@mmmbuto/nexuscrew 0.7.7 → 0.8.2
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/README.md +153 -25
- package/bin/nexuscrew.js +10 -4
- package/frontend/dist/assets/index-COsoJxXQ.css +32 -0
- package/frontend/dist/assets/index-Dey9rdY-.js +90 -0
- package/frontend/dist/assets/qr-scanner-worker.min-D85Z9gVD.js +98 -0
- package/frontend/dist/index.html +2 -2
- package/frontend/dist/sw.js +29 -0
- package/frontend/dist/version.json +1 -0
- package/lib/auth/middleware.js +7 -1
- package/lib/auth/token.js +31 -1
- package/lib/cli/commands.js +502 -43
- package/lib/cli/doctor.js +160 -0
- package/lib/cli/fleet-service.js +16 -3
- package/lib/cli/init.js +69 -11
- package/lib/cli/path.js +24 -0
- package/lib/cli/service.js +14 -8
- package/lib/cli/url.js +63 -0
- package/lib/config.js +5 -0
- package/lib/decks/routes.js +81 -0
- package/lib/decks/store.js +123 -0
- package/lib/files/routes.js +57 -1
- package/lib/files/store.js +16 -1
- package/lib/fleet/builtin.js +151 -24
- package/lib/fleet/definitions.js +26 -0
- package/lib/fleet/managed.js +381 -0
- package/lib/fleet/routes.js +5 -4
- package/lib/mcp/server.js +381 -0
- package/lib/nodes/commands.js +411 -0
- package/lib/nodes/peering.js +116 -0
- package/lib/nodes/store.js +425 -0
- package/lib/nodes/tunnel-supervisor.js +102 -0
- package/lib/nodes/tunnel.js +315 -0
- package/lib/notify/asks.js +150 -0
- package/lib/notify/events.js +59 -0
- package/lib/notify/notifier.js +37 -0
- package/lib/notify/persist.js +73 -0
- package/lib/notify/push.js +289 -0
- package/lib/notify/routes.js +260 -0
- package/lib/proxy/federation.js +217 -0
- package/lib/proxy/node-proxy.js +305 -0
- package/lib/pty/attach.js +34 -9
- package/lib/pty/provider.js +21 -6
- package/lib/server.js +291 -14
- package/lib/settings/routes.js +685 -0
- package/lib/ws/bridge.js +10 -1
- package/package.json +8 -2
- package/skills/nexuscrew-agent/SKILL.md +83 -0
- package/skills/nexuscrew-agent/bin/nc-deliver +23 -0
- package/skills/nexuscrew-agent/bin/nc-send +48 -0
- package/frontend/dist/assets/index-DUbtTZMj.css +0 -32
- package/frontend/dist/assets/index-EVa9bnAC.js +0 -81
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const n of s)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function i(s){const n={};return s.integrity&&(n.integrity=s.integrity),s.referrerPolicy&&(n.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?n.credentials="include":s.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function r(s){if(s.ep)return;s.ep=!0;const n=i(s);fetch(s.href,n)}})();function cm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ad={exports:{}},Co={},Id={exports:{}},ee={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ws=Symbol.for("react.element"),um=Symbol.for("react.portal"),dm=Symbol.for("react.fragment"),fm=Symbol.for("react.strict_mode"),_m=Symbol.for("react.profiler"),pm=Symbol.for("react.provider"),mm=Symbol.for("react.context"),vm=Symbol.for("react.forward_ref"),gm=Symbol.for("react.suspense"),Sm=Symbol.for("react.memo"),ym=Symbol.for("react.lazy"),Sc=Symbol.iterator;function wm(e){return e===null||typeof e!="object"?null:(e=Sc&&e[Sc]||e["@@iterator"],typeof e=="function"?e:null)}var zd={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$d=Object.assign,Fd={};function Ar(e,t,i){this.props=e,this.context=t,this.refs=Fd,this.updater=i||zd}Ar.prototype.isReactComponent={};Ar.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): 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")};Ar.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Hd(){}Hd.prototype=Ar.prototype;function uh(e,t,i){this.props=e,this.context=t,this.refs=Fd,this.updater=i||zd}var dh=uh.prototype=new Hd;dh.constructor=uh;$d(dh,Ar.prototype);dh.isPureReactComponent=!0;var yc=Array.isArray,jd=Object.prototype.hasOwnProperty,fh={current:null},Wd={key:!0,ref:!0,__self:!0,__source:!0};function Ud(e,t,i){var r,s={},n=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(n=""+t.key),t)jd.call(t,r)&&!Wd.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=i;else if(1<l){for(var a=Array(l),h=0;h<l;h++)a[h]=arguments[h+2];s.children=a}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:Ws,type:e,key:n,ref:o,props:s,_owner:fh.current}}function Cm(e,t){return{$$typeof:Ws,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function _h(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ws}function xm(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(i){return t[i]})}var wc=/\/+/g;function Uo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?xm(""+e.key):t.toString(36)}function kn(e,t,i,r,s){var n=typeof e;(n==="undefined"||n==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(n){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Ws:case um:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Uo(o,0):r,yc(s)?(i="",e!=null&&(i=e.replace(wc,"$&/")+"/"),kn(s,t,i,"",function(h){return h})):s!=null&&(_h(s)&&(s=Cm(s,i+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(wc,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",yc(e))for(var l=0;l<e.length;l++){n=e[l];var a=r+Uo(n,l);o+=kn(n,t,i,a,s)}else if(a=wm(e),typeof a=="function")for(e=a.call(e),l=0;!(n=e.next()).done;)n=n.value,a=r+Uo(n,l++),o+=kn(n,t,i,a,s);else if(n==="object")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 o}function Zs(e,t,i){if(e==null)return e;var r=[],s=0;return kn(e,r,"","",function(n){return t.call(i,n,s++)}),r}function km(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 Ze={current:null},bn={transition:null},bm={ReactCurrentDispatcher:Ze,ReactCurrentBatchConfig:bn,ReactCurrentOwner:fh};function Kd(){throw Error("act(...) is not supported in production builds of React.")}ee.Children={map:Zs,forEach:function(e,t,i){Zs(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return Zs(e,function(){t++}),t},toArray:function(e){return Zs(e,function(t){return t})||[]},only:function(e){if(!_h(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ee.Component=Ar;ee.Fragment=dm;ee.Profiler=_m;ee.PureComponent=uh;ee.StrictMode=fm;ee.Suspense=gm;ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bm;ee.act=Kd;ee.cloneElement=function(e,t,i){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=$d({},e.props),s=e.key,n=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(n=t.ref,o=fh.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)jd.call(t,a)&&!Wd.hasOwnProperty(a)&&(r[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)r.children=i;else if(1<a){l=Array(a);for(var h=0;h<a;h++)l[h]=arguments[h+2];r.children=l}return{$$typeof:Ws,type:e.type,key:s,ref:n,props:r,_owner:o}};ee.createContext=function(e){return e={$$typeof:mm,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:pm,_context:e},e.Consumer=e};ee.createElement=Ud;ee.createFactory=function(e){var t=Ud.bind(null,e);return t.type=e,t};ee.createRef=function(){return{current:null}};ee.forwardRef=function(e){return{$$typeof:vm,render:e}};ee.isValidElement=_h;ee.lazy=function(e){return{$$typeof:ym,_payload:{_status:-1,_result:e},_init:km}};ee.memo=function(e,t){return{$$typeof:Sm,type:e,compare:t===void 0?null:t}};ee.startTransition=function(e){var t=bn.transition;bn.transition={};try{e()}finally{bn.transition=t}};ee.unstable_act=Kd;ee.useCallback=function(e,t){return Ze.current.useCallback(e,t)};ee.useContext=function(e){return Ze.current.useContext(e)};ee.useDebugValue=function(){};ee.useDeferredValue=function(e){return Ze.current.useDeferredValue(e)};ee.useEffect=function(e,t){return Ze.current.useEffect(e,t)};ee.useId=function(){return Ze.current.useId()};ee.useImperativeHandle=function(e,t,i){return Ze.current.useImperativeHandle(e,t,i)};ee.useInsertionEffect=function(e,t){return Ze.current.useInsertionEffect(e,t)};ee.useLayoutEffect=function(e,t){return Ze.current.useLayoutEffect(e,t)};ee.useMemo=function(e,t){return Ze.current.useMemo(e,t)};ee.useReducer=function(e,t,i){return Ze.current.useReducer(e,t,i)};ee.useRef=function(e){return Ze.current.useRef(e)};ee.useState=function(e){return Ze.current.useState(e)};ee.useSyncExternalStore=function(e,t,i){return Ze.current.useSyncExternalStore(e,t,i)};ee.useTransition=function(){return Ze.current.useTransition()};ee.version="18.3.1";Id.exports=ee;var M=Id.exports;const Em=cm(M);/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Dm=M,Lm=Symbol.for("react.element"),Rm=Symbol.for("react.fragment"),Mm=Object.prototype.hasOwnProperty,Pm=Dm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Bm={key:!0,ref:!0,__self:!0,__source:!0};function Vd(e,t,i){var r,s={},n=null,o=null;i!==void 0&&(n=""+i),t.key!==void 0&&(n=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)Mm.call(t,r)&&!Bm.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:Lm,type:e,key:n,ref:o,props:s,_owner:Pm.current}}Co.Fragment=Rm;Co.jsx=Vd;Co.jsxs=Vd;Ad.exports=Co;var d=Ad.exports,Rl={},qd={exports:{}},vt={},Yd={exports:{}},Xd={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(y,L){var F=y.length;y.push(L);e:for(;0<F;){var q=F-1>>>1,Q=y[q];if(0<s(Q,L))y[q]=L,y[F]=Q,F=q;else break e}}function i(y){return y.length===0?null:y[0]}function r(y){if(y.length===0)return null;var L=y[0],F=y.pop();if(F!==L){y[0]=F;e:for(var q=0,Q=y.length,K=Q>>>1;q<K;){var X=2*(q+1)-1,ke=y[X],B=X+1,Y=y[B];if(0>s(ke,F))B<Q&&0>s(Y,ke)?(y[q]=Y,y[B]=F,q=B):(y[q]=ke,y[X]=F,q=X);else if(B<Q&&0>s(Y,F))y[q]=Y,y[B]=F,q=B;else break e}}return L}function s(y,L){var F=y.sortIndex-L.sortIndex;return F!==0?F:y.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var n=performance;e.unstable_now=function(){return n.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],h=[],f=1,c=null,u=3,p=!1,_=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(y){for(var L=i(h);L!==null;){if(L.callback===null)r(h);else if(L.startTime<=y)r(h),L.sortIndex=L.expirationTime,t(a,L);else break;L=i(h)}}function w(y){if(S=!1,g(y),!_)if(i(a)!==null)_=!0,P(x);else{var L=i(h);L!==null&&T(w,L.startTime-y)}}function x(y,L){_=!1,S&&(S=!1,m(N),N=-1),p=!0;var F=u;try{for(g(L),c=i(a);c!==null&&(!(c.expirationTime>L)||y&&!W());){var q=c.callback;if(typeof q=="function"){c.callback=null,u=c.priorityLevel;var Q=q(c.expirationTime<=L);L=e.unstable_now(),typeof Q=="function"?c.callback=Q:c===i(a)&&r(a),g(L)}else r(a);c=i(a)}if(c!==null)var K=!0;else{var X=i(h);X!==null&&T(w,X.startTime-L),K=!1}return K}finally{c=null,u=F,p=!1}}var b=!1,D=null,N=-1,V=5,H=-1;function W(){return!(e.unstable_now()-H<V)}function A(){if(D!==null){var y=e.unstable_now();H=y;var L=!0;try{L=D(!0,y)}finally{L?E():(b=!1,D=null)}}else b=!1}var E;if(typeof v=="function")E=function(){v(A)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,C=I.port2;I.port1.onmessage=A,E=function(){C.postMessage(null)}}else E=function(){k(A,0)};function P(y){D=y,b||(b=!0,E())}function T(y,L){N=k(function(){y(e.unstable_now())},L)}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(y){y.callback=null},e.unstable_continueExecution=function(){_||p||(_=!0,P(x))},e.unstable_forceFrameRate=function(y){0>y||125<y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<y?Math.floor(1e3/y):5},e.unstable_getCurrentPriorityLevel=function(){return u},e.unstable_getFirstCallbackNode=function(){return i(a)},e.unstable_next=function(y){switch(u){case 1:case 2:case 3:var L=3;break;default:L=u}var F=u;u=L;try{return y()}finally{u=F}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(y,L){switch(y){case 1:case 2:case 3:case 4:case 5:break;default:y=3}var F=u;u=y;try{return L()}finally{u=F}},e.unstable_scheduleCallback=function(y,L,F){var q=e.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?q+F:q):F=q,y){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=F+Q,y={id:f++,callback:L,priorityLevel:y,startTime:F,expirationTime:Q,sortIndex:-1},F>q?(y.sortIndex=F,t(h,y),i(a)===null&&y===i(h)&&(S?(m(N),N=-1):S=!0,T(w,F-q))):(y.sortIndex=Q,t(a,y),_||p||(_=!0,P(x))),y},e.unstable_shouldYield=W,e.unstable_wrapCallback=function(y){var L=u;return function(){var F=u;u=L;try{return y.apply(this,arguments)}finally{u=F}}}})(Xd);Yd.exports=Xd;var Nm=Yd.exports;/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var Tm=M,mt=Nm;function O(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;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."}var Gd=new Set,xs={};function ir(e,t){Lr(e,t),Lr(e+"Capture",t)}function Lr(e,t){for(xs[e]=t,e=0;e<t.length;e++)Gd.add(t[e])}var ii=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ml=Object.prototype.hasOwnProperty,Om=/^[: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]*$/,Cc={},xc={};function Am(e){return Ml.call(xc,e)?!0:Ml.call(Cc,e)?!1:Om.test(e)?xc[e]=!0:(Cc[e]=!0,!1)}function Im(e,t,i,r){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function zm(e,t,i,r){if(t===null||typeof t>"u"||Im(e,t,i,r))return!0;if(r)return!1;if(i!==null)switch(i.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function et(e,t,i,r,s,n,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=n,this.removeEmptyString=o}var Ue={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ue[e]=new et(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ue[t]=new et(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ue[e]=new et(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ue[e]=new et(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ue[e]=new et(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ue[e]=new et(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ue[e]=new et(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ue[e]=new et(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ue[e]=new et(e,5,!1,e.toLowerCase(),null,!1,!1)});var ph=/[\-:]([a-z])/g;function mh(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ph,mh);Ue[t]=new et(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ph,mh);Ue[t]=new et(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ph,mh);Ue[t]=new et(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ue[e]=new et(e,1,!1,e.toLowerCase(),null,!1,!1)});Ue.xlinkHref=new et("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ue[e]=new et(e,1,!1,e.toLowerCase(),null,!0,!0)});function vh(e,t,i,r){var s=Ue.hasOwnProperty(t)?Ue[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(zm(t,i,s,r)&&(i=null),r||s===null?Am(t)&&(i===null?e.removeAttribute(t):e.setAttribute(t,""+i)):s.mustUseProperty?e[s.propertyName]=i===null?s.type===3?!1:"":i:(t=s.attributeName,r=s.attributeNamespace,i===null?e.removeAttribute(t):(s=s.type,i=s===3||s===4&&i===!0?"":""+i,r?e.setAttributeNS(r,t,i):e.setAttribute(t,i))))}var oi=Tm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,en=Symbol.for("react.element"),hr=Symbol.for("react.portal"),cr=Symbol.for("react.fragment"),gh=Symbol.for("react.strict_mode"),Pl=Symbol.for("react.profiler"),Qd=Symbol.for("react.provider"),Jd=Symbol.for("react.context"),Sh=Symbol.for("react.forward_ref"),Bl=Symbol.for("react.suspense"),Nl=Symbol.for("react.suspense_list"),yh=Symbol.for("react.memo"),_i=Symbol.for("react.lazy"),Zd=Symbol.for("react.offscreen"),kc=Symbol.iterator;function Wr(e){return e===null||typeof e!="object"?null:(e=kc&&e[kc]||e["@@iterator"],typeof e=="function"?e:null)}var pe=Object.assign,Ko;function rs(e){if(Ko===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ko=t&&t[1]||""}return`
|
|
34
|
-
`+Ko+e}var Vo=!1;function qo(e,t){if(!e||Vo)return"";Vo=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(h){var r=h}Reflect.construct(e,[],t)}else{try{t.call()}catch(h){r=h}e.call(t.prototype)}else{try{throw Error()}catch(h){r=h}e()}}catch(h){if(h&&r&&typeof h.stack=="string"){for(var s=h.stack.split(`
|
|
35
|
-
`),n=r.stack.split(`
|
|
36
|
-
`),o=s.length-1,l=n.length-1;1<=o&&0<=l&&s[o]!==n[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==n[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==n[l]){var a=`
|
|
37
|
-
`+s[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Vo=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?rs(e):""}function $m(e){switch(e.tag){case 5:return rs(e.type);case 16:return rs("Lazy");case 13:return rs("Suspense");case 19:return rs("SuspenseList");case 0:case 2:case 15:return e=qo(e.type,!1),e;case 11:return e=qo(e.type.render,!1),e;case 1:return e=qo(e.type,!0),e;default:return""}}function Tl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case cr:return"Fragment";case hr:return"Portal";case Pl:return"Profiler";case gh:return"StrictMode";case Bl:return"Suspense";case Nl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Jd:return(e.displayName||"Context")+".Consumer";case Qd:return(e._context.displayName||"Context")+".Provider";case Sh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case yh:return t=e.displayName||null,t!==null?t:Tl(e.type)||"Memo";case _i:t=e._payload,e=e._init;try{return Tl(e(t))}catch{}}return null}function Fm(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Tl(t);case 8:return t===gh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Bi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ef(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Hm(e){var t=ef(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var s=i.get,n=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,n.call(this,o)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function tn(e){e._valueTracker||(e._valueTracker=Hm(e))}function tf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),r="";return e&&(r=ef(e)?e.checked?"true":"false":e.value),e=r,e!==i?(t.setValue(e),!0):!1}function Wn(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}}function Ol(e,t){var i=t.checked;return pe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function bc(e,t){var i=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;i=Bi(t.value!=null?t.value:i),e._wrapperState={initialChecked:r,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function rf(e,t){t=t.checked,t!=null&&vh(e,"checked",t,!1)}function Al(e,t){rf(e,t);var i=Bi(t.value),r=t.type;if(i!=null)r==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Il(e,t.type,i):t.hasOwnProperty("defaultValue")&&Il(e,t.type,Bi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ec(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function Il(e,t,i){(t!=="number"||Wn(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var ss=Array.isArray;function Cr(e,t,i,r){if(e=e.options,t){t={};for(var s=0;s<i.length;s++)t["$"+i[s]]=!0;for(i=0;i<e.length;i++)s=t.hasOwnProperty("$"+e[i].value),e[i].selected!==s&&(e[i].selected=s),s&&r&&(e[i].defaultSelected=!0)}else{for(i=""+Bi(i),t=null,s=0;s<e.length;s++){if(e[s].value===i){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function zl(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(O(91));return pe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Dc(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(O(92));if(ss(i)){if(1<i.length)throw Error(O(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:Bi(i)}}function sf(e,t){var i=Bi(t.value),r=Bi(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),r!=null&&(e.defaultValue=""+r)}function Lc(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function nf(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function $l(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?nf(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var rn,of=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,i,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,i,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(rn=rn||document.createElement("div"),rn.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=rn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ks(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var fs={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},jm=["Webkit","ms","Moz","O"];Object.keys(fs).forEach(function(e){jm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fs[t]=fs[e]})});function lf(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||fs.hasOwnProperty(e)&&fs[e]?(""+t).trim():t+"px"}function af(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var r=i.indexOf("--")===0,s=lf(i,t[i],r);i==="float"&&(i="cssFloat"),r?e.setProperty(i,s):e[i]=s}}var Wm=pe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Fl(e,t){if(t){if(Wm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(O(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(O(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(O(61))}if(t.style!=null&&typeof t.style!="object")throw Error(O(62))}}function Hl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 jl=null;function wh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wl=null,xr=null,kr=null;function Rc(e){if(e=Vs(e)){if(typeof Wl!="function")throw Error(O(280));var t=e.stateNode;t&&(t=Do(t),Wl(e.stateNode,e.type,t))}}function hf(e){xr?kr?kr.push(e):kr=[e]:xr=e}function cf(){if(xr){var e=xr,t=kr;if(kr=xr=null,Rc(e),t)for(e=0;e<t.length;e++)Rc(t[e])}}function uf(e,t){return e(t)}function df(){}var Yo=!1;function ff(e,t,i){if(Yo)return e(t,i);Yo=!0;try{return uf(e,t,i)}finally{Yo=!1,(xr!==null||kr!==null)&&(df(),cf())}}function bs(e,t){var i=e.stateNode;if(i===null)return null;var r=Do(i);if(r===null)return null;i=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(O(231,t,typeof i));return i}var Ul=!1;if(ii)try{var Ur={};Object.defineProperty(Ur,"passive",{get:function(){Ul=!0}}),window.addEventListener("test",Ur,Ur),window.removeEventListener("test",Ur,Ur)}catch{Ul=!1}function Um(e,t,i,r,s,n,o,l,a){var h=Array.prototype.slice.call(arguments,3);try{t.apply(i,h)}catch(f){this.onError(f)}}var _s=!1,Un=null,Kn=!1,Kl=null,Km={onError:function(e){_s=!0,Un=e}};function Vm(e,t,i,r,s,n,o,l,a){_s=!1,Un=null,Um.apply(Km,arguments)}function qm(e,t,i,r,s,n,o,l,a){if(Vm.apply(this,arguments),_s){if(_s){var h=Un;_s=!1,Un=null}else throw Error(O(198));Kn||(Kn=!0,Kl=h)}}function rr(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 _f(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 Mc(e){if(rr(e)!==e)throw Error(O(188))}function Ym(e){var t=e.alternate;if(!t){if(t=rr(e),t===null)throw Error(O(188));return t!==e?null:e}for(var i=e,r=t;;){var s=i.return;if(s===null)break;var n=s.alternate;if(n===null){if(r=s.return,r!==null){i=r;continue}break}if(s.child===n.child){for(n=s.child;n;){if(n===i)return Mc(s),e;if(n===r)return Mc(s),t;n=n.sibling}throw Error(O(188))}if(i.return!==r.return)i=s,r=n;else{for(var o=!1,l=s.child;l;){if(l===i){o=!0,i=s,r=n;break}if(l===r){o=!0,r=s,i=n;break}l=l.sibling}if(!o){for(l=n.child;l;){if(l===i){o=!0,i=n,r=s;break}if(l===r){o=!0,r=n,i=s;break}l=l.sibling}if(!o)throw Error(O(189))}}if(i.alternate!==r)throw Error(O(190))}if(i.tag!==3)throw Error(O(188));return i.stateNode.current===i?e:t}function pf(e){return e=Ym(e),e!==null?mf(e):null}function mf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=mf(e);if(t!==null)return t;e=e.sibling}return null}var vf=mt.unstable_scheduleCallback,Pc=mt.unstable_cancelCallback,Xm=mt.unstable_shouldYield,Gm=mt.unstable_requestPaint,ye=mt.unstable_now,Qm=mt.unstable_getCurrentPriorityLevel,Ch=mt.unstable_ImmediatePriority,gf=mt.unstable_UserBlockingPriority,Vn=mt.unstable_NormalPriority,Jm=mt.unstable_LowPriority,Sf=mt.unstable_IdlePriority,xo=null,Ut=null;function Zm(e){if(Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(xo,e,void 0,(e.current.flags&128)===128)}catch{}}var Tt=Math.clz32?Math.clz32:iv,ev=Math.log,tv=Math.LN2;function iv(e){return e>>>=0,e===0?32:31-(ev(e)/tv|0)|0}var sn=64,nn=4194304;function ns(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function qn(e,t){var i=e.pendingLanes;if(i===0)return 0;var r=0,s=e.suspendedLanes,n=e.pingedLanes,o=i&268435455;if(o!==0){var l=o&~s;l!==0?r=ns(l):(n&=o,n!==0&&(r=ns(n)))}else o=i&~s,o!==0?r=ns(o):n!==0&&(r=ns(n));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,n=t&-t,s>=n||s===16&&(n&4194240)!==0))return t;if(r&4&&(r|=i&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)i=31-Tt(t),s=1<<i,r|=e[i],t&=~s;return r}function rv(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function sv(e,t){for(var i=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,n=e.pendingLanes;0<n;){var o=31-Tt(n),l=1<<o,a=s[o];a===-1?(!(l&i)||l&r)&&(s[o]=rv(l,t)):a<=t&&(e.expiredLanes|=l),n&=~l}}function Vl(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function yf(){var e=sn;return sn<<=1,!(sn&4194240)&&(sn=64),e}function Xo(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function Us(e,t,i){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tt(t),e[t]=i}function nv(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<i;){var s=31-Tt(i),n=1<<s;t[s]=0,r[s]=-1,e[s]=-1,i&=~n}}function xh(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var r=31-Tt(i),s=1<<r;s&t|e[r]&t&&(e[r]|=t),i&=~s}}var re=0;function wf(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Cf,kh,xf,kf,bf,ql=!1,on=[],Ci=null,xi=null,ki=null,Es=new Map,Ds=new Map,vi=[],ov="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 submit".split(" ");function Bc(e,t){switch(e){case"focusin":case"focusout":Ci=null;break;case"dragenter":case"dragleave":xi=null;break;case"mouseover":case"mouseout":ki=null;break;case"pointerover":case"pointerout":Es.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ds.delete(t.pointerId)}}function Kr(e,t,i,r,s,n){return e===null||e.nativeEvent!==n?(e={blockedOn:t,domEventName:i,eventSystemFlags:r,nativeEvent:n,targetContainers:[s]},t!==null&&(t=Vs(t),t!==null&&kh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function lv(e,t,i,r,s){switch(t){case"focusin":return Ci=Kr(Ci,e,t,i,r,s),!0;case"dragenter":return xi=Kr(xi,e,t,i,r,s),!0;case"mouseover":return ki=Kr(ki,e,t,i,r,s),!0;case"pointerover":var n=s.pointerId;return Es.set(n,Kr(Es.get(n)||null,e,t,i,r,s)),!0;case"gotpointercapture":return n=s.pointerId,Ds.set(n,Kr(Ds.get(n)||null,e,t,i,r,s)),!0}return!1}function Ef(e){var t=ji(e.target);if(t!==null){var i=rr(t);if(i!==null){if(t=i.tag,t===13){if(t=_f(i),t!==null){e.blockedOn=t,bf(e.priority,function(){xf(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 En(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=Yl(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var r=new i.constructor(i.type,i);jl=r,i.target.dispatchEvent(r),jl=null}else return t=Vs(i),t!==null&&kh(t),e.blockedOn=i,!1;t.shift()}return!0}function Nc(e,t,i){En(e)&&i.delete(t)}function av(){ql=!1,Ci!==null&&En(Ci)&&(Ci=null),xi!==null&&En(xi)&&(xi=null),ki!==null&&En(ki)&&(ki=null),Es.forEach(Nc),Ds.forEach(Nc)}function Vr(e,t){e.blockedOn===t&&(e.blockedOn=null,ql||(ql=!0,mt.unstable_scheduleCallback(mt.unstable_NormalPriority,av)))}function Ls(e){function t(s){return Vr(s,e)}if(0<on.length){Vr(on[0],e);for(var i=1;i<on.length;i++){var r=on[i];r.blockedOn===e&&(r.blockedOn=null)}}for(Ci!==null&&Vr(Ci,e),xi!==null&&Vr(xi,e),ki!==null&&Vr(ki,e),Es.forEach(t),Ds.forEach(t),i=0;i<vi.length;i++)r=vi[i],r.blockedOn===e&&(r.blockedOn=null);for(;0<vi.length&&(i=vi[0],i.blockedOn===null);)Ef(i),i.blockedOn===null&&vi.shift()}var br=oi.ReactCurrentBatchConfig,Yn=!0;function hv(e,t,i,r){var s=re,n=br.transition;br.transition=null;try{re=1,bh(e,t,i,r)}finally{re=s,br.transition=n}}function cv(e,t,i,r){var s=re,n=br.transition;br.transition=null;try{re=4,bh(e,t,i,r)}finally{re=s,br.transition=n}}function bh(e,t,i,r){if(Yn){var s=Yl(e,t,i,r);if(s===null)nl(e,t,r,Xn,i),Bc(e,r);else if(lv(s,e,t,i,r))r.stopPropagation();else if(Bc(e,r),t&4&&-1<ov.indexOf(e)){for(;s!==null;){var n=Vs(s);if(n!==null&&Cf(n),n=Yl(e,t,i,r),n===null&&nl(e,t,r,Xn,i),n===s)break;s=n}s!==null&&r.stopPropagation()}else nl(e,t,r,null,i)}}var Xn=null;function Yl(e,t,i,r){if(Xn=null,e=wh(r),e=ji(e),e!==null)if(t=rr(e),t===null)e=null;else if(i=t.tag,i===13){if(e=_f(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 Xn=e,null}function Df(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Qm()){case Ch:return 1;case gf:return 4;case Vn:case Jm:return 16;case Sf:return 536870912;default:return 16}default:return 16}}var Si=null,Eh=null,Dn=null;function Lf(){if(Dn)return Dn;var e,t=Eh,i=t.length,r,s="value"in Si?Si.value:Si.textContent,n=s.length;for(e=0;e<i&&t[e]===s[e];e++);var o=i-e;for(r=1;r<=o&&t[i-r]===s[n-r];r++);return Dn=s.slice(e,1<r?1-r:void 0)}function Ln(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 ln(){return!0}function Tc(){return!1}function gt(e){function t(i,r,s,n,o){this._reactName=i,this._targetInst=s,this.type=r,this.nativeEvent=n,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(i=e[l],this[l]=i?i(n):n[l]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?ln:Tc,this.isPropagationStopped=Tc,this}return pe(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=ln)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=ln)},persist:function(){},isPersistent:ln}),t}var Ir={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dh=gt(Ir),Ks=pe({},Ir,{view:0,detail:0}),uv=gt(Ks),Go,Qo,qr,ko=pe({},Ks,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lh,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!==qr&&(qr&&e.type==="mousemove"?(Go=e.screenX-qr.screenX,Qo=e.screenY-qr.screenY):Qo=Go=0,qr=e),Go)},movementY:function(e){return"movementY"in e?e.movementY:Qo}}),Oc=gt(ko),dv=pe({},ko,{dataTransfer:0}),fv=gt(dv),_v=pe({},Ks,{relatedTarget:0}),Jo=gt(_v),pv=pe({},Ir,{animationName:0,elapsedTime:0,pseudoElement:0}),mv=gt(pv),vv=pe({},Ir,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),gv=gt(vv),Sv=pe({},Ir,{data:0}),Ac=gt(Sv),yv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wv={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"},Cv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Cv[e])?!!t[e]:!1}function Lh(){return xv}var kv=pe({},Ks,{key:function(e){if(e.key){var t=yv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ln(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lh,charCode:function(e){return e.type==="keypress"?Ln(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ln(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),bv=gt(kv),Ev=pe({},ko,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ic=gt(Ev),Dv=pe({},Ks,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lh}),Lv=gt(Dv),Rv=pe({},Ir,{propertyName:0,elapsedTime:0,pseudoElement:0}),Mv=gt(Rv),Pv=pe({},ko,{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}),Bv=gt(Pv),Nv=[9,13,27,32],Rh=ii&&"CompositionEvent"in window,ps=null;ii&&"documentMode"in document&&(ps=document.documentMode);var Tv=ii&&"TextEvent"in window&&!ps,Rf=ii&&(!Rh||ps&&8<ps&&11>=ps),zc=" ",$c=!1;function Mf(e,t){switch(e){case"keyup":return Nv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ur=!1;function Ov(e,t){switch(e){case"compositionend":return Pf(t);case"keypress":return t.which!==32?null:($c=!0,zc);case"textInput":return e=t.data,e===zc&&$c?null:e;default:return null}}function Av(e,t){if(ur)return e==="compositionend"||!Rh&&Mf(e,t)?(e=Lf(),Dn=Eh=Si=null,ur=!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 Rf&&t.locale!=="ko"?null:t.data;default:return null}}var Iv={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 Fc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Iv[e.type]:t==="textarea"}function Bf(e,t,i,r){hf(r),t=Gn(t,"onChange"),0<t.length&&(i=new Dh("onChange","change",null,i,r),e.push({event:i,listeners:t}))}var ms=null,Rs=null;function zv(e){Wf(e,0)}function bo(e){var t=_r(e);if(tf(t))return e}function $v(e,t){if(e==="change")return t}var Nf=!1;if(ii){var Zo;if(ii){var el="oninput"in document;if(!el){var Hc=document.createElement("div");Hc.setAttribute("oninput","return;"),el=typeof Hc.oninput=="function"}Zo=el}else Zo=!1;Nf=Zo&&(!document.documentMode||9<document.documentMode)}function jc(){ms&&(ms.detachEvent("onpropertychange",Tf),Rs=ms=null)}function Tf(e){if(e.propertyName==="value"&&bo(Rs)){var t=[];Bf(t,Rs,e,wh(e)),ff(zv,t)}}function Fv(e,t,i){e==="focusin"?(jc(),ms=t,Rs=i,ms.attachEvent("onpropertychange",Tf)):e==="focusout"&&jc()}function Hv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return bo(Rs)}function jv(e,t){if(e==="click")return bo(t)}function Wv(e,t){if(e==="input"||e==="change")return bo(t)}function Uv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var At=typeof Object.is=="function"?Object.is:Uv;function Ms(e,t){if(At(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(r=0;r<i.length;r++){var s=i[r];if(!Ml.call(t,s)||!At(e[s],t[s]))return!1}return!0}function Wc(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Uc(e,t){var i=Wc(e);e=0;for(var r;i;){if(i.nodeType===3){if(r=e+i.textContent.length,e<=t&&r>=t)return{node:i,offset:t-e};e=r}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Wc(i)}}function Of(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Of(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Af(){for(var e=window,t=Wn();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Wn(e.document)}return t}function Mh(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")}function Kv(e){var t=Af(),i=e.focusedElem,r=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&Of(i.ownerDocument.documentElement,i)){if(r!==null&&Mh(i)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if(e=(t=i.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=i.textContent.length,n=Math.min(r.start,s);r=r.end===void 0?n:Math.min(r.end,s),!e.extend&&n>r&&(s=r,r=n,n=s),s=Uc(i,n);var o=Uc(i,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),n>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=i;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<t.length;i++)e=t[i],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Vv=ii&&"documentMode"in document&&11>=document.documentMode,dr=null,Xl=null,vs=null,Gl=!1;function Kc(e,t,i){var r=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Gl||dr==null||dr!==Wn(r)||(r=dr,"selectionStart"in r&&Mh(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),vs&&Ms(vs,r)||(vs=r,r=Gn(Xl,"onSelect"),0<r.length&&(t=new Dh("onSelect","select",null,t,i),e.push({event:t,listeners:r}),t.target=dr)))}function an(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var fr={animationend:an("Animation","AnimationEnd"),animationiteration:an("Animation","AnimationIteration"),animationstart:an("Animation","AnimationStart"),transitionend:an("Transition","TransitionEnd")},tl={},If={};ii&&(If=document.createElement("div").style,"AnimationEvent"in window||(delete fr.animationend.animation,delete fr.animationiteration.animation,delete fr.animationstart.animation),"TransitionEvent"in window||delete fr.transitionend.transition);function Eo(e){if(tl[e])return tl[e];if(!fr[e])return e;var t=fr[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in If)return tl[e]=t[i];return e}var zf=Eo("animationend"),$f=Eo("animationiteration"),Ff=Eo("animationstart"),Hf=Eo("transitionend"),jf=new Map,Vc="abort auxClick 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(" ");function Ti(e,t){jf.set(e,t),ir(t,[e])}for(var il=0;il<Vc.length;il++){var rl=Vc[il],qv=rl.toLowerCase(),Yv=rl[0].toUpperCase()+rl.slice(1);Ti(qv,"on"+Yv)}Ti(zf,"onAnimationEnd");Ti($f,"onAnimationIteration");Ti(Ff,"onAnimationStart");Ti("dblclick","onDoubleClick");Ti("focusin","onFocus");Ti("focusout","onBlur");Ti(Hf,"onTransitionEnd");Lr("onMouseEnter",["mouseout","mouseover"]);Lr("onMouseLeave",["mouseout","mouseover"]);Lr("onPointerEnter",["pointerout","pointerover"]);Lr("onPointerLeave",["pointerout","pointerover"]);ir("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ir("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ir("onBeforeInput",["compositionend","keypress","textInput","paste"]);ir("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ir("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ir("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var os="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(" "),Xv=new Set("cancel close invalid load scroll toggle".split(" ").concat(os));function qc(e,t,i){var r=e.type||"unknown-event";e.currentTarget=i,qm(r,t,void 0,e),e.currentTarget=null}function Wf(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var r=e[i],s=r.event;r=r.listeners;e:{var n=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],a=l.instance,h=l.currentTarget;if(l=l.listener,a!==n&&s.isPropagationStopped())break e;qc(s,l,h),n=a}else for(o=0;o<r.length;o++){if(l=r[o],a=l.instance,h=l.currentTarget,l=l.listener,a!==n&&s.isPropagationStopped())break e;qc(s,l,h),n=a}}}if(Kn)throw e=Kl,Kn=!1,Kl=null,e}function oe(e,t){var i=t[ta];i===void 0&&(i=t[ta]=new Set);var r=e+"__bubble";i.has(r)||(Uf(t,e,2,!1),i.add(r))}function sl(e,t,i){var r=0;t&&(r|=4),Uf(i,e,r,t)}var hn="_reactListening"+Math.random().toString(36).slice(2);function Ps(e){if(!e[hn]){e[hn]=!0,Gd.forEach(function(i){i!=="selectionchange"&&(Xv.has(i)||sl(i,!1,e),sl(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[hn]||(t[hn]=!0,sl("selectionchange",!1,t))}}function Uf(e,t,i,r){switch(Df(t)){case 1:var s=hv;break;case 4:s=cv;break;default:s=bh}i=s.bind(null,t,i,e),s=void 0,!Ul||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,i,{capture:!0,passive:s}):e.addEventListener(t,i,!0):s!==void 0?e.addEventListener(t,i,{passive:s}):e.addEventListener(t,i,!1)}function nl(e,t,i,r,s){var n=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===s||a.nodeType===8&&a.parentNode===s))return;o=o.return}for(;l!==null;){if(o=ji(l),o===null)return;if(a=o.tag,a===5||a===6){r=n=o;continue e}l=l.parentNode}}r=r.return}ff(function(){var h=n,f=wh(i),c=[];e:{var u=jf.get(e);if(u!==void 0){var p=Dh,_=e;switch(e){case"keypress":if(Ln(i)===0)break e;case"keydown":case"keyup":p=bv;break;case"focusin":_="focus",p=Jo;break;case"focusout":_="blur",p=Jo;break;case"beforeblur":case"afterblur":p=Jo;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":p=Oc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=fv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Lv;break;case zf:case $f:case Ff:p=mv;break;case Hf:p=Mv;break;case"scroll":p=uv;break;case"wheel":p=Bv;break;case"copy":case"cut":case"paste":p=gv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Ic}var S=(t&4)!==0,k=!S&&e==="scroll",m=S?u!==null?u+"Capture":null:u;S=[];for(var v=h,g;v!==null;){g=v;var w=g.stateNode;if(g.tag===5&&w!==null&&(g=w,m!==null&&(w=bs(v,m),w!=null&&S.push(Bs(v,w,g)))),k)break;v=v.return}0<S.length&&(u=new p(u,_,null,i,f),c.push({event:u,listeners:S}))}}if(!(t&7)){e:{if(u=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",u&&i!==jl&&(_=i.relatedTarget||i.fromElement)&&(ji(_)||_[ri]))break e;if((p||u)&&(u=f.window===f?f:(u=f.ownerDocument)?u.defaultView||u.parentWindow:window,p?(_=i.relatedTarget||i.toElement,p=h,_=_?ji(_):null,_!==null&&(k=rr(_),_!==k||_.tag!==5&&_.tag!==6)&&(_=null)):(p=null,_=h),p!==_)){if(S=Oc,w="onMouseLeave",m="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(S=Ic,w="onPointerLeave",m="onPointerEnter",v="pointer"),k=p==null?u:_r(p),g=_==null?u:_r(_),u=new S(w,v+"leave",p,i,f),u.target=k,u.relatedTarget=g,w=null,ji(f)===h&&(S=new S(m,v+"enter",_,i,f),S.target=g,S.relatedTarget=k,w=S),k=w,p&&_)t:{for(S=p,m=_,v=0,g=S;g;g=or(g))v++;for(g=0,w=m;w;w=or(w))g++;for(;0<v-g;)S=or(S),v--;for(;0<g-v;)m=or(m),g--;for(;v--;){if(S===m||m!==null&&S===m.alternate)break t;S=or(S),m=or(m)}S=null}else S=null;p!==null&&Yc(c,u,p,S,!1),_!==null&&k!==null&&Yc(c,k,_,S,!0)}}e:{if(u=h?_r(h):window,p=u.nodeName&&u.nodeName.toLowerCase(),p==="select"||p==="input"&&u.type==="file")var x=$v;else if(Fc(u))if(Nf)x=Wv;else{x=Hv;var b=Fv}else(p=u.nodeName)&&p.toLowerCase()==="input"&&(u.type==="checkbox"||u.type==="radio")&&(x=jv);if(x&&(x=x(e,h))){Bf(c,x,i,f);break e}b&&b(e,u,h),e==="focusout"&&(b=u._wrapperState)&&b.controlled&&u.type==="number"&&Il(u,"number",u.value)}switch(b=h?_r(h):window,e){case"focusin":(Fc(b)||b.contentEditable==="true")&&(dr=b,Xl=h,vs=null);break;case"focusout":vs=Xl=dr=null;break;case"mousedown":Gl=!0;break;case"contextmenu":case"mouseup":case"dragend":Gl=!1,Kc(c,i,f);break;case"selectionchange":if(Vv)break;case"keydown":case"keyup":Kc(c,i,f)}var D;if(Rh)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else ur?Mf(e,i)&&(N="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(N="onCompositionStart");N&&(Rf&&i.locale!=="ko"&&(ur||N!=="onCompositionStart"?N==="onCompositionEnd"&&ur&&(D=Lf()):(Si=f,Eh="value"in Si?Si.value:Si.textContent,ur=!0)),b=Gn(h,N),0<b.length&&(N=new Ac(N,e,null,i,f),c.push({event:N,listeners:b}),D?N.data=D:(D=Pf(i),D!==null&&(N.data=D)))),(D=Tv?Ov(e,i):Av(e,i))&&(h=Gn(h,"onBeforeInput"),0<h.length&&(f=new Ac("onBeforeInput","beforeinput",null,i,f),c.push({event:f,listeners:h}),f.data=D))}Wf(c,t)})}function Bs(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Gn(e,t){for(var i=t+"Capture",r=[];e!==null;){var s=e,n=s.stateNode;s.tag===5&&n!==null&&(s=n,n=bs(e,i),n!=null&&r.unshift(Bs(e,n,s)),n=bs(e,t),n!=null&&r.push(Bs(e,n,s))),e=e.return}return r}function or(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Yc(e,t,i,r,s){for(var n=t._reactName,o=[];i!==null&&i!==r;){var l=i,a=l.alternate,h=l.stateNode;if(a!==null&&a===r)break;l.tag===5&&h!==null&&(l=h,s?(a=bs(i,n),a!=null&&o.unshift(Bs(i,a,l))):s||(a=bs(i,n),a!=null&&o.push(Bs(i,a,l)))),i=i.return}o.length!==0&&e.push({event:t,listeners:o})}var Gv=/\r\n?/g,Qv=/\u0000|\uFFFD/g;function Xc(e){return(typeof e=="string"?e:""+e).replace(Gv,`
|
|
38
|
-
`).replace(Qv,"")}function cn(e,t,i){if(t=Xc(t),Xc(e)!==t&&i)throw Error(O(425))}function Qn(){}var Ql=null,Jl=null;function Zl(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ea=typeof setTimeout=="function"?setTimeout:void 0,Jv=typeof clearTimeout=="function"?clearTimeout:void 0,Gc=typeof Promise=="function"?Promise:void 0,Zv=typeof queueMicrotask=="function"?queueMicrotask:typeof Gc<"u"?function(e){return Gc.resolve(null).then(e).catch(eg)}:ea;function eg(e){setTimeout(function(){throw e})}function ol(e,t){var i=t,r=0;do{var s=i.nextSibling;if(e.removeChild(i),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(r===0){e.removeChild(s),Ls(t);return}r--}else i!=="$"&&i!=="$?"&&i!=="$!"||r++;i=s}while(i);Ls(t)}function bi(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==="$?")break;if(t==="/$")return null}}return e}function Qc(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(t===0)return e;t--}else i==="/$"&&t++}e=e.previousSibling}return null}var zr=Math.random().toString(36).slice(2),jt="__reactFiber$"+zr,Ns="__reactProps$"+zr,ri="__reactContainer$"+zr,ta="__reactEvents$"+zr,tg="__reactListeners$"+zr,ig="__reactHandles$"+zr;function ji(e){var t=e[jt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[ri]||i[jt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Qc(e);e!==null;){if(i=e[jt])return i;e=Qc(e)}return t}e=i,i=e.parentNode}return null}function Vs(e){return e=e[jt]||e[ri],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function _r(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(O(33))}function Do(e){return e[Ns]||null}var ia=[],pr=-1;function Oi(e){return{current:e}}function ae(e){0>pr||(e.current=ia[pr],ia[pr]=null,pr--)}function ne(e,t){pr++,ia[pr]=e.current,e.current=t}var Ni={},Xe=Oi(Ni),lt=Oi(!1),Xi=Ni;function Rr(e,t){var i=e.type.contextTypes;if(!i)return Ni;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},n;for(n in i)s[n]=t[n];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function at(e){return e=e.childContextTypes,e!=null}function Jn(){ae(lt),ae(Xe)}function Jc(e,t,i){if(Xe.current!==Ni)throw Error(O(168));ne(Xe,t),ne(lt,i)}function Kf(e,t,i){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return i;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(O(108,Fm(e)||"Unknown",s));return pe({},i,r)}function Zn(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ni,Xi=Xe.current,ne(Xe,e),ne(lt,lt.current),!0}function Zc(e,t,i){var r=e.stateNode;if(!r)throw Error(O(169));i?(e=Kf(e,t,Xi),r.__reactInternalMemoizedMergedChildContext=e,ae(lt),ae(Xe),ne(Xe,e)):ae(lt),ne(lt,i)}var Qt=null,Lo=!1,ll=!1;function Vf(e){Qt===null?Qt=[e]:Qt.push(e)}function rg(e){Lo=!0,Vf(e)}function Ai(){if(!ll&&Qt!==null){ll=!0;var e=0,t=re;try{var i=Qt;for(re=1;e<i.length;e++){var r=i[e];do r=r(!0);while(r!==null)}Qt=null,Lo=!1}catch(s){throw Qt!==null&&(Qt=Qt.slice(e+1)),vf(Ch,Ai),s}finally{re=t,ll=!1}}return null}var mr=[],vr=0,eo=null,to=0,Ct=[],xt=0,Gi=null,Jt=1,Zt="";function zi(e,t){mr[vr++]=to,mr[vr++]=eo,eo=e,to=t}function qf(e,t,i){Ct[xt++]=Jt,Ct[xt++]=Zt,Ct[xt++]=Gi,Gi=e;var r=Jt;e=Zt;var s=32-Tt(r)-1;r&=~(1<<s),i+=1;var n=32-Tt(t)+s;if(30<n){var o=s-s%5;n=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Jt=1<<32-Tt(t)+s|i<<s|r,Zt=n+e}else Jt=1<<n|i<<s|r,Zt=e}function Ph(e){e.return!==null&&(zi(e,1),qf(e,1,0))}function Bh(e){for(;e===eo;)eo=mr[--vr],mr[vr]=null,to=mr[--vr],mr[vr]=null;for(;e===Gi;)Gi=Ct[--xt],Ct[xt]=null,Zt=Ct[--xt],Ct[xt]=null,Jt=Ct[--xt],Ct[xt]=null}var pt=null,ft=null,he=!1,Nt=null;function Yf(e,t){var i=kt(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,t=e.deletions,t===null?(e.deletions=[i],e.flags|=16):t.push(i)}function eu(e,t){switch(e.tag){case 5:var i=e.type;return t=t.nodeType!==1||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,pt=e,ft=bi(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,pt=e,ft=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(i=Gi!==null?{id:Jt,overflow:Zt}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},i=kt(18,null,null,0),i.stateNode=t,i.return=e,e.child=i,pt=e,ft=null,!0):!1;default:return!1}}function ra(e){return(e.mode&1)!==0&&(e.flags&128)===0}function sa(e){if(he){var t=ft;if(t){var i=t;if(!eu(e,t)){if(ra(e))throw Error(O(418));t=bi(i.nextSibling);var r=pt;t&&eu(e,t)?Yf(r,i):(e.flags=e.flags&-4097|2,he=!1,pt=e)}}else{if(ra(e))throw Error(O(418));e.flags=e.flags&-4097|2,he=!1,pt=e}}}function tu(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;pt=e}function un(e){if(e!==pt)return!1;if(!he)return tu(e),he=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Zl(e.type,e.memoizedProps)),t&&(t=ft)){if(ra(e))throw Xf(),Error(O(418));for(;t;)Yf(e,t),t=bi(t.nextSibling)}if(tu(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(O(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(t===0){ft=bi(e.nextSibling);break e}t--}else i!=="$"&&i!=="$!"&&i!=="$?"||t++}e=e.nextSibling}ft=null}}else ft=pt?bi(e.stateNode.nextSibling):null;return!0}function Xf(){for(var e=ft;e;)e=bi(e.nextSibling)}function Mr(){ft=pt=null,he=!1}function Nh(e){Nt===null?Nt=[e]:Nt.push(e)}var sg=oi.ReactCurrentBatchConfig;function Yr(e,t,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(O(309));var r=i.stateNode}if(!r)throw Error(O(147,e));var s=r,n=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===n?t.ref:(t=function(o){var l=s.refs;o===null?delete l[n]:l[n]=o},t._stringRef=n,t)}if(typeof e!="string")throw Error(O(284));if(!i._owner)throw Error(O(290,e))}return e}function dn(e,t){throw e=Object.prototype.toString.call(t),Error(O(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function iu(e){var t=e._init;return t(e._payload)}function Gf(e){function t(m,v){if(e){var g=m.deletions;g===null?(m.deletions=[v],m.flags|=16):g.push(v)}}function i(m,v){if(!e)return null;for(;v!==null;)t(m,v),v=v.sibling;return null}function r(m,v){for(m=new Map;v!==null;)v.key!==null?m.set(v.key,v):m.set(v.index,v),v=v.sibling;return m}function s(m,v){return m=Ri(m,v),m.index=0,m.sibling=null,m}function n(m,v,g){return m.index=g,e?(g=m.alternate,g!==null?(g=g.index,g<v?(m.flags|=2,v):g):(m.flags|=2,v)):(m.flags|=1048576,v)}function o(m){return e&&m.alternate===null&&(m.flags|=2),m}function l(m,v,g,w){return v===null||v.tag!==6?(v=_l(g,m.mode,w),v.return=m,v):(v=s(v,g),v.return=m,v)}function a(m,v,g,w){var x=g.type;return x===cr?f(m,v,g.props.children,w,g.key):v!==null&&(v.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===_i&&iu(x)===v.type)?(w=s(v,g.props),w.ref=Yr(m,v,g),w.return=m,w):(w=On(g.type,g.key,g.props,null,m.mode,w),w.ref=Yr(m,v,g),w.return=m,w)}function h(m,v,g,w){return v===null||v.tag!==4||v.stateNode.containerInfo!==g.containerInfo||v.stateNode.implementation!==g.implementation?(v=pl(g,m.mode,w),v.return=m,v):(v=s(v,g.children||[]),v.return=m,v)}function f(m,v,g,w,x){return v===null||v.tag!==7?(v=qi(g,m.mode,w,x),v.return=m,v):(v=s(v,g),v.return=m,v)}function c(m,v,g){if(typeof v=="string"&&v!==""||typeof v=="number")return v=_l(""+v,m.mode,g),v.return=m,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case en:return g=On(v.type,v.key,v.props,null,m.mode,g),g.ref=Yr(m,null,v),g.return=m,g;case hr:return v=pl(v,m.mode,g),v.return=m,v;case _i:var w=v._init;return c(m,w(v._payload),g)}if(ss(v)||Wr(v))return v=qi(v,m.mode,g,null),v.return=m,v;dn(m,v)}return null}function u(m,v,g,w){var x=v!==null?v.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return x!==null?null:l(m,v,""+g,w);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case en:return g.key===x?a(m,v,g,w):null;case hr:return g.key===x?h(m,v,g,w):null;case _i:return x=g._init,u(m,v,x(g._payload),w)}if(ss(g)||Wr(g))return x!==null?null:f(m,v,g,w,null);dn(m,g)}return null}function p(m,v,g,w,x){if(typeof w=="string"&&w!==""||typeof w=="number")return m=m.get(g)||null,l(v,m,""+w,x);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case en:return m=m.get(w.key===null?g:w.key)||null,a(v,m,w,x);case hr:return m=m.get(w.key===null?g:w.key)||null,h(v,m,w,x);case _i:var b=w._init;return p(m,v,g,b(w._payload),x)}if(ss(w)||Wr(w))return m=m.get(g)||null,f(v,m,w,x,null);dn(v,w)}return null}function _(m,v,g,w){for(var x=null,b=null,D=v,N=v=0,V=null;D!==null&&N<g.length;N++){D.index>N?(V=D,D=null):V=D.sibling;var H=u(m,D,g[N],w);if(H===null){D===null&&(D=V);break}e&&D&&H.alternate===null&&t(m,D),v=n(H,v,N),b===null?x=H:b.sibling=H,b=H,D=V}if(N===g.length)return i(m,D),he&&zi(m,N),x;if(D===null){for(;N<g.length;N++)D=c(m,g[N],w),D!==null&&(v=n(D,v,N),b===null?x=D:b.sibling=D,b=D);return he&&zi(m,N),x}for(D=r(m,D);N<g.length;N++)V=p(D,m,N,g[N],w),V!==null&&(e&&V.alternate!==null&&D.delete(V.key===null?N:V.key),v=n(V,v,N),b===null?x=V:b.sibling=V,b=V);return e&&D.forEach(function(W){return t(m,W)}),he&&zi(m,N),x}function S(m,v,g,w){var x=Wr(g);if(typeof x!="function")throw Error(O(150));if(g=x.call(g),g==null)throw Error(O(151));for(var b=x=null,D=v,N=v=0,V=null,H=g.next();D!==null&&!H.done;N++,H=g.next()){D.index>N?(V=D,D=null):V=D.sibling;var W=u(m,D,H.value,w);if(W===null){D===null&&(D=V);break}e&&D&&W.alternate===null&&t(m,D),v=n(W,v,N),b===null?x=W:b.sibling=W,b=W,D=V}if(H.done)return i(m,D),he&&zi(m,N),x;if(D===null){for(;!H.done;N++,H=g.next())H=c(m,H.value,w),H!==null&&(v=n(H,v,N),b===null?x=H:b.sibling=H,b=H);return he&&zi(m,N),x}for(D=r(m,D);!H.done;N++,H=g.next())H=p(D,m,N,H.value,w),H!==null&&(e&&H.alternate!==null&&D.delete(H.key===null?N:H.key),v=n(H,v,N),b===null?x=H:b.sibling=H,b=H);return e&&D.forEach(function(A){return t(m,A)}),he&&zi(m,N),x}function k(m,v,g,w){if(typeof g=="object"&&g!==null&&g.type===cr&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case en:e:{for(var x=g.key,b=v;b!==null;){if(b.key===x){if(x=g.type,x===cr){if(b.tag===7){i(m,b.sibling),v=s(b,g.props.children),v.return=m,m=v;break e}}else if(b.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===_i&&iu(x)===b.type){i(m,b.sibling),v=s(b,g.props),v.ref=Yr(m,b,g),v.return=m,m=v;break e}i(m,b);break}else t(m,b);b=b.sibling}g.type===cr?(v=qi(g.props.children,m.mode,w,g.key),v.return=m,m=v):(w=On(g.type,g.key,g.props,null,m.mode,w),w.ref=Yr(m,v,g),w.return=m,m=w)}return o(m);case hr:e:{for(b=g.key;v!==null;){if(v.key===b)if(v.tag===4&&v.stateNode.containerInfo===g.containerInfo&&v.stateNode.implementation===g.implementation){i(m,v.sibling),v=s(v,g.children||[]),v.return=m,m=v;break e}else{i(m,v);break}else t(m,v);v=v.sibling}v=pl(g,m.mode,w),v.return=m,m=v}return o(m);case _i:return b=g._init,k(m,v,b(g._payload),w)}if(ss(g))return _(m,v,g,w);if(Wr(g))return S(m,v,g,w);dn(m,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,v!==null&&v.tag===6?(i(m,v.sibling),v=s(v,g),v.return=m,m=v):(i(m,v),v=_l(g,m.mode,w),v.return=m,m=v),o(m)):i(m,v)}return k}var Pr=Gf(!0),Qf=Gf(!1),io=Oi(null),ro=null,gr=null,Th=null;function Oh(){Th=gr=ro=null}function Ah(e){var t=io.current;ae(io),e._currentValue=t}function na(e,t,i){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===i)break;e=e.return}}function Er(e,t){ro=e,Th=gr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ot=!0),e.firstContext=null)}function Dt(e){var t=e._currentValue;if(Th!==e)if(e={context:e,memoizedValue:t,next:null},gr===null){if(ro===null)throw Error(O(308));gr=e,ro.dependencies={lanes:0,firstContext:e}}else gr=gr.next=e;return t}var Wi=null;function Ih(e){Wi===null?Wi=[e]:Wi.push(e)}function Jf(e,t,i,r){var s=t.interleaved;return s===null?(i.next=i,Ih(t)):(i.next=s.next,s.next=i),t.interleaved=i,si(e,r)}function si(e,t){e.lanes|=t;var i=e.alternate;for(i!==null&&(i.lanes|=t),i=e,e=e.return;e!==null;)e.childLanes|=t,i=e.alternate,i!==null&&(i.childLanes|=t),i=e,e=e.return;return i.tag===3?i.stateNode:null}var pi=!1;function zh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Zf(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ti(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ei(e,t,i){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,te&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,si(e,i)}return s=r.interleaved,s===null?(t.next=t,Ih(r)):(t.next=s.next,s.next=t),r.interleaved=t,si(e,i)}function Rn(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,i|=r,t.lanes=i,xh(e,i)}}function ru(e,t){var i=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,i===r)){var s=null,n=null;if(i=i.firstBaseUpdate,i!==null){do{var o={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};n===null?s=n=o:n=n.next=o,i=i.next}while(i!==null);n===null?s=n=t:n=n.next=t}else s=n=t;i={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:n,shared:r.shared,effects:r.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function so(e,t,i,r){var s=e.updateQueue;pi=!1;var n=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var a=l,h=a.next;a.next=null,o===null?n=h:o.next=h,o=a;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==o&&(l===null?f.firstBaseUpdate=h:l.next=h,f.lastBaseUpdate=a))}if(n!==null){var c=s.baseState;o=0,f=h=a=null,l=n;do{var u=l.lane,p=l.eventTime;if((r&u)===u){f!==null&&(f=f.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var _=e,S=l;switch(u=t,p=i,S.tag){case 1:if(_=S.payload,typeof _=="function"){c=_.call(p,c,u);break e}c=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=S.payload,u=typeof _=="function"?_.call(p,c,u):_,u==null)break e;c=pe({},c,u);break e;case 2:pi=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,u=s.effects,u===null?s.effects=[l]:u.push(l))}else p={eventTime:p,lane:u,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(h=f=p,a=c):f=f.next=p,o|=u;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;u=l,l=u.next,u.next=null,s.lastBaseUpdate=u,s.shared.pending=null}}while(!0);if(f===null&&(a=c),s.baseState=a,s.firstBaseUpdate=h,s.lastBaseUpdate=f,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else n===null&&(s.shared.lanes=0);Ji|=o,e.lanes=o,e.memoizedState=c}}function su(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=i,typeof s!="function")throw Error(O(191,s));s.call(r)}}}var qs={},Kt=Oi(qs),Ts=Oi(qs),Os=Oi(qs);function Ui(e){if(e===qs)throw Error(O(174));return e}function $h(e,t){switch(ne(Os,t),ne(Ts,e),ne(Kt,qs),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:$l(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=$l(t,e)}ae(Kt),ne(Kt,t)}function Br(){ae(Kt),ae(Ts),ae(Os)}function e_(e){Ui(Os.current);var t=Ui(Kt.current),i=$l(t,e.type);t!==i&&(ne(Ts,e),ne(Kt,i))}function Fh(e){Ts.current===e&&(ae(Kt),ae(Ts))}var fe=Oi(0);function no(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){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 al=[];function Hh(){for(var e=0;e<al.length;e++)al[e]._workInProgressVersionPrimary=null;al.length=0}var Mn=oi.ReactCurrentDispatcher,hl=oi.ReactCurrentBatchConfig,Qi=0,_e=null,Le=null,Te=null,oo=!1,gs=!1,As=0,ng=0;function Ke(){throw Error(O(321))}function jh(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!At(e[i],t[i]))return!1;return!0}function Wh(e,t,i,r,s,n){if(Qi=n,_e=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Mn.current=e===null||e.memoizedState===null?hg:cg,e=i(r,s),gs){n=0;do{if(gs=!1,As=0,25<=n)throw Error(O(301));n+=1,Te=Le=null,t.updateQueue=null,Mn.current=ug,e=i(r,s)}while(gs)}if(Mn.current=lo,t=Le!==null&&Le.next!==null,Qi=0,Te=Le=_e=null,oo=!1,t)throw Error(O(300));return e}function Uh(){var e=As!==0;return As=0,e}function Ht(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Te===null?_e.memoizedState=Te=e:Te=Te.next=e,Te}function Lt(){if(Le===null){var e=_e.alternate;e=e!==null?e.memoizedState:null}else e=Le.next;var t=Te===null?_e.memoizedState:Te.next;if(t!==null)Te=t,Le=e;else{if(e===null)throw Error(O(310));Le=e,e={memoizedState:Le.memoizedState,baseState:Le.baseState,baseQueue:Le.baseQueue,queue:Le.queue,next:null},Te===null?_e.memoizedState=Te=e:Te=Te.next=e}return Te}function Is(e,t){return typeof t=="function"?t(e):t}function cl(e){var t=Lt(),i=t.queue;if(i===null)throw Error(O(311));i.lastRenderedReducer=e;var r=Le,s=r.baseQueue,n=i.pending;if(n!==null){if(s!==null){var o=s.next;s.next=n.next,n.next=o}r.baseQueue=s=n,i.pending=null}if(s!==null){n=s.next,r=r.baseState;var l=o=null,a=null,h=n;do{var f=h.lane;if((Qi&f)===f)a!==null&&(a=a.next={lane:0,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null}),r=h.hasEagerState?h.eagerState:e(r,h.action);else{var c={lane:f,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null};a===null?(l=a=c,o=r):a=a.next=c,_e.lanes|=f,Ji|=f}h=h.next}while(h!==null&&h!==n);a===null?o=r:a.next=l,At(r,t.memoizedState)||(ot=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=a,i.lastRenderedState=r}if(e=i.interleaved,e!==null){s=e;do n=s.lane,_e.lanes|=n,Ji|=n,s=s.next;while(s!==e)}else s===null&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function ul(e){var t=Lt(),i=t.queue;if(i===null)throw Error(O(311));i.lastRenderedReducer=e;var r=i.dispatch,s=i.pending,n=t.memoizedState;if(s!==null){i.pending=null;var o=s=s.next;do n=e(n,o.action),o=o.next;while(o!==s);At(n,t.memoizedState)||(ot=!0),t.memoizedState=n,t.baseQueue===null&&(t.baseState=n),i.lastRenderedState=n}return[n,r]}function t_(){}function i_(e,t){var i=_e,r=Lt(),s=t(),n=!At(r.memoizedState,s);if(n&&(r.memoizedState=s,ot=!0),r=r.queue,Kh(n_.bind(null,i,r,e),[e]),r.getSnapshot!==t||n||Te!==null&&Te.memoizedState.tag&1){if(i.flags|=2048,zs(9,s_.bind(null,i,r,s,t),void 0,null),ze===null)throw Error(O(349));Qi&30||r_(i,t,s)}return s}function r_(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=_e.updateQueue,t===null?(t={lastEffect:null,stores:null},_e.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function s_(e,t,i,r){t.value=i,t.getSnapshot=r,o_(t)&&l_(e)}function n_(e,t,i){return i(function(){o_(t)&&l_(e)})}function o_(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!At(e,i)}catch{return!0}}function l_(e){var t=si(e,1);t!==null&&Ot(t,e,1,-1)}function nu(e){var t=Ht();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Is,lastRenderedState:e},t.queue=e,e=e.dispatch=ag.bind(null,_e,e),[t.memoizedState,e]}function zs(e,t,i,r){return e={tag:e,create:t,destroy:i,deps:r,next:null},t=_e.updateQueue,t===null?(t={lastEffect:null,stores:null},_e.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(r=i.next,i.next=e,e.next=r,t.lastEffect=e)),e}function a_(){return Lt().memoizedState}function Pn(e,t,i,r){var s=Ht();_e.flags|=e,s.memoizedState=zs(1|t,i,void 0,r===void 0?null:r)}function Ro(e,t,i,r){var s=Lt();r=r===void 0?null:r;var n=void 0;if(Le!==null){var o=Le.memoizedState;if(n=o.destroy,r!==null&&jh(r,o.deps)){s.memoizedState=zs(t,i,n,r);return}}_e.flags|=e,s.memoizedState=zs(1|t,i,n,r)}function ou(e,t){return Pn(8390656,8,e,t)}function Kh(e,t){return Ro(2048,8,e,t)}function h_(e,t){return Ro(4,2,e,t)}function c_(e,t){return Ro(4,4,e,t)}function u_(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function d_(e,t,i){return i=i!=null?i.concat([e]):null,Ro(4,4,u_.bind(null,t,e),i)}function Vh(){}function f_(e,t){var i=Lt();t=t===void 0?null:t;var r=i.memoizedState;return r!==null&&t!==null&&jh(t,r[1])?r[0]:(i.memoizedState=[e,t],e)}function __(e,t){var i=Lt();t=t===void 0?null:t;var r=i.memoizedState;return r!==null&&t!==null&&jh(t,r[1])?r[0]:(e=e(),i.memoizedState=[e,t],e)}function p_(e,t,i){return Qi&21?(At(i,t)||(i=yf(),_e.lanes|=i,Ji|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ot=!0),e.memoizedState=i)}function og(e,t){var i=re;re=i!==0&&4>i?i:4,e(!0);var r=hl.transition;hl.transition={};try{e(!1),t()}finally{re=i,hl.transition=r}}function m_(){return Lt().memoizedState}function lg(e,t,i){var r=Li(e);if(i={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null},v_(e))g_(t,i);else if(i=Jf(e,t,i,r),i!==null){var s=Je();Ot(i,e,r,s),S_(i,t,r)}}function ag(e,t,i){var r=Li(e),s={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null};if(v_(e))g_(t,s);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var o=t.lastRenderedState,l=n(o,i);if(s.hasEagerState=!0,s.eagerState=l,At(l,o)){var a=t.interleaved;a===null?(s.next=s,Ih(t)):(s.next=a.next,a.next=s),t.interleaved=s;return}}catch{}finally{}i=Jf(e,t,s,r),i!==null&&(s=Je(),Ot(i,e,r,s),S_(i,t,r))}}function v_(e){var t=e.alternate;return e===_e||t!==null&&t===_e}function g_(e,t){gs=oo=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function S_(e,t,i){if(i&4194240){var r=t.lanes;r&=e.pendingLanes,i|=r,t.lanes=i,xh(e,i)}}var lo={readContext:Dt,useCallback:Ke,useContext:Ke,useEffect:Ke,useImperativeHandle:Ke,useInsertionEffect:Ke,useLayoutEffect:Ke,useMemo:Ke,useReducer:Ke,useRef:Ke,useState:Ke,useDebugValue:Ke,useDeferredValue:Ke,useTransition:Ke,useMutableSource:Ke,useSyncExternalStore:Ke,useId:Ke,unstable_isNewReconciler:!1},hg={readContext:Dt,useCallback:function(e,t){return Ht().memoizedState=[e,t===void 0?null:t],e},useContext:Dt,useEffect:ou,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,Pn(4194308,4,u_.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Pn(4194308,4,e,t)},useInsertionEffect:function(e,t){return Pn(4,2,e,t)},useMemo:function(e,t){var i=Ht();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var r=Ht();return t=i!==void 0?i(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=lg.bind(null,_e,e),[r.memoizedState,e]},useRef:function(e){var t=Ht();return e={current:e},t.memoizedState=e},useState:nu,useDebugValue:Vh,useDeferredValue:function(e){return Ht().memoizedState=e},useTransition:function(){var e=nu(!1),t=e[0];return e=og.bind(null,e[1]),Ht().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var r=_e,s=Ht();if(he){if(i===void 0)throw Error(O(407));i=i()}else{if(i=t(),ze===null)throw Error(O(349));Qi&30||r_(r,t,i)}s.memoizedState=i;var n={value:i,getSnapshot:t};return s.queue=n,ou(n_.bind(null,r,n,e),[e]),r.flags|=2048,zs(9,s_.bind(null,r,n,i,t),void 0,null),i},useId:function(){var e=Ht(),t=ze.identifierPrefix;if(he){var i=Zt,r=Jt;i=(r&~(1<<32-Tt(r)-1)).toString(32)+i,t=":"+t+"R"+i,i=As++,0<i&&(t+="H"+i.toString(32)),t+=":"}else i=ng++,t=":"+t+"r"+i.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},cg={readContext:Dt,useCallback:f_,useContext:Dt,useEffect:Kh,useImperativeHandle:d_,useInsertionEffect:h_,useLayoutEffect:c_,useMemo:__,useReducer:cl,useRef:a_,useState:function(){return cl(Is)},useDebugValue:Vh,useDeferredValue:function(e){var t=Lt();return p_(t,Le.memoizedState,e)},useTransition:function(){var e=cl(Is)[0],t=Lt().memoizedState;return[e,t]},useMutableSource:t_,useSyncExternalStore:i_,useId:m_,unstable_isNewReconciler:!1},ug={readContext:Dt,useCallback:f_,useContext:Dt,useEffect:Kh,useImperativeHandle:d_,useInsertionEffect:h_,useLayoutEffect:c_,useMemo:__,useReducer:ul,useRef:a_,useState:function(){return ul(Is)},useDebugValue:Vh,useDeferredValue:function(e){var t=Lt();return Le===null?t.memoizedState=e:p_(t,Le.memoizedState,e)},useTransition:function(){var e=ul(Is)[0],t=Lt().memoizedState;return[e,t]},useMutableSource:t_,useSyncExternalStore:i_,useId:m_,unstable_isNewReconciler:!1};function Pt(e,t){if(e&&e.defaultProps){t=pe({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i]);return t}return t}function oa(e,t,i,r){t=e.memoizedState,i=i(r,t),i=i==null?t:pe({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Mo={isMounted:function(e){return(e=e._reactInternals)?rr(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternals;var r=Je(),s=Li(e),n=ti(r,s);n.payload=t,i!=null&&(n.callback=i),t=Ei(e,n,s),t!==null&&(Ot(t,e,s,r),Rn(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var r=Je(),s=Li(e),n=ti(r,s);n.tag=1,n.payload=t,i!=null&&(n.callback=i),t=Ei(e,n,s),t!==null&&(Ot(t,e,s,r),Rn(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Je(),r=Li(e),s=ti(i,r);s.tag=2,t!=null&&(s.callback=t),t=Ei(e,s,r),t!==null&&(Ot(t,e,r,i),Rn(t,e,r))}};function lu(e,t,i,r,s,n,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,n,o):t.prototype&&t.prototype.isPureReactComponent?!Ms(i,r)||!Ms(s,n):!0}function y_(e,t,i){var r=!1,s=Ni,n=t.contextType;return typeof n=="object"&&n!==null?n=Dt(n):(s=at(t)?Xi:Xe.current,r=t.contextTypes,n=(r=r!=null)?Rr(e,s):Ni),t=new t(i,n),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Mo,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=n),t}function au(e,t,i,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,r),t.state!==e&&Mo.enqueueReplaceState(t,t.state,null)}function la(e,t,i,r){var s=e.stateNode;s.props=i,s.state=e.memoizedState,s.refs={},zh(e);var n=t.contextType;typeof n=="object"&&n!==null?s.context=Dt(n):(n=at(t)?Xi:Xe.current,s.context=Rr(e,n)),s.state=e.memoizedState,n=t.getDerivedStateFromProps,typeof n=="function"&&(oa(e,t,n,i),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Mo.enqueueReplaceState(s,s.state,null),so(e,i,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Nr(e,t){try{var i="",r=t;do i+=$m(r),r=r.return;while(r);var s=i}catch(n){s=`
|
|
39
|
-
Error generating stack: `+n.message+`
|
|
40
|
-
`+n.stack}return{value:e,source:t,stack:s,digest:null}}function dl(e,t,i){return{value:e,source:null,stack:i??null,digest:t??null}}function aa(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var dg=typeof WeakMap=="function"?WeakMap:Map;function w_(e,t,i){i=ti(-1,i),i.tag=3,i.payload={element:null};var r=t.value;return i.callback=function(){ho||(ho=!0,ga=r),aa(e,t)},i}function C_(e,t,i){i=ti(-1,i),i.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;i.payload=function(){return r(s)},i.callback=function(){aa(e,t)}}var n=e.stateNode;return n!==null&&typeof n.componentDidCatch=="function"&&(i.callback=function(){aa(e,t),typeof r!="function"&&(Di===null?Di=new Set([this]):Di.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),i}function hu(e,t,i){var r=e.pingCache;if(r===null){r=e.pingCache=new dg;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(i)||(s.add(i),e=Eg.bind(null,e,t,i),t.then(e,e))}function cu(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function uu(e,t,i,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(t=ti(-1,1),t.tag=2,Ei(i,t,1))),i.lanes|=1),e)}var fg=oi.ReactCurrentOwner,ot=!1;function Qe(e,t,i,r){t.child=e===null?Qf(t,null,i,r):Pr(t,e.child,i,r)}function du(e,t,i,r,s){i=i.render;var n=t.ref;return Er(t,s),r=Wh(e,t,i,r,n,s),i=Uh(),e!==null&&!ot?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ni(e,t,s)):(he&&i&&Ph(t),t.flags|=1,Qe(e,t,r,s),t.child)}function fu(e,t,i,r,s){if(e===null){var n=i.type;return typeof n=="function"&&!ec(n)&&n.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=n,x_(e,t,n,r,s)):(e=On(i.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(n=e.child,!(e.lanes&s)){var o=n.memoizedProps;if(i=i.compare,i=i!==null?i:Ms,i(o,r)&&e.ref===t.ref)return ni(e,t,s)}return t.flags|=1,e=Ri(n,r),e.ref=t.ref,e.return=t,t.child=e}function x_(e,t,i,r,s){if(e!==null){var n=e.memoizedProps;if(Ms(n,r)&&e.ref===t.ref)if(ot=!1,t.pendingProps=r=n,(e.lanes&s)!==0)e.flags&131072&&(ot=!0);else return t.lanes=e.lanes,ni(e,t,s)}return ha(e,t,i,r,s)}function k_(e,t,i){var r=t.pendingProps,s=r.children,n=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ne(yr,dt),dt|=i;else{if(!(i&1073741824))return e=n!==null?n.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ne(yr,dt),dt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=n!==null?n.baseLanes:i,ne(yr,dt),dt|=r}else n!==null?(r=n.baseLanes|i,t.memoizedState=null):r=i,ne(yr,dt),dt|=r;return Qe(e,t,s,i),t.child}function b_(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function ha(e,t,i,r,s){var n=at(i)?Xi:Xe.current;return n=Rr(t,n),Er(t,s),i=Wh(e,t,i,r,n,s),r=Uh(),e!==null&&!ot?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ni(e,t,s)):(he&&r&&Ph(t),t.flags|=1,Qe(e,t,i,s),t.child)}function _u(e,t,i,r,s){if(at(i)){var n=!0;Zn(t)}else n=!1;if(Er(t,s),t.stateNode===null)Bn(e,t),y_(t,i,r),la(t,i,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var a=o.context,h=i.contextType;typeof h=="object"&&h!==null?h=Dt(h):(h=at(i)?Xi:Xe.current,h=Rr(t,h));var f=i.getDerivedStateFromProps,c=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function";c||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||a!==h)&&au(t,o,r,h),pi=!1;var u=t.memoizedState;o.state=u,so(t,r,o,s),a=t.memoizedState,l!==r||u!==a||lt.current||pi?(typeof f=="function"&&(oa(t,i,f,r),a=t.memoizedState),(l=pi||lu(t,i,l,r,u,a,h))?(c||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=a),o.props=r,o.state=a,o.context=h,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Zf(e,t),l=t.memoizedProps,h=t.type===t.elementType?l:Pt(t.type,l),o.props=h,c=t.pendingProps,u=o.context,a=i.contextType,typeof a=="object"&&a!==null?a=Dt(a):(a=at(i)?Xi:Xe.current,a=Rr(t,a));var p=i.getDerivedStateFromProps;(f=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==c||u!==a)&&au(t,o,r,a),pi=!1,u=t.memoizedState,o.state=u,so(t,r,o,s);var _=t.memoizedState;l!==c||u!==_||lt.current||pi?(typeof p=="function"&&(oa(t,i,p,r),_=t.memoizedState),(h=pi||lu(t,i,h,r,u,_,a)||!1)?(f||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,_,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,_,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&u===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&u===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=_),o.props=r,o.state=_,o.context=a,r=h):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&u===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&u===e.memoizedState||(t.flags|=1024),r=!1)}return ca(e,t,i,r,n,s)}function ca(e,t,i,r,s,n){b_(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&Zc(t,i,!1),ni(e,t,n);r=t.stateNode,fg.current=t;var l=o&&typeof i.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Pr(t,e.child,null,n),t.child=Pr(t,null,l,n)):Qe(e,t,l,n),t.memoizedState=r.state,s&&Zc(t,i,!0),t.child}function E_(e){var t=e.stateNode;t.pendingContext?Jc(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Jc(e,t.context,!1),$h(e,t.containerInfo)}function pu(e,t,i,r,s){return Mr(),Nh(s),t.flags|=256,Qe(e,t,i,r),t.child}var ua={dehydrated:null,treeContext:null,retryLane:0};function da(e){return{baseLanes:e,cachePool:null,transitions:null}}function D_(e,t,i){var r=t.pendingProps,s=fe.current,n=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(n=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),ne(fe,s&1),e===null)return sa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,n?(r=t.mode,n=t.child,o={mode:"hidden",children:o},!(r&1)&&n!==null?(n.childLanes=0,n.pendingProps=o):n=No(o,r,0,null),e=qi(e,r,i,null),n.return=t,e.return=t,n.sibling=e,t.child=n,t.child.memoizedState=da(i),t.memoizedState=ua,e):qh(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return _g(e,t,o,r,l,s,i);if(n){n=r.fallback,o=t.mode,s=e.child,l=s.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=Ri(s,a),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?n=Ri(l,n):(n=qi(n,o,i,null),n.flags|=2),n.return=t,r.return=t,r.sibling=n,t.child=r,r=n,n=t.child,o=e.child.memoizedState,o=o===null?da(i):{baseLanes:o.baseLanes|i,cachePool:null,transitions:o.transitions},n.memoizedState=o,n.childLanes=e.childLanes&~i,t.memoizedState=ua,r}return n=e.child,e=n.sibling,r=Ri(n,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=i),r.return=t,r.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=r,t.memoizedState=null,r}function qh(e,t){return t=No({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function fn(e,t,i,r){return r!==null&&Nh(r),Pr(t,e.child,null,i),e=qh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _g(e,t,i,r,s,n,o){if(i)return t.flags&256?(t.flags&=-257,r=dl(Error(O(422))),fn(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(n=r.fallback,s=t.mode,r=No({mode:"visible",children:r.children},s,0,null),n=qi(n,s,o,null),n.flags|=2,r.return=t,n.return=t,r.sibling=n,t.child=r,t.mode&1&&Pr(t,e.child,null,o),t.child.memoizedState=da(o),t.memoizedState=ua,n);if(!(t.mode&1))return fn(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,n=Error(O(419)),r=dl(n,r,void 0),fn(e,t,o,r)}if(l=(o&e.childLanes)!==0,ot||l){if(r=ze,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==n.retryLane&&(n.retryLane=s,si(e,s),Ot(r,e,s,-1))}return Zh(),r=dl(Error(O(421))),fn(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=Dg.bind(null,e),s._reactRetry=t,null):(e=n.treeContext,ft=bi(s.nextSibling),pt=t,he=!0,Nt=null,e!==null&&(Ct[xt++]=Jt,Ct[xt++]=Zt,Ct[xt++]=Gi,Jt=e.id,Zt=e.overflow,Gi=t),t=qh(t,r.children),t.flags|=4096,t)}function mu(e,t,i){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),na(e.return,t,i)}function fl(e,t,i,r,s){var n=e.memoizedState;n===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:i,tailMode:s}:(n.isBackwards=t,n.rendering=null,n.renderingStartTime=0,n.last=r,n.tail=i,n.tailMode=s)}function L_(e,t,i){var r=t.pendingProps,s=r.revealOrder,n=r.tail;if(Qe(e,t,r.children,i),r=fe.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&mu(e,i,t);else if(e.tag===19)mu(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}r&=1}if(ne(fe,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(i=t.child,s=null;i!==null;)e=i.alternate,e!==null&&no(e)===null&&(s=i),i=i.sibling;i=s,i===null?(s=t.child,t.child=null):(s=i.sibling,i.sibling=null),fl(t,!1,s,i,n);break;case"backwards":for(i=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&no(e)===null){t.child=s;break}e=s.sibling,s.sibling=i,i=s,s=e}fl(t,!0,i,null,n);break;case"together":fl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Bn(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ni(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Ji|=t.lanes,!(i&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(O(153));if(t.child!==null){for(e=t.child,i=Ri(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Ri(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function pg(e,t,i){switch(t.tag){case 3:E_(t),Mr();break;case 5:e_(t);break;case 1:at(t.type)&&Zn(t);break;case 4:$h(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;ne(io,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ne(fe,fe.current&1),t.flags|=128,null):i&t.child.childLanes?D_(e,t,i):(ne(fe,fe.current&1),e=ni(e,t,i),e!==null?e.sibling:null);ne(fe,fe.current&1);break;case 19:if(r=(i&t.childLanes)!==0,e.flags&128){if(r)return L_(e,t,i);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ne(fe,fe.current),r)break;return null;case 22:case 23:return t.lanes=0,k_(e,t,i)}return ni(e,t,i)}var R_,fa,M_,P_;R_=function(e,t){for(var i=t.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};fa=function(){};M_=function(e,t,i,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Ui(Kt.current);var n=null;switch(i){case"input":s=Ol(e,s),r=Ol(e,r),n=[];break;case"select":s=pe({},s,{value:void 0}),r=pe({},r,{value:void 0}),n=[];break;case"textarea":s=zl(e,s),r=zl(e,r),n=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Qn)}Fl(i,r);var o;i=null;for(h in s)if(!r.hasOwnProperty(h)&&s.hasOwnProperty(h)&&s[h]!=null)if(h==="style"){var l=s[h];for(o in l)l.hasOwnProperty(o)&&(i||(i={}),i[o]="")}else h!=="dangerouslySetInnerHTML"&&h!=="children"&&h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(xs.hasOwnProperty(h)?n||(n=[]):(n=n||[]).push(h,null));for(h in r){var a=r[h];if(l=s!=null?s[h]:void 0,r.hasOwnProperty(h)&&a!==l&&(a!=null||l!=null))if(h==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(i||(i={}),i[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(i||(i={}),i[o]=a[o])}else i||(n||(n=[]),n.push(h,i)),i=a;else h==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(n=n||[]).push(h,a)):h==="children"?typeof a!="string"&&typeof a!="number"||(n=n||[]).push(h,""+a):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&(xs.hasOwnProperty(h)?(a!=null&&h==="onScroll"&&oe("scroll",e),n||l===a||(n=[])):(n=n||[]).push(h,a))}i&&(n=n||[]).push("style",i);var h=n;(t.updateQueue=h)&&(t.flags|=4)}};P_=function(e,t,i,r){i!==r&&(t.flags|=4)};function Xr(e,t){if(!he)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 r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ve(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,r=0;if(t)for(var s=e.child;s!==null;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=i,t}function mg(e,t,i){var r=t.pendingProps;switch(Bh(t),t.tag){case 2: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 at(t.type)&&Jn(),Ve(t),null;case 3:return r=t.stateNode,Br(),ae(lt),ae(Xe),Hh(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(un(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Nt!==null&&(wa(Nt),Nt=null))),fa(e,t),Ve(t),null;case 5:Fh(t);var s=Ui(Os.current);if(i=t.type,e!==null&&t.stateNode!=null)M_(e,t,i,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(O(166));return Ve(t),null}if(e=Ui(Kt.current),un(t)){r=t.stateNode,i=t.type;var n=t.memoizedProps;switch(r[jt]=t,r[Ns]=n,e=(t.mode&1)!==0,i){case"dialog":oe("cancel",r),oe("close",r);break;case"iframe":case"object":case"embed":oe("load",r);break;case"video":case"audio":for(s=0;s<os.length;s++)oe(os[s],r);break;case"source":oe("error",r);break;case"img":case"image":case"link":oe("error",r),oe("load",r);break;case"details":oe("toggle",r);break;case"input":bc(r,n),oe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!n.multiple},oe("invalid",r);break;case"textarea":Dc(r,n),oe("invalid",r)}Fl(i,n),s=null;for(var o in n)if(n.hasOwnProperty(o)){var l=n[o];o==="children"?typeof l=="string"?r.textContent!==l&&(n.suppressHydrationWarning!==!0&&cn(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(n.suppressHydrationWarning!==!0&&cn(r.textContent,l,e),s=["children",""+l]):xs.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&oe("scroll",r)}switch(i){case"input":tn(r),Ec(r,n,!0);break;case"textarea":tn(r),Lc(r);break;case"select":case"option":break;default:typeof n.onClick=="function"&&(r.onclick=Qn)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=nf(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(i,{is:r.is}):(e=o.createElement(i),i==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,i),e[jt]=t,e[Ns]=r,R_(e,t,!1,!1),t.stateNode=e;e:{switch(o=Hl(i,r),i){case"dialog":oe("cancel",e),oe("close",e),s=r;break;case"iframe":case"object":case"embed":oe("load",e),s=r;break;case"video":case"audio":for(s=0;s<os.length;s++)oe(os[s],e);s=r;break;case"source":oe("error",e),s=r;break;case"img":case"image":case"link":oe("error",e),oe("load",e),s=r;break;case"details":oe("toggle",e),s=r;break;case"input":bc(e,r),s=Ol(e,r),oe("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=pe({},r,{value:void 0}),oe("invalid",e);break;case"textarea":Dc(e,r),s=zl(e,r),oe("invalid",e);break;default:s=r}Fl(i,s),l=s;for(n in l)if(l.hasOwnProperty(n)){var a=l[n];n==="style"?af(e,a):n==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&of(e,a)):n==="children"?typeof a=="string"?(i!=="textarea"||a!=="")&&ks(e,a):typeof a=="number"&&ks(e,""+a):n!=="suppressContentEditableWarning"&&n!=="suppressHydrationWarning"&&n!=="autoFocus"&&(xs.hasOwnProperty(n)?a!=null&&n==="onScroll"&&oe("scroll",e):a!=null&&vh(e,n,a,o))}switch(i){case"input":tn(e),Ec(e,r,!1);break;case"textarea":tn(e),Lc(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Bi(r.value));break;case"select":e.multiple=!!r.multiple,n=r.value,n!=null?Cr(e,!!r.multiple,n,!1):r.defaultValue!=null&&Cr(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Qn)}switch(i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ve(t),null;case 6:if(e&&t.stateNode!=null)P_(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(O(166));if(i=Ui(Os.current),Ui(Kt.current),un(t)){if(r=t.stateNode,i=t.memoizedProps,r[jt]=t,(n=r.nodeValue!==i)&&(e=pt,e!==null))switch(e.tag){case 3:cn(r.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&cn(r.nodeValue,i,(e.mode&1)!==0)}n&&(t.flags|=4)}else r=(i.nodeType===9?i:i.ownerDocument).createTextNode(r),r[jt]=t,t.stateNode=r}return Ve(t),null;case 13:if(ae(fe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(he&&ft!==null&&t.mode&1&&!(t.flags&128))Xf(),Mr(),t.flags|=98560,n=!1;else if(n=un(t),r!==null&&r.dehydrated!==null){if(e===null){if(!n)throw Error(O(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(O(317));n[jt]=t}else Mr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ve(t),n=!1}else Nt!==null&&(wa(Nt),Nt=null),n=!0;if(!n)return t.flags&65536?t:null}return t.flags&128?(t.lanes=i,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||fe.current&1?Me===0&&(Me=3):Zh())),t.updateQueue!==null&&(t.flags|=4),Ve(t),null);case 4:return Br(),fa(e,t),e===null&&Ps(t.stateNode.containerInfo),Ve(t),null;case 10:return Ah(t.type._context),Ve(t),null;case 17:return at(t.type)&&Jn(),Ve(t),null;case 19:if(ae(fe),n=t.memoizedState,n===null)return Ve(t),null;if(r=(t.flags&128)!==0,o=n.rendering,o===null)if(r)Xr(n,!1);else{if(Me!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=no(e),o!==null){for(t.flags|=128,Xr(n,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=i,i=t.child;i!==null;)n=i,e=r,n.flags&=14680066,o=n.alternate,o===null?(n.childLanes=0,n.lanes=e,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,e=o.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return ne(fe,fe.current&1|2),t.child}e=e.sibling}n.tail!==null&&ye()>Tr&&(t.flags|=128,r=!0,Xr(n,!1),t.lanes=4194304)}else{if(!r)if(e=no(o),e!==null){if(t.flags|=128,r=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),Xr(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!he)return Ve(t),null}else 2*ye()-n.renderingStartTime>Tr&&i!==1073741824&&(t.flags|=128,r=!0,Xr(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(i=n.last,i!==null?i.sibling=o:t.child=o,n.last=o)}return n.tail!==null?(t=n.tail,n.rendering=t,n.tail=t.sibling,n.renderingStartTime=ye(),t.sibling=null,i=fe.current,ne(fe,r?i&1|2:i&1),t):(Ve(t),null);case 22:case 23:return Jh(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?dt&1073741824&&(Ve(t),t.subtreeFlags&6&&(t.flags|=8192)):Ve(t),null;case 24:return null;case 25:return null}throw Error(O(156,t.tag))}function vg(e,t){switch(Bh(t),t.tag){case 1:return at(t.type)&&Jn(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Br(),ae(lt),ae(Xe),Hh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Fh(t),null;case 13:if(ae(fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(O(340));Mr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ae(fe),null;case 4:return Br(),null;case 10:return Ah(t.type._context),null;case 22:case 23:return Jh(),null;case 24:return null;default:return null}}var _n=!1,Ye=!1,gg=typeof WeakSet=="function"?WeakSet:Set,U=null;function Sr(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(r){ve(e,t,r)}else i.current=null}function _a(e,t,i){try{i()}catch(r){ve(e,t,r)}}var vu=!1;function Sg(e,t){if(Ql=Yn,e=Af(),Mh(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var r=i.getSelection&&i.getSelection();if(r&&r.rangeCount!==0){i=r.anchorNode;var s=r.anchorOffset,n=r.focusNode;r=r.focusOffset;try{i.nodeType,n.nodeType}catch{i=null;break e}var o=0,l=-1,a=-1,h=0,f=0,c=e,u=null;t:for(;;){for(var p;c!==i||s!==0&&c.nodeType!==3||(l=o+s),c!==n||r!==0&&c.nodeType!==3||(a=o+r),c.nodeType===3&&(o+=c.nodeValue.length),(p=c.firstChild)!==null;)u=c,c=p;for(;;){if(c===e)break t;if(u===i&&++h===s&&(l=o),u===n&&++f===r&&(a=o),(p=c.nextSibling)!==null)break;c=u,u=c.parentNode}c=p}i=l===-1||a===-1?null:{start:l,end:a}}else i=null}i=i||{start:0,end:0}}else i=null;for(Jl={focusedElem:e,selectionRange:i},Yn=!1,U=t;U!==null;)if(t=U,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,U=e;else for(;U!==null;){t=U;try{var _=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(_!==null){var S=_.memoizedProps,k=_.memoizedState,m=t.stateNode,v=m.getSnapshotBeforeUpdate(t.elementType===t.type?S:Pt(t.type,S),k);m.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(O(163))}}catch(w){ve(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,U=e;break}U=t.return}return _=vu,vu=!1,_}function Ss(e,t,i){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var n=s.destroy;s.destroy=void 0,n!==void 0&&_a(t,i,n)}s=s.next}while(s!==r)}}function Po(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var r=i.create;i.destroy=r()}i=i.next}while(i!==t)}}function pa(e){var t=e.ref;if(t!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof t=="function"?t(e):t.current=e}}function B_(e){var t=e.alternate;t!==null&&(e.alternate=null,B_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[jt],delete t[Ns],delete t[ta],delete t[tg],delete t[ig])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function N_(e){return e.tag===5||e.tag===3||e.tag===4}function gu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||N_(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.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 ma(e,t,i){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Qn));else if(r!==4&&(e=e.child,e!==null))for(ma(e,t,i),e=e.sibling;e!==null;)ma(e,t,i),e=e.sibling}function va(e,t,i){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(va(e,t,i),e=e.sibling;e!==null;)va(e,t,i),e=e.sibling}var Fe=null,Bt=!1;function ci(e,t,i){for(i=i.child;i!==null;)T_(e,t,i),i=i.sibling}function T_(e,t,i){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(xo,i)}catch{}switch(i.tag){case 5:Ye||Sr(i,t);case 6:var r=Fe,s=Bt;Fe=null,ci(e,t,i),Fe=r,Bt=s,Fe!==null&&(Bt?(e=Fe,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):Fe.removeChild(i.stateNode));break;case 18:Fe!==null&&(Bt?(e=Fe,i=i.stateNode,e.nodeType===8?ol(e.parentNode,i):e.nodeType===1&&ol(e,i),Ls(e)):ol(Fe,i.stateNode));break;case 4:r=Fe,s=Bt,Fe=i.stateNode.containerInfo,Bt=!0,ci(e,t,i),Fe=r,Bt=s;break;case 0:case 11:case 14:case 15:if(!Ye&&(r=i.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var n=s,o=n.destroy;n=n.tag,o!==void 0&&(n&2||n&4)&&_a(i,t,o),s=s.next}while(s!==r)}ci(e,t,i);break;case 1:if(!Ye&&(Sr(i,t),r=i.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=i.memoizedProps,r.state=i.memoizedState,r.componentWillUnmount()}catch(l){ve(i,t,l)}ci(e,t,i);break;case 21:ci(e,t,i);break;case 22:i.mode&1?(Ye=(r=Ye)||i.memoizedState!==null,ci(e,t,i),Ye=r):ci(e,t,i);break;default:ci(e,t,i)}}function Su(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new gg),t.forEach(function(r){var s=Lg.bind(null,e,r);i.has(r)||(i.add(r),r.then(s,s))})}}function Rt(e,t){var i=t.deletions;if(i!==null)for(var r=0;r<i.length;r++){var s=i[r];try{var n=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Fe=l.stateNode,Bt=!1;break e;case 3:Fe=l.stateNode.containerInfo,Bt=!0;break e;case 4:Fe=l.stateNode.containerInfo,Bt=!0;break e}l=l.return}if(Fe===null)throw Error(O(160));T_(n,o,s),Fe=null,Bt=!1;var a=s.alternate;a!==null&&(a.return=null),s.return=null}catch(h){ve(s,t,h)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)O_(t,e),t=t.sibling}function O_(e,t){var i=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Rt(t,e),It(e),r&4){try{Ss(3,e,e.return),Po(3,e)}catch(S){ve(e,e.return,S)}try{Ss(5,e,e.return)}catch(S){ve(e,e.return,S)}}break;case 1:Rt(t,e),It(e),r&512&&i!==null&&Sr(i,i.return);break;case 5:if(Rt(t,e),It(e),r&512&&i!==null&&Sr(i,i.return),e.flags&32){var s=e.stateNode;try{ks(s,"")}catch(S){ve(e,e.return,S)}}if(r&4&&(s=e.stateNode,s!=null)){var n=e.memoizedProps,o=i!==null?i.memoizedProps:n,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&n.type==="radio"&&n.name!=null&&rf(s,n),Hl(l,o);var h=Hl(l,n);for(o=0;o<a.length;o+=2){var f=a[o],c=a[o+1];f==="style"?af(s,c):f==="dangerouslySetInnerHTML"?of(s,c):f==="children"?ks(s,c):vh(s,f,c,h)}switch(l){case"input":Al(s,n);break;case"textarea":sf(s,n);break;case"select":var u=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!n.multiple;var p=n.value;p!=null?Cr(s,!!n.multiple,p,!1):u!==!!n.multiple&&(n.defaultValue!=null?Cr(s,!!n.multiple,n.defaultValue,!0):Cr(s,!!n.multiple,n.multiple?[]:"",!1))}s[Ns]=n}catch(S){ve(e,e.return,S)}}break;case 6:if(Rt(t,e),It(e),r&4){if(e.stateNode===null)throw Error(O(162));s=e.stateNode,n=e.memoizedProps;try{s.nodeValue=n}catch(S){ve(e,e.return,S)}}break;case 3:if(Rt(t,e),It(e),r&4&&i!==null&&i.memoizedState.isDehydrated)try{Ls(t.containerInfo)}catch(S){ve(e,e.return,S)}break;case 4:Rt(t,e),It(e);break;case 13:Rt(t,e),It(e),s=e.child,s.flags&8192&&(n=s.memoizedState!==null,s.stateNode.isHidden=n,!n||s.alternate!==null&&s.alternate.memoizedState!==null||(Gh=ye())),r&4&&Su(e);break;case 22:if(f=i!==null&&i.memoizedState!==null,e.mode&1?(Ye=(h=Ye)||f,Rt(t,e),Ye=h):Rt(t,e),It(e),r&8192){if(h=e.memoizedState!==null,(e.stateNode.isHidden=h)&&!f&&e.mode&1)for(U=e,f=e.child;f!==null;){for(c=U=f;U!==null;){switch(u=U,p=u.child,u.tag){case 0:case 11:case 14:case 15:Ss(4,u,u.return);break;case 1:Sr(u,u.return);var _=u.stateNode;if(typeof _.componentWillUnmount=="function"){r=u,i=u.return;try{t=r,_.props=t.memoizedProps,_.state=t.memoizedState,_.componentWillUnmount()}catch(S){ve(r,i,S)}}break;case 5:Sr(u,u.return);break;case 22:if(u.memoizedState!==null){wu(c);continue}}p!==null?(p.return=u,U=p):wu(c)}f=f.sibling}e:for(f=null,c=e;;){if(c.tag===5){if(f===null){f=c;try{s=c.stateNode,h?(n=s.style,typeof n.setProperty=="function"?n.setProperty("display","none","important"):n.display="none"):(l=c.stateNode,a=c.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=lf("display",o))}catch(S){ve(e,e.return,S)}}}else if(c.tag===6){if(f===null)try{c.stateNode.nodeValue=h?"":c.memoizedProps}catch(S){ve(e,e.return,S)}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===e)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===e)break e;for(;c.sibling===null;){if(c.return===null||c.return===e)break e;f===c&&(f=null),c=c.return}f===c&&(f=null),c.sibling.return=c.return,c=c.sibling}}break;case 19:Rt(t,e),It(e),r&4&&Su(e);break;case 21:break;default:Rt(t,e),It(e)}}function It(e){var t=e.flags;if(t&2){try{e:{for(var i=e.return;i!==null;){if(N_(i)){var r=i;break e}i=i.return}throw Error(O(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(ks(s,""),r.flags&=-33);var n=gu(e);va(e,n,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=gu(e);ma(e,l,o);break;default:throw Error(O(161))}}catch(a){ve(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yg(e,t,i){U=e,A_(e)}function A_(e,t,i){for(var r=(e.mode&1)!==0;U!==null;){var s=U,n=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||_n;if(!o){var l=s.alternate,a=l!==null&&l.memoizedState!==null||Ye;l=_n;var h=Ye;if(_n=o,(Ye=a)&&!h)for(U=s;U!==null;)o=U,a=o.child,o.tag===22&&o.memoizedState!==null?Cu(s):a!==null?(a.return=o,U=a):Cu(s);for(;n!==null;)U=n,A_(n),n=n.sibling;U=s,_n=l,Ye=h}yu(e)}else s.subtreeFlags&8772&&n!==null?(n.return=s,U=n):yu(e)}}function yu(e){for(;U!==null;){var t=U;if(t.flags&8772){var i=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ye||Po(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Ye)if(i===null)r.componentDidMount();else{var s=t.elementType===t.type?i.memoizedProps:Pt(t.type,i.memoizedProps);r.componentDidUpdate(s,i.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var n=t.updateQueue;n!==null&&su(t,n,r);break;case 3:var o=t.updateQueue;if(o!==null){if(i=null,t.child!==null)switch(t.child.tag){case 5:i=t.child.stateNode;break;case 1:i=t.child.stateNode}su(t,o,i)}break;case 5:var l=t.stateNode;if(i===null&&t.flags&4){i=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&i.focus();break;case"img":a.src&&(i.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var h=t.alternate;if(h!==null){var f=h.memoizedState;if(f!==null){var c=f.dehydrated;c!==null&&Ls(c)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(O(163))}Ye||t.flags&512&&pa(t)}catch(u){ve(t,t.return,u)}}if(t===e){U=null;break}if(i=t.sibling,i!==null){i.return=t.return,U=i;break}U=t.return}}function wu(e){for(;U!==null;){var t=U;if(t===e){U=null;break}var i=t.sibling;if(i!==null){i.return=t.return,U=i;break}U=t.return}}function Cu(e){for(;U!==null;){var t=U;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{Po(4,t)}catch(a){ve(t,i,a)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(a){ve(t,s,a)}}var n=t.return;try{pa(t)}catch(a){ve(t,n,a)}break;case 5:var o=t.return;try{pa(t)}catch(a){ve(t,o,a)}}}catch(a){ve(t,t.return,a)}if(t===e){U=null;break}var l=t.sibling;if(l!==null){l.return=t.return,U=l;break}U=t.return}}var wg=Math.ceil,ao=oi.ReactCurrentDispatcher,Yh=oi.ReactCurrentOwner,bt=oi.ReactCurrentBatchConfig,te=0,ze=null,xe=null,We=0,dt=0,yr=Oi(0),Me=0,$s=null,Ji=0,Bo=0,Xh=0,ys=null,nt=null,Gh=0,Tr=1/0,Gt=null,ho=!1,ga=null,Di=null,pn=!1,yi=null,co=0,ws=0,Sa=null,Nn=-1,Tn=0;function Je(){return te&6?ye():Nn!==-1?Nn:Nn=ye()}function Li(e){return e.mode&1?te&2&&We!==0?We&-We:sg.transition!==null?(Tn===0&&(Tn=yf()),Tn):(e=re,e!==0||(e=window.event,e=e===void 0?16:Df(e.type)),e):1}function Ot(e,t,i,r){if(50<ws)throw ws=0,Sa=null,Error(O(185));Us(e,i,r),(!(te&2)||e!==ze)&&(e===ze&&(!(te&2)&&(Bo|=i),Me===4&&gi(e,We)),ht(e,r),i===1&&te===0&&!(t.mode&1)&&(Tr=ye()+500,Lo&&Ai()))}function ht(e,t){var i=e.callbackNode;sv(e,t);var r=qn(e,e===ze?We:0);if(r===0)i!==null&&Pc(i),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(i!=null&&Pc(i),t===1)e.tag===0?rg(xu.bind(null,e)):Vf(xu.bind(null,e)),Zv(function(){!(te&6)&&Ai()}),i=null;else{switch(wf(r)){case 1:i=Ch;break;case 4:i=gf;break;case 16:i=Vn;break;case 536870912:i=Sf;break;default:i=Vn}i=U_(i,I_.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function I_(e,t){if(Nn=-1,Tn=0,te&6)throw Error(O(327));var i=e.callbackNode;if(Dr()&&e.callbackNode!==i)return null;var r=qn(e,e===ze?We:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=uo(e,r);else{t=r;var s=te;te|=2;var n=$_();(ze!==e||We!==t)&&(Gt=null,Tr=ye()+500,Vi(e,t));do try{kg();break}catch(l){z_(e,l)}while(!0);Oh(),ao.current=n,te=s,xe!==null?t=0:(ze=null,We=0,t=Me)}if(t!==0){if(t===2&&(s=Vl(e),s!==0&&(r=s,t=ya(e,s))),t===1)throw i=$s,Vi(e,0),gi(e,r),ht(e,ye()),i;if(t===6)gi(e,r);else{if(s=e.current.alternate,!(r&30)&&!Cg(s)&&(t=uo(e,r),t===2&&(n=Vl(e),n!==0&&(r=n,t=ya(e,n))),t===1))throw i=$s,Vi(e,0),gi(e,r),ht(e,ye()),i;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(O(345));case 2:$i(e,nt,Gt);break;case 3:if(gi(e,r),(r&130023424)===r&&(t=Gh+500-ye(),10<t)){if(qn(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Je(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=ea($i.bind(null,e,nt,Gt),t);break}$i(e,nt,Gt);break;case 4:if(gi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-Tt(r);n=1<<o,o=t[o],o>s&&(s=o),r&=~n}if(r=s,r=ye()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wg(r/1960))-r,10<r){e.timeoutHandle=ea($i.bind(null,e,nt,Gt),r);break}$i(e,nt,Gt);break;case 5:$i(e,nt,Gt);break;default:throw Error(O(329))}}}return ht(e,ye()),e.callbackNode===i?I_.bind(null,e):null}function ya(e,t){var i=ys;return e.current.memoizedState.isDehydrated&&(Vi(e,t).flags|=256),e=uo(e,t),e!==2&&(t=nt,nt=i,t!==null&&wa(t)),e}function wa(e){nt===null?nt=e:nt.push.apply(nt,e)}function Cg(e){for(var t=e;;){if(t.flags&16384){var i=t.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var r=0;r<i.length;r++){var s=i[r],n=s.getSnapshot;s=s.value;try{if(!At(n(),s))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 gi(e,t){for(t&=~Xh,t&=~Bo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-Tt(t),r=1<<i;e[i]=-1,t&=~r}}function xu(e){if(te&6)throw Error(O(327));Dr();var t=qn(e,0);if(!(t&1))return ht(e,ye()),null;var i=uo(e,t);if(e.tag!==0&&i===2){var r=Vl(e);r!==0&&(t=r,i=ya(e,r))}if(i===1)throw i=$s,Vi(e,0),gi(e,t),ht(e,ye()),i;if(i===6)throw Error(O(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,$i(e,nt,Gt),ht(e,ye()),null}function Qh(e,t){var i=te;te|=1;try{return e(t)}finally{te=i,te===0&&(Tr=ye()+500,Lo&&Ai())}}function Zi(e){yi!==null&&yi.tag===0&&!(te&6)&&Dr();var t=te;te|=1;var i=bt.transition,r=re;try{if(bt.transition=null,re=1,e)return e()}finally{re=r,bt.transition=i,te=t,!(te&6)&&Ai()}}function Jh(){dt=yr.current,ae(yr)}function Vi(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,Jv(i)),xe!==null)for(i=xe.return;i!==null;){var r=i;switch(Bh(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Jn();break;case 3:Br(),ae(lt),ae(Xe),Hh();break;case 5:Fh(r);break;case 4:Br();break;case 13:ae(fe);break;case 19:ae(fe);break;case 10:Ah(r.type._context);break;case 22:case 23:Jh()}i=i.return}if(ze=e,xe=e=Ri(e.current,null),We=dt=t,Me=0,$s=null,Xh=Bo=Ji=0,nt=ys=null,Wi!==null){for(t=0;t<Wi.length;t++)if(i=Wi[t],r=i.interleaved,r!==null){i.interleaved=null;var s=r.next,n=i.pending;if(n!==null){var o=n.next;n.next=s,r.next=o}i.pending=r}Wi=null}return e}function z_(e,t){do{var i=xe;try{if(Oh(),Mn.current=lo,oo){for(var r=_e.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}oo=!1}if(Qi=0,Te=Le=_e=null,gs=!1,As=0,Yh.current=null,i===null||i.return===null){Me=1,$s=t,xe=null;break}e:{var n=e,o=i.return,l=i,a=t;if(t=We,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var h=a,f=l,c=f.tag;if(!(f.mode&1)&&(c===0||c===11||c===15)){var u=f.alternate;u?(f.updateQueue=u.updateQueue,f.memoizedState=u.memoizedState,f.lanes=u.lanes):(f.updateQueue=null,f.memoizedState=null)}var p=cu(o);if(p!==null){p.flags&=-257,uu(p,o,l,n,t),p.mode&1&&hu(n,h,t),t=p,a=h;var _=t.updateQueue;if(_===null){var S=new Set;S.add(a),t.updateQueue=S}else _.add(a);break e}else{if(!(t&1)){hu(n,h,t),Zh();break e}a=Error(O(426))}}else if(he&&l.mode&1){var k=cu(o);if(k!==null){!(k.flags&65536)&&(k.flags|=256),uu(k,o,l,n,t),Nh(Nr(a,l));break e}}n=a=Nr(a,l),Me!==4&&(Me=2),ys===null?ys=[n]:ys.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,t&=-t,n.lanes|=t;var m=w_(n,a,t);ru(n,m);break e;case 1:l=a;var v=n.type,g=n.stateNode;if(!(n.flags&128)&&(typeof v.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Di===null||!Di.has(g)))){n.flags|=65536,t&=-t,n.lanes|=t;var w=C_(n,l,t);ru(n,w);break e}}n=n.return}while(n!==null)}H_(i)}catch(x){t=x,xe===i&&i!==null&&(xe=i=i.return);continue}break}while(!0)}function $_(){var e=ao.current;return ao.current=lo,e===null?lo:e}function Zh(){(Me===0||Me===3||Me===2)&&(Me=4),ze===null||!(Ji&268435455)&&!(Bo&268435455)||gi(ze,We)}function uo(e,t){var i=te;te|=2;var r=$_();(ze!==e||We!==t)&&(Gt=null,Vi(e,t));do try{xg();break}catch(s){z_(e,s)}while(!0);if(Oh(),te=i,ao.current=r,xe!==null)throw Error(O(261));return ze=null,We=0,Me}function xg(){for(;xe!==null;)F_(xe)}function kg(){for(;xe!==null&&!Xm();)F_(xe)}function F_(e){var t=W_(e.alternate,e,dt);e.memoizedProps=e.pendingProps,t===null?H_(e):xe=t,Yh.current=null}function H_(e){var t=e;do{var i=t.alternate;if(e=t.return,t.flags&32768){if(i=vg(i,t),i!==null){i.flags&=32767,xe=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Me=6,xe=null;return}}else if(i=mg(i,t,dt),i!==null){xe=i;return}if(t=t.sibling,t!==null){xe=t;return}xe=t=e}while(t!==null);Me===0&&(Me=5)}function $i(e,t,i){var r=re,s=bt.transition;try{bt.transition=null,re=1,bg(e,t,i,r)}finally{bt.transition=s,re=r}return null}function bg(e,t,i,r){do Dr();while(yi!==null);if(te&6)throw Error(O(327));i=e.finishedWork;var s=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(O(177));e.callbackNode=null,e.callbackPriority=0;var n=i.lanes|i.childLanes;if(nv(e,n),e===ze&&(xe=ze=null,We=0),!(i.subtreeFlags&2064)&&!(i.flags&2064)||pn||(pn=!0,U_(Vn,function(){return Dr(),null})),n=(i.flags&15990)!==0,i.subtreeFlags&15990||n){n=bt.transition,bt.transition=null;var o=re;re=1;var l=te;te|=4,Yh.current=null,Sg(e,i),O_(i,e),Kv(Jl),Yn=!!Ql,Jl=Ql=null,e.current=i,yg(i),Gm(),te=l,re=o,bt.transition=n}else e.current=i;if(pn&&(pn=!1,yi=e,co=s),n=e.pendingLanes,n===0&&(Di=null),Zm(i.stateNode),ht(e,ye()),t!==null)for(r=e.onRecoverableError,i=0;i<t.length;i++)s=t[i],r(s.value,{componentStack:s.stack,digest:s.digest});if(ho)throw ho=!1,e=ga,ga=null,e;return co&1&&e.tag!==0&&Dr(),n=e.pendingLanes,n&1?e===Sa?ws++:(ws=0,Sa=e):ws=0,Ai(),null}function Dr(){if(yi!==null){var e=wf(co),t=bt.transition,i=re;try{if(bt.transition=null,re=16>e?16:e,yi===null)var r=!1;else{if(e=yi,yi=null,co=0,te&6)throw Error(O(331));var s=te;for(te|=4,U=e.current;U!==null;){var n=U,o=n.child;if(U.flags&16){var l=n.deletions;if(l!==null){for(var a=0;a<l.length;a++){var h=l[a];for(U=h;U!==null;){var f=U;switch(f.tag){case 0:case 11:case 15:Ss(8,f,n)}var c=f.child;if(c!==null)c.return=f,U=c;else for(;U!==null;){f=U;var u=f.sibling,p=f.return;if(B_(f),f===h){U=null;break}if(u!==null){u.return=p,U=u;break}U=p}}}var _=n.alternate;if(_!==null){var S=_.child;if(S!==null){_.child=null;do{var k=S.sibling;S.sibling=null,S=k}while(S!==null)}}U=n}}if(n.subtreeFlags&2064&&o!==null)o.return=n,U=o;else e:for(;U!==null;){if(n=U,n.flags&2048)switch(n.tag){case 0:case 11:case 15:Ss(9,n,n.return)}var m=n.sibling;if(m!==null){m.return=n.return,U=m;break e}U=n.return}}var v=e.current;for(U=v;U!==null;){o=U;var g=o.child;if(o.subtreeFlags&2064&&g!==null)g.return=o,U=g;else e:for(o=v;U!==null;){if(l=U,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Po(9,l)}}catch(x){ve(l,l.return,x)}if(l===o){U=null;break e}var w=l.sibling;if(w!==null){w.return=l.return,U=w;break e}U=l.return}}if(te=s,Ai(),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(xo,e)}catch{}r=!0}return r}finally{re=i,bt.transition=t}}return!1}function ku(e,t,i){t=Nr(i,t),t=w_(e,t,1),e=Ei(e,t,1),t=Je(),e!==null&&(Us(e,1,t),ht(e,t))}function ve(e,t,i){if(e.tag===3)ku(e,e,i);else for(;t!==null;){if(t.tag===3){ku(t,e,i);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Di===null||!Di.has(r))){e=Nr(i,e),e=C_(t,e,1),t=Ei(t,e,1),e=Je(),t!==null&&(Us(t,1,e),ht(t,e));break}}t=t.return}}function Eg(e,t,i){var r=e.pingCache;r!==null&&r.delete(t),t=Je(),e.pingedLanes|=e.suspendedLanes&i,ze===e&&(We&i)===i&&(Me===4||Me===3&&(We&130023424)===We&&500>ye()-Gh?Vi(e,0):Xh|=i),ht(e,t)}function j_(e,t){t===0&&(e.mode&1?(t=nn,nn<<=1,!(nn&130023424)&&(nn=4194304)):t=1);var i=Je();e=si(e,t),e!==null&&(Us(e,t,i),ht(e,i))}function Dg(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),j_(e,i)}function Lg(e,t){var i=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(i=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(O(314))}r!==null&&r.delete(t),j_(e,i)}var W_;W_=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||lt.current)ot=!0;else{if(!(e.lanes&i)&&!(t.flags&128))return ot=!1,pg(e,t,i);ot=!!(e.flags&131072)}else ot=!1,he&&t.flags&1048576&&qf(t,to,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Bn(e,t),e=t.pendingProps;var s=Rr(t,Xe.current);Er(t,i),s=Wh(null,t,r,e,s,i);var n=Uh();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,at(r)?(n=!0,Zn(t)):n=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,zh(t),s.updater=Mo,t.stateNode=s,s._reactInternals=t,la(t,r,e,i),t=ca(null,t,r,!0,n,i)):(t.tag=0,he&&n&&Ph(t),Qe(null,t,s,i),t=t.child),t;case 16:r=t.elementType;e:{switch(Bn(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=Mg(r),e=Pt(r,e),s){case 0:t=ha(null,t,r,e,i);break e;case 1:t=_u(null,t,r,e,i);break e;case 11:t=du(null,t,r,e,i);break e;case 14:t=fu(null,t,r,Pt(r.type,e),i);break e}throw Error(O(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Pt(r,s),ha(e,t,r,s,i);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Pt(r,s),_u(e,t,r,s,i);case 3:e:{if(E_(t),e===null)throw Error(O(387));r=t.pendingProps,n=t.memoizedState,s=n.element,Zf(e,t),so(t,r,null,i);var o=t.memoizedState;if(r=o.element,n.isDehydrated)if(n={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){s=Nr(Error(O(423)),t),t=pu(e,t,r,i,s);break e}else if(r!==s){s=Nr(Error(O(424)),t),t=pu(e,t,r,i,s);break e}else for(ft=bi(t.stateNode.containerInfo.firstChild),pt=t,he=!0,Nt=null,i=Qf(t,null,r,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Mr(),r===s){t=ni(e,t,i);break e}Qe(e,t,r,i)}t=t.child}return t;case 5:return e_(t),e===null&&sa(t),r=t.type,s=t.pendingProps,n=e!==null?e.memoizedProps:null,o=s.children,Zl(r,s)?o=null:n!==null&&Zl(r,n)&&(t.flags|=32),b_(e,t),Qe(e,t,o,i),t.child;case 6:return e===null&&sa(t),null;case 13:return D_(e,t,i);case 4:return $h(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pr(t,null,r,i):Qe(e,t,r,i),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Pt(r,s),du(e,t,r,s,i);case 7:return Qe(e,t,t.pendingProps,i),t.child;case 8:return Qe(e,t,t.pendingProps.children,i),t.child;case 12:return Qe(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,n=t.memoizedProps,o=s.value,ne(io,r._currentValue),r._currentValue=o,n!==null)if(At(n.value,o)){if(n.children===s.children&&!lt.current){t=ni(e,t,i);break e}}else for(n=t.child,n!==null&&(n.return=t);n!==null;){var l=n.dependencies;if(l!==null){o=n.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(n.tag===1){a=ti(-1,i&-i),a.tag=2;var h=n.updateQueue;if(h!==null){h=h.shared;var f=h.pending;f===null?a.next=a:(a.next=f.next,f.next=a),h.pending=a}}n.lanes|=i,a=n.alternate,a!==null&&(a.lanes|=i),na(n.return,i,t),l.lanes|=i;break}a=a.next}}else if(n.tag===10)o=n.type===t.type?null:n.child;else if(n.tag===18){if(o=n.return,o===null)throw Error(O(341));o.lanes|=i,l=o.alternate,l!==null&&(l.lanes|=i),na(o,i,t),o=n.sibling}else o=n.child;if(o!==null)o.return=n;else for(o=n;o!==null;){if(o===t){o=null;break}if(n=o.sibling,n!==null){n.return=o.return,o=n;break}o=o.return}n=o}Qe(e,t,s.children,i),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Er(t,i),s=Dt(s),r=r(s),t.flags|=1,Qe(e,t,r,i),t.child;case 14:return r=t.type,s=Pt(r,t.pendingProps),s=Pt(r.type,s),fu(e,t,r,s,i);case 15:return x_(e,t,t.type,t.pendingProps,i);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Pt(r,s),Bn(e,t),t.tag=1,at(r)?(e=!0,Zn(t)):e=!1,Er(t,i),y_(t,r,s),la(t,r,s,i),ca(null,t,r,!0,e,i);case 19:return L_(e,t,i);case 22:return k_(e,t,i)}throw Error(O(156,t.tag))};function U_(e,t){return vf(e,t)}function Rg(e,t,i,r){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function kt(e,t,i,r){return new Rg(e,t,i,r)}function ec(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Mg(e){if(typeof e=="function")return ec(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Sh)return 11;if(e===yh)return 14}return 2}function Ri(e,t){var i=e.alternate;return i===null?(i=kt(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&14680064,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}function On(e,t,i,r,s,n){var o=2;if(r=e,typeof e=="function")ec(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case cr:return qi(i.children,s,n,t);case gh:o=8,s|=8;break;case Pl:return e=kt(12,i,t,s|2),e.elementType=Pl,e.lanes=n,e;case Bl:return e=kt(13,i,t,s),e.elementType=Bl,e.lanes=n,e;case Nl:return e=kt(19,i,t,s),e.elementType=Nl,e.lanes=n,e;case Zd:return No(i,s,n,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Qd:o=10;break e;case Jd:o=9;break e;case Sh:o=11;break e;case yh:o=14;break e;case _i:o=16,r=null;break e}throw Error(O(130,e==null?e:typeof e,""))}return t=kt(o,i,t,s),t.elementType=e,t.type=r,t.lanes=n,t}function qi(e,t,i,r){return e=kt(7,e,r,t),e.lanes=i,e}function No(e,t,i,r){return e=kt(22,e,r,t),e.elementType=Zd,e.lanes=i,e.stateNode={isHidden:!1},e}function _l(e,t,i){return e=kt(6,e,null,t),e.lanes=i,e}function pl(e,t,i){return t=kt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Pg(e,t,i,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Xo(0),this.expirationTimes=Xo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xo(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function tc(e,t,i,r,s,n,o,l,a){return e=new Pg(e,t,i,l,a),t===1?(t=1,n===!0&&(t|=8)):t=0,n=kt(3,null,null,t),e.current=n,n.stateNode=e,n.memoizedState={element:r,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},zh(n),e}function Bg(e,t,i){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:hr,key:r==null?null:""+r,children:e,containerInfo:t,implementation:i}}function K_(e){if(!e)return Ni;e=e._reactInternals;e:{if(rr(e)!==e||e.tag!==1)throw Error(O(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(at(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(O(171))}if(e.tag===1){var i=e.type;if(at(i))return Kf(e,i,t)}return t}function V_(e,t,i,r,s,n,o,l,a){return e=tc(i,r,!0,e,s,n,o,l,a),e.context=K_(null),i=e.current,r=Je(),s=Li(i),n=ti(r,s),n.callback=t??null,Ei(i,n,s),e.current.lanes=s,Us(e,s,r),ht(e,r),e}function To(e,t,i,r){var s=t.current,n=Je(),o=Li(s);return i=K_(i),t.context===null?t.context=i:t.pendingContext=i,t=ti(n,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ei(s,t,o),e!==null&&(Ot(e,s,o,n),Rn(e,s,o)),o}function fo(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function bu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function ic(e,t){bu(e,t),(e=e.alternate)&&bu(e,t)}function Ng(){return null}var q_=typeof reportError=="function"?reportError:function(e){console.error(e)};function rc(e){this._internalRoot=e}Oo.prototype.render=rc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(O(409));To(e,t,null,null)};Oo.prototype.unmount=rc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zi(function(){To(null,e,null,null)}),t[ri]=null}};function Oo(e){this._internalRoot=e}Oo.prototype.unstable_scheduleHydration=function(e){if(e){var t=kf();e={blockedOn:null,target:e,priority:t};for(var i=0;i<vi.length&&t!==0&&t<vi[i].priority;i++);vi.splice(i,0,e),i===0&&Ef(e)}};function sc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ao(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Eu(){}function Tg(e,t,i,r,s){if(s){if(typeof r=="function"){var n=r;r=function(){var h=fo(o);n.call(h)}}var o=V_(t,r,e,0,null,!1,!1,"",Eu);return e._reactRootContainer=o,e[ri]=o.current,Ps(e.nodeType===8?e.parentNode:e),Zi(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var h=fo(a);l.call(h)}}var a=tc(e,0,!1,null,null,!1,!1,"",Eu);return e._reactRootContainer=a,e[ri]=a.current,Ps(e.nodeType===8?e.parentNode:e),Zi(function(){To(t,a,i,r)}),a}function Io(e,t,i,r,s){var n=i._reactRootContainer;if(n){var o=n;if(typeof s=="function"){var l=s;s=function(){var a=fo(o);l.call(a)}}To(t,o,e,s)}else o=Tg(i,t,e,s,r);return fo(o)}Cf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=ns(t.pendingLanes);i!==0&&(xh(t,i|1),ht(t,ye()),!(te&6)&&(Tr=ye()+500,Ai()))}break;case 13:Zi(function(){var r=si(e,1);if(r!==null){var s=Je();Ot(r,e,1,s)}}),ic(e,1)}};kh=function(e){if(e.tag===13){var t=si(e,134217728);if(t!==null){var i=Je();Ot(t,e,134217728,i)}ic(e,134217728)}};xf=function(e){if(e.tag===13){var t=Li(e),i=si(e,t);if(i!==null){var r=Je();Ot(i,e,t,r)}ic(e,t)}};kf=function(){return re};bf=function(e,t){var i=re;try{return re=e,t()}finally{re=i}};Wl=function(e,t,i){switch(t){case"input":if(Al(e,i),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var r=i[t];if(r!==e&&r.form===e.form){var s=Do(r);if(!s)throw Error(O(90));tf(r),Al(r,s)}}}break;case"textarea":sf(e,i);break;case"select":t=i.value,t!=null&&Cr(e,!!i.multiple,t,!1)}};uf=Qh;df=Zi;var Og={usingClientEntryPoint:!1,Events:[Vs,_r,Do,hf,cf,Qh]},Gr={findFiberByHostInstance:ji,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ag={bundleType:Gr.bundleType,version:Gr.version,rendererPackageName:Gr.rendererPackageName,rendererConfig:Gr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:oi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=pf(e),e===null?null:e.stateNode},findFiberByHostInstance:Gr.findFiberByHostInstance||Ng,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mn=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mn.isDisabled&&mn.supportsFiber)try{xo=mn.inject(Ag),Ut=mn}catch{}}vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Og;vt.createPortal=function(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!sc(t))throw Error(O(200));return Bg(e,t,null,i)};vt.createRoot=function(e,t){if(!sc(e))throw Error(O(299));var i=!1,r="",s=q_;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=tc(e,1,!1,null,null,i,!1,r,s),e[ri]=t.current,Ps(e.nodeType===8?e.parentNode:e),new rc(t)};vt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(O(188)):(e=Object.keys(e).join(","),Error(O(268,e)));return e=pf(t),e=e===null?null:e.stateNode,e};vt.flushSync=function(e){return Zi(e)};vt.hydrate=function(e,t,i){if(!Ao(t))throw Error(O(200));return Io(null,e,t,!0,i)};vt.hydrateRoot=function(e,t,i){if(!sc(e))throw Error(O(405));var r=i!=null&&i.hydratedSources||null,s=!1,n="",o=q_;if(i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(n=i.identifierPrefix),i.onRecoverableError!==void 0&&(o=i.onRecoverableError)),t=V_(t,null,e,1,i??null,s,!1,n,o),e[ri]=t.current,Ps(e),r)for(e=0;e<r.length;e++)i=r[e],s=i._getVersion,s=s(i._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[i,s]:t.mutableSourceEagerHydrationData.push(i,s);return new Oo(t)};vt.render=function(e,t,i){if(!Ao(t))throw Error(O(200));return Io(null,e,t,!1,i)};vt.unmountComponentAtNode=function(e){if(!Ao(e))throw Error(O(40));return e._reactRootContainer?(Zi(function(){Io(null,null,e,!1,function(){e._reactRootContainer=null,e[ri]=null})}),!0):!1};vt.unstable_batchedUpdates=Qh;vt.unstable_renderSubtreeIntoContainer=function(e,t,i,r){if(!Ao(i))throw Error(O(200));if(e==null||e._reactInternals===void 0)throw Error(O(38));return Io(e,t,i,!1,r)};vt.version="18.3.1-next-f1338f8080-20240426";function Y_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Y_)}catch(e){console.error(e)}}Y_(),qd.exports=vt;var Ig=qd.exports,Du=Ig;Rl.createRoot=Du.createRoot,Rl.hydrateRoot=Du.hydrateRoot;function _t(e,t,i={}){return fetch(e,{...i,headers:{...i.headers||{},Authorization:`Bearer ${t}`}})}const X_=e=>`nc_seen_${e}`;async function $r(e,t,i={}){const r=await _t(e,t,{method:i.method||"GET",headers:{"content-type":"application/json"},body:i.body?JSON.stringify(i.body):void 0}),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`HTTP ${r.status}`);return s}const nc=e=>$r("/api/fleet/status",e),G_=(e,t)=>$r("/api/fleet/up",e,{method:"POST",body:t}),Q_=(e,t)=>$r("/api/fleet/down",e,{method:"POST",body:t}),J_=(e,t)=>$r("/api/sessions",e,{method:"POST",body:t}),Z_=(e,t)=>$r(`/api/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),zg=(e,t)=>$r(`/api/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),$g={power:d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M12 3v8"}),d.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:d.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h3.6a2 2 0 0 1 1.4.6L12.4 6H18a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z"}),keyboard:d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),d.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),d.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),d.jsx("path",{d:"M12 18v3"})]}),enter:d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),d.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),d.jsx("path",{d:"M22 2 11 13"})]}),trash:d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M4 7h16"}),d.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),d.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),d.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:d.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),d.jsx("polyline",{points:"21 3 21 8 16 8"})]}),upload:d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M12 16V5"}),d.jsx("polyline",{points:"8 9 12 5 16 9"}),d.jsx("path",{d:"M5 20h14"})]}),chevronLeft:d.jsx("polyline",{points:"14 6 8 12 14 18"}),attach:d.jsx("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"}),file:d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),d.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M14.5 4h-5L7.5 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.5z"}),d.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),d.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),d.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:d.jsxs(d.Fragment,{children:[d.jsx("circle",{cx:"11",cy:"11",r:"7"}),d.jsx("path",{d:"M21 21l-4.35-4.35"}),d.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:d.jsxs(d.Fragment,{children:[d.jsx("circle",{cx:"11",cy:"11",r:"7"}),d.jsx("path",{d:"M21 21l-4.35-4.35"}),d.jsx("path",{d:"M8 11h6"})]})};function Re({name:e,size:t=20}){return d.jsx("svg",{className:"nc-icon",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:$g[e]||null})}const ep="nc_pins";function tp(){try{const e=JSON.parse(localStorage.getItem(ep));return Array.isArray(e)?e:[]}catch{return[]}}function ip(e,t){const i=e.includes(t)?e.filter(r=>r!==t):[...e,t];try{localStorage.setItem(ep,JSON.stringify(i))}catch{}return i}function ls(e,t,i){const r=e.indexOf(t);return[r===-1?1e9:r,-(i||0)]}function Ca(e,t){return e[0]-t[0]||e[1]-t[1]}const oc=["it","en","es"];function Fg(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return oc.includes(t)?t:"en"}catch{return"en"}}const An=Fg(),rp="nc_lang",xa="nc-lang";function sp(){return typeof localStorage<"u"?localStorage:null}const vn={it:{"update-available":"nuova versione {v} disponibile",reload:"ricarica","grid-empty":"trascina qui una sessione dalla sidebar, o doppio-clic per la vista singola",pin:"fissa in cima",sessions:"sessioni","new-session":"nuova sessione",new:"nuova",fleet:"Flotta","fleet-tmux":"flotta tmux","other-sessions":"Altre sessioni",files:"file",refresh:"aggiorna","filter-placeholder":"filtra sessioni…","loading-fleet":"carico la flotta…","no-sessions":"nessuna sessione tmux viva — la flotta parte al boot (systemd)","no-match":'nessuna sessione contiene "{q}"',"copy-url":"clicca per copiare l'URL","ssh-only":"solo tunnel SSH/VPN","new-files-outbox":"nuovi file in outbox",terminate:"termina","terminate-confirm":'Terminare la sessione "{name}"?',"cell-on":"tmux vivo","cell-off":"spenta","cell-degraded":"degradata: unit attiva, tmux morto","power-on":"accendi","power-off":"spegni","state-on":"accesa","state-off":"spenta",engine:"Engine","boot-persist":"avvia al boot","remove-boot":"togli anche dal boot","no-remote-control":"⚠ engine non-native: niente RC da app claude.ai (da qui la piloti comunque)",cancel:"annulla",name:"nome","name-invalid":"nome non valido: a-zA-Z0-9._- max 64, senza '-' iniziale",cwd:"cartella",browse:"sfoglia","fs-home":"home","fs-parent":".. su",preset:"preset","preset-2x2":"griglia 2×2","preset-columns":"colonne","preset-equalize":"equalizza",collapse:"comprimi",expand:"espandi",create:"crea","auth-prompt":"Incolla il token (stampato dal server):","remember-device":"ricorda su questo device","zoom-out":"testo più piccolo","zoom-in":"testo più grande",composer:"composer",windows:"{n} finestre","empty-files":"vuota",upload:"carica","no-sessions-short":"nessuna sessione","composer-placeholder":"scrivi o detta…",attach:"allega","attach-file":"File","attach-camera":"Fotocamera","attach-gallery":"Galleria","attach-uploading":"carico…",voice:"voice",send:"invia",close:"chiudi","lang-label":"lingua"},en:{"update-available":"new version {v} available",reload:"reload","grid-empty":"drag a session here from the sidebar, or double-click for single view",pin:"pin to top",sessions:"sessions","new-session":"new session",new:"new",fleet:"Fleet","fleet-tmux":"tmux fleet","other-sessions":"Other sessions",files:"files",refresh:"refresh","filter-placeholder":"filter sessions…","loading-fleet":"loading fleet…","no-sessions":"no live tmux sessions — the fleet starts at boot (systemd)","no-match":'no session matches "{q}"',"copy-url":"click to copy URL","ssh-only":"SSH/VPN tunnel only","new-files-outbox":"new files in outbox",terminate:"terminate","terminate-confirm":'Terminate session "{name}"?',"cell-on":"tmux alive","cell-off":"off","cell-degraded":"degraded: unit active, tmux dead","power-on":"power on","power-off":"power off","state-on":"running","state-off":"stopped",engine:"Engine","boot-persist":"start at boot","remove-boot":"also remove from boot","no-remote-control":"⚠ non-native engine: no claude.ai app RC (you can still drive it from here)",cancel:"cancel",name:"name","name-invalid":"invalid name: a-zA-Z0-9._- max 64, no leading '-'",cwd:"folder",browse:"browse","fs-home":"home","fs-parent":".. up",preset:"preset","preset-2x2":"2×2 grid","preset-columns":"columns","preset-equalize":"equalize",collapse:"collapse",expand:"expand",create:"create","auth-prompt":"Paste the token (printed by the server):","remember-device":"remember on this device","zoom-out":"smaller text","zoom-in":"bigger text",composer:"composer",windows:"{n} windows","empty-files":"empty",upload:"upload","no-sessions-short":"no sessions","composer-placeholder":"type or dictate…",attach:"attach","attach-file":"File","attach-camera":"Camera","attach-gallery":"Gallery","attach-uploading":"uploading…",voice:"voice",send:"send",close:"close","lang-label":"language"},es:{"update-available":"nueva versión {v} disponible",reload:"recargar","grid-empty":"arrastra aquí una sesión desde la barra lateral, o doble clic para vista única",pin:"fijar arriba",sessions:"sesiones","new-session":"nueva sesión",new:"nueva",fleet:"Flota","fleet-tmux":"flota tmux","other-sessions":"Otras sesiones",files:"archivos",refresh:"actualizar","filter-placeholder":"filtrar sesiones…","loading-fleet":"cargando flota…","no-sessions":"sin sesiones tmux vivas — la flota arranca en el boot (systemd)","no-match":"ninguna sesión coincide con «{q}»","copy-url":"clic para copiar la URL","ssh-only":"solo túnel SSH/VPN","new-files-outbox":"archivos nuevos en outbox",terminate:"terminar","terminate-confirm":"¿Terminar la sesión «{name}»?","cell-on":"tmux activo","cell-off":"apagada","cell-degraded":"degradada: unit activa, tmux muerto","power-on":"encender","power-off":"apagar","state-on":"encendida","state-off":"apagada",engine:"Motor","boot-persist":"iniciar en el boot","remove-boot":"quitar también del boot","no-remote-control":"⚠ motor no nativo: sin RC de la app claude.ai (aquí puedes pilotarla igual)",cancel:"cancelar",name:"nombre","name-invalid":"nombre inválido: a-zA-Z0-9._- máx 64, sin '-' inicial",cwd:"carpeta",browse:"explorar","fs-home":"home","fs-parent":".. arriba",preset:"preset","preset-2x2":"cuadrícula 2×2","preset-columns":"columnas","preset-equalize":"igualar",collapse:"contraer",expand:"expandir",create:"crear","auth-prompt":"Pega el token (impreso por el servidor):","remember-device":"recordar en este dispositivo","zoom-out":"texto más pequeño","zoom-in":"texto más grande",composer:"composer",windows:"{n} ventanas","empty-files":"vacía",upload:"subir","no-sessions-short":"sin sesiones","composer-placeholder":"escribe o dicta…",attach:"adjuntar","attach-file":"Archivo","attach-camera":"Cámara","attach-gallery":"Galería","attach-uploading":"subiendo…",voice:"voz",send:"enviar",close:"cerrar","lang-label":"idioma"}};function ka(){const e=sp(),t=e?e.getItem(rp):null;return oc.includes(t)?t:An}function Hg(e){const t=sp();if(t)try{t.setItem(rp,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(xa))}function z(e){const t=ka(),i=vn[t]||vn[An];return Object.prototype.hasOwnProperty.call(i,e)?i[e]:Object.prototype.hasOwnProperty.call(vn[An],e)?vn[An][e]:e}function jg(e){return typeof window>"u"?()=>{}:(window.addEventListener(xa,e),()=>window.removeEventListener(xa,e))}const np=oc;function Yt(){return[M.useSyncExternalStore(jg,ka,ka),Hg]}function op({cell:e,engines:t=[],onConfirm:i,onClose:r}){Yt();const s=!!(e&&e.active),n=t.length?t:[{id:(e==null?void 0:e.engine)||"native",label:(e==null?void 0:e.engine)||"native",rc:((e==null?void 0:e.engine)||"native")==="native"}],[o,l]=M.useState((e==null?void 0:e.engine)||n[0].id),a=n.find(k=>k.id===o),[h,f]=M.useState((e==null?void 0:e.boot)??!0),[c,u]=M.useState(!1),[p,_]=M.useState(null);async function S(k){k.preventDefault(),u(!0),_(null);try{s?await i({action:"down",boot:h}):await i({action:"up",engine:o,boot:h}),r()}catch(m){_(String(m&&m.message||m)),u(!1)}}return d.jsx("div",{className:"nc-sheet-overlay",onClick:r,children:d.jsxs("form",{className:"nc-sheet",onClick:k=>k.stopPropagation(),onSubmit:S,children:[d.jsxs("div",{className:"nc-sheet-head",children:[d.jsx("b",{children:e==null?void 0:e.cell}),d.jsx("span",{className:"nc-sheet-state",children:z(s?"state-on":"state-off")})]}),s?d.jsxs("label",{className:"nc-check",children:[d.jsx("input",{type:"checkbox",checked:h,onChange:k=>f(k.target.checked)}),z("remove-boot")]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"nc-sheet-label",children:z("engine")}),d.jsx("div",{className:"nc-engines",children:n.map(k=>d.jsxs("label",{className:`nc-engine${o===k.id?" sel":""}`,children:[d.jsx("input",{type:"radio",name:"ps-engine",checked:o===k.id,onChange:()=>l(k.id)}),k.label,k.label.toLowerCase()!==k.id.toLowerCase()&&d.jsxs("small",{className:"nc-engine-id",children:[" (",k.id,")"]})]},k.id))}),d.jsxs("label",{className:"nc-check",children:[d.jsx("input",{type:"checkbox",checked:h,onChange:k=>f(k.target.checked)}),z("boot-persist")]}),a&&!a.rc&&d.jsx("div",{className:"nc-note",children:z("no-remote-control")})]}),p&&d.jsx("div",{className:"nc-err",children:p}),d.jsxs("div",{className:"nc-sheet-actions",children:[d.jsx("button",{type:"button",className:"nc-btn ghost",onClick:r,disabled:c,children:z("cancel")}),d.jsx("button",{type:"submit",className:"nc-btn primary",disabled:c,children:z(s?"power-off":"power-on")})]})]})})}const Wg=/^[\w.-]{1,64}$/;function lp({presets:e=["shell"],token:t,onCreate:i,onClose:r}){Yt();const[s,n]=M.useState(""),[o,l]=M.useState("~"),[a,h]=M.useState(e[0]||"shell"),[f,c]=M.useState(!1),[u,p]=M.useState(null),[_,S]=M.useState(null),[k,m]=M.useState(null),v=Wg.test(s)&&!s.startsWith("-");async function g(x){m(null);try{const b=await zg(t,x);S(b),l(b.path)}catch(b){m(String(b&&b.message||b))}}async function w(x){if(x.preventDefault(),!!v){c(!0),p(null);try{await i({name:s,cwd:o==="~"?"":o,preset:a}),r()}catch(b){p(String(b&&b.message||b)),c(!1)}}}return d.jsx("div",{className:"nc-sheet-overlay",onClick:r,children:d.jsxs("form",{className:"nc-sheet",onClick:x=>x.stopPropagation(),onSubmit:w,children:[d.jsx("div",{className:"nc-sheet-head",children:d.jsx("b",{children:z("new-session")})}),d.jsxs("label",{className:"nc-field",children:[z("name"),d.jsx("input",{value:s,onChange:x=>n(x.target.value),autoFocus:!0,placeholder:"worker-1"})]}),s&&!v&&d.jsx("div",{className:"nc-err",children:z("name-invalid")}),d.jsxs("label",{className:"nc-field",children:[z("cwd"),d.jsxs("div",{className:"nc-cwd-row",children:[d.jsx("input",{value:o,onChange:x=>l(x.target.value),placeholder:"~"}),t&&d.jsx("button",{type:"button",className:"nc-btn ghost nc-cwd-browse",onClick:()=>_?S(null):g(o==="~"?"":o),children:z("browse")})]})]}),_&&d.jsxs("div",{className:"nc-fs",onMouseDown:x=>x.stopPropagation(),children:[d.jsx("div",{className:"nc-fs-path",title:_.path,children:_.path}),d.jsxs("div",{className:"nc-fs-list",children:[d.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:()=>g(_.home),children:["⌂ ",z("fs-home")]}),_.parent&&d.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:()=>g(_.parent),children:["↑ ",z("fs-parent")]}),_.dirs.map(x=>d.jsxs("button",{type:"button",className:"nc-fs-item",onClick:()=>g(`${_.path.replace(/\/$/,"")}/${x}`),children:["📁 ",x]},x)),_.dirs.length===0&&d.jsx("div",{className:"nc-fs-empty",children:"—"})]}),k&&d.jsx("div",{className:"nc-err",children:k})]}),d.jsxs("label",{className:"nc-field",children:[z("preset"),d.jsx("select",{value:a,onChange:x=>h(x.target.value),children:e.map(x=>d.jsx("option",{value:x,children:x},x))})]}),u&&d.jsx("div",{className:"nc-err",children:u}),d.jsxs("div",{className:"nc-sheet-actions",children:[d.jsx("button",{type:"button",className:"nc-btn ghost",onClick:r,disabled:f,children:z("cancel")}),d.jsx("button",{type:"submit",className:"nc-btn primary",disabled:f||!v,children:z("create")})]})]})})}function Lu(e,t){return t?0:e.attached?1:2}function Ru(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function Ug({onPick:e,token:t}){const[i,r]=Yt(),[s,n]=M.useState(null),[o,l]=M.useState(null),[a,h]=M.useState(""),[f,c]=M.useState(""),[u,p]=M.useState({bind:"127.0.0.1",port:""}),[_,S]=M.useState([]),[k,m]=M.useState(!1),[v,g]=M.useState([]),[w,x]=M.useState(["shell","claude","codex-vl","pi"]),[b,D]=M.useState(null),[N,V]=M.useState(!1);async function H(){try{const Y=await(await _t("/api/sessions",t)).json();Y.error?(l(Y.error),n([])):(l(null),n(Y.sessions||[]))}catch(B){l(String(B)),n([])}try{const B=await nc(t);m(!!B.available),S(B.available?B.cells||[]:[]),g(B.available?B.engines||[]:[])}catch{m(!1),S([]),g([])}}M.useEffect(()=>{H(),_t("/api/config",t).then(Y=>Y.json()).then(Y=>{c(Y.version||""),p({bind:Y.bind||"127.0.0.1",port:Y.port||""}),Array.isArray(Y.presets)&&Y.presets.length&&x(Y.presets)}).catch(()=>{});const B=setInterval(H,4e3);return()=>clearInterval(B)},[]);async function W(){if(!u.port)return;const B=`http://${u.bind}:${u.port}/#token=${t}`;try{await navigator.clipboard.writeText(B)}catch{}}async function A(B){if(!b)return;const{cell:Y}=b;B.action==="up"?await G_(t,{cell:Y,engine:B.engine,boot:!!B.boot}):await Q_(t,{cell:Y,boot:!!B.boot}),H()}async function E(B){try{await Z_(t,B)}catch{return}H()}async function I(B){await J_(t,B),V(!1),H()}const C=M.useMemo(()=>{const B=new Map;for(const Y of s||[])B.set(Y.name,Y);return B},[s]),P=M.useMemo(()=>new Set(_.map(B=>B.tmuxSession)),[_]),[T,y]=M.useState(tp),L=B=>y(Y=>ip(Y,B)),F=M.useMemo(()=>{const B=(s||[]).map(be=>{const Be=Number(localStorage.getItem(X_(be.name))||0),nr=!!(be.outbox&&be.outbox.count>0&&be.outbox.latest>Be);return{...be,fresh:nr}}),Y=a.trim().toLowerCase();return B.filter(be=>!Y||be.name.toLowerCase().includes(Y)).sort((be,Be)=>Ca(ls(T,be.name,be.activity),ls(T,Be.name,Be.activity))||Lu(be,be.fresh)-Lu(Be,Be.fresh)||be.name.localeCompare(Be.name))},[s,a,T]),q=F.filter(B=>!P.has(B.name)),Q=M.useMemo(()=>[..._].sort((B,Y)=>Ca(ls(T,B.tmuxSession,(C.get(B.tmuxSession)||{}).activity),ls(T,Y.tmuxSession,(C.get(Y.tmuxSession)||{}).activity))||Number(Y.active)-Number(B.active)||B.cell.localeCompare(Y.cell)),[_,T,C]),K=s?s.length:0,X=(s||[]).filter(B=>B.attached).length,ke=u.port?`${u.bind}:${u.port}`:u.bind;return d.jsxs("div",{className:"nc-home",children:[d.jsxs("header",{className:"nc-home-head",children:[d.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",d.jsx("span",{className:"nc-cursor"})]}),d.jsxs("div",{className:"nc-home-sub",children:[z("fleet-tmux")," · ",K," ",z("sessions"),X>0&&` · ${X} attached`]}),d.jsx("button",{className:"nc-refresh",onClick:H,title:z("refresh"),children:d.jsx(Re,{name:"refresh",size:18})})]}),K>8&&d.jsx("input",{className:"nc-filter",type:"search",placeholder:z("filter-placeholder"),value:a,onChange:B=>h(B.target.value)}),o&&d.jsx("div",{className:"nc-err",children:o}),k&&_.length>0&&d.jsxs("section",{className:"nc-group",children:[d.jsx("div",{className:"nc-group-title",children:z("fleet")}),Q.map(B=>{const Y=C.get(B.tmuxSession)||{},be=B.degraded?"warn":B.tmux?"on":"",Be=[`${B.engine}${B.key?`·${B.key}`:""}`,Y.preview].filter(Boolean).join(" · ");return d.jsxs("div",{className:"nc-mcard",children:[d.jsxs("button",{className:"nc-mcard-main",onClick:()=>B.tmux&&e(B.tmuxSession),title:B.degraded?z("cell-degraded"):B.tmux?z("cell-on"):z("cell-off"),children:[d.jsx("span",{className:`dot ${be}`}),d.jsxs("span",{className:"nc-mcard-text",children:[d.jsx("b",{children:B.cell}),d.jsx("small",{children:Be})]})]}),Y.activity?d.jsx("span",{className:"nc-rel",children:Ru(Y.activity)}):null,Y.outbox&&Y.outbox.count>0&&d.jsx("span",{className:"nc-badge",title:z("new-files-outbox"),children:Y.outbox.count}),d.jsx("button",{className:`nc-act pin${T.includes(B.tmuxSession)?" on":""}`,title:z("pin"),onClick:()=>L(B.tmuxSession),children:T.includes(B.tmuxSession)?"★":"☆"}),d.jsx("button",{className:`nc-act power${B.tmux?" on":""}${B.degraded?" warn":""}`,onClick:()=>D(B),title:B.active?z("power-off"):z("power-on"),children:d.jsx(Re,{name:"power",size:16})})]},B.cell)})]}),d.jsxs("section",{className:"nc-group",children:[k&&d.jsx("div",{className:"nc-group-title",children:z("other-sessions")}),q.map(B=>d.jsxs("div",{className:"nc-mcard",children:[d.jsxs("button",{className:"nc-mcard-main",onClick:()=>e(B.name),children:[d.jsx("span",{className:B.attached?"dot on":"dot"}),d.jsxs("span",{className:"nc-mcard-text",children:[d.jsx("b",{children:B.name}),d.jsx("small",{children:B.preview?B.preview:B.cmd?B.cmd:z("windows").replace("{n}",String(B.windows||0))})]})]}),B.activity?d.jsx("span",{className:"nc-rel",children:Ru(B.activity)}):null,B.fresh&&d.jsx("span",{className:"nc-badge",title:z("new-files-outbox"),children:B.outbox.count}),d.jsx("button",{className:`nc-act pin${T.includes(B.name)?" on":""}`,title:z("pin"),onClick:()=>L(B.name),children:T.includes(B.name)?"★":"☆"}),d.jsx("button",{className:"nc-menu",title:z("terminate"),onClick:()=>{window.confirm(z("terminate-confirm").replace("{name}",B.name))&&E(B.name)},children:"⋯"})]},B.name)),s===null&&d.jsx("div",{className:"nc-empty",children:z("loading-fleet")}),s!==null&&q.length===0&&F.length===0&&!o&&d.jsx("div",{className:"nc-empty",children:a?z("no-match").replace("{q}",a):z("no-sessions")})]}),d.jsxs("footer",{className:"nc-home-foot",onClick:W,title:z("copy-url"),children:[f&&d.jsxs("span",{children:["v",f]}),d.jsxs("span",{children:[ke," · ",z("ssh-only")]}),d.jsx("span",{className:"nc-lang",onClick:B=>B.stopPropagation(),children:np.map((B,Y)=>d.jsxs("span",{children:[Y>0&&" · ",d.jsx("button",{className:`nc-lang-btn${i===B?" on":""}`,onClick:()=>r(B),title:B,children:B.toUpperCase()})]},B))})]}),d.jsx("button",{className:"nc-fab",onClick:()=>V(!0),title:z("new-session"),"aria-label":z("new-session"),children:"+"}),b&&d.jsx(op,{cell:b,engines:v,onConfirm:A,onClose:()=>D(null)}),N&&d.jsx(lp,{presets:w,token:t,onCreate:I,onClose:()=>V(!1)})]})}/**
|
|
41
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
42
|
-
* @license MIT
|
|
43
|
-
*
|
|
44
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
45
|
-
* @license MIT
|
|
46
|
-
*
|
|
47
|
-
* Originally forked from (with the author's permission):
|
|
48
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
49
|
-
* http://bellard.org/jslinux/
|
|
50
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
51
|
-
*/var ap=Object.defineProperty,Kg=Object.getOwnPropertyDescriptor,Vg=(e,t)=>{for(var i in t)ap(e,i,{get:t[i],enumerable:!0})},ge=(e,t,i,r)=>{for(var s=r>1?void 0:r?Kg(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=(r?o(t,i,s):o(s))||s);return r&&s&&ap(t,i,s),s},j=(e,t)=>(i,r)=>t(i,r,e),Mu="Terminal input",ba={get:()=>Mu,set:e=>Mu=e},Pu="Too much output to announce, navigate to rows manually to read",Ea={get:()=>Pu,set:e=>Pu=e};function qg(e){return e.replace(/\r?\n/g,"\r")}function Yg(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Xg(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Gg(e,t,i,r){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");hp(s,t,i,r)}}function hp(e,t,i,r){e=qg(e),e=Yg(e,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function cp(e,t,i){let r=i.getBoundingClientRect(),s=e.clientX-r.left-10,n=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Bu(e,t,i,r,s){cp(e,t,i),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function mi(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function zo(e,t=0,i=e.length){let r="";for(let s=t;s<i;++s){let n=e[s];n>65535?(n-=65536,r+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):r+=String.fromCharCode(n)}return r}var Qg=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let r=0,s=0;if(this._interim){let n=e.charCodeAt(s++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let n=s;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,r;let l=e.charCodeAt(n);56320<=l&&l<=57343?t[r++]=(o-55296)*1024+l-56320+65536:(t[r++]=o,t[r++]=l);continue}o!==65279&&(t[r++]=o)}return r}},Jg=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let r=0,s,n,o,l,a=0,h=0;if(this.interim[0]){let u=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let _=0,S;for(;(S=this.interim[++_]&63)&&_<4;)p<<=6,p|=S;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,m=k-_;for(;h<m;){if(h>=i)return 0;if(S=e[h++],(S&192)!==128){h--,u=!0;break}else this.interim[_++]=S,p<<=6,p|=S&63}u||(k===2?p<128?h--:t[r++]=p:k===3?p<2048||p>=55296&&p<=57343||p===65279||(t[r++]=p):p<65536||p>1114111||(t[r++]=p)),this.interim.fill(0)}let f=i-4,c=h;for(;c<i;){for(;c<f&&!((s=e[c])&128)&&!((n=e[c+1])&128)&&!((o=e[c+2])&128)&&!((l=e[c+3])&128);)t[r++]=s,t[r++]=n,t[r++]=o,t[r++]=l,c+=4;if(s=e[c++],s<128)t[r++]=s;else if((s&224)===192){if(c>=i)return this.interim[0]=s,r;if(n=e[c++],(n&192)!==128){c--;continue}if(a=(s&31)<<6|n&63,a<128){c--;continue}t[r++]=a}else if((s&240)===224){if(c>=i)return this.interim[0]=s,r;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=s,this.interim[1]=n,r;if(o=e[c++],(o&192)!==128){c--;continue}if(a=(s&15)<<12|(n&63)<<6|o&63,a<2048||a>=55296&&a<=57343||a===65279)continue;t[r++]=a}else if((s&248)===240){if(c>=i)return this.interim[0]=s,r;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=s,this.interim[1]=n,r;if(o=e[c++],(o&192)!==128){c--;continue}if(c>=i)return this.interim[0]=s,this.interim[1]=n,this.interim[2]=o,r;if(l=e[c++],(l&192)!==128){c--;continue}if(a=(s&7)<<18|(n&63)<<12|(o&63)<<6|l&63,a<65536||a>1114111)continue;t[r++]=a}}return r}},up="",wi=" ",Ys=class dp{constructor(){this.fg=0,this.bg=0,this.extended=new _o}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 dp;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}},_o=class fp{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 fp(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Et=class _p extends Ys{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new _o,this.combinedData=""}static fromCharData(t){let i=new _p;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?mi(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 r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-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()]}},Nu="di$target",Da="di$dependencies",ml=new Map;function Zg(e){return e[Da]||[]}function $e(e){if(ml.has(e))return ml.get(e);let t=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");eS(t,i,s)};return t._id=e,ml.set(e,t),t}function eS(e,t,i){t[Nu]===t?t[Da].push({id:e,index:i}):(t[Da]=[{id:e,index:i}],t[Nu]=t)}var tt=$e("BufferService"),pp=$e("CoreMouseService"),sr=$e("CoreService"),tS=$e("CharsetService"),lc=$e("InstantiationService"),mp=$e("LogService"),it=$e("OptionsService"),vp=$e("OscLinkService"),iS=$e("UnicodeService"),Xs=$e("DecorationService"),La=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var f;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,n=new Et,o=i.getTrimmedLength(),l=-1,a=-1,h=!1;for(let c=0;c<o;c++)if(!(a===-1&&!i.hasContent(c))){if(i.loadCell(c,n),n.hasExtendedAttrs()&&n.extended.urlId)if(a===-1){a=c,l=n.extended.urlId;continue}else h=n.extended.urlId!==l;else a!==-1&&(h=!0);if(h||a!==-1&&c===o-1){let u=(f=this._oscLinkService.getLinkData(l))==null?void 0:f.uri;if(u){let p={start:{x:a+1,y:e},end:{x:c+(!h&&c===o-1?1:0),y:e}},_=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let S=new URL(u);["http:","https:"].includes(S.protocol)||(_=!0)}catch{_=!0}_||r.push({text:u,range:p,activate:(S,k)=>s?s.activate(S,k,p):rS(S,k),hover:(S,k)=>{var m;return(m=s==null?void 0:s.hover)==null?void 0:m.call(s,S,k,p)},leave:(S,k)=>{var m;return(m=s==null?void 0:s.leave)==null?void 0:m.call(s,S,k,p)}})}h=!1,n.hasExtendedAttrs()&&n.extended.urlId?(a=c,l=n.extended.urlId):(a=-1,l=-1)}}t(r)}};La=ge([j(0,tt),j(1,it),j(2,vp)],La);function rS(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
52
|
-
|
|
53
|
-
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 $o=$e("CharSizeService"),li=$e("CoreBrowserService"),ac=$e("MouseService"),ai=$e("RenderService"),sS=$e("SelectionService"),gp=$e("CharacterJoinerService"),Fr=$e("ThemeService"),Sp=$e("LinkProviderService"),nS=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Tu.isErrorNoTelemetry(e)?new Tu(e.message+`
|
|
54
|
-
|
|
55
|
-
`+e.stack):new Error(e.message+`
|
|
56
|
-
|
|
57
|
-
`+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)}},oS=new nS;function In(e){lS(e)||oS.onUnexpectedError(e)}var Ra="Canceled";function lS(e){return e instanceof aS?!0:e instanceof Error&&e.name===Ra&&e.message===Ra}var aS=class extends Error{constructor(){super(Ra),this.name=this.message}};function hS(e){return new Error(`Illegal argument: ${e}`)}var Tu=class Ma extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ma)return t;let i=new Ma;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Pa=class yp extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,yp.prototype)}};function ct(e,t=0){return e[e.length-(1+t)]}var cS;(e=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function r(n){return n>0}e.isGreaterThan=r;function s(n){return n===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(cS||(cS={}));function uS(e,t){let i=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(i,arguments))),s}}var wp;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function r(){return i}e.empty=r;function*s(w){yield w}e.single=s;function n(w){return t(w)?w:s(w)}e.wrap=n;function o(w){return w||i}e.from=o;function*l(w){for(let x=w.length-1;x>=0;x--)yield w[x]}e.reverse=l;function a(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=a;function h(w){return w[Symbol.iterator]().next().value}e.first=h;function f(w,x){let b=0;for(let D of w)if(x(D,b++))return!0;return!1}e.some=f;function c(w,x){for(let b of w)if(x(b))return b}e.find=c;function*u(w,x){for(let b of w)x(b)&&(yield b)}e.filter=u;function*p(w,x){let b=0;for(let D of w)yield x(D,b++)}e.map=p;function*_(w,x){let b=0;for(let D of w)yield*x(D,b++)}e.flatMap=_;function*S(...w){for(let x of w)yield*x}e.concat=S;function k(w,x,b){let D=b;for(let N of w)D=x(D,N);return D}e.reduce=k;function*m(w,x,b=w.length){for(x<0&&(x+=w.length),b<0?b+=w.length:b>w.length&&(b=w.length);x<b;x++)yield w[x]}e.slice=m;function v(w,x=Number.POSITIVE_INFINITY){let b=[];if(x===0)return[b,w];let D=w[Symbol.iterator]();for(let N=0;N<x;N++){let V=D.next();if(V.done)return[b,e.empty()];b.push(V.value)}return[b,{[Symbol.iterator](){return D}}]}e.consume=v;async function g(w){let x=[];for await(let b of w)x.push(b);return Promise.resolve(x)}e.asyncToArray=g})(wp||(wp={}));function er(e){if(wp.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(r){t.push(r)}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 dS(...e){return ce(()=>er(e))}function ce(e){return{dispose:uS(()=>{e()})}}var Cp=class xp{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{er(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?xp.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)}};Cp.DISABLE_DISPOSED_WARNING=!1;var Mi=Cp,Z=class{constructor(){this._store=new Mi,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)}};Z.None=Object.freeze({dispose(){}});var Or=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}},ei=typeof window=="object"?window:globalThis,Ba=class Na{constructor(t){this.element=t,this.next=Na.Undefined,this.prev=Na.Undefined}};Ba.Undefined=new Ba(void 0);var ue=Ba,Ou=class{constructor(){this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ue.Undefined}clear(){let e=this._first;for(;e!==ue.Undefined;){let t=e.next;e.prev=ue.Undefined,e.next=ue.Undefined,e=t}this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new ue(e);if(this._first===ue.Undefined)this._first=i,this._last=i;else if(t){let s=this._last;this._last=i,i.prev=s,s.next=i}else{let s=this._first;this._first=i,i.next=s,s.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==ue.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ue.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ue.Undefined&&e.next!==ue.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ue.Undefined&&e.next===ue.Undefined?(this._first=ue.Undefined,this._last=ue.Undefined):e.next===ue.Undefined?(this._last=this._last.prev,this._last.next=ue.Undefined):e.prev===ue.Undefined&&(this._first=this._first.next,this._first.prev=ue.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ue.Undefined;)yield e.element,e=e.next}},fS=globalThis.performance&&typeof globalThis.performance.now=="function",_S=class kp{static create(t){return new kp(t)}constructor(t){this._now=fS&&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}},je;(e=>{e.None=()=>Z.None;function t(A,E){return c(A,()=>{},0,void 0,!0,void 0,E)}e.defer=t;function i(A){return(E,I=null,C)=>{let P=!1,T;return T=A(y=>{if(!P)return T?T.dispose():P=!0,E.call(I,y)},null,C),P&&T.dispose(),T}}e.once=i;function r(A,E,I){return h((C,P=null,T)=>A(y=>C.call(P,E(y)),null,T),I)}e.map=r;function s(A,E,I){return h((C,P=null,T)=>A(y=>{E(y),C.call(P,y)},null,T),I)}e.forEach=s;function n(A,E,I){return h((C,P=null,T)=>A(y=>E(y)&&C.call(P,y),null,T),I)}e.filter=n;function o(A){return A}e.signal=o;function l(...A){return(E,I=null,C)=>{let P=dS(...A.map(T=>T(y=>E.call(I,y))));return f(P,C)}}e.any=l;function a(A,E,I,C){let P=I;return r(A,T=>(P=E(P,T),P),C)}e.reduce=a;function h(A,E){let I,C={onWillAddFirstListener(){I=A(P.fire,P)},onDidRemoveLastListener(){I==null||I.dispose()}},P=new $(C);return E==null||E.add(P),P.event}function f(A,E){return E instanceof Array?E.push(A):E&&E.add(A),A}function c(A,E,I=100,C=!1,P=!1,T,y){let L,F,q,Q=0,K,X={leakWarningThreshold:T,onWillAddFirstListener(){L=A(B=>{Q++,F=E(F,B),C&&!q&&(ke.fire(F),F=void 0),K=()=>{let Y=F;F=void 0,q=void 0,(!C||Q>1)&&ke.fire(Y),Q=0},typeof I=="number"?(clearTimeout(q),q=setTimeout(K,I)):q===void 0&&(q=0,queueMicrotask(K))})},onWillRemoveListener(){P&&Q>0&&(K==null||K())},onDidRemoveLastListener(){K=void 0,L.dispose()}},ke=new $(X);return y==null||y.add(ke),ke.event}e.debounce=c;function u(A,E=0,I){return e.debounce(A,(C,P)=>C?(C.push(P),C):[P],E,void 0,!0,void 0,I)}e.accumulate=u;function p(A,E=(C,P)=>C===P,I){let C=!0,P;return n(A,T=>{let y=C||!E(T,P);return C=!1,P=T,y},I)}e.latch=p;function _(A,E,I){return[e.filter(A,E,I),e.filter(A,C=>!E(C),I)]}e.split=_;function S(A,E=!1,I=[],C){let P=I.slice(),T=A(F=>{P?P.push(F):L.fire(F)});C&&C.add(T);let y=()=>{P==null||P.forEach(F=>L.fire(F)),P=null},L=new $({onWillAddFirstListener(){T||(T=A(F=>L.fire(F)),C&&C.add(T))},onDidAddFirstListener(){P&&(E?setTimeout(y):y())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return C&&C.add(L),L.event}e.buffer=S;function k(A,E){return(I,C,P)=>{let T=E(new v);return A(function(y){let L=T.evaluate(y);L!==m&&I.call(C,L)},void 0,P)}}e.chain=k;let m=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(E){return this.steps.push(E),this}forEach(E){return this.steps.push(I=>(E(I),I)),this}filter(E){return this.steps.push(I=>E(I)?I:m),this}reduce(E,I){let C=I;return this.steps.push(P=>(C=E(C,P),C)),this}latch(E=(I,C)=>I===C){let I=!0,C;return this.steps.push(P=>{let T=I||!E(P,C);return I=!1,C=P,T?P:m}),this}evaluate(E){for(let I of this.steps)if(E=I(E),E===m)break;return E}}function g(A,E,I=C=>C){let C=(...L)=>y.fire(I(...L)),P=()=>A.on(E,C),T=()=>A.removeListener(E,C),y=new $({onWillAddFirstListener:P,onDidRemoveLastListener:T});return y.event}e.fromNodeEventEmitter=g;function w(A,E,I=C=>C){let C=(...L)=>y.fire(I(...L)),P=()=>A.addEventListener(E,C),T=()=>A.removeEventListener(E,C),y=new $({onWillAddFirstListener:P,onDidRemoveLastListener:T});return y.event}e.fromDOMEventEmitter=w;function x(A){return new Promise(E=>i(A)(E))}e.toPromise=x;function b(A){let E=new $;return A.then(I=>{E.fire(I)},()=>{E.fire(void 0)}).finally(()=>{E.dispose()}),E.event}e.fromPromise=b;function D(A,E){return A(I=>E.fire(I))}e.forward=D;function N(A,E,I){return E(I),A(C=>E(C))}e.runAndSubscribe=N;class V{constructor(E,I){this._observable=E,this._counter=0,this._hasChanged=!1;let C={onWillAddFirstListener:()=>{E.addObserver(this)},onDidRemoveLastListener:()=>{E.removeObserver(this)}};this.emitter=new $(C),I&&I.add(this.emitter)}beginUpdate(E){this._counter++}handlePossibleChange(E){}handleChange(E,I){this._hasChanged=!0}endUpdate(E){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function H(A,E){return new V(A,E).emitter.event}e.fromObservable=H;function W(A){return(E,I,C)=>{let P=0,T=!1,y={beginUpdate(){P++},endUpdate(){P--,P===0&&(A.reportChanges(),T&&(T=!1,E.call(I)))},handlePossibleChange(){},handleChange(){T=!0}};A.addObserver(y),A.reportChanges();let L={dispose(){A.removeObserver(y)}};return C instanceof Mi?C.add(L):Array.isArray(C)&&C.push(L),L}}e.fromObservableLight=W})(je||(je={}));var Ta=class Oa{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Oa._idPool++}`,Oa.all.add(this)}start(t){this._stopWatch=new _S,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}}};Ta.all=new Set,Ta._idPool=0;var pS=Ta,mS=-1,bp=class Ep{constructor(t,i,r=(Ep._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let a=new SS(l,n);this._errorHandler(a)}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[r,s]of this._stacks)(!t||i<s)&&(t=[r,s],i=s);return t}};bp._idPool=1;var vS=bp,gS=class Dp{constructor(t){this.value=t}static create(){let t=new Error;return new Dp(t.stack??"")}print(){console.warn(this.value.split(`
|
|
58
|
-
`).slice(2).join(`
|
|
59
|
-
`))}},SS=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},yS=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},wS=0,vl=class{constructor(e){this.value=e,this.id=wS++}},CS=2,xS,$=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new vS((e==null?void 0:e.onListenerError)??In,((i=this._options)==null?void 0:i.leakWarningThreshold)??mS):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new pS(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,i,r;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),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var o,l,a,h,f;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let c=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(c);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new yS(`${c}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(((o=this._options)==null?void 0:o.onListenerError)||In)(p),Z.None}if(this._disposed)return Z.None;t&&(e=e.bind(t));let r=new vl(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=gS.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof vl?(this._deliveryQueue??(this._deliveryQueue=new kS),this._listeners=[this._listeners,r]):this._listeners.push(r):((a=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||a.call(l,this),this._listeners=r,(f=(h=this._options)==null?void 0:h.onDidAddFirstListener)==null||f.call(h,this)),this._size++;let n=ce(()=>{s==null||s(),this._removeListener(r)});return i instanceof Mi?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(e){var s,n,o,l;if((n=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||n.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||l.call(o,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 r=this._deliveryQueue.current===this;if(this._size*CS<=t.length){let a=0;for(let h=0;h<t.length;h++)t[h]?t[a++]=t[h]:r&&(this._deliveryQueue.end--,a<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=a}}_deliver(e,t){var r;if(!e)return;let i=((r=this._options)==null?void 0:r.onListenerError)||In;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_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,r,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof vl)this._deliver(this._listeners,e);else{let n=this._deliveryQueue;n.enqueue(this,e,this._listeners.length),this._deliverQueue(n)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},kS=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}},Aa=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new $,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new $,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 r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}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 r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Aa.INSTANCE=new Aa;var hc=Aa;function bS(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}hc.INSTANCE.onDidChangeZoomLevel;function ES(e){return hc.INSTANCE.getZoomFactor(e)}hc.INSTANCE.onDidChangeFullscreen;var Hr=typeof navigator=="object"?navigator.userAgent:"",Ia=Hr.indexOf("Firefox")>=0,DS=Hr.indexOf("AppleWebKit")>=0,cc=Hr.indexOf("Chrome")>=0,LS=!cc&&Hr.indexOf("Safari")>=0;Hr.indexOf("Electron/")>=0;Hr.indexOf("Android")>=0;var gl=!1;if(typeof ei.matchMedia=="function"){let e=ei.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ei.matchMedia("(display-mode: fullscreen)");gl=e.matches,bS(ei,e,({matches:i})=>{gl&&t.matches||(gl=i)})}var wr="en",za=!1,$a=!1,zn=!1,Lp=!1,gn,$n=wr,Au=wr,RS,Mt,Yi=globalThis,He,Nd;typeof Yi.vscode<"u"&&typeof Yi.vscode.process<"u"?He=Yi.vscode.process:typeof process<"u"&&typeof((Nd=process==null?void 0:process.versions)==null?void 0:Nd.node)=="string"&&(He=process);var Td,MS=typeof((Td=He==null?void 0:He.versions)==null?void 0:Td.electron)=="string",PS=MS&&(He==null?void 0:He.type)==="renderer",Od;if(typeof He=="object"){za=He.platform==="win32",$a=He.platform==="darwin",zn=He.platform==="linux",zn&&He.env.SNAP&&He.env.SNAP_REVISION,He.env.CI||He.env.BUILD_ARTIFACTSTAGINGDIRECTORY,gn=wr,$n=wr;let e=He.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);gn=t.userLocale,Au=t.osLocale,$n=t.resolvedLanguage||wr,RS=(Od=t.languagePack)==null?void 0:Od.translationsConfigFile}catch{}Lp=!0}else typeof navigator=="object"&&!PS?(Mt=navigator.userAgent,za=Mt.indexOf("Windows")>=0,$a=Mt.indexOf("Macintosh")>=0,(Mt.indexOf("Macintosh")>=0||Mt.indexOf("iPad")>=0||Mt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,zn=Mt.indexOf("Linux")>=0,(Mt==null?void 0:Mt.indexOf("Mobi"))>=0,$n=globalThis._VSCODE_NLS_LANGUAGE||wr,gn=navigator.language.toLowerCase(),Au=gn):console.error("Unable to resolve platform.");var Rp=za,Vt=$a,BS=zn,Iu=Lp,qt=Mt,ui=$n,NS;(e=>{function t(){return ui}e.value=t;function i(){return ui.length===2?ui==="en":ui.length>=3?ui[0]==="e"&&ui[1]==="n"&&ui[2]==="-":!1}e.isDefaultVariant=i;function r(){return ui==="en"}e.isDefault=r})(NS||(NS={}));var TS=typeof Yi.postMessage=="function"&&!Yi.importScripts;(()=>{if(TS){let e=[];Yi.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let n=e[r];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),n.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),Yi.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var OS=!!(qt&&qt.indexOf("Chrome")>=0);qt&&qt.indexOf("Firefox")>=0;!OS&&qt&&qt.indexOf("Safari")>=0;qt&&qt.indexOf("Edg/")>=0;qt&&qt.indexOf("Android")>=0;var lr=typeof navigator=="object"?navigator:{};Iu||document.queryCommandSupported&&document.queryCommandSupported("copy")||lr&&lr.clipboard&&lr.clipboard.writeText,Iu||lr&&lr.clipboard&&lr.clipboard.readText;var uc=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}},Sl=new uc,zu=new uc,$u=new uc,AS=new Array(230),Mp;(e=>{function t(l){return Sl.keyCodeToStr(l)}e.toString=t;function i(l){return Sl.strToKeyCode(l)}e.fromString=i;function r(l){return zu.keyCodeToStr(l)}e.toUserSettingsUS=r;function s(l){return $u.keyCodeToStr(l)}e.toUserSettingsGeneral=s;function n(l){return zu.strToKeyCode(l)||$u.strToKeyCode(l)}e.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Sl.keyCodeToStr(l)}e.toElectronAccelerator=o})(Mp||(Mp={}));var IS=class Pp{constructor(t,i,r,s,n){this.ctrlKey=t,this.shiftKey=i,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(t){return t instanceof Pp&&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",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${i}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new zS([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},zS=class{constructor(e){if(e.length===0)throw hS("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 $S(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return Mp.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(Ia)switch(t){case 59:return 85;case 60:if(BS)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Vt)return 57;break}else if(DS&&(Vt&&t===93||!Vt&&t===92))return 57;return AS[t]||0}var FS=Vt?256:2048,HS=512,jS=1024,WS=Vt?2048:256,Fu=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=$S(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|=FS),this.altKey&&(t|=HS),this.shiftKey&&(t|=jS),this.metaKey&&(t|=WS),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new IS(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Hu=new WeakMap;function US(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 KS=class{static getSameOriginWindowChain(e){let t=Hu.get(e);if(!t){t=[],Hu.set(e,t);let i=e,r;do r=US(i),r?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,r=0,s=this.getSameOriginWindowChain(e);for(let n of s){let o=n.window.deref();if(i+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();i+=l.top,r+=l.left}return{top:i,left:r}}},Sn=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=KS.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},ju=class{constructor(e,t=0,i=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let r=!1;if(cc){let n=navigator.userAgent.match(/Chrome\/(\d+)/);r=(n?parseInt(n[1]):123)<=122}if(e){let n=e,o=e,l=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof n.wheelDeltaY<"u")r?this.deltaY=n.wheelDeltaY/(120*l):this.deltaY=n.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?Ia&&!Vt?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof n.wheelDeltaX<"u")LS&&Rp?this.deltaX=-(n.wheelDeltaX/120):r?this.deltaX=n.wheelDeltaX/(120*l):this.deltaX=n.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?Ia&&!Vt?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Bp=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),VS;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof qS?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:je.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Bp})})(VS||(VS={}));var qS=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?Bp:(this._emitter||(this._emitter=new $),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},dc=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 Pa("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Pa("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},YS=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 Pa("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{e()},t);this.disposable=ce(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},XS;(e=>{async function t(r){let s,n=await Promise.all(r.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return n}e.settled=t;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}e.withAsyncBody=i})(XS||(XS={}));var Wu=class yt{static fromArray(t){return new yt(i=>{i.emitMany(t)})}static fromPromise(t){return new yt(async i=>{i.emitMany(await t)})}static fromPromises(t){return new yt(async i=>{await Promise.all(t.map(async r=>i.emitOne(await r)))})}static merge(t){return new yt(async i=>{await Promise.all(t.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new $,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.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 je.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 yt(async r=>{for await(let s of t)r.emitOne(i(s))})}map(t){return yt.map(this,t)}static filter(t,i){return new yt(async r=>{for await(let s of t)i(s)&&r.emitOne(s)})}filter(t){return yt.filter(this,t)}static coalesce(t){return yt.filter(t,i=>!!i)}coalesce(){return yt.coalesce(this)}static async toPromise(t){let i=[];for await(let r of t)i.push(r);return i}toPromise(){return yt.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())}};Wu.EMPTY=Wu.fromArray([]);var{getWindow:Wt,getWindowId:GS,onDidRegisterWindow:QS}=function(){let e=new Map,t={window:ei,disposables:new Mi};e.set(ei.vscodeWindowId,t);let i=new $,r=new $,s=new $;function n(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Z.None;let l=new Mi,a={window:o,disposables:l.add(new Mi)};return e.set(o.vscodeWindowId,a),l.add(ce(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),l.add(G(o,Ne.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(a),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){var h;let l=o;if((h=l==null?void 0:l.ownerDocument)!=null&&h.defaultView)return l.ownerDocument.defaultView.window;let a=o;return a!=null&&a.view?a.view.window:ei},getDocument(o){return Wt(o).document}}}(),JS=class{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,this._options=r||!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,r){return new JS(e,t,i,r)}var Uu=function(e,t,i,r){return G(e,t,i,r)},fc,ZS=class extends YS{constructor(e){super(),this.defaultTarget=e&&Wt(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},Ku=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){In(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,r=new Map,s=n=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),r.set(n,!0);o.length>0;)o.sort(Ku.sort),o.shift().execute();r.set(n,!1)};fc=(n,o,l=0)=>{let a=GS(n),h=new Ku(o,l),f=e.get(a);return f||(f=[],e.set(a,f)),f.push(h),i.get(a)||(i.set(a,!0),n.requestAnimationFrame(()=>s(a))),h}})();function e0(e){let t=e.getBoundingClientRect(),i=Wt(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var Ne={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"},t0=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=rt(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=rt(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=rt(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=rt(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=rt(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=rt(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=rt(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=rt(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=rt(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=rt(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=rt(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=rt(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=rt(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=rt(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 rt(e){return typeof e=="number"?`${e}px`:e}function Cs(e){return new t0(e)}var Np=class{constructor(){this._hooks=new Mi,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,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let n=e;try{e.setPointerCapture(t),this._hooks.add(ce(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=Wt(e)}this._hooks.add(G(n,Ne.POINTER_MOVE,o=>{if(o.buttons!==i){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(G(n,Ne.POINTER_UP,o=>this.stopMonitoring(!0)))}};function i0(e,t,i){let r=null,s=null;if(typeof i.value=="function"?(r="value",s=i.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(r="get",s=i.get),!s)throw new Error("not supported");let n=`$memoize$${t}`;i[r]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[n]}}var Ft;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ft||(Ft={}));var as=class qe extends Z{constructor(){super(),this.dispatched=!1,this.targets=new Ou,this.ignoreTargets=new Ou,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(je.runAndSubscribe(QS,({window:t,disposables:i})=>{i.add(G(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(G(t.document,"touchend",r=>this.onTouchEnd(t,r))),i.add(G(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:ei,disposables:this._store}))}static addTarget(t){if(!qe.isTouchDevice())return Z.None;qe.INSTANCE||(qe.INSTANCE=new qe);let i=qe.INSTANCE.targets.push(t);return ce(i)}static ignoreTarget(t){if(!qe.isTouchDevice())return Z.None;qe.INSTANCE||(qe.INSTANCE=new qe);let i=qe.INSTANCE.ignoreTargets.push(t);return ce(i)}static isTouchDevice(){return"ontouchstart"in ei||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 r=0,s=t.targetTouches.length;r<s;r++){let n=t.targetTouches.item(r);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 o=this.newGestureEvent(Ft.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let l=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let a=this.activeTouches[l.identifier],h=Date.now()-a.initialTimeStamp;if(h<qe.HOLD_DELAY&&Math.abs(a.initialPageX-ct(a.rollingPageX))<30&&Math.abs(a.initialPageY-ct(a.rollingPageY))<30){let f=this.newGestureEvent(Ft.Tap,a.initialTarget);f.pageX=ct(a.rollingPageX),f.pageY=ct(a.rollingPageY),this.dispatchEvent(f)}else if(h>=qe.HOLD_DELAY&&Math.abs(a.initialPageX-ct(a.rollingPageX))<30&&Math.abs(a.initialPageY-ct(a.rollingPageY))<30){let f=this.newGestureEvent(Ft.Contextmenu,a.initialTarget);f.pageX=ct(a.rollingPageX),f.pageY=ct(a.rollingPageY),this.dispatchEvent(f)}else if(s===1){let f=ct(a.rollingPageX),c=ct(a.rollingPageY),u=ct(a.rollingTimestamps)-a.rollingTimestamps[0],p=f-a.rollingPageX[0],_=c-a.rollingPageY[0],S=[...this.targets].filter(k=>a.initialTarget instanceof Node&&k.contains(a.initialTarget));this.inertia(t,S,r,Math.abs(p)/u,p>0?1:-1,f,Math.abs(_)/u,_>0?1:-1,c)}this.dispatchEvent(this.newGestureEvent(Ft.End,a.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(t){if(t.type===Ft.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>qe.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,t.tapCount=r}else(t.type===Ft.Change||t.type===Ft.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let s=0,n=t.initialTarget;for(;n&&n!==r;)s++,n=n.parentElement;i.push([s,r])}i.sort((r,s)=>r[0]-s[0]);for(let[r,s]of i)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,r,s,n,o,l,a,h){this.handle=fc(t,()=>{let f=Date.now(),c=f-r,u=0,p=0,_=!0;s+=qe.SCROLL_FRICTION*c,l+=qe.SCROLL_FRICTION*c,s>0&&(_=!1,u=n*s*c),l>0&&(_=!1,p=a*l*c);let S=this.newGestureEvent(Ft.Change);S.translationX=u,S.translationY=p,i.forEach(k=>k.dispatchEvent(S)),_||this.inertia(t,i,f,s,n,o+u,l,a,h+p)})}onTouchMove(t){let i=Date.now();for(let r=0,s=t.changedTouches.length;r<s;r++){let n=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],l=this.newGestureEvent(Ft.Change,o.initialTarget);l.translationX=n.pageX-ct(o.rollingPageX),l.translationY=n.pageY-ct(o.rollingPageY),l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};as.SCROLL_FRICTION=-.005,as.HOLD_DELAY=700,as.CLEAR_TAP_COUNT_TIME=400,ge([i0],as,"isTouchDevice",1);var r0=as,_c=class extends Z{onclick(e,t){this._register(G(e,Ne.CLICK,i=>t(new Sn(Wt(e),i))))}onmousedown(e,t){this._register(G(e,Ne.MOUSE_DOWN,i=>t(new Sn(Wt(e),i))))}onmouseover(e,t){this._register(G(e,Ne.MOUSE_OVER,i=>t(new Sn(Wt(e),i))))}onmouseleave(e,t){this._register(G(e,Ne.MOUSE_LEAVE,i=>t(new Sn(Wt(e),i))))}onkeydown(e,t){this._register(G(e,Ne.KEY_DOWN,i=>t(new Fu(i))))}onkeyup(e,t){this._register(G(e,Ne.KEY_UP,i=>t(new Fu(i))))}oninput(e,t){this._register(G(e,Ne.INPUT,t))}onblur(e,t){this._register(G(e,Ne.BLUR,t))}onfocus(e,t){this._register(G(e,Ne.FOCUS,t))}onchange(e,t){this._register(G(e,Ne.CHANGE,t))}ignoreGesture(e){return r0.ignoreTarget(e)}},Vu=11,s0=class extends _c{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Vu+"px",this.domNode.style.height=Vu+"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 Np),this._register(Uu(this.bgDomNode,Ne.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Uu(this.domNode,Ne.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new ZS),this._pointerdownScheduleRepeatTimer=this._register(new dc)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Wt(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()}},n0=class Fa{constructor(t,i,r,s,n,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,s=s|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,i<0&&(i=0),s+i>r&&(s=r-i),s<0&&(s=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=r,this.scrollLeft=s,this.height=n,this.scrollHeight=o,this.scrollTop=l}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 Fa(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 Fa(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 r=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,a=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:r,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},o0=class extends Z{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new $),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new n0(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 r;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.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 r;t?r=new Yu(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=Yu.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)))}},qu=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function yl(e,t){let i=t-e;return function(r){return e+i*h0(r)}}function l0(e,t,i){return function(r){return r<i?e(r/i):t((r-i)/(1-i))}}var Yu=class Ha{constructor(t,i,r,s){this.from=t,this.to=i,this.duration=s,this.startTime=r,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,r){if(Math.abs(t-i)>2.5*r){let s,n;return t<i?(s=t+.75*r,n=i-.75*r):(s=t-.75*r,n=i+.75*r),l0(yl(t,s),yl(n,i),.33)}return yl(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 r=this.scrollLeft(i),s=this.scrollTop(i);return new qu(r,s,!1)}return new qu(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,r){return Ha.start(t,i,r)}static start(t,i,r){r=r+10;let s=Date.now()-10;return new Ha(t,i,s,r)}};function a0(e){return Math.pow(e,3)}function h0(e){return 1-a0(1-e)}var c0=class extends Z{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 dc)}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":"")))}},u0=140,Tp=class extends _c{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new c0(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Np),this._shouldRender=!0,this.domNode=Cs(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,Ne.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new s0(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=Cs(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 r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(G(this.slider.domNode,Ne.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);i<=s&&s<=r?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 s=e0(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}let r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),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),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let n=this._sliderOrthogonalPointerPosition(s),o=Math.abs(n-i);if(Rp&&o>u0){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let l=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(l))},()=>{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()}},Op=class ja{constructor(t,i,r,s,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new ja(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,r,s,n){let o=Math.max(0,r-t),l=Math.max(0,o-2*i),a=s>0&&s>r;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(r*l/s))),f=(l-h)/(s-r),c=n*f;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(h),computedSliderRatio:f,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){let t=ja._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,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},d0=class extends Tp{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Op(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,s.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}},f0=class extends Tp{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Op(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.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}},_0=500,Xu=50,p0=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Wa=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,r=1,s=this._rear;do{let n=s===this._front?t:Math.pow(2,-r);if(t-=n,i+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(cc){let i=Wt(t.browserEvent),r=ES(i);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,r){let s=null,n=new p0(t,i,r);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,s)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),i){let s=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),a=Math.max(Math.min(s,o),1),h=Math.max(Math.min(n,l),1),f=Math.max(s,o),c=Math.max(n,l);f%a===0&&c%h===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Wa.INSTANCE=new Wa;var m0=Wa,v0=class extends _c{constructor(e,t,i){super(),this._onScroll=this._register(new $),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new $),this.onWillScroll=this._onWillScroll.event,this._options=S0(t),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new f0(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new d0(this._scrollable,this._options,r)),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=Cs(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Cs(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Cs(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new dc),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=er(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,Vt&&(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 ju(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=er(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new ju(i))};this._mouseWheelToDispose.push(G(this._listenOnDomNode,Ne.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=m0.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let l=!Vt&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),h={};if(n){let f=Xu*n,c=a.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(h,c)}if(o){let f=Xu*o,c=a.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(h,c)}h=this._scrollable.validateScrollPosition(h),(a.scrollLeft!==h.scrollLeft||a.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(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,r=i?" left":"",s=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${s}${r}`)}}_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(),_0)}},g0=class extends v0{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 S0(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,Vt&&(t.className+=" mac"),t}var Ua=class extends Z{constructor(e,t,i,r,s,n,o,l){super(),this._bufferService=i,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new $),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new o0({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>fc(r.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new g0(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},a)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(je.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ce(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ce(()=>this._styleElement.remove())),this._register(je.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(`
|
|
60
|
-
`)})),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(h=>this._handleScroll(h)))}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}};Ua=ge([j(2,tt),j(3,li),j(4,pp),j(5,Fr),j(6,it),j(7,ai)],Ua);var Ka=class extends Z{constructor(e,t,i,r,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=r,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(n=>this._removeDecoration(n))),this._register(ce(()=>{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 r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.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()}};Ka=ge([j(1,tt),j(2,li),j(3,Xs),j(4,ai)],Ka);var y0=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)}},zt={full:0,left:0,center:0,right:0},di={full:0,left:0,center:0,right:0},Qr={full:0,left:0,center:0,right:0},po=class extends Z{constructor(e,t,i,r,s,n,o,l){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=r,this._renderService=s,this._optionsService=n,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new y0,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(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(ce(()=>{var f;return(f=this._canvas)==null?void 0:f.remove()}));let a=this._canvas.getContext("2d");if(a)this._ctx=a;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);di.full=this._canvas.width,di.left=e,di.center=t,di.right=e,this._refreshDrawHeightConstants(),Qr.full=1,Qr.left=1,Qr.center=1+di.left,Qr.right=1+di.left+di.center}_refreshDrawHeightConstants(){zt.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);zt.left=t,zt.center=t,zt.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zt.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zt.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zt.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zt.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(Qr[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-zt[e.position||"full"]/2),di[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+zt[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}))}};po=ge([j(2,tt),j(3,Xs),j(4,ai),j(5,it),j(6,Fr),j(7,li)],po);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=`
|
|
61
|
-
`,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 Fn;(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=""))(Fn||(Fn={}));var Ap;(e=>e.ST=`${R.ESC}\\`)(Ap||(Ap={}));var Va=class{constructor(e,t,i,r,s,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=r,this._coreService=s,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,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"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=s+"px",this._textarea.style.top=r+"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)}}};Va=ge([j(2,tt),j(3,it),j(4,sr),j(5,ai)],Va);var Oe=0,Ae=0,Ie=0,me=0,Gu={css:"#00000000",rgba:0},Ce;(e=>{function t(s,n,o,l){return l!==void 0?`#${Ii(s)}${Ii(n)}${Ii(o)}${Ii(l)}`:`#${Ii(s)}${Ii(n)}${Ii(o)}`}e.toCss=t;function i(s,n,o,l=255){return(s<<24|n<<16|o<<8|l)>>>0}e.toRgba=i;function r(s,n,o,l){return{css:e.toCss(s,n,o,l),rgba:e.toRgba(s,n,o,l)}}e.toColor=r})(Ce||(Ce={}));var le;(e=>{function t(a,h){if(me=(h.rgba&255)/255,me===1)return{css:h.css,rgba:h.rgba};let f=h.rgba>>24&255,c=h.rgba>>16&255,u=h.rgba>>8&255,p=a.rgba>>24&255,_=a.rgba>>16&255,S=a.rgba>>8&255;Oe=p+Math.round((f-p)*me),Ae=_+Math.round((c-_)*me),Ie=S+Math.round((u-S)*me);let k=Ce.toCss(Oe,Ae,Ie),m=Ce.toRgba(Oe,Ae,Ie);return{css:k,rgba:m}}e.blend=t;function i(a){return(a.rgba&255)===255}e.isOpaque=i;function r(a,h,f){let c=Hn.ensureContrastRatio(a.rgba,h.rgba,f);if(c)return Ce.toColor(c>>24&255,c>>16&255,c>>8&255)}e.ensureContrastRatio=r;function s(a){let h=(a.rgba|255)>>>0;return[Oe,Ae,Ie]=Hn.toChannels(h),{css:Ce.toCss(Oe,Ae,Ie),rgba:h}}e.opaque=s;function n(a,h){return me=Math.round(h*255),[Oe,Ae,Ie]=Hn.toChannels(a.rgba),{css:Ce.toCss(Oe,Ae,Ie,me),rgba:Ce.toRgba(Oe,Ae,Ie,me)}}e.opacity=n;function o(a,h){return me=a.rgba&255,n(a,me*h/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})(le||(le={}));var de;(e=>{let t,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Oe=parseInt(s.slice(1,2).repeat(2),16),Ae=parseInt(s.slice(2,3).repeat(2),16),Ie=parseInt(s.slice(3,4).repeat(2),16),Ce.toColor(Oe,Ae,Ie);case 5:return Oe=parseInt(s.slice(1,2).repeat(2),16),Ae=parseInt(s.slice(2,3).repeat(2),16),Ie=parseInt(s.slice(3,4).repeat(2),16),me=parseInt(s.slice(4,5).repeat(2),16),Ce.toColor(Oe,Ae,Ie,me);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Oe=parseInt(n[1]),Ae=parseInt(n[2]),Ie=parseInt(n[3]),me=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ce.toColor(Oe,Ae,Ie,me);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Oe,Ae,Ie,me]=t.getImageData(0,0,1,1).data,me!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ce.toRgba(Oe,Ae,Ie,me),css:s}}e.toColor=r})(de||(de={}));var Ge;(e=>{function t(r){return i(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function i(r,s,n){let o=r/255,l=s/255,a=n/255,h=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),f=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return h*.2126+f*.7152+c*.0722}e.relativeLuminance2=i})(Ge||(Ge={}));var Hn;(e=>{function t(o,l){if(me=(l&255)/255,me===1)return l;let a=l>>24&255,h=l>>16&255,f=l>>8&255,c=o>>24&255,u=o>>16&255,p=o>>8&255;return Oe=c+Math.round((a-c)*me),Ae=u+Math.round((h-u)*me),Ie=p+Math.round((f-p)*me),Ce.toRgba(Oe,Ae,Ie)}e.blend=t;function i(o,l,a){let h=Ge.relativeLuminance(o>>8),f=Ge.relativeLuminance(l>>8);if(Xt(h,f)<a){if(f<h){let p=r(o,l,a),_=Xt(h,Ge.relativeLuminance(p>>8));if(_<a){let S=s(o,l,a),k=Xt(h,Ge.relativeLuminance(S>>8));return _>k?p:S}return p}let c=s(o,l,a),u=Xt(h,Ge.relativeLuminance(c>>8));if(u<a){let p=r(o,l,a),_=Xt(h,Ge.relativeLuminance(p>>8));return u>_?c:p}return c}}e.ensureContrastRatio=i;function r(o,l,a){let h=o>>24&255,f=o>>16&255,c=o>>8&255,u=l>>24&255,p=l>>16&255,_=l>>8&255,S=Xt(Ge.relativeLuminance2(u,p,_),Ge.relativeLuminance2(h,f,c));for(;S<a&&(u>0||p>0||_>0);)u-=Math.max(0,Math.ceil(u*.1)),p-=Math.max(0,Math.ceil(p*.1)),_-=Math.max(0,Math.ceil(_*.1)),S=Xt(Ge.relativeLuminance2(u,p,_),Ge.relativeLuminance2(h,f,c));return(u<<24|p<<16|_<<8|255)>>>0}e.reduceLuminance=r;function s(o,l,a){let h=o>>24&255,f=o>>16&255,c=o>>8&255,u=l>>24&255,p=l>>16&255,_=l>>8&255,S=Xt(Ge.relativeLuminance2(u,p,_),Ge.relativeLuminance2(h,f,c));for(;S<a&&(u<255||p<255||_<255);)u=Math.min(255,u+Math.ceil((255-u)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),S=Xt(Ge.relativeLuminance2(u,p,_),Ge.relativeLuminance2(h,f,c));return(u<<24|p<<16|_<<8|255)>>>0}e.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=n})(Hn||(Hn={}));function Ii(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Xt(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var w0=class extends Ys{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()]}},mo=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Et}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=[],r=t.translateToString(!0),s=0,n=0,o=0,l=t.getFg(0),a=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==a){if(h-s>1){let f=this._getJoinedRanges(r,o,n,t,s);for(let c=0;c<f.length;c++)i.push(f[c])}s=h,o=n,l=this._workCell.fg,a=this._workCell.bg}n+=this._workCell.getChars().length||wi.length}if(this._bufferService.cols-s>1){let h=this._getJoinedRanges(r,o,n,t,s);for(let f=0;f<h.length;f++)i.push(h[f])}return i}_getJoinedRanges(e,t,i,r,s){let n=e.substring(t,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let a=this._characterJoiners[l].handler(n);for(let h=0;h<a.length;h++)mo._mergeRanges(o,a[h])}catch(a){console.error(a)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(e,t,i){let r=0,s=!1,n=0,o=e[r];if(o){for(let l=i;l<this._bufferService.cols;l++){let a=t.getWidth(l),h=t.getString(l).length||wi.length;if(a!==0){if(!s&&o[0]<=n&&(o[0]=l,s=!0),o[1]<=n){if(o[1]=l,o=e[++r],!o)break;o[0]<=n?(o[0]=l,s=!0):s=!1}n+=h}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let r=0;r<e.length;r++){let s=e[r];if(i){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};mo=ge([j(0,tt)],mo);function C0(e){return 57508<=e&&e<=57558}function x0(e){return 9472<=e&&e<=9631}function k0(e){return C0(e)||x0(e)}function b0(){return{css:{canvas:yn(),cell:yn()},device:{canvas:yn(),cell:yn(),char:{width:0,height:0,left:0,top:0}}}}function yn(){return{width:0,height:0}}var qa=class{constructor(e,t,i,r,s,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._themeService=o,this._workCell=new Et,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,r,s,n,o,l,a,h,f){let c=[],u=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,_=e.getNoBgTrimmedLength();i&&_<n+1&&(_=n+1);let S,k=0,m="",v=0,g=0,w=0,x=0,b=!1,D=0,N=!1,V=0,H=0,W=[],A=h!==-1&&f!==-1;for(let E=0;E<_;E++){e.loadCell(E,this._workCell);let I=this._workCell.getWidth();if(I===0)continue;let C=!1,P=E>=H,T=E,y=this._workCell;if(u.length>0&&E===u[0][0]&&P){let ie=u.shift(),Wo=this._isCellInSelection(ie[0],t);for(v=ie[0]+1;v<ie[1];v++)P&&(P=Wo===this._isCellInSelection(v,t));P&&(P=!i||n<ie[0]||n>=ie[1]),P?(C=!0,y=new w0(this._workCell,e.translateToString(!0,ie[0],ie[1]),ie[1]-ie[0]),T=ie[1]-1,I=y.getWidth()):H=ie[1]}let L=this._isCellInSelection(E,t),F=i&&E===n,q=A&&E>=h&&E<=f,Q=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,ie=>{Q=!0});let K=y.getChars()||wi;if(K===" "&&(y.isUnderline()||y.isOverline())&&(K=" "),V=I*l-a.get(K,y.isBold(),y.isItalic()),!S)S=this._document.createElement("span");else if(k&&(L&&N||!L&&!N&&y.bg===g)&&(L&&N&&p.selectionForeground||y.fg===w)&&y.extended.ext===x&&q===b&&V===D&&!F&&!C&&!Q&&P){y.isInvisible()?m+=wi:m+=K,k++;continue}else k&&(S.textContent=m),S=this._document.createElement("span"),k=0,m="";if(g=y.bg,w=y.fg,x=y.extended.ext,b=q,D=V,N=L,C&&n>=E&&n<=T&&(n=E),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(W.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&W.push("xterm-cursor-blink"),W.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":W.push("xterm-cursor-outline");break;case"block":W.push("xterm-cursor-block");break;case"bar":W.push("xterm-cursor-bar");break;case"underline":W.push("xterm-cursor-underline");break}}if(y.isBold()&&W.push("xterm-bold"),y.isItalic()&&W.push("xterm-italic"),y.isDim()&&W.push("xterm-dim"),y.isInvisible()?m=wi:m=y.getChars()||wi,y.isUnderline()&&(W.push(`xterm-underline-${y.extended.underlineStyle}`),m===" "&&(m=" "),!y.isUnderlineColorDefault()))if(y.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${Ys.toColorRGB(y.getUnderlineColor()).join(",")})`;else{let ie=y.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&y.isBold()&&ie<8&&(ie+=8),S.style.textDecorationColor=p.ansi[ie].css}y.isOverline()&&(W.push("xterm-overline"),m===" "&&(m=" ")),y.isStrikethrough()&&W.push("xterm-strikethrough"),q&&(S.style.textDecoration="underline");let X=y.getFgColor(),ke=y.getFgColorMode(),B=y.getBgColor(),Y=y.getBgColorMode(),be=!!y.isInverse();if(be){let ie=X;X=B,B=ie;let Wo=ke;ke=Y,Y=Wo}let Be,nr,jr=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,ie=>{ie.options.layer!=="top"&&jr||(ie.backgroundColorRGB&&(Y=50331648,B=ie.backgroundColorRGB.rgba>>8&16777215,Be=ie.backgroundColorRGB),ie.foregroundColorRGB&&(ke=50331648,X=ie.foregroundColorRGB.rgba>>8&16777215,nr=ie.foregroundColorRGB),jr=ie.options.layer==="top")}),!jr&&L&&(Be=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,B=Be.rgba>>8&16777215,Y=50331648,jr=!0,p.selectionForeground&&(ke=50331648,X=p.selectionForeground.rgba>>8&16777215,nr=p.selectionForeground)),jr&&W.push("xterm-decoration-top");let hi;switch(Y){case 16777216:case 33554432:hi=p.ansi[B],W.push(`xterm-bg-${B}`);break;case 50331648:hi=Ce.toColor(B>>16,B>>8&255,B&255),this._addStyle(S,`background-color:#${Qu((B>>>0).toString(16),"0",6)}`);break;case 0:default:be?(hi=p.foreground,W.push("xterm-bg-257")):hi=p.background}switch(Be||y.isDim()&&(Be=le.multiplyOpacity(hi,.5)),ke){case 16777216:case 33554432:y.isBold()&&X<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(X+=8),this._applyMinimumContrast(S,hi,p.ansi[X],y,Be,void 0)||W.push(`xterm-fg-${X}`);break;case 50331648:let ie=Ce.toColor(X>>16&255,X>>8&255,X&255);this._applyMinimumContrast(S,hi,ie,y,Be,nr)||this._addStyle(S,`color:#${Qu(X.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,hi,p.foreground,y,Be,nr)||be&&W.push("xterm-fg-257")}W.length&&(S.className=W.join(" "),W.length=0),!F&&!C&&!Q&&P?k++:S.textContent=m,V!==this.defaultSpacing&&(S.style.letterSpacing=`${V}px`),c.push(S),E=T}return S&&k&&(S.textContent=m),c}_applyMinimumContrast(e,t,i,r,s,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||k0(r.getCode()))return!1;let o=this._getContrastCache(r),l;if(!s&&!n&&(l=o.getColor(t.rgba,i.rgba)),l===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=le.ensureContrastRatio(s||t,n||i,a),o.setColor((s||t).rgba,(n||i).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?e>=i[0]&&t>=i[1]&&e<r[0]&&t<=r[1]:e<i[0]&&t>=i[1]&&e>=r[0]&&t<=r[1]:t>i[1]&&t<r[1]||i[1]===r[1]&&t===i[1]&&e>=i[0]&&e<r[0]||i[1]<r[1]&&t===r[1]&&e<r[0]||i[1]<r[1]&&t===i[1]&&e>=i[0]}};qa=ge([j(1,gp),j(2,it),j(3,li),j(4,sr),j(5,Xs),j(6,Fr)],qa);function Qu(e,t,i){for(;e.length<i;)e=t+e;return e}var E0=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 r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.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,r,s,n],this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(s),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,r){e===this._font&&t===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,i){let r=0;if(!t&&!i&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let s=e;t&&(s+="B"),i&&(s+="I");let n=this._holey.get(s);if(n===void 0){let o=0;t&&(o|=1),i&&(o|=2),n=this._measure(e,o),n>0&&this._holey.set(s,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},D0=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,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let s=e.buffers.active.ydisp,n=t[1]-s,o=i[1]-s,l=Math.max(n,0),a=Math.min(o,e.rows-1);if(l>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=a,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 L0(){return new D0}var wl="xterm-dom-renderer-owner-",St="xterm-rows",wn="xterm-fg-",Ju="xterm-bg-",Jr="xterm-focus",Cn="xterm-selection",R0=1,Ya=class extends Z{constructor(e,t,i,r,s,n,o,l,a,h,f,c,u,p){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=r,this._viewportElement=s,this._helperContainer=n,this._linkifier2=o,this._charSizeService=a,this._optionsService=h,this._bufferService=f,this._coreService=c,this._coreBrowserService=u,this._themeService=p,this._terminalClass=R0++,this._rowElements=[],this._selectionRenderModel=L0(),this.onRequestRedraw=this._register(new $).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(St),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(Cn),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=b0(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(_=>this._injectCss(_))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(qa,document),this._element.classList.add(wl+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(_=>this._handleLinkHover(_))),this._register(this._linkifier2.onHideLinkUnderline(_=>this._handleLinkLeave(_))),this._register(ce(()=>{this._element.classList.remove(wl+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new E0(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} .${St} 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} .${St} { 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} .${St} .xterm-dim { color: ${le.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}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${St}.${Jr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${St}.${Jr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${St}.${Jr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${St} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${St} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${St} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${St} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${St} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Cn} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Cn} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Cn} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${wn}${n} { color: ${o.css}; }${this._terminalSelector} .${wn}${n}.xterm-dim { color: ${le.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Ju}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${wn}257 { color: ${le.opaque(e.background).css}; }${this._terminalSelector} .${wn}257.xterm-dim { color: ${le.multiplyOpacity(le.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ju}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 r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(Jr),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Jr),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 r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(i){let a=e[0]>t[0];l.appendChild(this._createSelectionElement(n,a?t[0]:e[0],a?e[0]:t[0],o-n+1))}else{let a=r===n?e[0]:0,h=n===s?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(n,a,h));let f=o-n-1;if(l.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,f)),n!==o){let c=s===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,c))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,i,r=1){let s=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${n}px`,s.style.width=`${o}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,r=i.ybase+i.y,s=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=t;a++){let h=a+i.ydisp,f=this._rowElements[a],c=i.lines.get(h);if(!f||!c)break;f.replaceChildren(...this._rowFactory.createRow(c,h,h===r,o,l,s,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${wl}${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,r,s,n){i<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),r=Math.max(Math.min(r,o),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,a=l.ybase+l.y,h=Math.min(l.x,s-1),f=this._optionsService.rawOptions.cursorBlink,c=this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=i;p<=r;++p){let _=p+l.ydisp,S=this._rowElements[p],k=l.lines.get(_);if(!S||!k)break;S.replaceChildren(...this._rowFactory.createRow(k,_,_===a,c,u,h,f,this.dimensions.css.cell.width,this._widthCache,n?p===i?e:0:-1,n?(p===r?t:s)-1:-1))}}};Ya=ge([j(7,lc),j(8,$o),j(9,it),j(10,tt),j(11,sr),j(12,li),j(13,Fr)],Ya);var Xa=class extends Z{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new $),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new P0(this._optionsService))}catch{this._measureStrategy=this._register(new M0(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())}};Xa=ge([j(2,it)],Xa);var Ip=class extends Z{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)}},M0=class extends Ip{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}},P0=class extends Ip{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}},B0=class extends Z{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 N0(this._window)),this._onDprChange=this._register(new $),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new $),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(je.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}},N0=class extends Z{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Or),this._onDprChange=this._register(new $),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ce(()=>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)}},T0=class extends Z{constructor(){super(),this.linkProviders=[],this._register(ce(()=>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 pc(e,t,i){let r=i.getBoundingClientRect(),s=e.getComputedStyle(i),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-n,t.clientY-r.top-o]}function O0(e,t,i,r,s,n,o,l,a){if(!n)return;let h=pc(e,t,i);if(h)return h[0]=Math.ceil((h[0]+(a?o/2:0))/o),h[1]=Math.ceil(h[1]/l),h[0]=Math.min(Math.max(h[0],1),r+(a?1:0)),h[1]=Math.min(Math.max(h[1],1),s),h}var Ga=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,r,s){return O0(window,e,t,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let i=pc(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])}}};Ga=ge([j(0,ai),j(1,$o)],Ga);var A0=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=[]}},zp={};Vg(zp,{getSafariVersion:()=>z0,isChromeOS:()=>jp,isFirefox:()=>$p,isIpad:()=>$0,isIphone:()=>F0,isLegacyEdge:()=>I0,isLinux:()=>mc,isMac:()=>vo,isNode:()=>Fo,isSafari:()=>Fp,isWindows:()=>Hp});var Fo=typeof process<"u"&&"title"in process,Gs=Fo?"node":navigator.userAgent,Qs=Fo?"node":navigator.platform,$p=Gs.includes("Firefox"),I0=Gs.includes("Edge"),Fp=/^((?!chrome|android).)*safari/i.test(Gs);function z0(){if(!Fp)return 0;let e=Gs.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var vo=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Qs),$0=Qs==="iPad",F0=Qs==="iPhone",Hp=["Windows","Win16","Win32","WinCE"].includes(Qs),mc=Qs.indexOf("Linux")>=0,jp=/\bCrOS\b/.test(Gs),Wp=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,r=e.timeRemaining(),s=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),s=e.timeRemaining(),i*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},H0=class extends Wp{_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())}}},j0=class extends Wp{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},go=!Fo&&"requestIdleCallback"in window?j0:H0,W0=class{constructor(){this._queue=new go}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Qa=class extends Z{constructor(e,t,i,r,s,n,o,l,a){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=r,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new Or),this._pausedResizeTask=new W0,this._observerDisposable=this._register(new Or),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 $),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new $),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new $),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new $),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new A0((h,f)=>this._renderRows(h,f),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new U0(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ce(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.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(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=ce(()=>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 r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.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 r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Qa=ge([j(2,it),j(3,$o),j(4,sr),j(5,Xs),j(6,tt),j(7,li),j(8,Fr)],Qa);var U0=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 K0(e,t,i,r){let s=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return Y0(s,n,e,t,i,r)+Ho(n,t,i,r)+X0(s,n,e,t,i,r);let o;if(n===t)return o=s>e?"D":"C",Hs(Math.abs(s-e),Fs(o,r));o=n>t?"D":"C";let l=Math.abs(n-t),a=q0(n>t?e:s,i)+(l-1)*i.cols+1+V0(n>t?s:e);return Hs(a,Fs(o,r))}function V0(e,t){return e-1}function q0(e,t){return t.cols-e}function Y0(e,t,i,r,s,n){return Ho(t,r,s,n).length===0?"":Hs(Kp(e,t,e,t-tr(t,s),!1,s).length,Fs("D",n))}function Ho(e,t,i,r){let s=e-tr(e,i),n=t-tr(t,i),o=Math.abs(s-n)-G0(e,t,i);return Hs(o,Fs(Up(e,t),r))}function X0(e,t,i,r,s,n){let o;Ho(t,r,s,n).length>0?o=r-tr(r,s):o=t;let l=r,a=Q0(e,t,i,r,s,n);return Hs(Kp(e,o,i,l,a==="C",s).length,Fs(a,n))}function G0(e,t,i){var o;let r=0,s=e-tr(e,i),n=t-tr(t,i);for(let l=0;l<Math.abs(s-n);l++){let a=Up(e,t)==="A"?-1:1;(o=i.buffer.lines.get(s+a*l))!=null&&o.isWrapped&&r++}return r}function tr(e,t){let i=0,r=t.buffer.lines.get(e),s=r==null?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)i++,r=t.buffer.lines.get(--e),s=r==null?void 0:r.isWrapped;return i}function Q0(e,t,i,r,s,n){let o;return Ho(i,r,s,n).length>0?o=r-tr(r,s):o=t,e<i&&o<=r||e>=i&&o<r?"C":"D"}function Up(e,t){return e>t?"A":"B"}function Kp(e,t,i,r,s,n){let o=e,l=t,a="";for(;(o!==i||l!==r)&&l>=0&&l<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(a+=n.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!s&&o<0&&(a+=n.buffer.translateBufferLineToString(l,!1,0,e+1),o=n.cols-1,e=o,l--);return a+n.buffer.translateBufferLineToString(l,!1,e,o)}function Fs(e,t){let i=t?"O":"[";return R.ESC+i+e}function Hs(e,t){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=t;return i}var J0=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 Zu(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 Cl=50,Z0=15,ey=50,ty=500,iy=" ",ry=new RegExp(iy,"g"),Ja=class extends Z{constructor(e,t,i,r,s,n,o,l,a){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=r,this._coreService=s,this._mouseService=n,this._optionsService=o,this._renderService=l,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Et,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new $),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new $),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new $),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new $),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new J0(this._bufferService),this._activeSelectionMode=0,this._register(ce(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.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,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=i.translateBufferLineToString(o,!0,s,n);r.push(l)}}else{let s=e[1]===t[1]?t[0]:void 0;r.push(i.translateBufferLineToString(e[1],!0,e[0],s));for(let n=e[1]+1;n<=t[1]-1;n++){let o=i.lines.get(n),l=i.translateBufferLineToString(n,!0);o!=null&&o.isWrapped?r[r.length-1]+=l:r.push(l)}if(e[1]!==t[1]){let n=i.lines.get(t[1]),o=i.translateBufferLineToString(t[1],!0,0,t[0]);n&&n.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(s=>s.replace(ry," ")).join(Hp?`\r
|
|
62
|
-
`:`
|
|
63
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),mc&&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,r=this._model.finalSelectionEnd;return!i||!r||!t?!1:this._areCoordsInSelection(t,i,r)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r?!1:this._areCoordsInSelection([e,t],i,r)}_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 s,n;let i=(n=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=Zu(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,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=pc(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,-Cl),Cl),t/=Cl,t/Math.abs(t)+Math.round(t*(Z0-1)))}shouldForceSelection(e){return vo?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(),ey)}_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&&!(vo&&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 r=i.lines.get(this._model.selectionEnd[1]);r&&r.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<ty&&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 r=K0(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!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 r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:s>1&&t!==r&&(i+=s-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,r=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,n=s.lines.get(e[1]);if(!n)return;let o=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(n,e[0]),a=l,h=e[0]-l,f=0,c=0,u=0,p=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;a<o.length&&o.charAt(a+1)===" ";)a++}else{let k=e[0],m=e[0];n.getWidth(k)===0&&(f++,k--),n.getWidth(m)===2&&(c++,m++);let v=n.getString(m).length;for(v>1&&(p+=v-1,a+=v-1);k>0&&l>0&&!this._isCharWordSeparator(n.loadCell(k-1,this._workCell));){n.loadCell(k-1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===0?(f++,k--):g>1&&(u+=g-1,l-=g-1),l--,k--}for(;m<n.length&&a+1<o.length&&!this._isCharWordSeparator(n.loadCell(m+1,this._workCell));){n.loadCell(m+1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===2?(c++,m++):g>1&&(p+=g-1,a+=g-1),a++,m++}}a++;let _=l+h-f+u,S=Math.min(this._bufferService.cols,a-l+f+c-u-p);if(!(!t&&o.slice(l,a).trim()==="")){if(i&&_===0&&n.getCodePoint(0)!==32){let k=s.lines.get(e[1]-1);if(k&&n.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let m=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(m){let v=this._bufferService.cols-m.start;_-=v,S+=v}}}if(r&&_+S===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let k=s.lines.get(e[1]+1);if(k!=null&&k.isWrapped&&k.getCodePoint(0)!==32){let m=this._getWordAt([0,e[1]+1],!1,!1,!0);m&&(S+=m.length)}}return{start:_,length:S}}}_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=Zu(i,this._bufferService.cols)}};Ja=ge([j(3,tt),j(4,sr),j(5,ac),j(6,it),j(7,ai),j(8,li)],Ja);var ed=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={}}},td=class{constructor(){this._color=new ed,this._css=new ed}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()}},Ee=Object.freeze((()=>{let e=[de.toColor("#2e3436"),de.toColor("#cc0000"),de.toColor("#4e9a06"),de.toColor("#c4a000"),de.toColor("#3465a4"),de.toColor("#75507b"),de.toColor("#06989a"),de.toColor("#d3d7cf"),de.toColor("#555753"),de.toColor("#ef2929"),de.toColor("#8ae234"),de.toColor("#fce94f"),de.toColor("#729fcf"),de.toColor("#ad7fa8"),de.toColor("#34e2e2"),de.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=t[i/36%6|0],s=t[i/6%6|0],n=t[i%6];e.push({css:Ce.toCss(r,s,n),rgba:Ce.toRgba(r,s,n)})}for(let i=0;i<24;i++){let r=8+i*10;e.push({css:Ce.toCss(r,r,r),rgba:Ce.toRgba(r,r,r)})}return e})()),Fi=de.toColor("#ffffff"),hs=de.toColor("#000000"),id=de.toColor("#ffffff"),rd=hs,Zr={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},sy=Fi,Za=class extends Z{constructor(e){super(),this._optionsService=e,this._contrastCache=new td,this._halfContrastCache=new td,this._onChangeColors=this._register(new $),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Fi,background:hs,cursor:id,cursorAccent:rd,selectionForeground:void 0,selectionBackgroundTransparent:Zr,selectionBackgroundOpaque:le.blend(hs,Zr),selectionInactiveBackgroundTransparent:Zr,selectionInactiveBackgroundOpaque:le.blend(hs,Zr),scrollbarSliderBackground:le.opacity(Fi,.2),scrollbarSliderHoverBackground:le.opacity(Fi,.4),scrollbarSliderActiveBackground:le.opacity(Fi,.5),overviewRulerBorder:Fi,ansi:Ee.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=se(e.foreground,Fi),t.background=se(e.background,hs),t.cursor=le.blend(t.background,se(e.cursor,id)),t.cursorAccent=le.blend(t.background,se(e.cursorAccent,rd)),t.selectionBackgroundTransparent=se(e.selectionBackground,Zr),t.selectionBackgroundOpaque=le.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=se(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=le.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?se(e.selectionForeground,Gu):void 0,t.selectionForeground===Gu&&(t.selectionForeground=void 0),le.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=le.opacity(t.selectionBackgroundTransparent,.3)),le.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=le.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=se(e.scrollbarSliderBackground,le.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=se(e.scrollbarSliderHoverBackground,le.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=se(e.scrollbarSliderActiveBackground,le.opacity(t.foreground,.5)),t.overviewRulerBorder=se(e.overviewRulerBorder,sy),t.ansi=Ee.slice(),t.ansi[0]=se(e.black,Ee[0]),t.ansi[1]=se(e.red,Ee[1]),t.ansi[2]=se(e.green,Ee[2]),t.ansi[3]=se(e.yellow,Ee[3]),t.ansi[4]=se(e.blue,Ee[4]),t.ansi[5]=se(e.magenta,Ee[5]),t.ansi[6]=se(e.cyan,Ee[6]),t.ansi[7]=se(e.white,Ee[7]),t.ansi[8]=se(e.brightBlack,Ee[8]),t.ansi[9]=se(e.brightRed,Ee[9]),t.ansi[10]=se(e.brightGreen,Ee[10]),t.ansi[11]=se(e.brightYellow,Ee[11]),t.ansi[12]=se(e.brightBlue,Ee[12]),t.ansi[13]=se(e.brightMagenta,Ee[13]),t.ansi[14]=se(e.brightCyan,Ee[14]),t.ansi[15]=se(e.brightWhite,Ee[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<i;r++)t.ansi[r+16]=se(e.extendedAnsi[r],Ee[r+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()}}};Za=ge([j(0,it)],Za);function se(e,t){if(e!==void 0)try{return de.toColor(e)}catch{}return t}var ny=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)}},oy=class{constructor(){this._services=new ny,this._services.set(lc,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=Zg(e).sort((n,o)=>n.index-o.index),r=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${n.id._id}.`);r.push(o)}let s=i.length>0?i[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},ly={trace:0,debug:1,info:2,warn:3,error:4,off:5},ay="xterm.js: ",eh=class extends Z{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=ly[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?"":ay)+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)}};eh=ge([j(0,it)],eh);var sd=class extends Z{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new $),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new $),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new $),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 r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<i.length;r++)this._array[this._getCyclicIndex(e+r)]=i[r];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let r=this._length+i.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}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 s=t-1;s>=0;s--)this.set(e+s+i,this.get(e+s));let r=e+t+i-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+i,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},J=3,we=Object.freeze(new Ys),xn=0,xl=2,cs=class Vp{constructor(t,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*J);let s=i||Et.fromCharData([0,up,1,0]);for(let n=0;n<t;++n)this.setCell(n,s);this.length=t}get(t){let i=this._data[t*J+0],r=i&2097151;return[this._data[t*J+1],i&2097152?this._combined[t]:r?mi(r):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,i){this._data[t*J+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*J+0]=t|2097152|i[2]<<22):this._data[t*J+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*J+0]>>22}hasWidth(t){return this._data[t*J+0]&12582912}getFg(t){return this._data[t*J+1]}getBg(t){return this._data[t*J+2]}hasContent(t){return this._data[t*J+0]&4194303}getCodePoint(t){let i=this._data[t*J+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*J+0]&2097152}getString(t){let i=this._data[t*J+0];return i&2097152?this._combined[t]:i&2097151?mi(i&2097151):""}isProtected(t){return this._data[t*J+2]&536870912}loadCell(t,i){return xn=t*J,i.content=this._data[xn+0],i.fg=this._data[xn+1],i.bg=this._data[xn+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*J+0]=i.content,this._data[t*J+1]=i.fg,this._data[t*J+2]=i.bg}setCellFromCodepoint(t,i,r,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*J+0]=i|r<<22,this._data[t*J+1]=s.fg,this._data[t*J+2]=s.bg}addCodepointToCell(t,i,r){let s=this._data[t*J+0];s&2097152?this._combined[t]+=mi(i):s&2097151?(this._combined[t]=mi(s&2097151)+mi(i),s&=-2097152,s|=2097152):s=i|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[t*J+0]=s}insertCells(t,i,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length-t){let s=new Et;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,s));for(let n=0;n<i;++n)this.setCell(t+n,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,i,r){if(t%=this.length,i<this.length-t){let s=new Et;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,s));for(let n=this.length-i;n<this.length;++n)this.setCell(n,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,i,r,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.setCell(t++,r)}resize(t,i){if(t===this.length)return this._data.length*4*xl<this._data.buffer.byteLength;let r=t*J;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let l=parseInt(n[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,r*4*xl<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*xl<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 r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,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 Vp(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*J+0]&4194303)return t+(this._data[t*J+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*J+0]&4194303||this._data[t*J+2]&50331648)return t+(this._data[t*J+0]>>22);return 0}copyCellsFrom(t,i,r,s,n){let o=t._data;if(n)for(let a=s-1;a>=0;a--){for(let h=0;h<J;h++)this._data[(r+a)*J+h]=o[(i+a)*J+h];o[(i+a)*J+2]&268435456&&(this._extendedAttrs[r+a]=t._extendedAttrs[i+a])}else for(let a=0;a<s;a++){for(let h=0;h<J;h++)this._data[(r+a)*J+h]=o[(i+a)*J+h];o[(i+a)*J+2]&268435456&&(this._extendedAttrs[r+a]=t._extendedAttrs[i+a])}let l=Object.keys(t._combined);for(let a=0;a<l.length;a++){let h=parseInt(l[a],10);h>=i&&(this._combined[h-i+r]=t._combined[h])}}translateToString(t,i,r,s){i=i??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let o=this._data[i*J+0],l=o&2097151,a=o&2097152?this._combined[i]:l?mi(l):wi;if(n+=a,s)for(let h=0;h<a.length;++h)s.push(i);i+=o>>22||1}return s&&s.push(i),n}};function hy(e,t,i,r,s,n){let o=[];for(let l=0;l<e.length-1;l++){let a=l,h=e.get(++a);if(!h.isWrapped)continue;let f=[e.get(l)];for(;a<e.length&&h.isWrapped;)f.push(h),h=e.get(++a);if(!n&&r>=l&&r<a){l+=f.length-1;continue}let c=0,u=js(f,c,t),p=1,_=0;for(;p<f.length;){let k=js(f,p,t),m=k-_,v=i-u,g=Math.min(m,v);f[c].copyCellsFrom(f[p],_,u,g,!1),u+=g,u===i&&(c++,u=0),_+=g,_===k&&(p++,_=0),u===0&&c!==0&&f[c-1].getWidth(i-1)===2&&(f[c].copyCellsFrom(f[c-1],i-1,u++,1,!1),f[c-1].setCell(i-1,s))}f[c].replaceCells(u,i,s);let S=0;for(let k=f.length-1;k>0&&(k>c||f[k].getTrimmedLength()===0);k--)S++;S>0&&(o.push(l+f.length-S),o.push(S)),l+=f.length-1}return o}function cy(e,t){let i=[],r=0,s=t[r],n=0;for(let o=0;o<e.length;o++)if(s===o){let l=t[++r];e.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,s=t[++r]}else i.push(o);return{layout:i,countRemoved:n}}function uy(e,t){let i=[];for(let r=0;r<t.length;r++)i.push(e.get(t[r]));for(let r=0;r<i.length;r++)e.set(r,i[r]);e.length=t.length}function dy(e,t,i){let r=[],s=e.map((a,h)=>js(e,h,t)).reduce((a,h)=>a+h),n=0,o=0,l=0;for(;l<s;){if(s-l<i){r.push(s-l);break}n+=i;let a=js(e,o,t);n>a&&(n-=a,o++);let h=e[o].getWidth(n-1)===2;h&&n--;let f=h?i-1:i;r.push(f),l+=f}return r}function js(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,s=e[t+1].getWidth(0)===2;return r&&s?i-1:i}var qp=class Yp{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Yp._nextId++,this._onDispose=this.register(new $),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),er(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};qp._nextId=1;var fy=qp,Pe={},Hi=Pe.B;Pe[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Pe.A={"#":"£"};Pe.B=void 0;Pe[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Pe.C=Pe[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Pe.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Pe.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Pe.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Pe.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Pe.E=Pe[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Pe.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Pe.H=Pe[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Pe["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var nd=4294967295,od=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=we.clone(),this.savedCharset=Hi,this.markers=[],this._nullCell=Et.fromCharData([0,up,1,0]),this._whitespaceCell=Et.fromCharData([0,wi,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new go,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new sd(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 _o),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 _o),this._whitespaceCell}getBlankLine(e,t){return new cs(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>nd?nd:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=we);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 sd(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(we),r=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,i);let n=0;if(this._rows<t)for(let o=this._rows;o<t;o++)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 cs(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 cs(e,i)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,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++)r+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.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,r=hy(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(we),i);if(r.length>0){let s=cy(this.lines,r);uy(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let r=this.getNullCell(we),s=i;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new cs(e,r))):(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,r=this.getNullCell(we),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let a=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),a.unshift(l);if(!i){let g=this.ybase+this.y;if(g>=o&&g<o+a.length)continue}let h=a[a.length-1].getTrimmedLength(),f=dy(a,this._cols,e),c=f.length-a.length,u;this.ybase===0&&this.y!==this.lines.length-1?u=Math.max(0,this.y-this.lines.maxLength+c):u=Math.max(0,this.lines.length-this.lines.maxLength+c);let p=[];for(let g=0;g<c;g++){let w=this.getBlankLine(we,!0);p.push(w)}p.length>0&&(s.push({start:o+a.length+n,newLines:p}),n+=p.length),a.push(...p);let _=f.length-1,S=f[_];S===0&&(_--,S=f[_]);let k=a.length-c-1,m=h;for(;k>=0;){let g=Math.min(m,S);if(a[_]===void 0)break;if(a[_].copyCellsFrom(a[k],m-g,S-g,g,!0),S-=g,S===0&&(_--,S=f[_]),m-=g,m===0){k--;let w=Math.max(k,0);m=js(a,w,this._cols)}}for(let g=0;g<a.length;g++)f[g]<e&&a[g].setCell(f[g],r);let v=c-u;for(;v-- >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+c,this.ybase+t-1)}if(s.length>0){let o=[],l=[];for(let S=0;S<this.lines.length;S++)l.push(this.lines.get(S));let a=this.lines.length,h=a-1,f=0,c=s[f];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let u=0;for(let S=Math.min(this.lines.maxLength-1,a+n-1);S>=0;S--)if(c&&c.start>h+u){for(let k=c.newLines.length-1;k>=0;k--)this.lines.set(S--,c.newLines[k]);S++,o.push({index:h+1,amount:c.newLines.length}),u+=c.newLines.length,c=s[++f]}else this.lines.set(S,l[h--]);let p=0;for(let S=o.length-1;S>=0;S--)o[S].index+=p,this.lines.onInsertEmitter.fire(o[S]),p+=o[S].amount;let _=Math.max(0,a+n-this.lines.maxLength);_>0&&this.lines.onTrimEmitter.fire(_)}}translateBufferLineToString(e,t,i=0,r){let s=this.lines.get(e);return s?s.translateToString(t,i,r):""}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 fy(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)}},_y=class extends Z{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new $),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 od(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new od(!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)}},Xp=2,Gp=1,th=class extends Z{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new $),this.onResize=this._onResize.event,this._onScroll=this._register(new $),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Xp),this.rows=Math.max(e.rawOptions.rows||0,Gp),this.buffers=this._register(new _y(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,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let s=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(n+1,0,r.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-s+1;i.lines.shiftElements(s+1,o-1,-1),i.lines.set(n,r.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 r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),r!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};th=ge([j(0,it)],th);var ar={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:vo,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},py=["normal","bold","100","200","300","400","500","600","700","800","900"],my=class extends Z{constructor(e){super(),this._onOptionChange=this._register(new $),this.onOptionChange=this._onOptionChange.event;let t={...ar};for(let i in e)if(i in t)try{let r=e[i];t[i]=this._sanitizeAndValidateOption(i,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ce(()=>{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 ar))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,r)=>{if(!(i in ar))throw new Error(`No option with key "${i}"`);r=this._sanitizeAndValidateOption(i,r),this.rawOptions[i]!==r&&(this.rawOptions[i]=r,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let r={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=ar[e]),!vy(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=ar[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=py.includes(t)?t:ar[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 vy(e){return e==="block"||e==="underline"||e==="bar"}function us(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let r in e)i[r]=t<=1?e[r]:e[r]&&us(e[r],t-1);return i}var ld=Object.freeze({insertMode:!1}),ad=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ih=class extends Z{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 $),this.onData=this._onData.event,this._onUserInput=this._register(new $),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new $),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new $),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=us(ld),this.decPrivateModes=us(ad)}reset(){this.modes=us(ld),this.decPrivateModes=us(ad)}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(r=>r.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))}};ih=ge([j(0,tt),j(1,mp),j(2,it)],ih);var hd={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 kl(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 bl=String.fromCharCode,cd={DEFAULT:e=>{let t=[kl(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${bl(t[0])}${bl(t[1])}${bl(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${kl(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${kl(e,!0)};${e.x};${e.y}${t}`}},rh=class extends Z{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 $),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(hd))this.addProtocol(r,hd[r]);for(let r of Object.keys(cd))this.addEncoding(r,cd[r]);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 r=t/i,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,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)}};rh=ge([j(0,tt),j(1,sr),j(2,it)],rh);var El=[[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]],gy=[[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]],De;function Sy(e,t){let i=0,r=t.length-1,s;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=i;)if(s=i+r>>1,e>t[s][1])i=s+1;else if(e<t[s][0])r=s-1;else return!0;return!1}var yy=class{constructor(){if(this.version="6",!De){De=new Uint8Array(65536),De.fill(1),De[0]=0,De.fill(0,1,32),De.fill(0,127,160),De.fill(2,4352,4448),De[9001]=2,De[9002]=2,De.fill(2,11904,42192),De[12351]=1,De.fill(2,44032,55204),De.fill(2,63744,64256),De.fill(2,65040,65050),De.fill(2,65072,65136),De.fill(2,65280,65377),De.fill(2,65504,65511);for(let e=0;e<El.length;++e)De.fill(0,El[e][0],El[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?De[e]:Sy(e,gy)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=i===0&&t!==0;if(r){let s=Ki.extractWidth(t);s===0?r=!1:s>i&&(i=s)}return Ki.createPropertyValue(0,i,r)}},Ki=class jn{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new $,this.onChange=this._onChange.event;let t=new yy;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,r=!1){return(t&16777215)<<3|(i&3)<<1|(r?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,r=0,s=t.length;for(let n=0;n<s;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return i+this.wcwidth(o);let h=t.charCodeAt(n);56320<=h&&h<=57343?o=(o-55296)*1024+h-56320+65536:i+=this.wcwidth(h)}let l=this.charProperties(o,r),a=jn.extractWidth(l);jn.extractShouldJoin(l)&&(a-=jn.extractWidth(r)),i+=a,r=l}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},wy=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 ud(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.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 es=2147483647,Cy=256,Qp=class sh{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>Cy)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 sh;if(!t.length)return i;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let s=t[r];if(Array.isArray(s))for(let n=0;n<s.length;++n)i.addSubParam(s[n]);else i.addParam(s)}return i}clone(){let t=new sh(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 r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,s))}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>es?es: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>es?es: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,r=this._subParamsIdx[t]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&(t[i]=this._subParams.slice(r,s))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[i-1];r[i-1]=~s?Math.min(s*10+t,es):t}},ts=[],xy=class{constructor(){this._state=0,this._active=ts,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 r=i.indexOf(t);r!==-1&&i.splice(r,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=ts}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=ts,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ts,!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",zo(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].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 r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-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,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].end(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=ts,this._id=-1,this._state=0}}},ut=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+=zo(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}},is=[],ky=class{constructor(){this._handlers=Object.create(null),this._active=is,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=is}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=is,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||is,!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",zo(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].unhook(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=is,this._ident=0}},ds=new Qp;ds.addParam(0);var dd=class{constructor(e){this._handler=e,this._data="",this._params=ds,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ds,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=zo(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=ds,this._data="",this._hitLimit=!1,i));return this._params=ds,this._data="",this._hitLimit=!1,t}},by=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,r){this.table[t<<8|e]=i<<4|r}addMany(e,t,i,r){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=i<<4|r}},wt=160,Ey=function(){let e=new by(4095),t=Array.apply(null,Array(256)).map((l,a)=>a),i=(l,a)=>t.slice(l,a),r=i(32,127),s=i(0,24);s.push(25),s.push.apply(s,i(28,32));let n=i(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,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(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(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(s,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(s,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(s,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(s,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(s,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(wt,0,2,0),e.add(wt,8,5,8),e.add(wt,6,0,6),e.add(wt,11,0,11),e.add(wt,13,13,13),e}(),Dy=class extends Z{constructor(e=Ey){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 Qp,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,r)=>{},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(ce(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new xy),this._dcsParser=this._register(new ky),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 s=0;s<e.intermediates.length;++s){let n=e.intermediates.charCodeAt(s);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 r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=r,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 r=this._escHandlers[i];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,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 r=this._csiHandlers[i];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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,r,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,t,i){let r=0,s=0,n=0,o;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 l=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&a>-1){for(;a>=0&&(o=l[a](this._params),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 4:if(i===!1&&a>-1){for(;a>=0&&(o=l[a](),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,i),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,i),o)return o;r===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 l=n;l<t;++l){switch(r=e[l],s=this._transitions.table[this.currentState<<8|(r<160?r:wt)],s>>4){case 2:for(let u=l+1;;++u){if(u>=t||(r=e[u])<32||r>126&&r<wt){this._printHandler(e,l,u),l=u-1;break}if(++u>=t||(r=e[u])<32||r>126&&r<wt){this._printHandler(e,l,u),l=u-1;break}if(++u>=t||(r=e[u])<32||r>126&&r<wt){this._printHandler(e,l,u),l=u-1;break}if(++u>=t||(r=e[u])<32||r>126&&r<wt){this._printHandler(e,l,u),l=u-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],h=a?a.length-1:-1;for(;h>=0&&(o=a[h](this._params),o!==!0);h--)if(o instanceof Promise)return this._preserveStack(3,a,h,s,l),o;h<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++l<t&&(r=e[l])>47&&r<60);l--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let f=this._escHandlers[this._collect<<8|r],c=f?f.length-1:-1;for(;c>=0&&(o=f[c](),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(4,f,c,s,l),o;c<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let u=l+1;;++u)if(u>=t||(r=e[u])===24||r===26||r===27||r>127&&r<wt){this._dcsParser.put(e,l,u),l=u-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,s,l),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let u=l+1;;u++)if(u>=t||(r=e[u])<32||r>127&&r<wt){this._oscParser.put(e,l,u),l=u-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,s,l),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},Ly=/^([\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})$/,Ry=/^[\da-f]+$/;function fd(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=Ly.exec(t);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),Ry.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(t.slice(i*s,i*s+i),16);r[s]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return r}}function Dl(e,t){let i=e.toString(16),r=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function My(e,t=16){let[i,r,s]=e;return`rgb:${Dl(i,t)}/${Dl(r,t)}/${Dl(s,t)}`}var Py={"(":0,")":1,"*":2,"+":3,"-":1,".":2},fi=131072,_d=10;function pd(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 md=5e3,vd=0,By=class extends Z{constructor(e,t,i,r,s,n,o,l,a=new Dy){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=a,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Qg,this._utf8Decoder=new Jg,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=we.clone(),this._eraseAttrDataInternal=we.clone(),this._onRequestBell=this._register(new $),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new $),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new $),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new $),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new $),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new $),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new $),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new $),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new $),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new $),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new $),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new $),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new $),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 nh(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,f)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:f.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,f,c)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:f,data:c})}),this._parser.setDcsHandlerFallback((h,f,c)=>{f==="HOOK"&&(c=c.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:f,payload:c})}),this._parser.setPrintHandler((h,f,c)=>this.print(h,f,c)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!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(Fn.IND,()=>this.index()),this._parser.setExecuteHandler(Fn.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Fn.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ut(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new ut(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new ut(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new ut(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new ut(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new ut(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new ut(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new ut(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new ut(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new ut(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new ut(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new ut(h=>this.restoreCursorColor(h))),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 h in Pe)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new dd((h,f)=>this.requestStatusString(h,f)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),md))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${md} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,r=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>fi&&(n=this._parseStack.position+fi)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<fi&&(this._parseBuffer=new Uint32Array(Math.min(e.length,fi))),o||this._dirtyRowTracker.clearRange(),e.length>fi)for(let h=n;h<e.length;h+=fi){let f=h+fi<e.length?h+fi:e.length,c=typeof e=="string"?this._stringDecoder.decode(e.substring(h,f),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,f),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,s,c,h),this._logSlowResolvingAsync(i),i}else if(!o){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,h))return this._preserveStack(r,s,h,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),a=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);a<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(a,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,a=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,f=this._curAttrData,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&c.getWidth(this._activeBuffer.x-1)===2&&c.setCellFromCodepoint(this._activeBuffer.x-1,0,1,f);let u=this._parser.precedingJoinState;for(let p=t;p<i;++p){if(r=e[p],r<127&&n){let m=n[String.fromCharCode(r)];m&&(r=m.charCodeAt(0))}let _=this._unicodeService.charProperties(r,u);s=Ki.extractWidth(_);let S=Ki.extractShouldJoin(_),k=S?Ki.extractWidth(u):0;if(u=_,o&&this._onA11yChar.fire(mi(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-k>l){if(a){let m=c,v=this._activeBuffer.x-k;for(this._activeBuffer.x=k,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),c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&c instanceof cs&&c.copyCellsFrom(m,v,0,k,!1);v<l;)m.setCellFromCodepoint(v++,0,1,f)}else if(this._activeBuffer.x=l-1,s===2)continue}if(S&&this._activeBuffer.x){let m=c.getWidth(this._activeBuffer.x-1)?1:2;c.addCodepointToCell(this._activeBuffer.x-m,r,s);for(let v=s-k;--v>=0;)c.setCellFromCodepoint(this._activeBuffer.x++,0,0,f);continue}if(h&&(c.insertCells(this._activeBuffer.x,s-k,this._activeBuffer.getNullCell(f)),c.getWidth(l-1)===2&&c.setCellFromCodepoint(l-1,0,1,f)),c.setCellFromCodepoint(this._activeBuffer.x++,r,s,f),s>0)for(;--s;)c.setCellFromCodepoint(this._activeBuffer.x++,0,0,f)}this._parser.precedingJoinState=u,this._activeBuffer.x<l&&i-t>0&&c.getWidth(this._activeBuffer.x)===0&&!c.hasContent(this._activeBuffer.x)&&c.setCellFromCodepoint(this._activeBuffer.x,0,1,f),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>pd(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new dd(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ut(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,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(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 r;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--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&r.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 s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,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,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(s-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,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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(we));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 r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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,r=Ki.extractWidth(t),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*i),l=0;for(let h=0;h<n.length;){let f=n.codePointAt(h)||0;o[l++]=f,h+=f>65535?2:1}let a=l;for(let h=1;h<i;++h)o.copyWithin(a,0,l),a+=l;return this.print(o,0,a),!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,Hi),this._charsetService.setgCharset(1,Hi),this._charsetService.setgCharset(2,Hi),this._charsetService.setgCharset(3,Hi);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){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:a}=this._bufferService,{active:h,alt:f}=l,c=this._optionsService.rawOptions,u=(S,k)=>(o.triggerDataEvent(`${R.ESC}[${t?"":"?"}${S};${k}$y`),!0),p=S=>S?1:2,_=e.params[0];return t?_===2?u(_,4):_===4?u(_,p(o.modes.insertMode)):_===12?u(_,3):_===20?u(_,p(c.convertEol)):u(_,0):_===1?u(_,p(r.applicationCursorKeys)):_===3?u(_,c.windowOptions.setWinLines?a===80?2:a===132?1:0:0):_===6?u(_,p(r.origin)):_===7?u(_,p(r.wraparound)):_===8?u(_,3):_===9?u(_,p(s==="X10")):_===12?u(_,p(c.cursorBlink)):_===25?u(_,p(!o.isCursorHidden)):_===45?u(_,p(r.reverseWraparound)):_===66?u(_,p(r.applicationKeypad)):_===67?u(_,4):_===1e3?u(_,p(s==="VT200")):_===1002?u(_,p(s==="DRAG")):_===1003?u(_,p(s==="ANY")):_===1004?u(_,p(r.sendFocus)):_===1005?u(_,4):_===1006?u(_,p(n==="SGR")):_===1015?u(_,4):_===1016?u(_,p(n==="SGR_PIXELS")):_===1048?u(_,1):_===47||_===1047||_===1049?u(_,p(h===f)):_===2004?u(_,p(r.bracketedPasteMode)):_===2026?u(_,p(r.synchronizedOutput)):u(_,0)}_updateAttrColor(e,t,i,r,s){return t===2?(e|=50331648,e&=-16777216,e|=Ys.fromColorRGB([i,r,s])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=e.params[t+n],e.hasSubParams(t+n)){let o=e.getSubParams(t+n),l=0;do r[1]===5&&(s=1),r[n+l+1+s]=o[l];while(++l<o.length&&l+n+1+s<r.length);break}if(r[1]===5&&n+s>=2||r[1]===2&&n+s>=5)break;r[1]&&(s=1)}while(++n+t<e.length&&n+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[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=we.fg,e.bg=we.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,r=this._curAttrData;for(let s=0;s<t;s++)i=e.params[s],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=we.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=we.bg&16777215):i===38||i===48||i===58?s+=this._extractColor(e,s,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=we.fg&16777215,r.bg&=-67108864,r.bg|=we.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=we.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(!pd(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>_d&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>_d&&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 r=i.shift(),s=i.shift();if(/^\d+$/.exec(r)){let n=parseInt(r);if(gd(n))if(s==="?")t.push({type:0,index:n});else{let o=fd(s);o&&t.push({type:1,index:n,color:o})}}}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(),r=e.slice(t+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),r,s=i.findIndex(n=>n.startsWith("id="));return s!==-1&&(r=i[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,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 r=0;r<i.length&&!(t>=this._specialColors.length);++r,++t)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=fd(i[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],i=e.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let s=parseInt(i[r]);gd(s)&&t.push({type:2,index:s})}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,Hi),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(Py[e[0]],Pe[e[1]]||Hi),!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=we.clone(),this._eraseAttrDataInternal=we.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 Et;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,r=this._activeBuffer.lines.get(i);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=o=>(this._coreService.triggerDataEvent(`${R.ESC}${o}${R.ESC}\\`),!0),r=this._bufferService.buffer,s=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${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},nh=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&&(vd=e,e=t,t=vd),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};nh=ge([j(0,tt)],nh);function gd(e){return 0<=e&&e<256}var Ny=5e7,Sd=12,Ty=50,Oy=class extends Z{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 $),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 r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Ny)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 r=this._writeBuffer[this._bufferOffset],s=this._action(r,t);if(s){let o=l=>performance.now()-i>=Sd?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(i,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-i>=Sd)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Ty&&(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()}},oh=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 l=t.addMarker(t.ybase+t.y),a={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(a,l)),this._dataByLinkId.set(a.id,a),a.id}let i=e,r=this._getEntryIdKey(i),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}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)))}};oh=ge([j(0,tt)],oh);var yd=!1,Ay=class extends Z{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Or),this._onBinary=this._register(new $),this.onBinary=this._onBinary.event,this._onData=this._register(new $),this.onData=this._onData.event,this._onLineFeed=this._register(new $),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new $),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new $),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new $),this._instantiationService=new oy,this.optionsService=this._register(new my(e)),this._instantiationService.setService(it,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(th)),this._instantiationService.setService(tt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(eh)),this._instantiationService.setService(mp,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ih)),this._instantiationService.setService(sr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(rh)),this._instantiationService.setService(pp,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ki)),this._instantiationService.setService(iS,this.unicodeService),this._charsetService=this._instantiationService.createInstance(wy),this._instantiationService.setService(tS,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(oh),this._instantiationService.setService(vp,this._oscLinkService),this._inputHandler=this._register(new By(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(je.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(je.forward(this._bufferService.onResize,this._onResize)),this._register(je.forward(this.coreService.onData,this._onData)),this._register(je.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 Oy((t,i)=>this._inputHandler.parse(t,i))),this._register(je.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new $),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&&!yd&&(this._logService.warn("writeSync is unreliable and will be removed soon."),yd=!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,Xp),t=Math.max(t,Gp),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(ud.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(ud(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ce(()=>{for(let t of e)t.dispose()})}}},Iy={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 zy(e,t,i,r){var o;let s={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?s.key=R.ESC+"OA":s.key=R.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=R.ESC+"OD":s.key=R.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=R.ESC+"OC":s.key=R.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=R.ESC+"OB":s.key=R.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":R.DEL,e.altKey&&(s.key=R.ESC+s.key);break;case 9:if(e.shiftKey){s.key=R.ESC+"[Z";break}s.key=R.HT,s.cancel=!0;break;case 13:s.key=e.altKey?R.ESC+R.CR:R.CR,s.cancel=!0;break;case 27:s.key=R.ESC,e.altKey&&(s.key=R.ESC+R.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;n?s.key=R.ESC+"[1;"+(n+1)+"D":t?s.key=R.ESC+"OD":s.key=R.ESC+"[D";break;case 39:if(e.metaKey)break;n?s.key=R.ESC+"[1;"+(n+1)+"C":t?s.key=R.ESC+"OC":s.key=R.ESC+"[C";break;case 38:if(e.metaKey)break;n?s.key=R.ESC+"[1;"+(n+1)+"A":t?s.key=R.ESC+"OA":s.key=R.ESC+"[A";break;case 40:if(e.metaKey)break;n?s.key=R.ESC+"[1;"+(n+1)+"B":t?s.key=R.ESC+"OB":s.key=R.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=R.ESC+"[2~");break;case 46:n?s.key=R.ESC+"[3;"+(n+1)+"~":s.key=R.ESC+"[3~";break;case 36:n?s.key=R.ESC+"[1;"+(n+1)+"H":t?s.key=R.ESC+"OH":s.key=R.ESC+"[H";break;case 35:n?s.key=R.ESC+"[1;"+(n+1)+"F":t?s.key=R.ESC+"OF":s.key=R.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=R.ESC+"[5;"+(n+1)+"~":s.key=R.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=R.ESC+"[6;"+(n+1)+"~":s.key=R.ESC+"[6~";break;case 112:n?s.key=R.ESC+"[1;"+(n+1)+"P":s.key=R.ESC+"OP";break;case 113:n?s.key=R.ESC+"[1;"+(n+1)+"Q":s.key=R.ESC+"OQ";break;case 114:n?s.key=R.ESC+"[1;"+(n+1)+"R":s.key=R.ESC+"OR";break;case 115:n?s.key=R.ESC+"[1;"+(n+1)+"S":s.key=R.ESC+"OS";break;case 116:n?s.key=R.ESC+"[15;"+(n+1)+"~":s.key=R.ESC+"[15~";break;case 117:n?s.key=R.ESC+"[17;"+(n+1)+"~":s.key=R.ESC+"[17~";break;case 118:n?s.key=R.ESC+"[18;"+(n+1)+"~":s.key=R.ESC+"[18~";break;case 119:n?s.key=R.ESC+"[19;"+(n+1)+"~":s.key=R.ESC+"[19~";break;case 120:n?s.key=R.ESC+"[20;"+(n+1)+"~":s.key=R.ESC+"[20~";break;case 121:n?s.key=R.ESC+"[21;"+(n+1)+"~":s.key=R.ESC+"[21~";break;case 122:n?s.key=R.ESC+"[23;"+(n+1)+"~":s.key=R.ESC+"[23~";break;case 123:n?s.key=R.ESC+"[24;"+(n+1)+"~":s.key=R.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=R.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=R.DEL:e.keyCode===219?s.key=R.ESC:e.keyCode===220?s.key=R.FS:e.keyCode===221&&(s.key=R.GS);else if((!i||r)&&e.altKey&&!e.metaKey){let l=(o=Iy[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)s.key=R.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let a=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(a);e.shiftKey&&(h=h.toUpperCase()),s.key=R.ESC+h}else if(e.keyCode===32)s.key=R.ESC+(e.ctrlKey?R.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),s.key=R.ESC+a,s.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=R.US),e.key==="@"&&(s.key=R.NUL));break}return s}var Se=0,$y=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new go,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new go,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,n)=>this._getKey(s)-this._getKey(n)),t=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(r[s]=e[t],t++):r[s]=this._array[i++];this._array=r,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||(Se=this._search(t),Se===-1)||this._getKey(this._array[Se])!==t)return!1;do if(this._array[Se]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Se),!0;while(++Se<this._array.length&&this._getKey(this._array[Se])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,n)=>s-n),t=0,i=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:i[r++]=this._array[s];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&&(Se=this._search(e),!(Se<0||Se>=this._array.length)&&this._getKey(this._array[Se])===e))do yield this._array[Se];while(++Se<this._array.length&&this._getKey(this._array[Se])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Se=this._search(e),!(Se<0||Se>=this._array.length)&&this._getKey(this._array[Se])===e))do t(this._array[Se]);while(++Se<this._array.length&&this._getKey(this._array[Se])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let r=t+i>>1,s=this._getKey(this._array[r]);if(s>e)i=r-1;else if(s<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Ll=0,wd=0,Fy=class extends Z{constructor(){super(),this._decorations=new $y(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new $),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new $),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ce(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Hy(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.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 r=0,s=0;for(let n of this._decorations.getKeyIterator(t))r=n.options.x??0,s=r+(n.options.width??1),e>=r&&e<s&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,r){this._decorations.forEachByKey(t,s=>{Ll=s.options.x??0,wd=Ll+(s.options.width??1),e>=Ll&&e<wd&&(!i||(s.options.layer??"bottom")===i)&&r(s)})}},Hy=class extends Mi{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new $),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new $),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=de.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=de.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},jy=1e3,Wy=class{constructor(e,t=jy){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 r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,n=this._debounceThresholdMS-s;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)}},Cd=20,So=class extends Z{constructor(e,t,i,r){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let 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=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Wy(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(`
|
|
64
|
-
`))),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(G(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ce(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Cd+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
65
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Cd+1&&(this._liveRegion.textContent+=Ea.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,r=i.lines.length.toString();for(let s=e;s<=t;s++){let n=i.lines.get(i.ydisp+s),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",a=(i.ydisp+s+1).toString(),h=this._rowElements[s];h&&(l.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=l,this._rowColumns.set(h,o)),h.setAttribute("aria-posinset",a),h.setAttribute("aria-setsize",r),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],s=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||e.relatedTarget!==r)return;let o,l;if(t===0?(o=i,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let a=this._createAccessibilityTreeNode();this._rowElements.unshift(a),this._rowContainer.insertAdjacentElement("afterbegin",a)}else{let a=this._createAccessibilityTreeNode();this._rowElements.push(a),this._rowContainer.appendChild(a)}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 l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let 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 r=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:((l=r.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(i.node))return;let s=({node:a,offset:h})=>{let f=a instanceof Text?a.parentNode:a,c=parseInt(f==null?void 0:f.getAttribute("aria-posinset"),10)-1;if(isNaN(c))return console.warn("row is invalid. Race condition?"),null;let u=this._rowColumns.get(f);if(!u)return console.warn("columns is null. Race condition?"),null;let p=h<u.length?u[h]:u.slice(-1)[0]+1;return p>=this._terminal.cols&&(++c,p=0),{row:c,column:p}},n=s(t),o=s(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.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 s,n;e.style.transform="";let t=e.getBoundingClientRect().width,i=(n=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:n[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};So=ge([j(1,lc),j(2,li),j(3,ai)],So);var lh=class extends Z{constructor(e,t,i,r,s){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new $),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new $),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ce(()=>{var n;er(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 r=0;r<i.length;r++){let s=i[r];if(s.classList.contains("xterm"))break;if(s.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 r,s;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):o.provideLinks(e.y,l=>{var h,f;if(this._isMouseOut)return;let a=l==null?void 0:l.map(c=>({link:c}));(h=this._activeProviderReplies)==null||h.set(n,a),i=this._checkLinkProviderResult(n,e,i),((f=this._activeProviderReplies)==null?void 0:f.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let r=0;r<t.size;r++){let s=t.get(r);if(s)for(let n=0;n<s.length;n++){let o=s[n],l=o.link.range.start.y<e?0:o.link.range.start.x,a=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let h=l;h<=a;h++){if(i.has(h)){s.splice(n--,1);break}i.add(h)}}}}_checkLinkProviderResult(e,t,i){var n;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(e),s=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&r){let o=r.find(l=>this._linkAtPosition(l.link,t));o&&(i=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(a=>this._linkAtPosition(a.link,t));if(l){i=!0,this._handleNewLink(l);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&&Uy(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,er(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,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.pointerCursor},set:i=>{var r;(r=this._currentLink)!=null&&r.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,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.underline},set:i=>{var r,s,n;(r=this._currentLink)!=null&&r.state&&((n=(s=this._currentLink)==null?void 0:s.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 r=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,i){var r;(r=this._currentLink)!=null&&r.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,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,i){var r;(r=this._currentLink)!=null&&r.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,r=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return i<=s&&s<=r}_positionFromMouseEvent(e,t,i){let r=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,r,s){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:s}}};lh=ge([j(1,ac),j(2,ai),j(3,tt),j(4,Sp)],lh);function Uy(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 Ky=class extends Ay{constructor(e={}){super(e),this._linkifier=this._register(new Or),this.browser=zp,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Or),this._onCursorMove=this._register(new $),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new $),this.onKey=this._onKey.event,this._onRender=this._register(new $),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new $),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new $),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new $),this.onBell=this._onBell.event,this._onFocus=this._register(new $),this._onBlur=this._register(new $),this._onA11yCharEmitter=this._register(new $),this._onA11yTabEmitter=this._register(new $),this._onWillOpen=this._register(new $),this._setup(),this._decorationService=this._instantiationService.createInstance(Fy),this._instantiationService.setService(Xs,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(T0),this._instantiationService.setService(Sp,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(La)),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(je.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(je.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(je.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(je.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ce(()=>{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,r="";switch(t.index){case 256:i="foreground",r="10";break;case 257:i="background",r="11";break;case 258:i="cursor",r="12";break;default:i="ansi",r="4;"+t.index}switch(t.type){case 0:let s=le.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${R.ESC}]${r};${My(s)}${Ap.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[t.index]=Ce.toColor(...t.color));else{let n=i;this._themeService.modifyColors(o=>o[n]=Ce.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(So,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),r=this._renderService.dimensions.css.cell.height,s=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(G(this.element,"copy",t=>{this.hasSelection()&&Xg(t,this._selectionService)}));let e=t=>Gg(t,this.textarea,this.coreService,this.optionsService);this._register(G(this.textarea,"paste",e)),this._register(G(this.element,"paste",e)),$p?this._register(G(this.element,"mousedown",t=>{t.button===2&&Bu(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(G(this.element,"contextmenu",t=>{Bu(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),mc&&this._register(G(this.element,"auxclick",t=>{t.button===1&&cp(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 s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let 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",ba.get()),jp||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(B0,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(li,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(Xa,this._document,this._helperContainer),this._instantiationService.setService($o,this._charSizeService),this._themeService=this._instantiationService.createInstance(Za),this._instantiationService.setService(Fr,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(mo),this._instantiationService.setService(gp,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Qa,this.rows,this.screenElement)),this._instantiationService.setService(ai,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(Va,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ga),this._instantiationService.setService(ac,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(lh,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(Ua,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(Ja,this.element,this.screenElement,r)),this._instantiationService.setService(sS,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(je.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(Ka,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(So,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(po,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(po,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Ya,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){var h,f,c,u,p;let o=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!o)return!1;let l,a;switch(n.overrideType||n.type){case"mousemove":a=32,n.buttons===void 0?(l=3,n.button!==void 0&&(l=n.button<3?n.button:3)):l=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":a=0,l=n.button<3?n.button:3;break;case"mousedown":a=1,l=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let _=n.deltaY;if(_===0||e.coreMouseService.consumeWheelEvent(n,(u=(c=(f=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:f.device)==null?void 0:c.cell)==null?void 0:u.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;a=_<0?0:1,l=4;break;default:return!1}return a===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:a,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.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?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),n&16?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),n&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),n&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.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),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(n)})),this._register(G(t,"wheel",n=>{var o,l,a,h,f;if(!r.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,(h=(a=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:a.cell)==null?void 0:h.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return this.cancel(n,!0);let c=R.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(c,!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){hp(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=zy(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let r=this.rows-1;return this.scrollLines(i.type===2?-r:r),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)&&(Vy(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(we));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 r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${R.ESC}[6;${s};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Vy(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var qy=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)}},Yy=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 Et)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},xd=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 Yy(t)}getNullCell(){return new Et}},Xy=class extends Z{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new $),this.onBufferChange=this._onBufferChange.event,this._normal=new xd(this._core.buffers.normal,"normal"),this._alternate=new xd(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)}},Gy=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,r)=>t(i,r.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)}},Qy=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}},Jy=["cols","rows"],$t=0,Zy=class extends Z{constructor(e){super(),this._core=this._register(new Ky(e)),this._addonManager=this._register(new qy),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],i=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:t.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(e){if(Jy.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 Gy(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Qy(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 Xy(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
|
|
66
|
-
`,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 ba.get()},set promptLabel(e){ba.set(e)},get tooMuchOutput(){return Ea.get()},set tooMuchOutput(e){Ea.set(e)}}}_verifyIntegers(...e){for($t of e)if($t===1/0||isNaN($t)||$t%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for($t of e)if($t&&($t===1/0||isNaN($t)||$t%1!==0||$t<0))throw new Error("This API only accepts positive integers")}};/**
|
|
67
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
68
|
-
* @license MIT
|
|
69
|
-
*
|
|
70
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
71
|
-
* @license MIT
|
|
72
|
-
*
|
|
73
|
-
* Originally forked from (with the author's permission):
|
|
74
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
75
|
-
* http://bellard.org/jslinux/
|
|
76
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
77
|
-
*/var e1=2,t1=1,i1=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 c;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:((c=this._terminal.options.overviewRuler)==null?void 0:c.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,a=o.right+o.left,h=r-l,f=s-a-t;return{cols:Math.max(e1,Math.floor(f/e.css.cell.width)),rows:Math.max(t1,Math.floor(h/e.css.cell.height))}}};function r1({session:e,token:t,cols:i,rows:r,readonly:s=!1,takeSize:n,onData:o,onExit:l,onFiles:a}){const h=["localhost","127.0.0.1","::1","[::1]"].includes(location.hostname);if(location.protocol!=="https:"&&!h)throw new Error("nexuscrew: ws:// rifiutato su origine non-locale e non-TLS (apri via tunnel su localhost o servi in HTTPS)");const f=location.protocol==="https:"?"wss":"ws",c=new WebSocket(`${f}://${location.host}/ws`);return c.binaryType="arraybuffer",c.onopen=()=>{const u={type:"attach",session:e,token:t,cols:i,rows:r,readonly:s};n!==void 0&&(u.takeSize=n),c.send(JSON.stringify(u))},c.onmessage=u=>{if(typeof u.data=="string"){let p;try{p=JSON.parse(u.data)}catch{return}p.type==="exit"&&l&&l(p.code),p.type==="files"&&a&&a(p)}else o&&o(new Uint8Array(u.data))},{sendInput:u=>{c.readyState===1&&c.send(typeof u=="string"?new TextEncoder().encode(u):u)},resize:(u,p)=>{c.readyState===1&&c.send(JSON.stringify({type:"resize",cols:u,rows:p}))},action:u=>{c.readyState===1&&c.send(JSON.stringify({type:"action",name:u}))},close:()=>c.close(),raw:c}}function Jp({session:e,token:t,readonly:i,takeSize:r,sendRef:s,actionRef:n,ctrlRef:o,setCtrlArmed:l,onFiles:a,fontSize:h=13}){const f=M.useRef(null),c=M.useRef(null),u=M.useRef(h);return u.current=h,M.useEffect(()=>{const p=c.current;p&&(p.term.options.fontSize=h,p.fit.fit(),p.sock.resize(p.term.cols,p.term.rows))},[h]),M.useEffect(()=>{const p=new Zy({cursorBlink:!0,fontSize:u.current,scrollback:1e3,theme:{background:"#0a0e0a"}}),_=new i1;p.loadAddon(_),p.open(f.current),_.fit();const S=new TextDecoder;let k;try{k=r1({session:e,token:t,readonly:i,takeSize:r,onFiles:a,cols:p.cols,rows:p.rows,onData:T=>p.write(S.decode(T)),onExit:()=>p.write(`\r
|
|
78
|
-
\x1B[33m[sessione finita]\x1B[0m\r
|
|
79
|
-
`)})}catch(T){return p.write(`\r
|
|
80
|
-
\x1B[31m${T.message}\x1B[0m\r
|
|
81
|
-
`),()=>p.dispose()}c.current={term:p,fit:_,sock:k},s&&(s.current=T=>k.sendInput(T)),n&&(n.current=T=>k.action(T));const m=p.onData(T=>{if(!i){if(o&&o.current&&T.length===1){const y=T.charCodeAt(0);let L=y;y>=97&&y<=122?L=y-96:y>=64&&y<=95?L=y-64:y===32&&(L=0),T=String.fromCharCode(L),o.current=!1,l&&l(!1)}k.sendInput(T)}}),v=f.current,g=24;let w=null,x=null,b=0,D=null;const N=T=>{if(T.touches.length!==1){w=null;return}w=T.touches[0].clientY,x=T.touches[0].clientX,b=0,D=null},V=T=>{if(w===null||T.touches.length!==1)return;T.preventDefault(),T.stopPropagation();const y=T.touches[0];if(D===null&&(Math.abs(y.clientY-w)>8||Math.abs(y.clientX-x)>8)&&(D=Math.abs(y.clientY-w)>Math.abs(y.clientX-x)),!!D){for(b+=y.clientY-w,w=y.clientY;b>=g;)k.action("scroll-up"),b-=g;for(;b<=-g;)k.action("scroll-down"),b+=g}},H=()=>{w=null};let W=0;const A=T=>{for(T.preventDefault(),T.stopPropagation(),W+=T.deltaY;W<=-g;)k.action("scroll-up"),W+=g;for(;W>=g;)k.action("scroll-down"),W-=g};v.addEventListener("touchstart",N,{passive:!0}),v.addEventListener("touchmove",V,{passive:!1,capture:!0}),v.addEventListener("touchend",H,{passive:!0}),v.addEventListener("wheel",A,{passive:!1,capture:!0});const E=()=>{_.fit(),k.resize(p.cols,p.rows)};window.addEventListener("resize",E);const I=window.visualViewport;I&&(I.addEventListener("resize",E),I.addEventListener("scroll",E));let C=null,P=0;return typeof ResizeObserver<"u"&&(C=new ResizeObserver(()=>{P&&cancelAnimationFrame(P),P=requestAnimationFrame(E)}),C.observe(v)),()=>{c.current=null,m.dispose(),v.removeEventListener("touchstart",N),v.removeEventListener("touchmove",V,{capture:!0}),v.removeEventListener("touchend",H),v.removeEventListener("wheel",A,{capture:!0}),window.removeEventListener("resize",E),I&&(I.removeEventListener("resize",E),I.removeEventListener("scroll",E)),C&&C.disconnect(),P&&cancelAnimationFrame(P),k.close(),p.dispose()}},[e,t,i,r,s,n,o,l,a]),d.jsx("div",{className:"nc-terminal",ref:f})}const kd="",st="\x1B",s1=[{label:"↑",seq:st+"[A"},{label:"↓",seq:st+"[B"},{label:"PGUP",seq:st+"[5~"},{label:"PGDN",seq:st+"[6~"}];function n1({send:e,action:t,ctrlArmed:i=!1,onCtrl:r,onKeyboard:s}){const[n,o]=M.useState(!1),[l,a]=M.useState(!1),[h,f]=M.useState(!1),c=_=>{h?(e(st+_),f(!1)):e(_)},u=(_,S,k)=>d.jsx("button",{onMouseDown:m=>{m.preventDefault(),c(S),k&&k()},children:_},_),p=(_,S)=>d.jsx("button",{onMouseDown:k=>{k.preventDefault(),t(S),a(!1)},children:_},_);return n?d.jsxs("div",{className:"nc-keybar copy",children:[d.jsx("span",{className:"tag",children:"copy-mode"}),s1.map(_=>u(_.label,_.seq)),u("ESCI (q)","q",()=>o(!1))]}):d.jsxs("div",{className:"nc-keybar termux",children:[l&&d.jsxs("div",{className:"nc-keymenu",children:[p("←WIN","prev-window"),p("WIN→","next-window"),p("⬅PANE","pane-left"),p("PANE➡","pane-right"),u("SCROLL",kd+"[",()=>{o(!0),a(!1)}),u("⌃C","",()=>a(!1)),u("DETACH",kd+"d",()=>a(!1))]}),d.jsxs("div",{className:"row",children:[u("ESC",st),d.jsx("button",{className:l?"armed":"",onMouseDown:_=>{_.preventDefault(),a(S=>!S)},children:"☰"},"menu"),u("/","/"),u("—","-"),u("HOME",st+"[H"),u("↑",st+"[A"),u("END",st+"[F"),u("PGUP",st+"[5~")]}),d.jsxs("div",{className:"row",children:[u("⇥"," "),d.jsx("button",{onMouseDown:_=>{_.preventDefault(),s&&s()},children:"⌨"},"kbd"),d.jsx("button",{className:i?"armed":"",onMouseDown:_=>{_.preventDefault(),r&&r()},children:"CTRL"},"ctrl"),d.jsx("button",{className:h?"armed":"",onMouseDown:_=>{_.preventDefault(),f(S=>!S)},children:"ALT"},"alt"),u("←",st+"[D"),u("↓",st+"[B"),u("→",st+"[C"),u("PGDN",st+"[6~")]})]})}const o1=e=>e>1048576?`${(e/1048576).toFixed(1)}M`:e>1024?`${(e/1024).toFixed(0)}K`:`${e}B`;function Zp({session:e,token:t,filesEvent:i,onClose:r}){Yt();const[s,n]=M.useState("outbox"),[o,l]=M.useState({inbox:[],outbox:[]}),[a,h]=M.useState(""),f=M.useRef(null);async function c(){try{const k=await(await _t(`/api/files?session=${encodeURIComponent(e)}`,t)).json();if(k.error){h(k.error);return}l(k);const m=k.outbox[0]?k.outbox[0].mtime:0;localStorage.setItem(X_(e),String(m))}catch(S){h(String(S))}}M.useEffect(()=>{c()},[e]),M.useEffect(()=>{i&&i.session===e&&c()},[i]);async function u(S){for(const k of S){h(`carico ${k.name}…`);const m=new FormData;m.append("session",e),m.append("file",k);try{const g=await(await _t("/api/files/upload",t,{method:"POST",body:m})).json();h(g.error?`errore: ${g.error}`:"")}catch(v){h(String(v))}}c()}async function p(S){const k=await _t(`/api/files/download?session=${encodeURIComponent(e)}&box=${s}&name=${encodeURIComponent(S)}`,t);if(!k.ok){h("errore download");return}const m=await k.blob(),v=URL.createObjectURL(m),g=document.createElement("a");g.href=v,g.download=S,g.click(),URL.revokeObjectURL(v)}async function _(S){await _t(`/api/files?session=${encodeURIComponent(e)}&box=${s}&name=${encodeURIComponent(S)}`,t,{method:"DELETE"}),c()}return d.jsxs("div",{className:"nc-files",children:[d.jsxs("header",{children:[d.jsx("b",{children:e}),d.jsx("button",{onClick:r,title:z("close"),children:d.jsx(Re,{name:"x",size:20})})]}),d.jsxs("nav",{children:[d.jsx("button",{className:s==="outbox"?"on":"",onClick:()=>n("outbox"),children:"outbox"}),d.jsx("button",{className:s==="inbox"?"on":"",onClick:()=>n("inbox"),children:"inbox"}),d.jsxs("button",{className:"up",onClick:()=>f.current&&f.current.click(),children:[d.jsx(Re,{name:"upload",size:18})," ",z("upload")]}),d.jsx("input",{type:"file",multiple:!0,ref:f,style:{display:"none"},onChange:S=>{u(Array.from(S.target.files||[])),S.target.value=""}})]}),a&&d.jsx("div",{className:"nc-busy",children:a}),d.jsxs("ul",{children:[o[s].map(S=>d.jsxs("li",{children:[d.jsx("span",{className:"name",onClick:()=>p(S.name),children:S.name}),d.jsx("small",{children:o1(S.size)}),d.jsx("button",{onClick:()=>_(S.name),title:"elimina",children:d.jsx(Re,{name:"trash",size:18})})]},S.name)),o[s].length===0&&d.jsx("li",{className:"empty",children:z("empty-files")})]})]})}const l1="\r";function a1(e){let t=e.length;for(;t>0;){const i=e.charCodeAt(t-1);if(i===10||i===13)t-=1;else break}return e.slice(0,t)}function em({send:e,token:t,session:i}){Yt();const[r,s]=M.useState(""),[n,o]=M.useState(!1),[l,a]=M.useState(""),[h,f]=M.useState(!1),c=M.useRef(null),u=M.useRef(null),[p,_]=M.useState(!1),[S,k]=M.useState({left:0,bottom:0}),[m,v]=M.useState(!1),g=M.useRef(null),w=M.useRef(null),x=M.useRef(null),b=M.useRef(null),D=M.useRef(null),N=M.useRef(`nc-attach-${Math.random().toString(36).slice(2,8)}`);M.useEffect(()=>{let y=!1;return _t("/api/voice/status",t).then(L=>L.json()).then(L=>{y||f(!!L.serverSttConfigured)}).catch(()=>{y||f(!1)}),()=>{y=!0}},[t]);const H=!!(typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)||h);function W(){const y=a1(r);y&&(e(y),e(l1),s(""))}function A(){const y=g.current&&g.current.getBoundingClientRect();y&&k({left:Math.max(6,Math.min(y.left,window.innerWidth-186)),bottom:window.innerHeight-y.top+6}),_(!0)}function E(y){_(!1),y&&g.current&&g.current.focus()}M.useEffect(()=>{if(!p)return;const y=F=>{F.key==="Escape"&&E(!0)},L=F=>{const q=w.current&&w.current.contains(F.target),Q=g.current&&g.current.contains(F.target);!q&&!Q&&E(!1)};return document.addEventListener("keydown",y),document.addEventListener("pointerdown",L),()=>{document.removeEventListener("keydown",y),document.removeEventListener("pointerdown",L)}},[p]);function I(y){E(!1),y.current&&y.current.click()}async function C(y){if(!y.length||!i)return;v(!0),a("");const L=[];for(const F of y)try{const q=new FormData;q.append("session",i),q.append("paste","false"),q.append("file",F,F.name);const K=await(await _t("/api/files/upload",t,{method:"POST",body:q})).json();if(K.error){a(K.error);break}L.push(K.path)}catch(q){a(String(q));break}L.length&&s(F=>F+(F&&!F.endsWith(" ")?" ":"")+L.join(" ")),v(!1)}function P(){c.current&&c.current.stop(),u.current&&u.current.stop(),o(!1)}async function T(){a("");const y=window.SpeechRecognition||window.webkitSpeechRecognition;if(y){const L=new y;L.lang="it-IT",L.continuous=!1,L.interimResults=!0;const F=r?`${r} `:"";L.onresult=q=>{const Q=Array.from(q.results).map(K=>K[0].transcript).join("");s(F+Q)},L.onend=()=>o(!1),L.onerror=q=>{a(`voice: ${q.error||"errore"}`),o(!1)},c.current=L,L.start(),o(!0);return}try{const L=await navigator.mediaDevices.getUserMedia({audio:!0}),F=new MediaRecorder(L),q=[];F.ondataavailable=Q=>q.push(Q.data),F.onstop=async()=>{L.getTracks().forEach(Q=>Q.stop()),o(!1),a("trascrivo…");try{const Q=new Blob(q,{type:F.mimeType||"audio/webm"}),X=await(await _t("/api/voice/transcribe",t,{method:"POST",headers:{"content-type":"application/octet-stream"},body:Q})).json();X.error?a(X.error):(a(""),s(ke=>ke+(ke?" ":"")+(X.text||"")))}catch(Q){a(String(Q))}},u.current={stop:()=>F.state!=="inactive"&&F.stop()},F.start(),o(!0)}catch{a("microfono non disponibile"),o(!1)}}return d.jsxs("div",{className:"nc-composer",children:[l&&d.jsx("div",{className:"nc-composer-err",children:l}),d.jsxs("div",{className:"nc-composer-row",children:[i&&d.jsx("button",{ref:g,className:m?"attach busy":"attach",disabled:m,onClick:()=>p?E(!1):A(),title:z(m?"attach-uploading":"attach"),"aria-label":z("attach"),"aria-haspopup":"menu","aria-expanded":p,"aria-controls":N.current,children:d.jsx(Re,{name:"attach",size:22})}),p&&d.jsxs("div",{ref:w,id:N.current,role:"menu",className:"nc-attach-menu",style:{left:S.left,bottom:S.bottom},children:[d.jsxs("button",{role:"menuitem",onClick:()=>I(x),children:[d.jsx(Re,{name:"file",size:18})," ",z("attach-file")]}),d.jsxs("button",{role:"menuitem",onClick:()=>I(b),children:[d.jsx(Re,{name:"camera",size:18})," ",z("attach-camera")]}),d.jsxs("button",{role:"menuitem",onClick:()=>I(D),children:[d.jsx(Re,{name:"image",size:18})," ",z("attach-gallery")]})]}),d.jsx("input",{ref:x,type:"file",multiple:!0,hidden:!0,onChange:y=>{C(Array.from(y.target.files||[])),y.target.value=""}}),d.jsx("input",{ref:b,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:y=>{C(Array.from(y.target.files||[])),y.target.value=""}}),d.jsx("input",{ref:D,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:y=>{C(Array.from(y.target.files||[])),y.target.value=""}}),d.jsx("textarea",{rows:2,value:r,placeholder:z("composer-placeholder"),onChange:y=>s(y.target.value)}),H&&d.jsx("button",{className:n?"mic on":"mic",onClick:n?P:T,title:z("voice"),children:d.jsx(Re,{name:"mic",size:22})}),d.jsx("button",{className:"go",onClick:W,title:z("send"),children:d.jsx(Re,{name:"enter",size:22})})]})]})}function h1(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function c1(e){return String(e||"?").replace(/^[^a-zA-Z0-9]+/,"").charAt(0).toUpperCase()||"?"}const u1=180,d1=480;function f1({sessions:e=[],cells:t=[],activeSessions:i=[],onPick:r,onAddTile:s,onPower:n,onKill:o,onNew:l,width:a=240,collapsed:h=!1,onResize:f,onToggleCollapse:c}){const[u,p]=Yt(),[_,S]=M.useState(tp),k=C=>S(P=>ip(P,C)),m=new Set((t||[]).map(C=>C.tmuxSession)),v=new Map((e||[]).map(C=>[C.name,C])),g=(C,P)=>ls(_,C,P),w=Ca,x=[...t||[]].sort((C,P)=>w(g(C.tmuxSession,(v.get(C.tmuxSession)||{}).activity),g(P.tmuxSession,(v.get(P.tmuxSession)||{}).activity))),b=(e||[]).filter(C=>!m.has(C.name)).sort((C,P)=>w(g(C.name,C.activity),g(P.name,P.activity))||C.name.localeCompare(P.name)),D=new Set(i||[]),[N,V]=M.useState(null),H=(C,P)=>{const T=C.currentTarget.getBoundingClientRect();V({text:P,y:T.top+T.height/2})},W=()=>V(null),A=M.useRef(null);M.useEffect(()=>()=>{A.current&&A.current()},[]);function E(C){C.preventDefault(),C.stopPropagation();const P=C.clientX,T=a,y=F=>{const q=Math.max(u1,Math.min(d1,T+(F.clientX-P)));f&&f(q)},L=()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",L),window.removeEventListener("blur",L),A.current=null};window.addEventListener("pointermove",y),window.addEventListener("pointerup",L),window.addEventListener("pointercancel",L),window.addEventListener("blur",L),A.current=L}const I=h?{width:48,flex:"0 0 48px"}:{width:a,flex:`0 0 ${a}px`};return h?d.jsxs("aside",{className:"nc-sidebar mini",style:I,children:[d.jsx("div",{className:"nc-side-head mini",children:d.jsx("button",{className:"nc-collapse-btn",onClick:c,title:z("expand"),children:"⟩"})}),d.jsxs("div",{className:"nc-side-group mini",children:[x.map(C=>{const P=C.degraded?"warn":C.tmux?"on":"",T=!!C.tmux;return d.jsx("button",{type:"button",className:`nc-mini-dot${D.has(C.tmuxSession)?" active":""}`,onMouseEnter:y=>H(y,C.cell),onMouseLeave:W,draggable:T,onDragStart:T?y=>y.dataTransfer.setData("text/nc-session",C.tmuxSession):void 0,onClick:T?()=>s&&s(C.tmuxSession):()=>n&&n(C),onDoubleClick:T?()=>r&&r(C.tmuxSession):void 0,children:d.jsx("span",{className:`nc-dot ${P}`})},C.cell)}),b.map(C=>d.jsx("button",{type:"button",className:`nc-mini-init${D.has(C.name)?" active":""}`,onMouseEnter:P=>H(P,C.name),onMouseLeave:W,draggable:!0,onDragStart:P=>P.dataTransfer.setData("text/nc-session",C.name),onClick:()=>s&&s(C.name),onDoubleClick:()=>r&&r(C.name),children:c1(C.name)},C.name))]}),N&&d.jsx("div",{className:"nc-mini-tip",style:{top:N.y},children:N.text})]}):d.jsxs("aside",{className:"nc-sidebar",style:I,children:[d.jsxs("div",{className:"nc-side-head",children:[d.jsx("button",{className:"nc-collapse-btn",onClick:c,title:z("collapse"),children:"⟨"}),d.jsx("span",{className:"nc-side-title",children:z("fleet")}),d.jsxs("button",{className:"nc-new-btn",onClick:l,title:z("new-session"),children:["+ ",z("new")]})]}),(t||[]).length>0&&d.jsx("div",{className:"nc-side-group",children:x.map(C=>{const P=C.degraded?"warn":C.tmux?"on":"",T=C.degraded?z("cell-degraded"):C.tmux?z("cell-on"):z("cell-off"),y=!!C.tmux;return d.jsxs("div",{className:`nc-cell${y?" live":""}${D.has(C.tmuxSession)?" active":""}`,title:T,draggable:y,onDragStart:y?L=>L.dataTransfer.setData("text/nc-session",C.tmuxSession):void 0,onClick:y?()=>s&&s(C.tmuxSession):void 0,onDoubleClick:y?()=>r&&r(C.tmuxSession):void 0,children:[d.jsx("span",{className:`nc-dot ${P}`}),d.jsxs("span",{className:"nc-cell-main",children:[d.jsx("b",{children:C.cell}),d.jsxs("small",{children:[C.engine,C.key?`·${C.key}`:""]})]}),d.jsx("button",{className:`nc-pin${_.includes(C.tmuxSession)?" on":""}`,title:z("pin"),onClick:L=>{L.stopPropagation(),k(C.tmuxSession)},children:_.includes(C.tmuxSession)?"★":"☆"}),d.jsx("button",{className:`nc-power${C.tmux?" on":""}${C.degraded?" warn":""}`,onClick:L=>{L.stopPropagation(),n&&n(C)},title:C.active?z("power-off"):z("power-on"),children:d.jsx(Re,{name:"power",size:14})})]},C.cell)})}),d.jsx("div",{className:"nc-side-group-title",children:z("other-sessions")}),d.jsxs("div",{className:"nc-side-group",children:[b.map(C=>d.jsxs("div",{className:`nc-side-card${D.has(C.name)?" active":""}`,draggable:!0,onDragStart:P=>P.dataTransfer.setData("text/nc-session",C.name),onClick:()=>s&&s(C.name),onDoubleClick:()=>r&&r(C.name),children:[d.jsx("span",{className:C.attached?"nc-dot on":"nc-dot"}),d.jsxs("span",{className:"nc-card-main",children:[d.jsx("b",{children:C.name}),d.jsxs("small",{children:[C.preview?C.preview:C.cmd?C.cmd:z("windows").replace("{n}",String(C.windows||0)),C.outbox&&C.outbox.count>0?` · 📦${C.outbox.count}`:""]})]}),C.activity?d.jsx("span",{className:"nc-rel",children:h1(C.activity)}):null,d.jsx("button",{className:`nc-pin${_.includes(C.name)?" on":""}`,title:z("pin"),onClick:P=>{P.stopPropagation(),k(C.name)},children:_.includes(C.name)?"★":"☆"}),d.jsx("button",{className:"nc-menu",title:z("terminate"),onClick:P=>{P.stopPropagation(),window.confirm(z("terminate-confirm").replace("{name}",C.name))&&o&&o(C.name)},children:"⋯"})]},C.name)),b.length===0&&d.jsx("div",{className:"nc-empty",children:z("no-sessions-short")})]}),d.jsx("div",{className:"nc-side-lang",children:np.map((C,P)=>d.jsxs("span",{children:[P>0&&" · ",d.jsx("button",{className:`nc-lang-btn${u===C?" on":""}`,onClick:()=>p(C),title:C,children:C.toUpperCase()})]},C))}),d.jsx("div",{className:"nc-side-resize",onPointerDown:E,title:""})]})}const vc=9,yo=.2,tm=9,im=24,jo=11,_1=e=>{const t=Number(e);return t>=tm&&t<=im?t:jo};function rm(){return{columns:[]}}function Pi(e){return e.columns.flatMap(t=>t.tiles.map(i=>i.session))}const Js=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(i=>({...i}))}))});function wo(e,t,i,r){if(Pi(e).includes(t)||Pi(e).length>=vc)return e;const s=Js(e),n={session:t,height:1,fontSize:jo,...r||{}};if(i==="end")return s.columns.push({width:1,tiles:[n]}),s;if(i&&typeof i.col=="number"&&typeof i.row=="number"&&s.columns[i.col])return s.columns[i.col].tiles.splice(i.row,0,n),s;if(i&&typeof i.col=="number"){const o=Math.max(0,Math.min(s.columns.length,i.col));return s.columns.splice(o,0,{width:1,tiles:[n]}),s}return s.columns.push({width:1,tiles:[n]}),s}function p1(e,t){if(Pi(e).includes(t)||Pi(e).length>=vc)return e;const i=Pi(e).length+1,r=Math.ceil(Math.sqrt(i));if(e.columns.length<r)return wo(e,t,"end");let s=0;for(let n=1;n<e.columns.length;n+=1)e.columns[n].tiles.length<e.columns[s].tiles.length&&(s=n);return wo(e,t,{col:s,row:e.columns[s].tiles.length})}function gc(e,t){const i=Js(e);for(const r of i.columns)r.tiles=r.tiles.filter(s=>s.session!==t);return i.columns=i.columns.filter(r=>r.tiles.length>0),i}function m1(e,t,i){if(!Pi(e).includes(t))return e;const r=e.columns.flatMap(s=>s.tiles).find(s=>s.session===t);return wo(gc(e,t),t,i,{fontSize:r.fontSize})}function v1(e,t,i){const r=Js(e);return r.columns[t]&&(r.columns[t].width=Math.max(yo,Number(i)||1)),r}function g1(e,t,i,r){const s=Js(e),n=s.columns[t]&&s.columns[t].tiles[i];return n&&(n.height=Math.max(yo,Number(r)||1)),s}function S1(e,t,i,r){if(!(e.columns[t]&&e.columns[t].tiles[i]))return e;const n=Js(e),o=n.columns[t].tiles[i],l=Number(o.fontSize)||jo;return o.fontSize=Math.max(tm,Math.min(im,l+(Number(r)||0))),n}function y1(e,t,i,r){const s=e.columns[t];if(!s||!s.tiles[i])return null;switch(r){case"left":return{col:t};case"right":return{col:t+1};case"top":return{col:t,row:i};case"bottom":return{col:t,row:i+1};default:return null}}function bd(e){for(const t of[.25,.5,.75])if(Math.abs(e-t)<=.03)return t;return e}function w1(e){if(!e||!Array.isArray(e.columns))return rm();const t=e.columns.map(r=>({width:Math.max(yo,Number(r&&r.width)||1),tiles:(Array.isArray(r&&r.tiles)?r.tiles:[]).filter(s=>s&&typeof s.session=="string"&&s.session).map(s=>({session:s.session,height:Math.max(yo,Number(s.height)||1),fontSize:_1(s.fontSize)}))})).filter(r=>r.tiles.length>0),i=new Set;for(const r of t)r.tiles=r.tiles.filter(s=>!i.has(s.session)&&i.add(s.session)&&i.size<=vc);return{columns:t.filter(r=>r.tiles.length>0)}}function C1({session:e,token:t,focused:i,onFocus:r,onClose:s,onOpenSingle:n,alive:o=!0,fontSize:l=jo,onZoom:a}){const h=M.useRef(()=>{}),f=M.useRef(()=>{}),c=M.useRef(!1),[u,p]=M.useState(!1),[_,S]=M.useState(!1),[k,m]=M.useState(!1),[v,g]=M.useState(null);return d.jsxs("div",{className:`nc-tile${i?" focused":""}`,onMouseDown:()=>r&&r(e),children:[d.jsxs("div",{className:"nc-tile-head",draggable:!0,onDragStart:w=>{w.dataTransfer.setData("text/nc-session",e),w.dataTransfer.effectAllowed="move"},children:[d.jsxs("button",{className:"nc-tile-name",onClick:()=>r&&r(e),children:[d.jsx("span",{className:o?"nc-dot on":"nc-dot"}),d.jsx("b",{children:e})]}),d.jsxs("span",{className:"nc-tile-actions",children:[a&&d.jsx("button",{onClick:()=>a(-1),title:z("zoom-out"),children:d.jsx(Re,{name:"zoomOut",size:14})}),a&&d.jsx("button",{onClick:()=>a(1),title:z("zoom-in"),children:d.jsx(Re,{name:"zoomIn",size:14})}),d.jsx("button",{onClick:()=>S(w=>!w),title:"composer",children:"⌨"}),d.jsx("button",{onClick:()=>m(w=>!w),title:"file",children:"📁"}),n&&d.jsx("button",{onClick:()=>n(e),title:"vista singola",children:"↗"}),s&&d.jsx("button",{className:"nc-tile-close",onClick:()=>s(e),title:"chiudi",children:"✕"})]})]}),d.jsxs("div",{className:"nc-tile-body",children:[d.jsx(Jp,{session:e,token:t,readonly:!1,takeSize:!1,sendRef:h,actionRef:f,ctrlRef:c,setCtrlArmed:p,onFiles:g,fontSize:l}),k&&d.jsx("div",{className:"nc-tile-files",onMouseDown:w=>w.stopPropagation(),children:d.jsx(Zp,{session:e,token:t,filesEvent:v,onClose:()=>m(!1)})})]}),_&&d.jsx("div",{className:"nc-tile-composer",onMouseDown:w=>w.stopPropagation(),children:d.jsx(em,{send:w=>h.current(w),token:t,session:e})})]})}const Ed=.2,Dd=.28;function x1(e,t,i){const r=(e-i.left)/(i.width||1),s=(t-i.top)/(i.height||1);return r<Dd?"left":r>1-Dd?"right":s<.5?"top":"bottom"}function k1({layout:e,onLayoutChange:t,token:i,sessionsAlive:r,focusSession:s,onFocus:n,onOpenSingle:o}){Yt();const[l,a]=M.useState(null),h=M.useRef(null),f=M.useRef([]),c=M.useRef(null);function u(x,b){const D=()=>{window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D),window.removeEventListener("blur",D),c.current=null};window.addEventListener("pointermove",x),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D),window.addEventListener("blur",D),c.current=D}M.useEffect(()=>()=>{c.current&&c.current()},[]),M.useEffect(()=>{const x=()=>a(null);return window.addEventListener("dragend",x),window.addEventListener("drop",x),()=>{window.removeEventListener("dragend",x),window.removeEventListener("drop",x)}},[]);const p=e.columns.length,_=x=>l&&l.col===x&&l.row===void 0,S=!!l&&l.col===p,k=(x,b)=>l&&l.col===x&&l.row===b&&l.quadrant?` drop-${l.quadrant}`:"";function m(x){x.preventDefault();const b=x.dataTransfer.getData("text/nc-session"),D=l;if(a(null),!b||!D)return;let N;if(D.quadrant){if(N=y1(e,D.col,D.row,D.quadrant),!N)return}else N={col:D.col};t(Pi(e).includes(b)?m1(e,b,N):wo(e,b,N))}function v(x,b){x.preventDefault(),x.stopPropagation();const D=x.clientX,N=e.columns[b].width,V=h.current&&h.current.clientWidth||1,H=e.columns[b+1];u(A=>{let E=Math.max(Ed,N+(A.clientX-D)/V);if(H){const I=bd(E/(E+H.width));E=I/(1-I)*H.width}t(v1(e,b,E))})}function g(x,b,D){x.preventDefault(),x.stopPropagation();const N=x.clientY,V=e.columns[b].tiles[D].height,H=f.current[b],W=H&&H.clientHeight||1,A=e.columns[b].tiles[D+1];u(I=>{let C=Math.max(Ed,V+(I.clientY-N)/W);if(A){const P=bd(C/(C+A.height));C=P/(1-P)*A.height}t(g1(e,b,D,C))})}function w(x){t(gc(e,x))}return d.jsxs("div",{className:"nc-grid",ref:h,onDragOver:x=>{x.preventDefault(),l&&l.col===p||a({col:p})},onDrop:m,onDragLeave:x=>{const b=x.relatedTarget;(!b||!(h.current&&h.current.contains(b)))&&a(null)},children:[e.columns.flatMap((x,b)=>{const D=[];return D.push(d.jsx("div",{className:`nc-col${_(b)?" drop-newcol":""}`,ref:N=>{f.current[b]=N},style:{flexGrow:x.width,flexBasis:0},onDragOver:N=>{N.preventDefault(),N.stopPropagation(),l&&l.col===b&&l.row===void 0||a({col:b})},children:x.tiles.flatMap((N,V)=>{const H=[];return H.push(d.jsx("div",{className:`nc-tile-slot${k(b,V)}`,style:{flexGrow:N.height,flexBasis:0},onDragOver:W=>{W.preventDefault(),W.stopPropagation();const A=x1(W.clientX,W.clientY,W.currentTarget.getBoundingClientRect());l&&l.col===b&&l.row===V&&l.quadrant===A||a({col:b,row:V,quadrant:A})},children:d.jsx(C1,{session:N.session,token:i,focused:s===N.session,onFocus:n,onClose:w,onOpenSingle:o,alive:!r||r.has(N.session),fontSize:N.fontSize,onZoom:W=>t(S1(e,b,V,W))})},N.session)),V<x.tiles.length-1&&H.push(d.jsx("div",{className:"nc-divider-h",onPointerDown:W=>g(W,b,V)},`h${V}`)),H})},`c${b}`)),b<p-1&&D.push(d.jsx("div",{className:"nc-divider-v",onPointerDown:N=>v(N,b)},`v${b}`)),D}),S&&d.jsx("div",{className:"nc-drop-line-v nc-drop-line-end"}),p===0&&d.jsx("div",{className:"nc-grid-empty",children:z("grid-empty")})]})}const sm=9,nm=24,om="nc_grid_v1",lm="nc_side_w",Ld="nc_side_min",b1=240,Rd="(min-width:1024px) and (pointer:fine)";function E1(){const e=Number(localStorage.getItem(lm));return e>=180&&e<=480?e:b1}function D1(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=sm&&e<=nm?e:13}function L1(){const t=location.hash.replace(/^#/,"").match(/(?:^|&)token=([^&]+)/);if(t){const i=decodeURIComponent(t[1]);try{history.replaceState(null,"",location.pathname+location.search)}catch{}try{localStorage.setItem("nc_token",i)}catch{}return i}return sessionStorage.getItem("nc_token")||localStorage.getItem("nc_token")||""}function R1(){try{return w1(JSON.parse(localStorage.getItem(om)||"null"))}catch{return rm()}}function Md(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function M1(){const[e,t]=M.useState(()=>window.matchMedia(Rd).matches);return M.useEffect(()=>{const i=window.matchMedia(Rd),r=s=>t(s.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),e}function Pd({session:e,token:t,onBack:i}){Yt();const[r,s]=M.useState(!1),[n,o]=M.useState(()=>window.matchMedia("(pointer: coarse)").matches),[l,a]=M.useState(null),[h,f]=M.useState(D1),[c,u]=M.useState(""),p=w=>f(x=>{const b=Math.max(sm,Math.min(nm,x+w));return localStorage.setItem("nc_fontsize",String(b)),b}),_=M.useRef(()=>{}),S=M.useRef(()=>{}),k=M.useRef(!1),[m,v]=M.useState(!1),g=()=>{k.current=!k.current,v(k.current)};return M.useEffect(()=>{let w=!0;async function x(){let D=null,N=null;try{const W=await(await _t("/api/sessions",t)).json();Array.isArray(W.sessions)&&(D=W.sessions.find(A=>A.name===e))}catch{}try{const H=await nc(t);H.available&&Array.isArray(H.cells)&&(N=H.cells.find(W=>W.tmuxSession===e))}catch{}if(!w)return;let V="";N?V=`${N.engine}${N.key?`·${N.key}`:""}`:D&&(V=D.attached?`attached · ${Md(D.activity)}`:D.activity?Md(D.activity):""),u(V)}x();const b=setInterval(x,4e3);return()=>{w=!1,clearInterval(b)}},[e,t]),d.jsxs("div",{className:"nc-app",children:[d.jsxs("header",{className:"nc-bar nc-bar-single",children:[d.jsxs("button",{onClick:i,title:z("sessions"),children:[d.jsx(Re,{name:"chevronLeft",size:18}),d.jsx("span",{className:"nc-bar-label",children:z("sessions")})]}),d.jsxs("span",{className:"nc-bar-center",children:[d.jsx("b",{children:e}),c&&d.jsx("small",{className:"nc-bar-sub",children:c})]}),d.jsxs("span",{className:"nc-bar-right",children:[d.jsx("button",{onClick:()=>p(-1),title:z("zoom-out"),children:d.jsx(Re,{name:"zoomOut",size:18})}),d.jsx("button",{onClick:()=>p(1),title:z("zoom-in"),children:d.jsx(Re,{name:"zoomIn",size:18})}),d.jsx("button",{onClick:()=>o(w=>!w),title:z("composer"),children:d.jsx(Re,{name:"keyboard",size:20})}),d.jsx("button",{onClick:()=>s(w=>!w),title:z("files"),children:d.jsx(Re,{name:"folder",size:20})})]})]}),d.jsx("div",{className:"nc-termwrap",children:d.jsx(Jp,{session:e,token:t,readonly:!1,sendRef:_,actionRef:S,ctrlRef:k,setCtrlArmed:v,onFiles:a,fontSize:h})}),d.jsx(n1,{onKeyboard:()=>o(w=>!w),send:w=>_.current(w),action:w=>S.current(w),ctrlArmed:m,onCtrl:g}),n&&d.jsx(em,{send:w=>_.current(w),token:t,session:e}),r&&d.jsx(Zp,{session:e,token:t,filesEvent:l,onClose:()=>s(!1)})]})}function P1(){Yt();const[e,t]=M.useState(L1()),[i,r]=M.useState(!1),s=M1(),[n,o]=M.useState(null),[l,a]=M.useState([]),[h,f]=M.useState([]),[c,u]=M.useState([]),[p,_]=M.useState(R1),[S,k]=M.useState(null),[m,v]=M.useState(null),[g,w]=M.useState(null),[x,b]=M.useState(!1),[D,N]=M.useState(!1),[V,H]=M.useState(["shell","claude","codex-vl","pi"]),[W,A]=M.useState(E1),[E,I]=M.useState(()=>localStorage.getItem(Ld)==="1");M.useEffect(()=>{try{localStorage.setItem(om,JSON.stringify(p))}catch{}},[p]),M.useEffect(()=>{try{localStorage.setItem(lm,String(W))}catch{}},[W]),M.useEffect(()=>{try{localStorage.setItem(Ld,E?"1":"")}catch{}},[E]);const C=M.useCallback(async()=>{try{const X=await(await _t("/api/sessions",e)).json();X.error||a(X.sessions||[])}catch{}try{const K=await nc(e);f(K.available?K.cells||[]:[]),u(K.available?K.engines||[]:[])}catch{f([]),u([])}},[e]);M.useEffect(()=>{if(!s)return;C();const K=setInterval(C,4e3);return()=>clearInterval(K)},[s,C]),M.useEffect(()=>{if(!s)return;let K=!1;return _t("/api/config",e).then(X=>X.json()).then(X=>{!K&&Array.isArray(X.presets)&&X.presets.length&&H(X.presets),!K&&X.version&&X.version!=="0.7.7"&&N(X.version)}).catch(()=>{}),()=>{K=!0}},[s,e]);const P=new Set(l.map(K=>K.name)),T=Pi(p),y=K=>_(X=>p1(X,K)),L=async K=>{try{await Z_(e,K)}catch{return}_(X=>gc(X,K)),C()},F=async K=>{if(!g)return;const{cell:X}=g;K.action==="up"?await G_(e,{cell:X,engine:K.engine,boot:!!K.boot}):await Q_(e,{cell:X,boot:!!K.boot}),C()},q=async K=>{await J_(e,K),C()};if(!e)return d.jsxs("div",{className:"nc-auth",children:[d.jsx("p",{children:z("auth-prompt")}),d.jsx("input",{onChange:K=>t(K.target.value.trim()),placeholder:"token"}),d.jsxs("label",{children:[d.jsx("input",{type:"checkbox",checked:i,onChange:K=>r(K.target.checked)})," ",z("remember-device")]}),d.jsx("button",{onClick:()=>{(i?localStorage:sessionStorage).setItem("nc_token",e)},children:"ok"})]});const Q=D?d.jsxs("div",{className:"nc-stale",onClick:()=>location.reload(),children:[z("update-available").replace("{v}",D)," — ",z("reload")]}):null;return s?d.jsxs("div",{className:"nc-workspace",children:[Q,d.jsx(f1,{sessions:l,cells:h,activeSessions:T,onPick:v,onAddTile:y,onPower:w,onKill:L,onNew:()=>b(!0),width:W,collapsed:E,onResize:A,onToggleCollapse:()=>I(K=>!K)}),d.jsx("div",{className:"nc-workspace-main",children:d.jsx(k1,{layout:p,onLayoutChange:_,token:e,sessionsAlive:P,focusSession:S,onFocus:k,onOpenSingle:v})}),m&&d.jsx("div",{className:"nc-single-overlay",children:d.jsx(Pd,{session:m,token:e,onBack:()=>v(null)})}),g&&d.jsx(op,{cell:g,engines:c,onConfirm:F,onClose:()=>w(null)}),x&&d.jsx(lp,{presets:V,token:e,onCreate:q,onClose:()=>b(!1)})]}):n?d.jsxs(d.Fragment,{children:[Q,d.jsx(Pd,{session:n,token:e,onBack:()=>o(null)})]}):d.jsxs(d.Fragment,{children:[Q,d.jsx(Ug,{onPick:o,token:e})]})}const B1="/sw.js",ah="nc-sw-update";let hh=null,ch=!1,am=!1;function N1(){typeof window<"u"&&window.dispatchEvent(new Event(ah))}function Bd(){return ch}function T1(e){return typeof window>"u"?()=>{}:(window.addEventListener(ah,e),()=>window.removeEventListener(ah,e))}function hm(e){ch!==e&&(ch=e,N1())}function O1(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&hm(!0)})}function A1(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{am&&location.reload()}),navigator.serviceWorker.register(B1).then(e=>{hh=e,e.waiting&&hm(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&O1(t)}),setInterval(()=>{e.update().catch(()=>{})},60*60*1e3)}).catch(()=>{}))}function I1(){am=!0;const e=hh&&hh.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}function z1(){if(Yt(),!M.useSyncExternalStore(T1,Bd,Bd))return null;const t=z("update-available").replace(" {v}","");return d.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[d.jsx("span",{className:"nc-update-msg",children:t}),d.jsx("button",{className:"nc-update-btn",onClick:I1,children:z("reload")})]})}A1();Rl.createRoot(document.getElementById("root")).render(d.jsxs(Em.StrictMode,{children:[d.jsx(P1,{}),d.jsx(z1,{})]}));
|