@mmmbuto/nexuscrew 0.8.0 → 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 +43 -51
- 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/version.json +1 -1
- package/lib/cli/commands.js +175 -100
- package/lib/cli/init.js +32 -7
- package/lib/cli/service.js +0 -5
- package/lib/decks/store.js +8 -2
- package/lib/files/routes.js +3 -1
- package/lib/fleet/builtin.js +15 -5
- package/lib/fleet/managed.js +277 -107
- package/lib/mcp/server.js +24 -5
- package/lib/nodes/commands.js +27 -12
- package/lib/nodes/peering.js +116 -0
- package/lib/nodes/store.js +91 -24
- package/lib/nodes/tunnel.js +22 -7
- package/lib/proxy/federation.js +217 -0
- package/lib/proxy/node-proxy.js +21 -8
- package/lib/server.js +90 -7
- package/lib/settings/routes.js +216 -4
- package/package.json +2 -2
- package/frontend/dist/assets/index-BBOgTCoO.css +0 -32
- package/frontend/dist/assets/index-DQrDBogT.js +0 -83
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function i(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(r){if(r.ep)return;r.ep=!0;const n=i(r);fetch(r.href,n)}})();function ov(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ff={exports:{}},Ao={},pf={exports:{}},se={};/**
|
|
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 Qr=Symbol.for("react.element"),lv=Symbol.for("react.portal"),av=Symbol.for("react.fragment"),cv=Symbol.for("react.strict_mode"),hv=Symbol.for("react.profiler"),uv=Symbol.for("react.provider"),dv=Symbol.for("react.context"),fv=Symbol.for("react.forward_ref"),pv=Symbol.for("react.suspense"),_v=Symbol.for("react.memo"),mv=Symbol.for("react.lazy"),Kh=Symbol.iterator;function vv(e){return e===null||typeof e!="object"?null:(e=Kh&&e[Kh]||e["@@iterator"],typeof e=="function"?e:null)}var _f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},mf=Object.assign,vf={};function Ks(e,t,i){this.props=e,this.context=t,this.refs=vf,this.updater=i||_f}Ks.prototype.isReactComponent={};Ks.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")};Ks.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function gf(){}gf.prototype=Ks.prototype;function zc(e,t,i){this.props=e,this.context=t,this.refs=vf,this.updater=i||_f}var Oc=zc.prototype=new gf;Oc.constructor=zc;mf(Oc,Ks.prototype);Oc.isPureReactComponent=!0;var Vh=Array.isArray,Sf=Object.prototype.hasOwnProperty,Ac={current:null},yf={key:!0,ref:!0,__self:!0,__source:!0};function wf(e,t,i){var s,r={},n=null,o=null;if(t!=null)for(s in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(n=""+t.key),t)Sf.call(t,s)&&!yf.hasOwnProperty(s)&&(r[s]=t[s]);var l=arguments.length-2;if(l===1)r.children=i;else if(1<l){for(var c=Array(l),a=0;a<l;a++)c[a]=arguments[a+2];r.children=c}if(e&&e.defaultProps)for(s in l=e.defaultProps,l)r[s]===void 0&&(r[s]=l[s]);return{$$typeof:Qr,type:e,key:n,ref:o,props:r,_owner:Ac.current}}function gv(e,t){return{$$typeof:Qr,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Ic(e){return typeof e=="object"&&e!==null&&e.$$typeof===Qr}function Sv(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(i){return t[i]})}var qh=/\/+/g;function al(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Sv(""+e.key):t.toString(36)}function jn(e,t,i,s,r){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 Qr:case lv:o=!0}}if(o)return o=e,r=r(o),e=s===""?"."+al(o,0):s,Vh(r)?(i="",e!=null&&(i=e.replace(qh,"$&/")+"/"),jn(r,t,i,"",function(a){return a})):r!=null&&(Ic(r)&&(r=gv(r,i+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(qh,"$&/")+"/")+e)),t.push(r)),1;if(o=0,s=s===""?".":s+":",Vh(e))for(var l=0;l<e.length;l++){n=e[l];var c=s+al(n,l);o+=jn(n,t,i,c,r)}else if(c=vv(e),typeof c=="function")for(e=c.call(e),l=0;!(n=e.next()).done;)n=n.value,c=s+al(n,l++),o+=jn(n,t,i,c,r);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 cn(e,t,i){if(e==null)return e;var s=[],r=0;return jn(e,s,"","",function(n){return t.call(i,n,r++)}),s}function yv(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 ot={current:null},zn={transition:null},wv={ReactCurrentDispatcher:ot,ReactCurrentBatchConfig:zn,ReactCurrentOwner:Ac};function Cf(){throw Error("act(...) is not supported in production builds of React.")}se.Children={map:cn,forEach:function(e,t,i){cn(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return cn(e,function(){t++}),t},toArray:function(e){return cn(e,function(t){return t})||[]},only:function(e){if(!Ic(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};se.Component=Ks;se.Fragment=av;se.Profiler=hv;se.PureComponent=zc;se.StrictMode=cv;se.Suspense=pv;se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wv;se.act=Cf;se.cloneElement=function(e,t,i){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=mf({},e.props),r=e.key,n=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(n=t.ref,o=Ac.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Sf.call(t,c)&&!yf.hasOwnProperty(c)&&(s[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)s.children=i;else if(1<c){l=Array(c);for(var a=0;a<c;a++)l[a]=arguments[a+2];s.children=l}return{$$typeof:Qr,type:e.type,key:r,ref:n,props:s,_owner:o}};se.createContext=function(e){return e={$$typeof:dv,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:uv,_context:e},e.Consumer=e};se.createElement=wf;se.createFactory=function(e){var t=wf.bind(null,e);return t.type=e,t};se.createRef=function(){return{current:null}};se.forwardRef=function(e){return{$$typeof:fv,render:e}};se.isValidElement=Ic;se.lazy=function(e){return{$$typeof:mv,_payload:{_status:-1,_result:e},_init:yv}};se.memo=function(e,t){return{$$typeof:_v,type:e,compare:t===void 0?null:t}};se.startTransition=function(e){var t=zn.transition;zn.transition={};try{e()}finally{zn.transition=t}};se.unstable_act=Cf;se.useCallback=function(e,t){return ot.current.useCallback(e,t)};se.useContext=function(e){return ot.current.useContext(e)};se.useDebugValue=function(){};se.useDeferredValue=function(e){return ot.current.useDeferredValue(e)};se.useEffect=function(e,t){return ot.current.useEffect(e,t)};se.useId=function(){return ot.current.useId()};se.useImperativeHandle=function(e,t,i){return ot.current.useImperativeHandle(e,t,i)};se.useInsertionEffect=function(e,t){return ot.current.useInsertionEffect(e,t)};se.useLayoutEffect=function(e,t){return ot.current.useLayoutEffect(e,t)};se.useMemo=function(e,t){return ot.current.useMemo(e,t)};se.useReducer=function(e,t,i){return ot.current.useReducer(e,t,i)};se.useRef=function(e){return ot.current.useRef(e)};se.useState=function(e){return ot.current.useState(e)};se.useSyncExternalStore=function(e,t,i){return ot.current.useSyncExternalStore(e,t,i)};se.useTransition=function(){return ot.current.useTransition()};se.version="18.3.1";pf.exports=se;var E=pf.exports;const Cv=ov(E);/**
|
|
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 xv=E,bv=Symbol.for("react.element"),kv=Symbol.for("react.fragment"),Ev=Object.prototype.hasOwnProperty,Nv=xv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Rv={key:!0,ref:!0,__self:!0,__source:!0};function xf(e,t,i){var s,r={},n=null,o=null;i!==void 0&&(n=""+i),t.key!==void 0&&(n=""+t.key),t.ref!==void 0&&(o=t.ref);for(s in t)Ev.call(t,s)&&!Rv.hasOwnProperty(s)&&(r[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)r[s]===void 0&&(r[s]=t[s]);return{$$typeof:bv,type:e,key:n,ref:o,props:r,_owner:Nv.current}}Ao.Fragment=kv;Ao.jsx=xf;Ao.jsxs=xf;ff.exports=Ao;var h=ff.exports,Xl={},bf={exports:{}},kt={},kf={exports:{}},Ef={};/**
|
|
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(b,I){var B=b.length;b.push(I);e:for(;0<B;){var U=B-1>>>1,X=b[U];if(0<r(X,I))b[U]=I,b[B]=X,B=U;else break e}}function i(b){return b.length===0?null:b[0]}function s(b){if(b.length===0)return null;var I=b[0],B=b.pop();if(B!==I){b[0]=B;e:for(var U=0,X=b.length,J=X>>>1;U<J;){var ee=2*(U+1)-1,oe=b[ee],ne=ee+1,pe=b[ne];if(0>r(oe,B))ne<X&&0>r(pe,oe)?(b[U]=pe,b[ne]=B,U=ne):(b[U]=oe,b[ee]=B,U=ee);else if(ne<X&&0>r(pe,B))b[U]=pe,b[ne]=B,U=ne;else break e}}return I}function r(b,I){var B=b.sortIndex-I.sortIndex;return B!==0?B:b.id-I.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 c=[],a=[],d=1,u=null,f=3,m=!1,_=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,p=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(b){for(var I=i(a);I!==null;){if(I.callback===null)s(a);else if(I.startTime<=b)s(a),I.sortIndex=I.expirationTime,t(c,I);else break;I=i(a)}}function w(b){if(S=!1,g(b),!_)if(i(c)!==null)_=!0,$(M);else{var I=i(a);I!==null&&R(w,I.startTime-b)}}function M(b,I){_=!1,S&&(S=!1,v(C),C=-1),m=!0;var B=f;try{for(g(I),u=i(c);u!==null&&(!(u.expirationTime>I)||b&&!A());){var U=u.callback;if(typeof U=="function"){u.callback=null,f=u.priorityLevel;var X=U(u.expirationTime<=I);I=e.unstable_now(),typeof X=="function"?u.callback=X:u===i(c)&&s(c),g(I)}else s(c);u=i(c)}if(u!==null)var J=!0;else{var ee=i(a);ee!==null&&R(w,ee.startTime-I),J=!1}return J}finally{u=null,f=B,m=!1}}var N=!1,x=null,C=-1,D=5,L=-1;function A(){return!(e.unstable_now()-L<D)}function T(){if(x!==null){var b=e.unstable_now();L=b;var I=!0;try{I=x(!0,b)}finally{I?P():(N=!1,x=null)}}else N=!1}var P;if(typeof p=="function")P=function(){p(T)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,F=j.port2;j.port1.onmessage=T,P=function(){F.postMessage(null)}}else P=function(){k(T,0)};function $(b){x=b,N||(N=!0,P())}function R(b,I){C=k(function(){b(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(b){b.callback=null},e.unstable_continueExecution=function(){_||m||(_=!0,$(M))},e.unstable_forceFrameRate=function(b){0>b||125<b?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<b?Math.floor(1e3/b):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return i(c)},e.unstable_next=function(b){switch(f){case 1:case 2:case 3:var I=3;break;default:I=f}var B=f;f=I;try{return b()}finally{f=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(b,I){switch(b){case 1:case 2:case 3:case 4:case 5:break;default:b=3}var B=f;f=b;try{return I()}finally{f=B}},e.unstable_scheduleCallback=function(b,I,B){var U=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?U+B:U):B=U,b){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=B+X,b={id:d++,callback:I,priorityLevel:b,startTime:B,expirationTime:X,sortIndex:-1},B>U?(b.sortIndex=B,t(a,b),i(c)===null&&b===i(a)&&(S?(v(C),C=-1):S=!0,R(w,B-U))):(b.sortIndex=X,t(c,b),_||m||(_=!0,$(M))),b},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(b){var I=f;return function(){var B=f;f=I;try{return b.apply(this,arguments)}finally{f=B}}}})(Ef);kf.exports=Ef;var Dv=kf.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 Mv=E,bt=Dv;function H(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 Nf=new Set,Lr={};function us(e,t){Os(e,t),Os(e+"Capture",t)}function Os(e,t){for(Lr[e]=t,e=0;e<t.length;e++)Nf.add(t[e])}var di=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gl=Object.prototype.hasOwnProperty,Lv=/^[: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]*$/,Yh={},Xh={};function Pv(e){return Gl.call(Xh,e)?!0:Gl.call(Yh,e)?!1:Lv.test(e)?Xh[e]=!0:(Yh[e]=!0,!1)}function Tv(e,t,i,s){if(i!==null&&i.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Bv(e,t,i,s){if(t===null||typeof t>"u"||Tv(e,t,i,s))return!0;if(s)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 lt(e,t,i,s,r,n,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=r,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=n,this.removeEmptyString=o}var Qe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Qe[e]=new lt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Qe[t]=new lt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Qe[e]=new lt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Qe[e]=new lt(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){Qe[e]=new lt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Qe[e]=new lt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Qe[e]=new lt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Qe[e]=new lt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Qe[e]=new lt(e,5,!1,e.toLowerCase(),null,!1,!1)});var $c=/[\-:]([a-z])/g;function Fc(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($c,Fc);Qe[t]=new lt(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($c,Fc);Qe[t]=new lt(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($c,Fc);Qe[t]=new lt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Qe[e]=new lt(e,1,!1,e.toLowerCase(),null,!1,!1)});Qe.xlinkHref=new lt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Qe[e]=new lt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Hc(e,t,i,s){var r=Qe.hasOwnProperty(t)?Qe[t]:null;(r!==null?r.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Bv(t,i,r,s)&&(i=null),s||r===null?Pv(t)&&(i===null?e.removeAttribute(t):e.setAttribute(t,""+i)):r.mustUseProperty?e[r.propertyName]=i===null?r.type===3?!1:"":i:(t=r.attributeName,s=r.attributeNamespace,i===null?e.removeAttribute(t):(r=r.type,i=r===3||r===4&&i===!0?"":""+i,s?e.setAttributeNS(s,t,i):e.setAttribute(t,i))))}var mi=Mv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,hn=Symbol.for("react.element"),gs=Symbol.for("react.portal"),Ss=Symbol.for("react.fragment"),Wc=Symbol.for("react.strict_mode"),Ql=Symbol.for("react.profiler"),Rf=Symbol.for("react.provider"),Df=Symbol.for("react.context"),Uc=Symbol.for("react.forward_ref"),Jl=Symbol.for("react.suspense"),Zl=Symbol.for("react.suspense_list"),Kc=Symbol.for("react.memo"),xi=Symbol.for("react.lazy"),Mf=Symbol.for("react.offscreen"),Gh=Symbol.iterator;function Qs(e){return e===null||typeof e!="object"?null:(e=Gh&&e[Gh]||e["@@iterator"],typeof e=="function"?e:null)}var ke=Object.assign,cl;function ur(e){if(cl===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);cl=t&&t[1]||""}return`
|
|
34
|
-
`+cl+e}var hl=!1;function ul(e,t){if(!e||hl)return"";hl=!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(a){var s=a}Reflect.construct(e,[],t)}else{try{t.call()}catch(a){s=a}e.call(t.prototype)}else{try{throw Error()}catch(a){s=a}e()}}catch(a){if(a&&s&&typeof a.stack=="string"){for(var r=a.stack.split(`
|
|
35
|
-
`),n=s.stack.split(`
|
|
36
|
-
`),o=r.length-1,l=n.length-1;1<=o&&0<=l&&r[o]!==n[l];)l--;for(;1<=o&&0<=l;o--,l--)if(r[o]!==n[l]){if(o!==1||l!==1)do if(o--,l--,0>l||r[o]!==n[l]){var c=`
|
|
37
|
-
`+r[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{hl=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?ur(e):""}function jv(e){switch(e.tag){case 5:return ur(e.type);case 16:return ur("Lazy");case 13:return ur("Suspense");case 19:return ur("SuspenseList");case 0:case 2:case 15:return e=ul(e.type,!1),e;case 11:return e=ul(e.type.render,!1),e;case 1:return e=ul(e.type,!0),e;default:return""}}function ea(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 Ss:return"Fragment";case gs:return"Portal";case Ql:return"Profiler";case Wc:return"StrictMode";case Jl:return"Suspense";case Zl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Df:return(e.displayName||"Context")+".Consumer";case Rf:return(e._context.displayName||"Context")+".Provider";case Uc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Kc:return t=e.displayName||null,t!==null?t:ea(e.type)||"Memo";case xi:t=e._payload,e=e._init;try{return ea(e(t))}catch{}}return null}function zv(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 ea(t);case 8:return t===Wc?"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 $i(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Lf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ov(e){var t=Lf(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var r=i.get,n=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){s=""+o,n.call(this,o)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(o){s=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function un(e){e._valueTracker||(e._valueTracker=Ov(e))}function Pf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),s="";return e&&(s=Lf(e)?e.checked?"true":"false":e.value),e=s,e!==i?(t.setValue(e),!0):!1}function to(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 ta(e,t){var i=t.checked;return ke({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function Qh(e,t){var i=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;i=$i(t.value!=null?t.value:i),e._wrapperState={initialChecked:s,initialValue:i,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Tf(e,t){t=t.checked,t!=null&&Hc(e,"checked",t,!1)}function ia(e,t){Tf(e,t);var i=$i(t.value),s=t.type;if(i!=null)s==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?sa(e,t.type,i):t.hasOwnProperty("defaultValue")&&sa(e,t.type,$i(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Jh(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="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 sa(e,t,i){(t!=="number"||to(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var dr=Array.isArray;function Ls(e,t,i,s){if(e=e.options,t){t={};for(var r=0;r<i.length;r++)t["$"+i[r]]=!0;for(i=0;i<e.length;i++)r=t.hasOwnProperty("$"+e[i].value),e[i].selected!==r&&(e[i].selected=r),r&&s&&(e[i].defaultSelected=!0)}else{for(i=""+$i(i),t=null,r=0;r<e.length;r++){if(e[r].value===i){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function ra(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(H(91));return ke({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Zh(e,t){var i=t.value;if(i==null){if(i=t.children,t=t.defaultValue,i!=null){if(t!=null)throw Error(H(92));if(dr(i)){if(1<i.length)throw Error(H(93));i=i[0]}t=i}t==null&&(t=""),i=t}e._wrapperState={initialValue:$i(i)}}function Bf(e,t){var i=$i(t.value),s=$i(t.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),t.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),s!=null&&(e.defaultValue=""+s)}function eu(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function jf(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 na(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?jf(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var dn,zf=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,i,s,r){MSApp.execUnsafeLocalFunction(function(){return e(t,i,s,r)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(dn=dn||document.createElement("div"),dn.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=dn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Pr(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var wr={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},Av=["Webkit","ms","Moz","O"];Object.keys(wr).forEach(function(e){Av.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),wr[t]=wr[e]})});function Of(e,t,i){return t==null||typeof t=="boolean"||t===""?"":i||typeof t!="number"||t===0||wr.hasOwnProperty(e)&&wr[e]?(""+t).trim():t+"px"}function Af(e,t){e=e.style;for(var i in t)if(t.hasOwnProperty(i)){var s=i.indexOf("--")===0,r=Of(i,t[i],s);i==="float"&&(i="cssFloat"),s?e.setProperty(i,r):e[i]=r}}var Iv=ke({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 oa(e,t){if(t){if(Iv[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(H(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(H(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(H(61))}if(t.style!=null&&typeof t.style!="object")throw Error(H(62))}}function la(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 aa=null;function Vc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ca=null,Ps=null,Ts=null;function tu(e){if(e=en(e)){if(typeof ca!="function")throw Error(H(280));var t=e.stateNode;t&&(t=Wo(t),ca(e.stateNode,e.type,t))}}function If(e){Ps?Ts?Ts.push(e):Ts=[e]:Ps=e}function $f(){if(Ps){var e=Ps,t=Ts;if(Ts=Ps=null,tu(e),t)for(e=0;e<t.length;e++)tu(t[e])}}function Ff(e,t){return e(t)}function Hf(){}var dl=!1;function Wf(e,t,i){if(dl)return e(t,i);dl=!0;try{return Ff(e,t,i)}finally{dl=!1,(Ps!==null||Ts!==null)&&(Hf(),$f())}}function Tr(e,t){var i=e.stateNode;if(i===null)return null;var s=Wo(i);if(s===null)return null;i=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(H(231,t,typeof i));return i}var ha=!1;if(di)try{var Js={};Object.defineProperty(Js,"passive",{get:function(){ha=!0}}),window.addEventListener("test",Js,Js),window.removeEventListener("test",Js,Js)}catch{ha=!1}function $v(e,t,i,s,r,n,o,l,c){var a=Array.prototype.slice.call(arguments,3);try{t.apply(i,a)}catch(d){this.onError(d)}}var Cr=!1,io=null,so=!1,ua=null,Fv={onError:function(e){Cr=!0,io=e}};function Hv(e,t,i,s,r,n,o,l,c){Cr=!1,io=null,$v.apply(Fv,arguments)}function Wv(e,t,i,s,r,n,o,l,c){if(Hv.apply(this,arguments),Cr){if(Cr){var a=io;Cr=!1,io=null}else throw Error(H(198));so||(so=!0,ua=a)}}function ds(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 Uf(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 iu(e){if(ds(e)!==e)throw Error(H(188))}function Uv(e){var t=e.alternate;if(!t){if(t=ds(e),t===null)throw Error(H(188));return t!==e?null:e}for(var i=e,s=t;;){var r=i.return;if(r===null)break;var n=r.alternate;if(n===null){if(s=r.return,s!==null){i=s;continue}break}if(r.child===n.child){for(n=r.child;n;){if(n===i)return iu(r),e;if(n===s)return iu(r),t;n=n.sibling}throw Error(H(188))}if(i.return!==s.return)i=r,s=n;else{for(var o=!1,l=r.child;l;){if(l===i){o=!0,i=r,s=n;break}if(l===s){o=!0,s=r,i=n;break}l=l.sibling}if(!o){for(l=n.child;l;){if(l===i){o=!0,i=n,s=r;break}if(l===s){o=!0,s=n,i=r;break}l=l.sibling}if(!o)throw Error(H(189))}}if(i.alternate!==s)throw Error(H(190))}if(i.tag!==3)throw Error(H(188));return i.stateNode.current===i?e:t}function Kf(e){return e=Uv(e),e!==null?Vf(e):null}function Vf(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Vf(e);if(t!==null)return t;e=e.sibling}return null}var qf=bt.unstable_scheduleCallback,su=bt.unstable_cancelCallback,Kv=bt.unstable_shouldYield,Vv=bt.unstable_requestPaint,Me=bt.unstable_now,qv=bt.unstable_getCurrentPriorityLevel,qc=bt.unstable_ImmediatePriority,Yf=bt.unstable_UserBlockingPriority,ro=bt.unstable_NormalPriority,Yv=bt.unstable_LowPriority,Xf=bt.unstable_IdlePriority,Io=null,Zt=null;function Xv(e){if(Zt&&typeof Zt.onCommitFiberRoot=="function")try{Zt.onCommitFiberRoot(Io,e,void 0,(e.current.flags&128)===128)}catch{}}var Ht=Math.clz32?Math.clz32:Jv,Gv=Math.log,Qv=Math.LN2;function Jv(e){return e>>>=0,e===0?32:31-(Gv(e)/Qv|0)|0}var fn=64,pn=4194304;function fr(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 no(e,t){var i=e.pendingLanes;if(i===0)return 0;var s=0,r=e.suspendedLanes,n=e.pingedLanes,o=i&268435455;if(o!==0){var l=o&~r;l!==0?s=fr(l):(n&=o,n!==0&&(s=fr(n)))}else o=i&~r,o!==0?s=fr(o):n!==0&&(s=fr(n));if(s===0)return 0;if(t!==0&&t!==s&&!(t&r)&&(r=s&-s,n=t&-t,r>=n||r===16&&(n&4194240)!==0))return t;if(s&4&&(s|=i&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)i=31-Ht(t),r=1<<i,s|=e[i],t&=~r;return s}function Zv(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 eg(e,t){for(var i=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,n=e.pendingLanes;0<n;){var o=31-Ht(n),l=1<<o,c=r[o];c===-1?(!(l&i)||l&s)&&(r[o]=Zv(l,t)):c<=t&&(e.expiredLanes|=l),n&=~l}}function da(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Gf(){var e=fn;return fn<<=1,!(fn&4194240)&&(fn=64),e}function fl(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function Jr(e,t,i){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ht(t),e[t]=i}function tg(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 s=e.eventTimes;for(e=e.expirationTimes;0<i;){var r=31-Ht(i),n=1<<r;t[r]=0,s[r]=-1,e[r]=-1,i&=~n}}function Yc(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var s=31-Ht(i),r=1<<s;r&t|e[s]&t&&(e[s]|=t),i&=~r}}var he=0;function Qf(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Jf,Xc,Zf,ep,tp,fa=!1,_n=[],Li=null,Pi=null,Ti=null,Br=new Map,jr=new Map,Ei=[],ig="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 ru(e,t){switch(e){case"focusin":case"focusout":Li=null;break;case"dragenter":case"dragleave":Pi=null;break;case"mouseover":case"mouseout":Ti=null;break;case"pointerover":case"pointerout":Br.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":jr.delete(t.pointerId)}}function Zs(e,t,i,s,r,n){return e===null||e.nativeEvent!==n?(e={blockedOn:t,domEventName:i,eventSystemFlags:s,nativeEvent:n,targetContainers:[r]},t!==null&&(t=en(t),t!==null&&Xc(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function sg(e,t,i,s,r){switch(t){case"focusin":return Li=Zs(Li,e,t,i,s,r),!0;case"dragenter":return Pi=Zs(Pi,e,t,i,s,r),!0;case"mouseover":return Ti=Zs(Ti,e,t,i,s,r),!0;case"pointerover":var n=r.pointerId;return Br.set(n,Zs(Br.get(n)||null,e,t,i,s,r)),!0;case"gotpointercapture":return n=r.pointerId,jr.set(n,Zs(jr.get(n)||null,e,t,i,s,r)),!0}return!1}function ip(e){var t=Qi(e.target);if(t!==null){var i=ds(t);if(i!==null){if(t=i.tag,t===13){if(t=Uf(i),t!==null){e.blockedOn=t,tp(e.priority,function(){Zf(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function On(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=pa(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var s=new i.constructor(i.type,i);aa=s,i.target.dispatchEvent(s),aa=null}else return t=en(i),t!==null&&Xc(t),e.blockedOn=i,!1;t.shift()}return!0}function nu(e,t,i){On(e)&&i.delete(t)}function rg(){fa=!1,Li!==null&&On(Li)&&(Li=null),Pi!==null&&On(Pi)&&(Pi=null),Ti!==null&&On(Ti)&&(Ti=null),Br.forEach(nu),jr.forEach(nu)}function er(e,t){e.blockedOn===t&&(e.blockedOn=null,fa||(fa=!0,bt.unstable_scheduleCallback(bt.unstable_NormalPriority,rg)))}function zr(e){function t(r){return er(r,e)}if(0<_n.length){er(_n[0],e);for(var i=1;i<_n.length;i++){var s=_n[i];s.blockedOn===e&&(s.blockedOn=null)}}for(Li!==null&&er(Li,e),Pi!==null&&er(Pi,e),Ti!==null&&er(Ti,e),Br.forEach(t),jr.forEach(t),i=0;i<Ei.length;i++)s=Ei[i],s.blockedOn===e&&(s.blockedOn=null);for(;0<Ei.length&&(i=Ei[0],i.blockedOn===null);)ip(i),i.blockedOn===null&&Ei.shift()}var Bs=mi.ReactCurrentBatchConfig,oo=!0;function ng(e,t,i,s){var r=he,n=Bs.transition;Bs.transition=null;try{he=1,Gc(e,t,i,s)}finally{he=r,Bs.transition=n}}function og(e,t,i,s){var r=he,n=Bs.transition;Bs.transition=null;try{he=4,Gc(e,t,i,s)}finally{he=r,Bs.transition=n}}function Gc(e,t,i,s){if(oo){var r=pa(e,t,i,s);if(r===null)xl(e,t,s,lo,i),ru(e,s);else if(sg(r,e,t,i,s))s.stopPropagation();else if(ru(e,s),t&4&&-1<ig.indexOf(e)){for(;r!==null;){var n=en(r);if(n!==null&&Jf(n),n=pa(e,t,i,s),n===null&&xl(e,t,s,lo,i),n===r)break;r=n}r!==null&&s.stopPropagation()}else xl(e,t,s,null,i)}}var lo=null;function pa(e,t,i,s){if(lo=null,e=Vc(s),e=Qi(e),e!==null)if(t=ds(e),t===null)e=null;else if(i=t.tag,i===13){if(e=Uf(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 lo=e,null}function sp(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(qv()){case qc:return 1;case Yf:return 4;case ro:case Yv:return 16;case Xf:return 536870912;default:return 16}default:return 16}}var Ri=null,Qc=null,An=null;function rp(){if(An)return An;var e,t=Qc,i=t.length,s,r="value"in Ri?Ri.value:Ri.textContent,n=r.length;for(e=0;e<i&&t[e]===r[e];e++);var o=i-e;for(s=1;s<=o&&t[i-s]===r[n-s];s++);return An=r.slice(e,1<s?1-s:void 0)}function In(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 mn(){return!0}function ou(){return!1}function Et(e){function t(i,s,r,n,o){this._reactName=i,this._targetInst=r,this.type=s,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)?mn:ou,this.isPropagationStopped=ou,this}return ke(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=mn)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=mn)},persist:function(){},isPersistent:mn}),t}var Vs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jc=Et(Vs),Zr=ke({},Vs,{view:0,detail:0}),lg=Et(Zr),pl,_l,tr,$o=ke({},Zr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zc,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!==tr&&(tr&&e.type==="mousemove"?(pl=e.screenX-tr.screenX,_l=e.screenY-tr.screenY):_l=pl=0,tr=e),pl)},movementY:function(e){return"movementY"in e?e.movementY:_l}}),lu=Et($o),ag=ke({},$o,{dataTransfer:0}),cg=Et(ag),hg=ke({},Zr,{relatedTarget:0}),ml=Et(hg),ug=ke({},Vs,{animationName:0,elapsedTime:0,pseudoElement:0}),dg=Et(ug),fg=ke({},Vs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),pg=Et(fg),_g=ke({},Vs,{data:0}),au=Et(_g),mg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vg={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"},gg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=gg[e])?!!t[e]:!1}function Zc(){return Sg}var yg=ke({},Zr,{key:function(e){if(e.key){var t=mg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=In(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?vg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zc,charCode:function(e){return e.type==="keypress"?In(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?In(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),wg=Et(yg),Cg=ke({},$o,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),cu=Et(Cg),xg=ke({},Zr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zc}),bg=Et(xg),kg=ke({},Vs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Eg=Et(kg),Ng=ke({},$o,{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}),Rg=Et(Ng),Dg=[9,13,27,32],eh=di&&"CompositionEvent"in window,xr=null;di&&"documentMode"in document&&(xr=document.documentMode);var Mg=di&&"TextEvent"in window&&!xr,np=di&&(!eh||xr&&8<xr&&11>=xr),hu=" ",uu=!1;function op(e,t){switch(e){case"keyup":return Dg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ys=!1;function Lg(e,t){switch(e){case"compositionend":return lp(t);case"keypress":return t.which!==32?null:(uu=!0,hu);case"textInput":return e=t.data,e===hu&&uu?null:e;default:return null}}function Pg(e,t){if(ys)return e==="compositionend"||!eh&&op(e,t)?(e=rp(),An=Qc=Ri=null,ys=!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 np&&t.locale!=="ko"?null:t.data;default:return null}}var Tg={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 du(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Tg[e.type]:t==="textarea"}function ap(e,t,i,s){If(s),t=ao(t,"onChange"),0<t.length&&(i=new Jc("onChange","change",null,i,s),e.push({event:i,listeners:t}))}var br=null,Or=null;function Bg(e){Sp(e,0)}function Fo(e){var t=xs(e);if(Pf(t))return e}function jg(e,t){if(e==="change")return t}var cp=!1;if(di){var vl;if(di){var gl="oninput"in document;if(!gl){var fu=document.createElement("div");fu.setAttribute("oninput","return;"),gl=typeof fu.oninput=="function"}vl=gl}else vl=!1;cp=vl&&(!document.documentMode||9<document.documentMode)}function pu(){br&&(br.detachEvent("onpropertychange",hp),Or=br=null)}function hp(e){if(e.propertyName==="value"&&Fo(Or)){var t=[];ap(t,Or,e,Vc(e)),Wf(Bg,t)}}function zg(e,t,i){e==="focusin"?(pu(),br=t,Or=i,br.attachEvent("onpropertychange",hp)):e==="focusout"&&pu()}function Og(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Fo(Or)}function Ag(e,t){if(e==="click")return Fo(t)}function Ig(e,t){if(e==="input"||e==="change")return Fo(t)}function $g(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ut=typeof Object.is=="function"?Object.is:$g;function Ar(e,t){if(Ut(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(s=0;s<i.length;s++){var r=i[s];if(!Gl.call(t,r)||!Ut(e[r],t[r]))return!1}return!0}function _u(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function mu(e,t){var i=_u(e);e=0;for(var s;i;){if(i.nodeType===3){if(s=e+i.textContent.length,e<=t&&s>=t)return{node:i,offset:t-e};e=s}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=_u(i)}}function up(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?up(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function dp(){for(var e=window,t=to();t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=to(e.document)}return t}function th(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 Fg(e){var t=dp(),i=e.focusedElem,s=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&up(i.ownerDocument.documentElement,i)){if(s!==null&&th(i)){if(t=s.start,e=s.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 r=i.textContent.length,n=Math.min(s.start,r);s=s.end===void 0?n:Math.min(s.end,r),!e.extend&&n>s&&(r=s,s=n,n=r),r=mu(i,n);var o=mu(i,s);r&&o&&(e.rangeCount!==1||e.anchorNode!==r.node||e.anchorOffset!==r.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(r.node,r.offset),e.removeAllRanges(),n>s?(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 Hg=di&&"documentMode"in document&&11>=document.documentMode,ws=null,_a=null,kr=null,ma=!1;function vu(e,t,i){var s=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;ma||ws==null||ws!==to(s)||(s=ws,"selectionStart"in s&&th(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),kr&&Ar(kr,s)||(kr=s,s=ao(_a,"onSelect"),0<s.length&&(t=new Jc("onSelect","select",null,t,i),e.push({event:t,listeners:s}),t.target=ws)))}function vn(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Cs={animationend:vn("Animation","AnimationEnd"),animationiteration:vn("Animation","AnimationIteration"),animationstart:vn("Animation","AnimationStart"),transitionend:vn("Transition","TransitionEnd")},Sl={},fp={};di&&(fp=document.createElement("div").style,"AnimationEvent"in window||(delete Cs.animationend.animation,delete Cs.animationiteration.animation,delete Cs.animationstart.animation),"TransitionEvent"in window||delete Cs.transitionend.transition);function Ho(e){if(Sl[e])return Sl[e];if(!Cs[e])return e;var t=Cs[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in fp)return Sl[e]=t[i];return e}var pp=Ho("animationend"),_p=Ho("animationiteration"),mp=Ho("animationstart"),vp=Ho("transitionend"),gp=new Map,gu="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 Hi(e,t){gp.set(e,t),us(t,[e])}for(var yl=0;yl<gu.length;yl++){var wl=gu[yl],Wg=wl.toLowerCase(),Ug=wl[0].toUpperCase()+wl.slice(1);Hi(Wg,"on"+Ug)}Hi(pp,"onAnimationEnd");Hi(_p,"onAnimationIteration");Hi(mp,"onAnimationStart");Hi("dblclick","onDoubleClick");Hi("focusin","onFocus");Hi("focusout","onBlur");Hi(vp,"onTransitionEnd");Os("onMouseEnter",["mouseout","mouseover"]);Os("onMouseLeave",["mouseout","mouseover"]);Os("onPointerEnter",["pointerout","pointerover"]);Os("onPointerLeave",["pointerout","pointerover"]);us("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));us("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));us("onBeforeInput",["compositionend","keypress","textInput","paste"]);us("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));us("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));us("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pr="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(" "),Kg=new Set("cancel close invalid load scroll toggle".split(" ").concat(pr));function Su(e,t,i){var s=e.type||"unknown-event";e.currentTarget=i,Wv(s,t,void 0,e),e.currentTarget=null}function Sp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var s=e[i],r=s.event;s=s.listeners;e:{var n=void 0;if(t)for(var o=s.length-1;0<=o;o--){var l=s[o],c=l.instance,a=l.currentTarget;if(l=l.listener,c!==n&&r.isPropagationStopped())break e;Su(r,l,a),n=c}else for(o=0;o<s.length;o++){if(l=s[o],c=l.instance,a=l.currentTarget,l=l.listener,c!==n&&r.isPropagationStopped())break e;Su(r,l,a),n=c}}}if(so)throw e=ua,so=!1,ua=null,e}function me(e,t){var i=t[wa];i===void 0&&(i=t[wa]=new Set);var s=e+"__bubble";i.has(s)||(yp(t,e,2,!1),i.add(s))}function Cl(e,t,i){var s=0;t&&(s|=4),yp(i,e,s,t)}var gn="_reactListening"+Math.random().toString(36).slice(2);function Ir(e){if(!e[gn]){e[gn]=!0,Nf.forEach(function(i){i!=="selectionchange"&&(Kg.has(i)||Cl(i,!1,e),Cl(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[gn]||(t[gn]=!0,Cl("selectionchange",!1,t))}}function yp(e,t,i,s){switch(sp(t)){case 1:var r=ng;break;case 4:r=og;break;default:r=Gc}i=r.bind(null,t,i,e),r=void 0,!ha||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,i,{capture:!0,passive:r}):e.addEventListener(t,i,!0):r!==void 0?e.addEventListener(t,i,{passive:r}):e.addEventListener(t,i,!1)}function xl(e,t,i,s,r){var n=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var l=s.stateNode.containerInfo;if(l===r||l.nodeType===8&&l.parentNode===r)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===r||c.nodeType===8&&c.parentNode===r))return;o=o.return}for(;l!==null;){if(o=Qi(l),o===null)return;if(c=o.tag,c===5||c===6){s=n=o;continue e}l=l.parentNode}}s=s.return}Wf(function(){var a=n,d=Vc(i),u=[];e:{var f=gp.get(e);if(f!==void 0){var m=Jc,_=e;switch(e){case"keypress":if(In(i)===0)break e;case"keydown":case"keyup":m=wg;break;case"focusin":_="focus",m=ml;break;case"focusout":_="blur",m=ml;break;case"beforeblur":case"afterblur":m=ml;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":m=lu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=cg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=bg;break;case pp:case _p:case mp:m=dg;break;case vp:m=Eg;break;case"scroll":m=lg;break;case"wheel":m=Rg;break;case"copy":case"cut":case"paste":m=pg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=cu}var S=(t&4)!==0,k=!S&&e==="scroll",v=S?f!==null?f+"Capture":null:f;S=[];for(var p=a,g;p!==null;){g=p;var w=g.stateNode;if(g.tag===5&&w!==null&&(g=w,v!==null&&(w=Tr(p,v),w!=null&&S.push($r(p,w,g)))),k)break;p=p.return}0<S.length&&(f=new m(f,_,null,i,d),u.push({event:f,listeners:S}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&i!==aa&&(_=i.relatedTarget||i.fromElement)&&(Qi(_)||_[fi]))break e;if((m||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,m?(_=i.relatedTarget||i.toElement,m=a,_=_?Qi(_):null,_!==null&&(k=ds(_),_!==k||_.tag!==5&&_.tag!==6)&&(_=null)):(m=null,_=a),m!==_)){if(S=lu,w="onMouseLeave",v="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(S=cu,w="onPointerLeave",v="onPointerEnter",p="pointer"),k=m==null?f:xs(m),g=_==null?f:xs(_),f=new S(w,p+"leave",m,i,d),f.target=k,f.relatedTarget=g,w=null,Qi(d)===a&&(S=new S(v,p+"enter",_,i,d),S.target=g,S.relatedTarget=k,w=S),k=w,m&&_)t:{for(S=m,v=_,p=0,g=S;g;g=_s(g))p++;for(g=0,w=v;w;w=_s(w))g++;for(;0<p-g;)S=_s(S),p--;for(;0<g-p;)v=_s(v),g--;for(;p--;){if(S===v||v!==null&&S===v.alternate)break t;S=_s(S),v=_s(v)}S=null}else S=null;m!==null&&yu(u,f,m,S,!1),_!==null&&k!==null&&yu(u,k,_,S,!0)}}e:{if(f=a?xs(a):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var M=jg;else if(du(f))if(cp)M=Ig;else{M=Og;var N=zg}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(M=Ag);if(M&&(M=M(e,a))){ap(u,M,i,d);break e}N&&N(e,f,a),e==="focusout"&&(N=f._wrapperState)&&N.controlled&&f.type==="number"&&sa(f,"number",f.value)}switch(N=a?xs(a):window,e){case"focusin":(du(N)||N.contentEditable==="true")&&(ws=N,_a=a,kr=null);break;case"focusout":kr=_a=ws=null;break;case"mousedown":ma=!0;break;case"contextmenu":case"mouseup":case"dragend":ma=!1,vu(u,i,d);break;case"selectionchange":if(Hg)break;case"keydown":case"keyup":vu(u,i,d)}var x;if(eh)e:{switch(e){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else ys?op(e,i)&&(C="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(C="onCompositionStart");C&&(np&&i.locale!=="ko"&&(ys||C!=="onCompositionStart"?C==="onCompositionEnd"&&ys&&(x=rp()):(Ri=d,Qc="value"in Ri?Ri.value:Ri.textContent,ys=!0)),N=ao(a,C),0<N.length&&(C=new au(C,e,null,i,d),u.push({event:C,listeners:N}),x?C.data=x:(x=lp(i),x!==null&&(C.data=x)))),(x=Mg?Lg(e,i):Pg(e,i))&&(a=ao(a,"onBeforeInput"),0<a.length&&(d=new au("onBeforeInput","beforeinput",null,i,d),u.push({event:d,listeners:a}),d.data=x))}Sp(u,t)})}function $r(e,t,i){return{instance:e,listener:t,currentTarget:i}}function ao(e,t){for(var i=t+"Capture",s=[];e!==null;){var r=e,n=r.stateNode;r.tag===5&&n!==null&&(r=n,n=Tr(e,i),n!=null&&s.unshift($r(e,n,r)),n=Tr(e,t),n!=null&&s.push($r(e,n,r))),e=e.return}return s}function _s(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function yu(e,t,i,s,r){for(var n=t._reactName,o=[];i!==null&&i!==s;){var l=i,c=l.alternate,a=l.stateNode;if(c!==null&&c===s)break;l.tag===5&&a!==null&&(l=a,r?(c=Tr(i,n),c!=null&&o.unshift($r(i,c,l))):r||(c=Tr(i,n),c!=null&&o.push($r(i,c,l)))),i=i.return}o.length!==0&&e.push({event:t,listeners:o})}var Vg=/\r\n?/g,qg=/\u0000|\uFFFD/g;function wu(e){return(typeof e=="string"?e:""+e).replace(Vg,`
|
|
38
|
-
`).replace(qg,"")}function Sn(e,t,i){if(t=wu(t),wu(e)!==t&&i)throw Error(H(425))}function co(){}var va=null,ga=null;function Sa(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 ya=typeof setTimeout=="function"?setTimeout:void 0,Yg=typeof clearTimeout=="function"?clearTimeout:void 0,Cu=typeof Promise=="function"?Promise:void 0,Xg=typeof queueMicrotask=="function"?queueMicrotask:typeof Cu<"u"?function(e){return Cu.resolve(null).then(e).catch(Gg)}:ya;function Gg(e){setTimeout(function(){throw e})}function bl(e,t){var i=t,s=0;do{var r=i.nextSibling;if(e.removeChild(i),r&&r.nodeType===8)if(i=r.data,i==="/$"){if(s===0){e.removeChild(r),zr(t);return}s--}else i!=="$"&&i!=="$?"&&i!=="$!"||s++;i=r}while(i);zr(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 xu(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 qs=Math.random().toString(36).slice(2),Qt="__reactFiber$"+qs,Fr="__reactProps$"+qs,fi="__reactContainer$"+qs,wa="__reactEvents$"+qs,Qg="__reactListeners$"+qs,Jg="__reactHandles$"+qs;function Qi(e){var t=e[Qt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[fi]||i[Qt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=xu(e);e!==null;){if(i=e[Qt])return i;e=xu(e)}return t}e=i,i=e.parentNode}return null}function en(e){return e=e[Qt]||e[fi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function xs(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(H(33))}function Wo(e){return e[Fr]||null}var Ca=[],bs=-1;function Wi(e){return{current:e}}function ge(e){0>bs||(e.current=Ca[bs],Ca[bs]=null,bs--)}function _e(e,t){bs++,Ca[bs]=e.current,e.current=t}var Fi={},it=Wi(Fi),pt=Wi(!1),rs=Fi;function As(e,t){var i=e.type.contextTypes;if(!i)return Fi;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var r={},n;for(n in i)r[n]=t[n];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function _t(e){return e=e.childContextTypes,e!=null}function ho(){ge(pt),ge(it)}function bu(e,t,i){if(it.current!==Fi)throw Error(H(168));_e(it,t),_e(pt,i)}function wp(e,t,i){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return i;s=s.getChildContext();for(var r in s)if(!(r in t))throw Error(H(108,zv(e)||"Unknown",r));return ke({},i,s)}function uo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Fi,rs=it.current,_e(it,e),_e(pt,pt.current),!0}function ku(e,t,i){var s=e.stateNode;if(!s)throw Error(H(169));i?(e=wp(e,t,rs),s.__reactInternalMemoizedMergedChildContext=e,ge(pt),ge(it),_e(it,e)):ge(pt),_e(pt,i)}var oi=null,Uo=!1,kl=!1;function Cp(e){oi===null?oi=[e]:oi.push(e)}function Zg(e){Uo=!0,Cp(e)}function Ui(){if(!kl&&oi!==null){kl=!0;var e=0,t=he;try{var i=oi;for(he=1;e<i.length;e++){var s=i[e];do s=s(!0);while(s!==null)}oi=null,Uo=!1}catch(r){throw oi!==null&&(oi=oi.slice(e+1)),qf(qc,Ui),r}finally{he=t,kl=!1}}return null}var ks=[],Es=0,fo=null,po=0,Mt=[],Lt=0,ns=null,li=1,ai="";function Vi(e,t){ks[Es++]=po,ks[Es++]=fo,fo=e,po=t}function xp(e,t,i){Mt[Lt++]=li,Mt[Lt++]=ai,Mt[Lt++]=ns,ns=e;var s=li;e=ai;var r=32-Ht(s)-1;s&=~(1<<r),i+=1;var n=32-Ht(t)+r;if(30<n){var o=r-r%5;n=(s&(1<<o)-1).toString(32),s>>=o,r-=o,li=1<<32-Ht(t)+r|i<<r|s,ai=n+e}else li=1<<n|i<<r|s,ai=e}function ih(e){e.return!==null&&(Vi(e,1),xp(e,1,0))}function sh(e){for(;e===fo;)fo=ks[--Es],ks[Es]=null,po=ks[--Es],ks[Es]=null;for(;e===ns;)ns=Mt[--Lt],Mt[Lt]=null,ai=Mt[--Lt],Mt[Lt]=null,li=Mt[--Lt],Mt[Lt]=null}var Ct=null,wt=null,Se=!1,Ft=null;function bp(e,t){var i=Pt(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,Ct=e,wt=Bi(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ct=e,wt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(i=ns!==null?{id:li,overflow:ai}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},i=Pt(18,null,null,0),i.stateNode=t,i.return=e,e.child=i,Ct=e,wt=null,!0):!1;default:return!1}}function xa(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ba(e){if(Se){var t=wt;if(t){var i=t;if(!Eu(e,t)){if(xa(e))throw Error(H(418));t=Bi(i.nextSibling);var s=Ct;t&&Eu(e,t)?bp(s,i):(e.flags=e.flags&-4097|2,Se=!1,Ct=e)}}else{if(xa(e))throw Error(H(418));e.flags=e.flags&-4097|2,Se=!1,Ct=e}}}function Nu(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ct=e}function yn(e){if(e!==Ct)return!1;if(!Se)return Nu(e),Se=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Sa(e.type,e.memoizedProps)),t&&(t=wt)){if(xa(e))throw kp(),Error(H(418));for(;t;)bp(e,t),t=Bi(t.nextSibling)}if(Nu(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(H(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(t===0){wt=Bi(e.nextSibling);break e}t--}else i!=="$"&&i!=="$!"&&i!=="$?"||t++}e=e.nextSibling}wt=null}}else wt=Ct?Bi(e.stateNode.nextSibling):null;return!0}function kp(){for(var e=wt;e;)e=Bi(e.nextSibling)}function Is(){wt=Ct=null,Se=!1}function rh(e){Ft===null?Ft=[e]:Ft.push(e)}var eS=mi.ReactCurrentBatchConfig;function ir(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(H(309));var s=i.stateNode}if(!s)throw Error(H(147,e));var r=s,n=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===n?t.ref:(t=function(o){var l=r.refs;o===null?delete l[n]:l[n]=o},t._stringRef=n,t)}if(typeof e!="string")throw Error(H(284));if(!i._owner)throw Error(H(290,e))}return e}function wn(e,t){throw e=Object.prototype.toString.call(t),Error(H(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ru(e){var t=e._init;return t(e._payload)}function Ep(e){function t(v,p){if(e){var g=v.deletions;g===null?(v.deletions=[p],v.flags|=16):g.push(p)}}function i(v,p){if(!e)return null;for(;p!==null;)t(v,p),p=p.sibling;return null}function s(v,p){for(v=new Map;p!==null;)p.key!==null?v.set(p.key,p):v.set(p.index,p),p=p.sibling;return v}function r(v,p){return v=Ai(v,p),v.index=0,v.sibling=null,v}function n(v,p,g){return v.index=g,e?(g=v.alternate,g!==null?(g=g.index,g<p?(v.flags|=2,p):g):(v.flags|=2,p)):(v.flags|=1048576,p)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,p,g,w){return p===null||p.tag!==6?(p=Pl(g,v.mode,w),p.return=v,p):(p=r(p,g),p.return=v,p)}function c(v,p,g,w){var M=g.type;return M===Ss?d(v,p,g.props.children,w,g.key):p!==null&&(p.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===xi&&Ru(M)===p.type)?(w=r(p,g.props),w.ref=ir(v,p,g),w.return=v,w):(w=Vn(g.type,g.key,g.props,null,v.mode,w),w.ref=ir(v,p,g),w.return=v,w)}function a(v,p,g,w){return p===null||p.tag!==4||p.stateNode.containerInfo!==g.containerInfo||p.stateNode.implementation!==g.implementation?(p=Tl(g,v.mode,w),p.return=v,p):(p=r(p,g.children||[]),p.return=v,p)}function d(v,p,g,w,M){return p===null||p.tag!==7?(p=is(g,v.mode,w,M),p.return=v,p):(p=r(p,g),p.return=v,p)}function u(v,p,g){if(typeof p=="string"&&p!==""||typeof p=="number")return p=Pl(""+p,v.mode,g),p.return=v,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case hn:return g=Vn(p.type,p.key,p.props,null,v.mode,g),g.ref=ir(v,null,p),g.return=v,g;case gs:return p=Tl(p,v.mode,g),p.return=v,p;case xi:var w=p._init;return u(v,w(p._payload),g)}if(dr(p)||Qs(p))return p=is(p,v.mode,g,null),p.return=v,p;wn(v,p)}return null}function f(v,p,g,w){var M=p!==null?p.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return M!==null?null:l(v,p,""+g,w);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case hn:return g.key===M?c(v,p,g,w):null;case gs:return g.key===M?a(v,p,g,w):null;case xi:return M=g._init,f(v,p,M(g._payload),w)}if(dr(g)||Qs(g))return M!==null?null:d(v,p,g,w,null);wn(v,g)}return null}function m(v,p,g,w,M){if(typeof w=="string"&&w!==""||typeof w=="number")return v=v.get(g)||null,l(p,v,""+w,M);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case hn:return v=v.get(w.key===null?g:w.key)||null,c(p,v,w,M);case gs:return v=v.get(w.key===null?g:w.key)||null,a(p,v,w,M);case xi:var N=w._init;return m(v,p,g,N(w._payload),M)}if(dr(w)||Qs(w))return v=v.get(g)||null,d(p,v,w,M,null);wn(p,w)}return null}function _(v,p,g,w){for(var M=null,N=null,x=p,C=p=0,D=null;x!==null&&C<g.length;C++){x.index>C?(D=x,x=null):D=x.sibling;var L=f(v,x,g[C],w);if(L===null){x===null&&(x=D);break}e&&x&&L.alternate===null&&t(v,x),p=n(L,p,C),N===null?M=L:N.sibling=L,N=L,x=D}if(C===g.length)return i(v,x),Se&&Vi(v,C),M;if(x===null){for(;C<g.length;C++)x=u(v,g[C],w),x!==null&&(p=n(x,p,C),N===null?M=x:N.sibling=x,N=x);return Se&&Vi(v,C),M}for(x=s(v,x);C<g.length;C++)D=m(x,v,C,g[C],w),D!==null&&(e&&D.alternate!==null&&x.delete(D.key===null?C:D.key),p=n(D,p,C),N===null?M=D:N.sibling=D,N=D);return e&&x.forEach(function(A){return t(v,A)}),Se&&Vi(v,C),M}function S(v,p,g,w){var M=Qs(g);if(typeof M!="function")throw Error(H(150));if(g=M.call(g),g==null)throw Error(H(151));for(var N=M=null,x=p,C=p=0,D=null,L=g.next();x!==null&&!L.done;C++,L=g.next()){x.index>C?(D=x,x=null):D=x.sibling;var A=f(v,x,L.value,w);if(A===null){x===null&&(x=D);break}e&&x&&A.alternate===null&&t(v,x),p=n(A,p,C),N===null?M=A:N.sibling=A,N=A,x=D}if(L.done)return i(v,x),Se&&Vi(v,C),M;if(x===null){for(;!L.done;C++,L=g.next())L=u(v,L.value,w),L!==null&&(p=n(L,p,C),N===null?M=L:N.sibling=L,N=L);return Se&&Vi(v,C),M}for(x=s(v,x);!L.done;C++,L=g.next())L=m(x,v,C,L.value,w),L!==null&&(e&&L.alternate!==null&&x.delete(L.key===null?C:L.key),p=n(L,p,C),N===null?M=L:N.sibling=L,N=L);return e&&x.forEach(function(T){return t(v,T)}),Se&&Vi(v,C),M}function k(v,p,g,w){if(typeof g=="object"&&g!==null&&g.type===Ss&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case hn:e:{for(var M=g.key,N=p;N!==null;){if(N.key===M){if(M=g.type,M===Ss){if(N.tag===7){i(v,N.sibling),p=r(N,g.props.children),p.return=v,v=p;break e}}else if(N.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===xi&&Ru(M)===N.type){i(v,N.sibling),p=r(N,g.props),p.ref=ir(v,N,g),p.return=v,v=p;break e}i(v,N);break}else t(v,N);N=N.sibling}g.type===Ss?(p=is(g.props.children,v.mode,w,g.key),p.return=v,v=p):(w=Vn(g.type,g.key,g.props,null,v.mode,w),w.ref=ir(v,p,g),w.return=v,v=w)}return o(v);case gs:e:{for(N=g.key;p!==null;){if(p.key===N)if(p.tag===4&&p.stateNode.containerInfo===g.containerInfo&&p.stateNode.implementation===g.implementation){i(v,p.sibling),p=r(p,g.children||[]),p.return=v,v=p;break e}else{i(v,p);break}else t(v,p);p=p.sibling}p=Tl(g,v.mode,w),p.return=v,v=p}return o(v);case xi:return N=g._init,k(v,p,N(g._payload),w)}if(dr(g))return _(v,p,g,w);if(Qs(g))return S(v,p,g,w);wn(v,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,p!==null&&p.tag===6?(i(v,p.sibling),p=r(p,g),p.return=v,v=p):(i(v,p),p=Pl(g,v.mode,w),p.return=v,v=p),o(v)):i(v,p)}return k}var $s=Ep(!0),Np=Ep(!1),_o=Wi(null),mo=null,Ns=null,nh=null;function oh(){nh=Ns=mo=null}function lh(e){var t=_o.current;ge(_o),e._currentValue=t}function ka(e,t,i){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===i)break;e=e.return}}function js(e,t){mo=e,nh=Ns=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ft=!0),e.firstContext=null)}function jt(e){var t=e._currentValue;if(nh!==e)if(e={context:e,memoizedValue:t,next:null},Ns===null){if(mo===null)throw Error(H(308));Ns=e,mo.dependencies={lanes:0,firstContext:e}}else Ns=Ns.next=e;return t}var Ji=null;function ah(e){Ji===null?Ji=[e]:Ji.push(e)}function Rp(e,t,i,s){var r=t.interleaved;return r===null?(i.next=i,ah(t)):(i.next=r.next,r.next=i),t.interleaved=i,pi(e,s)}function pi(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 bi=!1;function ch(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Dp(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 hi(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ji(e,t,i){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,le&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,pi(e,i)}return r=s.interleaved,r===null?(t.next=t,ah(s)):(t.next=r.next,r.next=t),s.interleaved=t,pi(e,i)}function $n(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Yc(e,i)}}function Du(e,t){var i=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,i===s)){var r=null,n=null;if(i=i.firstBaseUpdate,i!==null){do{var o={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};n===null?r=n=o:n=n.next=o,i=i.next}while(i!==null);n===null?r=n=t:n=n.next=t}else r=n=t;i={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:n,shared:s.shared,effects:s.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function vo(e,t,i,s){var r=e.updateQueue;bi=!1;var n=r.firstBaseUpdate,o=r.lastBaseUpdate,l=r.shared.pending;if(l!==null){r.shared.pending=null;var c=l,a=c.next;c.next=null,o===null?n=a:o.next=a,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=a:l.next=a,d.lastBaseUpdate=c))}if(n!==null){var u=r.baseState;o=0,d=a=c=null,l=n;do{var f=l.lane,m=l.eventTime;if((s&f)===f){d!==null&&(d=d.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var _=e,S=l;switch(f=t,m=i,S.tag){case 1:if(_=S.payload,typeof _=="function"){u=_.call(m,u,f);break e}u=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=S.payload,f=typeof _=="function"?_.call(m,u,f):_,f==null)break e;u=ke({},u,f);break e;case 2:bi=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=r.effects,f===null?r.effects=[l]:f.push(l))}else m={eventTime:m,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(a=d=m,c=u):d=d.next=m,o|=f;if(l=l.next,l===null){if(l=r.shared.pending,l===null)break;f=l,l=f.next,f.next=null,r.lastBaseUpdate=f,r.shared.pending=null}}while(!0);if(d===null&&(c=u),r.baseState=c,r.firstBaseUpdate=a,r.lastBaseUpdate=d,t=r.shared.interleaved,t!==null){r=t;do o|=r.lane,r=r.next;while(r!==t)}else n===null&&(r.shared.lanes=0);ls|=o,e.lanes=o,e.memoizedState=u}}function Mu(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],r=s.callback;if(r!==null){if(s.callback=null,s=i,typeof r!="function")throw Error(H(191,r));r.call(s)}}}var tn={},ei=Wi(tn),Hr=Wi(tn),Wr=Wi(tn);function Zi(e){if(e===tn)throw Error(H(174));return e}function hh(e,t){switch(_e(Wr,t),_e(Hr,e),_e(ei,tn),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:na(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=na(t,e)}ge(ei),_e(ei,t)}function Fs(){ge(ei),ge(Hr),ge(Wr)}function Mp(e){Zi(Wr.current);var t=Zi(ei.current),i=na(t,e.type);t!==i&&(_e(Hr,e),_e(ei,i))}function uh(e){Hr.current===e&&(ge(ei),ge(Hr))}var xe=Wi(0);function go(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 El=[];function dh(){for(var e=0;e<El.length;e++)El[e]._workInProgressVersionPrimary=null;El.length=0}var Fn=mi.ReactCurrentDispatcher,Nl=mi.ReactCurrentBatchConfig,os=0,be=null,ze=null,$e=null,So=!1,Er=!1,Ur=0,tS=0;function Je(){throw Error(H(321))}function fh(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Ut(e[i],t[i]))return!1;return!0}function ph(e,t,i,s,r,n){if(os=n,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Fn.current=e===null||e.memoizedState===null?nS:oS,e=i(s,r),Er){n=0;do{if(Er=!1,Ur=0,25<=n)throw Error(H(301));n+=1,$e=ze=null,t.updateQueue=null,Fn.current=lS,e=i(s,r)}while(Er)}if(Fn.current=yo,t=ze!==null&&ze.next!==null,os=0,$e=ze=be=null,So=!1,t)throw Error(H(300));return e}function _h(){var e=Ur!==0;return Ur=0,e}function Gt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $e===null?be.memoizedState=$e=e:$e=$e.next=e,$e}function zt(){if(ze===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=ze.next;var t=$e===null?be.memoizedState:$e.next;if(t!==null)$e=t,ze=e;else{if(e===null)throw Error(H(310));ze=e,e={memoizedState:ze.memoizedState,baseState:ze.baseState,baseQueue:ze.baseQueue,queue:ze.queue,next:null},$e===null?be.memoizedState=$e=e:$e=$e.next=e}return $e}function Kr(e,t){return typeof t=="function"?t(e):t}function Rl(e){var t=zt(),i=t.queue;if(i===null)throw Error(H(311));i.lastRenderedReducer=e;var s=ze,r=s.baseQueue,n=i.pending;if(n!==null){if(r!==null){var o=r.next;r.next=n.next,n.next=o}s.baseQueue=r=n,i.pending=null}if(r!==null){n=r.next,s=s.baseState;var l=o=null,c=null,a=n;do{var d=a.lane;if((os&d)===d)c!==null&&(c=c.next={lane:0,action:a.action,hasEagerState:a.hasEagerState,eagerState:a.eagerState,next:null}),s=a.hasEagerState?a.eagerState:e(s,a.action);else{var u={lane:d,action:a.action,hasEagerState:a.hasEagerState,eagerState:a.eagerState,next:null};c===null?(l=c=u,o=s):c=c.next=u,be.lanes|=d,ls|=d}a=a.next}while(a!==null&&a!==n);c===null?o=s:c.next=l,Ut(s,t.memoizedState)||(ft=!0),t.memoizedState=s,t.baseState=o,t.baseQueue=c,i.lastRenderedState=s}if(e=i.interleaved,e!==null){r=e;do n=r.lane,be.lanes|=n,ls|=n,r=r.next;while(r!==e)}else r===null&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function Dl(e){var t=zt(),i=t.queue;if(i===null)throw Error(H(311));i.lastRenderedReducer=e;var s=i.dispatch,r=i.pending,n=t.memoizedState;if(r!==null){i.pending=null;var o=r=r.next;do n=e(n,o.action),o=o.next;while(o!==r);Ut(n,t.memoizedState)||(ft=!0),t.memoizedState=n,t.baseQueue===null&&(t.baseState=n),i.lastRenderedState=n}return[n,s]}function Lp(){}function Pp(e,t){var i=be,s=zt(),r=t(),n=!Ut(s.memoizedState,r);if(n&&(s.memoizedState=r,ft=!0),s=s.queue,mh(jp.bind(null,i,s,e),[e]),s.getSnapshot!==t||n||$e!==null&&$e.memoizedState.tag&1){if(i.flags|=2048,Vr(9,Bp.bind(null,i,s,r,t),void 0,null),Ke===null)throw Error(H(349));os&30||Tp(i,t,r)}return r}function Tp(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=be.updateQueue,t===null?(t={lastEffect:null,stores:null},be.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Bp(e,t,i,s){t.value=i,t.getSnapshot=s,zp(t)&&Op(e)}function jp(e,t,i){return i(function(){zp(t)&&Op(e)})}function zp(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Ut(e,i)}catch{return!0}}function Op(e){var t=pi(e,1);t!==null&&Wt(t,e,1,-1)}function Lu(e){var t=Gt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:e},t.queue=e,e=e.dispatch=rS.bind(null,be,e),[t.memoizedState,e]}function Vr(e,t,i,s){return e={tag:e,create:t,destroy:i,deps:s,next:null},t=be.updateQueue,t===null?(t={lastEffect:null,stores:null},be.updateQueue=t,t.lastEffect=e.next=e):(i=t.lastEffect,i===null?t.lastEffect=e.next=e:(s=i.next,i.next=e,e.next=s,t.lastEffect=e)),e}function Ap(){return zt().memoizedState}function Hn(e,t,i,s){var r=Gt();be.flags|=e,r.memoizedState=Vr(1|t,i,void 0,s===void 0?null:s)}function Ko(e,t,i,s){var r=zt();s=s===void 0?null:s;var n=void 0;if(ze!==null){var o=ze.memoizedState;if(n=o.destroy,s!==null&&fh(s,o.deps)){r.memoizedState=Vr(t,i,n,s);return}}be.flags|=e,r.memoizedState=Vr(1|t,i,n,s)}function Pu(e,t){return Hn(8390656,8,e,t)}function mh(e,t){return Ko(2048,8,e,t)}function Ip(e,t){return Ko(4,2,e,t)}function $p(e,t){return Ko(4,4,e,t)}function Fp(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 Hp(e,t,i){return i=i!=null?i.concat([e]):null,Ko(4,4,Fp.bind(null,t,e),i)}function vh(){}function Wp(e,t){var i=zt();t=t===void 0?null:t;var s=i.memoizedState;return s!==null&&t!==null&&fh(t,s[1])?s[0]:(i.memoizedState=[e,t],e)}function Up(e,t){var i=zt();t=t===void 0?null:t;var s=i.memoizedState;return s!==null&&t!==null&&fh(t,s[1])?s[0]:(e=e(),i.memoizedState=[e,t],e)}function Kp(e,t,i){return os&21?(Ut(i,t)||(i=Gf(),be.lanes|=i,ls|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ft=!0),e.memoizedState=i)}function iS(e,t){var i=he;he=i!==0&&4>i?i:4,e(!0);var s=Nl.transition;Nl.transition={};try{e(!1),t()}finally{he=i,Nl.transition=s}}function Vp(){return zt().memoizedState}function sS(e,t,i){var s=Oi(e);if(i={lane:s,action:i,hasEagerState:!1,eagerState:null,next:null},qp(e))Yp(t,i);else if(i=Rp(e,t,i,s),i!==null){var r=nt();Wt(i,e,s,r),Xp(i,t,s)}}function rS(e,t,i){var s=Oi(e),r={lane:s,action:i,hasEagerState:!1,eagerState:null,next:null};if(qp(e))Yp(t,r);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(r.hasEagerState=!0,r.eagerState=l,Ut(l,o)){var c=t.interleaved;c===null?(r.next=r,ah(t)):(r.next=c.next,c.next=r),t.interleaved=r;return}}catch{}finally{}i=Rp(e,t,r,s),i!==null&&(r=nt(),Wt(i,e,s,r),Xp(i,t,s))}}function qp(e){var t=e.alternate;return e===be||t!==null&&t===be}function Yp(e,t){Er=So=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Xp(e,t,i){if(i&4194240){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Yc(e,i)}}var yo={readContext:jt,useCallback:Je,useContext:Je,useEffect:Je,useImperativeHandle:Je,useInsertionEffect:Je,useLayoutEffect:Je,useMemo:Je,useReducer:Je,useRef:Je,useState:Je,useDebugValue:Je,useDeferredValue:Je,useTransition:Je,useMutableSource:Je,useSyncExternalStore:Je,useId:Je,unstable_isNewReconciler:!1},nS={readContext:jt,useCallback:function(e,t){return Gt().memoizedState=[e,t===void 0?null:t],e},useContext:jt,useEffect:Pu,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,Hn(4194308,4,Fp.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Hn(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hn(4,2,e,t)},useMemo:function(e,t){var i=Gt();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var s=Gt();return t=i!==void 0?i(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=sS.bind(null,be,e),[s.memoizedState,e]},useRef:function(e){var t=Gt();return e={current:e},t.memoizedState=e},useState:Lu,useDebugValue:vh,useDeferredValue:function(e){return Gt().memoizedState=e},useTransition:function(){var e=Lu(!1),t=e[0];return e=iS.bind(null,e[1]),Gt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var s=be,r=Gt();if(Se){if(i===void 0)throw Error(H(407));i=i()}else{if(i=t(),Ke===null)throw Error(H(349));os&30||Tp(s,t,i)}r.memoizedState=i;var n={value:i,getSnapshot:t};return r.queue=n,Pu(jp.bind(null,s,n,e),[e]),s.flags|=2048,Vr(9,Bp.bind(null,s,n,i,t),void 0,null),i},useId:function(){var e=Gt(),t=Ke.identifierPrefix;if(Se){var i=ai,s=li;i=(s&~(1<<32-Ht(s)-1)).toString(32)+i,t=":"+t+"R"+i,i=Ur++,0<i&&(t+="H"+i.toString(32)),t+=":"}else i=tS++,t=":"+t+"r"+i.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},oS={readContext:jt,useCallback:Wp,useContext:jt,useEffect:mh,useImperativeHandle:Hp,useInsertionEffect:Ip,useLayoutEffect:$p,useMemo:Up,useReducer:Rl,useRef:Ap,useState:function(){return Rl(Kr)},useDebugValue:vh,useDeferredValue:function(e){var t=zt();return Kp(t,ze.memoizedState,e)},useTransition:function(){var e=Rl(Kr)[0],t=zt().memoizedState;return[e,t]},useMutableSource:Lp,useSyncExternalStore:Pp,useId:Vp,unstable_isNewReconciler:!1},lS={readContext:jt,useCallback:Wp,useContext:jt,useEffect:mh,useImperativeHandle:Hp,useInsertionEffect:Ip,useLayoutEffect:$p,useMemo:Up,useReducer:Dl,useRef:Ap,useState:function(){return Dl(Kr)},useDebugValue:vh,useDeferredValue:function(e){var t=zt();return ze===null?t.memoizedState=e:Kp(t,ze.memoizedState,e)},useTransition:function(){var e=Dl(Kr)[0],t=zt().memoizedState;return[e,t]},useMutableSource:Lp,useSyncExternalStore:Pp,useId:Vp,unstable_isNewReconciler:!1};function It(e,t){if(e&&e.defaultProps){t=ke({},t),e=e.defaultProps;for(var i in e)t[i]===void 0&&(t[i]=e[i]);return t}return t}function Ea(e,t,i,s){t=e.memoizedState,i=i(s,t),i=i==null?t:ke({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Vo={isMounted:function(e){return(e=e._reactInternals)?ds(e)===e:!1},enqueueSetState:function(e,t,i){e=e._reactInternals;var s=nt(),r=Oi(e),n=hi(s,r);n.payload=t,i!=null&&(n.callback=i),t=ji(e,n,r),t!==null&&(Wt(t,e,r,s),$n(t,e,r))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var s=nt(),r=Oi(e),n=hi(s,r);n.tag=1,n.payload=t,i!=null&&(n.callback=i),t=ji(e,n,r),t!==null&&(Wt(t,e,r,s),$n(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=nt(),s=Oi(e),r=hi(i,s);r.tag=2,t!=null&&(r.callback=t),t=ji(e,r,s),t!==null&&(Wt(t,e,s,i),$n(t,e,s))}};function Tu(e,t,i,s,r,n,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,n,o):t.prototype&&t.prototype.isPureReactComponent?!Ar(i,s)||!Ar(r,n):!0}function Gp(e,t,i){var s=!1,r=Fi,n=t.contextType;return typeof n=="object"&&n!==null?n=jt(n):(r=_t(t)?rs:it.current,s=t.contextTypes,n=(s=s!=null)?As(e,r):Fi),t=new t(i,n),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Vo,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=n),t}function Bu(e,t,i,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,s),t.state!==e&&Vo.enqueueReplaceState(t,t.state,null)}function Na(e,t,i,s){var r=e.stateNode;r.props=i,r.state=e.memoizedState,r.refs={},ch(e);var n=t.contextType;typeof n=="object"&&n!==null?r.context=jt(n):(n=_t(t)?rs:it.current,r.context=As(e,n)),r.state=e.memoizedState,n=t.getDerivedStateFromProps,typeof n=="function"&&(Ea(e,t,n,i),r.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(t=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),t!==r.state&&Vo.enqueueReplaceState(r,r.state,null),vo(e,i,r,s),r.state=e.memoizedState),typeof r.componentDidMount=="function"&&(e.flags|=4194308)}function Hs(e,t){try{var i="",s=t;do i+=jv(s),s=s.return;while(s);var r=i}catch(n){r=`
|
|
39
|
-
Error generating stack: `+n.message+`
|
|
40
|
-
`+n.stack}return{value:e,source:t,stack:r,digest:null}}function Ml(e,t,i){return{value:e,source:null,stack:i??null,digest:t??null}}function Ra(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var aS=typeof WeakMap=="function"?WeakMap:Map;function Qp(e,t,i){i=hi(-1,i),i.tag=3,i.payload={element:null};var s=t.value;return i.callback=function(){Co||(Co=!0,Aa=s),Ra(e,t)},i}function Jp(e,t,i){i=hi(-1,i),i.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var r=t.value;i.payload=function(){return s(r)},i.callback=function(){Ra(e,t)}}var n=e.stateNode;return n!==null&&typeof n.componentDidCatch=="function"&&(i.callback=function(){Ra(e,t),typeof s!="function"&&(zi===null?zi=new Set([this]):zi.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),i}function ju(e,t,i){var s=e.pingCache;if(s===null){s=e.pingCache=new aS;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(i)||(r.add(i),e=CS.bind(null,e,t,i),t.then(e,e))}function zu(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 Ou(e,t,i,s,r){return e.mode&1?(e.flags|=65536,e.lanes=r,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=hi(-1,1),t.tag=2,ji(i,t,1))),i.lanes|=1),e)}var cS=mi.ReactCurrentOwner,ft=!1;function rt(e,t,i,s){t.child=e===null?Np(t,null,i,s):$s(t,e.child,i,s)}function Au(e,t,i,s,r){i=i.render;var n=t.ref;return js(t,r),s=ph(e,t,i,s,n,r),i=_h(),e!==null&&!ft?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,_i(e,t,r)):(Se&&i&&ih(t),t.flags|=1,rt(e,t,s,r),t.child)}function Iu(e,t,i,s,r){if(e===null){var n=i.type;return typeof n=="function"&&!kh(n)&&n.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(t.tag=15,t.type=n,Zp(e,t,n,s,r)):(e=Vn(i.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(n=e.child,!(e.lanes&r)){var o=n.memoizedProps;if(i=i.compare,i=i!==null?i:Ar,i(o,s)&&e.ref===t.ref)return _i(e,t,r)}return t.flags|=1,e=Ai(n,s),e.ref=t.ref,e.return=t,t.child=e}function Zp(e,t,i,s,r){if(e!==null){var n=e.memoizedProps;if(Ar(n,s)&&e.ref===t.ref)if(ft=!1,t.pendingProps=s=n,(e.lanes&r)!==0)e.flags&131072&&(ft=!0);else return t.lanes=e.lanes,_i(e,t,r)}return Da(e,t,i,s,r)}function e_(e,t,i){var s=t.pendingProps,r=s.children,n=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},_e(Ds,yt),yt|=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,_e(Ds,yt),yt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=n!==null?n.baseLanes:i,_e(Ds,yt),yt|=s}else n!==null?(s=n.baseLanes|i,t.memoizedState=null):s=i,_e(Ds,yt),yt|=s;return rt(e,t,r,i),t.child}function t_(e,t){var i=t.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function Da(e,t,i,s,r){var n=_t(i)?rs:it.current;return n=As(t,n),js(t,r),i=ph(e,t,i,s,n,r),s=_h(),e!==null&&!ft?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,_i(e,t,r)):(Se&&s&&ih(t),t.flags|=1,rt(e,t,i,r),t.child)}function $u(e,t,i,s,r){if(_t(i)){var n=!0;uo(t)}else n=!1;if(js(t,r),t.stateNode===null)Wn(e,t),Gp(t,i,s),Na(t,i,s,r),s=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,a=i.contextType;typeof a=="object"&&a!==null?a=jt(a):(a=_t(i)?rs:it.current,a=As(t,a));var d=i.getDerivedStateFromProps,u=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==s||c!==a)&&Bu(t,o,s,a),bi=!1;var f=t.memoizedState;o.state=f,vo(t,s,o,r),c=t.memoizedState,l!==s||f!==c||pt.current||bi?(typeof d=="function"&&(Ea(t,i,d,s),c=t.memoizedState),(l=bi||Tu(t,i,l,s,f,c,a))?(u||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=s,t.memoizedState=c),o.props=s,o.state=c,o.context=a,s=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,Dp(e,t),l=t.memoizedProps,a=t.type===t.elementType?l:It(t.type,l),o.props=a,u=t.pendingProps,f=o.context,c=i.contextType,typeof c=="object"&&c!==null?c=jt(c):(c=_t(i)?rs:it.current,c=As(t,c));var m=i.getDerivedStateFromProps;(d=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==u||f!==c)&&Bu(t,o,s,c),bi=!1,f=t.memoizedState,o.state=f,vo(t,s,o,r);var _=t.memoizedState;l!==u||f!==_||pt.current||bi?(typeof m=="function"&&(Ea(t,i,m,s),_=t.memoizedState),(a=bi||Tu(t,i,a,s,f,_,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,_,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,_,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=_),o.props=s,o.state=_,o.context=c,s=a):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),s=!1)}return Ma(e,t,i,s,n,r)}function Ma(e,t,i,s,r,n){t_(e,t);var o=(t.flags&128)!==0;if(!s&&!o)return r&&ku(t,i,!1),_i(e,t,n);s=t.stateNode,cS.current=t;var l=o&&typeof i.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&o?(t.child=$s(t,e.child,null,n),t.child=$s(t,null,l,n)):rt(e,t,l,n),t.memoizedState=s.state,r&&ku(t,i,!0),t.child}function i_(e){var t=e.stateNode;t.pendingContext?bu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&bu(e,t.context,!1),hh(e,t.containerInfo)}function Fu(e,t,i,s,r){return Is(),rh(r),t.flags|=256,rt(e,t,i,s),t.child}var La={dehydrated:null,treeContext:null,retryLane:0};function Pa(e){return{baseLanes:e,cachePool:null,transitions:null}}function s_(e,t,i){var s=t.pendingProps,r=xe.current,n=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(r&2)!==0),l?(n=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(r|=1),_e(xe,r&1),e===null)return ba(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=s.children,e=s.fallback,n?(s=t.mode,n=t.child,o={mode:"hidden",children:o},!(s&1)&&n!==null?(n.childLanes=0,n.pendingProps=o):n=Xo(o,s,0,null),e=is(e,s,i,null),n.return=t,e.return=t,n.sibling=e,t.child=n,t.child.memoizedState=Pa(i),t.memoizedState=La,e):gh(t,o));if(r=e.memoizedState,r!==null&&(l=r.dehydrated,l!==null))return hS(e,t,o,s,l,r,i);if(n){n=s.fallback,o=t.mode,r=e.child,l=r.sibling;var c={mode:"hidden",children:s.children};return!(o&1)&&t.child!==r?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=Ai(r,c),s.subtreeFlags=r.subtreeFlags&14680064),l!==null?n=Ai(l,n):(n=is(n,o,i,null),n.flags|=2),n.return=t,s.return=t,s.sibling=n,t.child=s,s=n,n=t.child,o=e.child.memoizedState,o=o===null?Pa(i):{baseLanes:o.baseLanes|i,cachePool:null,transitions:o.transitions},n.memoizedState=o,n.childLanes=e.childLanes&~i,t.memoizedState=La,s}return n=e.child,e=n.sibling,s=Ai(n,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=i),s.return=t,s.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=s,t.memoizedState=null,s}function gh(e,t){return t=Xo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Cn(e,t,i,s){return s!==null&&rh(s),$s(t,e.child,null,i),e=gh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function hS(e,t,i,s,r,n,o){if(i)return t.flags&256?(t.flags&=-257,s=Ml(Error(H(422))),Cn(e,t,o,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(n=s.fallback,r=t.mode,s=Xo({mode:"visible",children:s.children},r,0,null),n=is(n,r,o,null),n.flags|=2,s.return=t,n.return=t,s.sibling=n,t.child=s,t.mode&1&&$s(t,e.child,null,o),t.child.memoizedState=Pa(o),t.memoizedState=La,n);if(!(t.mode&1))return Cn(e,t,o,null);if(r.data==="$!"){if(s=r.nextSibling&&r.nextSibling.dataset,s)var l=s.dgst;return s=l,n=Error(H(419)),s=Ml(n,s,void 0),Cn(e,t,o,s)}if(l=(o&e.childLanes)!==0,ft||l){if(s=Ke,s!==null){switch(o&-o){case 4:r=2;break;case 16:r=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:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(s.suspendedLanes|o)?0:r,r!==0&&r!==n.retryLane&&(n.retryLane=r,pi(e,r),Wt(s,e,r,-1))}return bh(),s=Ml(Error(H(421))),Cn(e,t,o,s)}return r.data==="$?"?(t.flags|=128,t.child=e.child,t=xS.bind(null,e),r._reactRetry=t,null):(e=n.treeContext,wt=Bi(r.nextSibling),Ct=t,Se=!0,Ft=null,e!==null&&(Mt[Lt++]=li,Mt[Lt++]=ai,Mt[Lt++]=ns,li=e.id,ai=e.overflow,ns=t),t=gh(t,s.children),t.flags|=4096,t)}function Hu(e,t,i){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),ka(e.return,t,i)}function Ll(e,t,i,s,r){var n=e.memoizedState;n===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:i,tailMode:r}:(n.isBackwards=t,n.rendering=null,n.renderingStartTime=0,n.last=s,n.tail=i,n.tailMode=r)}function r_(e,t,i){var s=t.pendingProps,r=s.revealOrder,n=s.tail;if(rt(e,t,s.children,i),s=xe.current,s&2)s=s&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&&Hu(e,i,t);else if(e.tag===19)Hu(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}s&=1}if(_e(xe,s),!(t.mode&1))t.memoizedState=null;else switch(r){case"forwards":for(i=t.child,r=null;i!==null;)e=i.alternate,e!==null&&go(e)===null&&(r=i),i=i.sibling;i=r,i===null?(r=t.child,t.child=null):(r=i.sibling,i.sibling=null),Ll(t,!1,r,i,n);break;case"backwards":for(i=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&go(e)===null){t.child=r;break}e=r.sibling,r.sibling=i,i=r,r=e}Ll(t,!0,i,null,n);break;case"together":Ll(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Wn(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function _i(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),ls|=t.lanes,!(i&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(H(153));if(t.child!==null){for(e=t.child,i=Ai(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Ai(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function uS(e,t,i){switch(t.tag){case 3:i_(t),Is();break;case 5:Mp(t);break;case 1:_t(t.type)&&uo(t);break;case 4:hh(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,r=t.memoizedProps.value;_e(_o,s._currentValue),s._currentValue=r;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(_e(xe,xe.current&1),t.flags|=128,null):i&t.child.childLanes?s_(e,t,i):(_e(xe,xe.current&1),e=_i(e,t,i),e!==null?e.sibling:null);_e(xe,xe.current&1);break;case 19:if(s=(i&t.childLanes)!==0,e.flags&128){if(s)return r_(e,t,i);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),_e(xe,xe.current),s)break;return null;case 22:case 23:return t.lanes=0,e_(e,t,i)}return _i(e,t,i)}var n_,Ta,o_,l_;n_=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}};Ta=function(){};o_=function(e,t,i,s){var r=e.memoizedProps;if(r!==s){e=t.stateNode,Zi(ei.current);var n=null;switch(i){case"input":r=ta(e,r),s=ta(e,s),n=[];break;case"select":r=ke({},r,{value:void 0}),s=ke({},s,{value:void 0}),n=[];break;case"textarea":r=ra(e,r),s=ra(e,s),n=[];break;default:typeof r.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=co)}oa(i,s);var o;i=null;for(a in r)if(!s.hasOwnProperty(a)&&r.hasOwnProperty(a)&&r[a]!=null)if(a==="style"){var l=r[a];for(o in l)l.hasOwnProperty(o)&&(i||(i={}),i[o]="")}else a!=="dangerouslySetInnerHTML"&&a!=="children"&&a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Lr.hasOwnProperty(a)?n||(n=[]):(n=n||[]).push(a,null));for(a in s){var c=s[a];if(l=r!=null?r[a]:void 0,s.hasOwnProperty(a)&&c!==l&&(c!=null||l!=null))if(a==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(i||(i={}),i[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(i||(i={}),i[o]=c[o])}else i||(n||(n=[]),n.push(a,i)),i=c;else a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(n=n||[]).push(a,c)):a==="children"?typeof c!="string"&&typeof c!="number"||(n=n||[]).push(a,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&(Lr.hasOwnProperty(a)?(c!=null&&a==="onScroll"&&me("scroll",e),n||l===c||(n=[])):(n=n||[]).push(a,c))}i&&(n=n||[]).push("style",i);var a=n;(t.updateQueue=a)&&(t.flags|=4)}};l_=function(e,t,i,s){i!==s&&(t.flags|=4)};function sr(e,t){if(!Se)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,s=0;if(t)for(var r=e.child;r!==null;)i|=r.lanes|r.childLanes,s|=r.subtreeFlags&14680064,s|=r.flags&14680064,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)i|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=i,t}function dS(e,t,i){var s=t.pendingProps;switch(sh(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return _t(t.type)&&ho(),Ze(t),null;case 3:return s=t.stateNode,Fs(),ge(pt),ge(it),dh(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(yn(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ft!==null&&(Fa(Ft),Ft=null))),Ta(e,t),Ze(t),null;case 5:uh(t);var r=Zi(Wr.current);if(i=t.type,e!==null&&t.stateNode!=null)o_(e,t,i,s,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(H(166));return Ze(t),null}if(e=Zi(ei.current),yn(t)){s=t.stateNode,i=t.type;var n=t.memoizedProps;switch(s[Qt]=t,s[Fr]=n,e=(t.mode&1)!==0,i){case"dialog":me("cancel",s),me("close",s);break;case"iframe":case"object":case"embed":me("load",s);break;case"video":case"audio":for(r=0;r<pr.length;r++)me(pr[r],s);break;case"source":me("error",s);break;case"img":case"image":case"link":me("error",s),me("load",s);break;case"details":me("toggle",s);break;case"input":Qh(s,n),me("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!n.multiple},me("invalid",s);break;case"textarea":Zh(s,n),me("invalid",s)}oa(i,n),r=null;for(var o in n)if(n.hasOwnProperty(o)){var l=n[o];o==="children"?typeof l=="string"?s.textContent!==l&&(n.suppressHydrationWarning!==!0&&Sn(s.textContent,l,e),r=["children",l]):typeof l=="number"&&s.textContent!==""+l&&(n.suppressHydrationWarning!==!0&&Sn(s.textContent,l,e),r=["children",""+l]):Lr.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&me("scroll",s)}switch(i){case"input":un(s),Jh(s,n,!0);break;case"textarea":un(s),eu(s);break;case"select":case"option":break;default:typeof n.onClick=="function"&&(s.onclick=co)}s=r,t.updateQueue=s,s!==null&&(t.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=jf(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=o.createElement(i,{is:s.is}):(e=o.createElement(i),i==="select"&&(o=e,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):e=o.createElementNS(e,i),e[Qt]=t,e[Fr]=s,n_(e,t,!1,!1),t.stateNode=e;e:{switch(o=la(i,s),i){case"dialog":me("cancel",e),me("close",e),r=s;break;case"iframe":case"object":case"embed":me("load",e),r=s;break;case"video":case"audio":for(r=0;r<pr.length;r++)me(pr[r],e);r=s;break;case"source":me("error",e),r=s;break;case"img":case"image":case"link":me("error",e),me("load",e),r=s;break;case"details":me("toggle",e),r=s;break;case"input":Qh(e,s),r=ta(e,s),me("invalid",e);break;case"option":r=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},r=ke({},s,{value:void 0}),me("invalid",e);break;case"textarea":Zh(e,s),r=ra(e,s),me("invalid",e);break;default:r=s}oa(i,r),l=r;for(n in l)if(l.hasOwnProperty(n)){var c=l[n];n==="style"?Af(e,c):n==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&zf(e,c)):n==="children"?typeof c=="string"?(i!=="textarea"||c!=="")&&Pr(e,c):typeof c=="number"&&Pr(e,""+c):n!=="suppressContentEditableWarning"&&n!=="suppressHydrationWarning"&&n!=="autoFocus"&&(Lr.hasOwnProperty(n)?c!=null&&n==="onScroll"&&me("scroll",e):c!=null&&Hc(e,n,c,o))}switch(i){case"input":un(e),Jh(e,s,!1);break;case"textarea":un(e),eu(e);break;case"option":s.value!=null&&e.setAttribute("value",""+$i(s.value));break;case"select":e.multiple=!!s.multiple,n=s.value,n!=null?Ls(e,!!s.multiple,n,!1):s.defaultValue!=null&&Ls(e,!!s.multiple,s.defaultValue,!0);break;default:typeof r.onClick=="function"&&(e.onclick=co)}switch(i){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ze(t),null;case 6:if(e&&t.stateNode!=null)l_(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(H(166));if(i=Zi(Wr.current),Zi(ei.current),yn(t)){if(s=t.stateNode,i=t.memoizedProps,s[Qt]=t,(n=s.nodeValue!==i)&&(e=Ct,e!==null))switch(e.tag){case 3:Sn(s.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Sn(s.nodeValue,i,(e.mode&1)!==0)}n&&(t.flags|=4)}else s=(i.nodeType===9?i:i.ownerDocument).createTextNode(s),s[Qt]=t,t.stateNode=s}return Ze(t),null;case 13:if(ge(xe),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Se&&wt!==null&&t.mode&1&&!(t.flags&128))kp(),Is(),t.flags|=98560,n=!1;else if(n=yn(t),s!==null&&s.dehydrated!==null){if(e===null){if(!n)throw Error(H(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(H(317));n[Qt]=t}else Is(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ze(t),n=!1}else Ft!==null&&(Fa(Ft),Ft=null),n=!0;if(!n)return t.flags&65536?t:null}return t.flags&128?(t.lanes=i,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||xe.current&1?Oe===0&&(Oe=3):bh())),t.updateQueue!==null&&(t.flags|=4),Ze(t),null);case 4:return Fs(),Ta(e,t),e===null&&Ir(t.stateNode.containerInfo),Ze(t),null;case 10:return lh(t.type._context),Ze(t),null;case 17:return _t(t.type)&&ho(),Ze(t),null;case 19:if(ge(xe),n=t.memoizedState,n===null)return Ze(t),null;if(s=(t.flags&128)!==0,o=n.rendering,o===null)if(s)sr(n,!1);else{if(Oe!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=go(e),o!==null){for(t.flags|=128,sr(n,!1),s=o.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=i,i=t.child;i!==null;)n=i,e=s,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 _e(xe,xe.current&1|2),t.child}e=e.sibling}n.tail!==null&&Me()>Ws&&(t.flags|=128,s=!0,sr(n,!1),t.lanes=4194304)}else{if(!s)if(e=go(o),e!==null){if(t.flags|=128,s=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),sr(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!Se)return Ze(t),null}else 2*Me()-n.renderingStartTime>Ws&&i!==1073741824&&(t.flags|=128,s=!0,sr(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=Me(),t.sibling=null,i=xe.current,_e(xe,s?i&1|2:i&1),t):(Ze(t),null);case 22:case 23:return xh(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?yt&1073741824&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),null;case 24:return null;case 25:return null}throw Error(H(156,t.tag))}function fS(e,t){switch(sh(t),t.tag){case 1:return _t(t.type)&&ho(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Fs(),ge(pt),ge(it),dh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return uh(t),null;case 13:if(ge(xe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(H(340));Is()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ge(xe),null;case 4:return Fs(),null;case 10:return lh(t.type._context),null;case 22:case 23:return xh(),null;case 24:return null;default:return null}}var xn=!1,tt=!1,pS=typeof WeakSet=="function"?WeakSet:Set,q=null;function Rs(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(s){Ne(e,t,s)}else i.current=null}function Ba(e,t,i){try{i()}catch(s){Ne(e,t,s)}}var Wu=!1;function _S(e,t){if(va=oo,e=dp(),th(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var s=i.getSelection&&i.getSelection();if(s&&s.rangeCount!==0){i=s.anchorNode;var r=s.anchorOffset,n=s.focusNode;s=s.focusOffset;try{i.nodeType,n.nodeType}catch{i=null;break e}var o=0,l=-1,c=-1,a=0,d=0,u=e,f=null;t:for(;;){for(var m;u!==i||r!==0&&u.nodeType!==3||(l=o+r),u!==n||s!==0&&u.nodeType!==3||(c=o+s),u.nodeType===3&&(o+=u.nodeValue.length),(m=u.firstChild)!==null;)f=u,u=m;for(;;){if(u===e)break t;if(f===i&&++a===r&&(l=o),f===n&&++d===s&&(c=o),(m=u.nextSibling)!==null)break;u=f,f=u.parentNode}u=m}i=l===-1||c===-1?null:{start:l,end:c}}else i=null}i=i||{start:0,end:0}}else i=null;for(ga={focusedElem:e,selectionRange:i},oo=!1,q=t;q!==null;)if(t=q,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;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,v=t.stateNode,p=v.getSnapshotBeforeUpdate(t.elementType===t.type?S:It(t.type,S),k);v.__reactInternalSnapshotBeforeUpdate=p}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(H(163))}}catch(w){Ne(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return _=Wu,Wu=!1,_}function Nr(e,t,i){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var r=s=s.next;do{if((r.tag&e)===e){var n=r.destroy;r.destroy=void 0,n!==void 0&&Ba(t,i,n)}r=r.next}while(r!==s)}}function qo(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 s=i.create;i.destroy=s()}i=i.next}while(i!==t)}}function ja(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 a_(e){var t=e.alternate;t!==null&&(e.alternate=null,a_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Qt],delete t[Fr],delete t[wa],delete t[Qg],delete t[Jg])),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 c_(e){return e.tag===5||e.tag===3||e.tag===4}function Uu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||c_(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 za(e,t,i){var s=e.tag;if(s===5||s===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=co));else if(s!==4&&(e=e.child,e!==null))for(za(e,t,i),e=e.sibling;e!==null;)za(e,t,i),e=e.sibling}function Oa(e,t,i){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(Oa(e,t,i),e=e.sibling;e!==null;)Oa(e,t,i),e=e.sibling}var qe=null,$t=!1;function Si(e,t,i){for(i=i.child;i!==null;)h_(e,t,i),i=i.sibling}function h_(e,t,i){if(Zt&&typeof Zt.onCommitFiberUnmount=="function")try{Zt.onCommitFiberUnmount(Io,i)}catch{}switch(i.tag){case 5:tt||Rs(i,t);case 6:var s=qe,r=$t;qe=null,Si(e,t,i),qe=s,$t=r,qe!==null&&($t?(e=qe,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):qe.removeChild(i.stateNode));break;case 18:qe!==null&&($t?(e=qe,i=i.stateNode,e.nodeType===8?bl(e.parentNode,i):e.nodeType===1&&bl(e,i),zr(e)):bl(qe,i.stateNode));break;case 4:s=qe,r=$t,qe=i.stateNode.containerInfo,$t=!0,Si(e,t,i),qe=s,$t=r;break;case 0:case 11:case 14:case 15:if(!tt&&(s=i.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){r=s=s.next;do{var n=r,o=n.destroy;n=n.tag,o!==void 0&&(n&2||n&4)&&Ba(i,t,o),r=r.next}while(r!==s)}Si(e,t,i);break;case 1:if(!tt&&(Rs(i,t),s=i.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=i.memoizedProps,s.state=i.memoizedState,s.componentWillUnmount()}catch(l){Ne(i,t,l)}Si(e,t,i);break;case 21:Si(e,t,i);break;case 22:i.mode&1?(tt=(s=tt)||i.memoizedState!==null,Si(e,t,i),tt=s):Si(e,t,i);break;default:Si(e,t,i)}}function Ku(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new pS),t.forEach(function(s){var r=bS.bind(null,e,s);i.has(s)||(i.add(s),s.then(r,r))})}}function Ot(e,t){var i=t.deletions;if(i!==null)for(var s=0;s<i.length;s++){var r=i[s];try{var n=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:qe=l.stateNode,$t=!1;break e;case 3:qe=l.stateNode.containerInfo,$t=!0;break e;case 4:qe=l.stateNode.containerInfo,$t=!0;break e}l=l.return}if(qe===null)throw Error(H(160));h_(n,o,r),qe=null,$t=!1;var c=r.alternate;c!==null&&(c.return=null),r.return=null}catch(a){Ne(r,t,a)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)u_(t,e),t=t.sibling}function u_(e,t){var i=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ot(t,e),Vt(e),s&4){try{Nr(3,e,e.return),qo(3,e)}catch(S){Ne(e,e.return,S)}try{Nr(5,e,e.return)}catch(S){Ne(e,e.return,S)}}break;case 1:Ot(t,e),Vt(e),s&512&&i!==null&&Rs(i,i.return);break;case 5:if(Ot(t,e),Vt(e),s&512&&i!==null&&Rs(i,i.return),e.flags&32){var r=e.stateNode;try{Pr(r,"")}catch(S){Ne(e,e.return,S)}}if(s&4&&(r=e.stateNode,r!=null)){var n=e.memoizedProps,o=i!==null?i.memoizedProps:n,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&n.type==="radio"&&n.name!=null&&Tf(r,n),la(l,o);var a=la(l,n);for(o=0;o<c.length;o+=2){var d=c[o],u=c[o+1];d==="style"?Af(r,u):d==="dangerouslySetInnerHTML"?zf(r,u):d==="children"?Pr(r,u):Hc(r,d,u,a)}switch(l){case"input":ia(r,n);break;case"textarea":Bf(r,n);break;case"select":var f=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!n.multiple;var m=n.value;m!=null?Ls(r,!!n.multiple,m,!1):f!==!!n.multiple&&(n.defaultValue!=null?Ls(r,!!n.multiple,n.defaultValue,!0):Ls(r,!!n.multiple,n.multiple?[]:"",!1))}r[Fr]=n}catch(S){Ne(e,e.return,S)}}break;case 6:if(Ot(t,e),Vt(e),s&4){if(e.stateNode===null)throw Error(H(162));r=e.stateNode,n=e.memoizedProps;try{r.nodeValue=n}catch(S){Ne(e,e.return,S)}}break;case 3:if(Ot(t,e),Vt(e),s&4&&i!==null&&i.memoizedState.isDehydrated)try{zr(t.containerInfo)}catch(S){Ne(e,e.return,S)}break;case 4:Ot(t,e),Vt(e);break;case 13:Ot(t,e),Vt(e),r=e.child,r.flags&8192&&(n=r.memoizedState!==null,r.stateNode.isHidden=n,!n||r.alternate!==null&&r.alternate.memoizedState!==null||(wh=Me())),s&4&&Ku(e);break;case 22:if(d=i!==null&&i.memoizedState!==null,e.mode&1?(tt=(a=tt)||d,Ot(t,e),tt=a):Ot(t,e),Vt(e),s&8192){if(a=e.memoizedState!==null,(e.stateNode.isHidden=a)&&!d&&e.mode&1)for(q=e,d=e.child;d!==null;){for(u=q=d;q!==null;){switch(f=q,m=f.child,f.tag){case 0:case 11:case 14:case 15:Nr(4,f,f.return);break;case 1:Rs(f,f.return);var _=f.stateNode;if(typeof _.componentWillUnmount=="function"){s=f,i=f.return;try{t=s,_.props=t.memoizedProps,_.state=t.memoizedState,_.componentWillUnmount()}catch(S){Ne(s,i,S)}}break;case 5:Rs(f,f.return);break;case 22:if(f.memoizedState!==null){qu(u);continue}}m!==null?(m.return=f,q=m):qu(u)}d=d.sibling}e:for(d=null,u=e;;){if(u.tag===5){if(d===null){d=u;try{r=u.stateNode,a?(n=r.style,typeof n.setProperty=="function"?n.setProperty("display","none","important"):n.display="none"):(l=u.stateNode,c=u.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Of("display",o))}catch(S){Ne(e,e.return,S)}}}else if(u.tag===6){if(d===null)try{u.stateNode.nodeValue=a?"":u.memoizedProps}catch(S){Ne(e,e.return,S)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;d===u&&(d=null),u=u.return}d===u&&(d=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:Ot(t,e),Vt(e),s&4&&Ku(e);break;case 21:break;default:Ot(t,e),Vt(e)}}function Vt(e){var t=e.flags;if(t&2){try{e:{for(var i=e.return;i!==null;){if(c_(i)){var s=i;break e}i=i.return}throw Error(H(160))}switch(s.tag){case 5:var r=s.stateNode;s.flags&32&&(Pr(r,""),s.flags&=-33);var n=Uu(e);Oa(e,n,r);break;case 3:case 4:var o=s.stateNode.containerInfo,l=Uu(e);za(e,l,o);break;default:throw Error(H(161))}}catch(c){Ne(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function mS(e,t,i){q=e,d_(e)}function d_(e,t,i){for(var s=(e.mode&1)!==0;q!==null;){var r=q,n=r.child;if(r.tag===22&&s){var o=r.memoizedState!==null||xn;if(!o){var l=r.alternate,c=l!==null&&l.memoizedState!==null||tt;l=xn;var a=tt;if(xn=o,(tt=c)&&!a)for(q=r;q!==null;)o=q,c=o.child,o.tag===22&&o.memoizedState!==null?Yu(r):c!==null?(c.return=o,q=c):Yu(r);for(;n!==null;)q=n,d_(n),n=n.sibling;q=r,xn=l,tt=a}Vu(e)}else r.subtreeFlags&8772&&n!==null?(n.return=r,q=n):Vu(e)}}function Vu(e){for(;q!==null;){var t=q;if(t.flags&8772){var i=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:tt||qo(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!tt)if(i===null)s.componentDidMount();else{var r=t.elementType===t.type?i.memoizedProps:It(t.type,i.memoizedProps);s.componentDidUpdate(r,i.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var n=t.updateQueue;n!==null&&Mu(t,n,s);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}Mu(t,o,i)}break;case 5:var l=t.stateNode;if(i===null&&t.flags&4){i=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&i.focus();break;case"img":c.src&&(i.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var a=t.alternate;if(a!==null){var d=a.memoizedState;if(d!==null){var u=d.dehydrated;u!==null&&zr(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(H(163))}tt||t.flags&512&&ja(t)}catch(f){Ne(t,t.return,f)}}if(t===e){q=null;break}if(i=t.sibling,i!==null){i.return=t.return,q=i;break}q=t.return}}function qu(e){for(;q!==null;){var t=q;if(t===e){q=null;break}var i=t.sibling;if(i!==null){i.return=t.return,q=i;break}q=t.return}}function Yu(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{qo(4,t)}catch(c){Ne(t,i,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var r=t.return;try{s.componentDidMount()}catch(c){Ne(t,r,c)}}var n=t.return;try{ja(t)}catch(c){Ne(t,n,c)}break;case 5:var o=t.return;try{ja(t)}catch(c){Ne(t,o,c)}}}catch(c){Ne(t,t.return,c)}if(t===e){q=null;break}var l=t.sibling;if(l!==null){l.return=t.return,q=l;break}q=t.return}}var vS=Math.ceil,wo=mi.ReactCurrentDispatcher,Sh=mi.ReactCurrentOwner,Tt=mi.ReactCurrentBatchConfig,le=0,Ke=null,Te=null,Ge=0,yt=0,Ds=Wi(0),Oe=0,qr=null,ls=0,Yo=0,yh=0,Rr=null,dt=null,wh=0,Ws=1/0,ni=null,Co=!1,Aa=null,zi=null,bn=!1,Di=null,xo=0,Dr=0,Ia=null,Un=-1,Kn=0;function nt(){return le&6?Me():Un!==-1?Un:Un=Me()}function Oi(e){return e.mode&1?le&2&&Ge!==0?Ge&-Ge:eS.transition!==null?(Kn===0&&(Kn=Gf()),Kn):(e=he,e!==0||(e=window.event,e=e===void 0?16:sp(e.type)),e):1}function Wt(e,t,i,s){if(50<Dr)throw Dr=0,Ia=null,Error(H(185));Jr(e,i,s),(!(le&2)||e!==Ke)&&(e===Ke&&(!(le&2)&&(Yo|=i),Oe===4&&Ni(e,Ge)),mt(e,s),i===1&&le===0&&!(t.mode&1)&&(Ws=Me()+500,Uo&&Ui()))}function mt(e,t){var i=e.callbackNode;eg(e,t);var s=no(e,e===Ke?Ge:0);if(s===0)i!==null&&su(i),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(i!=null&&su(i),t===1)e.tag===0?Zg(Xu.bind(null,e)):Cp(Xu.bind(null,e)),Xg(function(){!(le&6)&&Ui()}),i=null;else{switch(Qf(s)){case 1:i=qc;break;case 4:i=Yf;break;case 16:i=ro;break;case 536870912:i=Xf;break;default:i=ro}i=y_(i,f_.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function f_(e,t){if(Un=-1,Kn=0,le&6)throw Error(H(327));var i=e.callbackNode;if(zs()&&e.callbackNode!==i)return null;var s=no(e,e===Ke?Ge:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=bo(e,s);else{t=s;var r=le;le|=2;var n=__();(Ke!==e||Ge!==t)&&(ni=null,Ws=Me()+500,ts(e,t));do try{yS();break}catch(l){p_(e,l)}while(!0);oh(),wo.current=n,le=r,Te!==null?t=0:(Ke=null,Ge=0,t=Oe)}if(t!==0){if(t===2&&(r=da(e),r!==0&&(s=r,t=$a(e,r))),t===1)throw i=qr,ts(e,0),Ni(e,s),mt(e,Me()),i;if(t===6)Ni(e,s);else{if(r=e.current.alternate,!(s&30)&&!gS(r)&&(t=bo(e,s),t===2&&(n=da(e),n!==0&&(s=n,t=$a(e,n))),t===1))throw i=qr,ts(e,0),Ni(e,s),mt(e,Me()),i;switch(e.finishedWork=r,e.finishedLanes=s,t){case 0:case 1:throw Error(H(345));case 2:qi(e,dt,ni);break;case 3:if(Ni(e,s),(s&130023424)===s&&(t=wh+500-Me(),10<t)){if(no(e,0)!==0)break;if(r=e.suspendedLanes,(r&s)!==s){nt(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=ya(qi.bind(null,e,dt,ni),t);break}qi(e,dt,ni);break;case 4:if(Ni(e,s),(s&4194240)===s)break;for(t=e.eventTimes,r=-1;0<s;){var o=31-Ht(s);n=1<<o,o=t[o],o>r&&(r=o),s&=~n}if(s=r,s=Me()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*vS(s/1960))-s,10<s){e.timeoutHandle=ya(qi.bind(null,e,dt,ni),s);break}qi(e,dt,ni);break;case 5:qi(e,dt,ni);break;default:throw Error(H(329))}}}return mt(e,Me()),e.callbackNode===i?f_.bind(null,e):null}function $a(e,t){var i=Rr;return e.current.memoizedState.isDehydrated&&(ts(e,t).flags|=256),e=bo(e,t),e!==2&&(t=dt,dt=i,t!==null&&Fa(t)),e}function Fa(e){dt===null?dt=e:dt.push.apply(dt,e)}function gS(e){for(var t=e;;){if(t.flags&16384){var i=t.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var s=0;s<i.length;s++){var r=i[s],n=r.getSnapshot;r=r.value;try{if(!Ut(n(),r))return!1}catch{return!1}}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ni(e,t){for(t&=~yh,t&=~Yo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-Ht(t),s=1<<i;e[i]=-1,t&=~s}}function Xu(e){if(le&6)throw Error(H(327));zs();var t=no(e,0);if(!(t&1))return mt(e,Me()),null;var i=bo(e,t);if(e.tag!==0&&i===2){var s=da(e);s!==0&&(t=s,i=$a(e,s))}if(i===1)throw i=qr,ts(e,0),Ni(e,t),mt(e,Me()),i;if(i===6)throw Error(H(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,qi(e,dt,ni),mt(e,Me()),null}function Ch(e,t){var i=le;le|=1;try{return e(t)}finally{le=i,le===0&&(Ws=Me()+500,Uo&&Ui())}}function as(e){Di!==null&&Di.tag===0&&!(le&6)&&zs();var t=le;le|=1;var i=Tt.transition,s=he;try{if(Tt.transition=null,he=1,e)return e()}finally{he=s,Tt.transition=i,le=t,!(le&6)&&Ui()}}function xh(){yt=Ds.current,ge(Ds)}function ts(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,Yg(i)),Te!==null)for(i=Te.return;i!==null;){var s=i;switch(sh(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&ho();break;case 3:Fs(),ge(pt),ge(it),dh();break;case 5:uh(s);break;case 4:Fs();break;case 13:ge(xe);break;case 19:ge(xe);break;case 10:lh(s.type._context);break;case 22:case 23:xh()}i=i.return}if(Ke=e,Te=e=Ai(e.current,null),Ge=yt=t,Oe=0,qr=null,yh=Yo=ls=0,dt=Rr=null,Ji!==null){for(t=0;t<Ji.length;t++)if(i=Ji[t],s=i.interleaved,s!==null){i.interleaved=null;var r=s.next,n=i.pending;if(n!==null){var o=n.next;n.next=r,s.next=o}i.pending=s}Ji=null}return e}function p_(e,t){do{var i=Te;try{if(oh(),Fn.current=yo,So){for(var s=be.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}So=!1}if(os=0,$e=ze=be=null,Er=!1,Ur=0,Sh.current=null,i===null||i.return===null){Oe=1,qr=t,Te=null;break}e:{var n=e,o=i.return,l=i,c=t;if(t=Ge,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var a=c,d=l,u=d.tag;if(!(d.mode&1)&&(u===0||u===11||u===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=zu(o);if(m!==null){m.flags&=-257,Ou(m,o,l,n,t),m.mode&1&&ju(n,a,t),t=m,c=a;var _=t.updateQueue;if(_===null){var S=new Set;S.add(c),t.updateQueue=S}else _.add(c);break e}else{if(!(t&1)){ju(n,a,t),bh();break e}c=Error(H(426))}}else if(Se&&l.mode&1){var k=zu(o);if(k!==null){!(k.flags&65536)&&(k.flags|=256),Ou(k,o,l,n,t),rh(Hs(c,l));break e}}n=c=Hs(c,l),Oe!==4&&(Oe=2),Rr===null?Rr=[n]:Rr.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,t&=-t,n.lanes|=t;var v=Qp(n,c,t);Du(n,v);break e;case 1:l=c;var p=n.type,g=n.stateNode;if(!(n.flags&128)&&(typeof p.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(zi===null||!zi.has(g)))){n.flags|=65536,t&=-t,n.lanes|=t;var w=Jp(n,l,t);Du(n,w);break e}}n=n.return}while(n!==null)}v_(i)}catch(M){t=M,Te===i&&i!==null&&(Te=i=i.return);continue}break}while(!0)}function __(){var e=wo.current;return wo.current=yo,e===null?yo:e}function bh(){(Oe===0||Oe===3||Oe===2)&&(Oe=4),Ke===null||!(ls&268435455)&&!(Yo&268435455)||Ni(Ke,Ge)}function bo(e,t){var i=le;le|=2;var s=__();(Ke!==e||Ge!==t)&&(ni=null,ts(e,t));do try{SS();break}catch(r){p_(e,r)}while(!0);if(oh(),le=i,wo.current=s,Te!==null)throw Error(H(261));return Ke=null,Ge=0,Oe}function SS(){for(;Te!==null;)m_(Te)}function yS(){for(;Te!==null&&!Kv();)m_(Te)}function m_(e){var t=S_(e.alternate,e,yt);e.memoizedProps=e.pendingProps,t===null?v_(e):Te=t,Sh.current=null}function v_(e){var t=e;do{var i=t.alternate;if(e=t.return,t.flags&32768){if(i=fS(i,t),i!==null){i.flags&=32767,Te=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Oe=6,Te=null;return}}else if(i=dS(i,t,yt),i!==null){Te=i;return}if(t=t.sibling,t!==null){Te=t;return}Te=t=e}while(t!==null);Oe===0&&(Oe=5)}function qi(e,t,i){var s=he,r=Tt.transition;try{Tt.transition=null,he=1,wS(e,t,i,s)}finally{Tt.transition=r,he=s}return null}function wS(e,t,i,s){do zs();while(Di!==null);if(le&6)throw Error(H(327));i=e.finishedWork;var r=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(H(177));e.callbackNode=null,e.callbackPriority=0;var n=i.lanes|i.childLanes;if(tg(e,n),e===Ke&&(Te=Ke=null,Ge=0),!(i.subtreeFlags&2064)&&!(i.flags&2064)||bn||(bn=!0,y_(ro,function(){return zs(),null})),n=(i.flags&15990)!==0,i.subtreeFlags&15990||n){n=Tt.transition,Tt.transition=null;var o=he;he=1;var l=le;le|=4,Sh.current=null,_S(e,i),u_(i,e),Fg(ga),oo=!!va,ga=va=null,e.current=i,mS(i),Vv(),le=l,he=o,Tt.transition=n}else e.current=i;if(bn&&(bn=!1,Di=e,xo=r),n=e.pendingLanes,n===0&&(zi=null),Xv(i.stateNode),mt(e,Me()),t!==null)for(s=e.onRecoverableError,i=0;i<t.length;i++)r=t[i],s(r.value,{componentStack:r.stack,digest:r.digest});if(Co)throw Co=!1,e=Aa,Aa=null,e;return xo&1&&e.tag!==0&&zs(),n=e.pendingLanes,n&1?e===Ia?Dr++:(Dr=0,Ia=e):Dr=0,Ui(),null}function zs(){if(Di!==null){var e=Qf(xo),t=Tt.transition,i=he;try{if(Tt.transition=null,he=16>e?16:e,Di===null)var s=!1;else{if(e=Di,Di=null,xo=0,le&6)throw Error(H(331));var r=le;for(le|=4,q=e.current;q!==null;){var n=q,o=n.child;if(q.flags&16){var l=n.deletions;if(l!==null){for(var c=0;c<l.length;c++){var a=l[c];for(q=a;q!==null;){var d=q;switch(d.tag){case 0:case 11:case 15:Nr(8,d,n)}var u=d.child;if(u!==null)u.return=d,q=u;else for(;q!==null;){d=q;var f=d.sibling,m=d.return;if(a_(d),d===a){q=null;break}if(f!==null){f.return=m,q=f;break}q=m}}}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)}}q=n}}if(n.subtreeFlags&2064&&o!==null)o.return=n,q=o;else e:for(;q!==null;){if(n=q,n.flags&2048)switch(n.tag){case 0:case 11:case 15:Nr(9,n,n.return)}var v=n.sibling;if(v!==null){v.return=n.return,q=v;break e}q=n.return}}var p=e.current;for(q=p;q!==null;){o=q;var g=o.child;if(o.subtreeFlags&2064&&g!==null)g.return=o,q=g;else e:for(o=p;q!==null;){if(l=q,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:qo(9,l)}}catch(M){Ne(l,l.return,M)}if(l===o){q=null;break e}var w=l.sibling;if(w!==null){w.return=l.return,q=w;break e}q=l.return}}if(le=r,Ui(),Zt&&typeof Zt.onPostCommitFiberRoot=="function")try{Zt.onPostCommitFiberRoot(Io,e)}catch{}s=!0}return s}finally{he=i,Tt.transition=t}}return!1}function Gu(e,t,i){t=Hs(i,t),t=Qp(e,t,1),e=ji(e,t,1),t=nt(),e!==null&&(Jr(e,1,t),mt(e,t))}function Ne(e,t,i){if(e.tag===3)Gu(e,e,i);else for(;t!==null;){if(t.tag===3){Gu(t,e,i);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(zi===null||!zi.has(s))){e=Hs(i,e),e=Jp(t,e,1),t=ji(t,e,1),e=nt(),t!==null&&(Jr(t,1,e),mt(t,e));break}}t=t.return}}function CS(e,t,i){var s=e.pingCache;s!==null&&s.delete(t),t=nt(),e.pingedLanes|=e.suspendedLanes&i,Ke===e&&(Ge&i)===i&&(Oe===4||Oe===3&&(Ge&130023424)===Ge&&500>Me()-wh?ts(e,0):yh|=i),mt(e,t)}function g_(e,t){t===0&&(e.mode&1?(t=pn,pn<<=1,!(pn&130023424)&&(pn=4194304)):t=1);var i=nt();e=pi(e,t),e!==null&&(Jr(e,t,i),mt(e,i))}function xS(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),g_(e,i)}function bS(e,t){var i=0;switch(e.tag){case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(i=r.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(H(314))}s!==null&&s.delete(t),g_(e,i)}var S_;S_=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||pt.current)ft=!0;else{if(!(e.lanes&i)&&!(t.flags&128))return ft=!1,uS(e,t,i);ft=!!(e.flags&131072)}else ft=!1,Se&&t.flags&1048576&&xp(t,po,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;Wn(e,t),e=t.pendingProps;var r=As(t,it.current);js(t,i),r=ph(null,t,s,e,r,i);var n=_h();return t.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_t(s)?(n=!0,uo(t)):n=!1,t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,ch(t),r.updater=Vo,t.stateNode=r,r._reactInternals=t,Na(t,s,e,i),t=Ma(null,t,s,!0,n,i)):(t.tag=0,Se&&n&&ih(t),rt(null,t,r,i),t=t.child),t;case 16:s=t.elementType;e:{switch(Wn(e,t),e=t.pendingProps,r=s._init,s=r(s._payload),t.type=s,r=t.tag=ES(s),e=It(s,e),r){case 0:t=Da(null,t,s,e,i);break e;case 1:t=$u(null,t,s,e,i);break e;case 11:t=Au(null,t,s,e,i);break e;case 14:t=Iu(null,t,s,It(s.type,e),i);break e}throw Error(H(306,s,""))}return t;case 0:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:It(s,r),Da(e,t,s,r,i);case 1:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:It(s,r),$u(e,t,s,r,i);case 3:e:{if(i_(t),e===null)throw Error(H(387));s=t.pendingProps,n=t.memoizedState,r=n.element,Dp(e,t),vo(t,s,null,i);var o=t.memoizedState;if(s=o.element,n.isDehydrated)if(n={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){r=Hs(Error(H(423)),t),t=Fu(e,t,s,i,r);break e}else if(s!==r){r=Hs(Error(H(424)),t),t=Fu(e,t,s,i,r);break e}else for(wt=Bi(t.stateNode.containerInfo.firstChild),Ct=t,Se=!0,Ft=null,i=Np(t,null,s,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Is(),s===r){t=_i(e,t,i);break e}rt(e,t,s,i)}t=t.child}return t;case 5:return Mp(t),e===null&&ba(t),s=t.type,r=t.pendingProps,n=e!==null?e.memoizedProps:null,o=r.children,Sa(s,r)?o=null:n!==null&&Sa(s,n)&&(t.flags|=32),t_(e,t),rt(e,t,o,i),t.child;case 6:return e===null&&ba(t),null;case 13:return s_(e,t,i);case 4:return hh(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=$s(t,null,s,i):rt(e,t,s,i),t.child;case 11:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:It(s,r),Au(e,t,s,r,i);case 7:return rt(e,t,t.pendingProps,i),t.child;case 8:return rt(e,t,t.pendingProps.children,i),t.child;case 12:return rt(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(s=t.type._context,r=t.pendingProps,n=t.memoizedProps,o=r.value,_e(_o,s._currentValue),s._currentValue=o,n!==null)if(Ut(n.value,o)){if(n.children===r.children&&!pt.current){t=_i(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 c=l.firstContext;c!==null;){if(c.context===s){if(n.tag===1){c=hi(-1,i&-i),c.tag=2;var a=n.updateQueue;if(a!==null){a=a.shared;var d=a.pending;d===null?c.next=c:(c.next=d.next,d.next=c),a.pending=c}}n.lanes|=i,c=n.alternate,c!==null&&(c.lanes|=i),ka(n.return,i,t),l.lanes|=i;break}c=c.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(H(341));o.lanes|=i,l=o.alternate,l!==null&&(l.lanes|=i),ka(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}rt(e,t,r.children,i),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps.children,js(t,i),r=jt(r),s=s(r),t.flags|=1,rt(e,t,s,i),t.child;case 14:return s=t.type,r=It(s,t.pendingProps),r=It(s.type,r),Iu(e,t,s,r,i);case 15:return Zp(e,t,t.type,t.pendingProps,i);case 17:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:It(s,r),Wn(e,t),t.tag=1,_t(s)?(e=!0,uo(t)):e=!1,js(t,i),Gp(t,s,r),Na(t,s,r,i),Ma(null,t,s,!0,e,i);case 19:return r_(e,t,i);case 22:return e_(e,t,i)}throw Error(H(156,t.tag))};function y_(e,t){return qf(e,t)}function kS(e,t,i,s){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pt(e,t,i,s){return new kS(e,t,i,s)}function kh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ES(e){if(typeof e=="function")return kh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Uc)return 11;if(e===Kc)return 14}return 2}function Ai(e,t){var i=e.alternate;return i===null?(i=Pt(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 Vn(e,t,i,s,r,n){var o=2;if(s=e,typeof e=="function")kh(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ss:return is(i.children,r,n,t);case Wc:o=8,r|=8;break;case Ql:return e=Pt(12,i,t,r|2),e.elementType=Ql,e.lanes=n,e;case Jl:return e=Pt(13,i,t,r),e.elementType=Jl,e.lanes=n,e;case Zl:return e=Pt(19,i,t,r),e.elementType=Zl,e.lanes=n,e;case Mf:return Xo(i,r,n,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Rf:o=10;break e;case Df:o=9;break e;case Uc:o=11;break e;case Kc:o=14;break e;case xi:o=16,s=null;break e}throw Error(H(130,e==null?e:typeof e,""))}return t=Pt(o,i,t,r),t.elementType=e,t.type=s,t.lanes=n,t}function is(e,t,i,s){return e=Pt(7,e,s,t),e.lanes=i,e}function Xo(e,t,i,s){return e=Pt(22,e,s,t),e.elementType=Mf,e.lanes=i,e.stateNode={isHidden:!1},e}function Pl(e,t,i){return e=Pt(6,e,null,t),e.lanes=i,e}function Tl(e,t,i){return t=Pt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function NS(e,t,i,s,r){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=fl(0),this.expirationTimes=fl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fl(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Eh(e,t,i,s,r,n,o,l,c){return e=new NS(e,t,i,l,c),t===1?(t=1,n===!0&&(t|=8)):t=0,n=Pt(3,null,null,t),e.current=n,n.stateNode=e,n.memoizedState={element:s,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},ch(n),e}function RS(e,t,i){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:gs,key:s==null?null:""+s,children:e,containerInfo:t,implementation:i}}function w_(e){if(!e)return Fi;e=e._reactInternals;e:{if(ds(e)!==e||e.tag!==1)throw Error(H(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(_t(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(H(171))}if(e.tag===1){var i=e.type;if(_t(i))return wp(e,i,t)}return t}function C_(e,t,i,s,r,n,o,l,c){return e=Eh(i,s,!0,e,r,n,o,l,c),e.context=w_(null),i=e.current,s=nt(),r=Oi(i),n=hi(s,r),n.callback=t??null,ji(i,n,r),e.current.lanes=r,Jr(e,r,s),mt(e,s),e}function Go(e,t,i,s){var r=t.current,n=nt(),o=Oi(r);return i=w_(i),t.context===null?t.context=i:t.pendingContext=i,t=hi(n,o),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=ji(r,t,o),e!==null&&(Wt(e,r,o,n),$n(e,r,o)),o}function ko(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 Qu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Nh(e,t){Qu(e,t),(e=e.alternate)&&Qu(e,t)}function DS(){return null}var x_=typeof reportError=="function"?reportError:function(e){console.error(e)};function Rh(e){this._internalRoot=e}Qo.prototype.render=Rh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(H(409));Go(e,t,null,null)};Qo.prototype.unmount=Rh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;as(function(){Go(null,e,null,null)}),t[fi]=null}};function Qo(e){this._internalRoot=e}Qo.prototype.unstable_scheduleHydration=function(e){if(e){var t=ep();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Ei.length&&t!==0&&t<Ei[i].priority;i++);Ei.splice(i,0,e),i===0&&ip(e)}};function Dh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Jo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Ju(){}function MS(e,t,i,s,r){if(r){if(typeof s=="function"){var n=s;s=function(){var a=ko(o);n.call(a)}}var o=C_(t,s,e,0,null,!1,!1,"",Ju);return e._reactRootContainer=o,e[fi]=o.current,Ir(e.nodeType===8?e.parentNode:e),as(),o}for(;r=e.lastChild;)e.removeChild(r);if(typeof s=="function"){var l=s;s=function(){var a=ko(c);l.call(a)}}var c=Eh(e,0,!1,null,null,!1,!1,"",Ju);return e._reactRootContainer=c,e[fi]=c.current,Ir(e.nodeType===8?e.parentNode:e),as(function(){Go(t,c,i,s)}),c}function Zo(e,t,i,s,r){var n=i._reactRootContainer;if(n){var o=n;if(typeof r=="function"){var l=r;r=function(){var c=ko(o);l.call(c)}}Go(t,o,e,r)}else o=MS(i,t,e,r,s);return ko(o)}Jf=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=fr(t.pendingLanes);i!==0&&(Yc(t,i|1),mt(t,Me()),!(le&6)&&(Ws=Me()+500,Ui()))}break;case 13:as(function(){var s=pi(e,1);if(s!==null){var r=nt();Wt(s,e,1,r)}}),Nh(e,1)}};Xc=function(e){if(e.tag===13){var t=pi(e,134217728);if(t!==null){var i=nt();Wt(t,e,134217728,i)}Nh(e,134217728)}};Zf=function(e){if(e.tag===13){var t=Oi(e),i=pi(e,t);if(i!==null){var s=nt();Wt(i,e,t,s)}Nh(e,t)}};ep=function(){return he};tp=function(e,t){var i=he;try{return he=e,t()}finally{he=i}};ca=function(e,t,i){switch(t){case"input":if(ia(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 s=i[t];if(s!==e&&s.form===e.form){var r=Wo(s);if(!r)throw Error(H(90));Pf(s),ia(s,r)}}}break;case"textarea":Bf(e,i);break;case"select":t=i.value,t!=null&&Ls(e,!!i.multiple,t,!1)}};Ff=Ch;Hf=as;var LS={usingClientEntryPoint:!1,Events:[en,xs,Wo,If,$f,Ch]},rr={findFiberByHostInstance:Qi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},PS={bundleType:rr.bundleType,version:rr.version,rendererPackageName:rr.rendererPackageName,rendererConfig:rr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:mi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Kf(e),e===null?null:e.stateNode},findFiberByHostInstance:rr.findFiberByHostInstance||DS,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 kn=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!kn.isDisabled&&kn.supportsFiber)try{Io=kn.inject(PS),Zt=kn}catch{}}kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=LS;kt.createPortal=function(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Dh(t))throw Error(H(200));return RS(e,t,null,i)};kt.createRoot=function(e,t){if(!Dh(e))throw Error(H(299));var i=!1,s="",r=x_;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=Eh(e,1,!1,null,null,i,!1,s,r),e[fi]=t.current,Ir(e.nodeType===8?e.parentNode:e),new Rh(t)};kt.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(H(188)):(e=Object.keys(e).join(","),Error(H(268,e)));return e=Kf(t),e=e===null?null:e.stateNode,e};kt.flushSync=function(e){return as(e)};kt.hydrate=function(e,t,i){if(!Jo(t))throw Error(H(200));return Zo(null,e,t,!0,i)};kt.hydrateRoot=function(e,t,i){if(!Dh(e))throw Error(H(405));var s=i!=null&&i.hydratedSources||null,r=!1,n="",o=x_;if(i!=null&&(i.unstable_strictMode===!0&&(r=!0),i.identifierPrefix!==void 0&&(n=i.identifierPrefix),i.onRecoverableError!==void 0&&(o=i.onRecoverableError)),t=C_(t,null,e,1,i??null,r,!1,n,o),e[fi]=t.current,Ir(e),s)for(e=0;e<s.length;e++)i=s[e],r=i._getVersion,r=r(i._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[i,r]:t.mutableSourceEagerHydrationData.push(i,r);return new Qo(t)};kt.render=function(e,t,i){if(!Jo(t))throw Error(H(200));return Zo(null,e,t,!1,i)};kt.unmountComponentAtNode=function(e){if(!Jo(e))throw Error(H(40));return e._reactRootContainer?(as(function(){Zo(null,null,e,!1,function(){e._reactRootContainer=null,e[fi]=null})}),!0):!1};kt.unstable_batchedUpdates=Ch;kt.unstable_renderSubtreeIntoContainer=function(e,t,i,s){if(!Jo(i))throw Error(H(200));if(e==null||e._reactInternals===void 0)throw Error(H(38));return Zo(e,t,i,!1,s)};kt.version="18.3.1-next-f1338f8080-20240426";function b_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(b_)}catch(e){console.error(e)}}b_(),bf.exports=kt;var TS=bf.exports,Zu=TS;Xl.createRoot=Zu.createRoot,Xl.hydrateRoot=Zu.hydrateRoot;function Ue(e,t,i={}){return fetch(e,{...i,headers:{...i.headers||{},Authorization:`Bearer ${t}`}})}const k_=e=>`nc_seen_${e}`;async function ae(e,t,i={}){const s=await Ue(e,t,{method:i.method||"GET",headers:{"content-type":"application/json"},body:i.body?JSON.stringify(i.body):void 0}),r=await s.json().catch(()=>({}));if(!s.ok){const n=new Error(r.error||`HTTP ${s.status}`);throw n.status=s.status,n.data=r,n}return r}const el=e=>ae("/api/fleet/status",e),E_=(e,t)=>ae("/api/fleet/up",e,{method:"POST",body:t}),N_=(e,t)=>ae("/api/fleet/down",e,{method:"POST",body:t}),ed=(e,t)=>ae("/api/fleet/restart",e,{method:"POST",body:{cell:t}}),BS=e=>ae("/api/fleet/definitions",e),jS=(e,t)=>ae("/api/fleet/define-engine",e,{method:"POST",body:{def:t}}),zS=(e,t,i,s)=>ae("/api/fleet/edit-engine",e,{method:"POST",body:{id:t,patch:i,envChanges:s}}),OS=(e,t)=>ae("/api/fleet/remove-engine",e,{method:"POST",body:{id:t}}),AS=(e,t)=>ae("/api/fleet/define-cell",e,{method:"POST",body:{def:t}}),IS=(e,t,i)=>ae("/api/fleet/edit-cell",e,{method:"POST",body:{id:t,patch:i}}),$S=(e,t,i=!1)=>ae("/api/fleet/remove-cell",e,{method:"POST",body:{id:t,stop:i}}),R_=(e,t)=>ae("/api/sessions",e,{method:"POST",body:t}),D_=(e,t)=>ae(`/api/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),M_=(e,t)=>ae(`/api/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),L_=e=>ae("/api/settings",e),P_=e=>ae("/api/nodes",e),FS=(e,t)=>ae(`/node/${encodeURIComponent(t)}/api/sessions`,e),Ha=(e,t)=>ae("/api/settings/config",e,{method:"POST",body:t}),HS=e=>ae("/api/settings/token/rotate",e,{method:"POST"}),T_=(e,t)=>ae("/api/settings/nodes",e,{method:"POST",body:t}),WS=(e,t)=>ae(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),US=(e,t,i)=>ae(`/api/settings/nodes/${encodeURIComponent(t)}/${i}`,e,{method:"POST"}),B_=(e,t)=>ae("/api/settings/node-role",e,{method:"POST",body:t}),KS=e=>ae("/api/settings/service/regenerate",e,{method:"POST"}),VS=(e,t=!0)=>ae(`/api/asks${t?"?open=1":""}`,e),qS=(e,t,i)=>ae(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:i}}),Bl=e=>ae("/api/decks",e),td=(e,t)=>ae("/api/decks",e,{method:"POST",body:{name:t}}),En=(e,t,i,s)=>ae(`/api/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:i,expectedRevision:s}}),YS=(e,t,i,s)=>ae(`/api/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:i,expectedRevision:s}}),XS=(e,t,i)=>ae(`/api/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:i}}),GS={power:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 3v8"}),h.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:h.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:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),h.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),h.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),h.jsx("path",{d:"M12 18v3"})]}),enter:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),h.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),h.jsx("path",{d:"M22 2 11 13"})]}),trash:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M4 7h16"}),h.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),h.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),h.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:h.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),h.jsx("polyline",{points:"21 3 21 8 16 8"})]}),upload:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 16V5"}),h.jsx("polyline",{points:"8 9 12 5 16 9"}),h.jsx("path",{d:"M5 20h14"})]}),chevronLeft:h.jsx("polyline",{points:"14 6 8 12 14 18"}),attach:h.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:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:h.jsxs(h.Fragment,{children:[h.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"}),h.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),h.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),h.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"M21 21l-4.35-4.35"}),h.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"M21 21l-4.35-4.35"}),h.jsx("path",{d:"M8 11h6"})]}),gear:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),copy:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),h.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})};function fe({name:e,size:t=20}){return h.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:GS[e]||null})}const j_="nc_pins";function z_(){try{const e=JSON.parse(localStorage.getItem(j_));return Array.isArray(e)?e:[]}catch{return[]}}function O_(e,t){const i=e.includes(t)?e.filter(s=>s!==t):[...e,t];try{localStorage.setItem(j_,JSON.stringify(i))}catch{}return i}function _r(e,t,i){const s=e.indexOf(t);return[s===-1?1e9:s,-(i||0)]}function Wa(e,t){return e[0]-t[0]||e[1]-t[1]}const Mh=["it","en","es"];function QS(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return Mh.includes(t)?t:"en"}catch{return"en"}}const qn=QS(),A_="nc_lang",Ua="nc-lang";function I_(){return typeof localStorage<"u"?localStorage:null}const Nn={it:{"update-available":"nuova versione {v} disponibile","install-version-mismatch":"installazione incompleta: frontend e server non coincidono (v{v})",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",model:"Modello","model-default":"Modello predefinito del provider","model-remembered":"Ultimo modello usato con questo 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",decks:"deck","new-deck":"nuovo deck","deck-name":"nome deck","open-deck-window":"apri in una nuova finestra","deck-current":"questo deck (finestra corrente)","rename-deck":"rinomina deck","delete-deck":"elimina deck","delete-deck-confirm":'Eliminare il deck "{name}"?',"send-to-deck":"manda al deck…","deck-autosave":"salvataggio automatico",saving:"salvataggio…",saved:"salvato","popup-blocked":"popup bloccato: apri qui","select-drag":"trascina per selezionare","copy-manual":"seleziona e copia manualmente","toggle-sidebar":"mostra/nascondi la barra laterale",settings:"impostazioni","tab-roles":"ruoli","tab-nodes":"nodi","tab-system":"sistema","tab-fleet":"flotta","fleet-editor-unavailable":"Editor disponibile solo con il provider fleet builtin.","fleet-managed":"gestito da NexusCrew","fleet-custom":"comando personalizzato","fleet-managed-help":"Client, provider e avvio sono gestiti internamente; i segreti non vengono mostrati.","fleet-model-default":"modello predefinito (opzionale)","fleet-ready":"pronto","fleet-not-ready":"non configurato","fleet-engines":"Engine","fleet-cells":"Celle / sessioni cloud",edit:"modifica",save:"salva",label:"etichetta","command-path":"path assoluto del comando","args-lines":"argomenti, uno per riga","env-write-only":"I valori env sono write-only: vuoto mantiene il valore esistente.","fleet-new-engine":"Nuovo engine","fleet-new-cell":"Nuova cella","fleet-saved":"Definizione salvata.","fleet-restart-confirm":"Modifica salvata. Riavviare ora: {cells}?","fleet-remove-engine":'Eliminare l’engine "{id}"?',"fleet-remove-cell":'Eliminare la cella "{id}"? Se è attiva verrà prima fermata.',"settings-readonly":"READONLY attivo: le modifiche sono bloccate dal server (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"questa macchina guarda altri nodi via tunnel SSH","role-node":"nodo (raggiungibile)","role-node-desc":"questa macchina si pubblica via reverse tunnel su un rendezvous","rendezvous-ssh":"rendezvous ssh (user@host)","published-port":"porta pubblicata (opzionale)","no-nodes":"nessun nodo remoto configurato","node-add":"aggiungi nodo","node-name-ph":"nome (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"porta remota (opz.)","node-remove-confirm":'Rimuovere il nodo "{name}"?',"node-test":"test","tunnel-start":"avvia tunnel","tunnel-stop":"ferma tunnel","tunnel-restart":"riavvia tunnel","tunnel-up":"tunnel su","tunnel-down":"tunnel giù","authorized-keys-hint":"incolla questa riga in ~/.ssh/authorized_keys sull'host remoto:",copy:"copia",copied:"copiato","token-rotate":"ruota token","token-rotate-explain":"Il nuovo token NON verrà mostrato: recuperalo con `nexuscrew url`. La sessione si invalida al riavvio del service.","service-regenerate":"rigenera service","service-installed":"service installato","service-missing":"service non installato","service-active":"attivo","service-inactive":"non attivo",confirm:"conferma",add:"aggiungi",enable:"attiva","wizard-title":"benvenuto in NexusCrew","wizard-skip":"configura dopo dai settings","wizard-step-roles":"ruoli di questa installazione","wizard-step-node":"primo nodo remoto (opzionale)","wizard-step-rendezvous":"rendezvous per il ruolo nodo","wizard-done":"tutto pronto","wizard-done-desc":"setup completato — puoi cambiare tutto dai settings",next:"continua",back:"indietro",skip:"salta",finish:"fine","err-node-name":"nome non valido (a-z, 0-9, -, max 32)","err-ssh":"ssh non valido (atteso user@host)","err-port":"porta non valida (1–65535)","err-rendezvous-required":"serve un rendezvous ssh (user@host) per attivare il ruolo nodo","node-sessions":"{n} sessioni","tunnel-down-since":"tunnel giù da {t}","node-unreachable":"nodo non raggiungibile","asks-title":"domande dalle celle","ask-reply-ph":"scrivi la risposta…","push-enable":"attiva notifiche push","push-disable":"disattiva notifiche push","push-on":"push attive su questo device","push-off":"push non attive","push-denied":"permesso notifiche negato dal browser","push-unsupported":"push non supportate in questo browser"},en:{"update-available":"new version {v} available","install-version-mismatch":"incomplete installation: frontend and server do not match (v{v})",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",model:"Model","model-default":"Provider default model","model-remembered":"Last model used with this 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",decks:"decks","new-deck":"new deck","deck-name":"deck name","open-deck-window":"open in a new window","deck-current":"this deck (current window)","rename-deck":"rename deck","delete-deck":"delete deck","delete-deck-confirm":'Delete deck "{name}"?',"send-to-deck":"send to deck…","deck-autosave":"autosave",saving:"saving…",saved:"saved","popup-blocked":"popup blocked: open here","select-drag":"drag to select","copy-manual":"select and copy manually","toggle-sidebar":"show/hide the sidebar",settings:"settings","tab-roles":"roles","tab-nodes":"nodes","tab-system":"system","tab-fleet":"fleet","fleet-editor-unavailable":"The editor is available only with the builtin fleet provider.","fleet-managed":"managed by NexusCrew","fleet-custom":"custom command","fleet-managed-help":"Client, provider and launch are managed internally; secrets are never displayed.","fleet-model-default":"default model (optional)","fleet-ready":"ready","fleet-not-ready":"not configured","fleet-engines":"Engines","fleet-cells":"Cells / cloud sessions",edit:"edit",save:"save",label:"label","command-path":"absolute command path","args-lines":"arguments, one per line","env-write-only":"Environment values are write-only: blank keeps the existing value.","fleet-new-engine":"New engine","fleet-new-cell":"New cell","fleet-saved":"Definition saved.","fleet-restart-confirm":"Change saved. Restart now: {cells}?","fleet-remove-engine":'Delete engine "{id}"?',"fleet-remove-cell":'Delete cell "{id}"? If active it will be stopped first.',"settings-readonly":"READONLY active: changes are blocked by the server (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"this machine watches other nodes via SSH tunnels","role-node":"node (reachable)","role-node-desc":"this machine publishes itself via reverse tunnel to a rendezvous","rendezvous-ssh":"rendezvous ssh (user@host)","published-port":"published port (optional)","no-nodes":"no remote nodes configured","node-add":"add node","node-name-ph":"name (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"remote port (opt.)","node-remove-confirm":'Remove node "{name}"?',"node-test":"test","tunnel-start":"start tunnel","tunnel-stop":"stop tunnel","tunnel-restart":"restart tunnel","tunnel-up":"tunnel up","tunnel-down":"tunnel down","authorized-keys-hint":"paste this line into ~/.ssh/authorized_keys on the remote host:",copy:"copy",copied:"copied","token-rotate":"rotate token","token-rotate-explain":"The new token will NOT be shown: retrieve it with `nexuscrew url`. The session is invalidated when the service restarts.","service-regenerate":"regenerate service","service-installed":"service installed","service-missing":"service not installed","service-active":"active","service-inactive":"not active",confirm:"confirm",add:"add",enable:"enable","wizard-title":"welcome to NexusCrew","wizard-skip":"configure later from settings","wizard-step-roles":"roles of this install","wizard-step-node":"first remote node (optional)","wizard-step-rendezvous":"rendezvous for the node role","wizard-done":"all set","wizard-done-desc":"setup complete — you can change everything from settings",next:"continue",back:"back",skip:"skip",finish:"finish","err-node-name":"invalid name (a-z, 0-9, -, max 32)","err-ssh":"invalid ssh (expected user@host)","err-port":"invalid port (1–65535)","err-rendezvous-required":"a rendezvous ssh (user@host) is required to enable the node role","node-sessions":"{n} sessions","tunnel-down-since":"tunnel down for {t}","node-unreachable":"node unreachable","asks-title":"questions from the cells","ask-reply-ph":"type your answer…","push-enable":"enable push notifications","push-disable":"disable push notifications","push-on":"push active on this device","push-off":"push not active","push-denied":"notification permission denied by the browser","push-unsupported":"push not supported in this browser"},es:{"update-available":"nueva versión {v} disponible","install-version-mismatch":"instalación incompleta: frontend y servidor no coinciden (v{v})",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",model:"Modelo","model-default":"Modelo predeterminado del proveedor","model-remembered":"Último modelo usado con este 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",decks:"decks","new-deck":"nuevo deck","deck-name":"nombre del deck","open-deck-window":"abrir en una ventana nueva","deck-current":"este deck (ventana actual)","rename-deck":"renombrar deck","delete-deck":"eliminar deck","delete-deck-confirm":"¿Eliminar el deck «{name}»?","send-to-deck":"enviar al deck…","deck-autosave":"guardado automático",saving:"guardando…",saved:"guardado","popup-blocked":"ventana bloqueada: abrir aquí","select-drag":"arrastra para seleccionar","copy-manual":"selecciona y copia manualmente","toggle-sidebar":"mostrar/ocultar la barra lateral",settings:"ajustes","tab-roles":"roles","tab-nodes":"nodos","tab-system":"sistema","tab-fleet":"flota","fleet-editor-unavailable":"El editor solo está disponible con el proveedor builtin.","fleet-managed":"gestionado por NexusCrew","fleet-custom":"comando personalizado","fleet-managed-help":"Cliente, proveedor e inicio se gestionan internamente; los secretos nunca se muestran.","fleet-model-default":"modelo predeterminado (opcional)","fleet-ready":"listo","fleet-not-ready":"no configurado","fleet-engines":"Motores","fleet-cells":"Celdas / sesiones cloud",edit:"editar",save:"guardar",label:"etiqueta","command-path":"ruta absoluta del comando","args-lines":"argumentos, uno por línea","env-write-only":"Los valores env son de solo escritura: vacío conserva el valor existente.","fleet-new-engine":"Nuevo motor","fleet-new-cell":"Nueva celda","fleet-saved":"Definición guardada.","fleet-restart-confirm":"Cambio guardado. ¿Reiniciar ahora: {cells}?","fleet-remove-engine":'¿Eliminar el motor "{id}"?',"fleet-remove-cell":'¿Eliminar la celda "{id}"? Si está activa se detendrá primero.',"settings-readonly":"READONLY activo: los cambios están bloqueados por el servidor (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"esta máquina observa otros nodos vía túneles SSH","role-node":"nodo (alcanzable)","role-node-desc":"esta máquina se publica vía túnel inverso hacia un rendezvous","rendezvous-ssh":"rendezvous ssh (user@host)","published-port":"puerto publicado (opcional)","no-nodes":"sin nodos remotos configurados","node-add":"añadir nodo","node-name-ph":"nombre (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"puerto remoto (opc.)","node-remove-confirm":"¿Eliminar el nodo «{name}»?","node-test":"test","tunnel-start":"iniciar túnel","tunnel-stop":"detener túnel","tunnel-restart":"reiniciar túnel","tunnel-up":"túnel activo","tunnel-down":"túnel caído","authorized-keys-hint":"pega esta línea en ~/.ssh/authorized_keys del host remoto:",copy:"copiar",copied:"copiado","token-rotate":"rotar token","token-rotate-explain":"El nuevo token NO se mostrará: recupéralo con `nexuscrew url`. La sesión se invalida al reiniciar el service.","service-regenerate":"regenerar service","service-installed":"service instalado","service-missing":"service no instalado","service-active":"activo","service-inactive":"no activo",confirm:"confirmar",add:"añadir",enable:"activar","wizard-title":"bienvenido a NexusCrew","wizard-skip":"configura después desde ajustes","wizard-step-roles":"roles de esta instalación","wizard-step-node":"primer nodo remoto (opcional)","wizard-step-rendezvous":"rendezvous para el rol nodo","wizard-done":"todo listo","wizard-done-desc":"configuración completa — puedes cambiarlo todo desde ajustes",next:"continuar",back:"atrás",skip:"omitir",finish:"terminar","err-node-name":"nombre inválido (a-z, 0-9, -, máx 32)","err-ssh":"ssh inválido (se espera user@host)","err-port":"puerto inválido (1–65535)","err-rendezvous-required":"se necesita un rendezvous ssh (user@host) para activar el rol nodo","node-sessions":"{n} sesiones","tunnel-down-since":"túnel caído desde hace {t}","node-unreachable":"nodo inalcanzable","asks-title":"preguntas de las celdas","ask-reply-ph":"escribe la respuesta…","push-enable":"activar notificaciones push","push-disable":"desactivar notificaciones push","push-on":"push activas en este dispositivo","push-off":"push no activas","push-denied":"permiso de notificaciones denegado por el navegador","push-unsupported":"push no soportadas en este navegador"}};function Ka(){const e=I_(),t=e?e.getItem(A_):null;return Mh.includes(t)?t:qn}function JS(e){const t=I_();if(t)try{t.setItem(A_,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(Ua))}function y(e){const t=Ka(),i=Nn[t]||Nn[qn];return Object.prototype.hasOwnProperty.call(i,e)?i[e]:Object.prototype.hasOwnProperty.call(Nn[qn],e)?Nn[qn][e]:e}function ZS(e){return typeof window>"u"?()=>{}:(window.addEventListener(Ua,e),()=>window.removeEventListener(Ua,e))}const $_=Mh;function vt(){return[E.useSyncExternalStore(ZS,Ka,Ka),JS]}function F_({cell:e,engines:t=[],onConfirm:i,onClose:s}){var g;vt();const r=!!(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]=E.useState((e==null?void 0:e.engine)||n[0].id),c=n.find(w=>w.id===o),a=w=>{var N,x;const M=n.find(C=>C.id===w);return((N=e==null?void 0:e.models)==null?void 0:N[w])||((e==null?void 0:e.engine)===w?e==null?void 0:e.model:"")||(M==null?void 0:M.model)||((x=M==null?void 0:M.models)==null?void 0:x[0])||""},[d,u]=E.useState(()=>a((e==null?void 0:e.engine)||n[0].id)),[f,m]=E.useState((e==null?void 0:e.boot)??!0),[_,S]=E.useState(!1),[k,v]=E.useState(null);async function p(w){w.preventDefault(),S(!0),v(null);try{r?await i({action:"down",boot:f}):await i({action:"up",engine:o,model:d,boot:f}),s()}catch(M){v(String(M&&M.message||M)),S(!1)}}return h.jsx("div",{className:"nc-sheet-overlay",onClick:s,children:h.jsxs("form",{className:"nc-sheet",onClick:w=>w.stopPropagation(),onSubmit:p,children:[h.jsxs("div",{className:"nc-sheet-head",children:[h.jsx("b",{children:e==null?void 0:e.cell}),h.jsx("span",{className:"nc-sheet-state",children:y(r?"state-on":"state-off")})]}),r?h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:f,onChange:w=>m(w.target.checked)}),y("remove-boot")]}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"nc-sheet-label",children:y("engine")}),h.jsx("div",{className:"nc-engines",children:n.map(w=>h.jsxs("label",{className:`nc-engine${o===w.id?" sel":""}`,children:[h.jsx("input",{type:"radio",name:"ps-engine",checked:o===w.id,onChange:()=>{l(w.id),u(a(w.id))}}),w.label,w.label.toLowerCase()!==w.id.toLowerCase()&&h.jsxs("small",{className:"nc-engine-id",children:[" (",w.id,")"]})]},w.id))}),c&&(c.models||[]).length>0&&h.jsxs("label",{className:"nc-field",children:[h.jsx("span",{children:y("model")}),h.jsx("select",{value:d,onChange:w=>u(w.target.value),children:c.models.map(w=>h.jsx("option",{value:w,children:w},w))}),h.jsx("small",{children:(g=e==null?void 0:e.models)!=null&&g[o]?y("model-remembered"):y("model-default")})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:f,onChange:w=>m(w.target.checked)}),y("boot-persist")]}),c&&!c.rc&&h.jsx("div",{className:"nc-note",children:y("no-remote-control")})]}),k&&h.jsx("div",{className:"nc-err",children:k}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:s,disabled:_,children:y("cancel")}),h.jsx("button",{type:"submit",className:"nc-btn primary",disabled:_,children:y(r?"power-off":"power-on")})]})]})})}const ey=/^[\w.-]{1,64}$/;function H_({presets:e=["shell"],token:t,onCreate:i,onClose:s}){vt();const[r,n]=E.useState(""),[o,l]=E.useState("~"),[c,a]=E.useState(e[0]||"shell"),[d,u]=E.useState(!1),[f,m]=E.useState(null),[_,S]=E.useState(null),[k,v]=E.useState(null),p=ey.test(r)&&!r.startsWith("-");async function g(M){v(null);try{const N=await M_(t,M);S(N),l(N.path)}catch(N){v(String(N&&N.message||N))}}async function w(M){if(M.preventDefault(),!!p){u(!0),m(null);try{await i({name:r,cwd:o==="~"?"":o,preset:c}),s()}catch(N){m(String(N&&N.message||N)),u(!1)}}}return h.jsx("div",{className:"nc-sheet-overlay",onClick:s,children:h.jsxs("form",{className:"nc-sheet",onClick:M=>M.stopPropagation(),onSubmit:w,children:[h.jsx("div",{className:"nc-sheet-head",children:h.jsx("b",{children:y("new-session")})}),h.jsxs("label",{className:"nc-field",children:[y("name"),h.jsx("input",{value:r,onChange:M=>n(M.target.value),autoFocus:!0,placeholder:"worker-1"})]}),r&&!p&&h.jsx("div",{className:"nc-err",children:y("name-invalid")}),h.jsxs("label",{className:"nc-field",children:[y("cwd"),h.jsxs("div",{className:"nc-cwd-row",children:[h.jsx("input",{value:o,onChange:M=>l(M.target.value),placeholder:"~"}),t&&h.jsx("button",{type:"button",className:"nc-btn ghost nc-cwd-browse",onClick:()=>_?S(null):g(o==="~"?"":o),children:y("browse")})]})]}),_&&h.jsxs("div",{className:"nc-fs",onMouseDown:M=>M.stopPropagation(),children:[h.jsx("div",{className:"nc-fs-path",title:_.path,children:_.path}),h.jsxs("div",{className:"nc-fs-list",children:[h.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:()=>g(_.home),children:["⌂ ",y("fs-home")]}),_.parent&&h.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:()=>g(_.parent),children:["↑ ",y("fs-parent")]}),_.dirs.map(M=>h.jsxs("button",{type:"button",className:"nc-fs-item",onClick:()=>g(`${_.path.replace(/\/$/,"")}/${M}`),children:["📁 ",M]},M)),_.dirs.length===0&&h.jsx("div",{className:"nc-fs-empty",children:"—"})]}),k&&h.jsx("div",{className:"nc-err",children:k})]}),h.jsxs("label",{className:"nc-field",children:[y("preset"),h.jsx("select",{value:c,onChange:M=>a(M.target.value),children:e.map(M=>h.jsx("option",{value:M,children:M},M))})]}),f&&h.jsx("div",{className:"nc-err",children:f}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:s,disabled:d,children:y("cancel")}),h.jsx("button",{type:"submit",className:"nc-btn primary",disabled:d||!p,children:y("create")})]})]})})}const ty=/^[a-z0-9-]{1,32}$/;function iy(e,t,i){const s={};for(const r of Array.isArray(t)?t:[]){if(!r||typeof r.name!="string")continue;r.tunnel&&r.tunnel.status==="up"||(s[r.name]=e&&e[r.name]||i)}return s}function sy({nodes:e,remote:t,down:i}={}){const s=[];for(const r of Array.isArray(e)?e:[]){if(!r||typeof r.name!="string"||!ty.test(r.name))continue;if(!(r.tunnel&&r.tunnel.status==="up")){s.push({name:r.name,status:"down",sessions:[],downSince:i&&i[r.name]||null});continue}const o=t&&t[r.name]||null;if(!o||o.error||!Array.isArray(o.sessions)){s.push({name:r.name,status:"unreachable",sessions:[]});continue}const l=o.sessions.filter(c=>c&&typeof c.name=="string"&&c.name).map(c=>({...c,node:r.name,key:`${r.name}:${c.name}`}));s.push({name:r.name,status:"up",sessions:l})}return s.sort((r,n)=>r.name.localeCompare(n.name))}const ry=4e3;function W_(e,t=!0){const[i,s]=E.useState([]),r=E.useRef({});return E.useEffect(()=>{if(!t||!e){s([]);return}let n=!0;async function o(){let c=[];try{const u=await P_(e);c=Array.isArray(u.nodes)?u.nodes:[]}catch{c=[]}if(!n)return;r.current=iy(r.current,c,Math.floor(Date.now()/1e3));const a=c.filter(u=>u&&u.tunnel&&u.tunnel.status==="up"),d={};await Promise.all(a.map(async u=>{try{d[u.name]=await FS(e,u.name)}catch(f){d[u.name]={error:String(f&&f.message||f)}}})),n&&s(sy({nodes:c,remote:d,down:r.current}))}o();const l=setInterval(o,ry);return()=>{n=!1,clearInterval(l)}},[e,t]),i}function id(e,t){return t?0:e.attached?1:2}function Yn(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 ny(e){return e.status==="down"?e.downSince?y("tunnel-down-since").replace("{t}",Yn(e.downSince)):y("tunnel-down"):e.status==="unreachable"?y("node-unreachable"):""}function oy({onPick:e,token:t,onSettings:i}){const[s,r]=vt(),n=W_(t),[o,l]=E.useState(null),[c,a]=E.useState(null),[d,u]=E.useState(""),[f,m]=E.useState(""),[_,S]=E.useState({bind:"127.0.0.1",port:""}),[k,v]=E.useState([]),[p,g]=E.useState(!1),[w,M]=E.useState([]),[N,x]=E.useState(["shell","claude","codex-vl","pi"]),[C,D]=E.useState(null),[L,A]=E.useState(!1);async function T(){try{const V=await(await Ue("/api/sessions",t)).json();V.error?(a(V.error),l([])):(a(null),l(V.sessions||[]))}catch(z){a(String(z)),l([])}try{const z=await el(t);g(!!z.available),v(z.available?z.cells||[]:[]),M(z.available?z.engines||[]:[])}catch{g(!1),v([]),M([])}}E.useEffect(()=>{T(),Ue("/api/config",t).then(V=>V.json()).then(V=>{m(V.version||""),S({bind:V.bind||"127.0.0.1",port:V.port||""}),Array.isArray(V.presets)&&V.presets.length&&x(V.presets)}).catch(()=>{});const z=setInterval(T,4e3);return()=>clearInterval(z)},[]);async function P(){if(!_.port)return;const z=`http://${_.bind}:${_.port}/#token=${t}`;try{await navigator.clipboard.writeText(z)}catch{}}async function j(z){if(!C)return;const{cell:V}=C;z.action==="up"?await E_(t,{cell:V,engine:z.engine,model:z.model||"",boot:!!z.boot}):await N_(t,{cell:V,boot:!!z.boot}),T()}async function F(z){try{await D_(t,z)}catch{return}T()}async function $(z){await R_(t,z),A(!1),T()}const R=E.useMemo(()=>{const z=new Map;for(const V of o||[])z.set(V.name,V);return z},[o]),b=E.useMemo(()=>new Set(k.map(z=>z.tmuxSession)),[k]),[I,B]=E.useState(z_),U=z=>B(V=>O_(V,z)),X=E.useMemo(()=>{const z=(o||[]).map(ue=>{const G=Number(localStorage.getItem(k_(ue.name))||0),ce=!!(ue.outbox&&ue.outbox.count>0&&ue.outbox.latest>G);return{...ue,fresh:ce}}),V=d.trim().toLowerCase();return z.filter(ue=>!V||ue.name.toLowerCase().includes(V)).sort((ue,G)=>Wa(_r(I,ue.name,ue.activity),_r(I,G.name,G.activity))||id(ue,ue.fresh)-id(G,G.fresh)||ue.name.localeCompare(G.name))},[o,d,I]),J=X.filter(z=>!b.has(z.name)),ee=E.useMemo(()=>[...k].sort((z,V)=>Wa(_r(I,z.tmuxSession,(R.get(z.tmuxSession)||{}).activity),_r(I,V.tmuxSession,(R.get(V.tmuxSession)||{}).activity))||Number(V.active)-Number(z.active)||z.cell.localeCompare(V.cell)),[k,I,R]),oe=o?o.length:0,ne=(o||[]).filter(z=>z.attached).length,pe=_.port?`${_.bind}:${_.port}`:_.bind;return h.jsxs("div",{className:"nc-home",children:[h.jsxs("header",{className:"nc-home-head",children:[h.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",h.jsx("span",{className:"nc-cursor"})]}),h.jsxs("div",{className:"nc-home-sub",children:[y("fleet-tmux")," · ",oe," ",y("sessions"),ne>0&&` · ${ne} attached`]}),h.jsxs("span",{className:"nc-head-actions",children:[h.jsx("button",{className:"nc-refresh",onClick:i,title:y("settings"),children:h.jsx(fe,{name:"gear",size:18})}),h.jsx("button",{className:"nc-refresh",onClick:T,title:y("refresh"),children:h.jsx(fe,{name:"refresh",size:18})})]})]}),oe>8&&h.jsx("input",{className:"nc-filter",type:"search",placeholder:y("filter-placeholder"),value:d,onChange:z=>u(z.target.value)}),c&&h.jsx("div",{className:"nc-err",children:c}),p&&k.length>0&&h.jsxs("section",{className:"nc-group",children:[h.jsx("div",{className:"nc-group-title",children:y("fleet")}),ee.map(z=>{const V=R.get(z.tmuxSession)||{},ue=z.degraded?"warn":z.tmux?"on":"",G=[`${z.engine}${z.key?`·${z.key}`:""}`,V.preview].filter(Boolean).join(" · ");return h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>z.tmux&&e(z.tmuxSession),title:z.degraded?y("cell-degraded"):z.tmux?y("cell-on"):y("cell-off"),children:[h.jsx("span",{className:`dot ${ue}`}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:z.cell}),h.jsx("small",{children:G})]})]}),V.activity?h.jsx("span",{className:"nc-rel",children:Yn(V.activity)}):null,V.outbox&&V.outbox.count>0&&h.jsx("span",{className:"nc-badge",title:y("new-files-outbox"),children:V.outbox.count}),h.jsx("button",{className:`nc-act pin${I.includes(z.tmuxSession)?" on":""}`,title:y("pin"),onClick:()=>U(z.tmuxSession),children:I.includes(z.tmuxSession)?"★":"☆"}),h.jsx("button",{className:`nc-act power${z.tmux?" on":""}${z.degraded?" warn":""}`,onClick:()=>D(z),title:z.active?y("power-off"):y("power-on"),children:h.jsx(fe,{name:"power",size:16})})]},z.cell)})]}),h.jsxs("section",{className:"nc-group",children:[p&&h.jsx("div",{className:"nc-group-title",children:y("other-sessions")}),J.map(z=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>e(z.name),children:[h.jsx("span",{className:z.attached?"dot on":"dot"}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:z.name}),h.jsx("small",{children:z.preview?z.preview:z.cmd?z.cmd:y("windows").replace("{n}",String(z.windows||0))})]})]}),z.activity?h.jsx("span",{className:"nc-rel",children:Yn(z.activity)}):null,z.fresh&&h.jsx("span",{className:"nc-badge",title:y("new-files-outbox"),children:z.outbox.count}),h.jsx("button",{className:`nc-act pin${I.includes(z.name)?" on":""}`,title:y("pin"),onClick:()=>U(z.name),children:I.includes(z.name)?"★":"☆"}),h.jsx("button",{className:"nc-menu",title:y("terminate"),onClick:()=>{window.confirm(y("terminate-confirm").replace("{name}",z.name))&&F(z.name)},children:"⋯"})]},z.name)),o===null&&h.jsx("div",{className:"nc-empty",children:y("loading-fleet")}),o!==null&&J.length===0&&X.length===0&&!c&&h.jsx("div",{className:"nc-empty",children:d?y("no-match").replace("{q}",d):y("no-sessions")})]}),n.map(z=>h.jsxs("section",{className:"nc-group",children:[h.jsxs("div",{className:"nc-group-title nc-node-title",children:[h.jsx("span",{className:`dot ${z.status==="up"?"on":"warn"}`}),z.name," · ",z.status==="up"?y("node-sessions").replace("{n}",String(z.sessions.length)):ny(z)]}),z.status==="up"&&z.sessions.map(V=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>e({session:V.name,node:V.node}),children:[h.jsx("span",{className:V.attached?"dot on":"dot"}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:V.name}),h.jsx("small",{children:V.preview?V.preview:V.cmd?V.cmd:y("windows").replace("{n}",String(V.windows||0))})]})]}),V.activity?h.jsx("span",{className:"nc-rel",children:Yn(V.activity)}):null]},V.key)),z.status==="up"&&z.sessions.length===0&&h.jsx("div",{className:"nc-empty",children:y("no-sessions-short")})]},`nodo-${z.name}`)),h.jsxs("footer",{className:"nc-home-foot",onClick:P,title:y("copy-url"),children:[f&&h.jsxs("span",{children:["v",f]}),h.jsxs("span",{children:[pe," · ",y("ssh-only")]}),h.jsx("span",{className:"nc-lang",onClick:z=>z.stopPropagation(),children:$_.map((z,V)=>h.jsxs("span",{children:[V>0&&" · ",h.jsx("button",{className:`nc-lang-btn${s===z?" on":""}`,onClick:()=>r(z),title:z,children:z.toUpperCase()})]},z))})]}),h.jsx("button",{className:"nc-fab",onClick:()=>A(!0),title:y("new-session"),"aria-label":y("new-session"),children:"+"}),C&&h.jsx(F_,{cell:C,engines:w,onConfirm:j,onClose:()=>D(null)}),L&&h.jsx(H_,{presets:N,token:t,onCreate:$,onClose:()=>A(!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 U_=Object.defineProperty,ly=Object.getOwnPropertyDescriptor,ay=(e,t)=>{for(var i in t)U_(e,i,{get:t[i],enumerable:!0})},Re=(e,t,i,s)=>{for(var r=s>1?void 0:s?ly(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&U_(t,i,r),r},K=(e,t)=>(i,s)=>t(i,s,e),sd="Terminal input",Va={get:()=>sd,set:e=>sd=e},rd="Too much output to announce, navigate to rows manually to read",qa={get:()=>rd,set:e=>rd=e};function cy(e){return e.replace(/\r?\n/g,"\r")}function hy(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function uy(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function dy(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");K_(r,t,i,s)}}function K_(e,t,i,s){e=cy(e),e=hy(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function V_(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function nd(e,t,i,s,r){V_(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function ki(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function tl(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var fy=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let l=e.charCodeAt(n);56320<=l&&l<=57343?t[s++]=(o-55296)*1024+l-56320+65536:(t[s++]=o,t[s++]=l);continue}o!==65279&&(t[s++]=o)}return s}},py=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,l,c=0,a=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let _=0,S;for(;(S=this.interim[++_]&63)&&_<4;)m<<=6,m|=S;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,v=k-_;for(;a<v;){if(a>=i)return 0;if(S=e[a++],(S&192)!==128){a--,f=!0;break}else this.interim[_++]=S,m<<=6,m|=S&63}f||(k===2?m<128?a--:t[s++]=m:k===3?m<2048||m>=55296&&m<=57343||m===65279||(t[s++]=m):m<65536||m>1114111||(t[s++]=m)),this.interim.fill(0)}let d=i-4,u=a;for(;u<i;){for(;u<d&&!((r=e[u])&128)&&!((n=e[u+1])&128)&&!((o=e[u+2])&128)&&!((l=e[u+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=l,u+=4;if(r=e[u++],r<128)t[s++]=r;else if((r&224)===192){if(u>=i)return this.interim[0]=r,s;if(n=e[u++],(n&192)!==128){u--;continue}if(c=(r&31)<<6|n&63,c<128){u--;continue}t[s++]=c}else if((r&240)===224){if(u>=i)return this.interim[0]=r,s;if(n=e[u++],(n&192)!==128){u--;continue}if(u>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[u++],(o&192)!==128){u--;continue}if(c=(r&15)<<12|(n&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((r&248)===240){if(u>=i)return this.interim[0]=r,s;if(n=e[u++],(n&192)!==128){u--;continue}if(u>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[u++],(o&192)!==128){u--;continue}if(u>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(l=e[u++],(l&192)!==128){u--;continue}if(c=(r&7)<<18|(n&63)<<12|(o&63)<<6|l&63,c<65536||c>1114111)continue;t[s++]=c}}return s}},q_="",Mi=" ",sn=class Y_{constructor(){this.fg=0,this.bg=0,this.extended=new Eo}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 Y_;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}},Eo=class X_{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 X_(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Bt=class G_ extends sn{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Eo,this.combinedData=""}static fromCharData(t){let i=new G_;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?ki(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},od="di$target",Ya="di$dependencies",jl=new Map;function _y(e){return e[Ya]||[]}function Ve(e){if(jl.has(e))return jl.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");my(t,i,r)};return t._id=e,jl.set(e,t),t}function my(e,t,i){t[od]===t?t[Ya].push({id:e,index:i}):(t[Ya]=[{id:e,index:i}],t[od]=t)}var at=Ve("BufferService"),Q_=Ve("CoreMouseService"),fs=Ve("CoreService"),vy=Ve("CharsetService"),Lh=Ve("InstantiationService"),J_=Ve("LogService"),ct=Ve("OptionsService"),Z_=Ve("OscLinkService"),gy=Ve("UnicodeService"),rn=Ve("DecorationService"),Xa=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var d;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Bt,o=i.getTrimmedLength(),l=-1,c=-1,a=!1;for(let u=0;u<o;u++)if(!(c===-1&&!i.hasContent(u))){if(i.loadCell(u,n),n.hasExtendedAttrs()&&n.extended.urlId)if(c===-1){c=u,l=n.extended.urlId;continue}else a=n.extended.urlId!==l;else c!==-1&&(a=!0);if(a||c!==-1&&u===o-1){let f=(d=this._oscLinkService.getLinkData(l))==null?void 0:d.uri;if(f){let m={start:{x:c+1,y:e},end:{x:u+(!a&&u===o-1?1:0),y:e}},_=!1;if(!(r!=null&&r.allowNonHttpProtocols))try{let S=new URL(f);["http:","https:"].includes(S.protocol)||(_=!0)}catch{_=!0}_||s.push({text:f,range:m,activate:(S,k)=>r?r.activate(S,k,m):Sy(S,k),hover:(S,k)=>{var v;return(v=r==null?void 0:r.hover)==null?void 0:v.call(r,S,k,m)},leave:(S,k)=>{var v;return(v=r==null?void 0:r.leave)==null?void 0:v.call(r,S,k,m)}})}a=!1,n.hasExtendedAttrs()&&n.extended.urlId?(c=u,l=n.extended.urlId):(c=-1,l=-1)}}t(s)}};Xa=Re([K(0,at),K(1,ct),K(2,Z_)],Xa);function Sy(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 il=Ve("CharSizeService"),vi=Ve("CoreBrowserService"),Ph=Ve("MouseService"),gi=Ve("RenderService"),yy=Ve("SelectionService"),em=Ve("CharacterJoinerService"),Ys=Ve("ThemeService"),tm=Ve("LinkProviderService"),wy=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ld.isErrorNoTelemetry(e)?new ld(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)}},Cy=new wy;function Xn(e){xy(e)||Cy.onUnexpectedError(e)}var Ga="Canceled";function xy(e){return e instanceof by?!0:e instanceof Error&&e.name===Ga&&e.message===Ga}var by=class extends Error{constructor(){super(Ga),this.name=this.message}};function ky(e){return new Error(`Illegal argument: ${e}`)}var ld=class Qa extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Qa)return t;let i=new Qa;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Ja=class im extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,im.prototype)}};function gt(e,t=0){return e[e.length-(1+t)]}var Ey;(e=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function s(n){return n>0}e.isGreaterThan=s;function r(n){return n===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ey||(Ey={}));function Ny(e,t){let i=this,s=!1,r;return function(){return s||(s=!0,t||(r=e.apply(i,arguments))),r}}var sm;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*r(w){yield w}e.single=r;function n(w){return t(w)?w:r(w)}e.wrap=n;function o(w){return w||i}e.from=o;function*l(w){for(let M=w.length-1;M>=0;M--)yield w[M]}e.reverse=l;function c(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=c;function a(w){return w[Symbol.iterator]().next().value}e.first=a;function d(w,M){let N=0;for(let x of w)if(M(x,N++))return!0;return!1}e.some=d;function u(w,M){for(let N of w)if(M(N))return N}e.find=u;function*f(w,M){for(let N of w)M(N)&&(yield N)}e.filter=f;function*m(w,M){let N=0;for(let x of w)yield M(x,N++)}e.map=m;function*_(w,M){let N=0;for(let x of w)yield*M(x,N++)}e.flatMap=_;function*S(...w){for(let M of w)yield*M}e.concat=S;function k(w,M,N){let x=N;for(let C of w)x=M(x,C);return x}e.reduce=k;function*v(w,M,N=w.length){for(M<0&&(M+=w.length),N<0?N+=w.length:N>w.length&&(N=w.length);M<N;M++)yield w[M]}e.slice=v;function p(w,M=Number.POSITIVE_INFINITY){let N=[];if(M===0)return[N,w];let x=w[Symbol.iterator]();for(let C=0;C<M;C++){let D=x.next();if(D.done)return[N,e.empty()];N.push(D.value)}return[N,{[Symbol.iterator](){return x}}]}e.consume=p;async function g(w){let M=[];for await(let N of w)M.push(N);return Promise.resolve(M)}e.asyncToArray=g})(sm||(sm={}));function cs(e){if(sm.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Ry(...e){return ye(()=>cs(e))}function ye(e){return{dispose:Ny(()=>{e()})}}var rm=class nm{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{cs(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?nm.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)}};rm.DISABLE_DISPOSED_WARNING=!1;var Ii=rm,ie=class{constructor(){this._store=new Ii,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)}};ie.None=Object.freeze({dispose(){}});var Us=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}},ci=typeof window=="object"?window:globalThis,Za=class ec{constructor(t){this.element=t,this.next=ec.Undefined,this.prev=ec.Undefined}};Za.Undefined=new Za(void 0);var we=Za,ad=class{constructor(){this._first=we.Undefined,this._last=we.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===we.Undefined}clear(){let e=this._first;for(;e!==we.Undefined;){let t=e.next;e.prev=we.Undefined,e.next=we.Undefined,e=t}this._first=we.Undefined,this._last=we.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new we(e);if(this._first===we.Undefined)this._first=i,this._last=i;else if(t){let r=this._last;this._last=i,i.prev=r,r.next=i}else{let r=this._first;this._first=i,i.next=r,r.prev=i}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(i))}}shift(){if(this._first!==we.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==we.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==we.Undefined&&e.next!==we.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===we.Undefined&&e.next===we.Undefined?(this._first=we.Undefined,this._last=we.Undefined):e.next===we.Undefined?(this._last=this._last.prev,this._last.next=we.Undefined):e.prev===we.Undefined&&(this._first=this._first.next,this._first.prev=we.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==we.Undefined;)yield e.element,e=e.next}},Dy=globalThis.performance&&typeof globalThis.performance.now=="function",My=class om{static create(t){return new om(t)}constructor(t){this._now=Dy&&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}},Xe;(e=>{e.None=()=>ie.None;function t(T,P){return u(T,()=>{},0,void 0,!0,void 0,P)}e.defer=t;function i(T){return(P,j=null,F)=>{let $=!1,R;return R=T(b=>{if(!$)return R?R.dispose():$=!0,P.call(j,b)},null,F),$&&R.dispose(),R}}e.once=i;function s(T,P,j){return a((F,$=null,R)=>T(b=>F.call($,P(b)),null,R),j)}e.map=s;function r(T,P,j){return a((F,$=null,R)=>T(b=>{P(b),F.call($,b)},null,R),j)}e.forEach=r;function n(T,P,j){return a((F,$=null,R)=>T(b=>P(b)&&F.call($,b),null,R),j)}e.filter=n;function o(T){return T}e.signal=o;function l(...T){return(P,j=null,F)=>{let $=Ry(...T.map(R=>R(b=>P.call(j,b))));return d($,F)}}e.any=l;function c(T,P,j,F){let $=j;return s(T,R=>($=P($,R),$),F)}e.reduce=c;function a(T,P){let j,F={onWillAddFirstListener(){j=T($.fire,$)},onDidRemoveLastListener(){j==null||j.dispose()}},$=new W(F);return P==null||P.add($),$.event}function d(T,P){return P instanceof Array?P.push(T):P&&P.add(T),T}function u(T,P,j=100,F=!1,$=!1,R,b){let I,B,U,X=0,J,ee={leakWarningThreshold:R,onWillAddFirstListener(){I=T(ne=>{X++,B=P(B,ne),F&&!U&&(oe.fire(B),B=void 0),J=()=>{let pe=B;B=void 0,U=void 0,(!F||X>1)&&oe.fire(pe),X=0},typeof j=="number"?(clearTimeout(U),U=setTimeout(J,j)):U===void 0&&(U=0,queueMicrotask(J))})},onWillRemoveListener(){$&&X>0&&(J==null||J())},onDidRemoveLastListener(){J=void 0,I.dispose()}},oe=new W(ee);return b==null||b.add(oe),oe.event}e.debounce=u;function f(T,P=0,j){return e.debounce(T,(F,$)=>F?(F.push($),F):[$],P,void 0,!0,void 0,j)}e.accumulate=f;function m(T,P=(F,$)=>F===$,j){let F=!0,$;return n(T,R=>{let b=F||!P(R,$);return F=!1,$=R,b},j)}e.latch=m;function _(T,P,j){return[e.filter(T,P,j),e.filter(T,F=>!P(F),j)]}e.split=_;function S(T,P=!1,j=[],F){let $=j.slice(),R=T(B=>{$?$.push(B):I.fire(B)});F&&F.add(R);let b=()=>{$==null||$.forEach(B=>I.fire(B)),$=null},I=new W({onWillAddFirstListener(){R||(R=T(B=>I.fire(B)),F&&F.add(R))},onDidAddFirstListener(){$&&(P?setTimeout(b):b())},onDidRemoveLastListener(){R&&R.dispose(),R=null}});return F&&F.add(I),I.event}e.buffer=S;function k(T,P){return(j,F,$)=>{let R=P(new p);return T(function(b){let I=R.evaluate(b);I!==v&&j.call(F,I)},void 0,$)}}e.chain=k;let v=Symbol("HaltChainable");class p{constructor(){this.steps=[]}map(P){return this.steps.push(P),this}forEach(P){return this.steps.push(j=>(P(j),j)),this}filter(P){return this.steps.push(j=>P(j)?j:v),this}reduce(P,j){let F=j;return this.steps.push($=>(F=P(F,$),F)),this}latch(P=(j,F)=>j===F){let j=!0,F;return this.steps.push($=>{let R=j||!P($,F);return j=!1,F=$,R?$:v}),this}evaluate(P){for(let j of this.steps)if(P=j(P),P===v)break;return P}}function g(T,P,j=F=>F){let F=(...I)=>b.fire(j(...I)),$=()=>T.on(P,F),R=()=>T.removeListener(P,F),b=new W({onWillAddFirstListener:$,onDidRemoveLastListener:R});return b.event}e.fromNodeEventEmitter=g;function w(T,P,j=F=>F){let F=(...I)=>b.fire(j(...I)),$=()=>T.addEventListener(P,F),R=()=>T.removeEventListener(P,F),b=new W({onWillAddFirstListener:$,onDidRemoveLastListener:R});return b.event}e.fromDOMEventEmitter=w;function M(T){return new Promise(P=>i(T)(P))}e.toPromise=M;function N(T){let P=new W;return T.then(j=>{P.fire(j)},()=>{P.fire(void 0)}).finally(()=>{P.dispose()}),P.event}e.fromPromise=N;function x(T,P){return T(j=>P.fire(j))}e.forward=x;function C(T,P,j){return P(j),T(F=>P(F))}e.runAndSubscribe=C;class D{constructor(P,j){this._observable=P,this._counter=0,this._hasChanged=!1;let F={onWillAddFirstListener:()=>{P.addObserver(this)},onDidRemoveLastListener:()=>{P.removeObserver(this)}};this.emitter=new W(F),j&&j.add(this.emitter)}beginUpdate(P){this._counter++}handlePossibleChange(P){}handleChange(P,j){this._hasChanged=!0}endUpdate(P){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function L(T,P){return new D(T,P).emitter.event}e.fromObservable=L;function A(T){return(P,j,F)=>{let $=0,R=!1,b={beginUpdate(){$++},endUpdate(){$--,$===0&&(T.reportChanges(),R&&(R=!1,P.call(j)))},handlePossibleChange(){},handleChange(){R=!0}};T.addObserver(b),T.reportChanges();let I={dispose(){T.removeObserver(b)}};return F instanceof Ii?F.add(I):Array.isArray(F)&&F.push(I),I}}e.fromObservableLight=A})(Xe||(Xe={}));var tc=class ic{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ic._idPool++}`,ic.all.add(this)}start(t){this._stopWatch=new My,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}}};tc.all=new Set,tc._idPool=0;var Ly=tc,Py=-1,lm=class am{constructor(t,i,s=(am._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,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 c=new jy(l,n);this._errorHandler(c)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,r]of this._stacks)(!t||i<r)&&(t=[s,r],i=r);return t}};lm._idPool=1;var Ty=lm,By=class cm{constructor(t){this.value=t}static create(){let t=new Error;return new cm(t.stack??"")}print(){console.warn(this.value.split(`
|
|
58
|
-
`).slice(2).join(`
|
|
59
|
-
`))}},jy=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},zy=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Oy=0,zl=class{constructor(e){this.value=e,this.id=Oy++}},Ay=2,Iy,W=class{constructor(e){var t,i,s,r;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new Ty((e==null?void 0:e.onListenerError)??Xn,((i=this._options)==null?void 0:i.leakWarningThreshold)??Py):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new Ly(this._options._profName):void 0,this._deliveryQueue=(r=this._options)==null?void 0:r.deliveryQueue}dispose(){var e,t,i,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||i.call(t),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var o,l,c,a,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(u);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new zy(`${u}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Xn)(m),ie.None}if(this._disposed)return ie.None;t&&(e=e.bind(t));let s=new zl(e),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=By.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof zl?(this._deliveryQueue??(this._deliveryQueue=new $y),this._listeners=[this._listeners,s]):this._listeners.push(s):((c=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||c.call(l,this),this._listeners=s,(d=(a=this._options)==null?void 0:a.onDidAddFirstListener)==null||d.call(a,this)),this._size++;let n=ye(()=>{r==null||r(),this._removeListener(s)});return i instanceof Ii?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(e){var r,n,o,l;if((n=(r=this._options)==null?void 0:r.onWillRemoveListener)==null||n.call(r,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(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 s=this._deliveryQueue.current===this;if(this._size*Ay<=t.length){let c=0;for(let a=0;a<t.length;a++)t[a]?t[c++]=t[a]:s&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=c}}_deliver(e,t){var s;if(!e)return;let i=((s=this._options)==null?void 0:s.onListenerError)||Xn;if(!i){e.value(t);return}try{e.value(t)}catch(r){i(r)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,s,r;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof zl)this._deliver(this._listeners,e);else{let n=this._deliveryQueue;n.enqueue(this,e,this._listeners.length),this._deliverQueue(n)}(r=this._perfMon)==null||r.stop()}hasListeners(){return this._size>0}},$y=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}},sc=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new W,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new W,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};sc.INSTANCE=new sc;var Th=sc;function Fy(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}Th.INSTANCE.onDidChangeZoomLevel;function Hy(e){return Th.INSTANCE.getZoomFactor(e)}Th.INSTANCE.onDidChangeFullscreen;var Xs=typeof navigator=="object"?navigator.userAgent:"",rc=Xs.indexOf("Firefox")>=0,Wy=Xs.indexOf("AppleWebKit")>=0,Bh=Xs.indexOf("Chrome")>=0,Uy=!Bh&&Xs.indexOf("Safari")>=0;Xs.indexOf("Electron/")>=0;Xs.indexOf("Android")>=0;var Ol=!1;if(typeof ci.matchMedia=="function"){let e=ci.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ci.matchMedia("(display-mode: fullscreen)");Ol=e.matches,Fy(ci,e,({matches:i})=>{Ol&&t.matches||(Ol=i)})}var Ms="en",nc=!1,oc=!1,Gn=!1,hm=!1,Rn,Qn=Ms,cd=Ms,Ky,At,ss=globalThis,Ye,hf;typeof ss.vscode<"u"&&typeof ss.vscode.process<"u"?Ye=ss.vscode.process:typeof process<"u"&&typeof((hf=process==null?void 0:process.versions)==null?void 0:hf.node)=="string"&&(Ye=process);var uf,Vy=typeof((uf=Ye==null?void 0:Ye.versions)==null?void 0:uf.electron)=="string",qy=Vy&&(Ye==null?void 0:Ye.type)==="renderer",df;if(typeof Ye=="object"){nc=Ye.platform==="win32",oc=Ye.platform==="darwin",Gn=Ye.platform==="linux",Gn&&Ye.env.SNAP&&Ye.env.SNAP_REVISION,Ye.env.CI||Ye.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Rn=Ms,Qn=Ms;let e=Ye.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Rn=t.userLocale,cd=t.osLocale,Qn=t.resolvedLanguage||Ms,Ky=(df=t.languagePack)==null?void 0:df.translationsConfigFile}catch{}hm=!0}else typeof navigator=="object"&&!qy?(At=navigator.userAgent,nc=At.indexOf("Windows")>=0,oc=At.indexOf("Macintosh")>=0,(At.indexOf("Macintosh")>=0||At.indexOf("iPad")>=0||At.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Gn=At.indexOf("Linux")>=0,(At==null?void 0:At.indexOf("Mobi"))>=0,Qn=globalThis._VSCODE_NLS_LANGUAGE||Ms,Rn=navigator.language.toLowerCase(),cd=Rn):console.error("Unable to resolve platform.");var um=nc,ti=oc,Yy=Gn,hd=hm,ii=At,yi=Qn,Xy;(e=>{function t(){return yi}e.value=t;function i(){return yi.length===2?yi==="en":yi.length>=3?yi[0]==="e"&&yi[1]==="n"&&yi[2]==="-":!1}e.isDefaultVariant=i;function s(){return yi==="en"}e.isDefault=s})(Xy||(Xy={}));var Gy=typeof ss.postMessage=="function"&&!ss.importScripts;(()=>{if(Gy){let e=[];ss.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),ss.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var Qy=!!(ii&&ii.indexOf("Chrome")>=0);ii&&ii.indexOf("Firefox")>=0;!Qy&&ii&&ii.indexOf("Safari")>=0;ii&&ii.indexOf("Edg/")>=0;ii&&ii.indexOf("Android")>=0;var ms=typeof navigator=="object"?navigator:{};hd||document.queryCommandSupported&&document.queryCommandSupported("copy")||ms&&ms.clipboard&&ms.clipboard.writeText,hd||ms&&ms.clipboard&&ms.clipboard.readText;var jh=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}},Al=new jh,ud=new jh,dd=new jh,Jy=new Array(230),dm;(e=>{function t(l){return Al.keyCodeToStr(l)}e.toString=t;function i(l){return Al.strToKeyCode(l)}e.fromString=i;function s(l){return ud.keyCodeToStr(l)}e.toUserSettingsUS=s;function r(l){return dd.keyCodeToStr(l)}e.toUserSettingsGeneral=r;function n(l){return ud.strToKeyCode(l)||dd.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 Al.keyCodeToStr(l)}e.toElectronAccelerator=o})(dm||(dm={}));var Zy=class fm{constructor(t,i,s,r,n){this.ctrlKey=t,this.shiftKey=i,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(t){return t instanceof fm&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${i}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new e0([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},e0=class{constructor(e){if(e.length===0)throw ky("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 t0(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return dm.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(rc)switch(t){case 59:return 85;case 60:if(Yy)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ti)return 57;break}else if(Wy&&(ti&&t===93||!ti&&t===92))return 57;return Jy[t]||0}var i0=ti?256:2048,s0=512,r0=1024,n0=ti?2048:256,fd=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=t0(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|=i0),this.altKey&&(t|=s0),this.shiftKey&&(t|=r0),this.metaKey&&(t|=n0),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Zy(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},pd=new WeakMap;function o0(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 l0=class{static getSameOriginWindowChain(e){let t=pd.get(e);if(!t){t=[],pd.set(e,t);let i=e,s;do s=o0(i),s?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=s;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,s=0,r=this.getSameOriginWindowChain(e);for(let n of r){let o=n.window.deref();if(i+=(o==null?void 0:o.scrollY)??0,s+=(o==null?void 0:o.scrollX)??0,o===t||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();i+=l.top,s+=l.left}return{top:i,left:s}}},Dn=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=l0.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},_d=class{constructor(e,t=0,i=0){var r;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let s=!1;if(Bh){let n=navigator.userAgent.match(/Chrome\/(\d+)/);s=(n?parseInt(n[1]):123)<=122}if(e){let n=e,o=e,l=((r=e.view)==null?void 0:r.devicePixelRatio)||1;if(typeof n.wheelDeltaY<"u")s?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 c=e;c.deltaMode===c.DOM_DELTA_LINE?rc&&!ti?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof n.wheelDeltaX<"u")Uy&&um?this.deltaX=-(n.wheelDeltaX/120):s?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 c=e;c.deltaMode===c.DOM_DELTA_LINE?rc&&!ti?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},pm=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),a0;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof c0?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Xe.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:pm})})(a0||(a0={}));var c0=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?pm:(this._emitter||(this._emitter=new W),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},zh=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 Ja("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Ja("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},h0=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 Ja("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=i.setInterval(()=>{e()},t);this.disposable=ye(()=>{i.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},u0;(e=>{async function t(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}e.withAsyncBody=i})(u0||(u0={}));var md=class Rt{static fromArray(t){return new Rt(i=>{i.emitMany(t)})}static fromPromise(t){return new Rt(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Rt(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new Rt(async i=>{await Promise.all(t.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new W,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Xe.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 Rt(async s=>{for await(let r of t)s.emitOne(i(r))})}map(t){return Rt.map(this,t)}static filter(t,i){return new Rt(async s=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return Rt.filter(this,t)}static coalesce(t){return Rt.filter(t,i=>!!i)}coalesce(){return Rt.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return Rt.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())}};md.EMPTY=md.fromArray([]);var{getWindow:Jt,getWindowId:d0,onDidRegisterWindow:f0}=function(){let e=new Map,t={window:ci,disposables:new Ii};e.set(ci.vscodeWindowId,t);let i=new W,s=new W,r=new W;function n(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(e.has(o.vscodeWindowId))return ie.None;let l=new Ii,c={window:o,disposables:l.add(new Ii)};return e.set(o.vscodeWindowId,c),l.add(ye(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),l.add(Q(o,Ie.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(c),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 a;let l=o;if((a=l==null?void 0:l.ownerDocument)!=null&&a.defaultView)return l.ownerDocument.defaultView.window;let c=o;return c!=null&&c.view?c.view.window:ci},getDocument(o){return Jt(o).document}}}(),p0=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Q(e,t,i,s){return new p0(e,t,i,s)}var vd=function(e,t,i,s){return Q(e,t,i,s)},Oh,_0=class extends h0{constructor(e){super(),this.defaultTarget=e&&Jt(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},gd=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){Xn(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,s=new Map,r=n=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),s.set(n,!0);o.length>0;)o.sort(gd.sort),o.shift().execute();s.set(n,!1)};Oh=(n,o,l=0)=>{let c=d0(n),a=new gd(o,l),d=e.get(c);return d||(d=[],e.set(c,d)),d.push(a),i.get(c)||(i.set(c,!0),n.requestAnimationFrame(()=>r(c))),a}})();function m0(e){let t=e.getBoundingClientRect(),i=Jt(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var Ie={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"},v0=class{constructor(t){this.domNode=t,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(t){let i=ht(t);this._maxWidth!==i&&(this._maxWidth=i,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let i=ht(t);this._width!==i&&(this._width=i,this.domNode.style.width=this._width)}setHeight(t){let i=ht(t);this._height!==i&&(this._height=i,this.domNode.style.height=this._height)}setTop(t){let i=ht(t);this._top!==i&&(this._top=i,this.domNode.style.top=this._top)}setLeft(t){let i=ht(t);this._left!==i&&(this._left=i,this.domNode.style.left=this._left)}setBottom(t){let i=ht(t);this._bottom!==i&&(this._bottom=i,this.domNode.style.bottom=this._bottom)}setRight(t){let i=ht(t);this._right!==i&&(this._right=i,this.domNode.style.right=this._right)}setPaddingTop(t){let i=ht(t);this._paddingTop!==i&&(this._paddingTop=i,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let i=ht(t);this._paddingLeft!==i&&(this._paddingLeft=i,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let i=ht(t);this._paddingBottom!==i&&(this._paddingBottom=i,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let i=ht(t);this._paddingRight!==i&&(this._paddingRight=i,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let i=ht(t);this._fontSize!==i&&(this._fontSize=i,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let i=ht(t);this._lineHeight!==i&&(this._lineHeight=i,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let i=ht(t);this._letterSpacing!==i&&(this._letterSpacing=i,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,i){this.domNode.classList.toggle(t,i),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,i){this.domNode.setAttribute(t,i)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function ht(e){return typeof e=="number"?`${e}px`:e}function Mr(e){return new v0(e)}var _m=class{constructor(){this._hooks=new Ii,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,s,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=r;let n=e;try{e.setPointerCapture(t),this._hooks.add(ye(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=Jt(e)}this._hooks.add(Q(n,Ie.POINTER_MOVE,o=>{if(o.buttons!==i){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Q(n,Ie.POINTER_UP,o=>this.stopMonitoring(!0)))}};function g0(e,t,i){let s=null,r=null;if(typeof i.value=="function"?(s="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(s="get",r=i.get),!r)throw new Error("not supported");let n=`$memoize$${t}`;i[s]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var Xt;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Xt||(Xt={}));var mr=class et extends ie{constructor(){super(),this.dispatched=!1,this.targets=new ad,this.ignoreTargets=new ad,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Xe.runAndSubscribe(f0,({window:t,disposables:i})=>{i.add(Q(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),i.add(Q(t.document,"touchend",s=>this.onTouchEnd(t,s))),i.add(Q(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:ci,disposables:this._store}))}static addTarget(t){if(!et.isTouchDevice())return ie.None;et.INSTANCE||(et.INSTANCE=new et);let i=et.INSTANCE.targets.push(t);return ye(i)}static ignoreTarget(t){if(!et.isTouchDevice())return ie.None;et.INSTANCE||(et.INSTANCE=new et);let i=et.INSTANCE.ignoreTargets.push(t);return ye(i)}static isTouchDevice(){return"ontouchstart"in ci||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=t.targetTouches.length;s<r;s++){let n=t.targetTouches.item(s);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(Xt.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 s=Date.now(),r=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 c=this.activeTouches[l.identifier],a=Date.now()-c.initialTimeStamp;if(a<et.HOLD_DELAY&&Math.abs(c.initialPageX-gt(c.rollingPageX))<30&&Math.abs(c.initialPageY-gt(c.rollingPageY))<30){let d=this.newGestureEvent(Xt.Tap,c.initialTarget);d.pageX=gt(c.rollingPageX),d.pageY=gt(c.rollingPageY),this.dispatchEvent(d)}else if(a>=et.HOLD_DELAY&&Math.abs(c.initialPageX-gt(c.rollingPageX))<30&&Math.abs(c.initialPageY-gt(c.rollingPageY))<30){let d=this.newGestureEvent(Xt.Contextmenu,c.initialTarget);d.pageX=gt(c.rollingPageX),d.pageY=gt(c.rollingPageY),this.dispatchEvent(d)}else if(r===1){let d=gt(c.rollingPageX),u=gt(c.rollingPageY),f=gt(c.rollingTimestamps)-c.rollingTimestamps[0],m=d-c.rollingPageX[0],_=u-c.rollingPageY[0],S=[...this.targets].filter(k=>c.initialTarget instanceof Node&&k.contains(c.initialTarget));this.inertia(t,S,s,Math.abs(m)/f,m>0?1:-1,d,Math.abs(_)/f,_>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(Xt.End,c.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=i,s.tapCount=0,s}dispatchEvent(t){if(t.type===Xt.Tap){let i=new Date().getTime(),s=0;i-this._lastSetTapCountTime>et.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=i,t.tapCount=s}else(t.type===Xt.Change||t.type===Xt.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let i=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let r=0,n=t.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;i.push([r,s])}i.sort((s,r)=>s[0]-r[0]);for(let[s,r]of i)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,s,r,n,o,l,c,a){this.handle=Oh(t,()=>{let d=Date.now(),u=d-s,f=0,m=0,_=!0;r+=et.SCROLL_FRICTION*u,l+=et.SCROLL_FRICTION*u,r>0&&(_=!1,f=n*r*u),l>0&&(_=!1,m=c*l*u);let S=this.newGestureEvent(Xt.Change);S.translationX=f,S.translationY=m,i.forEach(k=>k.dispatchEvent(S)),_||this.inertia(t,i,d,r,n,o+f,l,c,a+m)})}onTouchMove(t){let i=Date.now();for(let s=0,r=t.changedTouches.length;s<r;s++){let n=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],l=this.newGestureEvent(Xt.Change,o.initialTarget);l.translationX=n.pageX-gt(o.rollingPageX),l.translationY=n.pageY-gt(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)}};mr.SCROLL_FRICTION=-.005,mr.HOLD_DELAY=700,mr.CLEAR_TAP_COUNT_TIME=400,Re([g0],mr,"isTouchDevice",1);var S0=mr,Ah=class extends ie{onclick(e,t){this._register(Q(e,Ie.CLICK,i=>t(new Dn(Jt(e),i))))}onmousedown(e,t){this._register(Q(e,Ie.MOUSE_DOWN,i=>t(new Dn(Jt(e),i))))}onmouseover(e,t){this._register(Q(e,Ie.MOUSE_OVER,i=>t(new Dn(Jt(e),i))))}onmouseleave(e,t){this._register(Q(e,Ie.MOUSE_LEAVE,i=>t(new Dn(Jt(e),i))))}onkeydown(e,t){this._register(Q(e,Ie.KEY_DOWN,i=>t(new fd(i))))}onkeyup(e,t){this._register(Q(e,Ie.KEY_UP,i=>t(new fd(i))))}oninput(e,t){this._register(Q(e,Ie.INPUT,t))}onblur(e,t){this._register(Q(e,Ie.BLUR,t))}onfocus(e,t){this._register(Q(e,Ie.FOCUS,t))}onchange(e,t){this._register(Q(e,Ie.CHANGE,t))}ignoreGesture(e){return S0.ignoreTarget(e)}},Sd=11,y0=class extends Ah{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=Sd+"px",this.domNode.style.height=Sd+"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 _m),this._register(vd(this.bgDomNode,Ie.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(vd(this.domNode,Ie.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new _0),this._pointerdownScheduleRepeatTimer=this._register(new zh)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Jt(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()}},w0=class lc{constructor(t,i,s,r,n,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,s=s|0,r=r|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=r,this.rawScrollTop=l,i<0&&(i=0),r+i>s&&(r=s-i),r<0&&(r=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=s,this.scrollLeft=r,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 lc(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 lc(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,i){let s=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,c=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:c}}},C0=class extends ie{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new w0(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var s;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;t?s=new wd(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=wd.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)))}},yd=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function Il(e,t){let i=t-e;return function(s){return e+i*k0(s)}}function x0(e,t,i){return function(s){return s<i?e(s/i):t((s-i)/(1-i))}}var wd=class ac{constructor(t,i,s,r){this.from=t,this.to=i,this.duration=r,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,i,s){if(Math.abs(t-i)>2.5*s){let r,n;return t<i?(r=t+.75*s,n=i-.75*s):(r=t-.75*s,n=i+.75*s),x0(Il(t,r),Il(n,i),.33)}return Il(t,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let i=(t-this.startTime)/this.duration;if(i<1){let s=this.scrollLeft(i),r=this.scrollTop(i);return new yd(s,r,!1)}return new yd(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,s){return ac.start(t,i,s)}static start(t,i,s){s=s+10;let r=Date.now()-10;return new ac(t,i,r,s)}};function b0(e){return Math.pow(e,3)}function k0(e){return 1-b0(1-e)}var E0=class extends ie{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 zh)}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":"")))}},N0=140,mm=class extends Ah{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 E0(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new _m),this._shouldRender=!0,this.domNode=Mr(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(Q(this.domNode.domNode,Ie.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new y0(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,s){this.slider=Mr(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Q(this.slider.domNode,Ie.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let r=m0(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let s=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let n=this._sliderOrthogonalPointerPosition(r),o=Math.abs(n-i);if(um&&o>N0){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let l=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(s.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()}},vm=class cc{constructor(t,i,s,r,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=r,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 cc(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,s,r,n){let o=Math.max(0,s-t),l=Math.max(0,o-2*i),c=r>0&&r>s;if(!c)return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let a=Math.round(Math.max(20,Math.floor(s*l/r))),d=(l-a)/(r-s),u=n*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(a),computedSliderRatio:d,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=cc._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,s=this._scrollPosition;return i<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},R0=class extends mm{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new vm(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},D0=class extends mm{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new vm(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},M0=500,Cd=50,L0=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},hc=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,i=0,s=1,r=this._rear;do{let n=r===this._front?t:Math.pow(2,-s);if(t-=n,i+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(Bh){let i=Jt(t.browserEvent),s=Hy(i);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,s){let r=null,n=new L0(t,i,s);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,r)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),i){let r=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),c=Math.max(Math.min(r,o),1),a=Math.max(Math.min(n,l),1),d=Math.max(r,o),u=Math.max(n,l);d%c===0&&u%a===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};hc.INSTANCE=new hc;var P0=hc,T0=class extends Ah{constructor(e,t,i){super(),this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new W),this.onWillScroll=this._onWillScroll.event,this._options=j0(t),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new D0(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new R0(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Mr(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Mr(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Mr(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new zh),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=cs(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,ti&&(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 _d(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=cs(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new _d(i))};this._mouseWheelToDispose.push(Q(this._listenOnDomNode,Ie.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var r;if((r=e.browserEvent)!=null&&r.defaultPrevented)return;let t=P0.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=!ti&&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 c=this._scrollable.getFutureScrollPosition(),a={};if(n){let d=Cd*n,u=c.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(a,u)}if(o){let d=Cd*o,u=c.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(a,u)}a=this._scrollable.validateScrollPosition(a),(c.scrollLeft!==a.scrollLeft||c.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,s=i?" left":"",r=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),M0)}},B0=class extends T0{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 j0(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,ti&&(t.className+=" mac"),t}var uc=class extends ie{constructor(e,t,i,s,r,n,o,l){super(),this._bufferService=i,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new W),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new C0({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:a=>Oh(s.window,a)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new B0(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(a=>{this._scrollableElement.updateOptions({handleMouseWheel:!(a&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Xe.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ye(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ye(()=>this._styleElement.remove())),this._register(Xe.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(a=>this._handleScroll(a)))}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}};uc=Re([K(2,at),K(3,vi),K(4,Q_),K(5,Ys),K(6,ct),K(7,gi)],uc);var dc=class extends ie{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(n=>this._removeDecoration(n))),this._register(ye(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};dc=Re([K(1,at),K(2,vi),K(3,rn),K(4,gi)],dc);var z0=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)}},qt={full:0,left:0,center:0,right:0},wi={full:0,left:0,center:0,right:0},nr={full:0,left:0,center:0,right:0},No=class extends ie{constructor(e,t,i,s,r,n,o,l){var a;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=n,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new z0,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(),(a=this._viewportElement.parentElement)==null||a.insertBefore(this._canvas,this._viewportElement),this._register(ye(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let c=this._canvas.getContext("2d");if(c)this._ctx=c;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);wi.full=this._canvas.width,wi.left=e,wi.center=t,wi.right=e,this._refreshDrawHeightConstants(),nr.full=1,nr.left=1,nr.center=1+wi.left,nr.right=1+wi.left+wi.center}_refreshDrawHeightConstants(){qt.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);qt.left=t,qt.center=t,qt.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qt.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qt.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qt.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qt.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(nr[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-qt[e.position||"full"]/2),wi[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+qt[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}))}};No=Re([K(2,at),K(3,rn),K(4,gi),K(5,ct),K(6,Ys),K(7,vi)],No);var O;(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=""))(O||(O={}));var Jn;(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=""))(Jn||(Jn={}));var gm;(e=>e.ST=`${O.ESC}\\`)(gm||(gm={}));var fc=class{constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${O.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};fc=Re([K(2,at),K(3,ct),K(4,fs),K(5,gi)],fc);var Fe=0,He=0,We=0,Ee=0,xd={css:"#00000000",rgba:0},Pe;(e=>{function t(r,n,o,l){return l!==void 0?`#${Ki(r)}${Ki(n)}${Ki(o)}${Ki(l)}`:`#${Ki(r)}${Ki(n)}${Ki(o)}`}e.toCss=t;function i(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}e.toRgba=i;function s(r,n,o,l){return{css:e.toCss(r,n,o,l),rgba:e.toRgba(r,n,o,l)}}e.toColor=s})(Pe||(Pe={}));var ve;(e=>{function t(c,a){if(Ee=(a.rgba&255)/255,Ee===1)return{css:a.css,rgba:a.rgba};let d=a.rgba>>24&255,u=a.rgba>>16&255,f=a.rgba>>8&255,m=c.rgba>>24&255,_=c.rgba>>16&255,S=c.rgba>>8&255;Fe=m+Math.round((d-m)*Ee),He=_+Math.round((u-_)*Ee),We=S+Math.round((f-S)*Ee);let k=Pe.toCss(Fe,He,We),v=Pe.toRgba(Fe,He,We);return{css:k,rgba:v}}e.blend=t;function i(c){return(c.rgba&255)===255}e.isOpaque=i;function s(c,a,d){let u=Zn.ensureContrastRatio(c.rgba,a.rgba,d);if(u)return Pe.toColor(u>>24&255,u>>16&255,u>>8&255)}e.ensureContrastRatio=s;function r(c){let a=(c.rgba|255)>>>0;return[Fe,He,We]=Zn.toChannels(a),{css:Pe.toCss(Fe,He,We),rgba:a}}e.opaque=r;function n(c,a){return Ee=Math.round(a*255),[Fe,He,We]=Zn.toChannels(c.rgba),{css:Pe.toCss(Fe,He,We,Ee),rgba:Pe.toRgba(Fe,He,We,Ee)}}e.opacity=n;function o(c,a){return Ee=c.rgba&255,n(c,Ee*a/255)}e.multiplyOpacity=o;function l(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}e.toColorRGB=l})(ve||(ve={}));var Ce;(e=>{let t,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Fe=parseInt(r.slice(1,2).repeat(2),16),He=parseInt(r.slice(2,3).repeat(2),16),We=parseInt(r.slice(3,4).repeat(2),16),Pe.toColor(Fe,He,We);case 5:return Fe=parseInt(r.slice(1,2).repeat(2),16),He=parseInt(r.slice(2,3).repeat(2),16),We=parseInt(r.slice(3,4).repeat(2),16),Ee=parseInt(r.slice(4,5).repeat(2),16),Pe.toColor(Fe,He,We,Ee);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Fe=parseInt(n[1]),He=parseInt(n[2]),We=parseInt(n[3]),Ee=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Pe.toColor(Fe,He,We,Ee);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Fe,He,We,Ee]=t.getImageData(0,0,1,1).data,Ee!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Pe.toRgba(Fe,He,We,Ee),css:r}}e.toColor=s})(Ce||(Ce={}));var st;(e=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,r,n){let o=s/255,l=r/255,c=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),u=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return a*.2126+d*.7152+u*.0722}e.relativeLuminance2=i})(st||(st={}));var Zn;(e=>{function t(o,l){if(Ee=(l&255)/255,Ee===1)return l;let c=l>>24&255,a=l>>16&255,d=l>>8&255,u=o>>24&255,f=o>>16&255,m=o>>8&255;return Fe=u+Math.round((c-u)*Ee),He=f+Math.round((a-f)*Ee),We=m+Math.round((d-m)*Ee),Pe.toRgba(Fe,He,We)}e.blend=t;function i(o,l,c){let a=st.relativeLuminance(o>>8),d=st.relativeLuminance(l>>8);if(ri(a,d)<c){if(d<a){let m=s(o,l,c),_=ri(a,st.relativeLuminance(m>>8));if(_<c){let S=r(o,l,c),k=ri(a,st.relativeLuminance(S>>8));return _>k?m:S}return m}let u=r(o,l,c),f=ri(a,st.relativeLuminance(u>>8));if(f<c){let m=s(o,l,c),_=ri(a,st.relativeLuminance(m>>8));return f>_?u:m}return u}}e.ensureContrastRatio=i;function s(o,l,c){let a=o>>24&255,d=o>>16&255,u=o>>8&255,f=l>>24&255,m=l>>16&255,_=l>>8&255,S=ri(st.relativeLuminance2(f,m,_),st.relativeLuminance2(a,d,u));for(;S<c&&(f>0||m>0||_>0);)f-=Math.max(0,Math.ceil(f*.1)),m-=Math.max(0,Math.ceil(m*.1)),_-=Math.max(0,Math.ceil(_*.1)),S=ri(st.relativeLuminance2(f,m,_),st.relativeLuminance2(a,d,u));return(f<<24|m<<16|_<<8|255)>>>0}e.reduceLuminance=s;function r(o,l,c){let a=o>>24&255,d=o>>16&255,u=o>>8&255,f=l>>24&255,m=l>>16&255,_=l>>8&255,S=ri(st.relativeLuminance2(f,m,_),st.relativeLuminance2(a,d,u));for(;S<c&&(f<255||m<255||_<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),S=ri(st.relativeLuminance2(f,m,_),st.relativeLuminance2(a,d,u));return(f<<24|m<<16|_<<8|255)>>>0}e.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=n})(Zn||(Zn={}));function Ki(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ri(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var O0=class extends sn{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()]}},Ro=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Bt}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let i=[],s=t.translateToString(!0),r=0,n=0,o=0,l=t.getFg(0),c=t.getBg(0);for(let a=0;a<t.getTrimmedLength();a++)if(t.loadCell(a,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==c){if(a-r>1){let d=this._getJoinedRanges(s,o,n,t,r);for(let u=0;u<d.length;u++)i.push(d[u])}r=a,o=n,l=this._workCell.fg,c=this._workCell.bg}n+=this._workCell.getChars().length||Mi.length}if(this._bufferService.cols-r>1){let a=this._getJoinedRanges(s,o,n,t,r);for(let d=0;d<a.length;d++)i.push(a[d])}return i}_getJoinedRanges(e,t,i,s,r){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 c=this._characterJoiners[l].handler(n);for(let a=0;a<c.length;a++)Ro._mergeRanges(o,c[a])}catch(c){console.error(c)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,o=e[s];if(o){for(let l=i;l<this._bufferService.cols;l++){let c=t.getWidth(l),a=t.getString(l).length||Mi.length;if(c!==0){if(!r&&o[0]<=n&&(o[0]=l,r=!0),o[1]<=n){if(o[1]=l,o=e[++s],!o)break;o[0]<=n?(o[0]=l,r=!0):r=!1}n+=a}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){let r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};Ro=Re([K(0,at)],Ro);function A0(e){return 57508<=e&&e<=57558}function I0(e){return 9472<=e&&e<=9631}function $0(e){return A0(e)||I0(e)}function F0(){return{css:{canvas:Mn(),cell:Mn()},device:{canvas:Mn(),cell:Mn(),char:{width:0,height:0,left:0,top:0}}}}function Mn(){return{width:0,height:0}}var pc=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new Bt,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,n,o,l,c,a,d){let u=[],f=this._characterJoinerService.getJoinedCharacters(t),m=this._themeService.colors,_=e.getNoBgTrimmedLength();i&&_<n+1&&(_=n+1);let S,k=0,v="",p=0,g=0,w=0,M=0,N=!1,x=0,C=!1,D=0,L=0,A=[],T=a!==-1&&d!==-1;for(let P=0;P<_;P++){e.loadCell(P,this._workCell);let j=this._workCell.getWidth();if(j===0)continue;let F=!1,$=P>=L,R=P,b=this._workCell;if(f.length>0&&P===f[0][0]&&$){let Z=f.shift(),Kt=this._isCellInSelection(Z[0],t);for(p=Z[0]+1;p<Z[1];p++)$&&($=Kt===this._isCellInSelection(p,t));$&&($=!i||n<Z[0]||n>=Z[1]),$?(F=!0,b=new O0(this._workCell,e.translateToString(!0,Z[0],Z[1]),Z[1]-Z[0]),R=Z[1]-1,j=b.getWidth()):L=Z[1]}let I=this._isCellInSelection(P,t),B=i&&P===n,U=T&&P>=a&&P<=d,X=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,Z=>{X=!0});let J=b.getChars()||Mi;if(J===" "&&(b.isUnderline()||b.isOverline())&&(J=" "),D=j*l-c.get(J,b.isBold(),b.isItalic()),!S)S=this._document.createElement("span");else if(k&&(I&&C||!I&&!C&&b.bg===g)&&(I&&C&&m.selectionForeground||b.fg===w)&&b.extended.ext===M&&U===N&&D===x&&!B&&!F&&!X&&$){b.isInvisible()?v+=Mi:v+=J,k++;continue}else k&&(S.textContent=v),S=this._document.createElement("span"),k=0,v="";if(g=b.bg,w=b.fg,M=b.extended.ext,N=U,x=D,C=I,F&&n>=P&&n<=R&&(n=P),!this._coreService.isCursorHidden&&B&&this._coreService.isCursorInitialized){if(A.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&A.push("xterm-cursor-blink"),A.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":A.push("xterm-cursor-outline");break;case"block":A.push("xterm-cursor-block");break;case"bar":A.push("xterm-cursor-bar");break;case"underline":A.push("xterm-cursor-underline");break}}if(b.isBold()&&A.push("xterm-bold"),b.isItalic()&&A.push("xterm-italic"),b.isDim()&&A.push("xterm-dim"),b.isInvisible()?v=Mi:v=b.getChars()||Mi,b.isUnderline()&&(A.push(`xterm-underline-${b.extended.underlineStyle}`),v===" "&&(v=" "),!b.isUnderlineColorDefault()))if(b.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${sn.toColorRGB(b.getUnderlineColor()).join(",")})`;else{let Z=b.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&b.isBold()&&Z<8&&(Z+=8),S.style.textDecorationColor=m.ansi[Z].css}b.isOverline()&&(A.push("xterm-overline"),v===" "&&(v=" ")),b.isStrikethrough()&&A.push("xterm-strikethrough"),U&&(S.style.textDecoration="underline");let ee=b.getFgColor(),oe=b.getFgColorMode(),ne=b.getBgColor(),pe=b.getBgColorMode(),z=!!b.isInverse();if(z){let Z=ee;ee=ne,ne=Z;let Kt=oe;oe=pe,pe=Kt}let V,ue,G=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,Z=>{Z.options.layer!=="top"&&G||(Z.backgroundColorRGB&&(pe=50331648,ne=Z.backgroundColorRGB.rgba>>8&16777215,V=Z.backgroundColorRGB),Z.foregroundColorRGB&&(oe=50331648,ee=Z.foregroundColorRGB.rgba>>8&16777215,ue=Z.foregroundColorRGB),G=Z.options.layer==="top")}),!G&&I&&(V=this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque,ne=V.rgba>>8&16777215,pe=50331648,G=!0,m.selectionForeground&&(oe=50331648,ee=m.selectionForeground.rgba>>8&16777215,ue=m.selectionForeground)),G&&A.push("xterm-decoration-top");let ce;switch(pe){case 16777216:case 33554432:ce=m.ansi[ne],A.push(`xterm-bg-${ne}`);break;case 50331648:ce=Pe.toColor(ne>>16,ne>>8&255,ne&255),this._addStyle(S,`background-color:#${bd((ne>>>0).toString(16),"0",6)}`);break;case 0:default:z?(ce=m.foreground,A.push("xterm-bg-257")):ce=m.background}switch(V||b.isDim()&&(V=ve.multiplyOpacity(ce,.5)),oe){case 16777216:case 33554432:b.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(S,ce,m.ansi[ee],b,V,void 0)||A.push(`xterm-fg-${ee}`);break;case 50331648:let Z=Pe.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(S,ce,Z,b,V,ue)||this._addStyle(S,`color:#${bd(ee.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,ce,m.foreground,b,V,ue)||z&&A.push("xterm-fg-257")}A.length&&(S.className=A.join(" "),A.length=0),!B&&!F&&!X&&$?k++:S.textContent=v,D!==this.defaultSpacing&&(S.style.letterSpacing=`${D}px`),u.push(S),P=R}return S&&k&&(S.textContent=v),u}_applyMinimumContrast(e,t,i,s,r,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||$0(s.getCode()))return!1;let o=this._getContrastCache(s),l;if(!r&&!n&&(l=o.getColor(t.rgba,i.rgba)),l===void 0){let c=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);l=ve.ensureContrastRatio(r||t,n||i,c),o.setColor((r||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,s=this._selectionEnd;return!i||!s?!1:this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0]}};pc=Re([K(1,em),K(2,ct),K(3,vi),K(4,fs),K(5,rn),K(6,Ys)],pc);function bd(e,t,i){for(;e.length<i;)e=t+e;return e}var H0=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let i=e.createElement("span");i.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,s,r,n],this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,i){let s=0;if(!t&&!i&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let o=this._measure(e,0);return o>0&&(this._flat[s]=o),o}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(n===void 0){let o=0;t&&(o|=1),i&&(o|=2),n=this._measure(e,o),n>0&&this._holey.set(r,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},W0=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,l=Math.max(n,0),c=Math.min(o,e.rows-1);if(l>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=c,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 U0(){return new W0}var $l="xterm-dom-renderer-owner-",Nt="xterm-rows",Ln="xterm-fg-",kd="xterm-bg-",or="xterm-focus",Pn="xterm-selection",K0=1,_c=class extends ie{constructor(e,t,i,s,r,n,o,l,c,a,d,u,f,m){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=n,this._linkifier2=o,this._charSizeService=c,this._optionsService=a,this._bufferService=d,this._coreService=u,this._coreBrowserService=f,this._themeService=m,this._terminalClass=K0++,this._rowElements=[],this._selectionRenderModel=U0(),this.onRequestRedraw=this._register(new W).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Nt),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(Pn),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=F0(),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(pc,document),this._element.classList.add($l+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(ye(()=>{this._element.classList.remove($l+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new H0(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} .${Nt} 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} .${Nt} { 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} .${Nt} .xterm-dim { color: ${ve.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Nt}.${or} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Nt}.${or} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Nt}.${or} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Nt} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Nt} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Nt} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Nt} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Nt} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Pn} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Pn} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Pn} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${Ln}${n} { color: ${o.css}; }${this._terminalSelector} .${Ln}${n}.xterm-dim { color: ${ve.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${kd}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${Ln}257 { color: ${ve.opaque(e.background).css}; }${this._terminalSelector} .${Ln}257.xterm-dim { color: ${ve.multiplyOpacity(ve.opaque(e.background),.5).css}; }${this._terminalSelector} .${kd}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(or),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(or),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(i){let c=e[0]>t[0];l.appendChild(this._createSelectionElement(n,c?t[0]:e[0],c?e[0]:t[0],o-n+1))}else{let c=s===n?e[0]:0,a=n===r?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(n,c,a));let d=o-n-1;if(l.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,d)),n!==o){let u=r===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,u))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,i,s=1){let r=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),r.style.height=`${s*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${n}px`,r.style.width=`${o}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let a=c+i.ydisp,d=this._rowElements[c],u=i.lines.get(a);if(!d||!u)break;d.replaceChildren(...this._rowFactory.createRow(u,a,a===s,o,l,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${$l}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,s,r,n){i<0&&(e=0),s<0&&(t=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);let l=this._bufferService.buffer,c=l.ybase+l.y,a=Math.min(l.x,r-1),d=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=i;m<=s;++m){let _=m+l.ydisp,S=this._rowElements[m],k=l.lines.get(_);if(!S||!k)break;S.replaceChildren(...this._rowFactory.createRow(k,_,_===c,u,f,a,d,this.dimensions.css.cell.width,this._widthCache,n?m===i?e:0:-1,n?(m===s?t:r)-1:-1))}}};_c=Re([K(7,Lh),K(8,il),K(9,ct),K(10,at),K(11,fs),K(12,vi),K(13,Ys)],_c);var mc=class extends ie{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new W),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new q0(this._optionsService))}catch{this._measureStrategy=this._register(new V0(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())}};mc=Re([K(2,ct)],mc);var Sm=class extends ie{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)}},V0=class extends Sm{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}},q0=class extends Sm{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}},Y0=class extends ie{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 X0(this._window)),this._onDprChange=this._register(new W),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new W),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(Xe.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Q(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Q(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}},X0=class extends ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Us),this._onDprChange=this._register(new W),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ye(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Q(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)}},G0=class extends ie{constructor(){super(),this.linkProviders=[],this._register(ye(()=>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 Ih(e,t,i){let s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-o]}function Q0(e,t,i,s,r,n,o,l,c){if(!n)return;let a=Ih(e,t,i);if(a)return a[0]=Math.ceil((a[0]+(c?o/2:0))/o),a[1]=Math.ceil(a[1]/l),a[0]=Math.min(Math.max(a[0],1),s+(c?1:0)),a[1]=Math.min(Math.max(a[1],1),r),a}var vc=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return Q0(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=Ih(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])}}};vc=Re([K(0,gi),K(1,il)],vc);var J0=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=[]}},ym={};ay(ym,{getSafariVersion:()=>ew,isChromeOS:()=>bm,isFirefox:()=>wm,isIpad:()=>tw,isIphone:()=>iw,isLegacyEdge:()=>Z0,isLinux:()=>$h,isMac:()=>Do,isNode:()=>sl,isSafari:()=>Cm,isWindows:()=>xm});var sl=typeof process<"u"&&"title"in process,nn=sl?"node":navigator.userAgent,on=sl?"node":navigator.platform,wm=nn.includes("Firefox"),Z0=nn.includes("Edge"),Cm=/^((?!chrome|android).)*safari/i.test(nn);function ew(){if(!Cm)return 0;let e=nn.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Do=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(on),tw=on==="iPad",iw=on==="iPhone",xm=["Windows","Win16","Win32","WinCE"].includes(on),$h=on.indexOf("Linux")>=0,bm=/\bCrOS\b/.test(nn),km=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),r=e.timeRemaining(),i*1.5>r){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},sw=class extends km{_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())}}},rw=class extends km{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Mo=!sl&&"requestIdleCallback"in window?rw:sw,nw=class{constructor(){this._queue=new Mo}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},gc=class extends ie{constructor(e,t,i,s,r,n,o,l,c){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=s,this._coreService=r,this._coreBrowserService=l,this._renderer=this._register(new Us),this._pausedResizeTask=new nw,this._observerDisposable=this._register(new Us),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 W),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new W),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new W),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new W),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new J0((a,d)=>this._renderRows(a,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new ow(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ye(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var a;return(a=this._renderer.value)==null?void 0:a.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(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(a=>this._registerIntersectionObserver(a,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=ye(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,i){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};gc=Re([K(2,ct),K(3,il),K(4,fs),K(5,rn),K(6,at),K(7,vi),K(8,Ys)],gc);var ow=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 lw(e,t,i,s){let r=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return hw(r,n,e,t,i,s)+rl(n,t,i,s)+uw(r,n,e,t,i,s);let o;if(n===t)return o=r>e?"D":"C",Xr(Math.abs(r-e),Yr(o,s));o=n>t?"D":"C";let l=Math.abs(n-t),c=cw(n>t?e:r,i)+(l-1)*i.cols+1+aw(n>t?r:e);return Xr(c,Yr(o,s))}function aw(e,t){return e-1}function cw(e,t){return t.cols-e}function hw(e,t,i,s,r,n){return rl(t,s,r,n).length===0?"":Xr(Nm(e,t,e,t-hs(t,r),!1,r).length,Yr("D",n))}function rl(e,t,i,s){let r=e-hs(e,i),n=t-hs(t,i),o=Math.abs(r-n)-dw(e,t,i);return Xr(o,Yr(Em(e,t),s))}function uw(e,t,i,s,r,n){let o;rl(t,s,r,n).length>0?o=s-hs(s,r):o=t;let l=s,c=fw(e,t,i,s,r,n);return Xr(Nm(e,o,i,l,c==="C",r).length,Yr(c,n))}function dw(e,t,i){var o;let s=0,r=e-hs(e,i),n=t-hs(t,i);for(let l=0;l<Math.abs(r-n);l++){let c=Em(e,t)==="A"?-1:1;(o=i.buffer.lines.get(r+c*l))!=null&&o.isWrapped&&s++}return s}function hs(e,t){let i=0,s=t.buffer.lines.get(e),r=s==null?void 0:s.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=s==null?void 0:s.isWrapped;return i}function fw(e,t,i,s,r,n){let o;return rl(i,s,r,n).length>0?o=s-hs(s,r):o=t,e<i&&o<=s||e>=i&&o<s?"C":"D"}function Em(e,t){return e>t?"A":"B"}function Nm(e,t,i,s,r,n){let o=e,l=t,c="";for(;(o!==i||l!==s)&&l>=0&&l<n.buffer.lines.length;)o+=r?1:-1,r&&o>n.cols-1?(c+=n.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!r&&o<0&&(c+=n.buffer.translateBufferLineToString(l,!1,0,e+1),o=n.cols-1,e=o,l--);return c+n.buffer.translateBufferLineToString(l,!1,e,o)}function Yr(e,t){let i=t?"O":"[";return O.ESC+i+e}function Xr(e,t){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=t;return i}var pw=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 Ed(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 Fl=50,_w=15,mw=50,vw=500,gw=" ",Sw=new RegExp(gw,"g"),Sc=class extends ie{constructor(e,t,i,s,r,n,o,l,c){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=o,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Bt,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new W),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new W),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new W),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new W),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=a=>this._handleMouseMove(a),this._mouseUpListener=a=>this._handleMouseUp(a),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(a=>this._handleTrim(a)),this._register(this._bufferService.buffers.onBufferActivate(a=>this._handleBufferActivate(a))),this.enable(),this._model=new pw(this._bufferService),this._activeSelectionMode=0,this._register(ye(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(a=>{a.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=i.translateBufferLineToString(o,!0,r,n);s.push(l)}}else{let r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let n=e[1]+1;n<=t[1]-1;n++){let o=i.lines.get(n),l=i.translateBufferLineToString(n,!0);o!=null&&o.isWrapped?s[s.length-1]+=l:s.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?s[s.length-1]+=o:s.push(o)}}return s.map(r=>r.replace(Sw," ")).join(xm?`\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())),$h&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s||!t?!1:this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s?!1:this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var r,n;let i=(n=(r=this._linkifier.currentLink)==null?void 0:r.link)==null?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=Ed(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Ih(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,-Fl),Fl),t/=Fl,t/Math.abs(t)+Math.round(t*(_w-1)))}shouldForceSelection(e){return Do?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(),mw)}_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&&!(Do&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let s=i.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<vw&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let s=lw(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;let o=r.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(n,e[0]),c=l,a=e[0]-l,d=0,u=0,f=0,m=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;c<o.length&&o.charAt(c+1)===" ";)c++}else{let k=e[0],v=e[0];n.getWidth(k)===0&&(d++,k--),n.getWidth(v)===2&&(u++,v++);let p=n.getString(v).length;for(p>1&&(m+=p-1,c+=p-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?(d++,k--):g>1&&(f+=g-1,l-=g-1),l--,k--}for(;v<n.length&&c+1<o.length&&!this._isCharWordSeparator(n.loadCell(v+1,this._workCell));){n.loadCell(v+1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===2?(u++,v++):g>1&&(m+=g-1,c+=g-1),c++,v++}}c++;let _=l+a-d+f,S=Math.min(this._bufferService.cols,c-l+d+u-f-m);if(!(!t&&o.slice(l,c).trim()==="")){if(i&&_===0&&n.getCodePoint(0)!==32){let k=r.lines.get(e[1]-1);if(k&&n.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let v=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(v){let p=this._bufferService.cols-v.start;_-=p,S+=p}}}if(s&&_+S===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let k=r.lines.get(e[1]+1);if(k!=null&&k.isWrapped&&k.getCodePoint(0)!==32){let v=this._getWordAt([0,e[1]+1],!1,!1,!0);v&&(S+=v.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=Ed(i,this._bufferService.cols)}};Sc=Re([K(3,at),K(4,fs),K(5,Ph),K(6,ct),K(7,gi),K(8,vi)],Sc);var Nd=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={}}},Rd=class{constructor(){this._color=new Nd,this._css=new Nd}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()}},Be=Object.freeze((()=>{let e=[Ce.toColor("#2e3436"),Ce.toColor("#cc0000"),Ce.toColor("#4e9a06"),Ce.toColor("#c4a000"),Ce.toColor("#3465a4"),Ce.toColor("#75507b"),Ce.toColor("#06989a"),Ce.toColor("#d3d7cf"),Ce.toColor("#555753"),Ce.toColor("#ef2929"),Ce.toColor("#8ae234"),Ce.toColor("#fce94f"),Ce.toColor("#729fcf"),Ce.toColor("#ad7fa8"),Ce.toColor("#34e2e2"),Ce.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:Pe.toCss(s,r,n),rgba:Pe.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;e.push({css:Pe.toCss(s,s,s),rgba:Pe.toRgba(s,s,s)})}return e})()),Yi=Ce.toColor("#ffffff"),vr=Ce.toColor("#000000"),Dd=Ce.toColor("#ffffff"),Md=vr,lr={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},yw=Yi,yc=class extends ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new Rd,this._halfContrastCache=new Rd,this._onChangeColors=this._register(new W),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Yi,background:vr,cursor:Dd,cursorAccent:Md,selectionForeground:void 0,selectionBackgroundTransparent:lr,selectionBackgroundOpaque:ve.blend(vr,lr),selectionInactiveBackgroundTransparent:lr,selectionInactiveBackgroundOpaque:ve.blend(vr,lr),scrollbarSliderBackground:ve.opacity(Yi,.2),scrollbarSliderHoverBackground:ve.opacity(Yi,.4),scrollbarSliderActiveBackground:ve.opacity(Yi,.5),overviewRulerBorder:Yi,ansi:Be.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=de(e.foreground,Yi),t.background=de(e.background,vr),t.cursor=ve.blend(t.background,de(e.cursor,Dd)),t.cursorAccent=ve.blend(t.background,de(e.cursorAccent,Md)),t.selectionBackgroundTransparent=de(e.selectionBackground,lr),t.selectionBackgroundOpaque=ve.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=de(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ve.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?de(e.selectionForeground,xd):void 0,t.selectionForeground===xd&&(t.selectionForeground=void 0),ve.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ve.opacity(t.selectionBackgroundTransparent,.3)),ve.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ve.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=de(e.scrollbarSliderBackground,ve.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=de(e.scrollbarSliderHoverBackground,ve.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=de(e.scrollbarSliderActiveBackground,ve.opacity(t.foreground,.5)),t.overviewRulerBorder=de(e.overviewRulerBorder,yw),t.ansi=Be.slice(),t.ansi[0]=de(e.black,Be[0]),t.ansi[1]=de(e.red,Be[1]),t.ansi[2]=de(e.green,Be[2]),t.ansi[3]=de(e.yellow,Be[3]),t.ansi[4]=de(e.blue,Be[4]),t.ansi[5]=de(e.magenta,Be[5]),t.ansi[6]=de(e.cyan,Be[6]),t.ansi[7]=de(e.white,Be[7]),t.ansi[8]=de(e.brightBlack,Be[8]),t.ansi[9]=de(e.brightRed,Be[9]),t.ansi[10]=de(e.brightGreen,Be[10]),t.ansi[11]=de(e.brightYellow,Be[11]),t.ansi[12]=de(e.brightBlue,Be[12]),t.ansi[13]=de(e.brightMagenta,Be[13]),t.ansi[14]=de(e.brightCyan,Be[14]),t.ansi[15]=de(e.brightWhite,Be[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<i;s++)t.ansi[s+16]=de(e.extendedAnsi[s],Be[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};yc=Re([K(0,ct)],yc);function de(e,t){if(e!==void 0)try{return Ce.toColor(e)}catch{}return t}var ww=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)}},Cw=class{constructor(){this._services=new ww,this._services.set(Lh,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=_y(e).sort((n,o)=>n.index-o.index),s=[];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}.`);s.push(o)}let r=i.length>0?i[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},xw={trace:0,debug:1,info:2,warn:3,error:4,off:5},bw="xterm.js: ",wc=class extends ie{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=xw[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?"":bw)+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)}};wc=Re([K(0,ct)],wc);var Ld=class extends ie{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new W),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new W),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new W),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let s=this._length+i.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},te=3,Le=Object.freeze(new sn),Tn=0,Hl=2,gr=class Rm{constructor(t,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*te);let r=i||Bt.fromCharData([0,q_,1,0]);for(let n=0;n<t;++n)this.setCell(n,r);this.length=t}get(t){let i=this._data[t*te+0],s=i&2097151;return[this._data[t*te+1],i&2097152?this._combined[t]:s?ki(s):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,i){this._data[t*te+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*te+0]=t|2097152|i[2]<<22):this._data[t*te+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*te+0]>>22}hasWidth(t){return this._data[t*te+0]&12582912}getFg(t){return this._data[t*te+1]}getBg(t){return this._data[t*te+2]}hasContent(t){return this._data[t*te+0]&4194303}getCodePoint(t){let i=this._data[t*te+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*te+0]&2097152}getString(t){let i=this._data[t*te+0];return i&2097152?this._combined[t]:i&2097151?ki(i&2097151):""}isProtected(t){return this._data[t*te+2]&536870912}loadCell(t,i){return Tn=t*te,i.content=this._data[Tn+0],i.fg=this._data[Tn+1],i.bg=this._data[Tn+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*te+0]=i.content,this._data[t*te+1]=i.fg,this._data[t*te+2]=i.bg}setCellFromCodepoint(t,i,s,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*te+0]=i|s<<22,this._data[t*te+1]=r.fg,this._data[t*te+2]=r.bg}addCodepointToCell(t,i,s){let r=this._data[t*te+0];r&2097152?this._combined[t]+=ki(i):r&2097151?(this._combined[t]=ki(r&2097151)+ki(i),r&=-2097152,r|=2097152):r=i|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[t*te+0]=r}insertCells(t,i,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length-t){let r=new Bt;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,r));for(let n=0;n<i;++n)this.setCell(t+n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,i,s){if(t%=this.length,i<this.length-t){let r=new Bt;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,r));for(let n=this.length-i;n<this.length;++n)this.setCell(n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,i,s,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.setCell(t++,s)}resize(t,i){if(t===this.length)return this._data.length*4*Hl<this._data.buffer.byteLength;let s=t*te;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let l=parseInt(r[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,s*4*Hl<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Hl<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new Rm(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*te+0]&4194303)return t+(this._data[t*te+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*te+0]&4194303||this._data[t*te+2]&50331648)return t+(this._data[t*te+0]>>22);return 0}copyCellsFrom(t,i,s,r,n){let o=t._data;if(n)for(let c=r-1;c>=0;c--){for(let a=0;a<te;a++)this._data[(s+c)*te+a]=o[(i+c)*te+a];o[(i+c)*te+2]&268435456&&(this._extendedAttrs[s+c]=t._extendedAttrs[i+c])}else for(let c=0;c<r;c++){for(let a=0;a<te;a++)this._data[(s+c)*te+a]=o[(i+c)*te+a];o[(i+c)*te+2]&268435456&&(this._extendedAttrs[s+c]=t._extendedAttrs[i+c])}let l=Object.keys(t._combined);for(let c=0;c<l.length;c++){let a=parseInt(l[c],10);a>=i&&(this._combined[a-i+s]=t._combined[a])}}translateToString(t,i,s,r){i=i??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i<s;){let o=this._data[i*te+0],l=o&2097151,c=o&2097152?this._combined[i]:l?ki(l):Mi;if(n+=c,r)for(let a=0;a<c.length;++a)r.push(i);i+=o>>22||1}return r&&r.push(i),n}};function kw(e,t,i,s,r,n){let o=[];for(let l=0;l<e.length-1;l++){let c=l,a=e.get(++c);if(!a.isWrapped)continue;let d=[e.get(l)];for(;c<e.length&&a.isWrapped;)d.push(a),a=e.get(++c);if(!n&&s>=l&&s<c){l+=d.length-1;continue}let u=0,f=Gr(d,u,t),m=1,_=0;for(;m<d.length;){let k=Gr(d,m,t),v=k-_,p=i-f,g=Math.min(v,p);d[u].copyCellsFrom(d[m],_,f,g,!1),f+=g,f===i&&(u++,f=0),_+=g,_===k&&(m++,_=0),f===0&&u!==0&&d[u-1].getWidth(i-1)===2&&(d[u].copyCellsFrom(d[u-1],i-1,f++,1,!1),d[u-1].setCell(i-1,r))}d[u].replaceCells(f,i,r);let S=0;for(let k=d.length-1;k>0&&(k>u||d[k].getTrimmedLength()===0);k--)S++;S>0&&(o.push(l+d.length-S),o.push(S)),l+=d.length-1}return o}function Ew(e,t){let i=[],s=0,r=t[s],n=0;for(let o=0;o<e.length;o++)if(r===o){let l=t[++s];e.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,r=t[++s]}else i.push(o);return{layout:i,countRemoved:n}}function Nw(e,t){let i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length}function Rw(e,t,i){let s=[],r=e.map((c,a)=>Gr(e,a,t)).reduce((c,a)=>c+a),n=0,o=0,l=0;for(;l<r;){if(r-l<i){s.push(r-l);break}n+=i;let c=Gr(e,o,t);n>c&&(n-=c,o++);let a=e[o].getWidth(n-1)===2;a&&n--;let d=a?i-1:i;s.push(d),l+=d}return s}function Gr(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,r=e[t+1].getWidth(0)===2;return s&&r?i-1:i}var Dm=class Mm{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Mm._nextId++,this._onDispose=this.register(new W),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),cs(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Dm._nextId=1;var Dw=Dm,Ae={},Xi=Ae.B;Ae[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ae.A={"#":"£"};Ae.B=void 0;Ae[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ae.C=Ae[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ae.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ae.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ae.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ae.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ae.E=Ae[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ae.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ae.H=Ae[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ae["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Pd=4294967295,Td=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=Le.clone(),this.savedCharset=Xi,this.markers=[],this._nullCell=Bt.fromCharData([0,q_,1,0]),this._whitespaceCell=Bt.fromCharData([0,Mi,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Mo,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Ld(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 Eo),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 Eo),this._whitespaceCell}getBlankLine(e,t){return new gr(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>Pd?Pd:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Le);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 Ld(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(Le),s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)s+=+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 gr(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 gr(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(r<this.lines.maxLength){let o=this.lines.length-r;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=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=kw(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Le),i);if(s.length>0){let r=Ew(this.lines,s);Nw(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let s=this.getNullCell(Le),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new gr(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(Le),r=[],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 c=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);if(!i){let g=this.ybase+this.y;if(g>=o&&g<o+c.length)continue}let a=c[c.length-1].getTrimmedLength(),d=Rw(c,this._cols,e),u=d.length-c.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+u):f=Math.max(0,this.lines.length-this.lines.maxLength+u);let m=[];for(let g=0;g<u;g++){let w=this.getBlankLine(Le,!0);m.push(w)}m.length>0&&(r.push({start:o+c.length+n,newLines:m}),n+=m.length),c.push(...m);let _=d.length-1,S=d[_];S===0&&(_--,S=d[_]);let k=c.length-u-1,v=a;for(;k>=0;){let g=Math.min(v,S);if(c[_]===void 0)break;if(c[_].copyCellsFrom(c[k],v-g,S-g,g,!0),S-=g,S===0&&(_--,S=d[_]),v-=g,v===0){k--;let w=Math.max(k,0);v=Gr(c,w,this._cols)}}for(let g=0;g<c.length;g++)d[g]<e&&c[g].setCell(d[g],s);let p=u-f;for(;p-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+t-1)}if(r.length>0){let o=[],l=[];for(let S=0;S<this.lines.length;S++)l.push(this.lines.get(S));let c=this.lines.length,a=c-1,d=0,u=r[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let f=0;for(let S=Math.min(this.lines.maxLength-1,c+n-1);S>=0;S--)if(u&&u.start>a+f){for(let k=u.newLines.length-1;k>=0;k--)this.lines.set(S--,u.newLines[k]);S++,o.push({index:a+1,amount:u.newLines.length}),f+=u.newLines.length,u=r[++d]}else this.lines.set(S,l[a--]);let m=0;for(let S=o.length-1;S>=0;S--)o[S].index+=m,this.lines.onInsertEmitter.fire(o[S]),m+=o[S].amount;let _=Math.max(0,c+n-this.lines.maxLength);_>0&&this.lines.onTrimEmitter.fire(_)}}translateBufferLineToString(e,t,i=0,s){let r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new Dw(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)}},Mw=class extends ie{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new W),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 Td(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Td(!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)}},Lm=2,Pm=1,Cc=class extends ie{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new W),this.onResize=this._onResize.event,this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Lm),this.rows=Math.max(e.rawOptions.rows||0,Pm),this.buffers=this._register(new Mw(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-r+1;i.lines.shiftElements(r+1,o-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};Cc=Re([K(0,ct)],Cc);var vs={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:Do,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Lw=["normal","bold","100","200","300","400","500","600","700","800","900"],Pw=class extends ie{constructor(e){super(),this._onOptionChange=this._register(new W),this.onOptionChange=this._onOptionChange.event;let t={...vs};for(let i in e)if(i in t)try{let s=e[i];t[i]=this._sanitizeAndValidateOption(i,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ye(()=>{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 vs))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,s)=>{if(!(i in vs))throw new Error(`No option with key "${i}"`);s=this._sanitizeAndValidateOption(i,s),this.rawOptions[i]!==s&&(this.rawOptions[i]=s,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let s={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=vs[e]),!Tw(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=vs[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Lw.includes(t)?t:vs[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 Tw(e){return e==="block"||e==="underline"||e==="bar"}function Sr(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let s in e)i[s]=t<=1?e[s]:e[s]&&Sr(e[s],t-1);return i}var Bd=Object.freeze({insertMode:!1}),jd=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),xc=class extends ie{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 W),this.onData=this._onData.event,this._onUserInput=this._register(new W),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new W),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new W),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Sr(Bd),this.decPrivateModes=Sr(jd)}reset(){this.modes=Sr(Bd),this.decPrivateModes=Sr(jd)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};xc=Re([K(0,at),K(1,J_),K(2,ct)],xc);var zd={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 Wl(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 Ul=String.fromCharCode,Od={DEFAULT:e=>{let t=[Wl(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Ul(t[0])}${Ul(t[1])}${Ul(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Wl(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Wl(e,!0)};${e.x};${e.y}${t}`}},bc=class extends ie{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 W),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(zd))this.addProtocol(s,zd[s]);for(let s of Object.keys(Od))this.addEncoding(s,Od[s]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let s=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};bc=Re([K(0,at),K(1,fs),K(2,ct)],bc);var Kl=[[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]],Bw=[[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]],je;function jw(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var zw=class{constructor(){if(this.version="6",!je){je=new Uint8Array(65536),je.fill(1),je[0]=0,je.fill(0,1,32),je.fill(0,127,160),je.fill(2,4352,4448),je[9001]=2,je[9002]=2,je.fill(2,11904,42192),je[12351]=1,je.fill(2,44032,55204),je.fill(2,63744,64256),je.fill(2,65040,65050),je.fill(2,65072,65136),je.fill(2,65280,65377),je.fill(2,65504,65511);for(let e=0;e<Kl.length;++e)je.fill(0,Kl[e][0],Kl[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?je[e]:jw(e,Bw)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=es.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return es.createPropertyValue(0,i,s)}},es=class eo{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new W,this.onChange=this._onChange.event;let t=new zw;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,s=!1){return(t&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,s=0,r=t.length;for(let n=0;n<r;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return i+this.wcwidth(o);let a=t.charCodeAt(n);56320<=a&&a<=57343?o=(o-55296)*1024+a-56320+65536:i+=this.wcwidth(a)}let l=this.charProperties(o,s),c=eo.extractWidth(l);eo.extractShouldJoin(l)&&(c-=eo.extractWidth(s)),i+=c,s=l}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},Ow=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Ad(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var ar=2147483647,Aw=256,Tm=class kc{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>Aw)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 kc;if(!t.length)return i;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let r=t[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)i.addSubParam(r[n]);else i.addParam(r)}return i}clone(){let t=new kc(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>ar?ar: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>ar?ar:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&(t[i]=this._subParams.slice(s,r))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+t,ar):t}},cr=[],Iw=class{constructor(){this._state=0,this._active=cr,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=cr}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=cr,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||cr,!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",tl(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].end(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=cr,this._id=-1,this._state=0}}},St=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+=tl(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}},hr=[],$w=class{constructor(){this._handlers=Object.create(null),this._active=hr,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=hr}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=hr,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||hr,!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",tl(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].unhook(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=hr,this._ident=0}},yr=new Tm;yr.addParam(0);var Id=class{constructor(e){this._handler=e,this._data="",this._params=yr,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():yr,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=tl(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=yr,this._data="",this._hitLimit=!1,i));return this._params=yr,this._data="",this._hitLimit=!1,t}},Fw=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|s}},Dt=160,Hw=function(){let e=new Fw(4095),t=Array.apply(null,Array(256)).map((l,c)=>c),i=(l,c)=>t.slice(l,c),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),o;e.setDefault(1,0),e.addMany(s,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(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Dt,0,2,0),e.add(Dt,8,5,8),e.add(Dt,6,0,6),e.add(Dt,11,0,11),e.add(Dt,13,13,13),e}(),Ww=class extends ie{constructor(e=Hw){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 Tm,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ye(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Iw),this._dcsParser=this._register(new $w),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let n=e.intermediates.charCodeAt(r);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let s=this._escHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let s=this._csiHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s=0,r=0,n=0,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,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&c>-1){for(;c>=0&&(o=l[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 4:if(i===!1&&c>-1){for(;c>=0&&(o=l[c](),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(s!==24&&s!==26,i),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],o=this._oscParser.end(s!==24&&s!==26,i),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=n;l<t;++l){switch(s=e[l],r=this._transitions.table[this.currentState<<8|(s<160?s:Dt)],r>>4){case 2:for(let f=l+1;;++f){if(f>=t||(s=e[f])<32||s>126&&s<Dt){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<Dt){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<Dt){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<Dt){this._printHandler(e,l,f),l=f-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let c=this._csiHandlers[this._collect<<8|s],a=c?c.length-1:-1;for(;a>=0&&(o=c[a](this._params),o!==!0);a--)if(o instanceof Promise)return this._preserveStack(3,c,a,r,l),o;a<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++l<t&&(s=e[l])>47&&s<60);l--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let d=this._escHandlers[this._collect<<8|s],u=d?d.length-1:-1;for(;u>=0&&(o=d[u](),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(4,d,u,r,l),o;u<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let f=l+1;;++f)if(f>=t||(s=e[f])===24||s===26||s===27||s>127&&s<Dt){this._dcsParser.put(e,l,f),l=f-1;break}break;case 14:if(o=this._dcsParser.unhook(s!==24&&s!==26),o)return this._preserveStack(6,[],0,r,l),o;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=l+1;;f++)if(f>=t||(s=e[f])<32||s>127&&s<Dt){this._oscParser.put(e,l,f),l=f-1;break}break;case 6:if(o=this._oscParser.end(s!==24&&s!==26),o)return this._preserveStack(5,[],0,r,l),o;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},Uw=/^([\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})$/,Kw=/^[\da-f]+$/;function $d(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=Uw.exec(t);if(i){let s=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/s*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/s*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),Kw.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(t.slice(i*r,i*r+i),16);s[r]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return s}}function Vl(e,t){let i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function Vw(e,t=16){let[i,s,r]=e;return`rgb:${Vl(i,t)}/${Vl(s,t)}/${Vl(r,t)}`}var qw={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ci=131072,Fd=10;function Hd(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 Wd=5e3,Ud=0,Yw=class extends ie{constructor(e,t,i,s,r,n,o,l,c=new Ww){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new fy,this._utf8Decoder=new py,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Le.clone(),this._eraseAttrDataInternal=Le.clone(),this._onRequestBell=this._register(new W),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new W),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new W),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new W),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new W),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new W),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new W),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new W),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new W),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new W),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new W),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new W),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 Ec(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(a=>this._activeBuffer=a.activeBuffer)),this._parser.setCsiHandlerFallback((a,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(a),params:d.toArray()})}),this._parser.setEscHandlerFallback(a=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(a)})}),this._parser.setExecuteHandlerFallback(a=>{this._logService.debug("Unknown EXECUTE code: ",{code:a})}),this._parser.setOscHandlerFallback((a,d,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:a,action:d,data:u})}),this._parser.setDcsHandlerFallback((a,d,u)=>{d==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(a),action:d,payload:u})}),this._parser.setPrintHandler((a,d,u)=>this.print(a,d,u)),this._parser.registerCsiHandler({final:"@"},a=>this.insertChars(a)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},a=>this.scrollLeft(a)),this._parser.registerCsiHandler({final:"A"},a=>this.cursorUp(a)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},a=>this.scrollRight(a)),this._parser.registerCsiHandler({final:"B"},a=>this.cursorDown(a)),this._parser.registerCsiHandler({final:"C"},a=>this.cursorForward(a)),this._parser.registerCsiHandler({final:"D"},a=>this.cursorBackward(a)),this._parser.registerCsiHandler({final:"E"},a=>this.cursorNextLine(a)),this._parser.registerCsiHandler({final:"F"},a=>this.cursorPrecedingLine(a)),this._parser.registerCsiHandler({final:"G"},a=>this.cursorCharAbsolute(a)),this._parser.registerCsiHandler({final:"H"},a=>this.cursorPosition(a)),this._parser.registerCsiHandler({final:"I"},a=>this.cursorForwardTab(a)),this._parser.registerCsiHandler({final:"J"},a=>this.eraseInDisplay(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},a=>this.eraseInDisplay(a,!0)),this._parser.registerCsiHandler({final:"K"},a=>this.eraseInLine(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},a=>this.eraseInLine(a,!0)),this._parser.registerCsiHandler({final:"L"},a=>this.insertLines(a)),this._parser.registerCsiHandler({final:"M"},a=>this.deleteLines(a)),this._parser.registerCsiHandler({final:"P"},a=>this.deleteChars(a)),this._parser.registerCsiHandler({final:"S"},a=>this.scrollUp(a)),this._parser.registerCsiHandler({final:"T"},a=>this.scrollDown(a)),this._parser.registerCsiHandler({final:"X"},a=>this.eraseChars(a)),this._parser.registerCsiHandler({final:"Z"},a=>this.cursorBackwardTab(a)),this._parser.registerCsiHandler({final:"`"},a=>this.charPosAbsolute(a)),this._parser.registerCsiHandler({final:"a"},a=>this.hPositionRelative(a)),this._parser.registerCsiHandler({final:"b"},a=>this.repeatPrecedingCharacter(a)),this._parser.registerCsiHandler({final:"c"},a=>this.sendDeviceAttributesPrimary(a)),this._parser.registerCsiHandler({prefix:">",final:"c"},a=>this.sendDeviceAttributesSecondary(a)),this._parser.registerCsiHandler({final:"d"},a=>this.linePosAbsolute(a)),this._parser.registerCsiHandler({final:"e"},a=>this.vPositionRelative(a)),this._parser.registerCsiHandler({final:"f"},a=>this.hVPosition(a)),this._parser.registerCsiHandler({final:"g"},a=>this.tabClear(a)),this._parser.registerCsiHandler({final:"h"},a=>this.setMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"h"},a=>this.setModePrivate(a)),this._parser.registerCsiHandler({final:"l"},a=>this.resetMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"l"},a=>this.resetModePrivate(a)),this._parser.registerCsiHandler({final:"m"},a=>this.charAttributes(a)),this._parser.registerCsiHandler({final:"n"},a=>this.deviceStatus(a)),this._parser.registerCsiHandler({prefix:"?",final:"n"},a=>this.deviceStatusPrivate(a)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},a=>this.softReset(a)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},a=>this.setCursorStyle(a)),this._parser.registerCsiHandler({final:"r"},a=>this.setScrollRegion(a)),this._parser.registerCsiHandler({final:"s"},a=>this.saveCursor(a)),this._parser.registerCsiHandler({final:"t"},a=>this.windowOptions(a)),this._parser.registerCsiHandler({final:"u"},a=>this.restoreCursor(a)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},a=>this.insertColumns(a)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},a=>this.deleteColumns(a)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},a=>this.selectProtected(a)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},a=>this.requestMode(a,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},a=>this.requestMode(a,!1)),this._parser.setExecuteHandler(O.BEL,()=>this.bell()),this._parser.setExecuteHandler(O.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(O.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(O.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(O.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(O.BS,()=>this.backspace()),this._parser.setExecuteHandler(O.HT,()=>this.tab()),this._parser.setExecuteHandler(O.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(O.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Jn.IND,()=>this.index()),this._parser.setExecuteHandler(Jn.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Jn.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new St(a=>(this.setTitle(a),this.setIconName(a),!0))),this._parser.registerOscHandler(1,new St(a=>this.setIconName(a))),this._parser.registerOscHandler(2,new St(a=>this.setTitle(a))),this._parser.registerOscHandler(4,new St(a=>this.setOrReportIndexedColor(a))),this._parser.registerOscHandler(8,new St(a=>this.setHyperlink(a))),this._parser.registerOscHandler(10,new St(a=>this.setOrReportFgColor(a))),this._parser.registerOscHandler(11,new St(a=>this.setOrReportBgColor(a))),this._parser.registerOscHandler(12,new St(a=>this.setOrReportCursorColor(a))),this._parser.registerOscHandler(104,new St(a=>this.restoreIndexedColor(a))),this._parser.registerOscHandler(110,new St(a=>this.restoreFgColor(a))),this._parser.registerOscHandler(111,new St(a=>this.restoreBgColor(a))),this._parser.registerOscHandler(112,new St(a=>this.restoreCursorColor(a))),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 a in Ae)this._parser.registerEscHandler({intermediates:"(",final:a},()=>this.selectCharset("("+a)),this._parser.registerEscHandler({intermediates:")",final:a},()=>this.selectCharset(")"+a)),this._parser.registerEscHandler({intermediates:"*",final:a},()=>this.selectCharset("*"+a)),this._parser.registerEscHandler({intermediates:"+",final:a},()=>this.selectCharset("+"+a)),this._parser.registerEscHandler({intermediates:"-",final:a},()=>this.selectCharset("-"+a)),this._parser.registerEscHandler({intermediates:".",final:a},()=>this.selectCharset("."+a)),this._parser.registerEscHandler({intermediates:"/",final:a},()=>this.selectCharset("/"+a));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(a=>(this._logService.error("Parsing error: ",a),a)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Id((a,d)=>this.requestStatusString(a,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),Wd))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Wd} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=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;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ci&&(n=this._parseStack.position+Ci)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,a=>String.fromCharCode(a)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(a=>a.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ci&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ci))),o||this._dirtyRowTracker.clearRange(),e.length>Ci)for(let a=n;a<e.length;a+=Ci){let d=a+Ci<e.length?a+Ci:e.length,u=typeof e=="string"?this._stringDecoder.decode(e.substring(a,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(a,d),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,u))return this._preserveStack(s,r,u,a),this._logSlowResolvingAsync(i),i}else if(!o){let a=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,a))return this._preserveStack(s,r,a,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,i){let s,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,a=this._coreService.modes.insertMode,d=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let f=this._parser.precedingJoinState;for(let m=t;m<i;++m){if(s=e[m],s<127&&n){let v=n[String.fromCharCode(s)];v&&(s=v.charCodeAt(0))}let _=this._unicodeService.charProperties(s,f);r=es.extractWidth(_);let S=es.extractShouldJoin(_),k=S?es.extractWidth(f):0;if(f=_,o&&this._onA11yChar.fire(ki(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-k>l){if(c){let v=u,p=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),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&u instanceof gr&&u.copyCellsFrom(v,p,0,k,!1);p<l;)v.setCellFromCodepoint(p++,0,1,d)}else if(this._activeBuffer.x=l-1,r===2)continue}if(S&&this._activeBuffer.x){let v=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-v,s,r);for(let p=r-k;--p>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(a&&(u.insertCells(this._activeBuffer.x,r-k,this._activeBuffer.getNullCell(d)),u.getWidth(l-1)===2&&u.setCellFromCodepoint(l-1,0,1,d)),u.setCellFromCodepoint(this._activeBuffer.x++,s,r,d),r>0)for(;--r;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&i-t>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>Hd(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Id(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new St(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&s.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Le));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let i=e.params[0]||1,s=es.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*i),l=0;for(let a=0;a<n.length;){let d=n.codePointAt(a)||0;o[l++]=d,a+=d>65535?2:1}let c=l;for(let a=1;a<i;++a)o.copyWithin(c,0,l),c+=l;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(O.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(O.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(O.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(O.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(O.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,Xi),this._charsetService.setgCharset(1,Xi),this._charsetService.setgCharset(2,Xi),this._charsetService.setgCharset(3,Xi);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 s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:c}=this._bufferService,{active:a,alt:d}=l,u=this._optionsService.rawOptions,f=(S,k)=>(o.triggerDataEvent(`${O.ESC}[${t?"":"?"}${S};${k}$y`),!0),m=S=>S?1:2,_=e.params[0];return t?_===2?f(_,4):_===4?f(_,m(o.modes.insertMode)):_===12?f(_,3):_===20?f(_,m(u.convertEol)):f(_,0):_===1?f(_,m(s.applicationCursorKeys)):_===3?f(_,u.windowOptions.setWinLines?c===80?2:c===132?1:0:0):_===6?f(_,m(s.origin)):_===7?f(_,m(s.wraparound)):_===8?f(_,3):_===9?f(_,m(r==="X10")):_===12?f(_,m(u.cursorBlink)):_===25?f(_,m(!o.isCursorHidden)):_===45?f(_,m(s.reverseWraparound)):_===66?f(_,m(s.applicationKeypad)):_===67?f(_,4):_===1e3?f(_,m(r==="VT200")):_===1002?f(_,m(r==="DRAG")):_===1003?f(_,m(r==="ANY")):_===1004?f(_,m(s.sendFocus)):_===1005?f(_,4):_===1006?f(_,m(n==="SGR")):_===1015?f(_,4):_===1016?f(_,m(n==="SGR_PIXELS")):_===1048?f(_,1):_===47||_===1047||_===1049?f(_,m(a===d)):_===2004?f(_,m(s.bracketedPasteMode)):_===2026?f(_,m(s.synchronizedOutput)):f(_,0)}_updateAttrColor(e,t,i,s,r){return t===2?(e|=50331648,e&=-16777216,e|=sn.fromColorRGB([i,s,r])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){let o=e.getSubParams(t+n),l=0;do s[1]===5&&(r=1),s[n+l+1+r]=o[l];while(++l<o.length&&l+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let o=2;o<s.length;++o)s[o]===-1&&(s[o]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Le.fg,e.bg=Le.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,i,s=this._curAttrData;for(let r=0;r<t;r++)i=e.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=Le.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=Le.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(e,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=Le.fg&16777215,s.bg&=-67108864,s.bg|=Le.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${O.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${O.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(`${O.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=Le.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(!Hd(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(`${O.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Fd&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Fd&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],i=e.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(Kd(n))if(r==="?")t.push({type:0,index:n});else{let o=$d(r);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(),s=e.slice(t+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),s,r=i.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=$d(i[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let r=parseInt(i[s]);Kd(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Xi),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(qw[e[0]],Ae[e[1]]||Xi),!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=Le.clone(),this._eraseAttrDataInternal=Le.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 Bt;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=o=>(this._coreService.triggerDataEvent(`${O.ESC}${o}${O.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Ec=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&&(Ud=e,e=t,t=Ud),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Ec=Re([K(0,at)],Ec);function Kd(e){return 0<=e&&e<256}var Xw=5e7,Vd=12,Gw=50,Qw=class extends ie{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 W),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Xw)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],r=this._action(s,t);if(r){let o=l=>performance.now()-i>=Vd?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(i,l);r.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-i>=Vd)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Gw&&(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()}},Nc=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),c={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(c,l)),this._dataByLinkId.set(c.id,c),c.id}let i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let n=t.addMarker(t.ybase+t.y),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(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);i.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(i,s))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Nc=Re([K(0,at)],Nc);var qd=!1,Jw=class extends ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Us),this._onBinary=this._register(new W),this.onBinary=this._onBinary.event,this._onData=this._register(new W),this.onData=this._onData.event,this._onLineFeed=this._register(new W),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new W),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new W),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new W),this._instantiationService=new Cw,this.optionsService=this._register(new Pw(e)),this._instantiationService.setService(ct,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Cc)),this._instantiationService.setService(at,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(wc)),this._instantiationService.setService(J_,this._logService),this.coreService=this._register(this._instantiationService.createInstance(xc)),this._instantiationService.setService(fs,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(bc)),this._instantiationService.setService(Q_,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(es)),this._instantiationService.setService(gy,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Ow),this._instantiationService.setService(vy,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Nc),this._instantiationService.setService(Z_,this._oscLinkService),this._inputHandler=this._register(new Yw(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Xe.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Xe.forward(this._bufferService.onResize,this._onResize)),this._register(Xe.forward(this.coreService.onData,this._onData)),this._register(Xe.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 Qw((t,i)=>this._inputHandler.parse(t,i))),this._register(Xe.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new W),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&&!qd&&(this._logService.warn("writeSync is unreliable and will be removed soon."),qd=!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,Lm),t=Math.max(t,Pm),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(Ad.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Ad(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ye(()=>{for(let t of e)t.dispose()})}}},Zw={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 e1(e,t,i,s){var o;let r={type:0,cancel:!1,key:void 0},n=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=O.ESC+"OA":r.key=O.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=O.ESC+"OD":r.key=O.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=O.ESC+"OC":r.key=O.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=O.ESC+"OB":r.key=O.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":O.DEL,e.altKey&&(r.key=O.ESC+r.key);break;case 9:if(e.shiftKey){r.key=O.ESC+"[Z";break}r.key=O.HT,r.cancel=!0;break;case 13:r.key=e.altKey?O.ESC+O.CR:O.CR,r.cancel=!0;break;case 27:r.key=O.ESC,e.altKey&&(r.key=O.ESC+O.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;n?r.key=O.ESC+"[1;"+(n+1)+"D":t?r.key=O.ESC+"OD":r.key=O.ESC+"[D";break;case 39:if(e.metaKey)break;n?r.key=O.ESC+"[1;"+(n+1)+"C":t?r.key=O.ESC+"OC":r.key=O.ESC+"[C";break;case 38:if(e.metaKey)break;n?r.key=O.ESC+"[1;"+(n+1)+"A":t?r.key=O.ESC+"OA":r.key=O.ESC+"[A";break;case 40:if(e.metaKey)break;n?r.key=O.ESC+"[1;"+(n+1)+"B":t?r.key=O.ESC+"OB":r.key=O.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=O.ESC+"[2~");break;case 46:n?r.key=O.ESC+"[3;"+(n+1)+"~":r.key=O.ESC+"[3~";break;case 36:n?r.key=O.ESC+"[1;"+(n+1)+"H":t?r.key=O.ESC+"OH":r.key=O.ESC+"[H";break;case 35:n?r.key=O.ESC+"[1;"+(n+1)+"F":t?r.key=O.ESC+"OF":r.key=O.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=O.ESC+"[5;"+(n+1)+"~":r.key=O.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=O.ESC+"[6;"+(n+1)+"~":r.key=O.ESC+"[6~";break;case 112:n?r.key=O.ESC+"[1;"+(n+1)+"P":r.key=O.ESC+"OP";break;case 113:n?r.key=O.ESC+"[1;"+(n+1)+"Q":r.key=O.ESC+"OQ";break;case 114:n?r.key=O.ESC+"[1;"+(n+1)+"R":r.key=O.ESC+"OR";break;case 115:n?r.key=O.ESC+"[1;"+(n+1)+"S":r.key=O.ESC+"OS";break;case 116:n?r.key=O.ESC+"[15;"+(n+1)+"~":r.key=O.ESC+"[15~";break;case 117:n?r.key=O.ESC+"[17;"+(n+1)+"~":r.key=O.ESC+"[17~";break;case 118:n?r.key=O.ESC+"[18;"+(n+1)+"~":r.key=O.ESC+"[18~";break;case 119:n?r.key=O.ESC+"[19;"+(n+1)+"~":r.key=O.ESC+"[19~";break;case 120:n?r.key=O.ESC+"[20;"+(n+1)+"~":r.key=O.ESC+"[20~";break;case 121:n?r.key=O.ESC+"[21;"+(n+1)+"~":r.key=O.ESC+"[21~";break;case 122:n?r.key=O.ESC+"[23;"+(n+1)+"~":r.key=O.ESC+"[23~";break;case 123:n?r.key=O.ESC+"[24;"+(n+1)+"~":r.key=O.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=O.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=O.DEL:e.keyCode===219?r.key=O.ESC:e.keyCode===220?r.key=O.FS:e.keyCode===221&&(r.key=O.GS);else if((!i||s)&&e.altKey&&!e.metaKey){let l=(o=Zw[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)r.key=O.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let c=e.ctrlKey?e.keyCode-64:e.keyCode+32,a=String.fromCharCode(c);e.shiftKey&&(a=a.toUpperCase()),r.key=O.ESC+a}else if(e.keyCode===32)r.key=O.ESC+(e.ctrlKey?O.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let c=e.code.slice(3,4);e.shiftKey||(c=c.toLowerCase()),r.key=O.ESC+c,r.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=O.US),e.key==="@"&&(r.key=O.NUL));break}return r}var De=0,t1=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Mo,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Mo,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,n)=>this._getKey(r)-this._getKey(n)),t=0,i=0,s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(De=this._search(t),De===-1)||this._getKey(this._array[De])!==t)return!1;do if(this._array[De]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(De),!0;while(++De<this._array.length&&this._getKey(this._array[De])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,n)=>r-n),t=0,i=new Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:i[s++]=this._array[r];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(De=this._search(e),!(De<0||De>=this._array.length)&&this._getKey(this._array[De])===e))do yield this._array[De];while(++De<this._array.length&&this._getKey(this._array[De])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(De=this._search(e),!(De<0||De>=this._array.length)&&this._getKey(this._array[De])===e))do t(this._array[De]);while(++De<this._array.length&&this._getKey(this._array[De])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1,r=this._getKey(this._array[s]);if(r>e)i=s-1;else if(r<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},ql=0,Yd=0,i1=class extends ie{constructor(){super(),this._decorations=new t1(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new W),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new W),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ye(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new s1(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(t))s=n.options.x??0,r=s+(n.options.width??1),e>=s&&e<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,s){this._decorations.forEachByKey(t,r=>{ql=r.options.x??0,Yd=ql+(r.options.width??1),e>=ql&&e<Yd&&(!i||(r.options.layer??"bottom")===i)&&s(r)})}},s1=class extends Ii{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new W),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new W),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=Ce.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ce.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},r1=1e3,n1=class{constructor(e,t=r1){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=s-this._lastRefreshMs,n=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Xd=20,Lo=class extends ie{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new n1(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(Q(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ye(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Xd+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
65
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Xd+1&&(this._liveRegion.textContent+=qa.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){let n=i.lines.get(i.ydisp+r),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",c=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(l.length===0?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=l,this._rowColumns.set(a,o)),a.setAttribute("aria-posinset",c),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||e.relatedTarget!==s)return;let 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 c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}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 s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:((l=s.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(i.node))return;let r=({node:c,offset:a})=>{let d=c instanceof Text?c.parentNode:c,u=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(d);if(!f)return console.warn("columns is null. Race condition?"),null;let m=a<f.length?f[a]:f.slice(-1)[0]+1;return m>=this._terminal.cols&&(++u,m=0),{row:u,column:m}},n=r(t),o=r(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 r,n;e.style.transform="";let t=e.getBoundingClientRect().width,i=(n=(r=this._rowColumns.get(e))==null?void 0:r.slice(-1))==null?void 0:n[0];if(!i)return;let s=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};Lo=Re([K(1,Lh),K(2,vi),K(3,gi)],Lo);var Rc=class extends ie{constructor(e,t,i,s,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new W),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new W),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ye(()=>{var n;cs(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(Q(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Q(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Q(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Q(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let s=0;s<i.length;s++){let r=i[s];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var s,r;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(n=>{n==null||n.forEach(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?(r=this._activeProviderReplies)!=null&&r.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):o.provideLinks(e.y,l=>{var a,d;if(this._isMouseOut)return;let c=l==null?void 0:l.map(u=>({link:u}));(a=this._activeProviderReplies)==null||a.set(n,c),i=this._checkLinkProviderResult(n,e,i),((d=this._activeProviderReplies)==null?void 0:d.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let n=0;n<r.length;n++){let o=r[n],l=o.link.range.start.y<e?0:o.link.range.start.x,c=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let a=l;a<=c;a++){if(i.has(a)){r.splice(n--,1);break}i.add(a)}}}}_checkLinkProviderResult(e,t,i){var n;if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&s){let o=s.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(c=>this._linkAtPosition(c.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&&o1(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,cs(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.pointerCursor},set:i=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline},set:i=>{var s,r,n;(s=this._currentLink)!=null&&s.state&&((n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,i){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){let s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};Rc=Re([K(1,Ph),K(2,gi),K(3,at),K(4,tm)],Rc);function o1(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 l1=class extends Jw{constructor(e={}){super(e),this._linkifier=this._register(new Us),this.browser=ym,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Us),this._onCursorMove=this._register(new W),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new W),this.onKey=this._onKey.event,this._onRender=this._register(new W),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new W),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new W),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new W),this.onBell=this._onBell.event,this._onFocus=this._register(new W),this._onBlur=this._register(new W),this._onA11yCharEmitter=this._register(new W),this._onA11yTabEmitter=this._register(new W),this._onWillOpen=this._register(new W),this._setup(),this._decorationService=this._instantiationService.createInstance(i1),this._instantiationService.setService(rn,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(G0),this._instantiationService.setService(tm,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Xa)),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(Xe.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Xe.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Xe.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Xe.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ye(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let i,s="";switch(t.index){case 256:i="foreground",s="10";break;case 257:i="background",s="11";break;case 258:i="cursor",s="12";break;default:i="ansi",s="4;"+t.index}switch(t.type){case 0:let r=ve.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${O.ESC}]${s};${Vw(r)}${gm.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[t.index]=Pe.toColor(...t.color));else{let n=i;this._themeService.modifyColors(o=>o[n]=Pe.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(Lo,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(O.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(O.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,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=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Q(this.element,"copy",t=>{this.hasSelection()&&uy(t,this._selectionService)}));let e=t=>dy(t,this.textarea,this.coreService,this.optionsService);this._register(Q(this.textarea,"paste",e)),this._register(Q(this.element,"paste",e)),wm?this._register(Q(this.element,"mousedown",t=>{t.button===2&&nd(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Q(this.element,"contextmenu",t=>{nd(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),$h&&this._register(Q(this.element,"auxclick",t=>{t.button===1&&V_(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Q(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Q(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Q(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Q(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Q(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Q(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Q(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var r;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((r=this.element)==null?void 0:r.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Q(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",Va.get()),bm||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(Y0,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(vi,this._coreBrowserService),this._register(Q(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(Q(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(mc,this._document,this._helperContainer),this._instantiationService.setService(il,this._charSizeService),this._themeService=this._instantiationService.createInstance(yc),this._instantiationService.setService(Ys,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ro),this._instantiationService.setService(em,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(gc,this.rows,this.screenElement)),this._instantiationService.setService(gi,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(fc,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(vc),this._instantiationService.setService(Ph,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(Rc,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(uc,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(Sc,this.element,this.screenElement,s)),this._instantiationService.setService(yy,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(Xe.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(dc,this.screenElement)),this._register(Q(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(Lo,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(No,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(No,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(_c,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){var a,d,u,f,m;let o=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!o)return!1;let l,c;switch(n.overrideType||n.type){case"mousemove":c=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":c=0,l=n.button<3?n.button:3;break;case"mousedown":c=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,(f=(u=(d=(a=e._renderService)==null?void 0:a.dimensions)==null?void 0:d.device)==null?void 0:u.cell)==null?void 0:f.height,(m=e._coreBrowserService)==null?void 0:m.dpr)===0)return!1;c=_<0?0:1,l=4;break;default:return!1}return c===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:c,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(n)),wheel:n=>(i(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&i(n)},mousemove:n=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),n&8?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),n&16?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),n&2?s.mouseup||(s.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),n&4?s.mousedrag||(s.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Q(t,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(n)})),this._register(Q(t,"wheel",n=>{var o,l,c,a,d;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,(a=(c=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:c.cell)==null?void 0:a.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(n,!0);let u=O.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!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){K_(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=e1(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let s=this.rows-1;return this.scrollLines(i.type===2?-s:s),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((i.key===O.ETX||i.key===O.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)&&(a1(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(Le));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(O.ESC+"[I"):this.coreService.triggerDataEvent(O.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(`${O.ESC}[4;${i};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${O.ESC}[6;${r};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function a1(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var c1=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)}},h1=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 Bt)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},Gd=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 h1(t)}getNullCell(){return new Bt}},u1=class extends ie{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new W),this.onBufferChange=this._onBufferChange.event,this._normal=new Gd(this._core.buffers.normal,"normal"),this._alternate=new Gd(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)}},d1=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,s)=>t(i,s.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},f1=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}},p1=["cols","rows"],Yt=0,_1=class extends ie{constructor(e){super(),this._core=this._register(new l1(e)),this._addonManager=this._register(new c1),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(e){if(p1.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 d1(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f1(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 u1(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 Va.get()},set promptLabel(e){Va.set(e)},get tooMuchOutput(){return qa.get()},set tooMuchOutput(e){qa.set(e)}}}_verifyIntegers(...e){for(Yt of e)if(Yt===1/0||isNaN(Yt)||Yt%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Yt of e)if(Yt&&(Yt===1/0||isNaN(Yt)||Yt%1!==0||Yt<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 m1=2,v1=1,g1=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 u;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:((u=this._terminal.options.overviewRuler)==null?void 0:u.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),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,c=o.right+o.left,a=s-l,d=r-c-t;return{cols:Math.max(m1,Math.floor(d/e.css.cell.width)),rows:Math.max(v1,Math.floor(a/e.css.cell.height))}}};function S1(e,t){return e?`/node/${encodeURIComponent(e)}/ws?token=${encodeURIComponent(t||"")}`:"/ws"}function y1({session:e,node:t,token:i,cols:s,rows:r,readonly:n=!1,takeSize:o,focused:l,onData:c,onExit:a,onFiles:d,retryBaseMs:u=250}){const f=["localhost","127.0.0.1","::1","[::1]"].includes(location.hostname);if(location.protocol!=="https:"&&!f)throw new Error("nexuscrew: ws:// rifiutato su origine non-locale e non-TLS (apri via tunnel su localhost o servi in HTTPS)");const _=`${location.protocol==="https:"?"wss":"ws"}://${location.host}${S1(t,i)}`;let S=null,k=!1,v=!1,p=null,g=0,w=l;const M=()=>{if(k||v||p)return;const x=Math.min(5e3,Math.max(0,u)*2**Math.min(g++,5));p=setTimeout(()=>{p=null,N()},x)},N=()=>{if(k||v)return;const x=new WebSocket(_);S=x,x.binaryType="arraybuffer",x.onopen=()=>{if(S!==x||k)return;g=0;const C={type:"attach",session:e,token:i,cols:s,rows:r,readonly:n};o!==void 0&&(C.takeSize=o),x.send(JSON.stringify(C)),w!==void 0&&x.send(JSON.stringify({type:"focus",on:!!w}))},x.onmessage=C=>{if(!(S!==x||k))if(typeof C.data=="string"){let D;try{D=JSON.parse(C.data)}catch{return}D.type==="exit"&&(v=!0,a&&a(D.code)),D.type==="files"&&d&&d(D)}else c&&c(new Uint8Array(C.data))},x.onerror=()=>{if(S===x)try{x.close()}catch{}},x.onclose=C=>{S!==x||k||v||[1e3,1002,4401,4404].includes(C==null?void 0:C.code)||M()}};return N(),{sendInput:x=>{!S||S.readyState!==1||S.send(typeof x=="string"?new TextEncoder().encode(x):x)},resize:(x,C)=>{s=x,r=C,(S==null?void 0:S.readyState)===1&&S.send(JSON.stringify({type:"resize",cols:x,rows:C}))},action:x=>{(S==null?void 0:S.readyState)===1&&S.send(JSON.stringify({type:"action",name:x}))},focus:x=>{w=x,(S==null?void 0:S.readyState)===1&&S.send(JSON.stringify({type:"focus",on:!!x}))},close:()=>{if(k=!0,p&&clearTimeout(p),p=null,S)try{S.close()}catch{}},get raw(){return S}}}async function Qd(e){const t=String(e||"");if(!t)return!1;try{if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")return await navigator.clipboard.writeText(t),!0}catch{}try{const i=document.createElement("textarea");i.value=t,i.readOnly=!0,i.style.position="fixed",i.style.opacity="0",i.style.pointerEvents="none",document.body.appendChild(i),i.select();const s=document.execCommand&&document.execCommand("copy");if(i.remove(),s)return!0}catch{}return!1}function Bm({session:e,node:t,token:i,readonly:s,takeSize:r,focused:n,sendRef:o,actionRef:l,ctrlRef:c,setCtrlArmed:a,onFiles:d,fontSize:u=13,selectionMode:f=!1,onSelectionModeChange:m}){const _=E.useRef(null),S=E.useRef(null),k=E.useRef(u);k.current=u;const v=E.useRef(n);v.current=n;const p=E.useRef(f);p.current=f;const[g,w]=E.useState(""),[M,N]=E.useState(""),x=async()=>{var L,A,T,P;const C=((A=(L=S.current)==null?void 0:L.term)==null?void 0:A.getSelection())||g,D=await Qd(C);N(y(D?"copied":"copy-manual")),D&&((P=(T=S.current)==null?void 0:T.term)==null||P.clearSelection(),m==null||m(!1)),setTimeout(()=>N(""),1800)};return E.useEffect(()=>{const C=S.current;C&&C.sock&&C.sock.focus&&C.sock.focus(!!n)},[n]),E.useEffect(()=>{const C=S.current;C&&(C.term.options.fontSize=u,C.fit.fit(),C.sock.resize(C.term.cols,C.term.rows))},[u]),E.useEffect(()=>{const C=new _1({cursorBlink:!0,fontSize:k.current,scrollback:1e3,theme:{background:"#0a0e0a"}}),D=new g1;C.loadAddon(D),C.open(_.current),D.fit();const L=new TextDecoder;let A;try{A=y1({session:e,node:t,token:i,readonly:s,takeSize:r,focused:v.current,onFiles:d,cols:C.cols,rows:C.rows,onData:G=>C.write(L.decode(G)),onExit:()=>C.write(`\r
|
|
78
|
-
\x1B[33m[sessione finita]\x1B[0m\r
|
|
79
|
-
`)})}catch(G){return C.write(`\r
|
|
80
|
-
\x1B[31m${G.message}\x1B[0m\r
|
|
81
|
-
`),()=>C.dispose()}S.current={term:C,fit:D,sock:A},o&&(o.current=G=>A.sendInput(G)),l&&(l.current=G=>A.action(G));const T=C.onData(G=>{if(!s){if(c&&c.current&&G.length===1){const ce=G.charCodeAt(0);let Z=ce;ce>=97&&ce<=122?Z=ce-96:ce>=64&&ce<=95?Z=ce-64:ce===32&&(Z=0),G=String.fromCharCode(Z),c.current=!1,a&&a(!1)}A.sendInput(G)}}),P=C.onSelectionChange(()=>w(C.getSelection()));C.attachCustomKeyEventHandler(G=>(G.ctrlKey||G.metaKey)&&G.key.toLowerCase()==="c"&&C.getSelection()?(G.type==="keydown"&&Qd(C.getSelection()),!1):!0);const j=_.current,F=24;let $=null,R=null,b=0,I=null,B=null;const U=G=>{const Z=(j.querySelector(".xterm-screen")||j).getBoundingClientRect(),Kt=Math.max(0,Math.min(C.cols-1,Math.floor((G.clientX-Z.left)/Math.max(1,Z.width)*C.cols))),ps=Math.max(0,Math.min(C.rows-1,Math.floor((G.clientY-Z.top)/Math.max(1,Z.height)*C.rows)));return{col:Kt,row:C.buffer.active.viewportY+ps}},X=G=>{if(G.touches.length!==1){$=null;return}if(p.current){G.preventDefault(),G.stopPropagation(),B=U(G.touches[0]),C.clearSelection();return}$=G.touches[0].clientY,R=G.touches[0].clientX,b=0,I=null},J=G=>{if(p.current&&B&&G.touches.length===1){G.preventDefault(),G.stopPropagation();const Z=U(G.touches[0]),Kt=B.row*C.cols+B.col,ps=Z.row*C.cols+Z.col,Gs=Kt<=ps?B:Z;C.select(Gs.col,Gs.row,Math.abs(ps-Kt)+1);return}if($===null||G.touches.length!==1)return;G.preventDefault(),G.stopPropagation();const ce=G.touches[0];if(I===null&&(Math.abs(ce.clientY-$)>8||Math.abs(ce.clientX-R)>8)&&(I=Math.abs(ce.clientY-$)>Math.abs(ce.clientX-R)),!!I){for(b+=ce.clientY-$,$=ce.clientY;b>=F;)A.action("scroll-up"),b-=F;for(;b<=-F;)A.action("scroll-down"),b+=F}},ee=()=>{$=null,B=null};let oe=0;const ne=G=>{for(G.preventDefault(),G.stopPropagation(),oe+=G.deltaY;oe<=-F;)A.action("scroll-up"),oe+=F;for(;oe>=F;)A.action("scroll-down"),oe-=F};j.addEventListener("touchstart",X,{passive:!1}),j.addEventListener("touchmove",J,{passive:!1,capture:!0}),j.addEventListener("touchend",ee,{passive:!0}),j.addEventListener("wheel",ne,{passive:!1,capture:!0});const pe=()=>{D.fit(),A.resize(C.cols,C.rows)};window.addEventListener("resize",pe);const z=window.visualViewport;z&&(z.addEventListener("resize",pe),z.addEventListener("scroll",pe));let V=null,ue=0;return typeof ResizeObserver<"u"&&(V=new ResizeObserver(()=>{ue&&cancelAnimationFrame(ue),ue=requestAnimationFrame(pe)}),V.observe(j)),()=>{S.current=null,T.dispose(),P.dispose(),j.removeEventListener("touchstart",X),j.removeEventListener("touchmove",J,{capture:!0}),j.removeEventListener("touchend",ee),j.removeEventListener("wheel",ne,{capture:!0}),window.removeEventListener("resize",pe),z&&(z.removeEventListener("resize",pe),z.removeEventListener("scroll",pe)),V&&V.disconnect(),ue&&cancelAnimationFrame(ue),A.close(),C.dispose()}},[e,t,i,s,r,o,l,c,a,d]),h.jsxs("div",{className:`nc-terminal${f?" selecting":""}`,children:[h.jsx("div",{className:"nc-terminal-host",ref:_}),(g||f)&&h.jsxs("div",{className:"nc-selection-tools",children:[g?h.jsx("button",{type:"button",onClick:x,children:M||y("copy")}):h.jsx("span",{children:y("select-drag")}),h.jsx("button",{type:"button",onClick:()=>{var C,D;(D=(C=S.current)==null?void 0:C.term)==null||D.clearSelection(),w(""),m==null||m(!1)},children:y("cancel")}),M===y("copy-manual")&&h.jsx("textarea",{readOnly:!0,value:g,onFocus:C=>C.target.select()})]})]})}const Jd="",ut="\x1B",w1=[{label:"↑",seq:ut+"[A"},{label:"↓",seq:ut+"[B"},{label:"PGUP",seq:ut+"[5~"},{label:"PGDN",seq:ut+"[6~"}];function C1({send:e,action:t,ctrlArmed:i=!1,onCtrl:s,onKeyboard:r,selectionMode:n=!1,onSelectionMode:o}){const[l,c]=E.useState(!1),[a,d]=E.useState(!1),[u,f]=E.useState(!1),m=k=>{u?(e(ut+k),f(!1)):e(k)},_=(k,v,p)=>h.jsx("button",{onMouseDown:g=>{g.preventDefault(),m(v),p&&p()},children:k},k),S=(k,v)=>h.jsx("button",{onMouseDown:p=>{p.preventDefault(),t(v),d(!1)},children:k},k);return l?h.jsxs("div",{className:"nc-keybar copy",children:[h.jsx("span",{className:"tag",children:"copy-mode"}),w1.map(k=>_(k.label,k.seq)),_("ESCI (q)","q",()=>c(!1))]}):h.jsxs("div",{className:"nc-keybar termux",children:[a&&h.jsxs("div",{className:"nc-keymenu",children:[S("←WIN","prev-window"),S("WIN→","next-window"),S("⬅PANE","pane-left"),S("PANE➡","pane-right"),_("SCROLL",Jd+"[",()=>{c(!0),d(!1)}),h.jsx("button",{className:n?"armed":"",onMouseDown:k=>{k.preventDefault(),o==null||o(!n),d(!1)},children:"SELECT"}),_("⌃C","",()=>d(!1)),_("DETACH",Jd+"d",()=>d(!1))]}),h.jsxs("div",{className:"row",children:[_("ESC",ut),h.jsx("button",{className:a?"armed":"",onMouseDown:k=>{k.preventDefault(),d(v=>!v)},children:"☰"},"menu"),_("/","/"),_("—","-"),_("HOME",ut+"[H"),_("↑",ut+"[A"),_("END",ut+"[F"),_("PGUP",ut+"[5~")]}),h.jsxs("div",{className:"row",children:[_("⇥"," "),h.jsx("button",{onMouseDown:k=>{k.preventDefault(),r&&r()},children:"⌨"},"kbd"),h.jsx("button",{className:i?"armed":"",onMouseDown:k=>{k.preventDefault(),s&&s()},children:"CTRL"},"ctrl"),h.jsx("button",{className:u?"armed":"",onMouseDown:k=>{k.preventDefault(),f(v=>!v)},children:"ALT"},"alt"),_("←",ut+"[D"),_("↓",ut+"[B"),_("→",ut+"[C"),_("PGDN",ut+"[6~")]})]})}const x1=e=>e>1048576?`${(e/1048576).toFixed(1)}M`:e>1024?`${(e/1024).toFixed(0)}K`:`${e}B`;function jm({session:e,node:t,token:i,filesEvent:s,onClose:r}){vt();const n=t?`/node/${encodeURIComponent(t)}`:"",o=t?`${t}:${e}`:e,[l,c]=E.useState("outbox"),[a,d]=E.useState({inbox:[],outbox:[]}),[u,f]=E.useState(""),m=E.useRef(null);async function _(){try{const g=await(await Ue(`${n}/api/files?session=${encodeURIComponent(e)}`,i)).json();if(g.error){f(g.error);return}d(g);const w=g.outbox[0]?g.outbox[0].mtime:0;localStorage.setItem(k_(o),String(w))}catch(p){f(String(p))}}E.useEffect(()=>{_()},[e,t]),E.useEffect(()=>{s&&s.session===e&&_()},[s]);async function S(p){for(const g of p){f(`carico ${g.name}…`);const w=new FormData;w.append("session",e),w.append("file",g);try{const N=await(await Ue(`${n}/api/files/upload`,i,{method:"POST",body:w})).json();f(N.error?`errore: ${N.error}`:"")}catch(M){f(String(M))}}_()}async function k(p){const g=await Ue(`${n}/api/files/download?session=${encodeURIComponent(e)}&box=${l}&name=${encodeURIComponent(p)}`,i);if(!g.ok){f("errore download");return}const w=await g.blob(),M=URL.createObjectURL(w),N=document.createElement("a");N.href=M,N.download=p,N.click(),URL.revokeObjectURL(M)}async function v(p){await Ue(`${n}/api/files?session=${encodeURIComponent(e)}&box=${l}&name=${encodeURIComponent(p)}`,i,{method:"DELETE"}),_()}return h.jsxs("div",{className:"nc-files",children:[h.jsxs("header",{children:[h.jsx("b",{children:t?`${t}:${e}`:e}),h.jsx("button",{onClick:r,title:y("close"),children:h.jsx(fe,{name:"x",size:20})})]}),h.jsxs("nav",{children:[h.jsx("button",{className:l==="outbox"?"on":"",onClick:()=>c("outbox"),children:"outbox"}),h.jsx("button",{className:l==="inbox"?"on":"",onClick:()=>c("inbox"),children:"inbox"}),h.jsxs("button",{className:"up",onClick:()=>m.current&&m.current.click(),children:[h.jsx(fe,{name:"upload",size:18})," ",y("upload")]}),h.jsx("input",{type:"file",multiple:!0,ref:m,style:{display:"none"},onChange:p=>{S(Array.from(p.target.files||[])),p.target.value=""}})]}),u&&h.jsx("div",{className:"nc-busy",children:u}),h.jsxs("ul",{children:[a[l].map(p=>h.jsxs("li",{children:[h.jsx("span",{className:"name",onClick:()=>k(p.name),children:p.name}),h.jsx("small",{children:x1(p.size)}),h.jsx("button",{onClick:()=>v(p.name),title:"elimina",children:h.jsx(fe,{name:"trash",size:18})})]},p.name)),a[l].length===0&&h.jsx("li",{className:"empty",children:y("empty-files")})]})]})}const b1="\r";function k1(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 zm({send:e,token:t,session:i,node:s}){vt();const r=s?`/node/${encodeURIComponent(s)}`:"",[n,o]=E.useState(""),[l,c]=E.useState(!1),[a,d]=E.useState(""),[u,f]=E.useState(!1),m=E.useRef(null),_=E.useRef(null),[S,k]=E.useState(!1),[v,p]=E.useState({left:0,bottom:0}),[g,w]=E.useState(!1),M=E.useRef(null),N=E.useRef(null),x=E.useRef(null),C=E.useRef(null),D=E.useRef(null),L=E.useRef(`nc-attach-${Math.random().toString(36).slice(2,8)}`);E.useEffect(()=>{let B=!1;return Ue(`${r}/api/voice/status`,t).then(U=>U.json()).then(U=>{B||f(!!U.serverSttConfigured)}).catch(()=>{B||f(!1)}),()=>{B=!0}},[t,r]);const T=!!(typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)||u);function P(){const B=k1(n);B&&(e(B),e(b1),o(""))}function j(){const B=M.current&&M.current.getBoundingClientRect();B&&p({left:Math.max(6,Math.min(B.left,window.innerWidth-186)),bottom:window.innerHeight-B.top+6}),k(!0)}function F(B){k(!1),B&&M.current&&M.current.focus()}E.useEffect(()=>{if(!S)return;const B=X=>{X.key==="Escape"&&F(!0)},U=X=>{const J=N.current&&N.current.contains(X.target),ee=M.current&&M.current.contains(X.target);!J&&!ee&&F(!1)};return document.addEventListener("keydown",B),document.addEventListener("pointerdown",U),()=>{document.removeEventListener("keydown",B),document.removeEventListener("pointerdown",U)}},[S]);function $(B){F(!1),B.current&&B.current.click()}async function R(B){if(!B.length||!i)return;w(!0),d("");const U=[];for(const X of B)try{const J=new FormData;J.append("session",i),J.append("paste","false"),J.append("file",X,X.name);const oe=await(await Ue(`${r}/api/files/upload`,t,{method:"POST",body:J})).json();if(oe.error){d(oe.error);break}U.push(oe.path)}catch(J){d(String(J));break}U.length&&o(X=>X+(X&&!X.endsWith(" ")?" ":"")+U.join(" ")),w(!1)}function b(){m.current&&m.current.stop(),_.current&&_.current.stop(),c(!1)}async function I(){d("");const B=window.SpeechRecognition||window.webkitSpeechRecognition;if(B){const U=new B;U.lang="it-IT",U.continuous=!1,U.interimResults=!0;const X=n?`${n} `:"";U.onresult=J=>{const ee=Array.from(J.results).map(oe=>oe[0].transcript).join("");o(X+ee)},U.onend=()=>c(!1),U.onerror=J=>{d(`voice: ${J.error||"errore"}`),c(!1)},m.current=U,U.start(),c(!0);return}try{const U=await navigator.mediaDevices.getUserMedia({audio:!0}),X=new MediaRecorder(U),J=[];X.ondataavailable=ee=>J.push(ee.data),X.onstop=async()=>{U.getTracks().forEach(ee=>ee.stop()),c(!1),d("trascrivo…");try{const ee=new Blob(J,{type:X.mimeType||"audio/webm"}),ne=await(await Ue(`${r}/api/voice/transcribe`,t,{method:"POST",headers:{"content-type":"application/octet-stream"},body:ee})).json();ne.error?d(ne.error):(d(""),o(pe=>pe+(pe?" ":"")+(ne.text||"")))}catch(ee){d(String(ee))}},_.current={stop:()=>X.state!=="inactive"&&X.stop()},X.start(),c(!0)}catch{d("microfono non disponibile"),c(!1)}}return h.jsxs("div",{className:"nc-composer",children:[a&&h.jsx("div",{className:"nc-composer-err",children:a}),h.jsxs("div",{className:"nc-composer-row",children:[i&&h.jsx("button",{ref:M,className:g?"attach busy":"attach",disabled:g,onClick:()=>S?F(!1):j(),title:y(g?"attach-uploading":"attach"),"aria-label":y("attach"),"aria-haspopup":"menu","aria-expanded":S,"aria-controls":L.current,children:h.jsx(fe,{name:"attach",size:22})}),S&&h.jsxs("div",{ref:N,id:L.current,role:"menu",className:"nc-attach-menu",style:{left:v.left,bottom:v.bottom},children:[h.jsxs("button",{role:"menuitem",onClick:()=>$(x),children:[h.jsx(fe,{name:"file",size:18})," ",y("attach-file")]}),h.jsxs("button",{role:"menuitem",onClick:()=>$(C),children:[h.jsx(fe,{name:"camera",size:18})," ",y("attach-camera")]}),h.jsxs("button",{role:"menuitem",onClick:()=>$(D),children:[h.jsx(fe,{name:"image",size:18})," ",y("attach-gallery")]})]}),h.jsx("input",{ref:x,type:"file",multiple:!0,hidden:!0,onChange:B=>{R(Array.from(B.target.files||[])),B.target.value=""}}),h.jsx("input",{ref:C,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:B=>{R(Array.from(B.target.files||[])),B.target.value=""}}),h.jsx("input",{ref:D,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:B=>{R(Array.from(B.target.files||[])),B.target.value=""}}),h.jsx("textarea",{rows:2,value:n,placeholder:y("composer-placeholder"),onChange:B=>o(B.target.value)}),T&&h.jsx("button",{className:l?"mic on":"mic",onClick:l?b:I,title:y("voice"),children:h.jsx(fe,{name:"mic",size:22})}),h.jsx("button",{className:"go",onClick:P,title:y("send"),children:h.jsx(fe,{name:"enter",size:22})})]})]})}function Dc(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 Zd(e){return String(e||"?").replace(/^[^a-zA-Z0-9]+/,"").charAt(0).toUpperCase()||"?"}const E1=180,N1=480;function ef(e){return e.status==="down"?e.downSince?y("tunnel-down-since").replace("{t}",Dc(e.downSince)):y("tunnel-down"):e.status==="unreachable"?y("node-unreachable"):""}function R1({sessions:e=[],cells:t=[],activeSessions:i=[],nodeGroups:s=[],onPick:r,onAddTile:n,onPower:o,onKill:l,onNew:c,onSettings:a,width:d=240,collapsed:u=!1,onResize:f,onToggleCollapse:m}){const[_,S]=vt(),[k,v]=E.useState(z_),p=R=>v(b=>O_(b,R)),g=new Set((t||[]).map(R=>R.tmuxSession)),w=new Map((e||[]).map(R=>[R.name,R])),M=(R,b)=>_r(k,R,b),N=Wa,x=[...t||[]].sort((R,b)=>N(M(R.tmuxSession,(w.get(R.tmuxSession)||{}).activity),M(b.tmuxSession,(w.get(b.tmuxSession)||{}).activity))),C=(e||[]).filter(R=>!g.has(R.name)).sort((R,b)=>N(M(R.name,R.activity),M(b.name,b.activity))||R.name.localeCompare(b.name)),D=new Set(i||[]),[L,A]=E.useState(null),T=(R,b)=>{const I=R.currentTarget.getBoundingClientRect();A({text:b,y:I.top+I.height/2})},P=()=>A(null),j=E.useRef(null);E.useEffect(()=>()=>{j.current&&j.current()},[]);function F(R){R.preventDefault(),R.stopPropagation();const b=R.clientX,I=d,B=X=>{const J=Math.max(E1,Math.min(N1,I+(X.clientX-b)));f&&f(J)},U=()=>{window.removeEventListener("pointermove",B),window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",U),window.removeEventListener("blur",U),j.current=null};window.addEventListener("pointermove",B),window.addEventListener("pointerup",U),window.addEventListener("pointercancel",U),window.addEventListener("blur",U),j.current=U}const $=u?{width:48,flex:"0 0 48px"}:{width:d,flex:`0 0 ${d}px`};return u?h.jsxs("aside",{className:"nc-sidebar mini",style:$,children:[h.jsx("div",{className:"nc-side-head mini",children:h.jsx("button",{className:"nc-collapse-btn",onClick:m,title:y("expand"),children:"⟩"})}),h.jsxs("div",{className:"nc-side-group mini",children:[x.map(R=>{const b=R.degraded?"warn":R.tmux?"on":"",I=!!R.tmux;return h.jsx("button",{type:"button",className:`nc-mini-dot${D.has(R.tmuxSession)?" active":""}`,onMouseEnter:B=>T(B,R.cell),onMouseLeave:P,draggable:I,onDragStart:I?B=>B.dataTransfer.setData("text/nc-session",R.tmuxSession):void 0,onClick:I?()=>n&&n(R.tmuxSession):()=>o&&o(R),onDoubleClick:I?()=>r&&r(R.tmuxSession):void 0,children:h.jsx("span",{className:`nc-dot ${b}`})},R.cell)}),C.map(R=>h.jsx("button",{type:"button",className:`nc-mini-init${D.has(R.name)?" active":""}`,onMouseEnter:b=>T(b,R.name),onMouseLeave:P,draggable:!0,onDragStart:b=>b.dataTransfer.setData("text/nc-session",R.name),onClick:()=>n&&n(R.name),onDoubleClick:()=>r&&r(R.name),children:Zd(R.name)},R.name)),(s||[]).flatMap(R=>R.status==="up"?R.sessions.map(b=>h.jsx("button",{type:"button",className:`nc-mini-init${D.has(b.key)?" active":""}`,onMouseEnter:I=>T(I,b.key),onMouseLeave:P,draggable:!0,onDragStart:I=>I.dataTransfer.setData("text/nc-session",b.key),onClick:()=>n&&n(b.key),onDoubleClick:()=>r&&r({session:b.name,node:b.node}),children:Zd(b.name)},b.key)):[h.jsx("button",{type:"button",className:"nc-mini-dot",onMouseEnter:b=>T(b,`${R.name}: ${ef(R)}`),onMouseLeave:P,children:h.jsx("span",{className:"nc-dot warn"})},`nodo-${R.name}`)])]}),h.jsx("button",{className:"nc-side-gear mini",onClick:a,title:y("settings"),onMouseEnter:R=>T(R,y("settings")),onMouseLeave:P,children:h.jsx(fe,{name:"gear",size:16})}),L&&h.jsx("div",{className:"nc-mini-tip",style:{top:L.y},children:L.text})]}):h.jsxs("aside",{className:"nc-sidebar",style:$,children:[h.jsxs("div",{className:"nc-side-head",children:[h.jsx("button",{className:"nc-collapse-btn",onClick:m,title:y("collapse"),children:"⟨"}),h.jsx("span",{className:"nc-side-title",children:y("fleet")}),h.jsxs("button",{className:"nc-new-btn",onClick:c,title:y("new-session"),children:["+ ",y("new")]})]}),(t||[]).length>0&&h.jsx("div",{className:"nc-side-group",children:x.map(R=>{const b=R.degraded?"warn":R.tmux?"on":"",I=R.degraded?y("cell-degraded"):R.tmux?y("cell-on"):y("cell-off"),B=!!R.tmux;return h.jsxs("div",{className:`nc-cell${B?" live":""}${D.has(R.tmuxSession)?" active":""}`,title:I,draggable:B,onDragStart:B?U=>U.dataTransfer.setData("text/nc-session",R.tmuxSession):void 0,onClick:B?()=>n&&n(R.tmuxSession):void 0,onDoubleClick:B?()=>r&&r(R.tmuxSession):void 0,children:[h.jsx("span",{className:`nc-dot ${b}`}),h.jsxs("span",{className:"nc-cell-main",children:[h.jsx("b",{children:R.cell}),h.jsxs("small",{children:[R.engine,R.key?`·${R.key}`:""]})]}),h.jsx("button",{className:`nc-pin${k.includes(R.tmuxSession)?" on":""}`,title:y("pin"),onClick:U=>{U.stopPropagation(),p(R.tmuxSession)},children:k.includes(R.tmuxSession)?"★":"☆"}),h.jsx("button",{className:`nc-power${R.tmux?" on":""}${R.degraded?" warn":""}`,onClick:U=>{U.stopPropagation(),o&&o(R)},title:R.active?y("power-off"):y("power-on"),children:h.jsx(fe,{name:"power",size:14})})]},R.cell)})}),h.jsxs("button",{className:"nc-side-gear",onClick:a,title:y("settings"),children:[h.jsx(fe,{name:"gear",size:15})," ",y("settings")]}),h.jsx("div",{className:"nc-side-group-title",children:y("other-sessions")}),h.jsxs("div",{className:"nc-side-group",children:[C.map(R=>h.jsxs("div",{className:`nc-side-card${D.has(R.name)?" active":""}`,draggable:!0,onDragStart:b=>b.dataTransfer.setData("text/nc-session",R.name),onClick:()=>n&&n(R.name),onDoubleClick:()=>r&&r(R.name),children:[h.jsx("span",{className:R.attached?"nc-dot on":"nc-dot"}),h.jsxs("span",{className:"nc-card-main",children:[h.jsx("b",{children:R.name}),h.jsxs("small",{children:[R.preview?R.preview:R.cmd?R.cmd:y("windows").replace("{n}",String(R.windows||0)),R.outbox&&R.outbox.count>0?` · 📦${R.outbox.count}`:""]})]}),R.activity?h.jsx("span",{className:"nc-rel",children:Dc(R.activity)}):null,h.jsx("button",{className:`nc-pin${k.includes(R.name)?" on":""}`,title:y("pin"),onClick:b=>{b.stopPropagation(),p(R.name)},children:k.includes(R.name)?"★":"☆"}),h.jsx("button",{className:"nc-menu",title:y("terminate"),onClick:b=>{b.stopPropagation(),window.confirm(y("terminate-confirm").replace("{name}",R.name))&&l&&l(R.name)},children:"⋯"})]},R.name)),C.length===0&&h.jsx("div",{className:"nc-empty",children:y("no-sessions-short")})]}),(s||[]).map(R=>h.jsxs("div",{children:[h.jsxs("div",{className:"nc-side-group-title nc-node-title",children:[h.jsx("span",{className:`nc-dot ${R.status==="up"?"on":"warn"}`}),h.jsx("b",{children:R.name}),h.jsxs("small",{children:[" · ",R.status==="up"?y("node-sessions").replace("{n}",String(R.sessions.length)):ef(R)]})]}),R.status==="up"&&h.jsxs("div",{className:"nc-side-group",children:[R.sessions.map(b=>h.jsxs("div",{className:`nc-side-card${D.has(b.key)?" active":""}`,draggable:!0,onDragStart:I=>I.dataTransfer.setData("text/nc-session",b.key),onClick:()=>n&&n(b.key),onDoubleClick:()=>r&&r({session:b.name,node:b.node}),children:[h.jsx("span",{className:b.attached?"nc-dot on":"nc-dot"}),h.jsxs("span",{className:"nc-card-main",children:[h.jsx("b",{children:b.name}),h.jsx("small",{children:b.preview?b.preview:b.cmd?b.cmd:y("windows").replace("{n}",String(b.windows||0))})]}),b.activity?h.jsx("span",{className:"nc-rel",children:Dc(b.activity)}):null]},b.key)),R.sessions.length===0&&h.jsx("div",{className:"nc-empty",children:y("no-sessions-short")})]})]},`nodo-${R.name}`)),h.jsx("div",{className:"nc-side-lang",children:$_.map((R,b)=>h.jsxs("span",{children:[b>0&&" · ",h.jsx("button",{className:`nc-lang-btn${_===R?" on":""}`,onClick:()=>S(R),title:R,children:R.toUpperCase()})]},R))}),h.jsx("div",{className:"nc-side-resize",onPointerDown:F,title:""})]})}const Fh=9,Po=.2,Mc=/^[a-z0-9-]{1,32}$/;function To(e){if(typeof e=="string"&&e){const t=e.indexOf(":");if(t<0)return{session:e};const i=e.slice(0,t),s=e.slice(t+1);return!Mc.test(i)||!s?null:{session:s,node:i}}return e&&typeof e=="object"&&typeof e.session=="string"&&e.session?e.node===void 0||e.node===null||e.node===""?{session:e.session}:typeof e.node=="string"&&Mc.test(e.node)?{session:e.session,node:e.node}:null:null}function si(e){const t=To(e);return t?t.node?`${t.node}:${t.session}`:t.session:""}const Om=9,Am=24,nl=11,D1=e=>{const t=Number(e);return t>=Om&&t<=Am?t:nl};function Bo(){return{columns:[]}}function ui(e){return e.columns.flatMap(t=>t.tiles.map(i=>si(i)))}const ln=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(i=>({...i}))}))});function jo(e,t,i,s){const r=To(t);if(!r||ui(e).includes(si(r))||ui(e).length>=Fh)return e;const n=ln(e),o={session:r.session,height:1,fontSize:nl,...s||{}};if(r.node&&(o.node=r.node),i==="end")return n.columns.push({width:1,tiles:[o]}),n;if(i&&typeof i.col=="number"&&typeof i.row=="number"&&n.columns[i.col])return n.columns[i.col].tiles.splice(i.row,0,o),n;if(i&&typeof i.col=="number"){const l=Math.max(0,Math.min(n.columns.length,i.col));return n.columns.splice(l,0,{width:1,tiles:[o]}),n}return n.columns.push({width:1,tiles:[o]}),n}function Im(e,t){const i=si(t);if(!i||ui(e).includes(i)||ui(e).length>=Fh)return e;const s=ui(e).length+1,r=Math.ceil(Math.sqrt(s));if(e.columns.length<r)return jo(e,t,"end");let n=0;for(let o=1;o<e.columns.length;o+=1)e.columns[o].tiles.length<e.columns[n].tiles.length&&(n=o);return jo(e,t,{col:n,row:e.columns[n].tiles.length})}function zo(e,t){const i=si(t),s=ln(e);for(const r of s.columns)r.tiles=r.tiles.filter(n=>si(n)!==i);return s.columns=s.columns.filter(r=>r.tiles.length>0),s}function M1(e,t,i){const s=si(t);if(!ui(e).includes(s))return e;const r=e.columns.flatMap(n=>n.tiles).find(n=>si(n)===s);return jo(zo(e,s),s,i,{fontSize:r.fontSize})}function L1(e,t,i){const s=ln(e);return s.columns[t]&&(s.columns[t].width=Math.max(Po,Number(i)||1)),s}function P1(e,t,i,s){const r=ln(e),n=r.columns[t]&&r.columns[t].tiles[i];return n&&(n.height=Math.max(Po,Number(s)||1)),r}function T1(e,t,i,s){if(!(e.columns[t]&&e.columns[t].tiles[i]))return e;const n=ln(e),o=n.columns[t].tiles[i],l=Number(o.fontSize)||nl;return o.fontSize=Math.max(Om,Math.min(Am,l+(Number(s)||0))),n}function B1(e,t,i,s){const r=e.columns[t];if(!r||!r.tiles[i])return null;switch(s){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 tf(e){for(const t of[.25,.5,.75])if(Math.abs(e-t)<=.03)return t;return e}function Gi(e){if(!e||!Array.isArray(e.columns))return Bo();const t=e.columns.map(s=>({width:Math.max(Po,Number(s&&s.width)||1),tiles:(Array.isArray(s&&s.tiles)?s.tiles:[]).filter(r=>r&&typeof r.session=="string"&&r.session).filter(r=>r.node==null||typeof r.node=="string"&&Mc.test(r.node)).map(r=>{const n={session:r.session,height:Math.max(Po,Number(r.height)||1),fontSize:D1(r.fontSize)};return r.node!=null&&(n.node=r.node),n})})).filter(s=>s.tiles.length>0),i=new Set;for(const s of t)s.tiles=s.tiles.filter(r=>!i.has(si(r))&&i.add(si(r))&&i.size<=Fh);return{columns:t.filter(s=>s.tiles.length>0)}}function j1({session:e,node:t,token:i,readonly:s=!1,focused:r,onFocus:n,onClose:o,onOpenSingle:l,alive:c=!0,fontSize:a=nl,onZoom:d,decks:u=[],currentDeck:f,onSendToDeck:m}){const _=E.useRef(()=>{}),S=E.useRef(()=>{}),k=E.useRef(!1),[v,p]=E.useState(!1),[g,w]=E.useState(!1),[M,N]=E.useState(!1),[x,C]=E.useState(null),D=t?`${t}:${e}`:e;return h.jsxs("div",{className:`nc-tile${r?" focused":""}`,onMouseDown:()=>n&&n(D),children:[h.jsxs("div",{className:"nc-tile-head",draggable:!0,onDragStart:L=>{L.dataTransfer.setData("text/nc-session",D),L.dataTransfer.effectAllowed="move"},children:[h.jsxs("button",{className:"nc-tile-name",onClick:()=>n&&n(D),children:[h.jsx("span",{className:c?"nc-dot on":"nc-dot"}),h.jsx("b",{children:e}),t&&h.jsxs("small",{className:"nc-tile-node",children:["@",t]})]}),h.jsxs("span",{className:"nc-tile-actions",children:[d&&h.jsx("button",{onClick:()=>d(-1),title:y("zoom-out"),children:h.jsx(fe,{name:"zoomOut",size:14})}),d&&h.jsx("button",{onClick:()=>d(1),title:y("zoom-in"),children:h.jsx(fe,{name:"zoomIn",size:14})}),m&&u.filter(L=>L!==f).length>0&&h.jsxs("select",{className:"nc-tile-deck",title:y("send-to-deck"),value:"",onMouseDown:L=>L.stopPropagation(),onChange:L=>{const A=L.target.value;A&&m(D,A),L.target.value=""},children:[h.jsx("option",{value:"",children:y("send-to-deck")}),u.filter(L=>L!==f).map(L=>h.jsx("option",{value:L,children:L},L))]}),h.jsx("button",{onClick:()=>w(L=>!L),title:"composer",children:"⌨"}),h.jsx("button",{onClick:()=>N(L=>!L),title:"file",children:"📁"}),l&&h.jsx("button",{onClick:()=>l({session:e,node:t}),title:"vista singola",children:"↗"}),o&&h.jsx("button",{className:"nc-tile-close",onClick:()=>o(D),title:"chiudi",children:"✕"})]})]}),h.jsxs("div",{className:"nc-tile-body",children:[h.jsx(Bm,{session:e,node:t,token:i,readonly:s,takeSize:!1,focused:r,sendRef:_,actionRef:S,ctrlRef:k,setCtrlArmed:p,onFiles:C,fontSize:a}),M&&h.jsx("div",{className:"nc-tile-files",onMouseDown:L=>L.stopPropagation(),children:h.jsx(jm,{session:e,node:t,token:i,filesEvent:x,onClose:()=>N(!1)})})]}),g&&h.jsx("div",{className:"nc-tile-composer",onMouseDown:L=>L.stopPropagation(),children:h.jsx(zm,{send:L=>_.current(L),token:i,session:e,node:t})})]})}const sf=.2,rf=.28;function z1(e,t,i){const s=(e-i.left)/(i.width||1),r=(t-i.top)/(i.height||1);return s<rf?"left":s>1-rf?"right":r<.5?"top":"bottom"}function O1({layout:e,onLayoutChange:t,token:i,readonly:s=!1,sessionsAlive:r,focusSession:n,onFocus:o,onOpenSingle:l,decks:c=[],currentDeck:a,onSendToDeck:d}){vt();const[u,f]=E.useState(null),m=E.useRef(null),_=E.useRef([]),S=E.useRef(null);function k(D,L){const A=()=>{window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",A),window.removeEventListener("blur",A),S.current=null};window.addEventListener("pointermove",D),window.addEventListener("pointerup",A),window.addEventListener("pointercancel",A),window.addEventListener("blur",A),S.current=A}E.useEffect(()=>()=>{S.current&&S.current()},[]),E.useEffect(()=>{const D=()=>f(null);return window.addEventListener("dragend",D),window.addEventListener("drop",D),()=>{window.removeEventListener("dragend",D),window.removeEventListener("drop",D)}},[]);const v=e.columns.length,p=D=>u&&u.col===D&&u.row===void 0,g=!!u&&u.col===v,w=(D,L)=>u&&u.col===D&&u.row===L&&u.quadrant?` drop-${u.quadrant}`:"";function M(D){D.preventDefault();const L=D.dataTransfer.getData("text/nc-session"),A=u;if(f(null),!L||!A)return;let T;if(A.quadrant){if(T=B1(e,A.col,A.row,A.quadrant),!T)return}else T={col:A.col};t(ui(e).includes(L)?M1(e,L,T):jo(e,L,T))}function N(D,L){D.preventDefault(),D.stopPropagation();const A=D.clientX,T=e.columns[L].width,P=m.current&&m.current.clientWidth||1,j=e.columns[L+1];k($=>{let R=Math.max(sf,T+($.clientX-A)/P);if(j){const b=tf(R/(R+j.width));R=b/(1-b)*j.width}t(L1(e,L,R))})}function x(D,L,A){D.preventDefault(),D.stopPropagation();const T=D.clientY,P=e.columns[L].tiles[A].height,j=_.current[L],F=j&&j.clientHeight||1,$=e.columns[L].tiles[A+1];k(b=>{let I=Math.max(sf,P+(b.clientY-T)/F);if($){const B=tf(I/(I+$.height));I=B/(1-B)*$.height}t(P1(e,L,A,I))})}function C(D){t(zo(e,D))}return h.jsxs("div",{className:"nc-grid",ref:m,onDragOver:D=>{D.preventDefault(),u&&u.col===v||f({col:v})},onDrop:M,onDragLeave:D=>{const L=D.relatedTarget;(!L||!(m.current&&m.current.contains(L)))&&f(null)},children:[e.columns.flatMap((D,L)=>{const A=[];return A.push(h.jsx("div",{className:`nc-col${p(L)?" drop-newcol":""}`,ref:T=>{_.current[L]=T},style:{flexGrow:D.width,flexBasis:0},onDragOver:T=>{T.preventDefault(),T.stopPropagation(),u&&u.col===L&&u.row===void 0||f({col:L})},children:D.tiles.flatMap((T,P)=>{const j=[],F=si(T);return j.push(h.jsx("div",{className:`nc-tile-slot${w(L,P)}`,style:{flexGrow:T.height,flexBasis:0},onDragOver:$=>{$.preventDefault(),$.stopPropagation();const R=z1($.clientX,$.clientY,$.currentTarget.getBoundingClientRect());u&&u.col===L&&u.row===P&&u.quadrant===R||f({col:L,row:P,quadrant:R})},children:h.jsx(j1,{session:T.session,node:T.node,token:i,readonly:s,focused:n===F,onFocus:o,onClose:C,onOpenSingle:l,alive:!r||r.has(F),fontSize:T.fontSize,onZoom:$=>t(T1(e,L,P,$)),decks:c,currentDeck:a,onSendToDeck:d})},F)),P<D.tiles.length-1&&j.push(h.jsx("div",{className:"nc-divider-h",onPointerDown:$=>x($,L,P)},`h${P}`)),j})},`c${L}`)),L<v-1&&A.push(h.jsx("div",{className:"nc-divider-v",onPointerDown:T=>N(T,L)},`v${L}`)),A}),g&&h.jsx("div",{className:"nc-drop-line-v nc-drop-line-end"}),v===0&&h.jsx("div",{className:"nc-grid-empty",children:y("grid-empty")})]})}const A1=/^[a-z0-9-]{1,32}$/,xt="main",$m="nc_decks",I1=24;function $1(e){return typeof e!="string"?"":e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").slice(0,32).replace(/-+$/,"")}function Hh(e){return typeof e=="string"&&A1.test(e)}function F1(e){const t=String(e||"").match(/^\/deck\/([^/]+)\/?$/);if(t){let i;try{i=decodeURIComponent(t[1])}catch{i=t[1]}return Hh(i)?i:xt}return xt}function Bn(e,t){const i=e===xt?"/":`/deck/${encodeURIComponent(e)}`;return t?`${i}#token=${encodeURIComponent(t)}`:i}function Fm(e){return e===xt?"nc_grid_v1":`nc_grid_v1__${e}`}function Hm(e){const t=[xt];if(Array.isArray(e)){for(const i of e)if(Hh(i)&&i!==xt&&!t.includes(i)&&t.push(i),t.length>=I1)break}return t}function ol(){return typeof localStorage<"u"?localStorage:null}function H1(){const e=ol();if(!e)return[xt];try{return Hm(JSON.parse(e.getItem($m)||"null"))}catch{return[xt]}}function W1(e){const t=ol();if(t)try{t.setItem($m,JSON.stringify(Hm(e)))}catch{}}function Lc(e){const t=ol();if(!t)return null;try{return JSON.parse(t.getItem(Fm(e))||"null")}catch{return null}}function U1(e,t){const i=ol();if(i)try{i.setItem(Fm(e),JSON.stringify(t))}catch{}}function K1({decks:e=[],currentDeck:t=xt,onCreate:i,onRename:s,onDelete:r,onOpenWindow:n,onNavigate:o,saveState:l="idle",error:c=""}){vt();const[a,d]=E.useState(!1),[u,f]=E.useState(""),[m,_]=E.useState(!1),[S,k]=E.useState(""),[v,p]=E.useState(""),g=$1(u),w=Hh(g),M=async()=>{if(w){_(!0),k("");try{i&&await i(g),f(""),d(!1)}catch(x){k(String(x.message||x))}_(!1)}},N=x=>{p(""),n&&n(x)||p(x)};return h.jsxs("div",{className:"nc-deckbar",children:[h.jsx("span",{className:"nc-deckbar-label",children:y("decks")}),h.jsx("div",{className:"nc-deck-chips",children:e.map(x=>h.jsxs("span",{className:`nc-deck-chip${x===t?" current":""}`,children:[h.jsxs("button",{className:"nc-deck-open",title:x===t?y("deck-current"):x,onClick:()=>x!==t&&o&&o(x),children:[x,x===t?" •":""]}),h.jsx("button",{className:"nc-deck-mini",title:y("open-deck-window"),onClick:()=>N(x),children:"↗"}),x!==xt&&h.jsxs(h.Fragment,{children:[h.jsx("button",{className:"nc-deck-mini",title:y("rename-deck"),onClick:()=>{const D=((typeof window<"u"?window.prompt(y("rename-deck"),x):"")||"").trim();D&&D!==x&&s&&s(x,D).catch(L=>k(String(L.message||L)))},children:"✎"}),h.jsx("button",{className:"nc-deck-mini nc-deck-del",title:y("delete-deck"),onClick:()=>{(typeof window>"u"||window.confirm(y("delete-deck-confirm").replace("{name}",x)))&&r&&r(x).catch(C=>k(String(C.message||C)))},children:"✕"})]})]},x))}),a?h.jsxs("span",{className:"nc-deck-add",children:[h.jsx("input",{autoFocus:!0,className:w||!u?"":"invalid",placeholder:y("deck-name"),value:u,onChange:x=>f(x.target.value),onKeyDown:x=>{x.key==="Enter"&&M(),x.key==="Escape"&&(f(""),d(!1))}}),u&&w&&g!==u&&h.jsxs("span",{className:"nc-deck-slug",children:["→ ",g]}),h.jsx("button",{className:"nc-deck-ok",disabled:!w||m,onClick:M,children:y("create")}),h.jsx("button",{className:"nc-deck-cancel",onClick:()=>{f(""),d(!1)},children:y("cancel")})]}):h.jsxs("button",{className:"nc-deck-newbtn",title:y("new-deck"),onClick:()=>d(!0),children:["+ ",y("new-deck")]}),h.jsx("span",{className:`nc-deck-state ${l}`,title:y("deck-autosave"),children:y(l==="saving"?"saving":l==="saved"?"saved":"deck-autosave")}),(S||c)&&h.jsx("span",{className:"nc-deck-error",children:S||c}),v&&h.jsx("a",{className:"nc-deck-fallback",href:`/deck/${encodeURIComponent(v)}`,target:"_blank",rel:"noreferrer",children:y("popup-blocked")})]})}const V1=/^[a-z0-9-]{1,32}$/,q1=/^[A-Za-z0-9._-]{1,32}$/,Y1=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/,X1=320;function G1(e){return typeof e=="string"&&V1.test(e)}function Wm(e){if(typeof e!="string"||!e||e.length>X1||e.includes("\0")||/\s/.test(e))return!1;const t=e.indexOf("@");return t<=0||t!==e.lastIndexOf("@")?!1:q1.test(e.slice(0,t))&&Y1.test(e.slice(t+1))}function Um(e){if(e===""||e===null||e===void 0)return null;const t=String(e).trim();if(!/^[0-9]{1,5}$/.test(t))return;const i=Number(t);return Number.isInteger(i)&&i>=1&&i<=65535?i:void 0}function Km({name:e,ssh:t,remotePort:i}={}){const s=typeof e=="string"?e.trim():e,r=typeof t=="string"?t.trim():t;if(!G1(s))return{ok:!1,error:"err-node-name"};if(!Wm(r))return{ok:!1,error:"err-ssh"};const n=Um(i);if(n===void 0)return{ok:!1,error:"err-port"};const o={name:s,ssh:r};return n!==null&&(o.remotePort=n),{ok:!0,value:o}}function Vm({ssh:e,publishedPort:t}={},i=!1){const s=typeof e=="string"?e.trim():e,r=Um(t);if(r===void 0)return{ok:!1,error:"err-port"};if(!s){if(!i)return{ok:!1,error:"err-rendezvous-required"};const o={};return r!==null&&(o.publishedPort=r),{ok:!0,value:o}}if(!Wm(s))return{ok:!1,error:"err-ssh"};const n={rendezvousSsh:s};return r!==null&&(n.publishedPort=r),{ok:!0,value:n}}function qm(e){const t=["roles","node"];return e&&e.node===!0&&t.push("rendezvous"),t.push("done"),t}function Q1(e,t){const i=qm(t),s=i.indexOf(e);return s<0?i[0]:i[Math.min(s+1,i.length-1)]}function J1(e,t){const i=qm(t),s=i.indexOf(e);return s<=0?i[0]:i[s-1]}function Z1(){return{step:"roles",roles:{client:!0,node:!1}}}function eC(e,t){if(!e||!t||t<e)return null;const i=Math.floor((t-e)/1e3);return i<60?"ora":i<3600?`${Math.floor(i/60)}m`:i<86400?`${Math.floor(i/3600)}h`:`${Math.floor(i/86400)}g`}function tC(e,t){const i=!!(e&&e.status==="up");return{up:i,label:i?"tunnel-up":"tunnel-down",since:i?eC(e.since,t):null}}function Wh(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&typeof Notification<"u"}function iC(e){const t="=".repeat((4-e.length%4)%4),i=(e+t).replace(/-/g,"+").replace(/_/g,"/"),s=atob(i),r=new Uint8Array(s.length);for(let n=0;n<s.length;n+=1)r[n]=s.charCodeAt(n);return r}async function sC(){if(!Wh())return"unsupported";if(Notification.permission==="denied")return"denied";try{return await(await navigator.serviceWorker.ready).pushManager.getSubscription()?"subscribed":"idle"}catch{return"idle"}}async function rC(e){if(!Wh())throw new Error("push-unsupported");if(await Notification.requestPermission()!=="granted")throw new Error("push-denied");const i=await Ue("/api/push/vapid",e),{publicKey:s}=await i.json();if(!s)throw new Error("vapid non disponibile");const n=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:iC(s)}),o=await Ue("/api/push/subscribe",e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({subscription:n.toJSON()})});if(!o.ok){try{await n.unsubscribe()}catch{}const l=await o.json().catch(()=>({}));throw new Error(l.error||`HTTP ${o.status}`)}return!0}async function nC(e){if(!Wh())return!1;const i=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!i)return!1;const s=i.endpoint;try{await i.unsubscribe()}catch{}try{await Ue("/api/push/subscribe",e,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:s})})}catch{}return!0}const oC=()=>({kind:"managed",id:"claude.ollama-cloud",label:"",client:"claude",provider:"ollama-cloud",managedModel:"glm-5.2",command:"",argsText:"",rc:!1,promptMode:"send-keys",promptFlag:"",modelFlag:"",modelValue:"",envRows:[]}),lC=(e="")=>({id:"",cwd:"",engine:e,boot:!1,model:"",prompt:""}),aC=(e,t)=>`${e==="claude"?"Claude":"Codex-VL"} · ${t==="native"?"Native":t==="ollama-cloud"?"Ollama Cloud Direct":t==="zai-a"?"Z.AI A":"Z.AI P"}`;function cC(e){var t,i,s,r,n;return{kind:e.managed?"managed":"custom",id:e.id,label:e.label||"",command:e.command||"",argsText:(e.args||[]).join(`
|
|
82
|
-
`),rc:!!e.rc,client:((t=e.managed)==null?void 0:t.client)||"claude",provider:((i=e.managed)==null?void 0:i.provider)||"native",managedModel:((s=e.managed)==null?void 0:s.model)||"",promptMode:e.promptMode||"send-keys",promptFlag:e.promptFlag||"",modelFlag:((r=e.model)==null?void 0:r.flag)||"",modelValue:((n=e.model)==null?void 0:n.value)||"",envRows:(e.envKeys||[]).map(o=>({key:o,value:"",configured:!0,remove:!1}))}}function hC(e,t){if(e.kind==="managed")return{...t?{id:e.id}:{},label:e.label||aC(e.client,e.provider),rc:!!e.rc,managed:{client:e.client,provider:e.provider,model:e.managedModel||""}};const i={...t?{id:e.id}:{},label:e.label||e.id,rc:!!e.rc,command:e.command,args:e.argsText.split(`
|
|
83
|
-
`).filter(s=>s!==""),promptMode:e.promptMode};return e.modelFlag&&(i.model={flag:e.modelFlag,value:e.modelValue||""}),e.promptMode==="flag"&&(i.promptFlag=e.promptFlag),t&&(i.env=Object.fromEntries(e.envRows.filter(s=>!s.remove&&s.key).map(s=>[s.key,s.value]))),i}function uC({token:e,readonly:t}){const[i,s]=E.useState({engines:[],cells:[]}),[r,n]=E.useState({available:!1,capabilities:[]}),[o,l]=E.useState(null),[c,a]=E.useState(null),[d,u]=E.useState(!1),[f,m]=E.useState(""),[_,S]=E.useState(""),k=E.useCallback(async()=>{try{const N=await el(e);n(N),N.provider==="builtin"&&(N.capabilities||[]).includes("definitions")&&s(await BS(e))}catch(N){m(String(N.message||N))}},[e]);E.useEffect(()=>{k();const N=setInterval(k,5e3);return()=>clearInterval(N)},[k]);const v=new Set((r.cells||[]).filter(N=>N.active).map(N=>N.cell)),p=r.provider==="builtin"&&(r.capabilities||[]).includes("edit"),g=async N=>{u(!0),m(""),S("");try{await N(),await k()}catch(x){m(String(x.message||x))}u(!1)},w=()=>g(async()=>{const N=o.mode==="new",x=hC(o.form,N);!N&&o.form.kind==="custom"&&!o.form.modelFlag&&(x.model=null),!N&&o.form.kind==="custom"&&o.form.promptMode!=="flag"&&(x.promptFlag=null);let C;if(N)C=await jS(e,x);else{const L=o.original,A=new Set(o.form.envRows.filter(j=>!j.remove).map(j=>j.key)),T=(L.envKeys||[]).filter(j=>!A.has(j)),P=Object.fromEntries(o.form.envRows.filter(j=>!j.remove&&j.key&&(!j.configured||j.value!=="")).map(j=>[j.key,j.value]));C=await zS(e,L.id,x,o.form.kind==="custom"?{set:P,remove:T}:void 0)}l(null),S(y("fleet-saved"));const D=(C==null?void 0:C.activeCells)||[];if(D.length&&window.confirm(y("fleet-restart-confirm").replace("{cells}",D.join(", "))))for(const L of D)await ed(e,L)}),M=()=>g(async()=>{const N=c.mode==="new",x=c.form,C={...N?{id:x.id}:{},cwd:x.cwd,engine:x.engine,boot:!!x.boot};N?(x.model&&(C.model=x.model),x.prompt&&(C.prompt=x.prompt)):(C.model=x.model||null,C.prompt=x.prompt||null);const D=N?await AS(e,C):await IS(e,c.original.id,C),L=N?x.id:c.original.id;a(null),S(y("fleet-saved")),!N&&(D!=null&&D.active)&&window.confirm(y("fleet-restart-confirm").replace("{cells}",L))&&await ed(e,L)});return p?h.jsxs("div",{className:"nc-set-tab nc-fleet-editor",children:[h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:y("fleet-engines")}),h.jsxs("button",{className:"nc-btn primary",disabled:t||d,onClick:()=>l({mode:"new",form:oC()}),children:["+ ",y("add")]})]}),i.engines.map(N=>{var x,C;return h.jsxs("div",{className:"nc-fleet-item",children:[h.jsxs("span",{children:[h.jsx("b",{children:N.label}),h.jsx("small",{children:N.managed?`${N.id} · ${N.managed.client} / ${N.managed.provider} · ${(x=N.managedInfo)!=null&&x.configured?y("fleet-ready"):((C=N.managedInfo)==null?void 0:C.reason)||y("fleet-not-ready")}`:`${N.id} · ${N.command}`})]}),h.jsxs("span",{children:[h.jsx("button",{className:"nc-btn ghost",disabled:t||d,onClick:()=>l({mode:"edit",original:N,form:cC(N)}),children:y("edit")}),h.jsx("button",{className:"nc-btn danger",disabled:t||d,onClick:()=>g(async()=>{window.confirm(y("fleet-remove-engine").replace("{id}",N.id))&&await OS(e,N.id)}),children:"×"})]})]},N.id)}),o&&h.jsx(dC,{state:o,setState:l,busy:d,onSave:w}),h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:y("fleet-cells")}),h.jsxs("button",{className:"nc-btn primary",disabled:t||d||!i.engines.length,onClick:()=>{var N;return a({mode:"new",form:lC((N=i.engines[0])==null?void 0:N.id)})},children:["+ ",y("add")]})]}),i.cells.map(N=>h.jsxs("div",{className:"nc-fleet-item",children:[h.jsxs("span",{children:[h.jsx("b",{children:N.id}),h.jsxs("small",{children:[N.engine," · ",N.cwd,v.has(N.id)?` · ${y("service-active")}`:""]})]}),h.jsxs("span",{children:[h.jsx("button",{className:"nc-btn ghost",disabled:t||d,onClick:()=>a({mode:"edit",original:N,form:{...N}}),children:y("edit")}),h.jsx("button",{className:"nc-btn danger",disabled:t||d,onClick:()=>g(async()=>{window.confirm(y("fleet-remove-cell").replace("{id}",N.id))&&await $S(e,N.id,!0)}),children:"×"})]})]},N.id)),c&&h.jsx(fC,{token:e,state:c,setState:a,engines:i.engines,busy:d,onSave:M}),_&&h.jsx("div",{className:"nc-set-note",children:_}),f&&h.jsx("div",{className:"nc-err",children:f})]}):h.jsx("div",{className:"nc-set-info",children:y("fleet-editor-unavailable")})}function dC({state:e,setState:t,busy:i,onSave:s}){const r=e.form,n=a=>t({...e,form:{...r,...a}}),o=r.envRows||[],l=r.client==="claude"?["native","ollama-cloud","zai-a","zai-p"]:["native","ollama-cloud"],c=(a,d)=>{const f=(a==="claude"?["native","ollama-cloud","zai-a","zai-p"]:["native","ollama-cloud"]).includes(d)?d:"native",m=f==="ollama-cloud"?"glm-5.2":f.startsWith("zai-")?"glm-5.2[1m]":"";n({client:a,provider:f,managedModel:m,rc:a==="claude"&&f==="native",...e.mode==="new"?{id:`${a}.${f}`,label:""}:{}})};return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsx("b",{children:e.mode==="new"?y("fleet-new-engine"):`${y("edit")} ${r.id}`}),h.jsx("input",{value:r.id,disabled:e.mode!=="new",placeholder:"id",onChange:a=>n({id:a.target.value})}),h.jsx("input",{value:r.label,placeholder:y("label"),onChange:a=>n({label:a.target.value})}),h.jsxs("select",{value:r.kind,disabled:e.mode!=="new",onChange:a=>n({kind:a.target.value}),children:[h.jsx("option",{value:"managed",children:y("fleet-managed")}),h.jsx("option",{value:"custom",children:y("fleet-custom")})]}),r.kind==="managed"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsxs("select",{value:r.client,disabled:e.mode!=="new",onChange:a=>c(a.target.value,r.provider),children:[h.jsx("option",{value:"claude",children:"Claude"}),h.jsx("option",{value:"codex-vl",children:"Codex-VL"})]}),h.jsx("select",{value:r.provider,disabled:e.mode!=="new",onChange:a=>c(r.client,a.target.value),children:l.map(a=>h.jsx("option",{value:a,children:a},a))})]}),h.jsx("input",{value:r.managedModel,placeholder:y("fleet-model-default"),onChange:a=>n({managedModel:a.target.value})}),h.jsx("small",{children:y("fleet-managed-help")})]}):h.jsxs(h.Fragment,{children:[h.jsx("input",{value:r.command,placeholder:y("command-path"),onChange:a=>n({command:a.target.value})}),h.jsx("textarea",{value:r.argsText,placeholder:y("args-lines"),onChange:a=>n({argsText:a.target.value})}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:r.rc,onChange:a=>n({rc:a.target.checked})})," remote control"]}),h.jsxs("select",{value:r.promptMode,onChange:a=>n({promptMode:a.target.value}),children:[h.jsx("option",{value:"send-keys",children:"send-keys"}),h.jsx("option",{value:"flag",children:"flag"})]}),r.promptMode==="flag"&&h.jsx("input",{value:r.promptFlag,placeholder:"prompt flag",onChange:a=>n({promptFlag:a.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:r.modelFlag,placeholder:"model flag",onChange:a=>n({modelFlag:a.target.value})}),h.jsx("input",{value:r.modelValue,placeholder:"model default",onChange:a=>n({modelValue:a.target.value})})]}),h.jsx("small",{children:y("env-write-only")}),o.map((a,d)=>h.jsxs("div",{className:"nc-fleet-env",children:[h.jsx("input",{value:a.key,disabled:a.configured,placeholder:"ENV_KEY",onChange:u=>{const f=o.slice();f[d]={...a,key:u.target.value},n({envRows:f})}}),h.jsx("input",{type:"password",value:a.value,placeholder:a.configured?"•••••• (unchanged)":"value",onChange:u=>{const f=o.slice();f[d]={...a,value:u.target.value},n({envRows:f})}}),h.jsx("button",{className:"nc-btn danger",onClick:()=>n({envRows:o.filter((u,f)=>f!==d)}),children:"×"})]},`${a.key}-${d}`)),h.jsx("button",{className:"nc-btn ghost",onClick:()=>n({envRows:[...o,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:y("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:i||!r.id||r.kind==="custom"&&!r.command,onClick:s,children:y("save")})]})]})}function fC({token:e,state:t,setState:i,engines:s,busy:r,onSave:n}){const[o,l]=E.useState(null),[c,a]=E.useState(""),d=t.form,u=_=>i({...t,form:{...d,..._}}),f=_=>{var k,v,p;const S=s.find(g=>g.id===_);u({engine:_,model:((k=d.models)==null?void 0:k[_])||((v=S==null?void 0:S.managed)==null?void 0:v.model)||((p=S==null?void 0:S.model)==null?void 0:p.value)||""})},m=async _=>{try{const S=await M_(e,_);l(S),u({cwd:S.path}),a("")}catch(S){a(String(S.message||S))}};return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsx("b",{children:t.mode==="new"?y("fleet-new-cell"):`${y("edit")} ${d.id}`}),h.jsx("input",{value:d.id,disabled:t.mode!=="new",placeholder:"id",onChange:_=>u({id:_.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:d.cwd,placeholder:y("cwd"),onChange:_=>u({cwd:_.target.value})}),h.jsx("button",{className:"nc-btn ghost",onClick:()=>o?l(null):m(d.cwd),children:y("browse")})]}),o&&h.jsxs("div",{className:"nc-fs",children:[h.jsx("div",{className:"nc-fs-path",children:o.path}),h.jsxs("div",{className:"nc-fs-list",children:[o.parent&&h.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>m(o.parent),children:["↑ ",y("fs-parent")]}),(o.dirs||[]).map(_=>h.jsxs("button",{className:"nc-fs-item",onClick:()=>m(`${o.path.replace(/\/$/,"")}/${_}`),children:["📁 ",_]},_))]})]}),c&&h.jsx("div",{className:"nc-err",children:c}),h.jsx("select",{value:d.engine,onChange:_=>f(_.target.value),children:s.map(_=>h.jsx("option",{value:_.id,children:_.label},_.id))}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!d.boot,onChange:_=>u({boot:_.target.checked})})," boot"]}),h.jsx("input",{value:d.model||"",placeholder:"model override",onChange:_=>u({model:_.target.value})}),h.jsx("textarea",{value:d.prompt||"",placeholder:"prompt",onChange:_=>u({prompt:_.target.value})}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>i(null),children:y("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:r||!d.id||!d.cwd||!d.engine,onClick:n,children:y("save")})]})]})}function pC({text:e}){const[t,i]=E.useState(!1),s=async()=>{try{await navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),1500)}catch{}};return h.jsxs("div",{className:"nc-set-copyline",children:[h.jsx("code",{children:e}),h.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:s,children:[h.jsx(fe,{name:"copy",size:14})," ",y(t?"copied":"copy")]})]})}function Oo({line:e}){return e?h.jsxs("div",{className:"nc-set-akeys",children:[h.jsx("div",{className:"nc-set-hint",children:y("authorized-keys-hint")}),h.jsx(pC,{text:e})]}):null}function _C({token:e,settings:t,readonly:i,refresh:s}){const r=t&&t.roles||{client:!1,node:!1},n=!!(t&&t.rendezvous),[o,l]=E.useState(null),[c,a]=E.useState(!1),[d,u]=E.useState(null),[f,m]=E.useState(null),_=async p=>{l(null),a(!0);try{await Ha(e,{roles:{client:p}}),await s()}catch(g){l(String(g.message||g))}a(!1)},S=async p=>{l(null),a(!0);try{const g=await B_(e,p);m(g.authorizedKeys||null),u(null),await s()}catch(g){l(String(g.message||g))}a(!1)},k=p=>{if(m(null),!p)return S({enabled:!1});if(n)return S({enabled:!0});u({ssh:"",publishedPort:""})},v=()=>{const p=Vm(d,n);if(!p.ok)return l(y(p.error));S({enabled:!0,...p.value})};return h.jsxs("div",{className:"nc-set-tab",children:[h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!r.client,disabled:i||c,onChange:p=>_(p.target.checked)}),h.jsxs("span",{children:[h.jsx("b",{children:y("role-client")}),h.jsx("small",{children:y("role-client-desc")})]})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!r.node,disabled:i||c,onChange:p=>k(p.target.checked)}),h.jsxs("span",{children:[h.jsx("b",{children:y("role-node")}),h.jsx("small",{children:y("role-node-desc")})]})]}),t&&t.rendezvous&&h.jsxs("div",{className:"nc-set-info",children:["rendezvous: ",t.rendezvous.ssh,t.rendezvous.publishedPort?` :${t.rendezvous.publishedPort}`:""]}),d&&h.jsxs("div",{className:"nc-set-form",children:[h.jsx("input",{placeholder:y("rendezvous-ssh"),value:d.ssh,onChange:p=>u({...d,ssh:p.target.value})}),h.jsx("input",{placeholder:y("published-port"),inputMode:"numeric",value:d.publishedPort,onChange:p=>u({...d,publishedPort:p.target.value})}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>u(null),children:y("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:c,onClick:v,children:y("enable")})]})]}),h.jsx(Oo,{line:f}),o&&h.jsx("div",{className:"nc-err",children:o})]})}function mC({token:e,nodes:t,readonly:i,refresh:s}){const[r,n]=E.useState(null),[o,l]=E.useState(null),[c,a]=E.useState({}),[d,u]=E.useState({name:"",ssh:"",remotePort:""}),[f,m]=E.useState(null),_=Date.now(),S=async(p,g)=>{n(null),l(`${p}:${g}`);try{const w=await US(e,p,g);g==="test"&&a(M=>({...M,[p]:w})),await s()}catch(w){n(`${p}: ${String(w.message||w)}`)}l(null)},k=async p=>{if(window.confirm(y("node-remove-confirm").replace("{name}",p))){n(null),l(`${p}:remove`);try{await WS(e,p),await s()}catch(g){n(`${p}: ${String(g.message||g)}`)}l(null)}},v=async()=>{n(null),m(null);const p=Km(d);if(!p.ok)return n(y(p.error));l("add");try{const g=await T_(e,p.value);m(g.authorizedKeys||null),u({name:"",ssh:"",remotePort:""}),await s()}catch(g){n(String(g.message||g))}l(null)};return h.jsxs("div",{className:"nc-set-tab",children:[(t||[]).length===0&&h.jsx("div",{className:"nc-empty",children:y("no-nodes")}),(t||[]).map(p=>{const g=tC(p.tunnel,_),w=c[p.name];return h.jsxs("div",{className:"nc-set-node",children:[h.jsxs("div",{className:"nc-set-node-head",children:[h.jsx("span",{className:`nc-dot ${g.up?"on":""}`}),h.jsx("b",{children:p.name}),h.jsxs("small",{children:[p.ssh," · :",p.localPort,"→:",p.remotePort]}),h.jsxs("span",{className:`nc-set-tunnel${g.up?" up":""}`,children:[y(g.label),g.since?` · ${g.since}`:""]})]}),h.jsxs("div",{className:"nc-set-node-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!o,onClick:()=>S(p.name,"test"),children:y("node-test")}),g.up?h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!o,onClick:()=>S(p.name,"down"),children:y("tunnel-stop")}):h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!o,onClick:()=>S(p.name,"up"),children:y("tunnel-start")}),h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!o,onClick:()=>S(p.name,"restart"),children:y("tunnel-restart")}),h.jsx("button",{type:"button",className:"nc-btn danger",disabled:i||!!o,title:y(i?"settings-readonly":"terminate"),onClick:()=>k(p.name),children:h.jsx(fe,{name:"trash",size:14})})]}),w&&h.jsxs("div",{className:`nc-set-test${w.ok?" ok":" ko"}`,children:[w.result,w.detail?` — ${w.detail}`:""]})]},p.name)}),h.jsxs("div",{className:"nc-set-form",children:[h.jsx("div",{className:"nc-sheet-label",children:y("node-add")}),h.jsx("input",{placeholder:y("node-name-ph"),value:d.name,disabled:i,onChange:p=>u({...d,name:p.target.value})}),h.jsx("input",{placeholder:y("node-ssh-ph"),value:d.ssh,disabled:i,onChange:p=>u({...d,ssh:p.target.value})}),h.jsx("input",{placeholder:y("node-port-ph"),inputMode:"numeric",value:d.remotePort,disabled:i,onChange:p=>u({...d,remotePort:p.target.value})}),h.jsx("div",{className:"nc-sheet-actions",children:h.jsx("button",{type:"button",className:"nc-btn primary",disabled:i||o==="add",title:i?y("settings-readonly"):"",onClick:v,children:y("add")})})]}),h.jsx(Oo,{line:f}),r&&h.jsx("div",{className:"nc-err",children:r})]})}function vC({token:e,readonly:t}){const[i,s]=E.useState("idle"),[r,n]=E.useState(!1),[o,l]=E.useState(null);E.useEffect(()=>{let a=!1;return sC().then(d=>{a||s(d)}),()=>{a=!0}},[]);const c=async()=>{l(null),n(!0);try{i==="subscribed"?(await nC(e),s("idle")):(await rC(e),s("subscribed"))}catch(a){const d=String(a.message||a);d==="push-denied"?(s("denied"),l(y("push-denied"))):d==="push-unsupported"?(s("unsupported"),l(y("push-unsupported"))):l(d)}n(!1)};return i==="unsupported"?h.jsx("div",{className:"nc-set-info",children:y("push-unsupported")}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||r||i==="denied",title:t?y("settings-readonly"):"",onClick:c,children:y(i==="subscribed"?"push-disable":"push-enable")}),h.jsx("span",{className:"nc-set-info",children:y(i==="subscribed"?"push-on":i==="denied"?"push-denied":"push-off")})]}),o&&h.jsx("div",{className:"nc-err",children:o})]})}function gC({token:e,settings:t,readonly:i}){const[s,r]=E.useState(null),[n,o]=E.useState(null),[l,c]=E.useState(!1),[a,d]=E.useState(!1),u=async()=>{r(null),o(null),d(!0);try{const _=await HS(e);o(_.note||"ok"),c(!1)}catch(_){r(String(_.message||_))}d(!1)},f=async()=>{r(null),o(null),d(!0);try{const _=await KS(e);o(`${_.note||"ok"}${_.target?` (${_.target})`:""}`)}catch(_){r(String(_.message||_))}d(!1)},m=t&&t.service;return h.jsxs("div",{className:"nc-set-tab",children:[t&&h.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,h.jsx("br",{}),m&&m.installed?y("service-installed"):y("service-missing"),m&&m.installed?` · ${m.active?y("service-active"):y("service-inactive")}`:""]}),h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:i||a,title:i?y("settings-readonly"):"",onClick:()=>{r(null),o(null),c(!0)},children:y("token-rotate")}),h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:i||a,title:i?y("settings-readonly"):"",onClick:f,children:y("service-regenerate")})]}),h.jsx(vC,{token:e,readonly:i}),l&&h.jsxs("div",{className:"nc-set-confirm",children:[h.jsx("div",{children:y("token-rotate-explain")}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:a,onClick:()=>c(!1),children:y("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:a,onClick:u,children:y("confirm")})]})]}),n&&h.jsx("div",{className:"nc-set-note",children:n}),s&&h.jsx("div",{className:"nc-err",children:s})]})}function SC({token:e,onClose:t}){vt();const[i,s]=E.useState("roles"),[r,n]=E.useState(null),[o,l]=E.useState([]),[c,a]=E.useState(!1),[d,u]=E.useState(null),f=E.useCallback(async()=>{try{const m=await L_(e);n(m),u(null)}catch(m){u(String(m.message||m))}try{const m=await P_(e);l(m.nodes||[])}catch(m){u(String(m.message||m))}},[e]);return E.useEffect(()=>{f();const m=setInterval(f,5e3);return()=>clearInterval(m)},[f]),E.useEffect(()=>{let m=!1;return Ue("/api/config",e).then(_=>_.json()).then(_=>{m||a(!!_.readonlyDefault)}).catch(()=>{}),()=>{m=!0}},[e]),h.jsx("div",{className:"nc-set-overlay",onClick:t,children:h.jsxs("div",{className:"nc-set-panel",onClick:m=>m.stopPropagation(),children:[h.jsxs("div",{className:"nc-set-head",children:[h.jsx(fe,{name:"gear",size:18}),h.jsx("b",{children:y("settings")}),h.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:y("close"),children:h.jsx(fe,{name:"x",size:18})})]}),c&&h.jsx("div",{className:"nc-set-readonly",children:y("settings-readonly")}),d&&h.jsx("div",{className:"nc-err",children:d}),h.jsx("div",{className:"nc-set-tabs",children:["roles","nodes","fleet","system"].map(m=>h.jsx("button",{type:"button",className:`nc-set-tabbtn${i===m?" on":""}`,onClick:()=>s(m),children:y(`tab-${m}`)},m))}),h.jsxs("div",{className:"nc-set-body",children:[i==="roles"&&h.jsx(_C,{token:e,settings:r,readonly:c,refresh:f}),i==="nodes"&&h.jsx(mC,{token:e,nodes:o,readonly:c,refresh:f}),i==="fleet"&&h.jsx(uC,{token:e,readonly:c}),i==="system"&&h.jsx(gC,{token:e,settings:r,readonly:c})]})]})})}function yC({token:e,onDone:t}){vt();const[i,s]=E.useState(Z1),[r,n]=E.useState(!1),[o,l]=E.useState(null),[c,a]=E.useState({name:"",ssh:"",remotePort:""}),[d,u]=E.useState(null),[f,m]=E.useState({ssh:"",publishedPort:""}),[_,S]=E.useState(null),{step:k,roles:v}=i,p=()=>{l(null),s(D=>({...D,step:Q1(D.step,D.roles)}))},g=()=>{l(null),s(D=>({...D,step:J1(D.step,D.roles)}))},w=async()=>{l(null),n(!0);try{await Ha(e,{wizardDone:!0}),t()}catch(D){l(String(D.message||D)),n(!1)}},M=async()=>{l(null),n(!0);try{await Ha(e,{roles:v}),n(!1),p()}catch(D){l(String(D.message||D)),n(!1)}},N=async()=>{l(null);const D=Km(c);if(!D.ok)return l(y(D.error));n(!0);try{const L=await T_(e,D.value);u(L.authorizedKeys||null)}catch(L){l(String(L.message||L))}n(!1)},x=async()=>{l(null);const D=Vm(f,!1);if(!D.ok)return l(y(D.error));n(!0);try{const L=await B_(e,{enabled:!0,...D.value});S(L.authorizedKeys||null)}catch(L){l(String(L.message||L))}n(!1)},C={roles:y("wizard-step-roles"),node:y("wizard-step-node"),rendezvous:y("wizard-step-rendezvous"),done:y("wizard-done")}[k];return h.jsx("div",{className:"nc-wiz-overlay",children:h.jsxs("div",{className:"nc-wiz",children:[h.jsxs("div",{className:"nc-wiz-head",children:[h.jsx("b",{children:y("wizard-title")}),h.jsx("small",{children:C})]}),k==="roles"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:v.client,onChange:D=>s(L=>({...L,roles:{...L.roles,client:D.target.checked}}))}),h.jsxs("span",{children:[h.jsx("b",{children:y("role-client")}),h.jsx("small",{children:y("role-client-desc")})]})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:v.node,onChange:D=>s(L=>({...L,roles:{...L.roles,node:D.target.checked}}))}),h.jsxs("span",{children:[h.jsx("b",{children:y("role-node")}),h.jsx("small",{children:y("role-node-desc")})]})]}),h.jsx("div",{className:"nc-sheet-actions",children:h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r,onClick:M,children:y("next")})})]}),k==="node"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("input",{placeholder:y("node-name-ph"),value:c.name,onChange:D=>a({...c,name:D.target.value})}),h.jsx("input",{placeholder:y("node-ssh-ph"),value:c.ssh,onChange:D=>a({...c,ssh:D.target.value})}),h.jsx("input",{placeholder:y("node-port-ph"),inputMode:"numeric",value:c.remotePort,onChange:D=>a({...c,remotePort:D.target.value})}),h.jsx(Oo,{line:d}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r,onClick:g,children:y("back")}),!d&&h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r,onClick:p,children:y("skip")}),!d&&h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r,onClick:N,children:y("add")}),d&&h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r,onClick:p,children:y("next")})]})]}),k==="rendezvous"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("input",{placeholder:y("rendezvous-ssh"),value:f.ssh,onChange:D=>m({...f,ssh:D.target.value})}),h.jsx("input",{placeholder:y("published-port"),inputMode:"numeric",value:f.publishedPort,onChange:D=>m({...f,publishedPort:D.target.value})}),h.jsx(Oo,{line:_}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r,onClick:g,children:y("back")}),!_&&h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r,onClick:p,children:y("skip")}),!_&&h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r,onClick:x,children:y("enable")}),_&&h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r,onClick:p,children:y("next")})]})]}),k==="done"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("div",{className:"nc-wiz-done",children:y("wizard-done-desc")}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r,onClick:g,children:y("back")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r,onClick:w,children:y("finish")})]})]}),o&&h.jsx("div",{className:"nc-err",children:o}),k!=="done"&&h.jsx("button",{type:"button",className:"nc-wiz-skip",disabled:r,onClick:w,children:y("wizard-skip")})]})})}function wC(e,t){if(typeof EventSource>"u"||!e)return()=>{};const i=new EventSource(`/api/events?token=${encodeURIComponent(e)}`);return i.onmessage=s=>{try{const r=JSON.parse(s.data);r&&typeof r=="object"&&typeof r.type=="string"&&t(r)}catch{}},()=>{try{i.close()}catch{}}}const CC=6e3,xC=12e3;function bC({n:e,onClose:t}){return h.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[h.jsxs("div",{className:"nc-ntf-toast-txt",children:[h.jsx("b",{children:e.title}),e.body&&h.jsx("small",{children:e.body}),e.session&&h.jsx("span",{className:"nc-ntf-from",children:e.session})]}),h.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:y("close"),children:h.jsx(fe,{name:"x",size:14})})]})}function kC({ask:e,token:t,onAnswered:i}){const[s,r]=E.useState(""),[n,o]=E.useState(!1),[l,c]=E.useState(null),a=async d=>{const u=String(d||"").trim();if(!(!u||n)){c(null),o(!0);try{await qS(t,e.id,u),i(e.id)}catch(f){c(String(f.message||f))}o(!1)}};return h.jsxs("div",{className:"nc-ask-card",children:[h.jsxs("div",{className:"nc-ask-head",children:[h.jsx("span",{className:"nc-ntf-from",children:e.session}),h.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),h.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&h.jsx("div",{className:"nc-ask-opts",children:e.options.map(d=>h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n,onClick:()=>a(d),children:d},d))}),h.jsxs("div",{className:"nc-ask-reply",children:[h.jsx("textarea",{rows:2,placeholder:y("ask-reply-ph"),value:s,disabled:n,onChange:d=>r(d.target.value)}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||!s.trim(),onClick:()=>a(s),children:y("send")})]}),l&&h.jsx("div",{className:"nc-err",children:l})]})}function EC({token:e}){vt();const[t,i]=E.useState([]),[s,r]=E.useState([]),[n,o]=E.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),l=E.useRef(0),c=E.useCallback(u=>{i(f=>f.filter(m=>m.key!==u))},[]),a=E.useCallback(u=>{const f=`t${l.current+=1}`;i(m=>[...m.slice(-3),{...u,key:f}]),setTimeout(()=>c(f),u.urgency==="high"?xC:CC)},[c]);E.useEffect(()=>{if(!e)return;let u=!1;VS(e).then(m=>{u||r(m.asks||[])}).catch(()=>{});const f=wC(e,m=>{m.type==="notify"?a(m):m.type==="ask"&&m.ask&&m.ask.id?r(_=>_.some(S=>S.id===m.ask.id)?_:[..._,m.ask]):m.type==="ask-answered"&&m.id&&r(_=>_.filter(S=>S.id!==m.id))});return()=>{u=!0,f()}},[e,a]);const d=u=>r(f=>f.filter(m=>m.id!==u));return h.jsxs(h.Fragment,{children:[t.length>0&&h.jsx("div",{className:"nc-ntf-toasts",children:t.map(u=>h.jsx(bC,{n:u,onClose:()=>c(u.key)},u.key))}),s.length>0&&!n&&h.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>o(!0),title:y("asks-title"),children:["? ",h.jsx("span",{className:"nc-ask-count",children:s.length})]}),s.length>0&&n&&h.jsxs("div",{className:"nc-ask-panel",children:[h.jsxs("div",{className:"nc-ask-panel-head",children:[h.jsx("b",{children:y("asks-title")}),h.jsx("span",{className:"nc-ask-count",children:s.length}),h.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>o(!1),title:y("close"),children:h.jsx(fe,{name:"x",size:16})})]}),h.jsx("div",{className:"nc-ask-panel-body",children:s.map(u=>h.jsx(kC,{ask:u,token:e,onAnswered:d},u.id))})]})]})}const Yl=e=>ui(Gi(e)).length===0;function NC(e,t,i,s){const[r,n]=E.useState([]),[o,l]=E.useState(!1),[c,a]=E.useState("idle"),[d,u]=E.useState(""),f=E.useRef([]),m=E.useRef(i),_=E.useRef(!1),S=E.useRef(!0);m.current=i,f.current=r;const k=E.useCallback((x,C=!0)=>{f.current=x,n(x);const D=x.find(L=>L.name===t);C&&D&&(S.current=!0,s(Gi(D.layout)),U1(t,D.layout)),W1(x.map(L=>L.name))},[t,s]),v=E.useCallback(async()=>{let x=await Bl(e);const C=x.decks.find(D=>D.name==="main");if(x.decks.length===1&&C&&C.revision===0&&Yl(C.layout)){const D=H1(),L=Gi(Lc("main")||Bo());if(!Yl(L)){const A=await En(e,"main",L,0);x.decks[0]=A}for(const A of D.filter(T=>T!=="main"))try{let T=await td(e,A);const P=Gi(Lc(A)||Bo());Yl(P)||(T=await En(e,A,P,T.revision)),x.decks.push(T)}catch{}x=await Bl(e)}k(x.decks,!0),l(!0),u("")},[e,k]);E.useEffect(()=>{e&&v().catch(x=>u(String(x.message||x)))},[v,e]);const p=E.useCallback(async()=>{if(!o)return;const x=f.current.find(C=>C.name===t);if(!x)return u(`deck inesistente: ${t}`);a("saving");try{const C=await En(e,t,Gi(m.current),x.revision);k(f.current.map(D=>D.name===t?C:D),!1),_.current=!1,a("saved"),u(""),setTimeout(()=>a("idle"),1500)}catch(C){a("error"),u(String(C.message||C)),C.status===409&&C.data&&C.data.current&&k(f.current.map(D=>D.name===t?C.data.current:D),!1)}},[o,t,e,k]);E.useEffect(()=>{if(!o)return;if(S.current){S.current=!1;return}_.current=!0,a("saving");const x=setTimeout(p,650);return()=>clearTimeout(x)},[i,o,p]),E.useEffect(()=>{if(!o)return;const x=setInterval(async()=>{try{const C=await Bl(e),D=f.current.find(T=>T.name===t),L=C.decks.find(T=>T.name===t),A=L&&(!D||L.revision>D.revision);k(C.decks,A&&!_.current)}catch{}},5e3);return()=>clearInterval(x)},[o,e,t,k]);const g=async x=>{const C=await td(e,x);return k([...f.current,C],!1),C},w=async(x,C)=>{const D=f.current.find(A=>A.name===x);if(!D)throw new Error("deck inesistente");const L=await YS(e,x,C,D.revision);return k(f.current.map(A=>A.name===x?L:A),!1),L},M=async x=>{const C=f.current.find(D=>D.name===x);if(!C)throw new Error("deck inesistente");await XS(e,x,C.revision),k(f.current.filter(D=>D.name!==x),!1)},N=async(x,C)=>{const D=f.current.find(A=>A.name===x);if(!D)throw new Error("deck inesistente");const L=await En(e,x,Im(Gi(D.layout),C),D.revision);return k(f.current.map(A=>A.name===x?L:A),!1),L};return{decks:r.map(x=>x.name),records:r,ready:o,saveState:c,error:d,setError:u,saveNow:p,add:g,rename:w,remove:M,addTileTo:N}}const RC="/sw.js",Pc="nc-sw-update";let Tc=null,Bc=!1,jc=null,Ym=Object.freeze({needed:!1,kind:null,version:""}),Xm=!1;function Gm(){typeof window<"u"&&window.dispatchEvent(new Event(Pc))}function Qm(){const e=jc||(Bc?{kind:"reload",version:""}:null);Ym=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function nf(){return Ym}function DC(e){return typeof window>"u"?()=>{}:(window.addEventListener(Pc,e),()=>window.removeEventListener(Pc,e))}function Uh(e){Bc!==e&&(Bc=e,Qm(),Gm())}function MC(e,t,i){let s=null;e&&t&&e!==t?s={kind:"install",version:e}:t&&i&&t!==i&&(s={kind:"reload",version:t});const r=JSON.stringify(s)===JSON.stringify(jc);jc=s,Qm(),r||Gm()}function LC(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&Uh(!0)})}function PC(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{Xm&&location.reload()}),navigator.serviceWorker.register(RC).then(e=>{Tc=e,e.waiting&&Uh(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&LC(t)}),setInterval(()=>{e.update().catch(()=>{})},60*60*1e3)}).catch(()=>{}))}function TC(){Xm=!0,Uh(!1);const e=Tc&&Tc.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}const Jm=9,Zm=24,ev="nc_side_w",of="nc_side_min",BC=240,lf="(min-width:1024px) and (pointer:fine)";function jC(){const e=Number(localStorage.getItem(ev));return e>=180&&e<=480?e:BC}function zC(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=Jm&&e<=Zm?e:13}function OC(){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 AC(e){try{return Gi(Lc(e))}catch{return Bo()}}function af(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 IC(){const[e,t]=E.useState(()=>window.matchMedia(lf).matches);return E.useEffect(()=>{const i=window.matchMedia(lf),s=r=>t(r.matches);return i.addEventListener("change",s),()=>i.removeEventListener("change",s)},[]),e}function cf({session:e,node:t,token:i,readonly:s=!1,onBack:r}){vt();const[n,o]=E.useState(!1),[l,c]=E.useState(()=>window.matchMedia("(pointer: coarse)").matches),[a,d]=E.useState(null),[u,f]=E.useState(zC),[m,_]=E.useState(""),S=C=>f(D=>{const L=Math.max(Jm,Math.min(Zm,D+C));return localStorage.setItem("nc_fontsize",String(L)),L}),k=E.useRef(()=>{}),v=E.useRef(()=>{}),p=E.useRef(!1),[g,w]=E.useState(!1),[M,N]=E.useState(!1),x=()=>{p.current=!p.current,w(p.current)};return E.useEffect(()=>{let C=!0;const D=t?`/node/${encodeURIComponent(t)}`:"";async function L(){let T=null,P=null;try{const $=await(await Ue(`${D}/api/sessions`,i)).json();Array.isArray($.sessions)&&(T=$.sessions.find(R=>R.name===e))}catch{}if(!t)try{const F=await el(i);F.available&&Array.isArray(F.cells)&&(P=F.cells.find($=>$.tmuxSession===e))}catch{}if(!C)return;let j="";P?j=`${P.engine}${P.key?`·${P.key}`:""}`:T&&(j=T.attached?`attached · ${af(T.activity)}`:T.activity?af(T.activity):""),_(j)}L();const A=setInterval(L,4e3);return()=>{C=!1,clearInterval(A)}},[e,t,i]),h.jsxs("div",{className:"nc-app",children:[h.jsxs("header",{className:"nc-bar nc-bar-single",children:[h.jsxs("button",{onClick:r,title:y("sessions"),children:[h.jsx(fe,{name:"chevronLeft",size:18}),h.jsx("span",{className:"nc-bar-label",children:y("sessions")})]}),h.jsxs("span",{className:"nc-bar-center",children:[h.jsx("b",{children:t?`${t}:${e}`:e}),m&&h.jsx("small",{className:"nc-bar-sub",children:m})]}),h.jsxs("span",{className:"nc-bar-right",children:[h.jsx("button",{onClick:()=>S(-1),title:y("zoom-out"),children:h.jsx(fe,{name:"zoomOut",size:18})}),h.jsx("button",{onClick:()=>S(1),title:y("zoom-in"),children:h.jsx(fe,{name:"zoomIn",size:18})}),h.jsx("button",{onClick:()=>c(C=>!C),title:y("composer"),children:h.jsx(fe,{name:"keyboard",size:20})}),h.jsx("button",{onClick:()=>o(C=>!C),title:y("files"),children:h.jsx(fe,{name:"folder",size:20})})]})]}),h.jsx("div",{className:"nc-termwrap",children:h.jsx(Bm,{session:e,node:t,token:i,readonly:s,takeSize:!0,sendRef:k,actionRef:v,ctrlRef:p,setCtrlArmed:w,onFiles:d,fontSize:u,selectionMode:M,onSelectionModeChange:N})}),h.jsx(C1,{onKeyboard:()=>c(C=>!C),send:C=>k.current(C),action:C=>v.current(C),ctrlArmed:g,onCtrl:x,selectionMode:M,onSelectionMode:N}),l&&h.jsx(zm,{send:C=>k.current(C),token:i,session:e,node:t}),n&&h.jsx(jm,{session:e,node:t,token:i,filesEvent:a,onClose:()=>o(!1)})]})}function $C(){vt();const[e,t]=E.useState(OC()),[i,s]=E.useState(!1),r=IC(),[n]=E.useState(()=>F1(typeof location<"u"?location.pathname:"/")),o=n===xt,[l,c]=E.useState(null),a=Y=>c(To(Y)),[d,u]=E.useState([]),[f,m]=E.useState([]),[_,S]=E.useState([]),[k,v]=E.useState(()=>AC(n)),p=NC(e,n,k,v),g=p.decks.length?p.decks:[xt],[w,M]=E.useState(null),[N,x]=E.useState(null),C=Y=>x(To(Y)),D=W_(e,r),[L,A]=E.useState(null),[T,P]=E.useState(!1),[j,F]=E.useState(["shell","claude","codex-vl","pi"]),[$,R]=E.useState(jC),[b,I]=E.useState(!o),[B,U]=E.useState(()=>o?localStorage.getItem(of)==="1":!0),[X,J]=E.useState(!1),[ee,oe]=E.useState(!1),[ne,pe]=E.useState(!1);E.useEffect(()=>{try{localStorage.setItem(ev,String($))}catch{}},[$]),E.useEffect(()=>{try{localStorage.setItem(of,B?"1":"")}catch{}},[B]),E.useEffect(()=>{if(!e)return;let Y=!1;return Promise.all([L_(e),Ue("/api/config",e).then(re=>re.json())]).then(([re,an])=>{Y||(pe(!!an.readonlyDefault),re.firstRun===!0&&!an.readonlyDefault&&oe(!0))}).catch(()=>{}),()=>{Y=!0}},[e]);const z=E.useCallback(async()=>{try{const re=await(await Ue("/api/sessions",e)).json();re.error||u(re.sessions||[])}catch{}try{const Y=await el(e);m(Y.available?Y.cells||[]:[]),S(Y.available?Y.engines||[]:[])}catch{m([]),S([])}},[e]);E.useEffect(()=>{if(!r)return;z();const Y=setInterval(z,4e3);return()=>clearInterval(Y)},[r,z]),E.useEffect(()=>{let Y=!1;return Ue("/api/config",e).then(re=>re.json()).then(re=>{!Y&&Array.isArray(re.presets)&&re.presets.length&&F(re.presets),Y||MC(re.version,re.uiVersion,"0.8.0")}).catch(()=>{}),()=>{Y=!0}},[e]);const V=new Set([...d.map(Y=>Y.name),...D.flatMap(Y=>Y.sessions.map(re=>re.key))]),ue=ui(k),G=Y=>v(re=>Im(re,Y)),ce=async Y=>{try{await D_(e,Y)}catch{return}v(re=>zo(re,Y)),z()},Z=async Y=>{if(!L)return;const{cell:re}=L;Y.action==="up"?await E_(e,{cell:re,engine:Y.engine,model:Y.model||"",boot:!!Y.boot}):await N_(e,{cell:re,boot:!!Y.boot}),z()},Kt=async Y=>{await R_(e,Y),z()},ps=Y=>{try{const re=window.open(Bn(Y,e),"_blank");return re&&(re.opener=null),!!re}catch{return!1}},Gs=Y=>location.assign(Bn(Y,e)),tv=async Y=>{await p.add(Y),Gs(Y)},iv=async(Y,re)=>{await p.rename(Y,re),Y===n&&location.assign(Bn(re,e))},sv=async Y=>{await p.remove(Y),Y===n&&location.assign(Bn(xt,e))},rv=async(Y,re)=>{!re||re===n||(await p.addTileTo(re,Y),v(an=>zo(an,Y)))};if(!e)return h.jsxs("div",{className:"nc-auth",children:[h.jsx("p",{children:y("auth-prompt")}),h.jsx("input",{onChange:Y=>t(Y.target.value.trim()),placeholder:"token"}),h.jsxs("label",{children:[h.jsx("input",{type:"checkbox",checked:i,onChange:Y=>s(Y.target.checked)})," ",y("remember-device")]}),h.jsx("button",{onClick:()=>{(i?localStorage:sessionStorage).setItem("nc_token",e)},children:"ok"})]});const ll=h.jsxs(h.Fragment,{children:[X&&h.jsx(SC,{token:e,onClose:()=>J(!1)}),ee&&h.jsx(yC,{token:e,onDone:()=>oe(!1)}),h.jsx(EC,{token:e})]});if(!r)return l?h.jsxs(h.Fragment,{children:[h.jsx(cf,{session:l.session,node:l.node,token:e,readonly:ne,onBack:()=>c(null)}),ll]}):h.jsxs(h.Fragment,{children:[h.jsx(oy,{onPick:a,token:e,onSettings:()=>J(!0)}),ll]});const nv=o||!b;return h.jsxs("div",{className:"nc-workspace",children:[!o&&h.jsx("button",{className:"nc-side-show",title:y("toggle-sidebar"),onClick:()=>I(Y=>!Y),children:"☰"}),nv&&h.jsx(R1,{sessions:d,cells:f,activeSessions:ue,nodeGroups:D,onPick:C,onAddTile:G,onPower:A,onKill:ce,onNew:()=>P(!0),onSettings:()=>J(!0),width:$,collapsed:B,onResize:R,onToggleCollapse:()=>U(Y=>!Y)}),h.jsxs("div",{className:"nc-workspace-main",children:[h.jsx(K1,{decks:g,currentDeck:n,onCreate:tv,onRename:iv,onDelete:sv,onOpenWindow:ps,onNavigate:Gs,saveState:p.saveState,error:p.error}),h.jsx(O1,{layout:k,onLayoutChange:v,token:e,readonly:ne,sessionsAlive:V,focusSession:w,onFocus:M,onOpenSingle:C,decks:g,currentDeck:n,onSendToDeck:rv})]}),N&&h.jsx("div",{className:"nc-single-overlay",children:h.jsx(cf,{session:N.session,node:N.node,token:e,readonly:ne,onBack:()=>x(null)})}),L&&h.jsx(F_,{cell:L,engines:_,onConfirm:Z,onClose:()=>A(null)}),T&&h.jsx(H_,{presets:j,token:e,onCreate:Kt,onClose:()=>P(!1)}),ll]})}function FC(){vt();const e=E.useSyncExternalStore(DC,nf,nf);if(!e.needed)return null;const t=e.kind==="install"?y("install-version-mismatch").replace("{v}",e.version):y("update-available").replace("{v}",e.version).replace(" "," ").trim();return h.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[h.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&h.jsx("button",{className:"nc-update-btn",onClick:TC,children:y("reload")})]})}PC();Xl.createRoot(document.getElementById("root")).render(h.jsxs(Cv.StrictMode,{children:[h.jsx($C,{}),h.jsx(FC,{})]}));
|