@mmmbuto/nexuscrew 0.8.2 → 0.8.4
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 +37 -16
- package/frontend/dist/assets/index-C1AFIaRR.js +90 -0
- package/frontend/dist/index.html +1 -1
- package/frontend/dist/version.json +1 -1
- package/lib/cli/commands.js +157 -28
- package/lib/cli/doctor.js +1 -1
- package/lib/cli/init.js +8 -3
- package/lib/cli/pidfile.js +2 -2
- package/lib/fleet/managed.js +3 -2
- package/lib/nodes/health.js +89 -0
- package/lib/nodes/store.js +78 -1
- package/lib/nodes/topology-cache.js +75 -0
- package/lib/proxy/federation.js +117 -6
- package/lib/pty/provider.js +7 -7
- package/lib/server.js +28 -10
- package/lib/settings/routes.js +65 -6
- package/package.json +4 -8
- package/frontend/dist/assets/index-Dey9rdY-.js +0 -90
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const h of l.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&n(h)}).observe(document,{childList:!0,subtree:!0});function r(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(a){if(a.ep)return;a.ep=!0;const l=r(a);fetch(a.href,l)}})();function su(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yc={exports:{}},mn={},Sc={exports:{}},Te={};/**
|
|
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 dp;function Oy(){if(dp)return Te;dp=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),h=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),g=Symbol.iterator;function C(R){return R===null||typeof R!="object"?null:(R=g&&R[g]||R["@@iterator"],typeof R=="function"?R:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,x={};function E(R,T,ne){this.props=R,this.context=T,this.refs=x,this.updater=ne||v}E.prototype.isReactComponent={},E.prototype.setState=function(R,T){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,T,"setState")},E.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function F(){}F.prototype=E.prototype;function U(R,T,ne){this.props=R,this.context=T,this.refs=x,this.updater=ne||v}var M=U.prototype=new F;M.constructor=U,y(M,E.prototype),M.isPureReactComponent=!0;var L=Array.isArray,G=Object.prototype.hasOwnProperty,$={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function K(R,T,ne){var ce,ue={},ge=null,Ce=null;if(T!=null)for(ce in T.ref!==void 0&&(Ce=T.ref),T.key!==void 0&&(ge=""+T.key),T)G.call(T,ce)&&!A.hasOwnProperty(ce)&&(ue[ce]=T[ce]);var be=arguments.length-2;if(be===1)ue.children=ne;else if(1<be){for(var xe=Array(be),Oe=0;Oe<be;Oe++)xe[Oe]=arguments[Oe+2];ue.children=xe}if(R&&R.defaultProps)for(ce in be=R.defaultProps,be)ue[ce]===void 0&&(ue[ce]=be[ce]);return{$$typeof:e,type:R,key:ge,ref:Ce,props:ue,_owner:$.current}}function P(R,T){return{$$typeof:e,type:R.type,key:T,ref:R.ref,props:R.props,_owner:R._owner}}function N(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function W(R){var T={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ne){return T[ne]})}var O=/\/+/g;function j(R,T){return typeof R=="object"&&R!==null&&R.key!=null?W(""+R.key):T.toString(36)}function B(R,T,ne,ce,ue){var ge=typeof R;(ge==="undefined"||ge==="boolean")&&(R=null);var Ce=!1;if(R===null)Ce=!0;else switch(ge){case"string":case"number":Ce=!0;break;case"object":switch(R.$$typeof){case e:case t:Ce=!0}}if(Ce)return Ce=R,ue=ue(Ce),R=ce===""?"."+j(Ce,0):ce,L(ue)?(ne="",R!=null&&(ne=R.replace(O,"$&/")+"/"),B(ue,T,ne,"",function(Oe){return Oe})):ue!=null&&(N(ue)&&(ue=P(ue,ne+(!ue.key||Ce&&Ce.key===ue.key?"":(""+ue.key).replace(O,"$&/")+"/")+R)),T.push(ue)),1;if(Ce=0,ce=ce===""?".":ce+":",L(R))for(var be=0;be<R.length;be++){ge=R[be];var xe=ce+j(ge,be);Ce+=B(ge,T,ne,xe,ue)}else if(xe=C(R),typeof xe=="function")for(R=xe.call(R),be=0;!(ge=R.next()).done;)ge=ge.value,xe=ce+j(ge,be++),Ce+=B(ge,T,ne,xe,ue);else if(ge==="object")throw T=String(R),Error("Objects are not valid as a React child (found: "+(T==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":T)+"). If you meant to render a collection of children, use an array instead.");return Ce}function V(R,T,ne){if(R==null)return R;var ce=[],ue=0;return B(R,ce,"","",function(ge){return T.call(ne,ge,ue++)}),ce}function Q(R){if(R._status===-1){var T=R._result;T=T(),T.then(function(ne){(R._status===0||R._status===-1)&&(R._status=1,R._result=ne)},function(ne){(R._status===0||R._status===-1)&&(R._status=2,R._result=ne)}),R._status===-1&&(R._status=0,R._result=T)}if(R._status===1)return R._result.default;throw R._result}var ee={current:null},b={transition:null},Z={ReactCurrentDispatcher:ee,ReactCurrentBatchConfig:b,ReactCurrentOwner:$};function te(){throw Error("act(...) is not supported in production builds of React.")}return Te.Children={map:V,forEach:function(R,T,ne){V(R,function(){T.apply(this,arguments)},ne)},count:function(R){var T=0;return V(R,function(){T++}),T},toArray:function(R){return V(R,function(T){return T})||[]},only:function(R){if(!N(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},Te.Component=E,Te.Fragment=r,Te.Profiler=a,Te.PureComponent=U,Te.StrictMode=n,Te.Suspense=m,Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Z,Te.act=te,Te.cloneElement=function(R,T,ne){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var ce=y({},R.props),ue=R.key,ge=R.ref,Ce=R._owner;if(T!=null){if(T.ref!==void 0&&(ge=T.ref,Ce=$.current),T.key!==void 0&&(ue=""+T.key),R.type&&R.type.defaultProps)var be=R.type.defaultProps;for(xe in T)G.call(T,xe)&&!A.hasOwnProperty(xe)&&(ce[xe]=T[xe]===void 0&&be!==void 0?be[xe]:T[xe])}var xe=arguments.length-2;if(xe===1)ce.children=ne;else if(1<xe){be=Array(xe);for(var Oe=0;Oe<xe;Oe++)be[Oe]=arguments[Oe+2];ce.children=be}return{$$typeof:e,type:R.type,key:ue,ref:ge,props:ce,_owner:Ce}},Te.createContext=function(R){return R={$$typeof:h,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},R.Provider={$$typeof:l,_context:R},R.Consumer=R},Te.createElement=K,Te.createFactory=function(R){var T=K.bind(null,R);return T.type=R,T},Te.createRef=function(){return{current:null}},Te.forwardRef=function(R){return{$$typeof:f,render:R}},Te.isValidElement=N,Te.lazy=function(R){return{$$typeof:S,_payload:{_status:-1,_result:R},_init:Q}},Te.memo=function(R,T){return{$$typeof:p,type:R,compare:T===void 0?null:T}},Te.startTransition=function(R){var T=b.transition;b.transition={};try{R()}finally{b.transition=T}},Te.unstable_act=te,Te.useCallback=function(R,T){return ee.current.useCallback(R,T)},Te.useContext=function(R){return ee.current.useContext(R)},Te.useDebugValue=function(){},Te.useDeferredValue=function(R){return ee.current.useDeferredValue(R)},Te.useEffect=function(R,T){return ee.current.useEffect(R,T)},Te.useId=function(){return ee.current.useId()},Te.useImperativeHandle=function(R,T,ne){return ee.current.useImperativeHandle(R,T,ne)},Te.useInsertionEffect=function(R,T){return ee.current.useInsertionEffect(R,T)},Te.useLayoutEffect=function(R,T){return ee.current.useLayoutEffect(R,T)},Te.useMemo=function(R,T){return ee.current.useMemo(R,T)},Te.useReducer=function(R,T,ne){return ee.current.useReducer(R,T,ne)},Te.useRef=function(R){return ee.current.useRef(R)},Te.useState=function(R){return ee.current.useState(R)},Te.useSyncExternalStore=function(R,T,ne){return ee.current.useSyncExternalStore(R,T,ne)},Te.useTransition=function(){return ee.current.useTransition()},Te.version="18.3.1",Te}var fp;function nu(){return fp||(fp=1,Sc.exports=Oy()),Sc.exports}/**
|
|
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 pp;function zy(){if(pp)return mn;pp=1;var e=nu(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function h(f,m,p){var S,g={},C=null,v=null;p!==void 0&&(C=""+p),m.key!==void 0&&(C=""+m.key),m.ref!==void 0&&(v=m.ref);for(S in m)n.call(m,S)&&!l.hasOwnProperty(S)&&(g[S]=m[S]);if(f&&f.defaultProps)for(S in m=f.defaultProps,m)g[S]===void 0&&(g[S]=m[S]);return{$$typeof:t,type:f,key:C,ref:v,props:g,_owner:a.current}}return mn.Fragment=r,mn.jsx=h,mn.jsxs=h,mn}var mp;function Fy(){return mp||(mp=1,yc.exports=zy()),yc.exports}var u=Fy(),I=nu();const Hy=su(I);var Xo={},wc={exports:{}},Kt={},Cc={exports:{}},bc={};/**
|
|
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
|
+
*/var _p;function Wy(){return _p||(_p=1,(function(e){function t(b,Z){var te=b.length;b.push(Z);e:for(;0<te;){var R=te-1>>>1,T=b[R];if(0<a(T,Z))b[R]=Z,b[te]=T,te=R;else break e}}function r(b){return b.length===0?null:b[0]}function n(b){if(b.length===0)return null;var Z=b[0],te=b.pop();if(te!==Z){b[0]=te;e:for(var R=0,T=b.length,ne=T>>>1;R<ne;){var ce=2*(R+1)-1,ue=b[ce],ge=ce+1,Ce=b[ge];if(0>a(ue,te))ge<T&&0>a(Ce,ue)?(b[R]=Ce,b[ge]=te,R=ge):(b[R]=ue,b[ce]=te,R=ce);else if(ge<T&&0>a(Ce,te))b[R]=Ce,b[ge]=te,R=ge;else break e}}return Z}function a(b,Z){var te=b.sortIndex-Z.sortIndex;return te!==0?te:b.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var h=Date,f=h.now();e.unstable_now=function(){return h.now()-f}}var m=[],p=[],S=1,g=null,C=3,v=!1,y=!1,x=!1,E=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(b){for(var Z=r(p);Z!==null;){if(Z.callback===null)n(p);else if(Z.startTime<=b)n(p),Z.sortIndex=Z.expirationTime,t(m,Z);else break;Z=r(p)}}function L(b){if(x=!1,M(b),!y)if(r(m)!==null)y=!0,Q(G);else{var Z=r(p);Z!==null&&ee(L,Z.startTime-b)}}function G(b,Z){y=!1,x&&(x=!1,F(K),K=-1),v=!0;var te=C;try{for(M(Z),g=r(m);g!==null&&(!(g.expirationTime>Z)||b&&!W());){var R=g.callback;if(typeof R=="function"){g.callback=null,C=g.priorityLevel;var T=R(g.expirationTime<=Z);Z=e.unstable_now(),typeof T=="function"?g.callback=T:g===r(m)&&n(m),M(Z)}else n(m);g=r(m)}if(g!==null)var ne=!0;else{var ce=r(p);ce!==null&&ee(L,ce.startTime-Z),ne=!1}return ne}finally{g=null,C=te,v=!1}}var $=!1,A=null,K=-1,P=5,N=-1;function W(){return!(e.unstable_now()-N<P)}function O(){if(A!==null){var b=e.unstable_now();N=b;var Z=!0;try{Z=A(!0,b)}finally{Z?j():($=!1,A=null)}}else $=!1}var j;if(typeof U=="function")j=function(){U(O)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,V=B.port2;B.port1.onmessage=O,j=function(){V.postMessage(null)}}else j=function(){E(O,0)};function Q(b){A=b,$||($=!0,j())}function ee(b,Z){K=E(function(){b(e.unstable_now())},Z)}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(){y||v||(y=!0,Q(G))},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"):P=0<b?Math.floor(1e3/b):5},e.unstable_getCurrentPriorityLevel=function(){return C},e.unstable_getFirstCallbackNode=function(){return r(m)},e.unstable_next=function(b){switch(C){case 1:case 2:case 3:var Z=3;break;default:Z=C}var te=C;C=Z;try{return b()}finally{C=te}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(b,Z){switch(b){case 1:case 2:case 3:case 4:case 5:break;default:b=3}var te=C;C=b;try{return Z()}finally{C=te}},e.unstable_scheduleCallback=function(b,Z,te){var R=e.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?R+te:R):te=R,b){case 1:var T=-1;break;case 2:T=250;break;case 5:T=1073741823;break;case 4:T=1e4;break;default:T=5e3}return T=te+T,b={id:S++,callback:Z,priorityLevel:b,startTime:te,expirationTime:T,sortIndex:-1},te>R?(b.sortIndex=te,t(p,b),r(m)===null&&b===r(p)&&(x?(F(K),K=-1):x=!0,ee(L,te-R))):(b.sortIndex=T,t(m,b),y||v||(y=!0,Q(G))),b},e.unstable_shouldYield=W,e.unstable_wrapCallback=function(b){var Z=C;return function(){var te=C;C=Z;try{return b.apply(this,arguments)}finally{C=te}}}})(bc)),bc}var gp;function $y(){return gp||(gp=1,Cc.exports=Wy()),Cc.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 vp;function Uy(){if(vp)return Kt;vp=1;var e=nu(),t=$y();function r(i){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+i,o=1;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,a={};function l(i,s){h(i,s),h(i+"Capture",s)}function h(i,s){for(a[i]=s,i=0;i<s.length;i++)n.add(s[i])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m=Object.prototype.hasOwnProperty,p=/^[: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]*$/,S={},g={};function C(i){return m.call(g,i)?!0:m.call(S,i)?!1:p.test(i)?g[i]=!0:(S[i]=!0,!1)}function v(i,s,o,c){if(o!==null&&o.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return c?!1:o!==null?!o.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function y(i,s,o,c){if(s===null||typeof s>"u"||v(i,s,o,c))return!0;if(c)return!1;if(o!==null)switch(o.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function x(i,s,o,c,d,_,w){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=c,this.attributeNamespace=d,this.mustUseProperty=o,this.propertyName=i,this.type=s,this.sanitizeURL=_,this.removeEmptyString=w}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){E[i]=new x(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var s=i[0];E[s]=new x(s,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){E[i]=new x(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){E[i]=new x(i,2,!1,i,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(i){E[i]=new x(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){E[i]=new x(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){E[i]=new x(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){E[i]=new x(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){E[i]=new x(i,5,!1,i.toLowerCase(),null,!1,!1)});var F=/[\-:]([a-z])/g;function U(i){return i[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(i){var s=i.replace(F,U);E[s]=new x(s,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var s=i.replace(F,U);E[s]=new x(s,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var s=i.replace(F,U);E[s]=new x(s,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){E[i]=new x(i,1,!1,i.toLowerCase(),null,!1,!1)}),E.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){E[i]=new x(i,1,!1,i.toLowerCase(),null,!0,!0)});function M(i,s,o,c){var d=E.hasOwnProperty(s)?E[s]:null;(d!==null?d.type!==0:c||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(y(s,o,d,c)&&(o=null),c||d===null?C(s)&&(o===null?i.removeAttribute(s):i.setAttribute(s,""+o)):d.mustUseProperty?i[d.propertyName]=o===null?d.type===3?!1:"":o:(s=d.attributeName,c=d.attributeNamespace,o===null?i.removeAttribute(s):(d=d.type,o=d===3||d===4&&o===!0?"":""+o,c?i.setAttributeNS(c,s,o):i.setAttribute(s,o))))}var L=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,G=Symbol.for("react.element"),$=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),N=Symbol.for("react.provider"),W=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),ee=Symbol.for("react.offscreen"),b=Symbol.iterator;function Z(i){return i===null||typeof i!="object"?null:(i=b&&i[b]||i["@@iterator"],typeof i=="function"?i:null)}var te=Object.assign,R;function T(i){if(R===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);R=s&&s[1]||""}return`
|
|
34
|
+
`+R+i}var ne=!1;function ce(i,s){if(!i||ne)return"";ne=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(J){var c=J}Reflect.construct(i,[],s)}else{try{s.call()}catch(J){c=J}i.call(s.prototype)}else{try{throw Error()}catch(J){c=J}i()}}catch(J){if(J&&c&&typeof J.stack=="string"){for(var d=J.stack.split(`
|
|
35
|
+
`),_=c.stack.split(`
|
|
36
|
+
`),w=d.length-1,D=_.length-1;1<=w&&0<=D&&d[w]!==_[D];)D--;for(;1<=w&&0<=D;w--,D--)if(d[w]!==_[D]){if(w!==1||D!==1)do if(w--,D--,0>D||d[w]!==_[D]){var z=`
|
|
37
|
+
`+d[w].replace(" at new "," at ");return i.displayName&&z.includes("<anonymous>")&&(z=z.replace("<anonymous>",i.displayName)),z}while(1<=w&&0<=D);break}}}finally{ne=!1,Error.prepareStackTrace=o}return(i=i?i.displayName||i.name:"")?T(i):""}function ue(i){switch(i.tag){case 5:return T(i.type);case 16:return T("Lazy");case 13:return T("Suspense");case 19:return T("SuspenseList");case 0:case 2:case 15:return i=ce(i.type,!1),i;case 11:return i=ce(i.type.render,!1),i;case 1:return i=ce(i.type,!0),i;default:return""}}function ge(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case A:return"Fragment";case $:return"Portal";case P:return"Profiler";case K:return"StrictMode";case j:return"Suspense";case B:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case W:return(i.displayName||"Context")+".Consumer";case N:return(i._context.displayName||"Context")+".Provider";case O:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case V:return s=i.displayName||null,s!==null?s:ge(i.type)||"Memo";case Q:s=i._payload,i=i._init;try{return ge(i(s))}catch{}}return null}function Ce(i){var s=i.type;switch(i.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=s.render,i=i.displayName||i.name||"",s.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(s);case 8:return s===K?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function be(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function xe(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Oe(i){var s=xe(i)?"checked":"value",o=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),c=""+i[s];if(!i.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var d=o.get,_=o.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return d.call(this)},set:function(w){c=""+w,_.call(this,w)}}),Object.defineProperty(i,s,{enumerable:o.enumerable}),{getValue:function(){return c},setValue:function(w){c=""+w},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Y(i){i._valueTracker||(i._valueTracker=Oe(i))}function ye(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var o=s.getValue(),c="";return i&&(c=xe(i)?i.checked?"true":"false":i.value),i=c,i!==o?(s.setValue(i),!0):!1}function me(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function He(i,s){var o=s.checked;return te({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??i._wrapperState.initialChecked})}function Me(i,s){var o=s.defaultValue==null?"":s.defaultValue,c=s.checked!=null?s.checked:s.defaultChecked;o=be(s.value!=null?s.value:o),i._wrapperState={initialChecked:c,initialValue:o,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Nr(i,s){s=s.checked,s!=null&&M(i,"checked",s,!1)}function Zi(i,s){Nr(i,s);var o=be(s.value),c=s.type;if(o!=null)c==="number"?(o===0&&i.value===""||i.value!=o)&&(i.value=""+o):i.value!==""+o&&(i.value=""+o);else if(c==="submit"||c==="reset"){i.removeAttribute("value");return}s.hasOwnProperty("value")?ri(i,s.type,o):s.hasOwnProperty("defaultValue")&&ri(i,s.type,be(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(i.defaultChecked=!!s.defaultChecked)}function ii(i,s,o){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var c=s.type;if(!(c!=="submit"&&c!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+i._wrapperState.initialValue,o||s===i.value||(i.value=s),i.defaultValue=s}o=i.name,o!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,o!==""&&(i.name=o)}function ri(i,s,o){(s!=="number"||me(i.ownerDocument)!==i)&&(o==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+o&&(i.defaultValue=""+o))}var si=Array.isArray;function zt(i,s,o,c){if(i=i.options,s){s={};for(var d=0;d<o.length;d++)s["$"+o[d]]=!0;for(o=0;o<i.length;o++)d=s.hasOwnProperty("$"+i[o].value),i[o].selected!==d&&(i[o].selected=d),d&&c&&(i[o].defaultSelected=!0)}else{for(o=""+be(o),s=null,d=0;d<i.length;d++){if(i[d].value===o){i[d].selected=!0,c&&(i[d].defaultSelected=!0);return}s!==null||i[d].disabled||(s=i[d])}s!==null&&(s.selected=!0)}}function pe(i,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return te({},s,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function Ae(i,s){var o=s.value;if(o==null){if(o=s.children,s=s.defaultValue,o!=null){if(s!=null)throw Error(r(92));if(si(o)){if(1<o.length)throw Error(r(93));o=o[0]}s=o}s==null&&(s=""),o=s}i._wrapperState={initialValue:be(o)}}function bt(i,s){var o=be(s.value),c=be(s.defaultValue);o!=null&&(o=""+o,o!==i.value&&(i.value=o),s.defaultValue==null&&i.defaultValue!==o&&(i.defaultValue=o)),c!=null&&(i.defaultValue=""+c)}function Tt(i){var s=i.textContent;s===i._wrapperState.initialValue&&s!==""&&s!==null&&(i.value=s)}function ni(i){switch(i){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 Ei(i,s){return i==null||i==="http://www.w3.org/1999/xhtml"?ni(s):i==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var er,Fn=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,o,c,d){MSApp.execUnsafeLocalFunction(function(){return i(s,o,c,d)})}:i})(function(i,s){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=s;else{for(er=er||document.createElement("div"),er.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=er.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;s.firstChild;)i.appendChild(s.firstChild)}});function he(i,s){if(s){var o=i.firstChild;if(o&&o===i.lastChild&&o.nodeType===3){o.nodeValue=s;return}}i.textContent=s}var De={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},_i=["Webkit","ms","Moz","O"];Object.keys(De).forEach(function(i){_i.forEach(function(s){s=s+i.charAt(0).toUpperCase()+i.substring(1),De[s]=De[i]})});function Ls(i,s,o){return s==null||typeof s=="boolean"||s===""?"":o||typeof s!="number"||s===0||De.hasOwnProperty(i)&&De[i]?(""+s).trim():s+"px"}function Nu(i,s){i=i.style;for(var o in s)if(s.hasOwnProperty(o)){var c=o.indexOf("--")===0,d=Ls(o,s[o],c);o==="float"&&(o="cssFloat"),c?i.setProperty(o,d):i[o]=d}}var $g=te({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 La(i,s){if(s){if($g[i]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,i));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function Pa(i,s){if(i.indexOf("-")===-1)return typeof s.is=="string";switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ta=null;function Ba(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ja=null,Jr=null,Zr=null;function Ru(i){if(i=Zs(i)){if(typeof ja!="function")throw Error(r(280));var s=i.stateNode;s&&(s=co(s),ja(i.stateNode,i.type,s))}}function Du(i){Jr?Zr?Zr.push(i):Zr=[i]:Jr=i}function Mu(){if(Jr){var i=Jr,s=Zr;if(Zr=Jr=null,Ru(i),s)for(i=0;i<s.length;i++)Ru(s[i])}}function Lu(i,s){return i(s)}function Pu(){}var Aa=!1;function Tu(i,s,o){if(Aa)return i(s,o);Aa=!0;try{return Lu(i,s,o)}finally{Aa=!1,(Jr!==null||Zr!==null)&&(Pu(),Mu())}}function Ps(i,s){var o=i.stateNode;if(o===null)return null;var c=co(o);if(c===null)return null;o=c[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(i=i.type,c=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!c;break e;default:i=!1}if(i)return null;if(o&&typeof o!="function")throw Error(r(231,s,typeof o));return o}var Ia=!1;if(f)try{var Ts={};Object.defineProperty(Ts,"passive",{get:function(){Ia=!0}}),window.addEventListener("test",Ts,Ts),window.removeEventListener("test",Ts,Ts)}catch{Ia=!1}function Ug(i,s,o,c,d,_,w,D,z){var J=Array.prototype.slice.call(arguments,3);try{s.apply(o,J)}catch(se){this.onError(se)}}var Bs=!1,Hn=null,Wn=!1,Oa=null,Kg={onError:function(i){Bs=!0,Hn=i}};function Vg(i,s,o,c,d,_,w,D,z){Bs=!1,Hn=null,Ug.apply(Kg,arguments)}function qg(i,s,o,c,d,_,w,D,z){if(Vg.apply(this,arguments),Bs){if(Bs){var J=Hn;Bs=!1,Hn=null}else throw Error(r(198));Wn||(Wn=!0,Oa=J)}}function Rr(i){var s=i,o=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(o=s.return),i=s.return;while(i)}return s.tag===3?o:null}function Bu(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function ju(i){if(Rr(i)!==i)throw Error(r(188))}function Yg(i){var s=i.alternate;if(!s){if(s=Rr(i),s===null)throw Error(r(188));return s!==i?null:i}for(var o=i,c=s;;){var d=o.return;if(d===null)break;var _=d.alternate;if(_===null){if(c=d.return,c!==null){o=c;continue}break}if(d.child===_.child){for(_=d.child;_;){if(_===o)return ju(d),i;if(_===c)return ju(d),s;_=_.sibling}throw Error(r(188))}if(o.return!==c.return)o=d,c=_;else{for(var w=!1,D=d.child;D;){if(D===o){w=!0,o=d,c=_;break}if(D===c){w=!0,c=d,o=_;break}D=D.sibling}if(!w){for(D=_.child;D;){if(D===o){w=!0,o=_,c=d;break}if(D===c){w=!0,c=_,o=d;break}D=D.sibling}if(!w)throw Error(r(189))}}if(o.alternate!==c)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?i:s}function Au(i){return i=Yg(i),i!==null?Iu(i):null}function Iu(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var s=Iu(i);if(s!==null)return s;i=i.sibling}return null}var Ou=t.unstable_scheduleCallback,zu=t.unstable_cancelCallback,Xg=t.unstable_shouldYield,Gg=t.unstable_requestPaint,rt=t.unstable_now,Qg=t.unstable_getCurrentPriorityLevel,za=t.unstable_ImmediatePriority,Fu=t.unstable_UserBlockingPriority,$n=t.unstable_NormalPriority,Jg=t.unstable_LowPriority,Hu=t.unstable_IdlePriority,Un=null,Ni=null;function Zg(i){if(Ni&&typeof Ni.onCommitFiberRoot=="function")try{Ni.onCommitFiberRoot(Un,i,void 0,(i.current.flags&128)===128)}catch{}}var gi=Math.clz32?Math.clz32:iv,ev=Math.log,tv=Math.LN2;function iv(i){return i>>>=0,i===0?32:31-(ev(i)/tv|0)|0}var Kn=64,Vn=4194304;function js(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function qn(i,s){var o=i.pendingLanes;if(o===0)return 0;var c=0,d=i.suspendedLanes,_=i.pingedLanes,w=o&268435455;if(w!==0){var D=w&~d;D!==0?c=js(D):(_&=w,_!==0&&(c=js(_)))}else w=o&~d,w!==0?c=js(w):_!==0&&(c=js(_));if(c===0)return 0;if(s!==0&&s!==c&&(s&d)===0&&(d=c&-c,_=s&-s,d>=_||d===16&&(_&4194240)!==0))return s;if((c&4)!==0&&(c|=o&16),s=i.entangledLanes,s!==0)for(i=i.entanglements,s&=c;0<s;)o=31-gi(s),d=1<<o,c|=i[o],s&=~d;return c}function rv(i,s){switch(i){case 1:case 2:case 4:return s+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 s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function sv(i,s){for(var o=i.suspendedLanes,c=i.pingedLanes,d=i.expirationTimes,_=i.pendingLanes;0<_;){var w=31-gi(_),D=1<<w,z=d[w];z===-1?((D&o)===0||(D&c)!==0)&&(d[w]=rv(D,s)):z<=s&&(i.expiredLanes|=D),_&=~D}}function Fa(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function Wu(){var i=Kn;return Kn<<=1,(Kn&4194240)===0&&(Kn=64),i}function Ha(i){for(var s=[],o=0;31>o;o++)s.push(i);return s}function As(i,s,o){i.pendingLanes|=s,s!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,s=31-gi(s),i[s]=o}function nv(i,s){var o=i.pendingLanes&~s;i.pendingLanes=s,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=s,i.mutableReadLanes&=s,i.entangledLanes&=s,s=i.entanglements;var c=i.eventTimes;for(i=i.expirationTimes;0<o;){var d=31-gi(o),_=1<<d;s[d]=0,c[d]=-1,i[d]=-1,o&=~_}}function Wa(i,s){var o=i.entangledLanes|=s;for(i=i.entanglements;o;){var c=31-gi(o),d=1<<c;d&s|i[c]&s&&(i[c]|=s),o&=~d}}var We=0;function $u(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var Uu,$a,Ku,Vu,qu,Ua=!1,Yn=[],tr=null,ir=null,rr=null,Is=new Map,Os=new Map,sr=[],ov="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Yu(i,s){switch(i){case"focusin":case"focusout":tr=null;break;case"dragenter":case"dragleave":ir=null;break;case"mouseover":case"mouseout":rr=null;break;case"pointerover":case"pointerout":Is.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Os.delete(s.pointerId)}}function zs(i,s,o,c,d,_){return i===null||i.nativeEvent!==_?(i={blockedOn:s,domEventName:o,eventSystemFlags:c,nativeEvent:_,targetContainers:[d]},s!==null&&(s=Zs(s),s!==null&&$a(s)),i):(i.eventSystemFlags|=c,s=i.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),i)}function av(i,s,o,c,d){switch(s){case"focusin":return tr=zs(tr,i,s,o,c,d),!0;case"dragenter":return ir=zs(ir,i,s,o,c,d),!0;case"mouseover":return rr=zs(rr,i,s,o,c,d),!0;case"pointerover":var _=d.pointerId;return Is.set(_,zs(Is.get(_)||null,i,s,o,c,d)),!0;case"gotpointercapture":return _=d.pointerId,Os.set(_,zs(Os.get(_)||null,i,s,o,c,d)),!0}return!1}function Xu(i){var s=Dr(i.target);if(s!==null){var o=Rr(s);if(o!==null){if(s=o.tag,s===13){if(s=Bu(o),s!==null){i.blockedOn=s,qu(i.priority,function(){Ku(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){i.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Xn(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var o=Va(i.domEventName,i.eventSystemFlags,s[0],i.nativeEvent);if(o===null){o=i.nativeEvent;var c=new o.constructor(o.type,o);Ta=c,o.target.dispatchEvent(c),Ta=null}else return s=Zs(o),s!==null&&$a(s),i.blockedOn=o,!1;s.shift()}return!0}function Gu(i,s,o){Xn(i)&&o.delete(s)}function lv(){Ua=!1,tr!==null&&Xn(tr)&&(tr=null),ir!==null&&Xn(ir)&&(ir=null),rr!==null&&Xn(rr)&&(rr=null),Is.forEach(Gu),Os.forEach(Gu)}function Fs(i,s){i.blockedOn===s&&(i.blockedOn=null,Ua||(Ua=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,lv)))}function Hs(i){function s(d){return Fs(d,i)}if(0<Yn.length){Fs(Yn[0],i);for(var o=1;o<Yn.length;o++){var c=Yn[o];c.blockedOn===i&&(c.blockedOn=null)}}for(tr!==null&&Fs(tr,i),ir!==null&&Fs(ir,i),rr!==null&&Fs(rr,i),Is.forEach(s),Os.forEach(s),o=0;o<sr.length;o++)c=sr[o],c.blockedOn===i&&(c.blockedOn=null);for(;0<sr.length&&(o=sr[0],o.blockedOn===null);)Xu(o),o.blockedOn===null&&sr.shift()}var es=L.ReactCurrentBatchConfig,Gn=!0;function cv(i,s,o,c){var d=We,_=es.transition;es.transition=null;try{We=1,Ka(i,s,o,c)}finally{We=d,es.transition=_}}function hv(i,s,o,c){var d=We,_=es.transition;es.transition=null;try{We=4,Ka(i,s,o,c)}finally{We=d,es.transition=_}}function Ka(i,s,o,c){if(Gn){var d=Va(i,s,o,c);if(d===null)cl(i,s,c,Qn,o),Yu(i,c);else if(av(d,i,s,o,c))c.stopPropagation();else if(Yu(i,c),s&4&&-1<ov.indexOf(i)){for(;d!==null;){var _=Zs(d);if(_!==null&&Uu(_),_=Va(i,s,o,c),_===null&&cl(i,s,c,Qn,o),_===d)break;d=_}d!==null&&c.stopPropagation()}else cl(i,s,c,null,o)}}var Qn=null;function Va(i,s,o,c){if(Qn=null,i=Ba(c),i=Dr(i),i!==null)if(s=Rr(i),s===null)i=null;else if(o=s.tag,o===13){if(i=Bu(s),i!==null)return i;i=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null);return Qn=i,null}function Qu(i){switch(i){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(Qg()){case za:return 1;case Fu:return 4;case $n:case Jg:return 16;case Hu:return 536870912;default:return 16}default:return 16}}var nr=null,qa=null,Jn=null;function Ju(){if(Jn)return Jn;var i,s=qa,o=s.length,c,d="value"in nr?nr.value:nr.textContent,_=d.length;for(i=0;i<o&&s[i]===d[i];i++);var w=o-i;for(c=1;c<=w&&s[o-c]===d[_-c];c++);return Jn=d.slice(i,1<c?1-c:void 0)}function Zn(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function eo(){return!0}function Zu(){return!1}function Xt(i){function s(o,c,d,_,w){this._reactName=o,this._targetInst=d,this.type=c,this.nativeEvent=_,this.target=w,this.currentTarget=null;for(var D in i)i.hasOwnProperty(D)&&(o=i[D],this[D]=o?o(_):_[D]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?eo:Zu,this.isPropagationStopped=Zu,this}return te(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=eo)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=eo)},persist:function(){},isPersistent:eo}),s}var ts={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ya=Xt(ts),Ws=te({},ts,{view:0,detail:0}),uv=Xt(Ws),Xa,Ga,$s,to=te({},Ws,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ja,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==$s&&($s&&i.type==="mousemove"?(Xa=i.screenX-$s.screenX,Ga=i.screenY-$s.screenY):Ga=Xa=0,$s=i),Xa)},movementY:function(i){return"movementY"in i?i.movementY:Ga}}),ed=Xt(to),dv=te({},to,{dataTransfer:0}),fv=Xt(dv),pv=te({},Ws,{relatedTarget:0}),Qa=Xt(pv),mv=te({},ts,{animationName:0,elapsedTime:0,pseudoElement:0}),_v=Xt(mv),gv=te({},ts,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),vv=Xt(gv),yv=te({},ts,{data:0}),td=Xt(yv),Sv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wv={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Cv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bv(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=Cv[i])?!!s[i]:!1}function Ja(){return bv}var xv=te({},Ws,{key:function(i){if(i.key){var s=Sv[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Zn(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?wv[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ja,charCode:function(i){return i.type==="keypress"?Zn(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Zn(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),kv=Xt(xv),Ev=te({},to,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),id=Xt(Ev),Nv=te({},Ws,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ja}),Rv=Xt(Nv),Dv=te({},ts,{propertyName:0,elapsedTime:0,pseudoElement:0}),Mv=Xt(Dv),Lv=te({},to,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Pv=Xt(Lv),Tv=[9,13,27,32],Za=f&&"CompositionEvent"in window,Us=null;f&&"documentMode"in document&&(Us=document.documentMode);var Bv=f&&"TextEvent"in window&&!Us,rd=f&&(!Za||Us&&8<Us&&11>=Us),sd=" ",nd=!1;function od(i,s){switch(i){case"keyup":return Tv.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ad(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var is=!1;function jv(i,s){switch(i){case"compositionend":return ad(s);case"keypress":return s.which!==32?null:(nd=!0,sd);case"textInput":return i=s.data,i===sd&&nd?null:i;default:return null}}function Av(i,s){if(is)return i==="compositionend"||!Za&&od(i,s)?(i=Ju(),Jn=qa=nr=null,is=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return rd&&s.locale!=="ko"?null:s.data;default:return null}}var Iv={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ld(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!Iv[i.type]:s==="textarea"}function cd(i,s,o,c){Du(c),s=oo(s,"onChange"),0<s.length&&(o=new Ya("onChange","change",null,o,c),i.push({event:o,listeners:s}))}var Ks=null,Vs=null;function Ov(i){Nd(i,0)}function io(i){var s=as(i);if(ye(s))return i}function zv(i,s){if(i==="change")return s}var hd=!1;if(f){var el;if(f){var tl="oninput"in document;if(!tl){var ud=document.createElement("div");ud.setAttribute("oninput","return;"),tl=typeof ud.oninput=="function"}el=tl}else el=!1;hd=el&&(!document.documentMode||9<document.documentMode)}function dd(){Ks&&(Ks.detachEvent("onpropertychange",fd),Vs=Ks=null)}function fd(i){if(i.propertyName==="value"&&io(Vs)){var s=[];cd(s,Vs,i,Ba(i)),Tu(Ov,s)}}function Fv(i,s,o){i==="focusin"?(dd(),Ks=s,Vs=o,Ks.attachEvent("onpropertychange",fd)):i==="focusout"&&dd()}function Hv(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return io(Vs)}function Wv(i,s){if(i==="click")return io(s)}function $v(i,s){if(i==="input"||i==="change")return io(s)}function Uv(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var vi=typeof Object.is=="function"?Object.is:Uv;function qs(i,s){if(vi(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var o=Object.keys(i),c=Object.keys(s);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var d=o[c];if(!m.call(s,d)||!vi(i[d],s[d]))return!1}return!0}function pd(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function md(i,s){var o=pd(i);i=0;for(var c;o;){if(o.nodeType===3){if(c=i+o.textContent.length,i<=s&&c>=s)return{node:o,offset:s-i};i=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=pd(o)}}function _d(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?_d(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function gd(){for(var i=window,s=me();s instanceof i.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)i=s.contentWindow;else break;s=me(i.document)}return s}function il(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}function Kv(i){var s=gd(),o=i.focusedElem,c=i.selectionRange;if(s!==o&&o&&o.ownerDocument&&_d(o.ownerDocument.documentElement,o)){if(c!==null&&il(o)){if(s=c.start,i=c.end,i===void 0&&(i=s),"selectionStart"in o)o.selectionStart=s,o.selectionEnd=Math.min(i,o.value.length);else if(i=(s=o.ownerDocument||document)&&s.defaultView||window,i.getSelection){i=i.getSelection();var d=o.textContent.length,_=Math.min(c.start,d);c=c.end===void 0?_:Math.min(c.end,d),!i.extend&&_>c&&(d=c,c=_,_=d),d=md(o,_);var w=md(o,c);d&&w&&(i.rangeCount!==1||i.anchorNode!==d.node||i.anchorOffset!==d.offset||i.focusNode!==w.node||i.focusOffset!==w.offset)&&(s=s.createRange(),s.setStart(d.node,d.offset),i.removeAllRanges(),_>c?(i.addRange(s),i.extend(w.node,w.offset)):(s.setEnd(w.node,w.offset),i.addRange(s)))}}for(s=[],i=o;i=i.parentNode;)i.nodeType===1&&s.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<s.length;o++)i=s[o],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var Vv=f&&"documentMode"in document&&11>=document.documentMode,rs=null,rl=null,Ys=null,sl=!1;function vd(i,s,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;sl||rs==null||rs!==me(c)||(c=rs,"selectionStart"in c&&il(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Ys&&qs(Ys,c)||(Ys=c,c=oo(rl,"onSelect"),0<c.length&&(s=new Ya("onSelect","select",null,s,o),i.push({event:s,listeners:c}),s.target=rs)))}function ro(i,s){var o={};return o[i.toLowerCase()]=s.toLowerCase(),o["Webkit"+i]="webkit"+s,o["Moz"+i]="moz"+s,o}var ss={animationend:ro("Animation","AnimationEnd"),animationiteration:ro("Animation","AnimationIteration"),animationstart:ro("Animation","AnimationStart"),transitionend:ro("Transition","TransitionEnd")},nl={},yd={};f&&(yd=document.createElement("div").style,"AnimationEvent"in window||(delete ss.animationend.animation,delete ss.animationiteration.animation,delete ss.animationstart.animation),"TransitionEvent"in window||delete ss.transitionend.transition);function so(i){if(nl[i])return nl[i];if(!ss[i])return i;var s=ss[i],o;for(o in s)if(s.hasOwnProperty(o)&&o in yd)return nl[i]=s[o];return i}var Sd=so("animationend"),wd=so("animationiteration"),Cd=so("animationstart"),bd=so("transitionend"),xd=new Map,kd="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 or(i,s){xd.set(i,s),l(s,[i])}for(var ol=0;ol<kd.length;ol++){var al=kd[ol],qv=al.toLowerCase(),Yv=al[0].toUpperCase()+al.slice(1);or(qv,"on"+Yv)}or(Sd,"onAnimationEnd"),or(wd,"onAnimationIteration"),or(Cd,"onAnimationStart"),or("dblclick","onDoubleClick"),or("focusin","onFocus"),or("focusout","onBlur"),or(bd,"onTransitionEnd"),h("onMouseEnter",["mouseout","mouseover"]),h("onMouseLeave",["mouseout","mouseover"]),h("onPointerEnter",["pointerout","pointerover"]),h("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Xv=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xs));function Ed(i,s,o){var c=i.type||"unknown-event";i.currentTarget=o,qg(c,s,void 0,i),i.currentTarget=null}function Nd(i,s){s=(s&4)!==0;for(var o=0;o<i.length;o++){var c=i[o],d=c.event;c=c.listeners;e:{var _=void 0;if(s)for(var w=c.length-1;0<=w;w--){var D=c[w],z=D.instance,J=D.currentTarget;if(D=D.listener,z!==_&&d.isPropagationStopped())break e;Ed(d,D,J),_=z}else for(w=0;w<c.length;w++){if(D=c[w],z=D.instance,J=D.currentTarget,D=D.listener,z!==_&&d.isPropagationStopped())break e;Ed(d,D,J),_=z}}}if(Wn)throw i=Oa,Wn=!1,Oa=null,i}function Ke(i,s){var o=s[ml];o===void 0&&(o=s[ml]=new Set);var c=i+"__bubble";o.has(c)||(Rd(s,i,2,!1),o.add(c))}function ll(i,s,o){var c=0;s&&(c|=4),Rd(o,i,c,s)}var no="_reactListening"+Math.random().toString(36).slice(2);function Gs(i){if(!i[no]){i[no]=!0,n.forEach(function(o){o!=="selectionchange"&&(Xv.has(o)||ll(o,!1,i),ll(o,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[no]||(s[no]=!0,ll("selectionchange",!1,s))}}function Rd(i,s,o,c){switch(Qu(s)){case 1:var d=cv;break;case 4:d=hv;break;default:d=Ka}o=d.bind(null,s,o,i),d=void 0,!Ia||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(d=!0),c?d!==void 0?i.addEventListener(s,o,{capture:!0,passive:d}):i.addEventListener(s,o,!0):d!==void 0?i.addEventListener(s,o,{passive:d}):i.addEventListener(s,o,!1)}function cl(i,s,o,c,d){var _=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var w=c.tag;if(w===3||w===4){var D=c.stateNode.containerInfo;if(D===d||D.nodeType===8&&D.parentNode===d)break;if(w===4)for(w=c.return;w!==null;){var z=w.tag;if((z===3||z===4)&&(z=w.stateNode.containerInfo,z===d||z.nodeType===8&&z.parentNode===d))return;w=w.return}for(;D!==null;){if(w=Dr(D),w===null)return;if(z=w.tag,z===5||z===6){c=_=w;continue e}D=D.parentNode}}c=c.return}Tu(function(){var J=_,se=Ba(o),oe=[];e:{var re=xd.get(i);if(re!==void 0){var fe=Ya,ve=i;switch(i){case"keypress":if(Zn(o)===0)break e;case"keydown":case"keyup":fe=kv;break;case"focusin":ve="focus",fe=Qa;break;case"focusout":ve="blur",fe=Qa;break;case"beforeblur":case"afterblur":fe=Qa;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=ed;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=fv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=Rv;break;case Sd:case wd:case Cd:fe=_v;break;case bd:fe=Mv;break;case"scroll":fe=uv;break;case"wheel":fe=Pv;break;case"copy":case"cut":case"paste":fe=vv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=id}var Se=(s&4)!==0,st=!Se&&i==="scroll",q=Se?re!==null?re+"Capture":null:re;Se=[];for(var H=J,X;H!==null;){X=H;var ae=X.stateNode;if(X.tag===5&&ae!==null&&(X=ae,q!==null&&(ae=Ps(H,q),ae!=null&&Se.push(Qs(H,ae,X)))),st)break;H=H.return}0<Se.length&&(re=new fe(re,ve,null,o,se),oe.push({event:re,listeners:Se}))}}if((s&7)===0){e:{if(re=i==="mouseover"||i==="pointerover",fe=i==="mouseout"||i==="pointerout",re&&o!==Ta&&(ve=o.relatedTarget||o.fromElement)&&(Dr(ve)||ve[Fi]))break e;if((fe||re)&&(re=se.window===se?se:(re=se.ownerDocument)?re.defaultView||re.parentWindow:window,fe?(ve=o.relatedTarget||o.toElement,fe=J,ve=ve?Dr(ve):null,ve!==null&&(st=Rr(ve),ve!==st||ve.tag!==5&&ve.tag!==6)&&(ve=null)):(fe=null,ve=J),fe!==ve)){if(Se=ed,ae="onMouseLeave",q="onMouseEnter",H="mouse",(i==="pointerout"||i==="pointerover")&&(Se=id,ae="onPointerLeave",q="onPointerEnter",H="pointer"),st=fe==null?re:as(fe),X=ve==null?re:as(ve),re=new Se(ae,H+"leave",fe,o,se),re.target=st,re.relatedTarget=X,ae=null,Dr(se)===J&&(Se=new Se(q,H+"enter",ve,o,se),Se.target=X,Se.relatedTarget=st,ae=Se),st=ae,fe&&ve)t:{for(Se=fe,q=ve,H=0,X=Se;X;X=ns(X))H++;for(X=0,ae=q;ae;ae=ns(ae))X++;for(;0<H-X;)Se=ns(Se),H--;for(;0<X-H;)q=ns(q),X--;for(;H--;){if(Se===q||q!==null&&Se===q.alternate)break t;Se=ns(Se),q=ns(q)}Se=null}else Se=null;fe!==null&&Dd(oe,re,fe,Se,!1),ve!==null&&st!==null&&Dd(oe,st,ve,Se,!0)}}e:{if(re=J?as(J):window,fe=re.nodeName&&re.nodeName.toLowerCase(),fe==="select"||fe==="input"&&re.type==="file")var we=zv;else if(ld(re))if(hd)we=$v;else{we=Hv;var ke=Fv}else(fe=re.nodeName)&&fe.toLowerCase()==="input"&&(re.type==="checkbox"||re.type==="radio")&&(we=Wv);if(we&&(we=we(i,J))){cd(oe,we,o,se);break e}ke&&ke(i,re,J),i==="focusout"&&(ke=re._wrapperState)&&ke.controlled&&re.type==="number"&&ri(re,"number",re.value)}switch(ke=J?as(J):window,i){case"focusin":(ld(ke)||ke.contentEditable==="true")&&(rs=ke,rl=J,Ys=null);break;case"focusout":Ys=rl=rs=null;break;case"mousedown":sl=!0;break;case"contextmenu":case"mouseup":case"dragend":sl=!1,vd(oe,o,se);break;case"selectionchange":if(Vv)break;case"keydown":case"keyup":vd(oe,o,se)}var Ee;if(Za)e:{switch(i){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else is?od(i,o)&&(Ne="onCompositionEnd"):i==="keydown"&&o.keyCode===229&&(Ne="onCompositionStart");Ne&&(rd&&o.locale!=="ko"&&(is||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&is&&(Ee=Ju()):(nr=se,qa="value"in nr?nr.value:nr.textContent,is=!0)),ke=oo(J,Ne),0<ke.length&&(Ne=new td(Ne,i,null,o,se),oe.push({event:Ne,listeners:ke}),Ee?Ne.data=Ee:(Ee=ad(o),Ee!==null&&(Ne.data=Ee)))),(Ee=Bv?jv(i,o):Av(i,o))&&(J=oo(J,"onBeforeInput"),0<J.length&&(se=new td("onBeforeInput","beforeinput",null,o,se),oe.push({event:se,listeners:J}),se.data=Ee))}Nd(oe,s)})}function Qs(i,s,o){return{instance:i,listener:s,currentTarget:o}}function oo(i,s){for(var o=s+"Capture",c=[];i!==null;){var d=i,_=d.stateNode;d.tag===5&&_!==null&&(d=_,_=Ps(i,o),_!=null&&c.unshift(Qs(i,_,d)),_=Ps(i,s),_!=null&&c.push(Qs(i,_,d))),i=i.return}return c}function ns(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function Dd(i,s,o,c,d){for(var _=s._reactName,w=[];o!==null&&o!==c;){var D=o,z=D.alternate,J=D.stateNode;if(z!==null&&z===c)break;D.tag===5&&J!==null&&(D=J,d?(z=Ps(o,_),z!=null&&w.unshift(Qs(o,z,D))):d||(z=Ps(o,_),z!=null&&w.push(Qs(o,z,D)))),o=o.return}w.length!==0&&i.push({event:s,listeners:w})}var Gv=/\r\n?/g,Qv=/\u0000|\uFFFD/g;function Md(i){return(typeof i=="string"?i:""+i).replace(Gv,`
|
|
38
|
+
`).replace(Qv,"")}function ao(i,s,o){if(s=Md(s),Md(i)!==s&&o)throw Error(r(425))}function lo(){}var hl=null,ul=null;function dl(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var fl=typeof setTimeout=="function"?setTimeout:void 0,Jv=typeof clearTimeout=="function"?clearTimeout:void 0,Ld=typeof Promise=="function"?Promise:void 0,Zv=typeof queueMicrotask=="function"?queueMicrotask:typeof Ld<"u"?function(i){return Ld.resolve(null).then(i).catch(ey)}:fl;function ey(i){setTimeout(function(){throw i})}function pl(i,s){var o=s,c=0;do{var d=o.nextSibling;if(i.removeChild(o),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(c===0){i.removeChild(d),Hs(s);return}c--}else o!=="$"&&o!=="$?"&&o!=="$!"||c++;o=d}while(o);Hs(s)}function ar(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return i}function Pd(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var o=i.data;if(o==="$"||o==="$!"||o==="$?"){if(s===0)return i;s--}else o==="/$"&&s++}i=i.previousSibling}return null}var os=Math.random().toString(36).slice(2),Ri="__reactFiber$"+os,Js="__reactProps$"+os,Fi="__reactContainer$"+os,ml="__reactEvents$"+os,ty="__reactListeners$"+os,iy="__reactHandles$"+os;function Dr(i){var s=i[Ri];if(s)return s;for(var o=i.parentNode;o;){if(s=o[Fi]||o[Ri]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(i=Pd(i);i!==null;){if(o=i[Ri])return o;i=Pd(i)}return s}i=o,o=i.parentNode}return null}function Zs(i){return i=i[Ri]||i[Fi],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function as(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(r(33))}function co(i){return i[Js]||null}var _l=[],ls=-1;function lr(i){return{current:i}}function Ve(i){0>ls||(i.current=_l[ls],_l[ls]=null,ls--)}function Ue(i,s){ls++,_l[ls]=i.current,i.current=s}var cr={},Rt=lr(cr),Ft=lr(!1),Mr=cr;function cs(i,s){var o=i.type.contextTypes;if(!o)return cr;var c=i.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===s)return c.__reactInternalMemoizedMaskedChildContext;var d={},_;for(_ in o)d[_]=s[_];return c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=s,i.__reactInternalMemoizedMaskedChildContext=d),d}function Ht(i){return i=i.childContextTypes,i!=null}function ho(){Ve(Ft),Ve(Rt)}function Td(i,s,o){if(Rt.current!==cr)throw Error(r(168));Ue(Rt,s),Ue(Ft,o)}function Bd(i,s,o){var c=i.stateNode;if(s=s.childContextTypes,typeof c.getChildContext!="function")return o;c=c.getChildContext();for(var d in c)if(!(d in s))throw Error(r(108,Ce(i)||"Unknown",d));return te({},o,c)}function uo(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||cr,Mr=Rt.current,Ue(Rt,i),Ue(Ft,Ft.current),!0}function jd(i,s,o){var c=i.stateNode;if(!c)throw Error(r(169));o?(i=Bd(i,s,Mr),c.__reactInternalMemoizedMergedChildContext=i,Ve(Ft),Ve(Rt),Ue(Rt,i)):Ve(Ft),Ue(Ft,o)}var Hi=null,fo=!1,gl=!1;function Ad(i){Hi===null?Hi=[i]:Hi.push(i)}function ry(i){fo=!0,Ad(i)}function hr(){if(!gl&&Hi!==null){gl=!0;var i=0,s=We;try{var o=Hi;for(We=1;i<o.length;i++){var c=o[i];do c=c(!0);while(c!==null)}Hi=null,fo=!1}catch(d){throw Hi!==null&&(Hi=Hi.slice(i+1)),Ou(za,hr),d}finally{We=s,gl=!1}}return null}var hs=[],us=0,po=null,mo=0,oi=[],ai=0,Lr=null,Wi=1,$i="";function Pr(i,s){hs[us++]=mo,hs[us++]=po,po=i,mo=s}function Id(i,s,o){oi[ai++]=Wi,oi[ai++]=$i,oi[ai++]=Lr,Lr=i;var c=Wi;i=$i;var d=32-gi(c)-1;c&=~(1<<d),o+=1;var _=32-gi(s)+d;if(30<_){var w=d-d%5;_=(c&(1<<w)-1).toString(32),c>>=w,d-=w,Wi=1<<32-gi(s)+d|o<<d|c,$i=_+i}else Wi=1<<_|o<<d|c,$i=i}function vl(i){i.return!==null&&(Pr(i,1),Id(i,1,0))}function yl(i){for(;i===po;)po=hs[--us],hs[us]=null,mo=hs[--us],hs[us]=null;for(;i===Lr;)Lr=oi[--ai],oi[ai]=null,$i=oi[--ai],oi[ai]=null,Wi=oi[--ai],oi[ai]=null}var Gt=null,Qt=null,Ye=!1,yi=null;function Od(i,s){var o=ui(5,null,null,0);o.elementType="DELETED",o.stateNode=s,o.return=i,s=i.deletions,s===null?(i.deletions=[o],i.flags|=16):s.push(o)}function zd(i,s){switch(i.tag){case 5:var o=i.type;return s=s.nodeType!==1||o.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(i.stateNode=s,Gt=i,Qt=ar(s.firstChild),!0):!1;case 6:return s=i.pendingProps===""||s.nodeType!==3?null:s,s!==null?(i.stateNode=s,Gt=i,Qt=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(o=Lr!==null?{id:Wi,overflow:$i}:null,i.memoizedState={dehydrated:s,treeContext:o,retryLane:1073741824},o=ui(18,null,null,0),o.stateNode=s,o.return=i,i.child=o,Gt=i,Qt=null,!0):!1;default:return!1}}function Sl(i){return(i.mode&1)!==0&&(i.flags&128)===0}function wl(i){if(Ye){var s=Qt;if(s){var o=s;if(!zd(i,s)){if(Sl(i))throw Error(r(418));s=ar(o.nextSibling);var c=Gt;s&&zd(i,s)?Od(c,o):(i.flags=i.flags&-4097|2,Ye=!1,Gt=i)}}else{if(Sl(i))throw Error(r(418));i.flags=i.flags&-4097|2,Ye=!1,Gt=i}}}function Fd(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;Gt=i}function _o(i){if(i!==Gt)return!1;if(!Ye)return Fd(i),Ye=!0,!1;var s;if((s=i.tag!==3)&&!(s=i.tag!==5)&&(s=i.type,s=s!=="head"&&s!=="body"&&!dl(i.type,i.memoizedProps)),s&&(s=Qt)){if(Sl(i))throw Hd(),Error(r(418));for(;s;)Od(i,s),s=ar(s.nextSibling)}if(Fd(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));e:{for(i=i.nextSibling,s=0;i;){if(i.nodeType===8){var o=i.data;if(o==="/$"){if(s===0){Qt=ar(i.nextSibling);break e}s--}else o!=="$"&&o!=="$!"&&o!=="$?"||s++}i=i.nextSibling}Qt=null}}else Qt=Gt?ar(i.stateNode.nextSibling):null;return!0}function Hd(){for(var i=Qt;i;)i=ar(i.nextSibling)}function ds(){Qt=Gt=null,Ye=!1}function Cl(i){yi===null?yi=[i]:yi.push(i)}var sy=L.ReactCurrentBatchConfig;function en(i,s,o){if(i=o.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(o._owner){if(o=o._owner,o){if(o.tag!==1)throw Error(r(309));var c=o.stateNode}if(!c)throw Error(r(147,i));var d=c,_=""+i;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===_?s.ref:(s=function(w){var D=d.refs;w===null?delete D[_]:D[_]=w},s._stringRef=_,s)}if(typeof i!="string")throw Error(r(284));if(!o._owner)throw Error(r(290,i))}return i}function go(i,s){throw i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i))}function Wd(i){var s=i._init;return s(i._payload)}function $d(i){function s(q,H){if(i){var X=q.deletions;X===null?(q.deletions=[H],q.flags|=16):X.push(H)}}function o(q,H){if(!i)return null;for(;H!==null;)s(q,H),H=H.sibling;return null}function c(q,H){for(q=new Map;H!==null;)H.key!==null?q.set(H.key,H):q.set(H.index,H),H=H.sibling;return q}function d(q,H){return q=vr(q,H),q.index=0,q.sibling=null,q}function _(q,H,X){return q.index=X,i?(X=q.alternate,X!==null?(X=X.index,X<H?(q.flags|=2,H):X):(q.flags|=2,H)):(q.flags|=1048576,H)}function w(q){return i&&q.alternate===null&&(q.flags|=2),q}function D(q,H,X,ae){return H===null||H.tag!==6?(H=fc(X,q.mode,ae),H.return=q,H):(H=d(H,X),H.return=q,H)}function z(q,H,X,ae){var we=X.type;return we===A?se(q,H,X.props.children,ae,X.key):H!==null&&(H.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===Q&&Wd(we)===H.type)?(ae=d(H,X.props),ae.ref=en(q,H,X),ae.return=q,ae):(ae=Ho(X.type,X.key,X.props,null,q.mode,ae),ae.ref=en(q,H,X),ae.return=q,ae)}function J(q,H,X,ae){return H===null||H.tag!==4||H.stateNode.containerInfo!==X.containerInfo||H.stateNode.implementation!==X.implementation?(H=pc(X,q.mode,ae),H.return=q,H):(H=d(H,X.children||[]),H.return=q,H)}function se(q,H,X,ae,we){return H===null||H.tag!==7?(H=Fr(X,q.mode,ae,we),H.return=q,H):(H=d(H,X),H.return=q,H)}function oe(q,H,X){if(typeof H=="string"&&H!==""||typeof H=="number")return H=fc(""+H,q.mode,X),H.return=q,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case G:return X=Ho(H.type,H.key,H.props,null,q.mode,X),X.ref=en(q,null,H),X.return=q,X;case $:return H=pc(H,q.mode,X),H.return=q,H;case Q:var ae=H._init;return oe(q,ae(H._payload),X)}if(si(H)||Z(H))return H=Fr(H,q.mode,X,null),H.return=q,H;go(q,H)}return null}function re(q,H,X,ae){var we=H!==null?H.key:null;if(typeof X=="string"&&X!==""||typeof X=="number")return we!==null?null:D(q,H,""+X,ae);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case G:return X.key===we?z(q,H,X,ae):null;case $:return X.key===we?J(q,H,X,ae):null;case Q:return we=X._init,re(q,H,we(X._payload),ae)}if(si(X)||Z(X))return we!==null?null:se(q,H,X,ae,null);go(q,X)}return null}function fe(q,H,X,ae,we){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return q=q.get(X)||null,D(H,q,""+ae,we);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case G:return q=q.get(ae.key===null?X:ae.key)||null,z(H,q,ae,we);case $:return q=q.get(ae.key===null?X:ae.key)||null,J(H,q,ae,we);case Q:var ke=ae._init;return fe(q,H,X,ke(ae._payload),we)}if(si(ae)||Z(ae))return q=q.get(X)||null,se(H,q,ae,we,null);go(H,ae)}return null}function ve(q,H,X,ae){for(var we=null,ke=null,Ee=H,Ne=H=0,_t=null;Ee!==null&&Ne<X.length;Ne++){Ee.index>Ne?(_t=Ee,Ee=null):_t=Ee.sibling;var ze=re(q,Ee,X[Ne],ae);if(ze===null){Ee===null&&(Ee=_t);break}i&&Ee&&ze.alternate===null&&s(q,Ee),H=_(ze,H,Ne),ke===null?we=ze:ke.sibling=ze,ke=ze,Ee=_t}if(Ne===X.length)return o(q,Ee),Ye&&Pr(q,Ne),we;if(Ee===null){for(;Ne<X.length;Ne++)Ee=oe(q,X[Ne],ae),Ee!==null&&(H=_(Ee,H,Ne),ke===null?we=Ee:ke.sibling=Ee,ke=Ee);return Ye&&Pr(q,Ne),we}for(Ee=c(q,Ee);Ne<X.length;Ne++)_t=fe(Ee,q,Ne,X[Ne],ae),_t!==null&&(i&&_t.alternate!==null&&Ee.delete(_t.key===null?Ne:_t.key),H=_(_t,H,Ne),ke===null?we=_t:ke.sibling=_t,ke=_t);return i&&Ee.forEach(function(yr){return s(q,yr)}),Ye&&Pr(q,Ne),we}function Se(q,H,X,ae){var we=Z(X);if(typeof we!="function")throw Error(r(150));if(X=we.call(X),X==null)throw Error(r(151));for(var ke=we=null,Ee=H,Ne=H=0,_t=null,ze=X.next();Ee!==null&&!ze.done;Ne++,ze=X.next()){Ee.index>Ne?(_t=Ee,Ee=null):_t=Ee.sibling;var yr=re(q,Ee,ze.value,ae);if(yr===null){Ee===null&&(Ee=_t);break}i&&Ee&&yr.alternate===null&&s(q,Ee),H=_(yr,H,Ne),ke===null?we=yr:ke.sibling=yr,ke=yr,Ee=_t}if(ze.done)return o(q,Ee),Ye&&Pr(q,Ne),we;if(Ee===null){for(;!ze.done;Ne++,ze=X.next())ze=oe(q,ze.value,ae),ze!==null&&(H=_(ze,H,Ne),ke===null?we=ze:ke.sibling=ze,ke=ze);return Ye&&Pr(q,Ne),we}for(Ee=c(q,Ee);!ze.done;Ne++,ze=X.next())ze=fe(Ee,q,Ne,ze.value,ae),ze!==null&&(i&&ze.alternate!==null&&Ee.delete(ze.key===null?Ne:ze.key),H=_(ze,H,Ne),ke===null?we=ze:ke.sibling=ze,ke=ze);return i&&Ee.forEach(function(Iy){return s(q,Iy)}),Ye&&Pr(q,Ne),we}function st(q,H,X,ae){if(typeof X=="object"&&X!==null&&X.type===A&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case G:e:{for(var we=X.key,ke=H;ke!==null;){if(ke.key===we){if(we=X.type,we===A){if(ke.tag===7){o(q,ke.sibling),H=d(ke,X.props.children),H.return=q,q=H;break e}}else if(ke.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===Q&&Wd(we)===ke.type){o(q,ke.sibling),H=d(ke,X.props),H.ref=en(q,ke,X),H.return=q,q=H;break e}o(q,ke);break}else s(q,ke);ke=ke.sibling}X.type===A?(H=Fr(X.props.children,q.mode,ae,X.key),H.return=q,q=H):(ae=Ho(X.type,X.key,X.props,null,q.mode,ae),ae.ref=en(q,H,X),ae.return=q,q=ae)}return w(q);case $:e:{for(ke=X.key;H!==null;){if(H.key===ke)if(H.tag===4&&H.stateNode.containerInfo===X.containerInfo&&H.stateNode.implementation===X.implementation){o(q,H.sibling),H=d(H,X.children||[]),H.return=q,q=H;break e}else{o(q,H);break}else s(q,H);H=H.sibling}H=pc(X,q.mode,ae),H.return=q,q=H}return w(q);case Q:return ke=X._init,st(q,H,ke(X._payload),ae)}if(si(X))return ve(q,H,X,ae);if(Z(X))return Se(q,H,X,ae);go(q,X)}return typeof X=="string"&&X!==""||typeof X=="number"?(X=""+X,H!==null&&H.tag===6?(o(q,H.sibling),H=d(H,X),H.return=q,q=H):(o(q,H),H=fc(X,q.mode,ae),H.return=q,q=H),w(q)):o(q,H)}return st}var fs=$d(!0),Ud=$d(!1),vo=lr(null),yo=null,ps=null,bl=null;function xl(){bl=ps=yo=null}function kl(i){var s=vo.current;Ve(vo),i._currentValue=s}function El(i,s,o){for(;i!==null;){var c=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),i===o)break;i=i.return}}function ms(i,s){yo=i,bl=ps=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&s)!==0&&(Wt=!0),i.firstContext=null)}function li(i){var s=i._currentValue;if(bl!==i)if(i={context:i,memoizedValue:s,next:null},ps===null){if(yo===null)throw Error(r(308));ps=i,yo.dependencies={lanes:0,firstContext:i}}else ps=ps.next=i;return s}var Tr=null;function Nl(i){Tr===null?Tr=[i]:Tr.push(i)}function Kd(i,s,o,c){var d=s.interleaved;return d===null?(o.next=o,Nl(s)):(o.next=d.next,d.next=o),s.interleaved=o,Ui(i,c)}function Ui(i,s){i.lanes|=s;var o=i.alternate;for(o!==null&&(o.lanes|=s),o=i,i=i.return;i!==null;)i.childLanes|=s,o=i.alternate,o!==null&&(o.childLanes|=s),o=i,i=i.return;return o.tag===3?o.stateNode:null}var ur=!1;function Rl(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vd(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Ki(i,s){return{eventTime:i,lane:s,tag:0,payload:null,callback:null,next:null}}function dr(i,s,o){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,(Ie&2)!==0){var d=c.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),c.pending=s,Ui(i,o)}return d=c.interleaved,d===null?(s.next=s,Nl(c)):(s.next=d.next,d.next=s),c.interleaved=s,Ui(i,o)}function So(i,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194240)!==0)){var c=s.lanes;c&=i.pendingLanes,o|=c,s.lanes=o,Wa(i,o)}}function qd(i,s){var o=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var d=null,_=null;if(o=o.firstBaseUpdate,o!==null){do{var w={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};_===null?d=_=w:_=_.next=w,o=o.next}while(o!==null);_===null?d=_=s:_=_.next=s}else d=_=s;o={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:_,shared:c.shared,effects:c.effects},i.updateQueue=o;return}i=o.lastBaseUpdate,i===null?o.firstBaseUpdate=s:i.next=s,o.lastBaseUpdate=s}function wo(i,s,o,c){var d=i.updateQueue;ur=!1;var _=d.firstBaseUpdate,w=d.lastBaseUpdate,D=d.shared.pending;if(D!==null){d.shared.pending=null;var z=D,J=z.next;z.next=null,w===null?_=J:w.next=J,w=z;var se=i.alternate;se!==null&&(se=se.updateQueue,D=se.lastBaseUpdate,D!==w&&(D===null?se.firstBaseUpdate=J:D.next=J,se.lastBaseUpdate=z))}if(_!==null){var oe=d.baseState;w=0,se=J=z=null,D=_;do{var re=D.lane,fe=D.eventTime;if((c&re)===re){se!==null&&(se=se.next={eventTime:fe,lane:0,tag:D.tag,payload:D.payload,callback:D.callback,next:null});e:{var ve=i,Se=D;switch(re=s,fe=o,Se.tag){case 1:if(ve=Se.payload,typeof ve=="function"){oe=ve.call(fe,oe,re);break e}oe=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Se.payload,re=typeof ve=="function"?ve.call(fe,oe,re):ve,re==null)break e;oe=te({},oe,re);break e;case 2:ur=!0}}D.callback!==null&&D.lane!==0&&(i.flags|=64,re=d.effects,re===null?d.effects=[D]:re.push(D))}else fe={eventTime:fe,lane:re,tag:D.tag,payload:D.payload,callback:D.callback,next:null},se===null?(J=se=fe,z=oe):se=se.next=fe,w|=re;if(D=D.next,D===null){if(D=d.shared.pending,D===null)break;re=D,D=re.next,re.next=null,d.lastBaseUpdate=re,d.shared.pending=null}}while(!0);if(se===null&&(z=oe),d.baseState=z,d.firstBaseUpdate=J,d.lastBaseUpdate=se,s=d.shared.interleaved,s!==null){d=s;do w|=d.lane,d=d.next;while(d!==s)}else _===null&&(d.shared.lanes=0);Ar|=w,i.lanes=w,i.memoizedState=oe}}function Yd(i,s,o){if(i=s.effects,s.effects=null,i!==null)for(s=0;s<i.length;s++){var c=i[s],d=c.callback;if(d!==null){if(c.callback=null,c=o,typeof d!="function")throw Error(r(191,d));d.call(c)}}}var tn={},Di=lr(tn),rn=lr(tn),sn=lr(tn);function Br(i){if(i===tn)throw Error(r(174));return i}function Dl(i,s){switch(Ue(sn,s),Ue(rn,i),Ue(Di,tn),i=s.nodeType,i){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:Ei(null,"");break;default:i=i===8?s.parentNode:s,s=i.namespaceURI||null,i=i.tagName,s=Ei(s,i)}Ve(Di),Ue(Di,s)}function _s(){Ve(Di),Ve(rn),Ve(sn)}function Xd(i){Br(sn.current);var s=Br(Di.current),o=Ei(s,i.type);s!==o&&(Ue(rn,i),Ue(Di,o))}function Ml(i){rn.current===i&&(Ve(Di),Ve(rn))}var Ge=lr(0);function Co(i){for(var s=i;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Ll=[];function Pl(){for(var i=0;i<Ll.length;i++)Ll[i]._workInProgressVersionPrimary=null;Ll.length=0}var bo=L.ReactCurrentDispatcher,Tl=L.ReactCurrentBatchConfig,jr=0,Qe=null,ct=null,pt=null,xo=!1,nn=!1,on=0,ny=0;function Dt(){throw Error(r(321))}function Bl(i,s){if(s===null)return!1;for(var o=0;o<s.length&&o<i.length;o++)if(!vi(i[o],s[o]))return!1;return!0}function jl(i,s,o,c,d,_){if(jr=_,Qe=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,bo.current=i===null||i.memoizedState===null?cy:hy,i=o(c,d),nn){_=0;do{if(nn=!1,on=0,25<=_)throw Error(r(301));_+=1,pt=ct=null,s.updateQueue=null,bo.current=uy,i=o(c,d)}while(nn)}if(bo.current=No,s=ct!==null&&ct.next!==null,jr=0,pt=ct=Qe=null,xo=!1,s)throw Error(r(300));return i}function Al(){var i=on!==0;return on=0,i}function Mi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pt===null?Qe.memoizedState=pt=i:pt=pt.next=i,pt}function ci(){if(ct===null){var i=Qe.alternate;i=i!==null?i.memoizedState:null}else i=ct.next;var s=pt===null?Qe.memoizedState:pt.next;if(s!==null)pt=s,ct=i;else{if(i===null)throw Error(r(310));ct=i,i={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},pt===null?Qe.memoizedState=pt=i:pt=pt.next=i}return pt}function an(i,s){return typeof s=="function"?s(i):s}function Il(i){var s=ci(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var c=ct,d=c.baseQueue,_=o.pending;if(_!==null){if(d!==null){var w=d.next;d.next=_.next,_.next=w}c.baseQueue=d=_,o.pending=null}if(d!==null){_=d.next,c=c.baseState;var D=w=null,z=null,J=_;do{var se=J.lane;if((jr&se)===se)z!==null&&(z=z.next={lane:0,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),c=J.hasEagerState?J.eagerState:i(c,J.action);else{var oe={lane:se,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null};z===null?(D=z=oe,w=c):z=z.next=oe,Qe.lanes|=se,Ar|=se}J=J.next}while(J!==null&&J!==_);z===null?w=c:z.next=D,vi(c,s.memoizedState)||(Wt=!0),s.memoizedState=c,s.baseState=w,s.baseQueue=z,o.lastRenderedState=c}if(i=o.interleaved,i!==null){d=i;do _=d.lane,Qe.lanes|=_,Ar|=_,d=d.next;while(d!==i)}else d===null&&(o.lanes=0);return[s.memoizedState,o.dispatch]}function Ol(i){var s=ci(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var c=o.dispatch,d=o.pending,_=s.memoizedState;if(d!==null){o.pending=null;var w=d=d.next;do _=i(_,w.action),w=w.next;while(w!==d);vi(_,s.memoizedState)||(Wt=!0),s.memoizedState=_,s.baseQueue===null&&(s.baseState=_),o.lastRenderedState=_}return[_,c]}function Gd(){}function Qd(i,s){var o=Qe,c=ci(),d=s(),_=!vi(c.memoizedState,d);if(_&&(c.memoizedState=d,Wt=!0),c=c.queue,zl(ef.bind(null,o,c,i),[i]),c.getSnapshot!==s||_||pt!==null&&pt.memoizedState.tag&1){if(o.flags|=2048,ln(9,Zd.bind(null,o,c,d,s),void 0,null),mt===null)throw Error(r(349));(jr&30)!==0||Jd(o,s,d)}return d}function Jd(i,s,o){i.flags|=16384,i={getSnapshot:s,value:o},s=Qe.updateQueue,s===null?(s={lastEffect:null,stores:null},Qe.updateQueue=s,s.stores=[i]):(o=s.stores,o===null?s.stores=[i]:o.push(i))}function Zd(i,s,o,c){s.value=o,s.getSnapshot=c,tf(s)&&rf(i)}function ef(i,s,o){return o(function(){tf(s)&&rf(i)})}function tf(i){var s=i.getSnapshot;i=i.value;try{var o=s();return!vi(i,o)}catch{return!0}}function rf(i){var s=Ui(i,1);s!==null&&bi(s,i,1,-1)}function sf(i){var s=Mi();return typeof i=="function"&&(i=i()),s.memoizedState=s.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:an,lastRenderedState:i},s.queue=i,i=i.dispatch=ly.bind(null,Qe,i),[s.memoizedState,i]}function ln(i,s,o,c){return i={tag:i,create:s,destroy:o,deps:c,next:null},s=Qe.updateQueue,s===null?(s={lastEffect:null,stores:null},Qe.updateQueue=s,s.lastEffect=i.next=i):(o=s.lastEffect,o===null?s.lastEffect=i.next=i:(c=o.next,o.next=i,i.next=c,s.lastEffect=i)),i}function nf(){return ci().memoizedState}function ko(i,s,o,c){var d=Mi();Qe.flags|=i,d.memoizedState=ln(1|s,o,void 0,c===void 0?null:c)}function Eo(i,s,o,c){var d=ci();c=c===void 0?null:c;var _=void 0;if(ct!==null){var w=ct.memoizedState;if(_=w.destroy,c!==null&&Bl(c,w.deps)){d.memoizedState=ln(s,o,_,c);return}}Qe.flags|=i,d.memoizedState=ln(1|s,o,_,c)}function of(i,s){return ko(8390656,8,i,s)}function zl(i,s){return Eo(2048,8,i,s)}function af(i,s){return Eo(4,2,i,s)}function lf(i,s){return Eo(4,4,i,s)}function cf(i,s){if(typeof s=="function")return i=i(),s(i),function(){s(null)};if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function hf(i,s,o){return o=o!=null?o.concat([i]):null,Eo(4,4,cf.bind(null,s,i),o)}function Fl(){}function uf(i,s){var o=ci();s=s===void 0?null:s;var c=o.memoizedState;return c!==null&&s!==null&&Bl(s,c[1])?c[0]:(o.memoizedState=[i,s],i)}function df(i,s){var o=ci();s=s===void 0?null:s;var c=o.memoizedState;return c!==null&&s!==null&&Bl(s,c[1])?c[0]:(i=i(),o.memoizedState=[i,s],i)}function ff(i,s,o){return(jr&21)===0?(i.baseState&&(i.baseState=!1,Wt=!0),i.memoizedState=o):(vi(o,s)||(o=Wu(),Qe.lanes|=o,Ar|=o,i.baseState=!0),s)}function oy(i,s){var o=We;We=o!==0&&4>o?o:4,i(!0);var c=Tl.transition;Tl.transition={};try{i(!1),s()}finally{We=o,Tl.transition=c}}function pf(){return ci().memoizedState}function ay(i,s,o){var c=_r(i);if(o={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null},mf(i))_f(s,o);else if(o=Kd(i,s,o,c),o!==null){var d=jt();bi(o,i,c,d),gf(o,s,c)}}function ly(i,s,o){var c=_r(i),d={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null};if(mf(i))_f(s,d);else{var _=i.alternate;if(i.lanes===0&&(_===null||_.lanes===0)&&(_=s.lastRenderedReducer,_!==null))try{var w=s.lastRenderedState,D=_(w,o);if(d.hasEagerState=!0,d.eagerState=D,vi(D,w)){var z=s.interleaved;z===null?(d.next=d,Nl(s)):(d.next=z.next,z.next=d),s.interleaved=d;return}}catch{}finally{}o=Kd(i,s,d,c),o!==null&&(d=jt(),bi(o,i,c,d),gf(o,s,c))}}function mf(i){var s=i.alternate;return i===Qe||s!==null&&s===Qe}function _f(i,s){nn=xo=!0;var o=i.pending;o===null?s.next=s:(s.next=o.next,o.next=s),i.pending=s}function gf(i,s,o){if((o&4194240)!==0){var c=s.lanes;c&=i.pendingLanes,o|=c,s.lanes=o,Wa(i,o)}}var No={readContext:li,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useInsertionEffect:Dt,useLayoutEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useMutableSource:Dt,useSyncExternalStore:Dt,useId:Dt,unstable_isNewReconciler:!1},cy={readContext:li,useCallback:function(i,s){return Mi().memoizedState=[i,s===void 0?null:s],i},useContext:li,useEffect:of,useImperativeHandle:function(i,s,o){return o=o!=null?o.concat([i]):null,ko(4194308,4,cf.bind(null,s,i),o)},useLayoutEffect:function(i,s){return ko(4194308,4,i,s)},useInsertionEffect:function(i,s){return ko(4,2,i,s)},useMemo:function(i,s){var o=Mi();return s=s===void 0?null:s,i=i(),o.memoizedState=[i,s],i},useReducer:function(i,s,o){var c=Mi();return s=o!==void 0?o(s):s,c.memoizedState=c.baseState=s,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:s},c.queue=i,i=i.dispatch=ay.bind(null,Qe,i),[c.memoizedState,i]},useRef:function(i){var s=Mi();return i={current:i},s.memoizedState=i},useState:sf,useDebugValue:Fl,useDeferredValue:function(i){return Mi().memoizedState=i},useTransition:function(){var i=sf(!1),s=i[0];return i=oy.bind(null,i[1]),Mi().memoizedState=i,[s,i]},useMutableSource:function(){},useSyncExternalStore:function(i,s,o){var c=Qe,d=Mi();if(Ye){if(o===void 0)throw Error(r(407));o=o()}else{if(o=s(),mt===null)throw Error(r(349));(jr&30)!==0||Jd(c,s,o)}d.memoizedState=o;var _={value:o,getSnapshot:s};return d.queue=_,of(ef.bind(null,c,_,i),[i]),c.flags|=2048,ln(9,Zd.bind(null,c,_,o,s),void 0,null),o},useId:function(){var i=Mi(),s=mt.identifierPrefix;if(Ye){var o=$i,c=Wi;o=(c&~(1<<32-gi(c)-1)).toString(32)+o,s=":"+s+"R"+o,o=on++,0<o&&(s+="H"+o.toString(32)),s+=":"}else o=ny++,s=":"+s+"r"+o.toString(32)+":";return i.memoizedState=s},unstable_isNewReconciler:!1},hy={readContext:li,useCallback:uf,useContext:li,useEffect:zl,useImperativeHandle:hf,useInsertionEffect:af,useLayoutEffect:lf,useMemo:df,useReducer:Il,useRef:nf,useState:function(){return Il(an)},useDebugValue:Fl,useDeferredValue:function(i){var s=ci();return ff(s,ct.memoizedState,i)},useTransition:function(){var i=Il(an)[0],s=ci().memoizedState;return[i,s]},useMutableSource:Gd,useSyncExternalStore:Qd,useId:pf,unstable_isNewReconciler:!1},uy={readContext:li,useCallback:uf,useContext:li,useEffect:zl,useImperativeHandle:hf,useInsertionEffect:af,useLayoutEffect:lf,useMemo:df,useReducer:Ol,useRef:nf,useState:function(){return Ol(an)},useDebugValue:Fl,useDeferredValue:function(i){var s=ci();return ct===null?s.memoizedState=i:ff(s,ct.memoizedState,i)},useTransition:function(){var i=Ol(an)[0],s=ci().memoizedState;return[i,s]},useMutableSource:Gd,useSyncExternalStore:Qd,useId:pf,unstable_isNewReconciler:!1};function Si(i,s){if(i&&i.defaultProps){s=te({},s),i=i.defaultProps;for(var o in i)s[o]===void 0&&(s[o]=i[o]);return s}return s}function Hl(i,s,o,c){s=i.memoizedState,o=o(c,s),o=o==null?s:te({},s,o),i.memoizedState=o,i.lanes===0&&(i.updateQueue.baseState=o)}var Ro={isMounted:function(i){return(i=i._reactInternals)?Rr(i)===i:!1},enqueueSetState:function(i,s,o){i=i._reactInternals;var c=jt(),d=_r(i),_=Ki(c,d);_.payload=s,o!=null&&(_.callback=o),s=dr(i,_,d),s!==null&&(bi(s,i,d,c),So(s,i,d))},enqueueReplaceState:function(i,s,o){i=i._reactInternals;var c=jt(),d=_r(i),_=Ki(c,d);_.tag=1,_.payload=s,o!=null&&(_.callback=o),s=dr(i,_,d),s!==null&&(bi(s,i,d,c),So(s,i,d))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var o=jt(),c=_r(i),d=Ki(o,c);d.tag=2,s!=null&&(d.callback=s),s=dr(i,d,c),s!==null&&(bi(s,i,c,o),So(s,i,c))}};function vf(i,s,o,c,d,_,w){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,_,w):s.prototype&&s.prototype.isPureReactComponent?!qs(o,c)||!qs(d,_):!0}function yf(i,s,o){var c=!1,d=cr,_=s.contextType;return typeof _=="object"&&_!==null?_=li(_):(d=Ht(s)?Mr:Rt.current,c=s.contextTypes,_=(c=c!=null)?cs(i,d):cr),s=new s(o,_),i.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Ro,i.stateNode=s,s._reactInternals=i,c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=d,i.__reactInternalMemoizedMaskedChildContext=_),s}function Sf(i,s,o,c){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,c),s.state!==i&&Ro.enqueueReplaceState(s,s.state,null)}function Wl(i,s,o,c){var d=i.stateNode;d.props=o,d.state=i.memoizedState,d.refs={},Rl(i);var _=s.contextType;typeof _=="object"&&_!==null?d.context=li(_):(_=Ht(s)?Mr:Rt.current,d.context=cs(i,_)),d.state=i.memoizedState,_=s.getDerivedStateFromProps,typeof _=="function"&&(Hl(i,s,_,o),d.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(s=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),s!==d.state&&Ro.enqueueReplaceState(d,d.state,null),wo(i,o,d,c),d.state=i.memoizedState),typeof d.componentDidMount=="function"&&(i.flags|=4194308)}function gs(i,s){try{var o="",c=s;do o+=ue(c),c=c.return;while(c);var d=o}catch(_){d=`
|
|
39
|
+
Error generating stack: `+_.message+`
|
|
40
|
+
`+_.stack}return{value:i,source:s,stack:d,digest:null}}function $l(i,s,o){return{value:i,source:null,stack:o??null,digest:s??null}}function Ul(i,s){try{console.error(s.value)}catch(o){setTimeout(function(){throw o})}}var dy=typeof WeakMap=="function"?WeakMap:Map;function wf(i,s,o){o=Ki(-1,o),o.tag=3,o.payload={element:null};var c=s.value;return o.callback=function(){jo||(jo=!0,nc=c),Ul(i,s)},o}function Cf(i,s,o){o=Ki(-1,o),o.tag=3;var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;o.payload=function(){return c(d)},o.callback=function(){Ul(i,s)}}var _=i.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(o.callback=function(){Ul(i,s),typeof c!="function"&&(pr===null?pr=new Set([this]):pr.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})}),o}function bf(i,s,o){var c=i.pingCache;if(c===null){c=i.pingCache=new dy;var d=new Set;c.set(s,d)}else d=c.get(s),d===void 0&&(d=new Set,c.set(s,d));d.has(o)||(d.add(o),i=Ey.bind(null,i,s,o),s.then(i,i))}function xf(i){do{var s;if((s=i.tag===13)&&(s=i.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return i;i=i.return}while(i!==null);return null}function kf(i,s,o,c,d){return(i.mode&1)===0?(i===s?i.flags|=65536:(i.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(s=Ki(-1,1),s.tag=2,dr(o,s,1))),o.lanes|=1),i):(i.flags|=65536,i.lanes=d,i)}var fy=L.ReactCurrentOwner,Wt=!1;function Bt(i,s,o,c){s.child=i===null?Ud(s,null,o,c):fs(s,i.child,o,c)}function Ef(i,s,o,c,d){o=o.render;var _=s.ref;return ms(s,d),c=jl(i,s,o,c,_,d),o=Al(),i!==null&&!Wt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~d,Vi(i,s,d)):(Ye&&o&&vl(s),s.flags|=1,Bt(i,s,c,d),s.child)}function Nf(i,s,o,c,d){if(i===null){var _=o.type;return typeof _=="function"&&!dc(_)&&_.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(s.tag=15,s.type=_,Rf(i,s,_,c,d)):(i=Ho(o.type,null,c,s,s.mode,d),i.ref=s.ref,i.return=s,s.child=i)}if(_=i.child,(i.lanes&d)===0){var w=_.memoizedProps;if(o=o.compare,o=o!==null?o:qs,o(w,c)&&i.ref===s.ref)return Vi(i,s,d)}return s.flags|=1,i=vr(_,c),i.ref=s.ref,i.return=s,s.child=i}function Rf(i,s,o,c,d){if(i!==null){var _=i.memoizedProps;if(qs(_,c)&&i.ref===s.ref)if(Wt=!1,s.pendingProps=c=_,(i.lanes&d)!==0)(i.flags&131072)!==0&&(Wt=!0);else return s.lanes=i.lanes,Vi(i,s,d)}return Kl(i,s,o,c,d)}function Df(i,s,o){var c=s.pendingProps,d=c.children,_=i!==null?i.memoizedState:null;if(c.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ue(ys,Jt),Jt|=o;else{if((o&1073741824)===0)return i=_!==null?_.baseLanes|o:o,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:i,cachePool:null,transitions:null},s.updateQueue=null,Ue(ys,Jt),Jt|=i,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=_!==null?_.baseLanes:o,Ue(ys,Jt),Jt|=c}else _!==null?(c=_.baseLanes|o,s.memoizedState=null):c=o,Ue(ys,Jt),Jt|=c;return Bt(i,s,d,o),s.child}function Mf(i,s){var o=s.ref;(i===null&&o!==null||i!==null&&i.ref!==o)&&(s.flags|=512,s.flags|=2097152)}function Kl(i,s,o,c,d){var _=Ht(o)?Mr:Rt.current;return _=cs(s,_),ms(s,d),o=jl(i,s,o,c,_,d),c=Al(),i!==null&&!Wt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~d,Vi(i,s,d)):(Ye&&c&&vl(s),s.flags|=1,Bt(i,s,o,d),s.child)}function Lf(i,s,o,c,d){if(Ht(o)){var _=!0;uo(s)}else _=!1;if(ms(s,d),s.stateNode===null)Mo(i,s),yf(s,o,c),Wl(s,o,c,d),c=!0;else if(i===null){var w=s.stateNode,D=s.memoizedProps;w.props=D;var z=w.context,J=o.contextType;typeof J=="object"&&J!==null?J=li(J):(J=Ht(o)?Mr:Rt.current,J=cs(s,J));var se=o.getDerivedStateFromProps,oe=typeof se=="function"||typeof w.getSnapshotBeforeUpdate=="function";oe||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(D!==c||z!==J)&&Sf(s,w,c,J),ur=!1;var re=s.memoizedState;w.state=re,wo(s,c,w,d),z=s.memoizedState,D!==c||re!==z||Ft.current||ur?(typeof se=="function"&&(Hl(s,o,se,c),z=s.memoizedState),(D=ur||vf(s,o,D,c,re,z,J))?(oe||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(s.flags|=4194308)):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=z),w.props=c,w.state=z,w.context=J,c=D):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{w=s.stateNode,Vd(i,s),D=s.memoizedProps,J=s.type===s.elementType?D:Si(s.type,D),w.props=J,oe=s.pendingProps,re=w.context,z=o.contextType,typeof z=="object"&&z!==null?z=li(z):(z=Ht(o)?Mr:Rt.current,z=cs(s,z));var fe=o.getDerivedStateFromProps;(se=typeof fe=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(D!==oe||re!==z)&&Sf(s,w,c,z),ur=!1,re=s.memoizedState,w.state=re,wo(s,c,w,d);var ve=s.memoizedState;D!==oe||re!==ve||Ft.current||ur?(typeof fe=="function"&&(Hl(s,o,fe,c),ve=s.memoizedState),(J=ur||vf(s,o,J,c,re,ve,z)||!1)?(se||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(c,ve,z),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(c,ve,z)),typeof w.componentDidUpdate=="function"&&(s.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof w.componentDidUpdate!="function"||D===i.memoizedProps&&re===i.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||D===i.memoizedProps&&re===i.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=ve),w.props=c,w.state=ve,w.context=z,c=J):(typeof w.componentDidUpdate!="function"||D===i.memoizedProps&&re===i.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||D===i.memoizedProps&&re===i.memoizedState||(s.flags|=1024),c=!1)}return Vl(i,s,o,c,_,d)}function Vl(i,s,o,c,d,_){Mf(i,s);var w=(s.flags&128)!==0;if(!c&&!w)return d&&jd(s,o,!1),Vi(i,s,_);c=s.stateNode,fy.current=s;var D=w&&typeof o.getDerivedStateFromError!="function"?null:c.render();return s.flags|=1,i!==null&&w?(s.child=fs(s,i.child,null,_),s.child=fs(s,null,D,_)):Bt(i,s,D,_),s.memoizedState=c.state,d&&jd(s,o,!0),s.child}function Pf(i){var s=i.stateNode;s.pendingContext?Td(i,s.pendingContext,s.pendingContext!==s.context):s.context&&Td(i,s.context,!1),Dl(i,s.containerInfo)}function Tf(i,s,o,c,d){return ds(),Cl(d),s.flags|=256,Bt(i,s,o,c),s.child}var ql={dehydrated:null,treeContext:null,retryLane:0};function Yl(i){return{baseLanes:i,cachePool:null,transitions:null}}function Bf(i,s,o){var c=s.pendingProps,d=Ge.current,_=!1,w=(s.flags&128)!==0,D;if((D=w)||(D=i!==null&&i.memoizedState===null?!1:(d&2)!==0),D?(_=!0,s.flags&=-129):(i===null||i.memoizedState!==null)&&(d|=1),Ue(Ge,d&1),i===null)return wl(s),i=s.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((s.mode&1)===0?s.lanes=1:i.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(w=c.children,i=c.fallback,_?(c=s.mode,_=s.child,w={mode:"hidden",children:w},(c&1)===0&&_!==null?(_.childLanes=0,_.pendingProps=w):_=Wo(w,c,0,null),i=Fr(i,c,o,null),_.return=s,i.return=s,_.sibling=i,s.child=_,s.child.memoizedState=Yl(o),s.memoizedState=ql,i):Xl(s,w));if(d=i.memoizedState,d!==null&&(D=d.dehydrated,D!==null))return py(i,s,w,c,D,d,o);if(_){_=c.fallback,w=s.mode,d=i.child,D=d.sibling;var z={mode:"hidden",children:c.children};return(w&1)===0&&s.child!==d?(c=s.child,c.childLanes=0,c.pendingProps=z,s.deletions=null):(c=vr(d,z),c.subtreeFlags=d.subtreeFlags&14680064),D!==null?_=vr(D,_):(_=Fr(_,w,o,null),_.flags|=2),_.return=s,c.return=s,c.sibling=_,s.child=c,c=_,_=s.child,w=i.child.memoizedState,w=w===null?Yl(o):{baseLanes:w.baseLanes|o,cachePool:null,transitions:w.transitions},_.memoizedState=w,_.childLanes=i.childLanes&~o,s.memoizedState=ql,c}return _=i.child,i=_.sibling,c=vr(_,{mode:"visible",children:c.children}),(s.mode&1)===0&&(c.lanes=o),c.return=s,c.sibling=null,i!==null&&(o=s.deletions,o===null?(s.deletions=[i],s.flags|=16):o.push(i)),s.child=c,s.memoizedState=null,c}function Xl(i,s){return s=Wo({mode:"visible",children:s},i.mode,0,null),s.return=i,i.child=s}function Do(i,s,o,c){return c!==null&&Cl(c),fs(s,i.child,null,o),i=Xl(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function py(i,s,o,c,d,_,w){if(o)return s.flags&256?(s.flags&=-257,c=$l(Error(r(422))),Do(i,s,w,c)):s.memoizedState!==null?(s.child=i.child,s.flags|=128,null):(_=c.fallback,d=s.mode,c=Wo({mode:"visible",children:c.children},d,0,null),_=Fr(_,d,w,null),_.flags|=2,c.return=s,_.return=s,c.sibling=_,s.child=c,(s.mode&1)!==0&&fs(s,i.child,null,w),s.child.memoizedState=Yl(w),s.memoizedState=ql,_);if((s.mode&1)===0)return Do(i,s,w,null);if(d.data==="$!"){if(c=d.nextSibling&&d.nextSibling.dataset,c)var D=c.dgst;return c=D,_=Error(r(419)),c=$l(_,c,void 0),Do(i,s,w,c)}if(D=(w&i.childLanes)!==0,Wt||D){if(c=mt,c!==null){switch(w&-w){case 4:d=2;break;case 16:d=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:d=32;break;case 536870912:d=268435456;break;default:d=0}d=(d&(c.suspendedLanes|w))!==0?0:d,d!==0&&d!==_.retryLane&&(_.retryLane=d,Ui(i,d),bi(c,i,d,-1))}return uc(),c=$l(Error(r(421))),Do(i,s,w,c)}return d.data==="$?"?(s.flags|=128,s.child=i.child,s=Ny.bind(null,i),d._reactRetry=s,null):(i=_.treeContext,Qt=ar(d.nextSibling),Gt=s,Ye=!0,yi=null,i!==null&&(oi[ai++]=Wi,oi[ai++]=$i,oi[ai++]=Lr,Wi=i.id,$i=i.overflow,Lr=s),s=Xl(s,c.children),s.flags|=4096,s)}function jf(i,s,o){i.lanes|=s;var c=i.alternate;c!==null&&(c.lanes|=s),El(i.return,s,o)}function Gl(i,s,o,c,d){var _=i.memoizedState;_===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:d}:(_.isBackwards=s,_.rendering=null,_.renderingStartTime=0,_.last=c,_.tail=o,_.tailMode=d)}function Af(i,s,o){var c=s.pendingProps,d=c.revealOrder,_=c.tail;if(Bt(i,s,c.children,o),c=Ge.current,(c&2)!==0)c=c&1|2,s.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&jf(i,o,s);else if(i.tag===19)jf(i,o,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}c&=1}if(Ue(Ge,c),(s.mode&1)===0)s.memoizedState=null;else switch(d){case"forwards":for(o=s.child,d=null;o!==null;)i=o.alternate,i!==null&&Co(i)===null&&(d=o),o=o.sibling;o=d,o===null?(d=s.child,s.child=null):(d=o.sibling,o.sibling=null),Gl(s,!1,d,o,_);break;case"backwards":for(o=null,d=s.child,s.child=null;d!==null;){if(i=d.alternate,i!==null&&Co(i)===null){s.child=d;break}i=d.sibling,d.sibling=o,o=d,d=i}Gl(s,!0,o,null,_);break;case"together":Gl(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Mo(i,s){(s.mode&1)===0&&i!==null&&(i.alternate=null,s.alternate=null,s.flags|=2)}function Vi(i,s,o){if(i!==null&&(s.dependencies=i.dependencies),Ar|=s.lanes,(o&s.childLanes)===0)return null;if(i!==null&&s.child!==i.child)throw Error(r(153));if(s.child!==null){for(i=s.child,o=vr(i,i.pendingProps),s.child=o,o.return=s;i.sibling!==null;)i=i.sibling,o=o.sibling=vr(i,i.pendingProps),o.return=s;o.sibling=null}return s.child}function my(i,s,o){switch(s.tag){case 3:Pf(s),ds();break;case 5:Xd(s);break;case 1:Ht(s.type)&&uo(s);break;case 4:Dl(s,s.stateNode.containerInfo);break;case 10:var c=s.type._context,d=s.memoizedProps.value;Ue(vo,c._currentValue),c._currentValue=d;break;case 13:if(c=s.memoizedState,c!==null)return c.dehydrated!==null?(Ue(Ge,Ge.current&1),s.flags|=128,null):(o&s.child.childLanes)!==0?Bf(i,s,o):(Ue(Ge,Ge.current&1),i=Vi(i,s,o),i!==null?i.sibling:null);Ue(Ge,Ge.current&1);break;case 19:if(c=(o&s.childLanes)!==0,(i.flags&128)!==0){if(c)return Af(i,s,o);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),Ue(Ge,Ge.current),c)break;return null;case 22:case 23:return s.lanes=0,Df(i,s,o)}return Vi(i,s,o)}var If,Ql,Of,zf;If=function(i,s){for(var o=s.child;o!==null;){if(o.tag===5||o.tag===6)i.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},Ql=function(){},Of=function(i,s,o,c){var d=i.memoizedProps;if(d!==c){i=s.stateNode,Br(Di.current);var _=null;switch(o){case"input":d=He(i,d),c=He(i,c),_=[];break;case"select":d=te({},d,{value:void 0}),c=te({},c,{value:void 0}),_=[];break;case"textarea":d=pe(i,d),c=pe(i,c),_=[];break;default:typeof d.onClick!="function"&&typeof c.onClick=="function"&&(i.onclick=lo)}La(o,c);var w;o=null;for(J in d)if(!c.hasOwnProperty(J)&&d.hasOwnProperty(J)&&d[J]!=null)if(J==="style"){var D=d[J];for(w in D)D.hasOwnProperty(w)&&(o||(o={}),o[w]="")}else J!=="dangerouslySetInnerHTML"&&J!=="children"&&J!=="suppressContentEditableWarning"&&J!=="suppressHydrationWarning"&&J!=="autoFocus"&&(a.hasOwnProperty(J)?_||(_=[]):(_=_||[]).push(J,null));for(J in c){var z=c[J];if(D=d!=null?d[J]:void 0,c.hasOwnProperty(J)&&z!==D&&(z!=null||D!=null))if(J==="style")if(D){for(w in D)!D.hasOwnProperty(w)||z&&z.hasOwnProperty(w)||(o||(o={}),o[w]="");for(w in z)z.hasOwnProperty(w)&&D[w]!==z[w]&&(o||(o={}),o[w]=z[w])}else o||(_||(_=[]),_.push(J,o)),o=z;else J==="dangerouslySetInnerHTML"?(z=z?z.__html:void 0,D=D?D.__html:void 0,z!=null&&D!==z&&(_=_||[]).push(J,z)):J==="children"?typeof z!="string"&&typeof z!="number"||(_=_||[]).push(J,""+z):J!=="suppressContentEditableWarning"&&J!=="suppressHydrationWarning"&&(a.hasOwnProperty(J)?(z!=null&&J==="onScroll"&&Ke("scroll",i),_||D===z||(_=[])):(_=_||[]).push(J,z))}o&&(_=_||[]).push("style",o);var J=_;(s.updateQueue=J)&&(s.flags|=4)}},zf=function(i,s,o,c){o!==c&&(s.flags|=4)};function cn(i,s){if(!Ye)switch(i.tailMode){case"hidden":s=i.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?i.tail=null:o.sibling=null;break;case"collapsed":o=i.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function Mt(i){var s=i.alternate!==null&&i.alternate.child===i.child,o=0,c=0;if(s)for(var d=i.child;d!==null;)o|=d.lanes|d.childLanes,c|=d.subtreeFlags&14680064,c|=d.flags&14680064,d.return=i,d=d.sibling;else for(d=i.child;d!==null;)o|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=i,d=d.sibling;return i.subtreeFlags|=c,i.childLanes=o,s}function _y(i,s,o){var c=s.pendingProps;switch(yl(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(s),null;case 1:return Ht(s.type)&&ho(),Mt(s),null;case 3:return c=s.stateNode,_s(),Ve(Ft),Ve(Rt),Pl(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(_o(s)?s.flags|=4:i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,yi!==null&&(lc(yi),yi=null))),Ql(i,s),Mt(s),null;case 5:Ml(s);var d=Br(sn.current);if(o=s.type,i!==null&&s.stateNode!=null)Of(i,s,o,c,d),i.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!c){if(s.stateNode===null)throw Error(r(166));return Mt(s),null}if(i=Br(Di.current),_o(s)){c=s.stateNode,o=s.type;var _=s.memoizedProps;switch(c[Ri]=s,c[Js]=_,i=(s.mode&1)!==0,o){case"dialog":Ke("cancel",c),Ke("close",c);break;case"iframe":case"object":case"embed":Ke("load",c);break;case"video":case"audio":for(d=0;d<Xs.length;d++)Ke(Xs[d],c);break;case"source":Ke("error",c);break;case"img":case"image":case"link":Ke("error",c),Ke("load",c);break;case"details":Ke("toggle",c);break;case"input":Me(c,_),Ke("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!_.multiple},Ke("invalid",c);break;case"textarea":Ae(c,_),Ke("invalid",c)}La(o,_),d=null;for(var w in _)if(_.hasOwnProperty(w)){var D=_[w];w==="children"?typeof D=="string"?c.textContent!==D&&(_.suppressHydrationWarning!==!0&&ao(c.textContent,D,i),d=["children",D]):typeof D=="number"&&c.textContent!==""+D&&(_.suppressHydrationWarning!==!0&&ao(c.textContent,D,i),d=["children",""+D]):a.hasOwnProperty(w)&&D!=null&&w==="onScroll"&&Ke("scroll",c)}switch(o){case"input":Y(c),ii(c,_,!0);break;case"textarea":Y(c),Tt(c);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(c.onclick=lo)}c=d,s.updateQueue=c,c!==null&&(s.flags|=4)}else{w=d.nodeType===9?d:d.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=ni(o)),i==="http://www.w3.org/1999/xhtml"?o==="script"?(i=w.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof c.is=="string"?i=w.createElement(o,{is:c.is}):(i=w.createElement(o),o==="select"&&(w=i,c.multiple?w.multiple=!0:c.size&&(w.size=c.size))):i=w.createElementNS(i,o),i[Ri]=s,i[Js]=c,If(i,s,!1,!1),s.stateNode=i;e:{switch(w=Pa(o,c),o){case"dialog":Ke("cancel",i),Ke("close",i),d=c;break;case"iframe":case"object":case"embed":Ke("load",i),d=c;break;case"video":case"audio":for(d=0;d<Xs.length;d++)Ke(Xs[d],i);d=c;break;case"source":Ke("error",i),d=c;break;case"img":case"image":case"link":Ke("error",i),Ke("load",i),d=c;break;case"details":Ke("toggle",i),d=c;break;case"input":Me(i,c),d=He(i,c),Ke("invalid",i);break;case"option":d=c;break;case"select":i._wrapperState={wasMultiple:!!c.multiple},d=te({},c,{value:void 0}),Ke("invalid",i);break;case"textarea":Ae(i,c),d=pe(i,c),Ke("invalid",i);break;default:d=c}La(o,d),D=d;for(_ in D)if(D.hasOwnProperty(_)){var z=D[_];_==="style"?Nu(i,z):_==="dangerouslySetInnerHTML"?(z=z?z.__html:void 0,z!=null&&Fn(i,z)):_==="children"?typeof z=="string"?(o!=="textarea"||z!=="")&&he(i,z):typeof z=="number"&&he(i,""+z):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(a.hasOwnProperty(_)?z!=null&&_==="onScroll"&&Ke("scroll",i):z!=null&&M(i,_,z,w))}switch(o){case"input":Y(i),ii(i,c,!1);break;case"textarea":Y(i),Tt(i);break;case"option":c.value!=null&&i.setAttribute("value",""+be(c.value));break;case"select":i.multiple=!!c.multiple,_=c.value,_!=null?zt(i,!!c.multiple,_,!1):c.defaultValue!=null&&zt(i,!!c.multiple,c.defaultValue,!0);break;default:typeof d.onClick=="function"&&(i.onclick=lo)}switch(o){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Mt(s),null;case 6:if(i&&s.stateNode!=null)zf(i,s,i.memoizedProps,c);else{if(typeof c!="string"&&s.stateNode===null)throw Error(r(166));if(o=Br(sn.current),Br(Di.current),_o(s)){if(c=s.stateNode,o=s.memoizedProps,c[Ri]=s,(_=c.nodeValue!==o)&&(i=Gt,i!==null))switch(i.tag){case 3:ao(c.nodeValue,o,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&ao(c.nodeValue,o,(i.mode&1)!==0)}_&&(s.flags|=4)}else c=(o.nodeType===9?o:o.ownerDocument).createTextNode(c),c[Ri]=s,s.stateNode=c}return Mt(s),null;case 13:if(Ve(Ge),c=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(Ye&&Qt!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Hd(),ds(),s.flags|=98560,_=!1;else if(_=_o(s),c!==null&&c.dehydrated!==null){if(i===null){if(!_)throw Error(r(318));if(_=s.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(r(317));_[Ri]=s}else ds(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Mt(s),_=!1}else yi!==null&&(lc(yi),yi=null),_=!0;if(!_)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=o,s):(c=c!==null,c!==(i!==null&&i.memoizedState!==null)&&c&&(s.child.flags|=8192,(s.mode&1)!==0&&(i===null||(Ge.current&1)!==0?ht===0&&(ht=3):uc())),s.updateQueue!==null&&(s.flags|=4),Mt(s),null);case 4:return _s(),Ql(i,s),i===null&&Gs(s.stateNode.containerInfo),Mt(s),null;case 10:return kl(s.type._context),Mt(s),null;case 17:return Ht(s.type)&&ho(),Mt(s),null;case 19:if(Ve(Ge),_=s.memoizedState,_===null)return Mt(s),null;if(c=(s.flags&128)!==0,w=_.rendering,w===null)if(c)cn(_,!1);else{if(ht!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(w=Co(i),w!==null){for(s.flags|=128,cn(_,!1),c=w.updateQueue,c!==null&&(s.updateQueue=c,s.flags|=4),s.subtreeFlags=0,c=o,o=s.child;o!==null;)_=o,i=c,_.flags&=14680066,w=_.alternate,w===null?(_.childLanes=0,_.lanes=i,_.child=null,_.subtreeFlags=0,_.memoizedProps=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null,_.stateNode=null):(_.childLanes=w.childLanes,_.lanes=w.lanes,_.child=w.child,_.subtreeFlags=0,_.deletions=null,_.memoizedProps=w.memoizedProps,_.memoizedState=w.memoizedState,_.updateQueue=w.updateQueue,_.type=w.type,i=w.dependencies,_.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),o=o.sibling;return Ue(Ge,Ge.current&1|2),s.child}i=i.sibling}_.tail!==null&&rt()>Ss&&(s.flags|=128,c=!0,cn(_,!1),s.lanes=4194304)}else{if(!c)if(i=Co(w),i!==null){if(s.flags|=128,c=!0,o=i.updateQueue,o!==null&&(s.updateQueue=o,s.flags|=4),cn(_,!0),_.tail===null&&_.tailMode==="hidden"&&!w.alternate&&!Ye)return Mt(s),null}else 2*rt()-_.renderingStartTime>Ss&&o!==1073741824&&(s.flags|=128,c=!0,cn(_,!1),s.lanes=4194304);_.isBackwards?(w.sibling=s.child,s.child=w):(o=_.last,o!==null?o.sibling=w:s.child=w,_.last=w)}return _.tail!==null?(s=_.tail,_.rendering=s,_.tail=s.sibling,_.renderingStartTime=rt(),s.sibling=null,o=Ge.current,Ue(Ge,c?o&1|2:o&1),s):(Mt(s),null);case 22:case 23:return hc(),c=s.memoizedState!==null,i!==null&&i.memoizedState!==null!==c&&(s.flags|=8192),c&&(s.mode&1)!==0?(Jt&1073741824)!==0&&(Mt(s),s.subtreeFlags&6&&(s.flags|=8192)):Mt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function gy(i,s){switch(yl(s),s.tag){case 1:return Ht(s.type)&&ho(),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return _s(),Ve(Ft),Ve(Rt),Pl(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 5:return Ml(s),null;case 13:if(Ve(Ge),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ds()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return Ve(Ge),null;case 4:return _s(),null;case 10:return kl(s.type._context),null;case 22:case 23:return hc(),null;case 24:return null;default:return null}}var Lo=!1,Lt=!1,vy=typeof WeakSet=="function"?WeakSet:Set,_e=null;function vs(i,s){var o=i.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(c){et(i,s,c)}else o.current=null}function Jl(i,s,o){try{o()}catch(c){et(i,s,c)}}var Ff=!1;function yy(i,s){if(hl=Gn,i=gd(),il(i)){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else e:{o=(o=i.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var d=c.anchorOffset,_=c.focusNode;c=c.focusOffset;try{o.nodeType,_.nodeType}catch{o=null;break e}var w=0,D=-1,z=-1,J=0,se=0,oe=i,re=null;t:for(;;){for(var fe;oe!==o||d!==0&&oe.nodeType!==3||(D=w+d),oe!==_||c!==0&&oe.nodeType!==3||(z=w+c),oe.nodeType===3&&(w+=oe.nodeValue.length),(fe=oe.firstChild)!==null;)re=oe,oe=fe;for(;;){if(oe===i)break t;if(re===o&&++J===d&&(D=w),re===_&&++se===c&&(z=w),(fe=oe.nextSibling)!==null)break;oe=re,re=oe.parentNode}oe=fe}o=D===-1||z===-1?null:{start:D,end:z}}else o=null}o=o||{start:0,end:0}}else o=null;for(ul={focusedElem:i,selectionRange:o},Gn=!1,_e=s;_e!==null;)if(s=_e,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,_e=i;else for(;_e!==null;){s=_e;try{var ve=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(ve!==null){var Se=ve.memoizedProps,st=ve.memoizedState,q=s.stateNode,H=q.getSnapshotBeforeUpdate(s.elementType===s.type?Se:Si(s.type,Se),st);q.__reactInternalSnapshotBeforeUpdate=H}break;case 3:var X=s.stateNode.containerInfo;X.nodeType===1?X.textContent="":X.nodeType===9&&X.documentElement&&X.removeChild(X.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ae){et(s,s.return,ae)}if(i=s.sibling,i!==null){i.return=s.return,_e=i;break}_e=s.return}return ve=Ff,Ff=!1,ve}function hn(i,s,o){var c=s.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var d=c=c.next;do{if((d.tag&i)===i){var _=d.destroy;d.destroy=void 0,_!==void 0&&Jl(s,o,_)}d=d.next}while(d!==c)}}function Po(i,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var o=s=s.next;do{if((o.tag&i)===i){var c=o.create;o.destroy=c()}o=o.next}while(o!==s)}}function Zl(i){var s=i.ref;if(s!==null){var o=i.stateNode;switch(i.tag){case 5:i=o;break;default:i=o}typeof s=="function"?s(i):s.current=i}}function Hf(i){var s=i.alternate;s!==null&&(i.alternate=null,Hf(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&(delete s[Ri],delete s[Js],delete s[ml],delete s[ty],delete s[iy])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Wf(i){return i.tag===5||i.tag===3||i.tag===4}function $f(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Wf(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function ec(i,s,o){var c=i.tag;if(c===5||c===6)i=i.stateNode,s?o.nodeType===8?o.parentNode.insertBefore(i,s):o.insertBefore(i,s):(o.nodeType===8?(s=o.parentNode,s.insertBefore(i,o)):(s=o,s.appendChild(i)),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=lo));else if(c!==4&&(i=i.child,i!==null))for(ec(i,s,o),i=i.sibling;i!==null;)ec(i,s,o),i=i.sibling}function tc(i,s,o){var c=i.tag;if(c===5||c===6)i=i.stateNode,s?o.insertBefore(i,s):o.appendChild(i);else if(c!==4&&(i=i.child,i!==null))for(tc(i,s,o),i=i.sibling;i!==null;)tc(i,s,o),i=i.sibling}var xt=null,wi=!1;function fr(i,s,o){for(o=o.child;o!==null;)Uf(i,s,o),o=o.sibling}function Uf(i,s,o){if(Ni&&typeof Ni.onCommitFiberUnmount=="function")try{Ni.onCommitFiberUnmount(Un,o)}catch{}switch(o.tag){case 5:Lt||vs(o,s);case 6:var c=xt,d=wi;xt=null,fr(i,s,o),xt=c,wi=d,xt!==null&&(wi?(i=xt,o=o.stateNode,i.nodeType===8?i.parentNode.removeChild(o):i.removeChild(o)):xt.removeChild(o.stateNode));break;case 18:xt!==null&&(wi?(i=xt,o=o.stateNode,i.nodeType===8?pl(i.parentNode,o):i.nodeType===1&&pl(i,o),Hs(i)):pl(xt,o.stateNode));break;case 4:c=xt,d=wi,xt=o.stateNode.containerInfo,wi=!0,fr(i,s,o),xt=c,wi=d;break;case 0:case 11:case 14:case 15:if(!Lt&&(c=o.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){d=c=c.next;do{var _=d,w=_.destroy;_=_.tag,w!==void 0&&((_&2)!==0||(_&4)!==0)&&Jl(o,s,w),d=d.next}while(d!==c)}fr(i,s,o);break;case 1:if(!Lt&&(vs(o,s),c=o.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=o.memoizedProps,c.state=o.memoizedState,c.componentWillUnmount()}catch(D){et(o,s,D)}fr(i,s,o);break;case 21:fr(i,s,o);break;case 22:o.mode&1?(Lt=(c=Lt)||o.memoizedState!==null,fr(i,s,o),Lt=c):fr(i,s,o);break;default:fr(i,s,o)}}function Kf(i){var s=i.updateQueue;if(s!==null){i.updateQueue=null;var o=i.stateNode;o===null&&(o=i.stateNode=new vy),s.forEach(function(c){var d=Ry.bind(null,i,c);o.has(c)||(o.add(c),c.then(d,d))})}}function Ci(i,s){var o=s.deletions;if(o!==null)for(var c=0;c<o.length;c++){var d=o[c];try{var _=i,w=s,D=w;e:for(;D!==null;){switch(D.tag){case 5:xt=D.stateNode,wi=!1;break e;case 3:xt=D.stateNode.containerInfo,wi=!0;break e;case 4:xt=D.stateNode.containerInfo,wi=!0;break e}D=D.return}if(xt===null)throw Error(r(160));Uf(_,w,d),xt=null,wi=!1;var z=d.alternate;z!==null&&(z.return=null),d.return=null}catch(J){et(d,s,J)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Vf(s,i),s=s.sibling}function Vf(i,s){var o=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(Ci(s,i),Li(i),c&4){try{hn(3,i,i.return),Po(3,i)}catch(Se){et(i,i.return,Se)}try{hn(5,i,i.return)}catch(Se){et(i,i.return,Se)}}break;case 1:Ci(s,i),Li(i),c&512&&o!==null&&vs(o,o.return);break;case 5:if(Ci(s,i),Li(i),c&512&&o!==null&&vs(o,o.return),i.flags&32){var d=i.stateNode;try{he(d,"")}catch(Se){et(i,i.return,Se)}}if(c&4&&(d=i.stateNode,d!=null)){var _=i.memoizedProps,w=o!==null?o.memoizedProps:_,D=i.type,z=i.updateQueue;if(i.updateQueue=null,z!==null)try{D==="input"&&_.type==="radio"&&_.name!=null&&Nr(d,_),Pa(D,w);var J=Pa(D,_);for(w=0;w<z.length;w+=2){var se=z[w],oe=z[w+1];se==="style"?Nu(d,oe):se==="dangerouslySetInnerHTML"?Fn(d,oe):se==="children"?he(d,oe):M(d,se,oe,J)}switch(D){case"input":Zi(d,_);break;case"textarea":bt(d,_);break;case"select":var re=d._wrapperState.wasMultiple;d._wrapperState.wasMultiple=!!_.multiple;var fe=_.value;fe!=null?zt(d,!!_.multiple,fe,!1):re!==!!_.multiple&&(_.defaultValue!=null?zt(d,!!_.multiple,_.defaultValue,!0):zt(d,!!_.multiple,_.multiple?[]:"",!1))}d[Js]=_}catch(Se){et(i,i.return,Se)}}break;case 6:if(Ci(s,i),Li(i),c&4){if(i.stateNode===null)throw Error(r(162));d=i.stateNode,_=i.memoizedProps;try{d.nodeValue=_}catch(Se){et(i,i.return,Se)}}break;case 3:if(Ci(s,i),Li(i),c&4&&o!==null&&o.memoizedState.isDehydrated)try{Hs(s.containerInfo)}catch(Se){et(i,i.return,Se)}break;case 4:Ci(s,i),Li(i);break;case 13:Ci(s,i),Li(i),d=i.child,d.flags&8192&&(_=d.memoizedState!==null,d.stateNode.isHidden=_,!_||d.alternate!==null&&d.alternate.memoizedState!==null||(sc=rt())),c&4&&Kf(i);break;case 22:if(se=o!==null&&o.memoizedState!==null,i.mode&1?(Lt=(J=Lt)||se,Ci(s,i),Lt=J):Ci(s,i),Li(i),c&8192){if(J=i.memoizedState!==null,(i.stateNode.isHidden=J)&&!se&&(i.mode&1)!==0)for(_e=i,se=i.child;se!==null;){for(oe=_e=se;_e!==null;){switch(re=_e,fe=re.child,re.tag){case 0:case 11:case 14:case 15:hn(4,re,re.return);break;case 1:vs(re,re.return);var ve=re.stateNode;if(typeof ve.componentWillUnmount=="function"){c=re,o=re.return;try{s=c,ve.props=s.memoizedProps,ve.state=s.memoizedState,ve.componentWillUnmount()}catch(Se){et(c,o,Se)}}break;case 5:vs(re,re.return);break;case 22:if(re.memoizedState!==null){Xf(oe);continue}}fe!==null?(fe.return=re,_e=fe):Xf(oe)}se=se.sibling}e:for(se=null,oe=i;;){if(oe.tag===5){if(se===null){se=oe;try{d=oe.stateNode,J?(_=d.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(D=oe.stateNode,z=oe.memoizedProps.style,w=z!=null&&z.hasOwnProperty("display")?z.display:null,D.style.display=Ls("display",w))}catch(Se){et(i,i.return,Se)}}}else if(oe.tag===6){if(se===null)try{oe.stateNode.nodeValue=J?"":oe.memoizedProps}catch(Se){et(i,i.return,Se)}}else if((oe.tag!==22&&oe.tag!==23||oe.memoizedState===null||oe===i)&&oe.child!==null){oe.child.return=oe,oe=oe.child;continue}if(oe===i)break e;for(;oe.sibling===null;){if(oe.return===null||oe.return===i)break e;se===oe&&(se=null),oe=oe.return}se===oe&&(se=null),oe.sibling.return=oe.return,oe=oe.sibling}}break;case 19:Ci(s,i),Li(i),c&4&&Kf(i);break;case 21:break;default:Ci(s,i),Li(i)}}function Li(i){var s=i.flags;if(s&2){try{e:{for(var o=i.return;o!==null;){if(Wf(o)){var c=o;break e}o=o.return}throw Error(r(160))}switch(c.tag){case 5:var d=c.stateNode;c.flags&32&&(he(d,""),c.flags&=-33);var _=$f(i);tc(i,_,d);break;case 3:case 4:var w=c.stateNode.containerInfo,D=$f(i);ec(i,D,w);break;default:throw Error(r(161))}}catch(z){et(i,i.return,z)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function Sy(i,s,o){_e=i,qf(i)}function qf(i,s,o){for(var c=(i.mode&1)!==0;_e!==null;){var d=_e,_=d.child;if(d.tag===22&&c){var w=d.memoizedState!==null||Lo;if(!w){var D=d.alternate,z=D!==null&&D.memoizedState!==null||Lt;D=Lo;var J=Lt;if(Lo=w,(Lt=z)&&!J)for(_e=d;_e!==null;)w=_e,z=w.child,w.tag===22&&w.memoizedState!==null?Gf(d):z!==null?(z.return=w,_e=z):Gf(d);for(;_!==null;)_e=_,qf(_),_=_.sibling;_e=d,Lo=D,Lt=J}Yf(i)}else(d.subtreeFlags&8772)!==0&&_!==null?(_.return=d,_e=_):Yf(i)}}function Yf(i){for(;_e!==null;){var s=_e;if((s.flags&8772)!==0){var o=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Lt||Po(5,s);break;case 1:var c=s.stateNode;if(s.flags&4&&!Lt)if(o===null)c.componentDidMount();else{var d=s.elementType===s.type?o.memoizedProps:Si(s.type,o.memoizedProps);c.componentDidUpdate(d,o.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var _=s.updateQueue;_!==null&&Yd(s,_,c);break;case 3:var w=s.updateQueue;if(w!==null){if(o=null,s.child!==null)switch(s.child.tag){case 5:o=s.child.stateNode;break;case 1:o=s.child.stateNode}Yd(s,w,o)}break;case 5:var D=s.stateNode;if(o===null&&s.flags&4){o=D;var z=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":z.autoFocus&&o.focus();break;case"img":z.src&&(o.src=z.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var J=s.alternate;if(J!==null){var se=J.memoizedState;if(se!==null){var oe=se.dehydrated;oe!==null&&Hs(oe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Lt||s.flags&512&&Zl(s)}catch(re){et(s,s.return,re)}}if(s===i){_e=null;break}if(o=s.sibling,o!==null){o.return=s.return,_e=o;break}_e=s.return}}function Xf(i){for(;_e!==null;){var s=_e;if(s===i){_e=null;break}var o=s.sibling;if(o!==null){o.return=s.return,_e=o;break}_e=s.return}}function Gf(i){for(;_e!==null;){var s=_e;try{switch(s.tag){case 0:case 11:case 15:var o=s.return;try{Po(4,s)}catch(z){et(s,o,z)}break;case 1:var c=s.stateNode;if(typeof c.componentDidMount=="function"){var d=s.return;try{c.componentDidMount()}catch(z){et(s,d,z)}}var _=s.return;try{Zl(s)}catch(z){et(s,_,z)}break;case 5:var w=s.return;try{Zl(s)}catch(z){et(s,w,z)}}}catch(z){et(s,s.return,z)}if(s===i){_e=null;break}var D=s.sibling;if(D!==null){D.return=s.return,_e=D;break}_e=s.return}}var wy=Math.ceil,To=L.ReactCurrentDispatcher,ic=L.ReactCurrentOwner,hi=L.ReactCurrentBatchConfig,Ie=0,mt=null,ot=null,kt=0,Jt=0,ys=lr(0),ht=0,un=null,Ar=0,Bo=0,rc=0,dn=null,$t=null,sc=0,Ss=1/0,qi=null,jo=!1,nc=null,pr=null,Ao=!1,mr=null,Io=0,fn=0,oc=null,Oo=-1,zo=0;function jt(){return(Ie&6)!==0?rt():Oo!==-1?Oo:Oo=rt()}function _r(i){return(i.mode&1)===0?1:(Ie&2)!==0&&kt!==0?kt&-kt:sy.transition!==null?(zo===0&&(zo=Wu()),zo):(i=We,i!==0||(i=window.event,i=i===void 0?16:Qu(i.type)),i)}function bi(i,s,o,c){if(50<fn)throw fn=0,oc=null,Error(r(185));As(i,o,c),((Ie&2)===0||i!==mt)&&(i===mt&&((Ie&2)===0&&(Bo|=o),ht===4&&gr(i,kt)),Ut(i,c),o===1&&Ie===0&&(s.mode&1)===0&&(Ss=rt()+500,fo&&hr()))}function Ut(i,s){var o=i.callbackNode;sv(i,s);var c=qn(i,i===mt?kt:0);if(c===0)o!==null&&zu(o),i.callbackNode=null,i.callbackPriority=0;else if(s=c&-c,i.callbackPriority!==s){if(o!=null&&zu(o),s===1)i.tag===0?ry(Jf.bind(null,i)):Ad(Jf.bind(null,i)),Zv(function(){(Ie&6)===0&&hr()}),o=null;else{switch($u(c)){case 1:o=za;break;case 4:o=Fu;break;case 16:o=$n;break;case 536870912:o=Hu;break;default:o=$n}o=op(o,Qf.bind(null,i))}i.callbackPriority=s,i.callbackNode=o}}function Qf(i,s){if(Oo=-1,zo=0,(Ie&6)!==0)throw Error(r(327));var o=i.callbackNode;if(ws()&&i.callbackNode!==o)return null;var c=qn(i,i===mt?kt:0);if(c===0)return null;if((c&30)!==0||(c&i.expiredLanes)!==0||s)s=Fo(i,c);else{s=c;var d=Ie;Ie|=2;var _=ep();(mt!==i||kt!==s)&&(qi=null,Ss=rt()+500,Or(i,s));do try{xy();break}catch(D){Zf(i,D)}while(!0);xl(),To.current=_,Ie=d,ot!==null?s=0:(mt=null,kt=0,s=ht)}if(s!==0){if(s===2&&(d=Fa(i),d!==0&&(c=d,s=ac(i,d))),s===1)throw o=un,Or(i,0),gr(i,c),Ut(i,rt()),o;if(s===6)gr(i,c);else{if(d=i.current.alternate,(c&30)===0&&!Cy(d)&&(s=Fo(i,c),s===2&&(_=Fa(i),_!==0&&(c=_,s=ac(i,_))),s===1))throw o=un,Or(i,0),gr(i,c),Ut(i,rt()),o;switch(i.finishedWork=d,i.finishedLanes=c,s){case 0:case 1:throw Error(r(345));case 2:zr(i,$t,qi);break;case 3:if(gr(i,c),(c&130023424)===c&&(s=sc+500-rt(),10<s)){if(qn(i,0)!==0)break;if(d=i.suspendedLanes,(d&c)!==c){jt(),i.pingedLanes|=i.suspendedLanes&d;break}i.timeoutHandle=fl(zr.bind(null,i,$t,qi),s);break}zr(i,$t,qi);break;case 4:if(gr(i,c),(c&4194240)===c)break;for(s=i.eventTimes,d=-1;0<c;){var w=31-gi(c);_=1<<w,w=s[w],w>d&&(d=w),c&=~_}if(c=d,c=rt()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*wy(c/1960))-c,10<c){i.timeoutHandle=fl(zr.bind(null,i,$t,qi),c);break}zr(i,$t,qi);break;case 5:zr(i,$t,qi);break;default:throw Error(r(329))}}}return Ut(i,rt()),i.callbackNode===o?Qf.bind(null,i):null}function ac(i,s){var o=dn;return i.current.memoizedState.isDehydrated&&(Or(i,s).flags|=256),i=Fo(i,s),i!==2&&(s=$t,$t=o,s!==null&&lc(s)),i}function lc(i){$t===null?$t=i:$t.push.apply($t,i)}function Cy(i){for(var s=i;;){if(s.flags&16384){var o=s.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var c=0;c<o.length;c++){var d=o[c],_=d.getSnapshot;d=d.value;try{if(!vi(_(),d))return!1}catch{return!1}}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function gr(i,s){for(s&=~rc,s&=~Bo,i.suspendedLanes|=s,i.pingedLanes&=~s,i=i.expirationTimes;0<s;){var o=31-gi(s),c=1<<o;i[o]=-1,s&=~c}}function Jf(i){if((Ie&6)!==0)throw Error(r(327));ws();var s=qn(i,0);if((s&1)===0)return Ut(i,rt()),null;var o=Fo(i,s);if(i.tag!==0&&o===2){var c=Fa(i);c!==0&&(s=c,o=ac(i,c))}if(o===1)throw o=un,Or(i,0),gr(i,s),Ut(i,rt()),o;if(o===6)throw Error(r(345));return i.finishedWork=i.current.alternate,i.finishedLanes=s,zr(i,$t,qi),Ut(i,rt()),null}function cc(i,s){var o=Ie;Ie|=1;try{return i(s)}finally{Ie=o,Ie===0&&(Ss=rt()+500,fo&&hr())}}function Ir(i){mr!==null&&mr.tag===0&&(Ie&6)===0&&ws();var s=Ie;Ie|=1;var o=hi.transition,c=We;try{if(hi.transition=null,We=1,i)return i()}finally{We=c,hi.transition=o,Ie=s,(Ie&6)===0&&hr()}}function hc(){Jt=ys.current,Ve(ys)}function Or(i,s){i.finishedWork=null,i.finishedLanes=0;var o=i.timeoutHandle;if(o!==-1&&(i.timeoutHandle=-1,Jv(o)),ot!==null)for(o=ot.return;o!==null;){var c=o;switch(yl(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&ho();break;case 3:_s(),Ve(Ft),Ve(Rt),Pl();break;case 5:Ml(c);break;case 4:_s();break;case 13:Ve(Ge);break;case 19:Ve(Ge);break;case 10:kl(c.type._context);break;case 22:case 23:hc()}o=o.return}if(mt=i,ot=i=vr(i.current,null),kt=Jt=s,ht=0,un=null,rc=Bo=Ar=0,$t=dn=null,Tr!==null){for(s=0;s<Tr.length;s++)if(o=Tr[s],c=o.interleaved,c!==null){o.interleaved=null;var d=c.next,_=o.pending;if(_!==null){var w=_.next;_.next=d,c.next=w}o.pending=c}Tr=null}return i}function Zf(i,s){do{var o=ot;try{if(xl(),bo.current=No,xo){for(var c=Qe.memoizedState;c!==null;){var d=c.queue;d!==null&&(d.pending=null),c=c.next}xo=!1}if(jr=0,pt=ct=Qe=null,nn=!1,on=0,ic.current=null,o===null||o.return===null){ht=1,un=s,ot=null;break}e:{var _=i,w=o.return,D=o,z=s;if(s=kt,D.flags|=32768,z!==null&&typeof z=="object"&&typeof z.then=="function"){var J=z,se=D,oe=se.tag;if((se.mode&1)===0&&(oe===0||oe===11||oe===15)){var re=se.alternate;re?(se.updateQueue=re.updateQueue,se.memoizedState=re.memoizedState,se.lanes=re.lanes):(se.updateQueue=null,se.memoizedState=null)}var fe=xf(w);if(fe!==null){fe.flags&=-257,kf(fe,w,D,_,s),fe.mode&1&&bf(_,J,s),s=fe,z=J;var ve=s.updateQueue;if(ve===null){var Se=new Set;Se.add(z),s.updateQueue=Se}else ve.add(z);break e}else{if((s&1)===0){bf(_,J,s),uc();break e}z=Error(r(426))}}else if(Ye&&D.mode&1){var st=xf(w);if(st!==null){(st.flags&65536)===0&&(st.flags|=256),kf(st,w,D,_,s),Cl(gs(z,D));break e}}_=z=gs(z,D),ht!==4&&(ht=2),dn===null?dn=[_]:dn.push(_),_=w;do{switch(_.tag){case 3:_.flags|=65536,s&=-s,_.lanes|=s;var q=wf(_,z,s);qd(_,q);break e;case 1:D=z;var H=_.type,X=_.stateNode;if((_.flags&128)===0&&(typeof H.getDerivedStateFromError=="function"||X!==null&&typeof X.componentDidCatch=="function"&&(pr===null||!pr.has(X)))){_.flags|=65536,s&=-s,_.lanes|=s;var ae=Cf(_,D,s);qd(_,ae);break e}}_=_.return}while(_!==null)}ip(o)}catch(we){s=we,ot===o&&o!==null&&(ot=o=o.return);continue}break}while(!0)}function ep(){var i=To.current;return To.current=No,i===null?No:i}function uc(){(ht===0||ht===3||ht===2)&&(ht=4),mt===null||(Ar&268435455)===0&&(Bo&268435455)===0||gr(mt,kt)}function Fo(i,s){var o=Ie;Ie|=2;var c=ep();(mt!==i||kt!==s)&&(qi=null,Or(i,s));do try{by();break}catch(d){Zf(i,d)}while(!0);if(xl(),Ie=o,To.current=c,ot!==null)throw Error(r(261));return mt=null,kt=0,ht}function by(){for(;ot!==null;)tp(ot)}function xy(){for(;ot!==null&&!Xg();)tp(ot)}function tp(i){var s=np(i.alternate,i,Jt);i.memoizedProps=i.pendingProps,s===null?ip(i):ot=s,ic.current=null}function ip(i){var s=i;do{var o=s.alternate;if(i=s.return,(s.flags&32768)===0){if(o=_y(o,s,Jt),o!==null){ot=o;return}}else{if(o=gy(o,s),o!==null){o.flags&=32767,ot=o;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{ht=6,ot=null;return}}if(s=s.sibling,s!==null){ot=s;return}ot=s=i}while(s!==null);ht===0&&(ht=5)}function zr(i,s,o){var c=We,d=hi.transition;try{hi.transition=null,We=1,ky(i,s,o,c)}finally{hi.transition=d,We=c}return null}function ky(i,s,o,c){do ws();while(mr!==null);if((Ie&6)!==0)throw Error(r(327));o=i.finishedWork;var d=i.finishedLanes;if(o===null)return null;if(i.finishedWork=null,i.finishedLanes=0,o===i.current)throw Error(r(177));i.callbackNode=null,i.callbackPriority=0;var _=o.lanes|o.childLanes;if(nv(i,_),i===mt&&(ot=mt=null,kt=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||Ao||(Ao=!0,op($n,function(){return ws(),null})),_=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||_){_=hi.transition,hi.transition=null;var w=We;We=1;var D=Ie;Ie|=4,ic.current=null,yy(i,o),Vf(o,i),Kv(ul),Gn=!!hl,ul=hl=null,i.current=o,Sy(o),Gg(),Ie=D,We=w,hi.transition=_}else i.current=o;if(Ao&&(Ao=!1,mr=i,Io=d),_=i.pendingLanes,_===0&&(pr=null),Zg(o.stateNode),Ut(i,rt()),s!==null)for(c=i.onRecoverableError,o=0;o<s.length;o++)d=s[o],c(d.value,{componentStack:d.stack,digest:d.digest});if(jo)throw jo=!1,i=nc,nc=null,i;return(Io&1)!==0&&i.tag!==0&&ws(),_=i.pendingLanes,(_&1)!==0?i===oc?fn++:(fn=0,oc=i):fn=0,hr(),null}function ws(){if(mr!==null){var i=$u(Io),s=hi.transition,o=We;try{if(hi.transition=null,We=16>i?16:i,mr===null)var c=!1;else{if(i=mr,mr=null,Io=0,(Ie&6)!==0)throw Error(r(331));var d=Ie;for(Ie|=4,_e=i.current;_e!==null;){var _=_e,w=_.child;if((_e.flags&16)!==0){var D=_.deletions;if(D!==null){for(var z=0;z<D.length;z++){var J=D[z];for(_e=J;_e!==null;){var se=_e;switch(se.tag){case 0:case 11:case 15:hn(8,se,_)}var oe=se.child;if(oe!==null)oe.return=se,_e=oe;else for(;_e!==null;){se=_e;var re=se.sibling,fe=se.return;if(Hf(se),se===J){_e=null;break}if(re!==null){re.return=fe,_e=re;break}_e=fe}}}var ve=_.alternate;if(ve!==null){var Se=ve.child;if(Se!==null){ve.child=null;do{var st=Se.sibling;Se.sibling=null,Se=st}while(Se!==null)}}_e=_}}if((_.subtreeFlags&2064)!==0&&w!==null)w.return=_,_e=w;else e:for(;_e!==null;){if(_=_e,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:hn(9,_,_.return)}var q=_.sibling;if(q!==null){q.return=_.return,_e=q;break e}_e=_.return}}var H=i.current;for(_e=H;_e!==null;){w=_e;var X=w.child;if((w.subtreeFlags&2064)!==0&&X!==null)X.return=w,_e=X;else e:for(w=H;_e!==null;){if(D=_e,(D.flags&2048)!==0)try{switch(D.tag){case 0:case 11:case 15:Po(9,D)}}catch(we){et(D,D.return,we)}if(D===w){_e=null;break e}var ae=D.sibling;if(ae!==null){ae.return=D.return,_e=ae;break e}_e=D.return}}if(Ie=d,hr(),Ni&&typeof Ni.onPostCommitFiberRoot=="function")try{Ni.onPostCommitFiberRoot(Un,i)}catch{}c=!0}return c}finally{We=o,hi.transition=s}}return!1}function rp(i,s,o){s=gs(o,s),s=wf(i,s,1),i=dr(i,s,1),s=jt(),i!==null&&(As(i,1,s),Ut(i,s))}function et(i,s,o){if(i.tag===3)rp(i,i,o);else for(;s!==null;){if(s.tag===3){rp(s,i,o);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(pr===null||!pr.has(c))){i=gs(o,i),i=Cf(s,i,1),s=dr(s,i,1),i=jt(),s!==null&&(As(s,1,i),Ut(s,i));break}}s=s.return}}function Ey(i,s,o){var c=i.pingCache;c!==null&&c.delete(s),s=jt(),i.pingedLanes|=i.suspendedLanes&o,mt===i&&(kt&o)===o&&(ht===4||ht===3&&(kt&130023424)===kt&&500>rt()-sc?Or(i,0):rc|=o),Ut(i,s)}function sp(i,s){s===0&&((i.mode&1)===0?s=1:(s=Vn,Vn<<=1,(Vn&130023424)===0&&(Vn=4194304)));var o=jt();i=Ui(i,s),i!==null&&(As(i,s,o),Ut(i,o))}function Ny(i){var s=i.memoizedState,o=0;s!==null&&(o=s.retryLane),sp(i,o)}function Ry(i,s){var o=0;switch(i.tag){case 13:var c=i.stateNode,d=i.memoizedState;d!==null&&(o=d.retryLane);break;case 19:c=i.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(s),sp(i,o)}var np;np=function(i,s,o){if(i!==null)if(i.memoizedProps!==s.pendingProps||Ft.current)Wt=!0;else{if((i.lanes&o)===0&&(s.flags&128)===0)return Wt=!1,my(i,s,o);Wt=(i.flags&131072)!==0}else Wt=!1,Ye&&(s.flags&1048576)!==0&&Id(s,mo,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;Mo(i,s),i=s.pendingProps;var d=cs(s,Rt.current);ms(s,o),d=jl(null,s,c,i,d,o);var _=Al();return s.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,Ht(c)?(_=!0,uo(s)):_=!1,s.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,Rl(s),d.updater=Ro,s.stateNode=d,d._reactInternals=s,Wl(s,c,i,o),s=Vl(null,s,c,!0,_,o)):(s.tag=0,Ye&&_&&vl(s),Bt(null,s,d,o),s=s.child),s;case 16:c=s.elementType;e:{switch(Mo(i,s),i=s.pendingProps,d=c._init,c=d(c._payload),s.type=c,d=s.tag=My(c),i=Si(c,i),d){case 0:s=Kl(null,s,c,i,o);break e;case 1:s=Lf(null,s,c,i,o);break e;case 11:s=Ef(null,s,c,i,o);break e;case 14:s=Nf(null,s,c,Si(c.type,i),o);break e}throw Error(r(306,c,""))}return s;case 0:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:Si(c,d),Kl(i,s,c,d,o);case 1:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:Si(c,d),Lf(i,s,c,d,o);case 3:e:{if(Pf(s),i===null)throw Error(r(387));c=s.pendingProps,_=s.memoizedState,d=_.element,Vd(i,s),wo(s,c,null,o);var w=s.memoizedState;if(c=w.element,_.isDehydrated)if(_={element:c,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},s.updateQueue.baseState=_,s.memoizedState=_,s.flags&256){d=gs(Error(r(423)),s),s=Tf(i,s,c,o,d);break e}else if(c!==d){d=gs(Error(r(424)),s),s=Tf(i,s,c,o,d);break e}else for(Qt=ar(s.stateNode.containerInfo.firstChild),Gt=s,Ye=!0,yi=null,o=Ud(s,null,c,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ds(),c===d){s=Vi(i,s,o);break e}Bt(i,s,c,o)}s=s.child}return s;case 5:return Xd(s),i===null&&wl(s),c=s.type,d=s.pendingProps,_=i!==null?i.memoizedProps:null,w=d.children,dl(c,d)?w=null:_!==null&&dl(c,_)&&(s.flags|=32),Mf(i,s),Bt(i,s,w,o),s.child;case 6:return i===null&&wl(s),null;case 13:return Bf(i,s,o);case 4:return Dl(s,s.stateNode.containerInfo),c=s.pendingProps,i===null?s.child=fs(s,null,c,o):Bt(i,s,c,o),s.child;case 11:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:Si(c,d),Ef(i,s,c,d,o);case 7:return Bt(i,s,s.pendingProps,o),s.child;case 8:return Bt(i,s,s.pendingProps.children,o),s.child;case 12:return Bt(i,s,s.pendingProps.children,o),s.child;case 10:e:{if(c=s.type._context,d=s.pendingProps,_=s.memoizedProps,w=d.value,Ue(vo,c._currentValue),c._currentValue=w,_!==null)if(vi(_.value,w)){if(_.children===d.children&&!Ft.current){s=Vi(i,s,o);break e}}else for(_=s.child,_!==null&&(_.return=s);_!==null;){var D=_.dependencies;if(D!==null){w=_.child;for(var z=D.firstContext;z!==null;){if(z.context===c){if(_.tag===1){z=Ki(-1,o&-o),z.tag=2;var J=_.updateQueue;if(J!==null){J=J.shared;var se=J.pending;se===null?z.next=z:(z.next=se.next,se.next=z),J.pending=z}}_.lanes|=o,z=_.alternate,z!==null&&(z.lanes|=o),El(_.return,o,s),D.lanes|=o;break}z=z.next}}else if(_.tag===10)w=_.type===s.type?null:_.child;else if(_.tag===18){if(w=_.return,w===null)throw Error(r(341));w.lanes|=o,D=w.alternate,D!==null&&(D.lanes|=o),El(w,o,s),w=_.sibling}else w=_.child;if(w!==null)w.return=_;else for(w=_;w!==null;){if(w===s){w=null;break}if(_=w.sibling,_!==null){_.return=w.return,w=_;break}w=w.return}_=w}Bt(i,s,d.children,o),s=s.child}return s;case 9:return d=s.type,c=s.pendingProps.children,ms(s,o),d=li(d),c=c(d),s.flags|=1,Bt(i,s,c,o),s.child;case 14:return c=s.type,d=Si(c,s.pendingProps),d=Si(c.type,d),Nf(i,s,c,d,o);case 15:return Rf(i,s,s.type,s.pendingProps,o);case 17:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:Si(c,d),Mo(i,s),s.tag=1,Ht(c)?(i=!0,uo(s)):i=!1,ms(s,o),yf(s,c,d),Wl(s,c,d,o),Vl(null,s,c,!0,i,o);case 19:return Af(i,s,o);case 22:return Df(i,s,o)}throw Error(r(156,s.tag))};function op(i,s){return Ou(i,s)}function Dy(i,s,o,c){this.tag=i,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ui(i,s,o,c){return new Dy(i,s,o,c)}function dc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function My(i){if(typeof i=="function")return dc(i)?1:0;if(i!=null){if(i=i.$$typeof,i===O)return 11;if(i===V)return 14}return 2}function vr(i,s){var o=i.alternate;return o===null?(o=ui(i.tag,s,i.key,i.mode),o.elementType=i.elementType,o.type=i.type,o.stateNode=i.stateNode,o.alternate=i,i.alternate=o):(o.pendingProps=s,o.type=i.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=i.flags&14680064,o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,s=i.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=i.sibling,o.index=i.index,o.ref=i.ref,o}function Ho(i,s,o,c,d,_){var w=2;if(c=i,typeof i=="function")dc(i)&&(w=1);else if(typeof i=="string")w=5;else e:switch(i){case A:return Fr(o.children,d,_,s);case K:w=8,d|=8;break;case P:return i=ui(12,o,s,d|2),i.elementType=P,i.lanes=_,i;case j:return i=ui(13,o,s,d),i.elementType=j,i.lanes=_,i;case B:return i=ui(19,o,s,d),i.elementType=B,i.lanes=_,i;case ee:return Wo(o,d,_,s);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case N:w=10;break e;case W:w=9;break e;case O:w=11;break e;case V:w=14;break e;case Q:w=16,c=null;break e}throw Error(r(130,i==null?i:typeof i,""))}return s=ui(w,o,s,d),s.elementType=i,s.type=c,s.lanes=_,s}function Fr(i,s,o,c){return i=ui(7,i,c,s),i.lanes=o,i}function Wo(i,s,o,c){return i=ui(22,i,c,s),i.elementType=ee,i.lanes=o,i.stateNode={isHidden:!1},i}function fc(i,s,o){return i=ui(6,i,null,s),i.lanes=o,i}function pc(i,s,o){return s=ui(4,i.children!==null?i.children:[],i.key,s),s.lanes=o,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}function Ly(i,s,o,c,d){this.tag=s,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ha(0),this.expirationTimes=Ha(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ha(0),this.identifierPrefix=c,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function mc(i,s,o,c,d,_,w,D,z){return i=new Ly(i,s,o,D,z),s===1?(s=1,_===!0&&(s|=8)):s=0,_=ui(3,null,null,s),i.current=_,_.stateNode=i,_.memoizedState={element:c,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Rl(_),i}function Py(i,s,o){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$,key:c==null?null:""+c,children:i,containerInfo:s,implementation:o}}function ap(i){if(!i)return cr;i=i._reactInternals;e:{if(Rr(i)!==i||i.tag!==1)throw Error(r(170));var s=i;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(Ht(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(i.tag===1){var o=i.type;if(Ht(o))return Bd(i,o,s)}return s}function lp(i,s,o,c,d,_,w,D,z){return i=mc(o,c,!0,i,d,_,w,D,z),i.context=ap(null),o=i.current,c=jt(),d=_r(o),_=Ki(c,d),_.callback=s??null,dr(o,_,d),i.current.lanes=d,As(i,d,c),Ut(i,c),i}function $o(i,s,o,c){var d=s.current,_=jt(),w=_r(d);return o=ap(o),s.context===null?s.context=o:s.pendingContext=o,s=Ki(_,w),s.payload={element:i},c=c===void 0?null:c,c!==null&&(s.callback=c),i=dr(d,s,w),i!==null&&(bi(i,d,w,_),So(i,d,w)),w}function Uo(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function cp(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var o=i.retryLane;i.retryLane=o!==0&&o<s?o:s}}function _c(i,s){cp(i,s),(i=i.alternate)&&cp(i,s)}function Ty(){return null}var hp=typeof reportError=="function"?reportError:function(i){console.error(i)};function gc(i){this._internalRoot=i}Ko.prototype.render=gc.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));$o(i,s,null,null)},Ko.prototype.unmount=gc.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Ir(function(){$o(null,i,null,null)}),s[Fi]=null}};function Ko(i){this._internalRoot=i}Ko.prototype.unstable_scheduleHydration=function(i){if(i){var s=Vu();i={blockedOn:null,target:i,priority:s};for(var o=0;o<sr.length&&s!==0&&s<sr[o].priority;o++);sr.splice(o,0,i),o===0&&Xu(i)}};function vc(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Vo(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function up(){}function By(i,s,o,c,d){if(d){if(typeof c=="function"){var _=c;c=function(){var J=Uo(w);_.call(J)}}var w=lp(s,c,i,0,null,!1,!1,"",up);return i._reactRootContainer=w,i[Fi]=w.current,Gs(i.nodeType===8?i.parentNode:i),Ir(),w}for(;d=i.lastChild;)i.removeChild(d);if(typeof c=="function"){var D=c;c=function(){var J=Uo(z);D.call(J)}}var z=mc(i,0,!1,null,null,!1,!1,"",up);return i._reactRootContainer=z,i[Fi]=z.current,Gs(i.nodeType===8?i.parentNode:i),Ir(function(){$o(s,z,o,c)}),z}function qo(i,s,o,c,d){var _=o._reactRootContainer;if(_){var w=_;if(typeof d=="function"){var D=d;d=function(){var z=Uo(w);D.call(z)}}$o(s,w,i,d)}else w=By(o,s,i,d,c);return Uo(w)}Uu=function(i){switch(i.tag){case 3:var s=i.stateNode;if(s.current.memoizedState.isDehydrated){var o=js(s.pendingLanes);o!==0&&(Wa(s,o|1),Ut(s,rt()),(Ie&6)===0&&(Ss=rt()+500,hr()))}break;case 13:Ir(function(){var c=Ui(i,1);if(c!==null){var d=jt();bi(c,i,1,d)}}),_c(i,1)}},$a=function(i){if(i.tag===13){var s=Ui(i,134217728);if(s!==null){var o=jt();bi(s,i,134217728,o)}_c(i,134217728)}},Ku=function(i){if(i.tag===13){var s=_r(i),o=Ui(i,s);if(o!==null){var c=jt();bi(o,i,s,c)}_c(i,s)}},Vu=function(){return We},qu=function(i,s){var o=We;try{return We=i,s()}finally{We=o}},ja=function(i,s,o){switch(s){case"input":if(Zi(i,o),s=o.name,o.type==="radio"&&s!=null){for(o=i;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<o.length;s++){var c=o[s];if(c!==i&&c.form===i.form){var d=co(c);if(!d)throw Error(r(90));ye(c),Zi(c,d)}}}break;case"textarea":bt(i,o);break;case"select":s=o.value,s!=null&&zt(i,!!o.multiple,s,!1)}},Lu=cc,Pu=Ir;var jy={usingClientEntryPoint:!1,Events:[Zs,as,co,Du,Mu,cc]},pn={findFiberByHostInstance:Dr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ay={bundleType:pn.bundleType,version:pn.version,rendererPackageName:pn.rendererPackageName,rendererConfig:pn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:L.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Au(i),i===null?null:i.stateNode},findFiberByHostInstance:pn.findFiberByHostInstance||Ty,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 Yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yo.isDisabled&&Yo.supportsFiber)try{Un=Yo.inject(Ay),Ni=Yo}catch{}}return Kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=jy,Kt.createPortal=function(i,s){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!vc(s))throw Error(r(200));return Py(i,s,null,o)},Kt.createRoot=function(i,s){if(!vc(i))throw Error(r(299));var o=!1,c="",d=hp;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onRecoverableError!==void 0&&(d=s.onRecoverableError)),s=mc(i,1,!1,null,null,o,!1,c,d),i[Fi]=s.current,Gs(i.nodeType===8?i.parentNode:i),new gc(s)},Kt.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=Au(s),i=i===null?null:i.stateNode,i},Kt.flushSync=function(i){return Ir(i)},Kt.hydrate=function(i,s,o){if(!Vo(s))throw Error(r(200));return qo(null,i,s,!0,o)},Kt.hydrateRoot=function(i,s,o){if(!vc(i))throw Error(r(405));var c=o!=null&&o.hydratedSources||null,d=!1,_="",w=hp;if(o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(_=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),s=lp(s,null,i,1,o??null,d,!1,_,w),i[Fi]=s.current,Gs(i),c)for(i=0;i<c.length;i++)o=c[i],d=o._getVersion,d=d(o._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[o,d]:s.mutableSourceEagerHydrationData.push(o,d);return new Ko(s)},Kt.render=function(i,s,o){if(!Vo(s))throw Error(r(200));return qo(null,i,s,!1,o)},Kt.unmountComponentAtNode=function(i){if(!Vo(i))throw Error(r(40));return i._reactRootContainer?(Ir(function(){qo(null,null,i,!1,function(){i._reactRootContainer=null,i[Fi]=null})}),!0):!1},Kt.unstable_batchedUpdates=cc,Kt.unstable_renderSubtreeIntoContainer=function(i,s,o,c){if(!Vo(o))throw Error(r(200));if(i==null||i._reactInternals===void 0)throw Error(r(38));return qo(i,s,o,!1,c)},Kt.version="18.3.1-next-f1338f8080-20240426",Kt}var yp;function Ky(){if(yp)return wc.exports;yp=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),wc.exports=Uy(),wc.exports}var Sp;function Vy(){if(Sp)return Xo;Sp=1;var e=Ky();return Xo.createRoot=e.createRoot,Xo.hydrateRoot=e.hydrateRoot,Xo}var qy=Vy();const Yy=su(qy);function wt(e,t,r={}){return fetch(e,{...r,headers:{...r.headers||{},Authorization:`Bearer ${t}`}})}const p_=e=>`nc_seen_${e}`;async function je(e,t,r={}){const n=await wt(e,t,{method:r.method||"GET",headers:{"content-type":"application/json"},body:r.body?JSON.stringify(r.body):void 0}),a=await n.json().catch(()=>({}));if(!n.ok){const l=new Error(a.error||`HTTP ${n.status}`);throw l.status=n.status,l.data=a,l}return a}const Ns=e=>Array.isArray(e)&&e.length?`/api/route/${e.map(encodeURIComponent).join("/")}/_`:"/api",ki=(e,t)=>`${Ns(e)}/fleet/${t}`,Rs=(e,t)=>je(ki(t,"status"),e),ou=(e,t,r)=>je(ki(r,"up"),e,{method:"POST",body:t}),au=(e,t,r)=>je(ki(r,"down"),e,{method:"POST",body:t}),hh=(e,t,r)=>je(ki(r,"restart"),e,{method:"POST",body:{cell:t}}),Xy=(e,t)=>je(ki(t,"definitions"),e),Gy=(e,t,r)=>je(ki(r,"define-engine"),e,{method:"POST",body:{def:t}}),Qy=(e,t,r,n,a)=>je(ki(a,"edit-engine"),e,{method:"POST",body:{id:t,patch:r,envChanges:n}}),Jy=(e,t,r)=>je(ki(r,"remove-engine"),e,{method:"POST",body:{id:t}}),Zy=(e,t,r)=>je(ki(r,"define-cell"),e,{method:"POST",body:{def:t}}),e0=(e,t,r,n)=>je(ki(n,"edit-cell"),e,{method:"POST",body:{id:t,patch:r}}),m_=(e,t,r=!1,n)=>je(ki(n,"remove-cell"),e,{method:"POST",body:{id:t,stop:r}}),__=(e,t,r)=>je(`${Ns(r)}/sessions`,e,{method:"POST",body:t}),lu=(e,t,r)=>je(`${Ns(r)}/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),g_=(e,t,r)=>je(`${Ns(r)}/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),v_=e=>je("/api/settings",e),y_=e=>je("/api/nodes",e),t0=e=>je("/api/topology",e),S_=(e,t)=>je(`${Ns(t)}/sessions`,e),w_=(e,t)=>je(`${Ns(t)}/config`,e),i0=(e,t)=>je("/api/settings/config",e,{method:"POST",body:t}),r0=e=>je("/api/settings/token/rotate",e,{method:"POST"}),C_=(e,t)=>je("/api/settings/nodes/pair",e,{method:"POST",body:t}),s0=(e,t)=>je("/api/settings/peering/invite",e,{method:"POST",body:t||{}}),n0=(e,t,r)=>je(`/api/settings/nodes/${encodeURIComponent(t)}/label`,e,{method:"PATCH",body:{label:r}}),o0=(e,t)=>je(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),cu=(e,t,r)=>je(`/api/settings/nodes/${encodeURIComponent(t)}/${r}`,e,{method:"POST"}),wp=(e,t,r,n=[])=>je(`/api/settings/nodes/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{visibility:r,selected:n}}),a0=e=>je("/api/settings/service/regenerate",e,{method:"POST"}),l0=(e,t=!0)=>je(`/api/asks${t?"?open=1":""}`,e),c0=(e,t,r)=>je(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:r}}),xc=e=>je("/api/decks",e),Cp=(e,t)=>je("/api/decks",e,{method:"POST",body:{name:t}}),Go=(e,t,r,n)=>je(`/api/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:r,expectedRevision:n}}),h0=(e,t,r,n)=>je(`/api/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:r,expectedRevision:n}}),u0=(e,t,r)=>je(`/api/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:r}}),d0={power:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M12 3v8"}),u.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:u.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:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),u.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),u.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),u.jsx("path",{d:"M12 18v3"})]}),enter:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),u.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),u.jsx("path",{d:"M22 2 11 13"})]}),trash:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 7h16"}),u.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),u.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),u.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:u.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),u.jsx("polyline",{points:"21 3 21 8 16 8"})]}),upload:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M12 16V5"}),u.jsx("polyline",{points:"8 9 12 5 16 9"}),u.jsx("path",{d:"M5 20h14"})]}),chevronLeft:u.jsx("polyline",{points:"14 6 8 12 14 18"}),attach:u.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:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:u.jsxs(u.Fragment,{children:[u.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"}),u.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),u.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),u.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"M21 21l-4.35-4.35"}),u.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"M21 21l-4.35-4.35"}),u.jsx("path",{d:"M8 11h6"})]}),gear:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.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:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),u.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 u.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:d0[e]||null})}const b_="nc_pins";function x_(){try{const e=JSON.parse(localStorage.getItem(b_));return Array.isArray(e)?e:[]}catch{return[]}}function k_(e,t){const r=e.includes(t)?e.filter(n=>n!==t):[...e,t];try{localStorage.setItem(b_,JSON.stringify(r))}catch{}return r}function bn(e,t,r){const n=e.indexOf(t);return[n===-1?1e9:n,-(r||0)]}function uh(e,t){return e[0]-t[0]||e[1]-t[1]}const hu=["it","en","es"];function f0(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return hu.includes(t)?t:"en"}catch{return"en"}}const oa=f0(),E_="nc_lang",dh="nc-lang";function N_(){return typeof localStorage<"u"?localStorage:null}const Qo={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",local:"Locale",location:"Dove","pairing-link":"link di pairing","pairing-required":"nome, alias SSH e link di pairing sono obbligatori","scan-qr":"scansiona QR","pairing-qr-invalid":"QR di pairing non valido","invite-node":"invita un nodo","create-pairing-link":"crea link / QR","visibility-network":"tutta la rete","visibility-relay":"solo relay","visibility-selected":"nodi selezionati","hydra-simple":"locale + nodi, una sola rete","local-ready":"Questo dispositivo è pronto. Puoi usarlo da solo o collegarlo a un nodo.","local-only":"solo locale","add-node":"aggiungi nodo",connect:"collega","node-connected":"Nodo collegato. La rete verrà sincronizzata automaticamente.","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-model-required":"modello (obbligatorio)","fleet-standard-permissions":"permessi standard","fleet-unsafe-permissions":"non sicuro · ignora approvazioni/sandbox","fleet-unsafe-warning":"Modalità non sicura esplicita: il worker può agire senza le normali approvazioni o protezioni sandbox.","fleet-provider-display":"nome visualizzato del provider","fleet-custom-provider-default":"Provider personalizzato","fleet-api-key-env":"NOME_VARIABILE_API_KEY","fleet-provider-id":"id-provider","fleet-custom-secret-help":"NexusCrew salva solo il nome della variabile d’ambiente, mai il suo valore.","fleet-model-override":"modello alternativo","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":"collega installazione NexusCrew","node-connect-help":"La porta SSH serve a raggiungere il server SSH. La porta NexusCrew è invece la porta locale mostrata da `nexuscrew status` sul nodo remoto.","node-name-label":"Nome del nodo","node-ssh-label":"Host SSH","node-ssh-port-label":"Porta SSH","node-ssh-port-help":"Di solito 22; usa la porta pubblica del server SSH.","node-app-port-label":"Porta NexusCrew sul nodo","node-app-port-help":"È la porta mostrata da `nexuscrew status` sul nodo remoto.","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-ssh-port":"porta SSH non valida (1–65535)","err-node-port":"porta NexusCrew 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","node-offline":"nodo offline","node-offline-seen":"offline · visto {t} fa","node-needs-repair":"legacy · ripeti il pairing","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","node-display-label":"Nome (etichetta)","node-slug-hint":"routing su slug: {slug}","device-name-label":"Nome dispositivo","device-name-hint":"come ti vedono i peer (modificabile)","err-label":"etichetta non valida (max 64 char, niente a capo)","fleet-inventory":"Celle e sessioni","fleet-inventory-help":"tutte le posizioni (Locale + route Hydra)","fleet-inventory-empty":"nessuna cella o sessione","fleet-not-available":"fleet non disponibile su questa posizione",start:"avvia",stop:"ferma",restart:"riavvia",delete:"elimina","copy-manual":"copia non riuscita — seleziona e Cmd+C, o copia a mano","copy-empty":"niente selezione: trascina con Shift per selezionare"},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",local:"Local",location:"Location","pairing-link":"pairing link","pairing-required":"name, SSH alias and pairing link are required","scan-qr":"scan QR","pairing-qr-invalid":"invalid pairing QR","invite-node":"invite a node","create-pairing-link":"create link / QR","visibility-network":"whole network","visibility-relay":"relay only","visibility-selected":"selected nodes","hydra-simple":"local + nodes, one network","local-ready":"This device is ready. Use it alone or connect it to a node.","local-only":"local only","add-node":"add node",connect:"connect","node-connected":"Node connected. The network will synchronize automatically.","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-model-required":"model (required)","fleet-standard-permissions":"standard permissions","fleet-unsafe-permissions":"unsafe · bypass approvals/sandbox","fleet-unsafe-warning":"Explicit unsafe mode: the worker can act without normal approval or sandbox gates.","fleet-provider-display":"provider display name","fleet-custom-provider-default":"Custom provider","fleet-api-key-env":"API_KEY_ENV_NAME","fleet-provider-id":"provider-id","fleet-custom-secret-help":"NexusCrew stores only the environment-variable name, never its value.","fleet-model-override":"model override","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":"connect a NexusCrew installation","node-connect-help":"The SSH port reaches the SSH server. The NexusCrew port is the local port reported by `nexuscrew status` on the remote node.","node-name-label":"Node name","node-ssh-label":"SSH host","node-ssh-port-label":"SSH port","node-ssh-port-help":"Usually 22; use the SSH server public port.","node-app-port-label":"NexusCrew port on node","node-app-port-help":"The port reported by `nexuscrew status` on the remote 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-ssh-port":"invalid SSH port (1–65535)","err-node-port":"invalid NexusCrew 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","node-offline":"node offline","node-offline-seen":"offline · seen {t} ago","node-needs-repair":"legacy · pair again","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","node-display-label":"Name (label)","node-slug-hint":"routing on slug: {slug}","device-name-label":"Device name","device-name-hint":"how peers see you (editable)","err-label":"invalid label (max 64 chars, no line breaks)","fleet-inventory":"Cells and sessions","fleet-inventory-help":"all positions (Local + Hydra routes)","fleet-inventory-empty":"no cells or sessions","fleet-not-available":"fleet not available on this position",start:"start",stop:"stop",restart:"restart",delete:"delete","copy-manual":"copy failed — select and press Cmd+C, or copy manually","copy-empty":"nothing selected: drag with Shift to select"},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",local:"Local",location:"Ubicación","pairing-link":"enlace de emparejamiento","pairing-required":"nombre, alias SSH y enlace son obligatorios","scan-qr":"escanear QR","pairing-qr-invalid":"QR de emparejamiento no válido","invite-node":"invitar un nodo","create-pairing-link":"crear enlace / QR","visibility-network":"toda la red","visibility-relay":"solo relay","visibility-selected":"nodos seleccionados","hydra-simple":"local + nodos, una red","local-ready":"Este dispositivo está listo. Úsalo solo o conéctalo a un nodo.","local-only":"solo local","add-node":"añadir nodo",connect:"conectar","node-connected":"Nodo conectado. La red se sincronizará automáticamente.","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-model-required":"modelo (obligatorio)","fleet-standard-permissions":"permisos estándar","fleet-unsafe-permissions":"inseguro · omitir aprobaciones/sandbox","fleet-unsafe-warning":"Modo inseguro explícito: el worker puede actuar sin las aprobaciones normales ni las protecciones del sandbox.","fleet-provider-display":"nombre visible del proveedor","fleet-custom-provider-default":"Proveedor personalizado","fleet-api-key-env":"NOMBRE_VARIABLE_API_KEY","fleet-provider-id":"id-proveedor","fleet-custom-secret-help":"NexusCrew guarda solo el nombre de la variable de entorno, nunca su valor.","fleet-model-override":"modelo alternativo","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":"conectar una instalación NexusCrew","node-connect-help":"El puerto SSH conecta con el servidor SSH. El puerto NexusCrew es el puerto local indicado por `nexuscrew status` en el nodo remoto.","node-name-label":"Nombre del nodo","node-ssh-label":"Host SSH","node-ssh-port-label":"Puerto SSH","node-ssh-port-help":"Normalmente 22; usa el puerto público del servidor SSH.","node-app-port-label":"Puerto NexusCrew del nodo","node-app-port-help":"El puerto indicado por `nexuscrew status` en el nodo remoto.","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-ssh-port":"puerto SSH inválido (1–65535)","err-node-port":"puerto NexusCrew 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","node-offline":"nodo desconectado","node-offline-seen":"sin conexión · visto hace {t}","node-needs-repair":"legacy · vuelve a enlazar","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","node-display-label":"Nombre (etiqueta)","node-slug-hint":"enrutado por slug: {slug}","device-name-label":"Nombre del dispositivo","device-name-hint":"cómo te ven los pares (editable)","err-label":"etiqueta no válida (máx 64 caracteres, sin saltos de línea)","fleet-inventory":"Celdas y sesiones","fleet-inventory-help":"todas las posiciones (Local + rutas Hydra)","fleet-inventory-empty":"sin celdas ni sesiones","fleet-not-available":"fleet no disponible en esta posición",start:"iniciar",stop:"detener",restart:"reiniciar",delete:"eliminar","copy-manual":"copia fallida — selecciona y pulsa Cmd+C, o copia a mano","copy-empty":"nada seleccionado: arrastra con Shift para seleccionar"}};function fh(){const e=N_(),t=e?e.getItem(E_):null;return hu.includes(t)?t:oa}function p0(e){const t=N_();if(t)try{t.setItem(E_,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(dh))}function k(e){const t=fh(),r=Qo[t]||Qo[oa];return Object.prototype.hasOwnProperty.call(r,e)?r[e]:Object.prototype.hasOwnProperty.call(Qo[oa],e)?Qo[oa][e]:e}function m0(e){return typeof window>"u"?()=>{}:(window.addEventListener(dh,e),()=>window.removeEventListener(dh,e))}const R_=hu;function Yt(){return[I.useSyncExternalStore(m0,fh,fh),p0]}function D_({cell:e,engines:t=[],onConfirm:r,onClose:n}){var M;Yt();const a=!!(e&&e.active),l=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"}],[h,f]=I.useState((e==null?void 0:e.engine)||l[0].id),m=l.find(L=>L.id===h),p=L=>{var $,A;const G=l.find(K=>K.id===L);return(($=e==null?void 0:e.models)==null?void 0:$[L])||((e==null?void 0:e.engine)===L?e==null?void 0:e.model:"")||(G==null?void 0:G.model)||((A=G==null?void 0:G.models)==null?void 0:A[0])||""},[S,g]=I.useState(()=>p((e==null?void 0:e.engine)||l[0].id)),[C,v]=I.useState((e==null?void 0:e.boot)??!0),[y,x]=I.useState(!1),[E,F]=I.useState(null);async function U(L){L.preventDefault(),x(!0),F(null);try{a?await r({action:"down",boot:C}):await r({action:"up",engine:h,model:S,boot:C}),n()}catch(G){F(String(G&&G.message||G)),x(!1)}}return u.jsx("div",{className:"nc-sheet-overlay",onClick:n,children:u.jsxs("form",{className:"nc-sheet",onClick:L=>L.stopPropagation(),onSubmit:U,children:[u.jsxs("div",{className:"nc-sheet-head",children:[u.jsx("b",{children:e==null?void 0:e.cell}),u.jsx("span",{className:"nc-sheet-state",children:k(a?"state-on":"state-off")})]}),a?u.jsxs("label",{className:"nc-check",children:[u.jsx("input",{type:"checkbox",checked:C,onChange:L=>v(L.target.checked)}),k("remove-boot")]}):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"nc-sheet-label",children:k("engine")}),u.jsx("div",{className:"nc-engines",children:l.map(L=>u.jsxs("label",{className:`nc-engine${h===L.id?" sel":""}`,children:[u.jsx("input",{type:"radio",name:"ps-engine",checked:h===L.id,onChange:()=>{f(L.id),g(p(L.id))}}),L.label,L.label.toLowerCase()!==L.id.toLowerCase()&&u.jsxs("small",{className:"nc-engine-id",children:[" (",L.id,")"]})]},L.id))}),m&&(m.models||[]).length>0&&u.jsxs("label",{className:"nc-field",children:[u.jsx("span",{children:k("model")}),u.jsx("select",{value:S,onChange:L=>g(L.target.value),children:m.models.map(L=>u.jsx("option",{value:L,children:L},L))}),u.jsx("small",{children:(M=e==null?void 0:e.models)!=null&&M[h]?k("model-remembered"):k("model-default")})]}),u.jsxs("label",{className:"nc-check",children:[u.jsx("input",{type:"checkbox",checked:C,onChange:L=>v(L.target.checked)}),k("boot-persist")]}),m&&!m.rc&&u.jsx("div",{className:"nc-note",children:k("no-remote-control")})]}),E&&u.jsx("div",{className:"nc-err",children:E}),u.jsxs("div",{className:"nc-sheet-actions",children:[u.jsx("button",{type:"button",className:"nc-btn ghost",onClick:n,disabled:y,children:k("cancel")}),u.jsx("button",{type:"submit",className:"nc-btn primary",disabled:y,children:k(a?"power-off":"power-on")})]})]})})}const _0=/^[\w.-]{1,64}$/;function M_({presets:e=["shell"],targets:t=[],token:r,onCreate:n,onClose:a}){Yt();const[l,h]=I.useState(""),[f,m]=I.useState("~"),[p,S]=I.useState(e[0]||"shell"),[g,C]=I.useState(e),[v,y]=I.useState(""),[x,E]=I.useState(!1),[F,U]=I.useState(null),[M,L]=I.useState(null),[G,$]=I.useState(null),A=_0.test(l)&&!l.startsWith("-");async function K(N){$(null);try{const W=v?v.split("/"):[],O=await g_(r,N,W);L(O),m(O.path)}catch(W){$(String(W&&W.message||W))}}async function P(N){if(N.preventDefault(),!!A){E(!0),U(null);try{await n({name:l,cwd:f==="~"?"":f,preset:p},v?v.split("/"):[]),a()}catch(W){U(String(W&&W.message||W)),E(!1)}}}return u.jsx("div",{className:"nc-sheet-overlay",onClick:a,children:u.jsxs("form",{className:"nc-sheet",onClick:N=>N.stopPropagation(),onSubmit:P,children:[u.jsx("div",{className:"nc-sheet-head",children:u.jsx("b",{children:k("new-session")})}),u.jsxs("label",{className:"nc-field",children:[k("location"),u.jsxs("select",{value:v,onChange:async N=>{const W=N.target.value;y(W),L(null);try{const O=await w_(r,W?W.split("/"):[]),j=Array.isArray(O.presets)&&O.presets.length?O.presets:["shell"];C(j),S(j[0])}catch{C(["shell"]),S("shell")}},children:[u.jsx("option",{value:"",children:k("local")}),t.map(N=>u.jsx("option",{value:N.route.join("/"),children:N.label},N.route.join("/")))]})]}),u.jsxs("label",{className:"nc-field",children:[k("name"),u.jsx("input",{value:l,onChange:N=>h(N.target.value),autoFocus:!0,placeholder:"worker-1"})]}),l&&!A&&u.jsx("div",{className:"nc-err",children:k("name-invalid")}),u.jsxs("label",{className:"nc-field",children:[k("cwd"),u.jsxs("div",{className:"nc-cwd-row",children:[u.jsx("input",{value:f,onChange:N=>m(N.target.value),placeholder:"~"}),r&&u.jsx("button",{type:"button",className:"nc-btn ghost nc-cwd-browse",onClick:()=>M?L(null):K(f==="~"?"":f),children:k("browse")})]})]}),M&&u.jsxs("div",{className:"nc-fs",onMouseDown:N=>N.stopPropagation(),children:[u.jsx("div",{className:"nc-fs-path",title:M.path,children:M.path}),u.jsxs("div",{className:"nc-fs-list",children:[u.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:()=>K(M.home),children:["⌂ ",k("fs-home")]}),M.parent&&u.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:()=>K(M.parent),children:["↑ ",k("fs-parent")]}),M.dirs.map(N=>u.jsxs("button",{type:"button",className:"nc-fs-item",onClick:()=>K(`${M.path.replace(/\/$/,"")}/${N}`),children:["📁 ",N]},N)),M.dirs.length===0&&u.jsx("div",{className:"nc-fs-empty",children:"—"})]}),G&&u.jsx("div",{className:"nc-err",children:G})]}),u.jsxs("label",{className:"nc-field",children:[k("preset"),u.jsx("select",{value:p,onChange:N=>S(N.target.value),children:g.map(N=>u.jsx("option",{value:N,children:N},N))})]}),F&&u.jsx("div",{className:"nc-err",children:F}),u.jsxs("div",{className:"nc-sheet-actions",children:[u.jsx("button",{type:"button",className:"nc-btn ghost",onClick:a,disabled:x,children:k("cancel")}),u.jsx("button",{type:"submit",className:"nc-btn primary",disabled:x||!A,children:k("create")})]})]})})}const bp=/^[a-z0-9-]{1,32}$/;function g0(e,t,r){const n={};for(const a of Array.isArray(t)?t:[]){const l=Array.isArray(a==null?void 0:a.route)?a.route:typeof(a==null?void 0:a.name)=="string"?[a.name]:[];if(!l.length)continue;const h=l.join("/");a.status==="up"||a.tunnel&&a.tunnel.status==="up"||(n[h]=e&&e[h]||r)}return n}function xp(e,t,r){return!e||!Array.isArray(e.cells)?[]:e.cells.map(n=>({...n,route:t,key:`${r}:${n.cell||n.tmuxSession}`}))}function kp({nodes:e,topology:t,remote:r,down:n,fleet:a}={}){var m,p,S;const l=[],h=new Set,f=new Set;for(const g of Array.isArray(e)?e:[]){if(!g||typeof g.name!="string"||!bp.test(g.name))continue;const C=[g.name],v=g.name;h.add(v);const y=((m=g.tunnel)==null?void 0:m.status)||"unknown",x=y==="up",E={name:g.name,label:g.label||g.name,route:C,direct:!0,tunnelStatus:y,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:g.health||null};if(g.nodeId&&f.add(g.nodeId),!g.nodeId&&g.paired===!1){l.push({...E,status:"needs-repair",downSince:n&&n[v]||null});continue}if(((p=g.health)==null?void 0:p.auth)==="failed"||y==="degraded"&&((S=g.health)==null?void 0:S.status)==="degraded"){l.push({...E,status:"needs-repair",downSince:n&&n[v]||null});continue}if(!x){l.push({...E,status:"down",downSince:n&&n[v]||null});continue}const F=r&&(r[v]||r[g.name])||null;if(!F||F.error||!Array.isArray(F.sessions)){l.push({...E,status:"unreachable"});continue}const U=F.sessions.filter($=>$&&typeof $.name=="string"&&$.name).map($=>({...$,node:v,route:C,key:`${v}:${$.name}`})),M=a&&(a[v]||a[g.name]),L=xp(M,C,v),G=new Set(L.map($=>$.tmuxSession).filter(Boolean));l.push({...E,status:"up",sessions:U,cells:L,unmanaged:U.filter($=>!G.has($.name)),fleetAvailable:!!(M&&M.available),capabilities:M&&M.capabilities||[],engines:M&&M.engines||[],fleetProvider:M&&M.provider||null})}for(const g of Array.isArray(t)?t:[]){if(!g||!Array.isArray(g.route)||g.route.length<1||g.route.some(M=>!bp.test(M)))continue;const C=g.route.join("/");if(h.has(C)||g.instanceId&&f.has(g.instanceId))continue;g.instanceId&&f.add(g.instanceId);const v={name:g.name,label:g.label||g.route.join(" › "),route:[...g.route],direct:!1,tunnelStatus:null,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:g.health||null,lastSeen:g.lastSeen||null};if(g.stale){l.push({...v,status:"offline",downSince:n&&n[C]||g.lastSeen||null});continue}const y=r&&r[C]||null;if(!y||y.error||!Array.isArray(y.sessions)){l.push({...v,status:"unreachable",downSince:n&&n[C]||null});continue}const x=y.sessions.filter(M=>M&&typeof M.name=="string"&&M.name).map(M=>({...M,node:C,route:g.route,key:`${C}:${M.name}`})),E=a&&a[C],F=xp(E,g.route,C),U=new Set(F.map(M=>M.tmuxSession).filter(Boolean));l.push({...v,status:"up",sessions:x,cells:F,unmanaged:x.filter(M=>!U.has(M.name)),fleetAvailable:!!(E&&E.available),capabilities:E&&E.capabilities||[],engines:E&&E.engines||[],fleetProvider:E&&E.provider||null,lastSeen:g.lastSeen||null})}return l.sort((g,C)=>g.label.localeCompare(C.label))}const v0=4e3;function uu(e,t=!0){const[r,n]=I.useState([]),a=I.useRef({});return I.useEffect(()=>{if(!t||!e){n([]);return}let l=!0;async function h(){var x;let m=[],p=[];if(await Promise.all([y_(e).then(E=>{m=Array.isArray(E.nodes)?E.nodes:[]}).catch(()=>{}),t0(e).then(E=>{p=Array.isArray(E.nodes)?E.nodes:[]}).catch(()=>{})]),!l)return;const S={},g={},C=new Set(m.map(E=>E.name)),v=[];for(const E of m)((x=E.tunnel)==null?void 0:x.status)==="up"&&(E.nodeId||E.paired!==!1)&&v.push([E.name]);for(const E of p)!E.stale&&Array.isArray(E.route)&&!(E.route.length===1&&C.has(E.route[0]))&&v.push(E.route);if(await Promise.all(v.map(async E=>{const F=E.join("/");try{S[F]=await S_(e,E)}catch{S[F]={error:"unreachable"}}try{g[F]=await Rs(e,E)}catch{g[F]={available:!1}}})),!l)return;const y=kp({nodes:m,topology:p,remote:S,fleet:g,down:a.current});a.current=g0(a.current,y,Math.floor(Date.now()/1e3)),n(kp({nodes:m,topology:p,remote:S,fleet:g,down:a.current}))}h();const f=setInterval(h,v0);return()=>{l=!1,clearInterval(f)}},[e,t]),r}function Ep(e,t){return t?0:e.attached?1:2}function Dn(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 kc(e){return e.status==="down"?e.downSince?k("tunnel-down-since").replace("{t}",Dn(e.downSince)):k("tunnel-down"):e.status==="unreachable"?k("node-unreachable"):e.status==="offline"?e.lastSeen?k("node-offline-seen").replace("{t}",Dn(e.lastSeen)):k("node-offline"):e.status==="needs-repair"?k("node-needs-repair"):""}function y0(e){return e?e.status==="healthy"?"on":"warn":null}function Np(e){return e&&(e.detail||e.status)||""}function S0({onPick:e,token:t,onSettings:r}){const[n,a]=Yt(),l=uu(t),[h,f]=I.useState(null),[m,p]=I.useState(null),[S,g]=I.useState(""),[C,v]=I.useState(""),[y,x]=I.useState({bind:"127.0.0.1",port:""}),[E,F]=I.useState([]),[U,M]=I.useState(!1),[L,G]=I.useState([]),[$,A]=I.useState(["shell","claude","codex-vl","pi"]),[K,P]=I.useState(null),[N,W]=I.useState(!1),[O,j]=I.useState(null);async function B(){try{const ye=await(await wt("/api/sessions",t)).json();ye.error?(p(ye.error),f([])):(p(null),f(ye.sessions||[]))}catch(Y){p(String(Y)),f([])}try{const Y=await Rs(t);M(!!Y.available),F(Y.available?Y.cells||[]:[]),G(Y.available?Y.engines||[]:[])}catch{M(!1),F([]),G([])}}I.useEffect(()=>{B(),wt("/api/config",t).then(ye=>ye.json()).then(ye=>{v(ye.version||""),x({bind:ye.bind||"127.0.0.1",port:ye.port||""}),Array.isArray(ye.presets)&&ye.presets.length&&A(ye.presets)}).catch(()=>{});const Y=setInterval(B,4e3);return()=>clearInterval(Y)},[]);async function V(){if(!y.port)return;const Y=`http://${y.bind}:${y.port}/#token=${t}`;try{await navigator.clipboard.writeText(Y)}catch{}}async function Q(Y){if(!K)return;const{cell:ye}=K,me=Array.isArray(K.route)?K.route:[];Y.action==="up"?await ou(t,{cell:ye,engine:Y.engine,model:Y.model||"",boot:!!Y.boot},me):await au(t,{cell:ye,boot:!!Y.boot},me),B()}async function ee(Y,ye=[]){try{await lu(t,Y,ye)}catch{return}B()}async function b(Y,ye=[]){await __(t,Y,ye),W(!1),B()}async function Z(Y){if(!(!(Y!=null&&Y.direct)||O)){j(Y.name);try{await cu(t,Y.name,Y.tunnelStatus==="up"?"down":"up")}catch{}j(null)}}const te=I.useMemo(()=>{const Y=new Map;for(const ye of h||[])Y.set(ye.name,ye);return Y},[h]),R=I.useMemo(()=>new Set(E.map(Y=>Y.tmuxSession)),[E]),[T,ne]=I.useState(x_),ce=Y=>ne(ye=>k_(ye,Y)),ue=I.useMemo(()=>{const Y=(h||[]).map(me=>{const He=Number(localStorage.getItem(p_(me.name))||0),Me=!!(me.outbox&&me.outbox.count>0&&me.outbox.latest>He);return{...me,fresh:Me}}),ye=S.trim().toLowerCase();return Y.filter(me=>!ye||me.name.toLowerCase().includes(ye)).sort((me,He)=>uh(bn(T,me.name,me.activity),bn(T,He.name,He.activity))||Ep(me,me.fresh)-Ep(He,He.fresh)||me.name.localeCompare(He.name))},[h,S,T]),ge=ue.filter(Y=>!R.has(Y.name)),Ce=I.useMemo(()=>[...E].sort((Y,ye)=>uh(bn(T,Y.tmuxSession,(te.get(Y.tmuxSession)||{}).activity),bn(T,ye.tmuxSession,(te.get(ye.tmuxSession)||{}).activity))||Number(ye.active)-Number(Y.active)||Y.cell.localeCompare(ye.cell)),[E,T,te]),be=h?h.length:0,xe=(h||[]).filter(Y=>Y.attached).length,Oe=y.port?`${y.bind}:${y.port}`:y.bind;return u.jsxs("div",{className:"nc-home",children:[u.jsxs("header",{className:"nc-home-head",children:[u.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",u.jsx("span",{className:"nc-cursor"})]}),u.jsxs("div",{className:"nc-home-sub",children:[k("fleet-tmux")," · ",be," ",k("sessions"),xe>0&&` · ${xe} attached`]}),u.jsxs("span",{className:"nc-head-actions",children:[u.jsx("button",{className:"nc-refresh",onClick:r,title:k("settings"),children:u.jsx(Fe,{name:"gear",size:18})}),u.jsx("button",{className:"nc-refresh",onClick:B,title:k("refresh"),children:u.jsx(Fe,{name:"refresh",size:18})})]})]}),be>8&&u.jsx("input",{className:"nc-filter",type:"search",placeholder:k("filter-placeholder"),value:S,onChange:Y=>g(Y.target.value)}),m&&u.jsx("div",{className:"nc-err",children:m}),U&&E.length>0&&u.jsxs("section",{className:"nc-group",children:[u.jsx("div",{className:"nc-group-title",children:k("fleet")}),Ce.map(Y=>{const ye=te.get(Y.tmuxSession)||{},me=Y.degraded?"warn":Y.tmux?"on":"",He=[`${Y.engine}${Y.key?`·${Y.key}`:""}`,ye.preview].filter(Boolean).join(" · ");return u.jsxs("div",{className:"nc-mcard",children:[u.jsxs("button",{className:"nc-mcard-main",onClick:()=>Y.tmux&&e(Y.tmuxSession),title:Y.degraded?k("cell-degraded"):Y.tmux?k("cell-on"):k("cell-off"),children:[u.jsx("span",{className:`dot ${me}`}),u.jsxs("span",{className:"nc-mcard-text",children:[u.jsx("b",{children:Y.cell}),u.jsx("small",{children:He})]})]}),ye.activity?u.jsx("span",{className:"nc-rel",children:Dn(ye.activity)}):null,ye.outbox&&ye.outbox.count>0&&u.jsx("span",{className:"nc-badge",title:k("new-files-outbox"),children:ye.outbox.count}),u.jsx("button",{className:`nc-act pin${T.includes(Y.tmuxSession)?" on":""}`,title:k("pin"),onClick:()=>ce(Y.tmuxSession),children:T.includes(Y.tmuxSession)?"★":"☆"}),u.jsx("button",{className:`nc-act power${Y.tmux?" on":""}${Y.degraded?" warn":""}`,onClick:()=>P(Y),title:Y.active?k("power-off"):k("power-on"),children:u.jsx(Fe,{name:"power",size:16})})]},Y.cell)})]}),u.jsxs("section",{className:"nc-group",children:[u.jsx("div",{className:"nc-group-title",children:k("local")}),ge.map(Y=>u.jsxs("div",{className:"nc-mcard",children:[u.jsxs("button",{className:"nc-mcard-main",onClick:()=>e(Y.name),children:[u.jsx("span",{className:Y.attached?"dot on":"dot"}),u.jsxs("span",{className:"nc-mcard-text",children:[u.jsx("b",{children:Y.name}),u.jsx("small",{children:Y.preview?Y.preview:Y.cmd?Y.cmd:k("windows").replace("{n}",String(Y.windows||0))})]})]}),Y.activity?u.jsx("span",{className:"nc-rel",children:Dn(Y.activity)}):null,Y.fresh&&u.jsx("span",{className:"nc-badge",title:k("new-files-outbox"),children:Y.outbox.count}),u.jsx("button",{className:`nc-act pin${T.includes(Y.name)?" on":""}`,title:k("pin"),onClick:()=>ce(Y.name),children:T.includes(Y.name)?"★":"☆"}),u.jsx("button",{className:"nc-menu",title:k("terminate"),onClick:()=>{window.confirm(k("terminate-confirm").replace("{name}",Y.name))&&ee(Y.name)},children:"⋯"})]},Y.name)),h===null&&u.jsx("div",{className:"nc-empty",children:k("loading-fleet")}),h!==null&&ge.length===0&&ue.length===0&&!m&&u.jsx("div",{className:"nc-empty",children:S?k("no-match").replace("{q}",S):k("no-sessions")})]}),l.map(Y=>{const me=y0(Y.health)||(Y.status==="up"?"on":"warn"),He=Y.health?Np(Y.health):Y.status==="up"?"":kc(Y);return u.jsxs("section",{className:"nc-group",children:[u.jsxs("div",{className:"nc-group-title nc-node-title",children:[u.jsx("span",{className:`dot ${me}`,title:He}),Y.label||Y.name," · ",Y.status==="up"?k("node-sessions").replace("{n}",String(Y.cells.length+Y.unmanaged.length)):Y.health&&Np(Y.health)||kc(Y),Y.direct&&Y.health&&Y.health.managed!==!1&&u.jsx("button",{type:"button",className:`nc-act power${Y.tunnelStatus==="up"?" on":""}`,disabled:O===Y.name,title:Y.tunnelStatus==="up"?k("power-off"):k("power-on"),onClick:()=>Z(Y),children:u.jsx(Fe,{name:"power",size:15})})]}),Y.status==="up"&&Y.cells.length>0&&Y.cells.map(Me=>u.jsxs("div",{className:"nc-mcard",children:[u.jsxs("button",{className:"nc-mcard-main",onClick:()=>Me.tmux&&e({session:Me.tmuxSession,node:(Y.route||[Y.name]).join("/")}),title:Me.active?k("cell-on"):k("cell-off"),children:[u.jsx("span",{className:`dot ${Me.degraded?"warn":Me.tmux?"on":""}`}),u.jsxs("span",{className:"nc-mcard-text",children:[u.jsx("b",{children:Me.cell}),u.jsxs("small",{children:[`${Me.engine}${Me.key?`·${Me.key}`:""}`,Me.active?"":` · ${k("cell-off")}`]})]})]}),(Y.capabilities||[]).includes(Me.active?"down":"up")&&u.jsx("button",{className:`nc-act power${Me.active?" on":""}${Me.degraded?" warn":""}`,title:Me.active?k("power-off"):k("power-on"),onClick:()=>P({...Me,route:Y.route,availableEngines:Y.engines||[]}),children:u.jsx(Fe,{name:"power",size:15})})]},Me.key)),Y.status==="up"&&Y.unmanaged.map(Me=>u.jsxs("div",{className:"nc-mcard",children:[u.jsxs("button",{className:"nc-mcard-main",onClick:()=>e({session:Me.name,node:Me.node}),children:[u.jsx("span",{className:Me.attached?"dot on":"dot"}),u.jsxs("span",{className:"nc-mcard-text",children:[u.jsx("b",{children:Me.name}),u.jsx("small",{children:Me.preview?Me.preview:Me.cmd?Me.cmd:k("windows").replace("{n}",String(Me.windows||0))})]})]}),Me.activity?u.jsx("span",{className:"nc-rel",children:Dn(Me.activity)}):null,u.jsx("button",{className:"nc-menu",title:k("terminate"),onClick:()=>{window.confirm(k("terminate-confirm").replace("{name}",Me.name))&&ee(Me.name,Y.route)},children:"⋯"})]},Me.key)),Y.status==="up"&&Y.cells.length===0&&Y.unmanaged.length===0&&u.jsx("div",{className:"nc-empty",children:k("no-sessions-short")})]},`nodo-${(Y.route||[Y.name]).join("/")}`)}),u.jsxs("footer",{className:"nc-home-foot",onClick:V,title:k("copy-url"),children:[C&&u.jsxs("span",{children:["v",C]}),u.jsxs("span",{children:[Oe," · ",k("ssh-only")]}),u.jsx("span",{className:"nc-lang",onClick:Y=>Y.stopPropagation(),children:R_.map((Y,ye)=>u.jsxs("span",{children:[ye>0&&" · ",u.jsx("button",{className:`nc-lang-btn${n===Y?" on":""}`,onClick:()=>a(Y),title:Y,children:Y.toUpperCase()})]},Y))})]}),u.jsx("button",{className:"nc-fab",onClick:()=>W(!0),title:k("new-session"),"aria-label":k("new-session"),children:"+"}),K&&u.jsx(D_,{cell:K,engines:K.availableEngines||L,onConfirm:Q,onClose:()=>P(null)}),N&&u.jsx(M_,{presets:$,targets:l.filter(Y=>Y.status==="up").map(Y=>({route:Y.route,label:Y.label||Y.name})),token:t,onCreate:b,onClose:()=>W(!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 L_=Object.defineProperty,w0=Object.getOwnPropertyDescriptor,C0=(e,t)=>{for(var r in t)L_(e,r,{get:t[r],enumerable:!0})},it=(e,t,r,n)=>{for(var a=n>1?void 0:n?w0(t,r):t,l=e.length-1,h;l>=0;l--)(h=e[l])&&(a=(n?h(t,r,a):h(a))||a);return n&&a&&L_(t,r,a),a},de=(e,t)=>(r,n)=>t(r,n,e),Rp="Terminal input",ph={get:()=>Rp,set:e=>Rp=e},Dp="Too much output to announce, navigate to rows manually to read",mh={get:()=>Dp,set:e=>Dp=e};function b0(e){return e.replace(/\r?\n/g,"\r")}function x0(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function k0(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function E0(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");P_(a,t,r,n)}}function P_(e,t,r,n){e=b0(e),e=x0(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function T_(e,t,r){let n=r.getBoundingClientRect(),a=e.clientX-n.left-10,l=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${l}px`,t.style.zIndex="1000",t.focus()}function Mp(e,t,r,n,a){T_(e,t,r),a&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function xr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ka(e,t=0,r=e.length){let n="";for(let a=t;a<r;++a){let l=e[a];l>65535?(l-=65536,n+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):n+=String.fromCharCode(l)}return n}var N0=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let n=0,a=0;if(this._interim){let l=e.charCodeAt(a++);56320<=l&&l<=57343?t[n++]=(this._interim-55296)*1024+l-56320+65536:(t[n++]=this._interim,t[n++]=l),this._interim=0}for(let l=a;l<r;++l){let h=e.charCodeAt(l);if(55296<=h&&h<=56319){if(++l>=r)return this._interim=h,n;let f=e.charCodeAt(l);56320<=f&&f<=57343?t[n++]=(h-55296)*1024+f-56320+65536:(t[n++]=h,t[n++]=f);continue}h!==65279&&(t[n++]=h)}return n}},R0=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let n=0,a,l,h,f,m=0,p=0;if(this.interim[0]){let C=!1,v=this.interim[0];v&=(v&224)===192?31:(v&240)===224?15:7;let y=0,x;for(;(x=this.interim[++y]&63)&&y<4;)v<<=6,v|=x;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,F=E-y;for(;p<F;){if(p>=r)return 0;if(x=e[p++],(x&192)!==128){p--,C=!0;break}else this.interim[y++]=x,v<<=6,v|=x&63}C||(E===2?v<128?p--:t[n++]=v:E===3?v<2048||v>=55296&&v<=57343||v===65279||(t[n++]=v):v<65536||v>1114111||(t[n++]=v)),this.interim.fill(0)}let S=r-4,g=p;for(;g<r;){for(;g<S&&!((a=e[g])&128)&&!((l=e[g+1])&128)&&!((h=e[g+2])&128)&&!((f=e[g+3])&128);)t[n++]=a,t[n++]=l,t[n++]=h,t[n++]=f,g+=4;if(a=e[g++],a<128)t[n++]=a;else if((a&224)===192){if(g>=r)return this.interim[0]=a,n;if(l=e[g++],(l&192)!==128){g--;continue}if(m=(a&31)<<6|l&63,m<128){g--;continue}t[n++]=m}else if((a&240)===224){if(g>=r)return this.interim[0]=a,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=r)return this.interim[0]=a,this.interim[1]=l,n;if(h=e[g++],(h&192)!==128){g--;continue}if(m=(a&15)<<12|(l&63)<<6|h&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[n++]=m}else if((a&248)===240){if(g>=r)return this.interim[0]=a,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=r)return this.interim[0]=a,this.interim[1]=l,n;if(h=e[g++],(h&192)!==128){g--;continue}if(g>=r)return this.interim[0]=a,this.interim[1]=l,this.interim[2]=h,n;if(f=e[g++],(f&192)!==128){g--;continue}if(m=(a&7)<<18|(l&63)<<12|(h&63)<<6|f&63,m<65536||m>1114111)continue;t[n++]=m}}return n}},B_="",kr=" ",jn=class j_{constructor(){this.fg=0,this.bg=0,this.extended=new fa}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new j_;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},fa=class A_{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}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 A_(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},mi=class I_ extends jn{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new fa,this.combinedData=""}static fromCharData(t){let r=new I_;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?xr(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 r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(n-55296)*1024+a-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Lp="di$target",_h="di$dependencies",Ec=new Map;function D0(e){return e[_h]||[]}function Ct(e){if(Ec.has(e))return Ec.get(e);let t=function(r,n,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");M0(t,r,a)};return t._id=e,Ec.set(e,t),t}function M0(e,t,r){t[Lp]===t?t[_h].push({id:e,index:r}):(t[_h]=[{id:e,index:r}],t[Lp]=t)}var It=Ct("BufferService"),O_=Ct("CoreMouseService"),Xr=Ct("CoreService"),L0=Ct("CharsetService"),du=Ct("InstantiationService"),z_=Ct("LogService"),Ot=Ct("OptionsService"),F_=Ct("OscLinkService"),P0=Ct("UnicodeService"),An=Ct("DecorationService"),gh=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var S;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let n=[],a=this._optionsService.rawOptions.linkHandler,l=new mi,h=r.getTrimmedLength(),f=-1,m=-1,p=!1;for(let g=0;g<h;g++)if(!(m===-1&&!r.hasContent(g))){if(r.loadCell(g,l),l.hasExtendedAttrs()&&l.extended.urlId)if(m===-1){m=g,f=l.extended.urlId;continue}else p=l.extended.urlId!==f;else m!==-1&&(p=!0);if(p||m!==-1&&g===h-1){let C=(S=this._oscLinkService.getLinkData(f))==null?void 0:S.uri;if(C){let v={start:{x:m+1,y:e},end:{x:g+(!p&&g===h-1?1:0),y:e}},y=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let x=new URL(C);["http:","https:"].includes(x.protocol)||(y=!0)}catch{y=!0}y||n.push({text:C,range:v,activate:(x,E)=>a?a.activate(x,E,v):T0(x,E),hover:(x,E)=>{var F;return(F=a==null?void 0:a.hover)==null?void 0:F.call(a,x,E,v)},leave:(x,E)=>{var F;return(F=a==null?void 0:a.leave)==null?void 0:F.call(a,x,E,v)}})}p=!1,l.hasExtendedAttrs()&&l.extended.urlId?(m=g,f=l.extended.urlId):(m=-1,f=-1)}}t(n)}};gh=it([de(0,It),de(1,Ot),de(2,F_)],gh);function T0(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
52
|
+
|
|
53
|
+
WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Ea=Ct("CharSizeService"),Qi=Ct("CoreBrowserService"),fu=Ct("MouseService"),Ji=Ct("RenderService"),B0=Ct("SelectionService"),H_=Ct("CharacterJoinerService"),Ds=Ct("ThemeService"),W_=Ct("LinkProviderService"),j0=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Pp.isErrorNoTelemetry(e)?new Pp(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)}},A0=new j0;function aa(e){I0(e)||A0.onUnexpectedError(e)}var vh="Canceled";function I0(e){return e instanceof O0?!0:e instanceof Error&&e.name===vh&&e.message===vh}var O0=class extends Error{constructor(){super(vh),this.name=this.message}};function z0(e){return new Error(`Illegal argument: ${e}`)}var Pp=class yh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof yh)return t;let r=new yh;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Sh=class $_ extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,$_.prototype)}};function Zt(e,t=0){return e[e.length-(1+t)]}var F0;(e=>{function t(l){return l<0}e.isLessThan=t;function r(l){return l<=0}e.isLessThanOrEqual=r;function n(l){return l>0}e.isGreaterThan=n;function a(l){return l===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(F0||(F0={}));function H0(e,t){let r=this,n=!1,a;return function(){return n||(n=!0,t||(a=e.apply(r,arguments))),a}}var U_;(e=>{function t(L){return L&&typeof L=="object"&&typeof L[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*a(L){yield L}e.single=a;function l(L){return t(L)?L:a(L)}e.wrap=l;function h(L){return L||r}e.from=h;function*f(L){for(let G=L.length-1;G>=0;G--)yield L[G]}e.reverse=f;function m(L){return!L||L[Symbol.iterator]().next().done===!0}e.isEmpty=m;function p(L){return L[Symbol.iterator]().next().value}e.first=p;function S(L,G){let $=0;for(let A of L)if(G(A,$++))return!0;return!1}e.some=S;function g(L,G){for(let $ of L)if(G($))return $}e.find=g;function*C(L,G){for(let $ of L)G($)&&(yield $)}e.filter=C;function*v(L,G){let $=0;for(let A of L)yield G(A,$++)}e.map=v;function*y(L,G){let $=0;for(let A of L)yield*G(A,$++)}e.flatMap=y;function*x(...L){for(let G of L)yield*G}e.concat=x;function E(L,G,$){let A=$;for(let K of L)A=G(A,K);return A}e.reduce=E;function*F(L,G,$=L.length){for(G<0&&(G+=L.length),$<0?$+=L.length:$>L.length&&($=L.length);G<$;G++)yield L[G]}e.slice=F;function U(L,G=Number.POSITIVE_INFINITY){let $=[];if(G===0)return[$,L];let A=L[Symbol.iterator]();for(let K=0;K<G;K++){let P=A.next();if(P.done)return[$,e.empty()];$.push(P.value)}return[$,{[Symbol.iterator](){return A}}]}e.consume=U;async function M(L){let G=[];for await(let $ of L)G.push($);return Promise.resolve(G)}e.asyncToArray=M})(U_||(U_={}));function qr(e){if(U_.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(n){t.push(n)}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 W0(...e){return Xe(()=>qr(e))}function Xe(e){return{dispose:H0(()=>{e()})}}var K_=class V_{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{qr(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?V_.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)}};K_.DISABLE_DISPOSED_WARNING=!1;var Er=K_,Pe=class{constructor(){this._store=new Er,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)}};Pe.None=Object.freeze({dispose(){}});var Es=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}},Xi=typeof window=="object"?window:globalThis,wh=class Ch{constructor(t){this.element=t,this.next=Ch.Undefined,this.prev=Ch.Undefined}};wh.Undefined=new wh(void 0);var Je=wh,Tp=class{constructor(){this._first=Je.Undefined,this._last=Je.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Je.Undefined}clear(){let e=this._first;for(;e!==Je.Undefined;){let t=e.next;e.prev=Je.Undefined,e.next=Je.Undefined,e=t}this._first=Je.Undefined,this._last=Je.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Je(e);if(this._first===Je.Undefined)this._first=r,this._last=r;else if(t){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==Je.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Je.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Je.Undefined&&e.next!==Je.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Je.Undefined&&e.next===Je.Undefined?(this._first=Je.Undefined,this._last=Je.Undefined):e.next===Je.Undefined?(this._last=this._last.prev,this._last.next=Je.Undefined):e.prev===Je.Undefined&&(this._first=this._first.next,this._first.prev=Je.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Je.Undefined;)yield e.element,e=e.next}},$0=globalThis.performance&&typeof globalThis.performance.now=="function",U0=class q_{static create(t){return new q_(t)}constructor(t){this._now=$0&&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}},Nt;(e=>{e.None=()=>Pe.None;function t(O,j){return g(O,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function r(O){return(j,B=null,V)=>{let Q=!1,ee;return ee=O(b=>{if(!Q)return ee?ee.dispose():Q=!0,j.call(B,b)},null,V),Q&&ee.dispose(),ee}}e.once=r;function n(O,j,B){return p((V,Q=null,ee)=>O(b=>V.call(Q,j(b)),null,ee),B)}e.map=n;function a(O,j,B){return p((V,Q=null,ee)=>O(b=>{j(b),V.call(Q,b)},null,ee),B)}e.forEach=a;function l(O,j,B){return p((V,Q=null,ee)=>O(b=>j(b)&&V.call(Q,b),null,ee),B)}e.filter=l;function h(O){return O}e.signal=h;function f(...O){return(j,B=null,V)=>{let Q=W0(...O.map(ee=>ee(b=>j.call(B,b))));return S(Q,V)}}e.any=f;function m(O,j,B,V){let Q=B;return n(O,ee=>(Q=j(Q,ee),Q),V)}e.reduce=m;function p(O,j){let B,V={onWillAddFirstListener(){B=O(Q.fire,Q)},onDidRemoveLastListener(){B==null||B.dispose()}},Q=new le(V);return j==null||j.add(Q),Q.event}function S(O,j){return j instanceof Array?j.push(O):j&&j.add(O),O}function g(O,j,B=100,V=!1,Q=!1,ee,b){let Z,te,R,T=0,ne,ce={leakWarningThreshold:ee,onWillAddFirstListener(){Z=O(ge=>{T++,te=j(te,ge),V&&!R&&(ue.fire(te),te=void 0),ne=()=>{let Ce=te;te=void 0,R=void 0,(!V||T>1)&&ue.fire(Ce),T=0},typeof B=="number"?(clearTimeout(R),R=setTimeout(ne,B)):R===void 0&&(R=0,queueMicrotask(ne))})},onWillRemoveListener(){Q&&T>0&&(ne==null||ne())},onDidRemoveLastListener(){ne=void 0,Z.dispose()}},ue=new le(ce);return b==null||b.add(ue),ue.event}e.debounce=g;function C(O,j=0,B){return e.debounce(O,(V,Q)=>V?(V.push(Q),V):[Q],j,void 0,!0,void 0,B)}e.accumulate=C;function v(O,j=(V,Q)=>V===Q,B){let V=!0,Q;return l(O,ee=>{let b=V||!j(ee,Q);return V=!1,Q=ee,b},B)}e.latch=v;function y(O,j,B){return[e.filter(O,j,B),e.filter(O,V=>!j(V),B)]}e.split=y;function x(O,j=!1,B=[],V){let Q=B.slice(),ee=O(te=>{Q?Q.push(te):Z.fire(te)});V&&V.add(ee);let b=()=>{Q==null||Q.forEach(te=>Z.fire(te)),Q=null},Z=new le({onWillAddFirstListener(){ee||(ee=O(te=>Z.fire(te)),V&&V.add(ee))},onDidAddFirstListener(){Q&&(j?setTimeout(b):b())},onDidRemoveLastListener(){ee&&ee.dispose(),ee=null}});return V&&V.add(Z),Z.event}e.buffer=x;function E(O,j){return(B,V,Q)=>{let ee=j(new U);return O(function(b){let Z=ee.evaluate(b);Z!==F&&B.call(V,Z)},void 0,Q)}}e.chain=E;let F=Symbol("HaltChainable");class U{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(B=>(j(B),B)),this}filter(j){return this.steps.push(B=>j(B)?B:F),this}reduce(j,B){let V=B;return this.steps.push(Q=>(V=j(V,Q),V)),this}latch(j=(B,V)=>B===V){let B=!0,V;return this.steps.push(Q=>{let ee=B||!j(Q,V);return B=!1,V=Q,ee?Q:F}),this}evaluate(j){for(let B of this.steps)if(j=B(j),j===F)break;return j}}function M(O,j,B=V=>V){let V=(...Z)=>b.fire(B(...Z)),Q=()=>O.on(j,V),ee=()=>O.removeListener(j,V),b=new le({onWillAddFirstListener:Q,onDidRemoveLastListener:ee});return b.event}e.fromNodeEventEmitter=M;function L(O,j,B=V=>V){let V=(...Z)=>b.fire(B(...Z)),Q=()=>O.addEventListener(j,V),ee=()=>O.removeEventListener(j,V),b=new le({onWillAddFirstListener:Q,onDidRemoveLastListener:ee});return b.event}e.fromDOMEventEmitter=L;function G(O){return new Promise(j=>r(O)(j))}e.toPromise=G;function $(O){let j=new le;return O.then(B=>{j.fire(B)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=$;function A(O,j){return O(B=>j.fire(B))}e.forward=A;function K(O,j,B){return j(B),O(V=>j(V))}e.runAndSubscribe=K;class P{constructor(j,B){this._observable=j,this._counter=0,this._hasChanged=!1;let V={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new le(V),B&&B.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,B){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function N(O,j){return new P(O,j).emitter.event}e.fromObservable=N;function W(O){return(j,B,V)=>{let Q=0,ee=!1,b={beginUpdate(){Q++},endUpdate(){Q--,Q===0&&(O.reportChanges(),ee&&(ee=!1,j.call(B)))},handlePossibleChange(){},handleChange(){ee=!0}};O.addObserver(b),O.reportChanges();let Z={dispose(){O.removeObserver(b)}};return V instanceof Er?V.add(Z):Array.isArray(V)&&V.push(Z),Z}}e.fromObservableLight=W})(Nt||(Nt={}));var bh=class xh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${xh._idPool++}`,xh.all.add(this)}start(t){this._stopWatch=new U0,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}}};bh.all=new Set,bh._idPool=0;var K0=bh,V0=-1,Y_=class X_{constructor(t,r,n=(X_._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let n=this.threshold;if(n<=0||r<n)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[l,h]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${h}):`;console.warn(f),console.warn(l);let m=new X0(f,l);this._errorHandler(m)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,a]of this._stacks)(!t||r<a)&&(t=[n,a],r=a);return t}};Y_._idPool=1;var q0=Y_,Y0=class G_{constructor(t){this.value=t}static create(){let t=new Error;return new G_(t.stack??"")}print(){console.warn(this.value.split(`
|
|
58
|
+
`).slice(2).join(`
|
|
59
|
+
`))}},X0=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},G0=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Q0=0,Nc=class{constructor(e){this.value=e,this.id=Q0++}},J0=2,Z0,le=class{constructor(e){var t,r,n,a;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new q0((e==null?void 0:e.onListenerError)??aa,((r=this._options)==null?void 0:r.leakWarningThreshold)??V0):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new K0(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var e,t,r,n;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),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(n=this._leakageMon)==null||n.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var h,f,m,p,S;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);let C=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],v=new G0(`${g}. HINT: Stack shows most frequent listener (${C[1]}-times)`,C[0]);return(((h=this._options)==null?void 0:h.onListenerError)||aa)(v),Pe.None}if(this._disposed)return Pe.None;t&&(e=e.bind(t));let n=new Nc(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=Y0.create(),a=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof Nc?(this._deliveryQueue??(this._deliveryQueue=new eS),this._listeners=[this._listeners,n]):this._listeners.push(n):((m=(f=this._options)==null?void 0:f.onWillAddFirstListener)==null||m.call(f,this),this._listeners=n,(S=(p=this._options)==null?void 0:p.onDidAddFirstListener)==null||S.call(p,this)),this._size++;let l=Xe(()=>{a==null||a(),this._removeListener(n)});return r instanceof Er?r.add(l):Array.isArray(r)&&r.push(l),l}),this._event}_removeListener(e){var a,l,h,f;if((l=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||l.call(a,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(f=(h=this._options)==null?void 0:h.onDidRemoveLastListener)==null||f.call(h,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-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[r]=void 0;let n=this._deliveryQueue.current===this;if(this._size*J0<=t.length){let m=0;for(let p=0;p<t.length;p++)t[p]?t[m++]=t[p]:n&&(this._deliveryQueue.end--,m<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=m}}_deliver(e,t){var n;if(!e)return;let r=((n=this._options)==null?void 0:n.onListenerError)||aa;if(!r){e.value(t);return}try{e.value(t)}catch(a){r(a)}}_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,r,n,a;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(n=this._perfMon)==null||n.start(this._size),this._listeners)if(this._listeners instanceof Nc)this._deliver(this._listeners,e);else{let l=this._deliveryQueue;l.enqueue(this,e,this._listeners.length),this._deliverQueue(l)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},eS=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},kh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new le,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new le,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};kh.INSTANCE=new kh;var pu=kh;function tS(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}pu.INSTANCE.onDidChangeZoomLevel;function iS(e){return pu.INSTANCE.getZoomFactor(e)}pu.INSTANCE.onDidChangeFullscreen;var Ms=typeof navigator=="object"?navigator.userAgent:"",Eh=Ms.indexOf("Firefox")>=0,rS=Ms.indexOf("AppleWebKit")>=0,mu=Ms.indexOf("Chrome")>=0,sS=!mu&&Ms.indexOf("Safari")>=0;Ms.indexOf("Electron/")>=0;Ms.indexOf("Android")>=0;var Rc=!1;if(typeof Xi.matchMedia=="function"){let e=Xi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Xi.matchMedia("(display-mode: fullscreen)");Rc=e.matches,tS(Xi,e,({matches:r})=>{Rc&&t.matches||(Rc=r)})}var ks="en",Nh=!1,Rh=!1,la=!1,Q_=!1,Jo,ca=ks,Bp=ks,nS,xi,Vr=globalThis,Et,u_;typeof Vr.vscode<"u"&&typeof Vr.vscode.process<"u"?Et=Vr.vscode.process:typeof process<"u"&&typeof((u_=process==null?void 0:process.versions)==null?void 0:u_.node)=="string"&&(Et=process);var d_,oS=typeof((d_=Et==null?void 0:Et.versions)==null?void 0:d_.electron)=="string",aS=oS&&(Et==null?void 0:Et.type)==="renderer",f_;if(typeof Et=="object"){Nh=Et.platform==="win32",Rh=Et.platform==="darwin",la=Et.platform==="linux",la&&Et.env.SNAP&&Et.env.SNAP_REVISION,Et.env.CI||Et.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Jo=ks,ca=ks;let e=Et.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Jo=t.userLocale,Bp=t.osLocale,ca=t.resolvedLanguage||ks,nS=(f_=t.languagePack)==null?void 0:f_.translationsConfigFile}catch{}Q_=!0}else typeof navigator=="object"&&!aS?(xi=navigator.userAgent,Nh=xi.indexOf("Windows")>=0,Rh=xi.indexOf("Macintosh")>=0,(xi.indexOf("Macintosh")>=0||xi.indexOf("iPad")>=0||xi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,la=xi.indexOf("Linux")>=0,(xi==null?void 0:xi.indexOf("Mobi"))>=0,ca=globalThis._VSCODE_NLS_LANGUAGE||ks,Jo=navigator.language.toLowerCase(),Bp=Jo):console.error("Unable to resolve platform.");var J_=Nh,Ii=Rh,lS=la,jp=Q_,Oi=xi,Sr=ca,cS;(e=>{function t(){return Sr}e.value=t;function r(){return Sr.length===2?Sr==="en":Sr.length>=3?Sr[0]==="e"&&Sr[1]==="n"&&Sr[2]==="-":!1}e.isDefaultVariant=r;function n(){return Sr==="en"}e.isDefault=n})(cS||(cS={}));var hS=typeof Vr.postMessage=="function"&&!Vr.importScripts;(()=>{if(hS){let e=[];Vr.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,a=e.length;n<a;n++){let l=e[n];if(l.id===r.data.vscodeScheduleAsyncWork){e.splice(n,1),l.callback();return}}});let t=0;return r=>{let n=++t;e.push({id:n,callback:r}),Vr.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var uS=!!(Oi&&Oi.indexOf("Chrome")>=0);Oi&&Oi.indexOf("Firefox")>=0;!uS&&Oi&&Oi.indexOf("Safari")>=0;Oi&&Oi.indexOf("Edg/")>=0;Oi&&Oi.indexOf("Android")>=0;var Cs=typeof navigator=="object"?navigator:{};jp||document.queryCommandSupported&&document.queryCommandSupported("copy")||Cs&&Cs.clipboard&&Cs.clipboard.writeText,jp||Cs&&Cs.clipboard&&Cs.clipboard.readText;var _u=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Dc=new _u,Ap=new _u,Ip=new _u,dS=new Array(230),Z_;(e=>{function t(f){return Dc.keyCodeToStr(f)}e.toString=t;function r(f){return Dc.strToKeyCode(f)}e.fromString=r;function n(f){return Ap.keyCodeToStr(f)}e.toUserSettingsUS=n;function a(f){return Ip.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function l(f){return Ap.strToKeyCode(f)||Ip.strToKeyCode(f)}e.fromUserSettings=l;function h(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Dc.keyCodeToStr(f)}e.toElectronAccelerator=h})(Z_||(Z_={}));var fS=class eg{constructor(t,r,n,a,l){this.ctrlKey=t,this.shiftKey=r,this.altKey=n,this.metaKey=a,this.keyCode=l}equals(t){return t instanceof eg&&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",r=this.shiftKey?"1":"0",n=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${r}${n}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new pS([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},pS=class{constructor(e){if(e.length===0)throw z0("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;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 mS(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return Z_.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Eh)switch(t){case 59:return 85;case 60:if(lS)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ii)return 57;break}else if(rS&&(Ii&&t===93||!Ii&&t===92))return 57;return dS[t]||0}var _S=Ii?256:2048,gS=512,vS=1024,yS=Ii?2048:256,Op=class{constructor(e){var r;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=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=mS(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|=_S),this.altKey&&(t|=gS),this.shiftKey&&(t|=vS),this.metaKey&&(t|=yS),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new fS(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},zp=new WeakMap;function SS(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var wS=class{static getSameOriginWindowChain(e){let t=zp.get(e);if(!t){t=[],zp.set(e,t);let r=e,n;do n=SS(r),n?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=n;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,n=0,a=this.getSameOriginWindowChain(e);for(let l of a){let h=l.window.deref();if(r+=(h==null?void 0:h.scrollY)??0,n+=(h==null?void 0:h.scrollX)??0,h===t||!l.iframeElement)break;let f=l.iframeElement.getBoundingClientRect();r+=f.top,n+=f.left}return{top:r,left:n}}},Zo=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 r=wS.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Fp=class{constructor(e,t=0,r=0){var a;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let n=!1;if(mu){let l=navigator.userAgent.match(/Chrome\/(\d+)/);n=(l?parseInt(l[1]):123)<=122}if(e){let l=e,h=e,f=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof l.wheelDeltaY<"u")n?this.deltaY=l.wheelDeltaY/(120*f):this.deltaY=l.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?Eh&&!Ii?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")sS&&J_?this.deltaX=-(l.wheelDeltaX/120):n?this.deltaX=l.wheelDeltaX/(120*f):this.deltaX=l.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?Eh&&!Ii?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*f):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},tg=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),CS;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof bS?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Nt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:tg})})(CS||(CS={}));var bS=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?tg:(this._emitter||(this._emitter=new le),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},gu=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 Sh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Sh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},xS=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,r=globalThis){if(this.isDisposed)throw new Sh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=Xe(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},kS;(e=>{async function t(n){let a,l=await Promise.all(n.map(h=>h.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return l}e.settled=t;function r(n){return new Promise(async(a,l)=>{try{await n(a,l)}catch(h){l(h)}})}e.withAsyncBody=r})(kS||(kS={}));var Hp=class fi{static fromArray(t){return new fi(r=>{r.emitMany(t)})}static fromPromise(t){return new fi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new fi(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new fi(async r=>{await Promise.all(t.map(async n=>{for await(let a of n)r.emitOne(a)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new le,queueMicrotask(async()=>{let n={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(n)),this.resolve()}catch(a){this.reject(a)}finally{n.emitOne=void 0,n.emitMany=void 0,n.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 Nt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new fi(async n=>{for await(let a of t)n.emitOne(r(a))})}map(t){return fi.map(this,t)}static filter(t,r){return new fi(async n=>{for await(let a of t)r(a)&&n.emitOne(a)})}filter(t){return fi.filter(this,t)}static coalesce(t){return fi.filter(t,r=>!!r)}coalesce(){return fi.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return fi.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())}};Hp.EMPTY=Hp.fromArray([]);var{getWindow:Ai,getWindowId:ES,onDidRegisterWindow:NS}=(function(){let e=new Map,t={window:Xi,disposables:new Er};e.set(Xi.vscodeWindowId,t);let r=new le,n=new le,a=new le;function l(h,f){return(typeof h=="number"?e.get(h):void 0)??(f?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:n.event,registerWindow(h){if(e.has(h.vscodeWindowId))return Pe.None;let f=new Er,m={window:h,disposables:f.add(new Er)};return e.set(h.vscodeWindowId,m),f.add(Xe(()=>{e.delete(h.vscodeWindowId),n.fire(h)})),f.add(Re(h,gt.BEFORE_UNLOAD,()=>{a.fire(h)})),r.fire(m),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:l,getWindow(h){var p;let f=h;if((p=f==null?void 0:f.ownerDocument)!=null&&p.defaultView)return f.ownerDocument.defaultView.window;let m=h;return m!=null&&m.view?m.view.window:Xi},getDocument(h){return Ai(h).document}}})(),RS=class{constructor(e,t,r,n){this._node=e,this._type=t,this._handler=r,this._options=n||!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 Re(e,t,r,n){return new RS(e,t,r,n)}var Wp=function(e,t,r,n){return Re(e,t,r,n)},vu,DS=class extends xS{constructor(e){super(),this.defaultTarget=e&&Ai(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},$p=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){aa(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,n=new Map,a=l=>{r.set(l,!1);let h=e.get(l)??[];for(t.set(l,h),e.set(l,[]),n.set(l,!0);h.length>0;)h.sort($p.sort),h.shift().execute();n.set(l,!1)};vu=(l,h,f=0)=>{let m=ES(l),p=new $p(h,f),S=e.get(m);return S||(S=[],e.set(m,S)),S.push(p),r.get(m)||(r.set(m,!0),l.requestAnimationFrame(()=>a(m))),p}})();function MS(e){let t=e.getBoundingClientRect(),r=Ai(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var gt={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"},LS=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 r=Vt(t);this._maxWidth!==r&&(this._maxWidth=r,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let r=Vt(t);this._width!==r&&(this._width=r,this.domNode.style.width=this._width)}setHeight(t){let r=Vt(t);this._height!==r&&(this._height=r,this.domNode.style.height=this._height)}setTop(t){let r=Vt(t);this._top!==r&&(this._top=r,this.domNode.style.top=this._top)}setLeft(t){let r=Vt(t);this._left!==r&&(this._left=r,this.domNode.style.left=this._left)}setBottom(t){let r=Vt(t);this._bottom!==r&&(this._bottom=r,this.domNode.style.bottom=this._bottom)}setRight(t){let r=Vt(t);this._right!==r&&(this._right=r,this.domNode.style.right=this._right)}setPaddingTop(t){let r=Vt(t);this._paddingTop!==r&&(this._paddingTop=r,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let r=Vt(t);this._paddingLeft!==r&&(this._paddingLeft=r,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let r=Vt(t);this._paddingBottom!==r&&(this._paddingBottom=r,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let r=Vt(t);this._paddingRight!==r&&(this._paddingRight=r,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 r=Vt(t);this._fontSize!==r&&(this._fontSize=r,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 r=Vt(t);this._lineHeight!==r&&(this._lineHeight=r,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let r=Vt(t);this._letterSpacing!==r&&(this._letterSpacing=r,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,r){this.domNode.classList.toggle(t,r),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,r){this.domNode.setAttribute(t,r)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Vt(e){return typeof e=="number"?`${e}px`:e}function Mn(e){return new LS(e)}var ig=class{constructor(){this._hooks=new Er,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 r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,n,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=a;let l=e;try{e.setPointerCapture(t),this._hooks.add(Xe(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Ai(e)}this._hooks.add(Re(l,gt.POINTER_MOVE,h=>{if(h.buttons!==r){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(Re(l,gt.POINTER_UP,h=>this.stopMonitoring(!0)))}};function PS(e,t,r){let n=null,a=null;if(typeof r.value=="function"?(n="value",a=r.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",a=r.get),!a)throw new Error("not supported");let l=`$memoize$${t}`;r[n]=function(...h){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,h)}),this[l]}}var ji;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ji||(ji={}));var xn=class Pt extends Pe{constructor(){super(),this.dispatched=!1,this.targets=new Tp,this.ignoreTargets=new Tp,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Nt.runAndSubscribe(NS,({window:t,disposables:r})=>{r.add(Re(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(Re(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(Re(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Xi,disposables:this._store}))}static addTarget(t){if(!Pt.isTouchDevice())return Pe.None;Pt.INSTANCE||(Pt.INSTANCE=new Pt);let r=Pt.INSTANCE.targets.push(t);return Xe(r)}static ignoreTarget(t){if(!Pt.isTouchDevice())return Pe.None;Pt.INSTANCE||(Pt.INSTANCE=new Pt);let r=Pt.INSTANCE.ignoreTargets.push(t);return Xe(r)}static isTouchDevice(){return"ontouchstart"in Xi||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,a=t.targetTouches.length;n<a;n++){let l=t.targetTouches.item(n);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:r,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[r],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let h=this.newGestureEvent(ji.Start,l.target);h.pageX=l.pageX,h.pageY=l.pageY,this.dispatchEvent(h)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let n=Date.now(),a=Object.keys(this.activeTouches).length;for(let l=0,h=r.changedTouches.length;l<h;l++){let f=r.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let m=this.activeTouches[f.identifier],p=Date.now()-m.initialTimeStamp;if(p<Pt.HOLD_DELAY&&Math.abs(m.initialPageX-Zt(m.rollingPageX))<30&&Math.abs(m.initialPageY-Zt(m.rollingPageY))<30){let S=this.newGestureEvent(ji.Tap,m.initialTarget);S.pageX=Zt(m.rollingPageX),S.pageY=Zt(m.rollingPageY),this.dispatchEvent(S)}else if(p>=Pt.HOLD_DELAY&&Math.abs(m.initialPageX-Zt(m.rollingPageX))<30&&Math.abs(m.initialPageY-Zt(m.rollingPageY))<30){let S=this.newGestureEvent(ji.Contextmenu,m.initialTarget);S.pageX=Zt(m.rollingPageX),S.pageY=Zt(m.rollingPageY),this.dispatchEvent(S)}else if(a===1){let S=Zt(m.rollingPageX),g=Zt(m.rollingPageY),C=Zt(m.rollingTimestamps)-m.rollingTimestamps[0],v=S-m.rollingPageX[0],y=g-m.rollingPageY[0],x=[...this.targets].filter(E=>m.initialTarget instanceof Node&&E.contains(m.initialTarget));this.inertia(t,x,n,Math.abs(v)/C,v>0?1:-1,S,Math.abs(y)/C,y>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(ji.End,m.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=r,n.tapCount=0,n}dispatchEvent(t){if(t.type===ji.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Pt.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===ji.Change||t.type===ji.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let r=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let a=0,l=t.initialTarget;for(;l&&l!==n;)a++,l=l.parentElement;r.push([a,n])}r.sort((n,a)=>n[0]-a[0]);for(let[n,a]of r)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,n,a,l,h,f,m,p){this.handle=vu(t,()=>{let S=Date.now(),g=S-n,C=0,v=0,y=!0;a+=Pt.SCROLL_FRICTION*g,f+=Pt.SCROLL_FRICTION*g,a>0&&(y=!1,C=l*a*g),f>0&&(y=!1,v=m*f*g);let x=this.newGestureEvent(ji.Change);x.translationX=C,x.translationY=v,r.forEach(E=>E.dispatchEvent(x)),y||this.inertia(t,r,S,a,l,h+C,f,m,p+v)})}onTouchMove(t){let r=Date.now();for(let n=0,a=t.changedTouches.length;n<a;n++){let l=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let h=this.activeTouches[l.identifier],f=this.newGestureEvent(ji.Change,h.initialTarget);f.translationX=l.pageX-Zt(h.rollingPageX),f.translationY=l.pageY-Zt(h.rollingPageY),f.pageX=l.pageX,f.pageY=l.pageY,this.dispatchEvent(f),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(l.pageX),h.rollingPageY.push(l.pageY),h.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};xn.SCROLL_FRICTION=-.005,xn.HOLD_DELAY=700,xn.CLEAR_TAP_COUNT_TIME=400,it([PS],xn,"isTouchDevice",1);var TS=xn,yu=class extends Pe{onclick(e,t){this._register(Re(e,gt.CLICK,r=>t(new Zo(Ai(e),r))))}onmousedown(e,t){this._register(Re(e,gt.MOUSE_DOWN,r=>t(new Zo(Ai(e),r))))}onmouseover(e,t){this._register(Re(e,gt.MOUSE_OVER,r=>t(new Zo(Ai(e),r))))}onmouseleave(e,t){this._register(Re(e,gt.MOUSE_LEAVE,r=>t(new Zo(Ai(e),r))))}onkeydown(e,t){this._register(Re(e,gt.KEY_DOWN,r=>t(new Op(r))))}onkeyup(e,t){this._register(Re(e,gt.KEY_UP,r=>t(new Op(r))))}oninput(e,t){this._register(Re(e,gt.INPUT,t))}onblur(e,t){this._register(Re(e,gt.BLUR,t))}onfocus(e,t){this._register(Re(e,gt.FOCUS,t))}onchange(e,t){this._register(Re(e,gt.CHANGE,t))}ignoreGesture(e){return TS.ignoreTarget(e)}},Up=11,BS=class extends yu{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=Up+"px",this.domNode.style.height=Up+"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 ig),this._register(Wp(this.bgDomNode,gt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Wp(this.domNode,gt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new DS),this._pointerdownScheduleRepeatTimer=this._register(new gu)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ai(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},jS=class Dh{constructor(t,r,n,a,l,h,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,a=a|0,l=l|0,h=h|0,f=f|0),this.rawScrollLeft=a,this.rawScrollTop=f,r<0&&(r=0),a+r>n&&(a=n-r),a<0&&(a=0),l<0&&(l=0),f+l>h&&(f=h-l),f<0&&(f=0),this.width=r,this.scrollWidth=n,this.scrollLeft=a,this.height=l,this.scrollHeight=h,this.scrollTop=f}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Dh(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Dh(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,r){let n=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,h=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,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:n,scrollWidthChanged:a,scrollLeftChanged:l,heightChanged:h,scrollHeightChanged:f,scrollTopChanged:m}}},AS=class extends Pe{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new le),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new jS(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 n;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(n=this._smoothScrolling)==null||n.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 r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let n;t?n=new Vp(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=Vp.start(this._state,r,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 r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},Kp=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function Mc(e,t){let r=t-e;return function(n){return e+r*zS(n)}}function IS(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var Vp=class Mh{constructor(t,r,n,a){this.from=t,this.to=r,this.duration=a,this.startTime=n,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,r,n){if(Math.abs(t-r)>2.5*n){let a,l;return t<r?(a=t+.75*n,l=r-.75*n):(a=t-.75*n,l=r+.75*n),IS(Mc(t,a),Mc(l,r),.33)}return Mc(t,r)}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 r=(t-this.startTime)/this.duration;if(r<1){let n=this.scrollLeft(r),a=this.scrollTop(r);return new Kp(n,a,!1)}return new Kp(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return Mh.start(t,r,n)}static start(t,r,n){n=n+10;let a=Date.now()-10;return new Mh(t,r,a,n)}};function OS(e){return Math.pow(e,3)}function zS(e){return 1-OS(1-e)}var FS=class extends Pe{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new gu)}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":"")))}},HS=140,rg=class extends yu{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 FS(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ig),this._shouldRender=!0,this.domNode=Mn(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(Re(this.domNode.domNode,gt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new BS(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=Mn(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Re(this.slider.domNode,gt.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.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,r=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);r<=a&&a<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let a=MS(this.domNode.domNode);t=e.pageX-a.left,r=e.pageY-a.top}let n=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let l=this._sliderOrthogonalPointerPosition(a),h=Math.abs(l-r);if(J_&&h>HS){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let f=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(f))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},sg=class Lh{constructor(t,r,n,a,l,h){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=l,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Lh(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,n,a,l){let h=Math.max(0,n-t),f=Math.max(0,h-2*r),m=a>0&&a>n;if(!m)return{computedAvailableSize:Math.round(h),computedIsNeeded:m,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(n*f/a))),S=(f-p)/(a-n),g=l*S;return{computedAvailableSize:Math.round(h),computedIsNeeded:m,computedSliderSize:Math.round(p),computedSliderRatio:S,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=Lh._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 r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,n=this._scrollPosition;return r<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},WS=class extends rg{constructor(e,t,r){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new sg(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,a.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}},$S=class extends rg{constructor(e,t,r){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new sg(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,a.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}},US=500,qp=50,KS=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Ph=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,r=0,n=1,a=this._rear;do{let l=a===this._front?t:Math.pow(2,-n);if(t-=l,r+=this._memory[a].score*l,a===this._front)break;a=(this._capacity+a-1)%this._capacity,n++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(mu){let r=Ai(t.browserEvent),n=iS(r);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,n){let a=null,l=new KS(t,r,n);this._front===-1&&this._rear===-1?(this._memory[0]=l,this._front=0,this._rear=0):(a=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]=l),l.score=this._computeScore(l,a)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),r){let a=Math.abs(t.deltaX),l=Math.abs(t.deltaY),h=Math.abs(r.deltaX),f=Math.abs(r.deltaY),m=Math.max(Math.min(a,h),1),p=Math.max(Math.min(l,f),1),S=Math.max(a,h),g=Math.max(l,f);S%m===0&&g%p===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Ph.INSTANCE=new Ph;var VS=Ph,qS=class extends yu{constructor(e,t,r){super(),this._onScroll=this._register(new le),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new le),this.onWillScroll=this._onWillScroll.event,this._options=XS(t),this._scrollable=r,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let n={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new $S(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new WS(this._scrollable,this._options,n)),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=Mn(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Mn(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Mn(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,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new gu),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=qr(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,Ii&&(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 Fp(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=qr(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new Fp(r))};this._mouseWheelToDispose.push(Re(this._listenOnDomNode,gt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=VS.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+l===0?h=l=0:Math.abs(l)>=Math.abs(h)?h=0:l=0),this._options.flipAxes&&([l,h]=[h,l]);let f=!Ii&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||f)&&!h&&(h=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let m=this._scrollable.getFutureScrollPosition(),p={};if(l){let S=qp*l,g=m.scrollTop-(S<0?Math.floor(S):Math.ceil(S));this._verticalScrollbar.writeScrollPosition(p,g)}if(h){let S=qp*h,g=m.scrollLeft-(S<0?Math.floor(S):Math.ceil(S));this._horizontalScrollbar.writeScrollPosition(p,g)}p=this._scrollable.validateScrollPosition(p),(m.scrollLeft!==p.scrollLeft||m.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(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,r=e.scrollLeft>0,n=r?" left":"",a=t?" top":"",l=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${a}${n}`)}}_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(),US)}},YS=class extends qS{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function XS(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,Ii&&(t.className+=" mac"),t}var Th=class extends Pe{constructor(e,t,r,n,a,l,h,f){super(),this._bufferService=r,this._optionsService=h,this._renderService=f,this._onRequestScrollLines=this._register(new le),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new AS({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>vu(n.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new YS(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Nt.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Xe(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Xe(()=>this._styleElement.remove())),this._register(Nt.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.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(p=>this._handleScroll(p)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){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),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Th=it([de(2,It),de(3,Qi),de(4,O_),de(5,Ds),de(6,Ot),de(7,Ji)],Th);var Bh=class extends Pe{constructor(e,t,r,n,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=n,this._renderService=a,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(l=>this._removeDecoration(l))),this._register(Xe(()=>{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 n;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((n=e==null?void 0:e.options)==null?void 0:n.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 r=e.options.x??0;return r&&r>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 r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*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()}};Bh=it([de(1,It),de(2,Qi),de(3,An),de(4,Ji)],Bh);var GS=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,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Pi={full:0,left:0,center:0,right:0},wr={full:0,left:0,center:0,right:0},_n={full:0,left:0,center:0,right:0},pa=class extends Pe{constructor(e,t,r,n,a,l,h,f){var p;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=a,this._optionsService=l,this._themeService=h,this._coreBrowserService=f,this._colorZoneStore=new GS,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(),(p=this._viewportElement.parentElement)==null||p.insertBefore(this._canvas,this._viewportElement),this._register(Xe(()=>{var S;return(S=this._canvas)==null?void 0:S.remove()}));let m=this._canvas.getContext("2d");if(m)this._ctx=m;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){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);wr.full=this._canvas.width,wr.left=e,wr.center=t,wr.right=e,this._refreshDrawHeightConstants(),_n.full=1,_n.left=1,_n.center=1+wr.left,_n.right=1+wr.left+wr.center}_refreshDrawHeightConstants(){Pi.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);Pi.left=t,Pi.center=t,Pi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Pi.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(_n[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Pi[e.position||"full"]/2),wr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Pi[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}))}};pa=it([de(2,It),de(3,An),de(4,Ji),de(5,Ot),de(6,Ds),de(7,Qi)],pa);var ie;(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=""))(ie||(ie={}));var ha;(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=""))(ha||(ha={}));var ng;(e=>e.ST=`${ie.ESC}\\`)(ng||(ng={}));var jh=class{constructor(e,t,r,n,a,l){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=a,this._renderService=l,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 r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!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,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ie.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),r=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};jh=it([de(2,It),de(3,Ot),de(4,Xr),de(5,Ji)],jh);var vt=0,yt=0,St=0,tt=0,Yp={css:"#00000000",rgba:0},lt;(e=>{function t(a,l,h,f){return f!==void 0?`#${Hr(a)}${Hr(l)}${Hr(h)}${Hr(f)}`:`#${Hr(a)}${Hr(l)}${Hr(h)}`}e.toCss=t;function r(a,l,h,f=255){return(a<<24|l<<16|h<<8|f)>>>0}e.toRgba=r;function n(a,l,h,f){return{css:e.toCss(a,l,h,f),rgba:e.toRgba(a,l,h,f)}}e.toColor=n})(lt||(lt={}));var qe;(e=>{function t(m,p){if(tt=(p.rgba&255)/255,tt===1)return{css:p.css,rgba:p.rgba};let S=p.rgba>>24&255,g=p.rgba>>16&255,C=p.rgba>>8&255,v=m.rgba>>24&255,y=m.rgba>>16&255,x=m.rgba>>8&255;vt=v+Math.round((S-v)*tt),yt=y+Math.round((g-y)*tt),St=x+Math.round((C-x)*tt);let E=lt.toCss(vt,yt,St),F=lt.toRgba(vt,yt,St);return{css:E,rgba:F}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function n(m,p,S){let g=ua.ensureContrastRatio(m.rgba,p.rgba,S);if(g)return lt.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=n;function a(m){let p=(m.rgba|255)>>>0;return[vt,yt,St]=ua.toChannels(p),{css:lt.toCss(vt,yt,St),rgba:p}}e.opaque=a;function l(m,p){return tt=Math.round(p*255),[vt,yt,St]=ua.toChannels(m.rgba),{css:lt.toCss(vt,yt,St,tt),rgba:lt.toRgba(vt,yt,St,tt)}}e.opacity=l;function h(m,p){return tt=m.rgba&255,l(m,tt*p/255)}e.multiplyOpacity=h;function f(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=f})(qe||(qe={}));var Ze;(e=>{let t,r;try{let a=document.createElement("canvas");a.width=1,a.height=1;let l=a.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return vt=parseInt(a.slice(1,2).repeat(2),16),yt=parseInt(a.slice(2,3).repeat(2),16),St=parseInt(a.slice(3,4).repeat(2),16),lt.toColor(vt,yt,St);case 5:return vt=parseInt(a.slice(1,2).repeat(2),16),yt=parseInt(a.slice(2,3).repeat(2),16),St=parseInt(a.slice(3,4).repeat(2),16),tt=parseInt(a.slice(4,5).repeat(2),16),lt.toColor(vt,yt,St,tt);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let l=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return vt=parseInt(l[1]),yt=parseInt(l[2]),St=parseInt(l[3]),tt=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),lt.toColor(vt,yt,St,tt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[vt,yt,St,tt]=t.getImageData(0,0,1,1).data,tt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:lt.toRgba(vt,yt,St,tt),css:a}}e.toColor=n})(Ze||(Ze={}));var At;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,l){let h=n/255,f=a/255,m=l/255,p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),S=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),g=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return p*.2126+S*.7152+g*.0722}e.relativeLuminance2=r})(At||(At={}));var ua;(e=>{function t(h,f){if(tt=(f&255)/255,tt===1)return f;let m=f>>24&255,p=f>>16&255,S=f>>8&255,g=h>>24&255,C=h>>16&255,v=h>>8&255;return vt=g+Math.round((m-g)*tt),yt=C+Math.round((p-C)*tt),St=v+Math.round((S-v)*tt),lt.toRgba(vt,yt,St)}e.blend=t;function r(h,f,m){let p=At.relativeLuminance(h>>8),S=At.relativeLuminance(f>>8);if(Yi(p,S)<m){if(S<p){let v=n(h,f,m),y=Yi(p,At.relativeLuminance(v>>8));if(y<m){let x=a(h,f,m),E=Yi(p,At.relativeLuminance(x>>8));return y>E?v:x}return v}let g=a(h,f,m),C=Yi(p,At.relativeLuminance(g>>8));if(C<m){let v=n(h,f,m),y=Yi(p,At.relativeLuminance(v>>8));return C>y?g:v}return g}}e.ensureContrastRatio=r;function n(h,f,m){let p=h>>24&255,S=h>>16&255,g=h>>8&255,C=f>>24&255,v=f>>16&255,y=f>>8&255,x=Yi(At.relativeLuminance2(C,v,y),At.relativeLuminance2(p,S,g));for(;x<m&&(C>0||v>0||y>0);)C-=Math.max(0,Math.ceil(C*.1)),v-=Math.max(0,Math.ceil(v*.1)),y-=Math.max(0,Math.ceil(y*.1)),x=Yi(At.relativeLuminance2(C,v,y),At.relativeLuminance2(p,S,g));return(C<<24|v<<16|y<<8|255)>>>0}e.reduceLuminance=n;function a(h,f,m){let p=h>>24&255,S=h>>16&255,g=h>>8&255,C=f>>24&255,v=f>>16&255,y=f>>8&255,x=Yi(At.relativeLuminance2(C,v,y),At.relativeLuminance2(p,S,g));for(;x<m&&(C<255||v<255||y<255);)C=Math.min(255,C+Math.ceil((255-C)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Yi(At.relativeLuminance2(C,v,y),At.relativeLuminance2(p,S,g));return(C<<24|v<<16|y<<8|255)>>>0}e.increaseLuminance=a;function l(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=l})(ua||(ua={}));function Hr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Yi(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var QS=class extends jn{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}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()]}},ma=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new mi}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 r=[],n=t.translateToString(!0),a=0,l=0,h=0,f=t.getFg(0),m=t.getBg(0);for(let p=0;p<t.getTrimmedLength();p++)if(t.loadCell(p,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==m){if(p-a>1){let S=this._getJoinedRanges(n,h,l,t,a);for(let g=0;g<S.length;g++)r.push(S[g])}a=p,h=l,f=this._workCell.fg,m=this._workCell.bg}l+=this._workCell.getChars().length||kr.length}if(this._bufferService.cols-a>1){let p=this._getJoinedRanges(n,h,l,t,a);for(let S=0;S<p.length;S++)r.push(p[S])}return r}_getJoinedRanges(e,t,r,n,a){let l=e.substring(t,r),h=[];try{h=this._characterJoiners[0].handler(l)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let m=this._characterJoiners[f].handler(l);for(let p=0;p<m.length;p++)ma._mergeRanges(h,m[p])}catch(m){console.error(m)}return this._stringRangesToCellRanges(h,n,a),h}_stringRangesToCellRanges(e,t,r){let n=0,a=!1,l=0,h=e[n];if(h){for(let f=r;f<this._bufferService.cols;f++){let m=t.getWidth(f),p=t.getString(f).length||kr.length;if(m!==0){if(!a&&h[0]<=l&&(h[0]=f,a=!0),h[1]<=l){if(h[1]=f,h=e[++n],!h)break;h[0]<=l?(h[0]=f,a=!0):a=!1}l+=p}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(r){if(t[1]<=a[0])return e[n-1][1]=t[1],e;if(t[1]<=a[1])return e[n-1][1]=Math.max(t[1],a[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=a[0])return e.splice(n,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};ma=it([de(0,It)],ma);function JS(e){return 57508<=e&&e<=57558}function ZS(e){return 9472<=e&&e<=9631}function ew(e){return JS(e)||ZS(e)}function tw(){return{css:{canvas:ea(),cell:ea()},device:{canvas:ea(),cell:ea(),char:{width:0,height:0,left:0,top:0}}}}function ea(){return{width:0,height:0}}var Ah=class{constructor(e,t,r,n,a,l,h){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=a,this._decorationService=l,this._themeService=h,this._workCell=new mi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,a,l,h,f,m,p,S){let g=[],C=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,y=e.getNoBgTrimmedLength();r&&y<l+1&&(y=l+1);let x,E=0,F="",U=0,M=0,L=0,G=0,$=!1,A=0,K=!1,P=0,N=0,W=[],O=p!==-1&&S!==-1;for(let j=0;j<y;j++){e.loadCell(j,this._workCell);let B=this._workCell.getWidth();if(B===0)continue;let V=!1,Q=j>=N,ee=j,b=this._workCell;if(C.length>0&&j===C[0][0]&&Q){let me=C.shift(),He=this._isCellInSelection(me[0],t);for(U=me[0]+1;U<me[1];U++)Q&&(Q=He===this._isCellInSelection(U,t));Q&&(Q=!r||l<me[0]||l>=me[1]),Q?(V=!0,b=new QS(this._workCell,e.translateToString(!0,me[0],me[1]),me[1]-me[0]),ee=me[1]-1,B=b.getWidth()):N=me[1]}let Z=this._isCellInSelection(j,t),te=r&&j===l,R=O&&j>=p&&j<=S,T=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,me=>{T=!0});let ne=b.getChars()||kr;if(ne===" "&&(b.isUnderline()||b.isOverline())&&(ne=" "),P=B*f-m.get(ne,b.isBold(),b.isItalic()),!x)x=this._document.createElement("span");else if(E&&(Z&&K||!Z&&!K&&b.bg===M)&&(Z&&K&&v.selectionForeground||b.fg===L)&&b.extended.ext===G&&R===$&&P===A&&!te&&!V&&!T&&Q){b.isInvisible()?F+=kr:F+=ne,E++;continue}else E&&(x.textContent=F),x=this._document.createElement("span"),E=0,F="";if(M=b.bg,L=b.fg,G=b.extended.ext,$=R,A=P,K=Z,V&&l>=j&&l<=ee&&(l=j),!this._coreService.isCursorHidden&&te&&this._coreService.isCursorInitialized){if(W.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&W.push("xterm-cursor-blink"),W.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":W.push("xterm-cursor-outline");break;case"block":W.push("xterm-cursor-block");break;case"bar":W.push("xterm-cursor-bar");break;case"underline":W.push("xterm-cursor-underline");break}}if(b.isBold()&&W.push("xterm-bold"),b.isItalic()&&W.push("xterm-italic"),b.isDim()&&W.push("xterm-dim"),b.isInvisible()?F=kr:F=b.getChars()||kr,b.isUnderline()&&(W.push(`xterm-underline-${b.extended.underlineStyle}`),F===" "&&(F=" "),!b.isUnderlineColorDefault()))if(b.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${jn.toColorRGB(b.getUnderlineColor()).join(",")})`;else{let me=b.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&b.isBold()&&me<8&&(me+=8),x.style.textDecorationColor=v.ansi[me].css}b.isOverline()&&(W.push("xterm-overline"),F===" "&&(F=" ")),b.isStrikethrough()&&W.push("xterm-strikethrough"),R&&(x.style.textDecoration="underline");let ce=b.getFgColor(),ue=b.getFgColorMode(),ge=b.getBgColor(),Ce=b.getBgColorMode(),be=!!b.isInverse();if(be){let me=ce;ce=ge,ge=me;let He=ue;ue=Ce,Ce=He}let xe,Oe,Y=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,me=>{me.options.layer!=="top"&&Y||(me.backgroundColorRGB&&(Ce=50331648,ge=me.backgroundColorRGB.rgba>>8&16777215,xe=me.backgroundColorRGB),me.foregroundColorRGB&&(ue=50331648,ce=me.foregroundColorRGB.rgba>>8&16777215,Oe=me.foregroundColorRGB),Y=me.options.layer==="top")}),!Y&&Z&&(xe=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,ge=xe.rgba>>8&16777215,Ce=50331648,Y=!0,v.selectionForeground&&(ue=50331648,ce=v.selectionForeground.rgba>>8&16777215,Oe=v.selectionForeground)),Y&&W.push("xterm-decoration-top");let ye;switch(Ce){case 16777216:case 33554432:ye=v.ansi[ge],W.push(`xterm-bg-${ge}`);break;case 50331648:ye=lt.toColor(ge>>16,ge>>8&255,ge&255),this._addStyle(x,`background-color:#${Xp((ge>>>0).toString(16),"0",6)}`);break;case 0:default:be?(ye=v.foreground,W.push("xterm-bg-257")):ye=v.background}switch(xe||b.isDim()&&(xe=qe.multiplyOpacity(ye,.5)),ue){case 16777216:case 33554432:b.isBold()&&ce<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ce+=8),this._applyMinimumContrast(x,ye,v.ansi[ce],b,xe,void 0)||W.push(`xterm-fg-${ce}`);break;case 50331648:let me=lt.toColor(ce>>16&255,ce>>8&255,ce&255);this._applyMinimumContrast(x,ye,me,b,xe,Oe)||this._addStyle(x,`color:#${Xp(ce.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(x,ye,v.foreground,b,xe,Oe)||be&&W.push("xterm-fg-257")}W.length&&(x.className=W.join(" "),W.length=0),!te&&!V&&!T&&Q?E++:x.textContent=F,P!==this.defaultSpacing&&(x.style.letterSpacing=`${P}px`),g.push(x),j=ee}return x&&E&&(x.textContent=F),g}_applyMinimumContrast(e,t,r,n,a,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||ew(n.getCode()))return!1;let h=this._getContrastCache(n),f;if(!a&&!l&&(f=h.getColor(t.rgba,r.rgba)),f===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);f=qe.ensureContrastRatio(a||t,l||r,m),h.setColor((a||t).rgba,(l||r).rgba,f??null)}return f?(this._addStyle(e,`color:${f.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,n=this._selectionEnd;return!r||!n?!1:this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&t>=r[1]&&e<n[0]&&t<=n[1]:e<r[0]&&t>=r[1]&&e>=n[0]&&t<=n[1]:t>r[1]&&t<n[1]||r[1]===n[1]&&t===r[1]&&e>=r[0]&&e<n[0]||r[1]<n[1]&&t===n[1]&&e<n[0]||r[1]<n[1]&&t===r[1]&&e>=r[0]}};Ah=it([de(1,H_),de(2,Ot),de(3,Qi),de(4,Xr),de(5,An),de(6,Ds)],Ah);function Xp(e,t,r){for(;e.length<r;)e=t+e;return e}var iw=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 r=e.createElement("span");r.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[r,n,a,l],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(a),this._container.appendChild(l),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,r,n){e===this._font&&t===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,r){let n=0;if(!t&&!r&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let h=this._measure(e,0);return h>0&&(this._flat[n]=h),h}let a=e;t&&(a+="B"),r&&(a+="I");let l=this._holey.get(a);if(l===void 0){let h=0;t&&(h|=1),r&&(h|=2),l=this._measure(e,h),l>0&&this._holey.set(a,l)}return l}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},rw=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,r,n=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let a=e.buffers.active.ydisp,l=t[1]-a,h=r[1]-a,f=Math.max(l,0),m=Math.min(h,e.rows-1);if(f>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=l,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function sw(){return new rw}var Lc="xterm-dom-renderer-owner-",di="xterm-rows",ta="xterm-fg-",Gp="xterm-bg-",gn="xterm-focus",ia="xterm-selection",nw=1,Ih=class extends Pe{constructor(e,t,r,n,a,l,h,f,m,p,S,g,C,v){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=a,this._helperContainer=l,this._linkifier2=h,this._charSizeService=m,this._optionsService=p,this._bufferService=S,this._coreService=g,this._coreBrowserService=C,this._themeService=v,this._terminalClass=nw++,this._rowElements=[],this._selectionRenderModel=sw(),this.onRequestRedraw=this._register(new le).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(di),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(ia),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=tw(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(y=>this._injectCss(y))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(Ah,document),this._element.classList.add(Lc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(y=>this._handleLinkHover(y))),this._register(this._linkifier2.onHideLinkUnderline(y=>this._handleLinkLeave(y))),this._register(Xe(()=>{this._element.classList.remove(Lc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new iw(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 r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${di} 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} .${di} { 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} .${di} .xterm-dim { color: ${qe.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 r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${di}.${gn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${di}.${gn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${di}.${gn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ia} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ia} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ia} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,h]of e.ansi.entries())t+=`${this._terminalSelector} .${ta}${l} { color: ${h.css}; }${this._terminalSelector} .${ta}${l}.xterm-dim { color: ${qe.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${Gp}${l} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${ta}257 { color: ${qe.opaque(e.background).css}; }${this._terminalSelector} .${ta}257.xterm-dim { color: ${qe.multiplyOpacity(qe.opaque(e.background),.5).css}; }${this._terminalSelector} .${Gp}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 r=this._rowElements.length;r<=t;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}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(gn),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(gn),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,h=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(r){let m=e[0]>t[0];f.appendChild(this._createSelectionElement(l,m?t[0]:e[0],m?e[0]:t[0],h-l+1))}else{let m=n===l?e[0]:0,p=l===a?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(l,m,p));let S=h-l-1;if(f.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,S)),l!==h){let g=a===h?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(h,0,g))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,r,n=1){let a=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(r-t);return l+h>this.dimensions.css.canvas.width&&(h=this.dimensions.css.canvas.width-l),a.style.height=`${n*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${l}px`,a.style.width=`${h}px`,a}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 r=this._bufferService.buffer,n=r.ybase+r.y,a=Math.min(r.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let p=m+r.ydisp,S=this._rowElements[m],g=r.lines.get(p);if(!S||!g)break;S.replaceChildren(...this._rowFactory.createRow(g,p,p===n,h,f,a,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Lc}${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,r,n,a,l){r<0&&(e=0),n<0&&(t=0);let h=this._bufferService.rows-1;r=Math.max(Math.min(r,h),0),n=Math.max(Math.min(n,h),0),a=Math.min(a,this._bufferService.cols);let f=this._bufferService.buffer,m=f.ybase+f.y,p=Math.min(f.x,a-1),S=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,C=this._optionsService.rawOptions.cursorInactiveStyle;for(let v=r;v<=n;++v){let y=v+f.ydisp,x=this._rowElements[v],E=f.lines.get(y);if(!x||!E)break;x.replaceChildren(...this._rowFactory.createRow(E,y,y===m,g,C,p,S,this.dimensions.css.cell.width,this._widthCache,l?v===r?e:0:-1,l?(v===n?t:a)-1:-1))}}};Ih=it([de(7,du),de(8,Ea),de(9,Ot),de(10,It),de(11,Xr),de(12,Qi),de(13,Ds)],Ih);var Oh=class extends Pe{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new le),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new aw(this._optionsService))}catch{this._measureStrategy=this._register(new ow(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())}};Oh=it([de(2,Ot)],Oh);var og=class extends Pe{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)}},ow=class extends og{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,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}},aw=class extends og{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}},lw=class extends Pe{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new cw(this._window)),this._onDprChange=this._register(new le),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new le),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Nt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Re(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Re(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}},cw=class extends Pe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Es),this._onDprChange=this._register(new le),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Xe(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Re(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)}},hw=class extends Pe{constructor(){super(),this.linkProviders=[],this._register(Xe(()=>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 Su(e,t,r){let n=r.getBoundingClientRect(),a=e.getComputedStyle(r),l=parseInt(a.getPropertyValue("padding-left")),h=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-n.left-l,t.clientY-n.top-h]}function uw(e,t,r,n,a,l,h,f,m){if(!l)return;let p=Su(e,t,r);if(p)return p[0]=Math.ceil((p[0]+(m?h/2:0))/h),p[1]=Math.ceil(p[1]/f),p[0]=Math.min(Math.max(p[0],1),n+(m?1:0)),p[1]=Math.min(Math.max(p[1],1),a),p}var zh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,a){return uw(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let r=Su(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};zh=it([de(0,Ji),de(1,Ea)],zh);var dw=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,r){this._rowCount=r,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=[]}},ag={};C0(ag,{getSafariVersion:()=>pw,isChromeOS:()=>ug,isFirefox:()=>lg,isIpad:()=>mw,isIphone:()=>_w,isLegacyEdge:()=>fw,isLinux:()=>wu,isMac:()=>_a,isNode:()=>Na,isSafari:()=>cg,isWindows:()=>hg});var Na=typeof process<"u"&&"title"in process,In=Na?"node":navigator.userAgent,On=Na?"node":navigator.platform,lg=In.includes("Firefox"),fw=In.includes("Edge"),cg=/^((?!chrome|android).)*safari/i.test(In);function pw(){if(!cg)return 0;let e=In.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var _a=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(On),mw=On==="iPad",_w=On==="iPhone",hg=["Windows","Win16","Win32","WinCE"].includes(On),wu=On.indexOf("Linux")>=0,ug=/\bCrOS\b/.test(In),dg=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,r=0,n=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),a=e.timeRemaining(),r*1.5>a){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=a}this.clear()}},gw=class extends dg{_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())}}},vw=class extends dg{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ga=!Na&&"requestIdleCallback"in window?vw:gw,yw=class{constructor(){this._queue=new ga}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Fh=class extends Pe{constructor(e,t,r,n,a,l,h,f,m){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new Es),this._pausedResizeTask=new yw,this._observerDisposable=this._register(new Es),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 le),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new le),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new le),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new le),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new dw((p,S)=>this._renderRows(p,S),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Sw(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Xe(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>{var p;return(p=this._renderer.value)==null?void 0:p.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(p=>this._registerIntersectionObserver(p,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=Xe(()=>r.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,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),r||(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 r;return(r=this._renderer.value)==null?void 0:r.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,r){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(n=this._renderer.value)==null||n.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Fh=it([de(2,Ot),de(3,Ea),de(4,Xr),de(5,An),de(6,It),de(7,Qi),de(8,Ds)],Fh);var Sw=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,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 ww(e,t,r,n){let a=r.buffer.x,l=r.buffer.y;if(!r.buffer.hasScrollback)return xw(a,l,e,t,r,n)+Ra(l,t,r,n)+kw(a,l,e,t,r,n);let h;if(l===t)return h=a>e?"D":"C",Tn(Math.abs(a-e),Pn(h,n));h=l>t?"D":"C";let f=Math.abs(l-t),m=bw(l>t?e:a,r)+(f-1)*r.cols+1+Cw(l>t?a:e);return Tn(m,Pn(h,n))}function Cw(e,t){return e-1}function bw(e,t){return t.cols-e}function xw(e,t,r,n,a,l){return Ra(t,n,a,l).length===0?"":Tn(pg(e,t,e,t-Yr(t,a),!1,a).length,Pn("D",l))}function Ra(e,t,r,n){let a=e-Yr(e,r),l=t-Yr(t,r),h=Math.abs(a-l)-Ew(e,t,r);return Tn(h,Pn(fg(e,t),n))}function kw(e,t,r,n,a,l){let h;Ra(t,n,a,l).length>0?h=n-Yr(n,a):h=t;let f=n,m=Nw(e,t,r,n,a,l);return Tn(pg(e,h,r,f,m==="C",a).length,Pn(m,l))}function Ew(e,t,r){var h;let n=0,a=e-Yr(e,r),l=t-Yr(t,r);for(let f=0;f<Math.abs(a-l);f++){let m=fg(e,t)==="A"?-1:1;(h=r.buffer.lines.get(a+m*f))!=null&&h.isWrapped&&n++}return n}function Yr(e,t){let r=0,n=t.buffer.lines.get(e),a=n==null?void 0:n.isWrapped;for(;a&&e>=0&&e<t.rows;)r++,n=t.buffer.lines.get(--e),a=n==null?void 0:n.isWrapped;return r}function Nw(e,t,r,n,a,l){let h;return Ra(r,n,a,l).length>0?h=n-Yr(n,a):h=t,e<r&&h<=n||e>=r&&h<n?"C":"D"}function fg(e,t){return e>t?"A":"B"}function pg(e,t,r,n,a,l){let h=e,f=t,m="";for(;(h!==r||f!==n)&&f>=0&&f<l.buffer.lines.length;)h+=a?1:-1,a&&h>l.cols-1?(m+=l.buffer.translateBufferLineToString(f,!1,e,h),h=0,e=0,f++):!a&&h<0&&(m+=l.buffer.translateBufferLineToString(f,!1,0,e+1),h=l.cols-1,e=h,f--);return m+l.buffer.translateBufferLineToString(f,!1,e,h)}function Pn(e,t){let r=t?"O":"[";return ie.ESC+r+e}function Tn(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var Rw=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 Qp(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Pc=50,Dw=15,Mw=50,Lw=500,Pw=" ",Tw=new RegExp(Pw,"g"),Hh=class extends Pe{constructor(e,t,r,n,a,l,h,f,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=a,this._mouseService=l,this._optionsService=h,this._renderService=f,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new mi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new le),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new le),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new le),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new le),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=p=>this._handleMouseMove(p),this._mouseUpListener=p=>this._handleMouseUp(p),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(p=>this._handleTrim(p)),this._register(this._bufferService.buffers.onBufferActivate(p=>this._handleBufferActivate(p))),this.enable(),this._model=new Rw(this._bufferService),this._activeSelectionMode=0,this._register(Xe(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(p=>{p.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let h=e[1];h<=t[1];h++){let f=r.translateBufferLineToString(h,!0,a,l);n.push(f)}}else{let a=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],a));for(let l=e[1]+1;l<=t[1]-1;l++){let h=r.lines.get(l),f=r.translateBufferLineToString(l,!0);h!=null&&h.isWrapped?n[n.length-1]+=f:n.push(f)}if(e[1]!==t[1]){let l=r.lines.get(t[1]),h=r.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?n[n.length-1]+=h:n.push(h)}}return n.map(a=>a.replace(Tw," ")).join(hg?`\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())),wu&&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),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n||!t?!1:this._areCoordsInSelection(t,r,n)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n?!1:this._areCoordsInSelection([e,t],r,n)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var a,l;let r=(l=(a=this._linkifier.currentLink)==null?void 0:a.link)==null?void 0:l.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=Qp(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,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=Su(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-Pc),Pc),t/=Pc,t/Math.abs(t)+Math.round(t*(Dw-1)))}shouldForceSelection(e){return _a?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&&!(_a&&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 r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let n=r.lines.get(this._model.selectionEnd[1]);n&&n.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<Lw&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let n=ww(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);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,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let n=0;t>=n;n++){let a=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:a>1&&t!==n&&(r+=a-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,l=a.lines.get(e[1]);if(!l)return;let h=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(l,e[0]),m=f,p=e[0]-f,S=0,g=0,C=0,v=0;if(h.charAt(f)===" "){for(;f>0&&h.charAt(f-1)===" ";)f--;for(;m<h.length&&h.charAt(m+1)===" ";)m++}else{let E=e[0],F=e[0];l.getWidth(E)===0&&(S++,E--),l.getWidth(F)===2&&(g++,F++);let U=l.getString(F).length;for(U>1&&(v+=U-1,m+=U-1);E>0&&f>0&&!this._isCharWordSeparator(l.loadCell(E-1,this._workCell));){l.loadCell(E-1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===0?(S++,E--):M>1&&(C+=M-1,f-=M-1),f--,E--}for(;F<l.length&&m+1<h.length&&!this._isCharWordSeparator(l.loadCell(F+1,this._workCell));){l.loadCell(F+1,this._workCell);let M=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,F++):M>1&&(v+=M-1,m+=M-1),m++,F++}}m++;let y=f+p-S+C,x=Math.min(this._bufferService.cols,m-f+S+g-C-v);if(!(!t&&h.slice(f,m).trim()==="")){if(r&&y===0&&l.getCodePoint(0)!==32){let E=a.lines.get(e[1]-1);if(E&&l.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let F=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(F){let U=this._bufferService.cols-F.start;y-=U,x+=U}}}if(n&&y+x===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let E=a.lines.get(e[1]+1);if(E!=null&&E.isWrapped&&E.getCodePoint(0)!==32){let F=this._getWordAt([0,e[1]+1],!1,!1,!0);F&&(x+=F.length)}}return{start:y,length:x}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={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=Qp(r,this._bufferService.cols)}};Hh=it([de(3,It),de(4,Xr),de(5,fu),de(6,Ot),de(7,Ji),de(8,Qi)],Hh);var Jp=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Zp=class{constructor(){this._color=new Jp,this._css=new Jp}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ut=Object.freeze((()=>{let e=[Ze.toColor("#2e3436"),Ze.toColor("#cc0000"),Ze.toColor("#4e9a06"),Ze.toColor("#c4a000"),Ze.toColor("#3465a4"),Ze.toColor("#75507b"),Ze.toColor("#06989a"),Ze.toColor("#d3d7cf"),Ze.toColor("#555753"),Ze.toColor("#ef2929"),Ze.toColor("#8ae234"),Ze.toColor("#fce94f"),Ze.toColor("#729fcf"),Ze.toColor("#ad7fa8"),Ze.toColor("#34e2e2"),Ze.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],a=t[r/6%6|0],l=t[r%6];e.push({css:lt.toCss(n,a,l),rgba:lt.toRgba(n,a,l)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:lt.toCss(n,n,n),rgba:lt.toRgba(n,n,n)})}return e})()),Wr=Ze.toColor("#ffffff"),kn=Ze.toColor("#000000"),em=Ze.toColor("#ffffff"),tm=kn,vn={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Bw=Wr,Wh=class extends Pe{constructor(e){super(),this._optionsService=e,this._contrastCache=new Zp,this._halfContrastCache=new Zp,this._onChangeColors=this._register(new le),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Wr,background:kn,cursor:em,cursorAccent:tm,selectionForeground:void 0,selectionBackgroundTransparent:vn,selectionBackgroundOpaque:qe.blend(kn,vn),selectionInactiveBackgroundTransparent:vn,selectionInactiveBackgroundOpaque:qe.blend(kn,vn),scrollbarSliderBackground:qe.opacity(Wr,.2),scrollbarSliderHoverBackground:qe.opacity(Wr,.4),scrollbarSliderActiveBackground:qe.opacity(Wr,.5),overviewRulerBorder:Wr,ansi:ut.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=$e(e.foreground,Wr),t.background=$e(e.background,kn),t.cursor=qe.blend(t.background,$e(e.cursor,em)),t.cursorAccent=qe.blend(t.background,$e(e.cursorAccent,tm)),t.selectionBackgroundTransparent=$e(e.selectionBackground,vn),t.selectionBackgroundOpaque=qe.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=$e(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=qe.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?$e(e.selectionForeground,Yp):void 0,t.selectionForeground===Yp&&(t.selectionForeground=void 0),qe.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=qe.opacity(t.selectionBackgroundTransparent,.3)),qe.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=qe.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=$e(e.scrollbarSliderBackground,qe.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=$e(e.scrollbarSliderHoverBackground,qe.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=$e(e.scrollbarSliderActiveBackground,qe.opacity(t.foreground,.5)),t.overviewRulerBorder=$e(e.overviewRulerBorder,Bw),t.ansi=ut.slice(),t.ansi[0]=$e(e.black,ut[0]),t.ansi[1]=$e(e.red,ut[1]),t.ansi[2]=$e(e.green,ut[2]),t.ansi[3]=$e(e.yellow,ut[3]),t.ansi[4]=$e(e.blue,ut[4]),t.ansi[5]=$e(e.magenta,ut[5]),t.ansi[6]=$e(e.cyan,ut[6]),t.ansi[7]=$e(e.white,ut[7]),t.ansi[8]=$e(e.brightBlack,ut[8]),t.ansi[9]=$e(e.brightRed,ut[9]),t.ansi[10]=$e(e.brightGreen,ut[10]),t.ansi[11]=$e(e.brightYellow,ut[11]),t.ansi[12]=$e(e.brightBlue,ut[12]),t.ansi[13]=$e(e.brightMagenta,ut[13]),t.ansi[14]=$e(e.brightCyan,ut[14]),t.ansi[15]=$e(e.brightWhite,ut[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<r;n++)t.ansi[n+16]=$e(e.extendedAnsi[n],ut[n+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()}}};Wh=it([de(0,Ot)],Wh);function $e(e,t){if(e!==void 0)try{return Ze.toColor(e)}catch{}return t}var jw=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Aw=class{constructor(){this._services=new jw,this._services.set(du,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=D0(e).sort((l,h)=>l.index-h.index),n=[];for(let l of r){let h=this._services.get(l.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);n.push(h)}let a=r.length>0?r[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},Iw={trace:0,debug:1,info:2,warn:3,error:4,off:5},Ow="xterm.js: ",$h=class extends Pe{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=Iw[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,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":Ow)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};$h=it([de(0,Ot)],$h);var im=class extends Pe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new le),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new le),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new le),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 r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];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,...r){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<r.length;n++)this._array[this._getCyclicIndex(e+n)]=r[n];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let a=t-1;a>=0;a--)this.set(e+a+r,this.get(e+a));let n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Le=3,at=Object.freeze(new jn),ra=0,Tc=2,En=class mg{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Le);let a=r||mi.fromCharData([0,B_,1,0]);for(let l=0;l<t;++l)this.setCell(l,a);this.length=t}get(t){let r=this._data[t*Le+0],n=r&2097151;return[this._data[t*Le+1],r&2097152?this._combined[t]:n?xr(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*Le+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Le+0]=t|2097152|r[2]<<22):this._data[t*Le+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Le+0]>>22}hasWidth(t){return this._data[t*Le+0]&12582912}getFg(t){return this._data[t*Le+1]}getBg(t){return this._data[t*Le+2]}hasContent(t){return this._data[t*Le+0]&4194303}getCodePoint(t){let r=this._data[t*Le+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Le+0]&2097152}getString(t){let r=this._data[t*Le+0];return r&2097152?this._combined[t]:r&2097151?xr(r&2097151):""}isProtected(t){return this._data[t*Le+2]&536870912}loadCell(t,r){return ra=t*Le,r.content=this._data[ra+0],r.fg=this._data[ra+1],r.bg=this._data[ra+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Le+0]=r.content,this._data[t*Le+1]=r.fg,this._data[t*Le+2]=r.bg}setCellFromCodepoint(t,r,n,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Le+0]=r|n<<22,this._data[t*Le+1]=a.fg,this._data[t*Le+2]=a.bg}addCodepointToCell(t,r,n){let a=this._data[t*Le+0];a&2097152?this._combined[t]+=xr(r):a&2097151?(this._combined[t]=xr(a&2097151)+xr(r),a&=-2097152,a|=2097152):a=r|1<<22,n&&(a&=-12582913,a|=n<<22),this._data[t*Le+0]=a}insertCells(t,r,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length-t){let a=new mi;for(let l=this.length-t-r-1;l>=0;--l)this.setCell(t+r+l,this.loadCell(t+l,a));for(let l=0;l<r;++l)this.setCell(t+l,n)}else for(let a=t;a<this.length;++a)this.setCell(a,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,r,n){if(t%=this.length,r<this.length-t){let a=new mi;for(let l=0;l<this.length-t-r;++l)this.setCell(t+l,this.loadCell(t+r+l,a));for(let l=this.length-r;l<this.length;++l)this.setCell(l,n)}else for(let a=t;a<this.length;++a)this.setCell(a,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,r,n,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.setCell(t++,n)}resize(t,r){if(t===this.length)return this._data.length*4*Tc<this._data.buffer.byteLength;let n=t*Le;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let a=new Uint32Array(n);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,r)}else{this._data=this._data.subarray(0,n);let a=Object.keys(this._combined);for(let h=0;h<a.length;h++){let f=parseInt(a[h],10);f>=t&&delete this._combined[f]}let l=Object.keys(this._extendedAttrs);for(let h=0;h<l.length;h++){let f=parseInt(l[h],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,n*4*Tc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Tc<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,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 r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new mg(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Le+0]&4194303)return t+(this._data[t*Le+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Le+0]&4194303||this._data[t*Le+2]&50331648)return t+(this._data[t*Le+0]>>22);return 0}copyCellsFrom(t,r,n,a,l){let h=t._data;if(l)for(let m=a-1;m>=0;m--){for(let p=0;p<Le;p++)this._data[(n+m)*Le+p]=h[(r+m)*Le+p];h[(r+m)*Le+2]&268435456&&(this._extendedAttrs[n+m]=t._extendedAttrs[r+m])}else for(let m=0;m<a;m++){for(let p=0;p<Le;p++)this._data[(n+m)*Le+p]=h[(r+m)*Le+p];h[(r+m)*Le+2]&268435456&&(this._extendedAttrs[n+m]=t._extendedAttrs[r+m])}let f=Object.keys(t._combined);for(let m=0;m<f.length;m++){let p=parseInt(f[m],10);p>=r&&(this._combined[p-r+n]=t._combined[p])}}translateToString(t,r,n,a){r=r??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),a&&(a.length=0);let l="";for(;r<n;){let h=this._data[r*Le+0],f=h&2097151,m=h&2097152?this._combined[r]:f?xr(f):kr;if(l+=m,a)for(let p=0;p<m.length;++p)a.push(r);r+=h>>22||1}return a&&a.push(r),l}};function zw(e,t,r,n,a,l){let h=[];for(let f=0;f<e.length-1;f++){let m=f,p=e.get(++m);if(!p.isWrapped)continue;let S=[e.get(f)];for(;m<e.length&&p.isWrapped;)S.push(p),p=e.get(++m);if(!l&&n>=f&&n<m){f+=S.length-1;continue}let g=0,C=Bn(S,g,t),v=1,y=0;for(;v<S.length;){let E=Bn(S,v,t),F=E-y,U=r-C,M=Math.min(F,U);S[g].copyCellsFrom(S[v],y,C,M,!1),C+=M,C===r&&(g++,C=0),y+=M,y===E&&(v++,y=0),C===0&&g!==0&&S[g-1].getWidth(r-1)===2&&(S[g].copyCellsFrom(S[g-1],r-1,C++,1,!1),S[g-1].setCell(r-1,a))}S[g].replaceCells(C,r,a);let x=0;for(let E=S.length-1;E>0&&(E>g||S[E].getTrimmedLength()===0);E--)x++;x>0&&(h.push(f+S.length-x),h.push(x)),f+=S.length-1}return h}function Fw(e,t){let r=[],n=0,a=t[n],l=0;for(let h=0;h<e.length;h++)if(a===h){let f=t[++n];e.onDeleteEmitter.fire({index:h-l,amount:f}),h+=f-1,l+=f,a=t[++n]}else r.push(h);return{layout:r,countRemoved:l}}function Hw(e,t){let r=[];for(let n=0;n<t.length;n++)r.push(e.get(t[n]));for(let n=0;n<r.length;n++)e.set(n,r[n]);e.length=t.length}function Ww(e,t,r){let n=[],a=e.map((m,p)=>Bn(e,p,t)).reduce((m,p)=>m+p),l=0,h=0,f=0;for(;f<a;){if(a-f<r){n.push(a-f);break}l+=r;let m=Bn(e,h,t);l>m&&(l-=m,h++);let p=e[h].getWidth(l-1)===2;p&&l--;let S=p?r-1:r;n.push(S),f+=S}return n}function Bn(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,a=e[t+1].getWidth(0)===2;return n&&a?r-1:r}var _g=class gg{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=gg._nextId++,this._onDispose=this.register(new le),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),qr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};_g._nextId=1;var $w=_g,ft={},$r=ft.B;ft[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ft.A={"#":"£"};ft.B=void 0;ft[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ft.C=ft[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ft.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ft.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ft.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ft.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ft.E=ft[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ft.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ft.H=ft[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ft["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var rm=4294967295,sm=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=at.clone(),this.savedCharset=$r,this.markers=[],this._nullCell=mi.fromCharData([0,B_,1,0]),this._whitespaceCell=mi.fromCharData([0,kr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ga,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new im(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new fa),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new fa),this._whitespaceCell}getBlankLine(e,t){return new En(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>rm?rm:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=at);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 im(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(at),n=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let h=0;h<this.lines.length;h++)n+=+this.lines.get(h).resize(e,r);let l=0;if(this._rows<t)for(let h=this._rows;h<t;h++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new En(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new En(e,r)));else for(let h=this._rows;h>t;h--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let h=this.lines.length-a;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),l&&(this.y+=l),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 l=0;l<this.lines.length;l++)n+=+this.lines.get(l).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.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 r=this._optionsService.rawOptions.reflowCursorLine,n=zw(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(at),r);if(n.length>0){let a=Fw(this.lines,n);Hw(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(at),a=r;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new En(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(at),a=[],l=0;for(let h=this.lines.length-1;h>=0;h--){let f=this.lines.get(h);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let m=[f];for(;f.isWrapped&&h>0;)f=this.lines.get(--h),m.unshift(f);if(!r){let M=this.ybase+this.y;if(M>=h&&M<h+m.length)continue}let p=m[m.length-1].getTrimmedLength(),S=Ww(m,this._cols,e),g=S.length-m.length,C;this.ybase===0&&this.y!==this.lines.length-1?C=Math.max(0,this.y-this.lines.maxLength+g):C=Math.max(0,this.lines.length-this.lines.maxLength+g);let v=[];for(let M=0;M<g;M++){let L=this.getBlankLine(at,!0);v.push(L)}v.length>0&&(a.push({start:h+m.length+l,newLines:v}),l+=v.length),m.push(...v);let y=S.length-1,x=S[y];x===0&&(y--,x=S[y]);let E=m.length-g-1,F=p;for(;E>=0;){let M=Math.min(F,x);if(m[y]===void 0)break;if(m[y].copyCellsFrom(m[E],F-M,x-M,M,!0),x-=M,x===0&&(y--,x=S[y]),F-=M,F===0){E--;let L=Math.max(E,0);F=Bn(m,L,this._cols)}}for(let M=0;M<m.length;M++)S[M]<e&&m[M].setCell(S[M],n);let U=g-C;for(;U-- >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+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(a.length>0){let h=[],f=[];for(let x=0;x<this.lines.length;x++)f.push(this.lines.get(x));let m=this.lines.length,p=m-1,S=0,g=a[S];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let C=0;for(let x=Math.min(this.lines.maxLength-1,m+l-1);x>=0;x--)if(g&&g.start>p+C){for(let E=g.newLines.length-1;E>=0;E--)this.lines.set(x--,g.newLines[E]);x++,h.push({index:p+1,amount:g.newLines.length}),C+=g.newLines.length,g=a[++S]}else this.lines.set(x,f[p--]);let v=0;for(let x=h.length-1;x>=0;x--)h[x].index+=v,this.lines.onInsertEmitter.fire(h[x]),v+=h[x].amount;let y=Math.max(0,m+l-this.lines.maxLength);y>0&&this.lines.onTrimEmitter.fire(y)}}translateBufferLineToString(e,t,r=0,n){let a=this.lines.get(e);return a?a.translateToString(t,r,n):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}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 $w(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Uw=class extends Pe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new le),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 sm(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new sm(!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)}},vg=2,yg=1,Uh=class extends Pe{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new le),this.onResize=this._onResize.event,this._onScroll=this._register(new le),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,vg),this.rows=Math.max(e.rawOptions.rows||0,yg),this.buffers=this._register(new Uw(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let a=r.ybase+r.scrollTop,l=r.ybase+r.scrollBottom;if(r.scrollTop===0){let h=r.lines.isFull;l===r.lines.length-1?h?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(l+1,0,n.clone()),h?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let h=l-a+1;r.lines.shiftElements(a+1,h-1,-1),r.lines.set(l,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};Uh=it([de(0,Ot)],Uh);var bs={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:_a,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Kw=["normal","bold","100","200","300","400","500","600","700","800","900"],Vw=class extends Pe{constructor(e){super(),this._onOptionChange=this._register(new le),this.onOptionChange=this._onOptionChange.event;let t={...bs};for(let r in e)if(r in t)try{let n=e[r];t[r]=this._sanitizeAndValidateOption(r,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Xe(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in bs))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in bs))throw new Error(`No option with key "${r}"`);n=this._sanitizeAndValidateOption(r,n),this.rawOptions[r]!==n&&(this.rawOptions[r]=n,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=bs[e]),!qw(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=bs[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Kw.includes(t)?t:bs[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 qw(e){return e==="block"||e==="underline"||e==="bar"}function Nn(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let n in e)r[n]=t<=1?e[n]:e[n]&&Nn(e[n],t-1);return r}var nm=Object.freeze({insertMode:!1}),om=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Kh=class extends Pe{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new le),this.onData=this._onData.event,this._onUserInput=this._register(new le),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new le),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new le),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Nn(nm),this.decPrivateModes=Nn(om)}reset(){this.modes=Nn(nm),this.decPrivateModes=Nn(om)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.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))}};Kh=it([de(0,It),de(1,z_),de(2,Ot)],Kh);var am={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Bc(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var jc=String.fromCharCode,lm={DEFAULT:e=>{let t=[Bc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${jc(t[0])}${jc(t[1])}${jc(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Bc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Bc(e,!0)};${e.x};${e.y}${t}`}},Vh=class extends Pe{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new le),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(am))this.addProtocol(n,am[n]);for(let n of Object.keys(lm))this.addEncoding(n,lm[n]);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,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let n=t/r,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=n+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_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,r){if(r){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)}};Vh=it([de(0,It),de(1,Xr),de(2,Ot)],Vh);var Ac=[[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]],Yw=[[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]],dt;function Xw(e,t){let r=0,n=t.length-1,a;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(a=r+n>>1,e>t[a][1])r=a+1;else if(e<t[a][0])n=a-1;else return!0;return!1}var Gw=class{constructor(){if(this.version="6",!dt){dt=new Uint8Array(65536),dt.fill(1),dt[0]=0,dt.fill(0,1,32),dt.fill(0,127,160),dt.fill(2,4352,4448),dt[9001]=2,dt[9002]=2,dt.fill(2,11904,42192),dt[12351]=1,dt.fill(2,44032,55204),dt.fill(2,63744,64256),dt.fill(2,65040,65050),dt.fill(2,65072,65136),dt.fill(2,65280,65377),dt.fill(2,65504,65511);for(let e=0;e<Ac.length;++e)dt.fill(0,Ac[e][0],Ac[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?dt[e]:Xw(e,Yw)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let a=Kr.extractWidth(t);a===0?n=!1:a>r&&(r=a)}return Kr.createPropertyValue(0,r,n)}},Kr=class da{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new le,this.onChange=this._onChange.event;let t=new Gw;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,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?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 r=0,n=0,a=t.length;for(let l=0;l<a;++l){let h=t.charCodeAt(l);if(55296<=h&&h<=56319){if(++l>=a)return r+this.wcwidth(h);let p=t.charCodeAt(l);56320<=p&&p<=57343?h=(h-55296)*1024+p-56320+65536:r+=this.wcwidth(p)}let f=this.charProperties(h,n),m=da.extractWidth(f);da.extractShouldJoin(f)&&(m-=da.extractWidth(n)),r+=m,n=f}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},Qw=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 cm(e){var n;let t=(n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:n.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var yn=2147483647,Jw=256,Sg=class qh{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>Jw)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new qh;if(!t.length)return r;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let a=t[n];if(Array.isArray(a))for(let l=0;l<a.length;++l)r.addSubParam(a[l]);else r.addParam(a)}return r}clone(){let t=new qh(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 r=0;r<this.length;++r){t.push(this.params[r]);let n=this._subParamsIdx[r]>>8,a=this._subParamsIdx[r]&255;a-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,a))}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>yn?yn: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>yn?yn:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-r>0?this._subParams.subarray(r,n):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let n=this._subParamsIdx[r]>>8,a=this._subParamsIdx[r]&255;a-n>0&&(t[r]=this._subParams.slice(n,a))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,a=n[r-1];n[r-1]=~a?Math.min(a*10+t,yn):t}},Sn=[],Zw=class{constructor(){this._state=0,this._active=Sn,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 r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,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=Sn}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=Sn,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Sn,!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,r){if(!this._active.length)this._handlerFb(this._id,"PUT",ka(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&r-t>0&&this._put(e,t,r)}}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 r=!1,n=this._active.length-1,a=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&r===!1){for(;n>=0&&(r=this._active[n].end(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=Sn,this._id=-1,this._state=0}}},ei=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=ka(e,t,r),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(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},wn=[],e1=class{constructor(){this._handlers=Object.create(null),this._active=wn,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=wn}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,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=wn,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||wn,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",ka(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,n=this._active.length-1,a=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&r===!1){for(;n>=0&&(r=this._active[n].unhook(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=wn,this._ident=0}},Rn=new Sg;Rn.addParam(0);var hm=class{constructor(e){this._handler=e,this._data="",this._params=Rn,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Rn,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=ka(e,t,r),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(r=>(this._params=Rn,this._data="",this._hitLimit=!1,r));return this._params=Rn,this._data="",this._hitLimit=!1,t}},t1=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,n){this.table[t<<8|e]=r<<4|n}addMany(e,t,r,n){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=r<<4|n}},pi=160,i1=(function(){let e=new t1(4095),t=Array.apply(null,Array(256)).map((f,m)=>m),r=(f,m)=>t.slice(f,m),n=r(32,127),a=r(0,24);a.push(25),a.push.apply(a,r(28,32));let l=r(0,14),h;e.setDefault(1,0),e.addMany(n,0,2,0);for(h in l)e.addMany([24,26,153,154],h,3,0),e.addMany(r(128,144),h,3,0),e.addMany(r(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(pi,0,2,0),e.add(pi,8,5,8),e.add(pi,6,0,6),e.add(pi,11,0,11),e.add(pi,13,13,13),e})(),r1=class extends Pe{constructor(e=i1){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 Sg,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},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(Xe(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Zw),this._dcsParser=this._register(new e1),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>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 a=0;a<e.intermediates.length;++a){let l=e.intermediates.charCodeAt(a);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=n,r}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 r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,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 r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,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,r,n,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=a}parse(e,t,r){let n=0,a=0,l=0,h;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let f=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(h=f[m](this._params),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(h=f[m](),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(n!==24&&n!==26,r),h)return h;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],h=this._oscParser.end(n!==24&&n!==26,r),h)return h;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=l;f<t;++f){switch(n=e[f],a=this._transitions.table[this.currentState<<8|(n<160?n:pi)],a>>4){case 2:for(let C=f+1;;++C){if(C>=t||(n=e[C])<32||n>126&&n<pi){this._printHandler(e,f,C),f=C-1;break}if(++C>=t||(n=e[C])<32||n>126&&n<pi){this._printHandler(e,f,C),f=C-1;break}if(++C>=t||(n=e[C])<32||n>126&&n<pi){this._printHandler(e,f,C),f=C-1;break}if(++C>=t||(n=e[C])<32||n>126&&n<pi){this._printHandler(e,f,C),f=C-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|n],p=m?m.length-1:-1;for(;p>=0&&(h=m[p](this._params),h!==!0);p--)if(h instanceof Promise)return this._preserveStack(3,m,p,a,f),h;p<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++f<t&&(n=e[f])>47&&n<60);f--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let S=this._escHandlers[this._collect<<8|n],g=S?S.length-1:-1;for(;g>=0&&(h=S[g](),h!==!0);g--)if(h instanceof Promise)return this._preserveStack(4,S,g,a,f),h;g<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let C=f+1;;++C)if(C>=t||(n=e[C])===24||n===26||n===27||n>127&&n<pi){this._dcsParser.put(e,f,C),f=C-1;break}break;case 14:if(h=this._dcsParser.unhook(n!==24&&n!==26),h)return this._preserveStack(6,[],0,a,f),h;n===27&&(a|=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 C=f+1;;C++)if(C>=t||(n=e[C])<32||n>127&&n<pi){this._oscParser.put(e,f,C),f=C-1;break}break;case 6:if(h=this._oscParser.end(n!==24&&n!==26),h)return this._preserveStack(5,[],0,a,f),h;n===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},s1=/^([\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})$/,n1=/^[\da-f]+$/;function um(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=s1.exec(t);if(r){let n=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/n*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/n*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),n1.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,n=[0,0,0];for(let a=0;a<3;++a){let l=parseInt(t.slice(r*a,r*a+r),16);n[a]=r===1?l<<4:r===2?l:r===3?l>>4:l>>8}return n}}function Ic(e,t){let r=e.toString(16),n=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function o1(e,t=16){let[r,n,a]=e;return`rgb:${Ic(r,t)}/${Ic(n,t)}/${Ic(a,t)}`}var a1={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Cr=131072,dm=10;function fm(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 pm=5e3,mm=0,l1=class extends Pe{constructor(e,t,r,n,a,l,h,f,m=new r1){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=a,this._oscLinkService=l,this._coreMouseService=h,this._unicodeService=f,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new N0,this._utf8Decoder=new R0,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=at.clone(),this._eraseAttrDataInternal=at.clone(),this._onRequestBell=this._register(new le),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new le),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new le),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new le),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new le),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new le),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new le),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new le),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new le),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new le),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new le),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new le),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new le),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 Yh(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,S)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:S.toArray()})}),this._parser.setEscHandlerFallback(p=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(p)})}),this._parser.setExecuteHandlerFallback(p=>{this._logService.debug("Unknown EXECUTE code: ",{code:p})}),this._parser.setOscHandlerFallback((p,S,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:S,data:g})}),this._parser.setDcsHandlerFallback((p,S,g)=>{S==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:S,payload:g})}),this._parser.setPrintHandler((p,S,g)=>this.print(p,S,g)),this._parser.registerCsiHandler({final:"@"},p=>this.insertChars(p)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},p=>this.scrollLeft(p)),this._parser.registerCsiHandler({final:"A"},p=>this.cursorUp(p)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},p=>this.scrollRight(p)),this._parser.registerCsiHandler({final:"B"},p=>this.cursorDown(p)),this._parser.registerCsiHandler({final:"C"},p=>this.cursorForward(p)),this._parser.registerCsiHandler({final:"D"},p=>this.cursorBackward(p)),this._parser.registerCsiHandler({final:"E"},p=>this.cursorNextLine(p)),this._parser.registerCsiHandler({final:"F"},p=>this.cursorPrecedingLine(p)),this._parser.registerCsiHandler({final:"G"},p=>this.cursorCharAbsolute(p)),this._parser.registerCsiHandler({final:"H"},p=>this.cursorPosition(p)),this._parser.registerCsiHandler({final:"I"},p=>this.cursorForwardTab(p)),this._parser.registerCsiHandler({final:"J"},p=>this.eraseInDisplay(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},p=>this.eraseInDisplay(p,!0)),this._parser.registerCsiHandler({final:"K"},p=>this.eraseInLine(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},p=>this.eraseInLine(p,!0)),this._parser.registerCsiHandler({final:"L"},p=>this.insertLines(p)),this._parser.registerCsiHandler({final:"M"},p=>this.deleteLines(p)),this._parser.registerCsiHandler({final:"P"},p=>this.deleteChars(p)),this._parser.registerCsiHandler({final:"S"},p=>this.scrollUp(p)),this._parser.registerCsiHandler({final:"T"},p=>this.scrollDown(p)),this._parser.registerCsiHandler({final:"X"},p=>this.eraseChars(p)),this._parser.registerCsiHandler({final:"Z"},p=>this.cursorBackwardTab(p)),this._parser.registerCsiHandler({final:"`"},p=>this.charPosAbsolute(p)),this._parser.registerCsiHandler({final:"a"},p=>this.hPositionRelative(p)),this._parser.registerCsiHandler({final:"b"},p=>this.repeatPrecedingCharacter(p)),this._parser.registerCsiHandler({final:"c"},p=>this.sendDeviceAttributesPrimary(p)),this._parser.registerCsiHandler({prefix:">",final:"c"},p=>this.sendDeviceAttributesSecondary(p)),this._parser.registerCsiHandler({final:"d"},p=>this.linePosAbsolute(p)),this._parser.registerCsiHandler({final:"e"},p=>this.vPositionRelative(p)),this._parser.registerCsiHandler({final:"f"},p=>this.hVPosition(p)),this._parser.registerCsiHandler({final:"g"},p=>this.tabClear(p)),this._parser.registerCsiHandler({final:"h"},p=>this.setMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"h"},p=>this.setModePrivate(p)),this._parser.registerCsiHandler({final:"l"},p=>this.resetMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"l"},p=>this.resetModePrivate(p)),this._parser.registerCsiHandler({final:"m"},p=>this.charAttributes(p)),this._parser.registerCsiHandler({final:"n"},p=>this.deviceStatus(p)),this._parser.registerCsiHandler({prefix:"?",final:"n"},p=>this.deviceStatusPrivate(p)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},p=>this.softReset(p)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},p=>this.setCursorStyle(p)),this._parser.registerCsiHandler({final:"r"},p=>this.setScrollRegion(p)),this._parser.registerCsiHandler({final:"s"},p=>this.saveCursor(p)),this._parser.registerCsiHandler({final:"t"},p=>this.windowOptions(p)),this._parser.registerCsiHandler({final:"u"},p=>this.restoreCursor(p)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},p=>this.insertColumns(p)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},p=>this.deleteColumns(p)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},p=>this.selectProtected(p)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},p=>this.requestMode(p,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},p=>this.requestMode(p,!1)),this._parser.setExecuteHandler(ie.BEL,()=>this.bell()),this._parser.setExecuteHandler(ie.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ie.BS,()=>this.backspace()),this._parser.setExecuteHandler(ie.HT,()=>this.tab()),this._parser.setExecuteHandler(ie.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ie.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ha.IND,()=>this.index()),this._parser.setExecuteHandler(ha.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ha.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ei(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new ei(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new ei(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new ei(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new ei(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new ei(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new ei(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new ei(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new ei(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new ei(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new ei(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new ei(p=>this.restoreCursorColor(p))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let p in ft)this._parser.registerEscHandler({intermediates:"(",final:p},()=>this.selectCharset("("+p)),this._parser.registerEscHandler({intermediates:")",final:p},()=>this.selectCharset(")"+p)),this._parser.registerEscHandler({intermediates:"*",final:p},()=>this.selectCharset("*"+p)),this._parser.registerEscHandler({intermediates:"+",final:p},()=>this.selectCharset("+"+p)),this._parser.registerEscHandler({intermediates:"-",final:p},()=>this.selectCharset("-"+p)),this._parser.registerEscHandler({intermediates:".",final:p},()=>this.selectCharset("."+p)),this._parser.registerEscHandler({intermediates:"/",final:p},()=>this.selectCharset("/"+p));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(p=>(this._logService.error("Parsing error: ",p),p)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new hm((p,S)=>this.requestStatusString(p,S)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),pm))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${pm} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,a=this._activeBuffer.y,l=0,h=this._parseStack.paused;if(h){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Cr&&(l=this._parseStack.position+Cr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,p=>String.fromCharCode(p)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(p=>p.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Cr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Cr))),h||this._dirtyRowTracker.clearRange(),e.length>Cr)for(let p=l;p<e.length;p+=Cr){let S=p+Cr<e.length?p+Cr:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(p,S),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,S),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,g))return this._preserveStack(n,a,g,p),this._logSlowResolvingAsync(r),r}else if(!h){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,p))return this._preserveStack(n,a,p,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,r){let n,a,l=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,S=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,S);let C=this._parser.precedingJoinState;for(let v=t;v<r;++v){if(n=e[v],n<127&&l){let F=l[String.fromCharCode(n)];F&&(n=F.charCodeAt(0))}let y=this._unicodeService.charProperties(n,C);a=Kr.extractWidth(y);let x=Kr.extractShouldJoin(y),E=x?Kr.extractWidth(C):0;if(C=y,h&&this._onA11yChar.fire(xr(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-E>f){if(m){let F=g,U=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&g instanceof En&&g.copyCellsFrom(F,U,0,E,!1);U<f;)F.setCellFromCodepoint(U++,0,1,S)}else if(this._activeBuffer.x=f-1,a===2)continue}if(x&&this._activeBuffer.x){let F=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-F,n,a);for(let U=a-E;--U>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,S);continue}if(p&&(g.insertCells(this._activeBuffer.x,a-E,this._activeBuffer.getNullCell(S)),g.getWidth(f-1)===2&&g.setCellFromCodepoint(f-1,0,1,S)),g.setCellFromCodepoint(this._activeBuffer.x++,n,a,S),a>0)for(;--a;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,S)}this._parser.precedingJoinState=C,this._activeBuffer.x<f&&r-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,S),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>fm(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new hm(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ei(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,r,n=!1,a=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),a),n&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&n.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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 r=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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(at));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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 r=e.params[0]||1,n=Kr.extractWidth(t),a=this._activeBuffer.x-n,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),h=new Uint32Array(l.length*r),f=0;for(let p=0;p<l.length;){let S=l.codePointAt(p)||0;h[f++]=S,p+=S>65535?2:1}let m=f;for(let p=1;p<r;++p)h.copyWithin(m,0,f),m+=f;return this.print(h,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ie.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ie.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ie.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ie.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ie.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,$r),this._charsetService.setgCharset(1,$r),this._charsetService.setgCharset(2,$r),this._charsetService.setgCharset(3,$r);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){(x=>(x[x.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",x[x.SET=1]="SET",x[x.RESET=2]="RESET",x[x.PERMANENTLY_SET=3]="PERMANENTLY_SET",x[x.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let n=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:l}=this._coreMouseService,h=this._coreService,{buffers:f,cols:m}=this._bufferService,{active:p,alt:S}=f,g=this._optionsService.rawOptions,C=(x,E)=>(h.triggerDataEvent(`${ie.ESC}[${t?"":"?"}${x};${E}$y`),!0),v=x=>x?1:2,y=e.params[0];return t?y===2?C(y,4):y===4?C(y,v(h.modes.insertMode)):y===12?C(y,3):y===20?C(y,v(g.convertEol)):C(y,0):y===1?C(y,v(n.applicationCursorKeys)):y===3?C(y,g.windowOptions.setWinLines?m===80?2:m===132?1:0:0):y===6?C(y,v(n.origin)):y===7?C(y,v(n.wraparound)):y===8?C(y,3):y===9?C(y,v(a==="X10")):y===12?C(y,v(g.cursorBlink)):y===25?C(y,v(!h.isCursorHidden)):y===45?C(y,v(n.reverseWraparound)):y===66?C(y,v(n.applicationKeypad)):y===67?C(y,4):y===1e3?C(y,v(a==="VT200")):y===1002?C(y,v(a==="DRAG")):y===1003?C(y,v(a==="ANY")):y===1004?C(y,v(n.sendFocus)):y===1005?C(y,4):y===1006?C(y,v(l==="SGR")):y===1015?C(y,4):y===1016?C(y,v(l==="SGR_PIXELS")):y===1048?C(y,1):y===47||y===1047||y===1049?C(y,v(p===S)):y===2004?C(y,v(n.bracketedPasteMode)):y===2026?C(y,v(n.synchronizedOutput)):C(y,0)}_updateAttrColor(e,t,r,n,a){return t===2?(e|=50331648,e&=-16777216,e|=jn.fromColorRGB([r,n,a])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let n=[0,0,-1,0,0,0],a=0,l=0;do{if(n[l+a]=e.params[t+l],e.hasSubParams(t+l)){let h=e.getSubParams(t+l),f=0;do n[1]===5&&(a=1),n[l+f+1+a]=h[f];while(++f<h.length&&f+l+1+a<n.length);break}if(n[1]===5&&l+a>=2||n[1]===2&&l+a>=5)break;n[1]&&(a=1)}while(++l+t<e.length&&l+a<n.length);for(let h=2;h<n.length;++h)n[h]===-1&&(n[h]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return l}_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=at.fg,e.bg=at.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,r,n=this._curAttrData;for(let a=0;a<t;a++)r=e.params[a],r>=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777216|r-90|8):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777216|r-100|8):r===0?this._processSGR0(n):r===1?n.fg|=134217728:r===3?n.bg|=67108864:r===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,n)):r===5?n.fg|=536870912:r===7?n.fg|=67108864:r===8?n.fg|=1073741824:r===9?n.fg|=2147483648:r===2?n.bg|=134217728:r===21?this._processUnderline(2,n):r===22?(n.fg&=-134217729,n.bg&=-134217729):r===23?n.bg&=-67108865:r===24?(n.fg&=-268435457,this._processUnderline(0,n)):r===25?n.fg&=-536870913:r===27?n.fg&=-67108865:r===28?n.fg&=-1073741825:r===29?n.fg&=2147483647:r===39?(n.fg&=-67108864,n.fg|=at.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=at.bg&16777215):r===38||r===48||r===58?a+=this._extractColor(e,a,n):r===53?n.bg|=1073741824:r===55?n.bg&=-1073741825:r===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):r===100?(n.fg&=-67108864,n.fg|=at.fg&16777215,n.bg&=-67108864,n.bg|=at.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ie.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ie.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ie.ESC}[?${t};${r}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=at.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 r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!fm(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(`${ie.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>dm&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>dm&&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=[],r=e.split(";");for(;r.length>1;){let n=r.shift(),a=r.shift();if(/^\d+$/.exec(n)){let l=parseInt(n);if(_m(l))if(a==="?")t.push({type:0,index:l});else{let h=um(a);h&&t.push({type:1,index:l,color:h})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,a=r.findIndex(l=>l.startsWith("id="));return a!==-1&&(n=r[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,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 r=e.split(";");for(let n=0;n<r.length&&!(t>=this._specialColors.length);++n,++t)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=um(r[n]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}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=[],r=e.split(";");for(let n=0;n<r.length;++n)if(/^\d+$/.exec(r[n])){let a=parseInt(r[n]);_m(a)&&t.push({type:2,index:a})}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,$r),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(a1[e[0]],ft[e[1]]||$r),!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=at.clone(),this._eraseAttrDataInternal=at.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 mi;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 r=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=h=>(this._coreService.triggerDataEvent(`${ie.ESC}${h}${ie.ESC}\\`),!0),n=this._bufferService.buffer,a=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Yh=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&&(mm=e,e=t,t=mm),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Yh=it([de(0,It)],Yh);function _m(e){return 0<=e&&e<256}var c1=5e7,gm=12,h1=50,u1=class extends Pe{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 le),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 r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>c1)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 r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],a=this._action(n,t);if(a){let h=f=>performance.now()-r>=gm?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(r,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(h);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=gm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>h1&&(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()}},Xh=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let f=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(m,f)),this._dataByLinkId.set(m.id,m),m.id}let r=e,n=this._getEntryIdKey(r),a=this._entriesWithId.get(n);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let l=t.addMarker(t.ybase+t.y),h={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(h,l)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);r.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(r,n))}}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 r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Xh=it([de(0,It)],Xh);var vm=!1,d1=class extends Pe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Es),this._onBinary=this._register(new le),this.onBinary=this._onBinary.event,this._onData=this._register(new le),this.onData=this._onData.event,this._onLineFeed=this._register(new le),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new le),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new le),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new le),this._instantiationService=new Aw,this.optionsService=this._register(new Vw(e)),this._instantiationService.setService(Ot,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Uh)),this._instantiationService.setService(It,this._bufferService),this._logService=this._register(this._instantiationService.createInstance($h)),this._instantiationService.setService(z_,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Kh)),this._instantiationService.setService(Xr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Vh)),this._instantiationService.setService(O_,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Kr)),this._instantiationService.setService(P0,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Qw),this._instantiationService.setService(L0,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Xh),this._instantiationService.setService(F_,this._oscLinkService),this._inputHandler=this._register(new l1(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Nt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Nt.forward(this._bufferService.onResize,this._onResize)),this._register(Nt.forward(this.coreService.onData,this._onData)),this._register(Nt.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 u1((t,r)=>this._inputHandler.parse(t,r))),this._register(Nt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new le),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&&!vm&&(this._logService.warn("writeSync is unreliable and will be removed soon."),vm=!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,vg),t=Math.max(t,yg),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(cm.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(cm(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Xe(()=>{for(let t of e)t.dispose()})}}},f1={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 p1(e,t,r,n){var h;let a={type:0,cancel:!1,key:void 0},l=(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?a.key=ie.ESC+"OA":a.key=ie.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=ie.ESC+"OD":a.key=ie.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=ie.ESC+"OC":a.key=ie.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=ie.ESC+"OB":a.key=ie.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":ie.DEL,e.altKey&&(a.key=ie.ESC+a.key);break;case 9:if(e.shiftKey){a.key=ie.ESC+"[Z";break}a.key=ie.HT,a.cancel=!0;break;case 13:a.key=e.altKey?ie.ESC+ie.CR:ie.CR,a.cancel=!0;break;case 27:a.key=ie.ESC,e.altKey&&(a.key=ie.ESC+ie.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;l?a.key=ie.ESC+"[1;"+(l+1)+"D":t?a.key=ie.ESC+"OD":a.key=ie.ESC+"[D";break;case 39:if(e.metaKey)break;l?a.key=ie.ESC+"[1;"+(l+1)+"C":t?a.key=ie.ESC+"OC":a.key=ie.ESC+"[C";break;case 38:if(e.metaKey)break;l?a.key=ie.ESC+"[1;"+(l+1)+"A":t?a.key=ie.ESC+"OA":a.key=ie.ESC+"[A";break;case 40:if(e.metaKey)break;l?a.key=ie.ESC+"[1;"+(l+1)+"B":t?a.key=ie.ESC+"OB":a.key=ie.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=ie.ESC+"[2~");break;case 46:l?a.key=ie.ESC+"[3;"+(l+1)+"~":a.key=ie.ESC+"[3~";break;case 36:l?a.key=ie.ESC+"[1;"+(l+1)+"H":t?a.key=ie.ESC+"OH":a.key=ie.ESC+"[H";break;case 35:l?a.key=ie.ESC+"[1;"+(l+1)+"F":t?a.key=ie.ESC+"OF":a.key=ie.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=ie.ESC+"[5;"+(l+1)+"~":a.key=ie.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=ie.ESC+"[6;"+(l+1)+"~":a.key=ie.ESC+"[6~";break;case 112:l?a.key=ie.ESC+"[1;"+(l+1)+"P":a.key=ie.ESC+"OP";break;case 113:l?a.key=ie.ESC+"[1;"+(l+1)+"Q":a.key=ie.ESC+"OQ";break;case 114:l?a.key=ie.ESC+"[1;"+(l+1)+"R":a.key=ie.ESC+"OR";break;case 115:l?a.key=ie.ESC+"[1;"+(l+1)+"S":a.key=ie.ESC+"OS";break;case 116:l?a.key=ie.ESC+"[15;"+(l+1)+"~":a.key=ie.ESC+"[15~";break;case 117:l?a.key=ie.ESC+"[17;"+(l+1)+"~":a.key=ie.ESC+"[17~";break;case 118:l?a.key=ie.ESC+"[18;"+(l+1)+"~":a.key=ie.ESC+"[18~";break;case 119:l?a.key=ie.ESC+"[19;"+(l+1)+"~":a.key=ie.ESC+"[19~";break;case 120:l?a.key=ie.ESC+"[20;"+(l+1)+"~":a.key=ie.ESC+"[20~";break;case 121:l?a.key=ie.ESC+"[21;"+(l+1)+"~":a.key=ie.ESC+"[21~";break;case 122:l?a.key=ie.ESC+"[23;"+(l+1)+"~":a.key=ie.ESC+"[23~";break;case 123:l?a.key=ie.ESC+"[24;"+(l+1)+"~":a.key=ie.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=ie.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=ie.DEL:e.keyCode===219?a.key=ie.ESC:e.keyCode===220?a.key=ie.FS:e.keyCode===221&&(a.key=ie.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let f=(h=f1[e.keyCode])==null?void 0:h[e.shiftKey?1:0];if(f)a.key=ie.ESC+f;else if(e.keyCode>=65&&e.keyCode<=90){let m=e.ctrlKey?e.keyCode-64:e.keyCode+32,p=String.fromCharCode(m);e.shiftKey&&(p=p.toUpperCase()),a.key=ie.ESC+p}else if(e.keyCode===32)a.key=ie.ESC+(e.ctrlKey?ie.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let m=e.code.slice(3,4);e.shiftKey||(m=m.toLowerCase()),a.key=ie.ESC+m,a.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=ie.US),e.key==="@"&&(a.key=ie.NUL));break}return a}var nt=0,m1=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ga,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ga,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((a,l)=>this._getKey(a)-this._getKey(l)),t=0,r=0,n=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<n.length;a++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(n[a]=e[t],t++):n[a]=this._array[r++];this._array=n,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||(nt=this._search(t),nt===-1)||this._getKey(this._array[nt])!==t)return!1;do if(this._array[nt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(nt),!0;while(++nt<this._array.length&&this._getKey(this._array[nt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,l)=>a-l),t=0,r=new Array(this._array.length-e.length),n=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:r[n++]=this._array[a];this._array=r,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&&(nt=this._search(e),!(nt<0||nt>=this._array.length)&&this._getKey(this._array[nt])===e))do yield this._array[nt];while(++nt<this._array.length&&this._getKey(this._array[nt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(nt=this._search(e),!(nt<0||nt>=this._array.length)&&this._getKey(this._array[nt])===e))do t(this._array[nt]);while(++nt<this._array.length&&this._getKey(this._array[nt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let n=t+r>>1,a=this._getKey(this._array[n]);if(a>e)r=n-1;else if(a<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},Oc=0,ym=0,_1=class extends Pe{constructor(){super(),this._decorations=new m1(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new le),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new le),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Xe(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new g1(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.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,r){let n=0,a=0;for(let l of this._decorations.getKeyIterator(t))n=l.options.x??0,a=n+(l.options.width??1),e>=n&&e<a&&(!r||(l.options.layer??"bottom")===r)&&(yield l)}forEachDecorationAtCell(e,t,r,n){this._decorations.forEachByKey(t,a=>{Oc=a.options.x??0,ym=Oc+(a.options.width??1),e>=Oc&&e<ym&&(!r||(a.options.layer??"bottom")===r)&&n(a)})}},g1=class extends Er{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new le),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new le),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=Ze.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ze.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},v1=1e3,y1=class{constructor(e,t=v1){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,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 n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=n-this._lastRefreshMs,l=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_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)}},Sm=20,va=class extends Pe{constructor(e,t,r,n){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,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=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new y1(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(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
64
|
+
`))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Re(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Xe(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Sm+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
65
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Sm+1&&(this._liveRegion.textContent+=mh.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 r=this._terminal.buffer,n=r.lines.length.toString();for(let a=e;a<=t;a++){let l=r.lines.get(r.ydisp+a),h=[],f=(l==null?void 0:l.translateToString(!0,void 0,void 0,h))||"",m=(r.ydisp+a+1).toString(),p=this._rowElements[a];p&&(f.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=f,this._rowColumns.set(p,h)),p.setAttribute("aria-posinset",m),p.setAttribute("aria-setsize",n),this._alignRowWidth(p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],a=r.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===l||e.relatedTarget!==n)return;let h,f;if(t===0?(h=r,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(h=this._rowElements.shift(),f=r,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var f;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},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,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 n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:((f=n.textContent)==null?void 0:f.length)??0}),!this._rowContainer.contains(r.node))return;let a=({node:m,offset:p})=>{let S=m instanceof Text?m.parentNode:m,g=parseInt(S==null?void 0:S.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let C=this._rowColumns.get(S);if(!C)return console.warn("columns is null. Race condition?"),null;let v=p<C.length?C[p]:C.slice(-1)[0]+1;return v>=this._terminal.cols&&(++g,v=0),{row:g,column:v}},l=a(t),h=a(r);if(!(!l||!h)){if(l.row>h.row||l.row===h.row&&l.column>=h.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(h.row-l.row)*this._terminal.cols-l.column+h.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var a,l;e.style.transform="";let t=e.getBoundingClientRect().width,r=(l=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:l[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};va=it([de(1,du),de(2,Qi),de(3,Ji)],va);var Gh=class extends Pe{constructor(e,t,r,n,a){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=n,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new le),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new le),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Xe(()=>{var l;qr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(l=this._activeProviderReplies)==null||l.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Re(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Re(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Re(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Re(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 r=e.composedPath();for(let n=0;n<r.length;n++){let a=r[n];if(a.classList.contains("xterm"))break;if(a.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 n,a;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(l=>{l==null||l.forEach(h=>{h.link.dispose&&h.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[l,h]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(l)&&(r=this._checkLinkProviderResult(l,e,r)):h.provideLinks(e.y,f=>{var p,S;if(this._isMouseOut)return;let m=f==null?void 0:f.map(g=>({link:g}));(p=this._activeProviderReplies)==null||p.set(l,m),r=this._checkLinkProviderResult(l,e,r),((S=this._activeProviderReplies)==null?void 0:S.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let n=0;n<t.size;n++){let a=t.get(n);if(a)for(let l=0;l<a.length;l++){let h=a[l],f=h.link.range.start.y<e?0:h.link.range.start.x,m=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let p=f;p<=m;p++){if(r.has(p)){a.splice(l--,1);break}r.add(p)}}}}_checkLinkProviderResult(e,t,r){var l;if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),a=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(a=!0);if(!a&&n){let h=n.find(f=>this._linkAtPosition(f.link,t));h&&(r=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let h=0;h<this._activeProviderReplies.size;h++){let f=(l=this._activeProviderReplies.get(h))==null?void 0:l.find(m=>this._linkAtPosition(m.link,t));if(f){r=!0,this._handleNewLink(f);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&S1(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,qr(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 r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.pointerCursor},set:r=>{var n;(n=this._currentLink)!=null&&n.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline},set:r=>{var n,a,l;(n=this._currentLink)!=null&&n.state&&((l=(a=this._currentLink)==null?void 0:a.state)==null?void 0:l.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let n=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(n,a),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,t,r){var n;(n=this._currentLink)!=null&&n.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(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,n=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,r){var n;(n=this._currentLink)!=null&&n.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(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return r<=a&&a<=n}_positionFromMouseEvent(e,t,r){let n=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,n,a){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:a}}};Gh=it([de(1,fu),de(2,Ji),de(3,It),de(4,W_)],Gh);function S1(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 w1=class extends d1{constructor(e={}){super(e),this._linkifier=this._register(new Es),this.browser=ag,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Es),this._onCursorMove=this._register(new le),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new le),this.onKey=this._onKey.event,this._onRender=this._register(new le),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new le),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new le),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new le),this.onBell=this._onBell.event,this._onFocus=this._register(new le),this._onBlur=this._register(new le),this._onA11yCharEmitter=this._register(new le),this._onA11yTabEmitter=this._register(new le),this._onWillOpen=this._register(new le),this._setup(),this._decorationService=this._instantiationService.createInstance(_1),this._instantiationService.setService(An,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(hw),this._instantiationService.setService(W_,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(gh)),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(Nt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Nt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Nt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Nt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Xe(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.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 r,n="";switch(t.index){case 256:r="foreground",n="10";break;case 257:r="background",n="11";break;case 258:r="cursor",n="12";break;default:r="ansi",n="4;"+t.index}switch(t.type){case 0:let a=qe.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ie.ESC}]${n};${o1(a)}${ng.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=lt.toColor(...t.color));else{let l=r;this._themeService.modifyColors(h=>h[l]=lt.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(va,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.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(ie.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 r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,a=t.getWidth(r),l=this._renderService.dimensions.css.cell.width*a,h=this.buffer.y*this._renderService.dimensions.css.cell.height,f=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=h+"px",this.textarea.style.width=l+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Re(this.element,"copy",t=>{this.hasSelection()&&k0(t,this._selectionService)}));let e=t=>E0(t,this.textarea,this.coreService,this.optionsService);this._register(Re(this.textarea,"paste",e)),this._register(Re(this.element,"paste",e)),lg?this._register(Re(this.element,"mousedown",t=>{t.button===2&&Mp(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Re(this.element,"contextmenu",t=>{Mp(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),wu&&this._register(Re(this.element,"auxclick",t=>{t.button===1&&T_(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Re(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Re(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Re(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Re(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Re(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Re(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Re(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var a;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"),((a=this.element)==null?void 0:a.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(Re(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",ph.get()),ug||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",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(lw,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Qi,this._coreBrowserService),this._register(Re(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Re(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Oh,this._document,this._helperContainer),this._instantiationService.setService(Ea,this._charSizeService),this._themeService=this._instantiationService.createInstance(Wh),this._instantiationService.setService(Ds,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ma),this._instantiationService.setService(H_,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Fh,this.rows,this.screenElement)),this._instantiationService.setService(Ji,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(jh,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(zh),this._instantiationService.setService(fu,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(Gh,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(Th,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Hh,this.element,this.screenElement,n)),this._instantiationService.setService(B0,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(Nt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var l;this._selectionService.refresh(),(l=this._viewport)==null||l.queueSync()})),this._register(this._instantiationService.createInstance(Bh,this.screenElement)),this._register(Re(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),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(va,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(pa,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(pa,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Ih,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(l){var p,S,g,C,v;let h=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!h)return!1;let f,m;switch(l.overrideType||l.type){case"mousemove":m=32,l.buttons===void 0?(f=3,l.button!==void 0&&(f=l.button<3?l.button:3)):f=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":m=0,f=l.button<3?l.button:3;break;case"mousedown":m=1,f=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let y=l.deltaY;if(y===0||e.coreMouseService.consumeWheelEvent(l,(C=(g=(S=(p=e._renderService)==null?void 0:p.dimensions)==null?void 0:S.device)==null?void 0:g.cell)==null?void 0:C.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return!1;m=y<0?0:1,f=4;break;default:return!1}return m===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:f,action:m,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:l=>(r(l),l.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(l)),wheel:l=>(r(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&r(l)},mousemove:l=>{l.buttons||r(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),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()),l&8?n.mousemove||(t.addEventListener("mousemove",a.mousemove),n.mousemove=a.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),l&16?n.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),n.wheel=a.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),l&2?n.mouseup||(n.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),l&4?n.mousedrag||(n.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Re(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return r(l),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(l)})),this._register(Re(t,"wheel",l=>{var h,f,m,p,S;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,(p=(m=(f=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:f.device)==null?void 0:m.cell)==null?void 0:p.height,(S=e._coreBrowserService)==null?void 0:S.dpr)===0)return this.cancel(l,!0);let g=ie.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(g,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.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){P_(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,r){this._selectionService.setSelection(e,t,r)}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 r;(r=this._selectionService)==null||r.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 r=p1(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let n=this.rows-1;return this.scrollLines(r.type===2?-n:n),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.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((r.key===ie.ETX||r.key===ie.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=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"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(C1(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 r;(r=this._charSizeService)==null||r.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(at));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(ie.ESC+"[I"):this.coreService.triggerDataEvent(ie.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.ESC}[4;${r};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.ESC}[6;${a};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function C1(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var b1=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;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)}},x1=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 mi)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},wm=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 x1(t)}getNullCell(){return new mi}},k1=class extends Pe{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new le),this.onBufferChange=this._onBufferChange.event,this._normal=new wm(this._core.buffers.normal,"normal"),this._alternate=new wm(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)}},E1=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,n)=>t(r,n.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)}},N1=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}},R1=["cols","rows"],Ti=0,D1=class extends Pe{constructor(e){super(),this._core=this._register(new w1(e)),this._addonManager=this._register(new b1),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],r=(n,a)=>{this._checkReadonlyOptions(n),this._core.options[n]=a};for(let n in this._core.options){let a={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,a)}}_checkReadonlyOptions(e){if(R1.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 E1(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new N1(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 k1(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,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}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 ph.get()},set promptLabel(e){ph.set(e)},get tooMuchOutput(){return mh.get()},set tooMuchOutput(e){mh.set(e)}}}_verifyIntegers(...e){for(Ti of e)if(Ti===1/0||isNaN(Ti)||Ti%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ti of e)if(Ti&&(Ti===1/0||isNaN(Ti)||Ti%1!==0||Ti<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,L1=1,P1=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 g;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:((g=this._terminal.options.overviewRuler)==null?void 0:g.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),a=Math.max(0,parseInt(r.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),h={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},f=h.top+h.bottom,m=h.right+h.left,p=n-f,S=a-m-t;return{cols:Math.max(M1,Math.floor(S/e.css.cell.width)),rows:Math.max(L1,Math.floor(p/e.css.cell.height))}}};function T1(e,t){return e?`/api/route/${String(e).split("/").map(encodeURIComponent).join("/")}/_/ws?token=${encodeURIComponent(t||"")}`:"/ws"}function B1({session:e,node:t,token:r,cols:n,rows:a,readonly:l=!1,takeSize:h,focused:f,onData:m,onExit:p,onFiles:S,retryBaseMs:g=250}){const C=["localhost","127.0.0.1","::1","[::1]"].includes(location.hostname);if(location.protocol!=="https:"&&!C)throw new Error("nexuscrew: ws:// rifiutato su origine non-locale e non-TLS (apri via tunnel su localhost o servi in HTTPS)");const y=`${location.protocol==="https:"?"wss":"ws"}://${location.host}${T1(t,r)}`;let x=null,E=!1,F=!1,U=null,M=0,L=f;const G=()=>{if(E||F||U)return;const A=Math.min(5e3,Math.max(0,g)*2**Math.min(M++,5));U=setTimeout(()=>{U=null,$()},A)},$=()=>{if(E||F)return;const A=new WebSocket(y);x=A,A.binaryType="arraybuffer",A.onopen=()=>{if(x!==A||E)return;M=0;const K={type:"attach",session:e,token:r,cols:n,rows:a,readonly:l};h!==void 0&&(K.takeSize=h),A.send(JSON.stringify(K)),L!==void 0&&A.send(JSON.stringify({type:"focus",on:!!L}))},A.onmessage=K=>{if(!(x!==A||E))if(typeof K.data=="string"){let P;try{P=JSON.parse(K.data)}catch{return}P.type==="exit"&&(F=!0,p&&p(P.code)),P.type==="files"&&S&&S(P)}else m&&m(new Uint8Array(K.data))},A.onerror=()=>{if(x===A)try{A.close()}catch{}},A.onclose=K=>{x!==A||E||F||[1e3,1002,4401,4404].includes(K==null?void 0:K.code)||G()}};return $(),{sendInput:A=>{!x||x.readyState!==1||x.send(typeof A=="string"?new TextEncoder().encode(A):A)},resize:(A,K)=>{n=A,a=K,(x==null?void 0:x.readyState)===1&&x.send(JSON.stringify({type:"resize",cols:A,rows:K}))},action:A=>{(x==null?void 0:x.readyState)===1&&x.send(JSON.stringify({type:"action",name:A}))},focus:A=>{L=A,(x==null?void 0:x.readyState)===1&&x.send(JSON.stringify({type:"focus",on:!!A}))},close:()=>{if(E=!0,U&&clearTimeout(U),U=null,x)try{x.close()}catch{}},get raw(){return x}}}async function Cm(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 r=document.createElement("textarea");r.value=t,r.readOnly=!0,r.style.position="fixed",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r),r.select();const n=document.execCommand&&document.execCommand("copy");if(r.remove(),n)return!0}catch{}return!1}function j1(e){return!e||typeof e!="object"?!1:!!e.shiftKey}function A1(e){return!e||typeof e!="object"||String(e.key||"").toLowerCase()!=="c"?!1:!!(e.metaKey||e.ctrlKey&&e.shiftKey)}const I1=450,bm=8;function O1(e,t,r,n){return Math.abs(Number(r)-Number(e))>bm||Math.abs(Number(n)-Number(t))>bm}function wg({session:e,node:t,token:r,readonly:n,takeSize:a,focused:l,sendRef:h,actionRef:f,ctrlRef:m,setCtrlArmed:p,onFiles:S,fontSize:g=13,selectionMode:C=!1,onSelectionModeChange:v}){const y=I.useRef(null),x=I.useRef(null),E=I.useRef(g);E.current=g;const F=I.useRef(l);F.current=l;const U=I.useRef(C);U.current=C;const[M,L]=I.useState(""),[G,$]=I.useState(""),A=async()=>{var W,O,j,B;const P=((O=(W=x.current)==null?void 0:W.term)==null?void 0:O.getSelection())||M;if(!P){$(k("copy-empty")),setTimeout(()=>$(""),1500);return}const N=await Cm(P);$(k(N?"copied":"copy-manual")),N&&((B=(j=x.current)==null?void 0:j.term)==null||B.clearSelection(),v==null||v(!1)),setTimeout(()=>$(""),1800)},K=I.useRef(A);return K.current=A,I.useEffect(()=>{const P=x.current;P&&P.sock&&P.sock.focus&&P.sock.focus(!!l)},[l]),I.useEffect(()=>{const P=x.current;P&&(P.term.options.fontSize=g,P.fit.fit(),P.sock.resize(P.term.cols,P.term.rows))},[g]),I.useEffect(()=>{const P=new D1({cursorBlink:!0,fontSize:E.current,scrollback:1e3,theme:{background:"#0a0e0a"}}),N=new P1;P.loadAddon(N),P.open(y.current),N.fit();const W=new TextDecoder;let O;try{O=B1({session:e,node:t,token:r,readonly:n,takeSize:a,focused:F.current,onFiles:S,cols:P.cols,rows:P.rows,onData:pe=>P.write(W.decode(pe)),onExit:()=>P.write(`\r
|
|
78
|
+
\x1B[33m[sessione finita]\x1B[0m\r
|
|
79
|
+
`)})}catch(pe){return P.write(`\r
|
|
80
|
+
\x1B[31m${pe.message}\x1B[0m\r
|
|
81
|
+
`),()=>P.dispose()}x.current={term:P,fit:N,sock:O},h&&(h.current=pe=>O.sendInput(pe)),f&&(f.current=pe=>O.action(pe));const j=P.onData(pe=>{if(!n){if(m&&m.current&&pe.length===1){const Ae=pe.charCodeAt(0);let bt=Ae;Ae>=97&&Ae<=122?bt=Ae-96:Ae>=64&&Ae<=95?bt=Ae-64:Ae===32&&(bt=0),pe=String.fromCharCode(bt),m.current=!1,p&&p(!1)}O.sendInput(pe)}}),B=P.onSelectionChange(()=>L(P.getSelection()));P.attachCustomKeyEventHandler(pe=>(pe.ctrlKey||pe.metaKey)&&pe.key.toLowerCase()==="c"&&P.getSelection()?(pe.type==="keydown"&&Cm(P.getSelection()),!1):!0);const V=y.current,Q=24;let ee=null,b=null,Z=0,te=null,R=null,T=null,ne=!1;const ce=()=>{T&&clearTimeout(T),T=null},ue=(pe,Ae)=>{const Tt=(V.querySelector(".xterm-screen")||V).getBoundingClientRect(),ni=Math.max(0,Math.min(P.cols-1,Math.floor((pe-Tt.left)/Math.max(1,Tt.width)*P.cols))),Ei=Math.max(0,Math.min(P.rows-1,Math.floor((Ae-Tt.top)/Math.max(1,Tt.height)*P.rows)));return{col:ni,row:P.buffer.active.viewportY+Ei}},ge=pe=>ue(pe.clientX,pe.clientY),Ce=pe=>{if(ce(),ne=!1,pe.touches.length!==1){ee=null;return}if(U.current){pe.preventDefault(),pe.stopPropagation(),R=ge(pe.touches[0]),P.clearSelection();return}ee=pe.touches[0].clientY,b=pe.touches[0].clientX,Z=0,te=null;const Ae={x:b,y:ee};T=setTimeout(()=>{T=null,ne=!0,U.current=!0,v==null||v(!0),R=ue(Ae.x,Ae.y),P.clearSelection(),P.select(R.col,R.row,1),ee=null,b=null,te=null,Z=0},I1)},be=pe=>{if((U.current||ne)&&R&&pe.touches.length===1){pe.preventDefault(),pe.stopPropagation();const bt=ge(pe.touches[0]),Tt=R.row*P.cols+R.col,ni=bt.row*P.cols+bt.col,Ei=Tt<=ni?R:bt;P.select(Ei.col,Ei.row,Math.abs(ni-Tt)+1);return}if(ee===null||pe.touches.length!==1)return;pe.preventDefault(),pe.stopPropagation();const Ae=pe.touches[0];if(T&&O1(b,ee,Ae.clientX,Ae.clientY)&&ce(),te===null&&(Math.abs(Ae.clientY-ee)>8||Math.abs(Ae.clientX-b)>8)&&(te=Math.abs(Ae.clientY-ee)>Math.abs(Ae.clientX-b)),!!te){for(Z+=Ae.clientY-ee,ee=Ae.clientY;Z>=Q;)O.action("scroll-up"),Z-=Q;for(;Z<=-Q;)O.action("scroll-down"),Z+=Q}},xe=()=>{ce(),ee=null,b=null,R=null,ne=!1};let Oe=0;const Y=pe=>{for(pe.preventDefault(),pe.stopPropagation(),Oe+=pe.deltaY;Oe<=-Q;)O.action("scroll-up"),Oe+=Q;for(;Oe>=Q;)O.action("scroll-down"),Oe-=Q};V.addEventListener("touchstart",Ce,{passive:!1}),V.addEventListener("touchmove",be,{passive:!1,capture:!0}),V.addEventListener("touchend",xe,{passive:!0}),V.addEventListener("touchcancel",xe,{passive:!0});const ye=pe=>{(U.current||ne)&&(pe.preventDefault(),pe.stopPropagation())};V.addEventListener("contextmenu",ye,!0),V.addEventListener("wheel",Y,{passive:!1,capture:!0});let me=null;const He=pe=>{j1(pe)&&(pe.preventDefault(),pe.stopPropagation(),me=ue(pe.clientX,pe.clientY),P.clearSelection())},Me=pe=>{if(!me)return;pe.preventDefault(),pe.stopPropagation();const Ae=ue(pe.clientX,pe.clientY),bt=me.row*P.cols+me.col,Tt=Ae.row*P.cols+Ae.col,ni=bt<=Tt?me:Ae;P.select(ni.col,ni.row,Math.abs(Tt-bt)+1)},Nr=pe=>{me&&(pe.stopPropagation(),me=null)};V.addEventListener("mousedown",He,!0),V.addEventListener("mousemove",Me,!0),V.addEventListener("mouseup",Nr,!0);const Zi=pe=>{!A1(pe)||!(x.current&&x.current.term&&x.current.term.getSelection())||(pe.preventDefault(),pe.stopPropagation(),K.current&&K.current())};V.addEventListener("keydown",Zi,!0);const ii=()=>{N.fit(),O.resize(P.cols,P.rows)};window.addEventListener("resize",ii);const ri=window.visualViewport;ri&&(ri.addEventListener("resize",ii),ri.addEventListener("scroll",ii));let si=null,zt=0;return typeof ResizeObserver<"u"&&(si=new ResizeObserver(()=>{zt&&cancelAnimationFrame(zt),zt=requestAnimationFrame(ii)}),si.observe(V)),()=>{x.current=null,j.dispose(),B.dispose(),V.removeEventListener("touchstart",Ce),V.removeEventListener("touchmove",be,{capture:!0}),V.removeEventListener("touchend",xe),V.removeEventListener("touchcancel",xe),V.removeEventListener("contextmenu",ye,!0),ce(),V.removeEventListener("wheel",Y,{capture:!0}),V.removeEventListener("mousedown",He,!0),V.removeEventListener("mousemove",Me,!0),V.removeEventListener("mouseup",Nr,!0),V.removeEventListener("keydown",Zi,!0),window.removeEventListener("resize",ii),ri&&(ri.removeEventListener("resize",ii),ri.removeEventListener("scroll",ii)),si&&si.disconnect(),zt&&cancelAnimationFrame(zt),O.close(),P.dispose()}},[e,t,r,n,a,h,f,m,p,S]),u.jsxs("div",{className:`nc-terminal${C?" selecting":""}`,children:[u.jsx("div",{className:"nc-terminal-host",ref:y}),(M||C)&&u.jsxs("div",{className:"nc-selection-tools",children:[M?u.jsx("button",{type:"button",onClick:A,children:G||k("copy")}):u.jsx("span",{children:k("select-drag")}),u.jsx("button",{type:"button",onClick:()=>{var P,N;(N=(P=x.current)==null?void 0:P.term)==null||N.clearSelection(),L(""),v==null||v(!1)},children:k("cancel")}),G===k("copy-manual")&&u.jsx("textarea",{readOnly:!0,value:M,onFocus:P=>P.target.select()})]})]})}const xm="",qt="\x1B",z1=[{label:"↑",seq:qt+"[A"},{label:"↓",seq:qt+"[B"},{label:"PGUP",seq:qt+"[5~"},{label:"PGDN",seq:qt+"[6~"}];function F1({send:e,action:t,ctrlArmed:r=!1,onCtrl:n,onKeyboard:a,selectionMode:l=!1,onSelectionMode:h}){const[f,m]=I.useState(!1),[p,S]=I.useState(!1),[g,C]=I.useState(!1),v=E=>{g?(e(qt+E),C(!1)):e(E)},y=(E,F,U)=>u.jsx("button",{onMouseDown:M=>{M.preventDefault(),v(F),U&&U()},children:E},E),x=(E,F)=>u.jsx("button",{onMouseDown:U=>{U.preventDefault(),t(F),S(!1)},children:E},E);return f?u.jsxs("div",{className:"nc-keybar copy",children:[u.jsx("span",{className:"tag",children:"copy-mode"}),z1.map(E=>y(E.label,E.seq)),y("ESCI (q)","q",()=>m(!1))]}):u.jsxs("div",{className:"nc-keybar termux",children:[p&&u.jsxs("div",{className:"nc-keymenu",children:[x("←WIN","prev-window"),x("WIN→","next-window"),x("⬅PANE","pane-left"),x("PANE➡","pane-right"),y("SCROLL",xm+"[",()=>{m(!0),S(!1)}),u.jsx("button",{className:l?"armed":"",onMouseDown:E=>{E.preventDefault(),h==null||h(!l),S(!1)},children:"SELECT"}),y("⌃C","",()=>S(!1)),y("DETACH",xm+"d",()=>S(!1))]}),u.jsxs("div",{className:"row",children:[y("ESC",qt),u.jsx("button",{className:p?"armed":"",onMouseDown:E=>{E.preventDefault(),S(F=>!F)},children:"☰"},"menu"),y("/","/"),y("—","-"),y("HOME",qt+"[H"),y("↑",qt+"[A"),y("END",qt+"[F"),y("PGUP",qt+"[5~")]}),u.jsxs("div",{className:"row",children:[y("⇥"," "),u.jsx("button",{onMouseDown:E=>{E.preventDefault(),a&&a()},children:"⌨"},"kbd"),u.jsx("button",{className:r?"armed":"",onMouseDown:E=>{E.preventDefault(),n&&n()},children:"CTRL"},"ctrl"),u.jsx("button",{className:g?"armed":"",onMouseDown:E=>{E.preventDefault(),C(F=>!F)},children:"ALT"},"alt"),y("←",qt+"[D"),y("↓",qt+"[B"),y("→",qt+"[C"),y("PGDN",qt+"[6~")]})]})}const H1=e=>e>1048576?`${(e/1048576).toFixed(1)}M`:e>1024?`${(e/1024).toFixed(0)}K`:`${e}B`;function Cg({session:e,node:t,token:r,filesEvent:n,onClose:a}){Yt();const l=t?`/api/route/${String(t).split("/").map(encodeURIComponent).join("/")}/_`:"/api",h=t?`${t}:${e}`:e,[f,m]=I.useState("outbox"),[p,S]=I.useState({inbox:[],outbox:[]}),[g,C]=I.useState(""),v=I.useRef(null);async function y(){try{const M=await(await wt(`${l}/files?session=${encodeURIComponent(e)}`,r)).json();if(M.error){C(M.error);return}S(M);const L=M.outbox[0]?M.outbox[0].mtime:0;localStorage.setItem(p_(h),String(L))}catch(U){C(String(U))}}I.useEffect(()=>{y()},[e,t]),I.useEffect(()=>{n&&n.session===e&&y()},[n]);async function x(U){for(const M of U){C(`carico ${M.name}…`);const L=new FormData;L.append("session",e),L.append("file",M);try{const $=await(await wt(`${l}/files/upload`,r,{method:"POST",body:L})).json();C($.error?`errore: ${$.error}`:"")}catch(G){C(String(G))}}y()}async function E(U){const M=await wt(`${l}/files/download?session=${encodeURIComponent(e)}&box=${f}&name=${encodeURIComponent(U)}`,r);if(!M.ok){C("errore download");return}const L=await M.blob(),G=URL.createObjectURL(L),$=document.createElement("a");$.href=G,$.download=U,$.click(),URL.revokeObjectURL(G)}async function F(U){await wt(`${l}/files?session=${encodeURIComponent(e)}&box=${f}&name=${encodeURIComponent(U)}`,r,{method:"DELETE"}),y()}return u.jsxs("div",{className:"nc-files",children:[u.jsxs("header",{children:[u.jsx("b",{children:t?`${t}:${e}`:e}),u.jsx("button",{onClick:a,title:k("close"),children:u.jsx(Fe,{name:"x",size:20})})]}),u.jsxs("nav",{children:[u.jsx("button",{className:f==="outbox"?"on":"",onClick:()=>m("outbox"),children:"outbox"}),u.jsx("button",{className:f==="inbox"?"on":"",onClick:()=>m("inbox"),children:"inbox"}),u.jsxs("button",{className:"up",onClick:()=>v.current&&v.current.click(),children:[u.jsx(Fe,{name:"upload",size:18})," ",k("upload")]}),u.jsx("input",{type:"file",multiple:!0,ref:v,style:{display:"none"},onChange:U=>{x(Array.from(U.target.files||[])),U.target.value=""}})]}),g&&u.jsx("div",{className:"nc-busy",children:g}),u.jsxs("ul",{children:[p[f].map(U=>u.jsxs("li",{children:[u.jsx("span",{className:"name",onClick:()=>E(U.name),children:U.name}),u.jsx("small",{children:H1(U.size)}),u.jsx("button",{onClick:()=>F(U.name),title:"elimina",children:u.jsx(Fe,{name:"trash",size:18})})]},U.name)),p[f].length===0&&u.jsx("li",{className:"empty",children:k("empty-files")})]})]})}const W1="\r";function $1(e){let t=e.length;for(;t>0;){const r=e.charCodeAt(t-1);if(r===10||r===13)t-=1;else break}return e.slice(0,t)}function bg({send:e,token:t,session:r,node:n}){Yt();const a=n?`/api/route/${String(n).split("/").map(encodeURIComponent).join("/")}/_`:"/api",[l,h]=I.useState(""),[f,m]=I.useState(!1),[p,S]=I.useState(""),[g,C]=I.useState(!1),v=I.useRef(null),y=I.useRef(null),x=I.useRef(null),[E,F]=I.useState(!1),[U,M]=I.useState({left:0,bottom:0}),[L,G]=I.useState(!1),$=I.useRef(null),A=I.useRef(null),K=I.useRef(null),P=I.useRef(null),N=I.useRef(null),W=I.useRef(`nc-attach-${Math.random().toString(36).slice(2,8)}`);I.useEffect(()=>{let R=!1;if(n){C(!1);return}return wt(`${a}/voice/status`,t).then(T=>T.json()).then(T=>{R||C(!!T.serverSttConfigured)}).catch(()=>{R||C(!1)}),()=>{R=!0}},[t,a]);const j=!!(typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)||g);function B(){const R=$1(l);R&&(e(R),e(W1),h(""),requestAnimationFrame(()=>{var T;return(T=x.current)==null?void 0:T.focus({preventScroll:!0})}))}function V(){const R=$.current&&$.current.getBoundingClientRect();R&&M({left:Math.max(6,Math.min(R.left,window.innerWidth-186)),bottom:window.innerHeight-R.top+6}),F(!0)}function Q(R){F(!1),R&&$.current&&$.current.focus()}I.useEffect(()=>{if(!E)return;const R=ne=>{ne.key==="Escape"&&Q(!0)},T=ne=>{const ce=A.current&&A.current.contains(ne.target),ue=$.current&&$.current.contains(ne.target);!ce&&!ue&&Q(!1)};return document.addEventListener("keydown",R),document.addEventListener("pointerdown",T),()=>{document.removeEventListener("keydown",R),document.removeEventListener("pointerdown",T)}},[E]);function ee(R){Q(!1),R.current&&R.current.click()}async function b(R){if(!R.length||!r)return;G(!0),S("");const T=[];for(const ne of R)try{const ce=new FormData;ce.append("session",r),ce.append("paste","false"),ce.append("file",ne,ne.name);const ge=await(await wt(`${a}/files/upload`,t,{method:"POST",body:ce})).json();if(ge.error){S(ge.error);break}T.push(ge.path)}catch(ce){S(String(ce));break}T.length&&h(ne=>ne+(ne&&!ne.endsWith(" ")?" ":"")+T.join(" ")),G(!1)}function Z(){v.current&&v.current.stop(),y.current&&y.current.stop(),m(!1)}async function te(){S("");const R=window.SpeechRecognition||window.webkitSpeechRecognition;if(R){const T=new R;T.lang="it-IT",T.continuous=!1,T.interimResults=!0;const ne=l?`${l} `:"";T.onresult=ce=>{const ue=Array.from(ce.results).map(ge=>ge[0].transcript).join("");h(ne+ue)},T.onend=()=>m(!1),T.onerror=ce=>{S(`voice: ${ce.error||"errore"}`),m(!1)},v.current=T,T.start(),m(!0);return}try{const T=await navigator.mediaDevices.getUserMedia({audio:!0}),ne=new MediaRecorder(T),ce=[];ne.ondataavailable=ue=>ce.push(ue.data),ne.onstop=async()=>{T.getTracks().forEach(ue=>ue.stop()),m(!1),S("trascrivo…");try{const ue=new Blob(ce,{type:ne.mimeType||"audio/webm"}),Ce=await(await wt(`${a}/voice/transcribe`,t,{method:"POST",headers:{"content-type":"application/octet-stream"},body:ue})).json();Ce.error?S(Ce.error):(S(""),h(be=>be+(be?" ":"")+(Ce.text||"")))}catch(ue){S(String(ue))}},y.current={stop:()=>ne.state!=="inactive"&&ne.stop()},ne.start(),m(!0)}catch{S("microfono non disponibile"),m(!1)}}return u.jsxs("div",{className:"nc-composer",children:[p&&u.jsx("div",{className:"nc-composer-err",children:p}),u.jsxs("div",{className:"nc-composer-row",children:[r&&u.jsx("button",{ref:$,className:L?"attach busy":"attach",disabled:L,onClick:()=>E?Q(!1):V(),title:k(L?"attach-uploading":"attach"),"aria-label":k("attach"),"aria-haspopup":"menu","aria-expanded":E,"aria-controls":W.current,children:u.jsx(Fe,{name:"attach",size:22})}),E&&u.jsxs("div",{ref:A,id:W.current,role:"menu",className:"nc-attach-menu",style:{left:U.left,bottom:U.bottom},children:[u.jsxs("button",{role:"menuitem",onClick:()=>ee(K),children:[u.jsx(Fe,{name:"file",size:18})," ",k("attach-file")]}),u.jsxs("button",{role:"menuitem",onClick:()=>ee(P),children:[u.jsx(Fe,{name:"camera",size:18})," ",k("attach-camera")]}),u.jsxs("button",{role:"menuitem",onClick:()=>ee(N),children:[u.jsx(Fe,{name:"image",size:18})," ",k("attach-gallery")]})]}),u.jsx("input",{ref:K,type:"file",multiple:!0,hidden:!0,onChange:R=>{b(Array.from(R.target.files||[])),R.target.value=""}}),u.jsx("input",{ref:P,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:R=>{b(Array.from(R.target.files||[])),R.target.value=""}}),u.jsx("input",{ref:N,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:R=>{b(Array.from(R.target.files||[])),R.target.value=""}}),u.jsx("textarea",{ref:x,rows:2,value:l,placeholder:k("composer-placeholder"),onChange:R=>h(R.target.value)}),j&&u.jsx("button",{className:f?"mic on":"mic",onClick:f?Z:te,title:k("voice"),children:u.jsx(Fe,{name:"mic",size:22})}),u.jsx("button",{type:"button",className:"go",onPointerDown:R=>R.preventDefault(),onClick:B,title:k("send"),children:u.jsx(Fe,{name:"enter",size:22})})]})]})}function ya(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 km(e){return String(e||"?").replace(/^[^a-zA-Z0-9]+/,"").charAt(0).toUpperCase()||"?"}const U1=180,K1=480;function zc(e){return e.status==="down"?e.downSince?k("tunnel-down-since").replace("{t}",ya(e.downSince)):k("tunnel-down"):e.status==="unreachable"?k("node-unreachable"):e.status==="offline"?e.lastSeen?k("node-offline-seen").replace("{t}",ya(e.lastSeen)):k("node-offline"):e.status==="needs-repair"?k("node-needs-repair"):""}function V1(e){return e?e.status==="healthy"?"on":"warn":null}function Em(e){return e&&(e.detail||e.status)||""}function q1({sessions:e=[],cells:t=[],activeSessions:r=[],nodeGroups:n=[],onPick:a,onAddTile:l,onPower:h,onNodePower:f,onKill:m,onNew:p,onSettings:S,width:g=240,collapsed:C=!1,onResize:v,onToggleCollapse:y}){const[x,E]=Yt(),[F,U]=I.useState(x_),M=b=>U(Z=>k_(Z,b)),L=new Set((t||[]).map(b=>b.tmuxSession)),G=new Map((e||[]).map(b=>[b.name,b])),$=(b,Z)=>bn(F,b,Z),A=uh,K=[...t||[]].sort((b,Z)=>A($(b.tmuxSession,(G.get(b.tmuxSession)||{}).activity),$(Z.tmuxSession,(G.get(Z.tmuxSession)||{}).activity))),P=(e||[]).filter(b=>!L.has(b.name)).sort((b,Z)=>A($(b.name,b.activity),$(Z.name,Z.activity))||b.name.localeCompare(Z.name)),N=new Set(r||[]),[W,O]=I.useState(null),j=(b,Z)=>{const te=b.currentTarget.getBoundingClientRect();O({text:Z,y:te.top+te.height/2})},B=()=>O(null),V=I.useRef(null);I.useEffect(()=>()=>{V.current&&V.current()},[]);function Q(b){b.preventDefault(),b.stopPropagation();const Z=b.clientX,te=g,R=ne=>{const ce=Math.max(U1,Math.min(K1,te+(ne.clientX-Z)));v&&v(ce)},T=()=>{window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T),window.removeEventListener("blur",T),V.current=null};window.addEventListener("pointermove",R),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T),window.addEventListener("blur",T),V.current=T}const ee=C?{width:48,flex:"0 0 48px"}:{width:g,flex:`0 0 ${g}px`};return C?u.jsxs("aside",{className:"nc-sidebar mini",style:ee,children:[u.jsx("div",{className:"nc-side-head mini",children:u.jsx("button",{className:"nc-collapse-btn",onClick:y,title:k("expand"),children:"⟩"})}),u.jsxs("div",{className:"nc-side-group mini",children:[K.map(b=>{const Z=b.degraded?"warn":b.tmux?"on":"",te=!!b.tmux;return u.jsx("button",{type:"button",className:`nc-mini-dot${N.has(b.tmuxSession)?" active":""}`,onMouseEnter:R=>j(R,b.cell),onMouseLeave:B,draggable:te,onDragStart:te?R=>R.dataTransfer.setData("text/nc-session",b.tmuxSession):void 0,onClick:te?()=>l&&l(b.tmuxSession):()=>h&&h(b),onDoubleClick:te?()=>a&&a(b.tmuxSession):void 0,children:u.jsx("span",{className:`nc-dot ${Z}`})},b.cell)}),P.map(b=>u.jsx("button",{type:"button",className:`nc-mini-init${N.has(b.name)?" active":""}`,onMouseEnter:Z=>j(Z,b.name),onMouseLeave:B,draggable:!0,onDragStart:Z=>Z.dataTransfer.setData("text/nc-session",b.name),onClick:()=>l&&l(b.name),onDoubleClick:()=>a&&a(b.name),children:km(b.name)},b.name)),(n||[]).flatMap(b=>b.status==="up"?b.sessions.map(Z=>u.jsx("button",{type:"button",className:`nc-mini-init${N.has(Z.key)?" active":""}`,onMouseEnter:te=>j(te,Z.key),onMouseLeave:B,draggable:!0,onDragStart:te=>te.dataTransfer.setData("text/nc-session",Z.key),onClick:()=>l&&l(Z.key),onDoubleClick:()=>a&&a({session:Z.name,node:Z.node}),children:km(Z.name)},Z.key)):[u.jsx("button",{type:"button",className:"nc-mini-dot",onMouseEnter:Z=>j(Z,`${b.label||(b.route||[b.name]).join(" › ")}: ${zc(b)}`),onMouseLeave:B,children:u.jsx("span",{className:"nc-dot warn"})},`nodo-${(b.route||[b.name]).join("/")}`)])]}),u.jsx("button",{className:"nc-side-gear mini",onClick:S,title:k("settings"),onMouseEnter:b=>j(b,k("settings")),onMouseLeave:B,children:u.jsx(Fe,{name:"gear",size:16})}),W&&u.jsx("div",{className:"nc-mini-tip",style:{top:W.y},children:W.text})]}):u.jsxs("aside",{className:"nc-sidebar",style:ee,children:[u.jsxs("div",{className:"nc-side-head",children:[u.jsx("button",{className:"nc-collapse-btn",onClick:y,title:k("collapse"),children:"⟨"}),u.jsx("span",{className:"nc-side-title",children:k("fleet")}),u.jsxs("button",{className:"nc-new-btn",onClick:p,title:k("new-session"),children:["+ ",k("new")]})]}),(t||[]).length>0&&u.jsx("div",{className:"nc-side-group",children:K.map(b=>{const Z=b.degraded?"warn":b.tmux?"on":"",te=b.degraded?k("cell-degraded"):b.tmux?k("cell-on"):k("cell-off"),R=!!b.tmux;return u.jsxs("div",{className:`nc-cell${R?" live":""}${N.has(b.tmuxSession)?" active":""}`,title:te,draggable:R,onDragStart:R?T=>T.dataTransfer.setData("text/nc-session",b.tmuxSession):void 0,onClick:R?()=>l&&l(b.tmuxSession):void 0,onDoubleClick:R?()=>a&&a(b.tmuxSession):void 0,children:[u.jsx("span",{className:`nc-dot ${Z}`}),u.jsxs("span",{className:"nc-cell-main",children:[u.jsx("b",{children:b.cell}),u.jsxs("small",{children:[b.engine,b.key?`·${b.key}`:""]})]}),u.jsx("button",{className:`nc-pin${F.includes(b.tmuxSession)?" on":""}`,title:k("pin"),onClick:T=>{T.stopPropagation(),M(b.tmuxSession)},children:F.includes(b.tmuxSession)?"★":"☆"}),u.jsx("button",{className:`nc-power${b.tmux?" on":""}${b.degraded?" warn":""}`,onClick:T=>{T.stopPropagation(),h&&h(b)},title:b.active?k("power-off"):k("power-on"),children:u.jsx(Fe,{name:"power",size:14})})]},b.cell)})}),u.jsxs("button",{className:"nc-side-gear",onClick:S,title:k("settings"),children:[u.jsx(Fe,{name:"gear",size:15})," ",k("settings")]}),u.jsx("div",{className:"nc-side-group-title",children:k("other-sessions")}),u.jsxs("div",{className:"nc-side-group",children:[P.map(b=>u.jsxs("div",{className:`nc-side-card${N.has(b.name)?" active":""}`,draggable:!0,onDragStart:Z=>Z.dataTransfer.setData("text/nc-session",b.name),onClick:()=>l&&l(b.name),onDoubleClick:()=>a&&a(b.name),children:[u.jsx("span",{className:b.attached?"nc-dot on":"nc-dot"}),u.jsxs("span",{className:"nc-card-main",children:[u.jsx("b",{children:b.name}),u.jsxs("small",{children:[b.preview?b.preview:b.cmd?b.cmd:k("windows").replace("{n}",String(b.windows||0)),b.outbox&&b.outbox.count>0?` · 📦${b.outbox.count}`:""]})]}),b.activity?u.jsx("span",{className:"nc-rel",children:ya(b.activity)}):null,u.jsx("button",{className:`nc-pin${F.includes(b.name)?" on":""}`,title:k("pin"),onClick:Z=>{Z.stopPropagation(),M(b.name)},children:F.includes(b.name)?"★":"☆"}),u.jsx("button",{className:"nc-menu",title:k("terminate"),onClick:Z=>{Z.stopPropagation(),window.confirm(k("terminate-confirm").replace("{name}",b.name))&&m&&m(b.name)},children:"⋯"})]},b.name)),P.length===0&&u.jsx("div",{className:"nc-empty",children:k("no-sessions-short")})]}),(n||[]).map(b=>{const te=V1(b.health)||(b.status==="up"?"on":"warn"),R=(b.route||[b.name]).join("/");return u.jsxs("div",{children:[u.jsxs("div",{className:"nc-side-group-title nc-node-title",children:[u.jsx("span",{className:`nc-dot ${te}`,title:b.health?Em(b.health):""}),u.jsx("b",{children:b.label||b.name}),u.jsxs("small",{children:[" · ",b.status==="up"?k("node-sessions").replace("{n}",String((b.cells||[]).length+(b.unmanaged||[]).length)):b.health&&Em(b.health)||zc(b)]}),b.direct&&b.health&&b.health.managed!==!1&&u.jsx("button",{type:"button",className:`nc-power${b.tunnelStatus==="up"?" on":""}`,title:b.tunnelStatus==="up"?k("power-off"):k("power-on"),onClick:()=>f&&f(b),children:u.jsx(Fe,{name:"power",size:14})})]}),b.status==="up"&&u.jsxs("div",{className:"nc-side-group",children:[(b.cells||[]).map(T=>{const ne=!!T.tmux,ce=T.degraded?"warn":T.tmux?"on":"";return u.jsxs("div",{className:`nc-side-card nc-cell${ne?" live":""}${N.has(T.key)?" active":""}`,title:T.active?k("cell-on"):k("cell-off"),draggable:ne,onDragStart:ne?ue=>ue.dataTransfer.setData("text/nc-session",T.key):void 0,onClick:ne?()=>l&&l(T.key):void 0,onDoubleClick:ne?()=>a&&a({session:T.tmuxSession,node:R}):void 0,children:[u.jsx("span",{className:`nc-dot ${ce}`}),u.jsxs("span",{className:"nc-card-main",children:[u.jsx("b",{children:T.cell}),u.jsxs("small",{children:[T.engine,T.key?`·${T.key}`:"",T.active?"":` · ${k("cell-off")}`]})]}),(b.capabilities||[]).includes(T.active?"down":"up")&&u.jsx("button",{className:`nc-power${T.active?" on":""}${T.degraded?" warn":""}`,onClick:ue=>{ue.stopPropagation(),h&&h({...T,route:b.route,availableEngines:b.engines||[]})},title:T.active?k("power-off"):k("power-on"),children:u.jsx(Fe,{name:"power",size:14})})]},T.key)}),(b.unmanaged||[]).map(T=>u.jsxs("div",{className:`nc-side-card${N.has(T.key)?" active":""}`,draggable:!0,onDragStart:ne=>ne.dataTransfer.setData("text/nc-session",T.key),onClick:()=>l&&l(T.key),onDoubleClick:()=>a&&a({session:T.name,node:T.node}),children:[u.jsx("span",{className:T.attached?"nc-dot on":"nc-dot"}),u.jsxs("span",{className:"nc-card-main",children:[u.jsx("b",{children:T.name}),u.jsx("small",{children:T.preview?T.preview:T.cmd?T.cmd:k("windows").replace("{n}",String(T.windows||0))})]}),T.activity?u.jsx("span",{className:"nc-rel",children:ya(T.activity)}):null,u.jsx("button",{className:"nc-menu",title:k("terminate"),onClick:ne=>{ne.stopPropagation(),window.confirm(k("terminate-confirm").replace("{name}",T.name))&&m&&m(T.name,b.route)},children:"⋯"})]},T.key)),(b.cells||[]).length===0&&(b.unmanaged||[]).length===0&&u.jsx("div",{className:"nc-empty",children:k("no-sessions-short")})]})]},`nodo-${(b.route||[b.name]).join("/")}`)}),u.jsx("div",{className:"nc-side-lang",children:R_.map((b,Z)=>u.jsxs("span",{children:[Z>0&&" · ",u.jsx("button",{className:`nc-lang-btn${x===b?" on":""}`,onClick:()=>E(b),title:b,children:b.toUpperCase()})]},b))}),u.jsx("div",{className:"nc-side-resize",onPointerDown:Q,title:""})]})}const Cu=9,Sa=.2,Y1=/^[a-z0-9-]{1,32}(?:\/[a-z0-9-]{1,32}){0,3}$/,Qh=e=>Y1.test(e)&&new Set(e.split("/")).size===e.split("/").length;function wa(e){if(typeof e=="string"&&e){const t=e.indexOf(":");if(t<0)return{session:e};const r=e.slice(0,t),n=e.slice(t+1);return!Qh(r)||!n?null:{session:n,node:r}}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"&&Qh(e.node)?{session:e.session,node:e.node}:null:null}function zi(e){const t=wa(e);return t?t.node?`${t.node}:${t.session}`:t.session:""}const xg=9,kg=24,Da=11,X1=e=>{const t=Number(e);return t>=xg&&t<=kg?t:Da};function Ca(){return{columns:[]}}function Gi(e){return e.columns.flatMap(t=>t.tiles.map(r=>zi(r)))}const zn=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(r=>({...r}))}))});function ba(e,t,r,n){const a=wa(t);if(!a||Gi(e).includes(zi(a))||Gi(e).length>=Cu)return e;const l=zn(e),h={session:a.session,height:1,fontSize:Da,...n||{}};if(a.node&&(h.node=a.node),r==="end")return l.columns.push({width:1,tiles:[h]}),l;if(r&&typeof r.col=="number"&&typeof r.row=="number"&&l.columns[r.col])return l.columns[r.col].tiles.splice(r.row,0,h),l;if(r&&typeof r.col=="number"){const f=Math.max(0,Math.min(l.columns.length,r.col));return l.columns.splice(f,0,{width:1,tiles:[h]}),l}return l.columns.push({width:1,tiles:[h]}),l}function Eg(e,t){const r=zi(t);if(!r||Gi(e).includes(r)||Gi(e).length>=Cu)return e;const n=Gi(e).length+1,a=Math.ceil(Math.sqrt(n));if(e.columns.length<a)return ba(e,t,"end");let l=0;for(let h=1;h<e.columns.length;h+=1)e.columns[h].tiles.length<e.columns[l].tiles.length&&(l=h);return ba(e,t,{col:l,row:e.columns[l].tiles.length})}function xa(e,t){const r=zi(t),n=zn(e);for(const a of n.columns)a.tiles=a.tiles.filter(l=>zi(l)!==r);return n.columns=n.columns.filter(a=>a.tiles.length>0),n}function G1(e,t,r){const n=zi(t);if(!Gi(e).includes(n))return e;const a=e.columns.flatMap(l=>l.tiles).find(l=>zi(l)===n);return ba(xa(e,n),n,r,{fontSize:a.fontSize})}function Q1(e,t,r){const n=zn(e);return n.columns[t]&&(n.columns[t].width=Math.max(Sa,Number(r)||1)),n}function J1(e,t,r,n){const a=zn(e),l=a.columns[t]&&a.columns[t].tiles[r];return l&&(l.height=Math.max(Sa,Number(n)||1)),a}function Z1(e,t,r,n){if(!(e.columns[t]&&e.columns[t].tiles[r]))return e;const l=zn(e),h=l.columns[t].tiles[r],f=Number(h.fontSize)||Da;return h.fontSize=Math.max(xg,Math.min(kg,f+(Number(n)||0))),l}function eC(e,t,r,n){const a=e.columns[t];if(!a||!a.tiles[r])return null;switch(n){case"left":return{col:t};case"right":return{col:t+1};case"top":return{col:t,row:r};case"bottom":return{col:t,row:r+1};default:return null}}function Nm(e){for(const t of[.25,.5,.75])if(Math.abs(e-t)<=.03)return t;return e}function Ur(e){if(!e||!Array.isArray(e.columns))return Ca();const t=e.columns.map(n=>({width:Math.max(Sa,Number(n&&n.width)||1),tiles:(Array.isArray(n&&n.tiles)?n.tiles:[]).filter(a=>a&&typeof a.session=="string"&&a.session).filter(a=>a.node==null||typeof a.node=="string"&&Qh(a.node)).map(a=>{const l={session:a.session,height:Math.max(Sa,Number(a.height)||1),fontSize:X1(a.fontSize)};return a.node!=null&&(l.node=a.node),l})})).filter(n=>n.tiles.length>0),r=new Set;for(const n of t)n.tiles=n.tiles.filter(a=>!r.has(zi(a))&&r.add(zi(a))&&r.size<=Cu);return{columns:t.filter(n=>n.tiles.length>0)}}function tC({session:e,node:t,token:r,readonly:n=!1,focused:a,onFocus:l,onClose:h,onOpenSingle:f,alive:m=!0,fontSize:p=Da,onZoom:S,decks:g=[],currentDeck:C,onSendToDeck:v}){const y=I.useRef(()=>{}),x=I.useRef(()=>{}),E=I.useRef(!1),[F,U]=I.useState(!1),[M,L]=I.useState(!1),[G,$]=I.useState(!1),[A,K]=I.useState(null),P=t?`${t}:${e}`:e;return u.jsxs("div",{className:`nc-tile${a?" focused":""}`,onMouseDown:()=>l&&l(P),children:[u.jsxs("div",{className:"nc-tile-head",draggable:!0,onDragStart:N=>{N.dataTransfer.setData("text/nc-session",P),N.dataTransfer.effectAllowed="move"},children:[u.jsxs("button",{className:"nc-tile-name",onClick:()=>l&&l(P),children:[u.jsx("span",{className:m?"nc-dot on":"nc-dot"}),u.jsx("b",{children:e}),t&&u.jsxs("small",{className:"nc-tile-node",children:["@",t]})]}),u.jsxs("span",{className:"nc-tile-actions",children:[S&&u.jsx("button",{onClick:()=>S(-1),title:k("zoom-out"),children:u.jsx(Fe,{name:"zoomOut",size:14})}),S&&u.jsx("button",{onClick:()=>S(1),title:k("zoom-in"),children:u.jsx(Fe,{name:"zoomIn",size:14})}),v&&g.filter(N=>N!==C).length>0&&u.jsxs("select",{className:"nc-tile-deck",title:k("send-to-deck"),value:"",onMouseDown:N=>N.stopPropagation(),onChange:N=>{const W=N.target.value;W&&v(P,W),N.target.value=""},children:[u.jsx("option",{value:"",children:k("send-to-deck")}),g.filter(N=>N!==C).map(N=>u.jsx("option",{value:N,children:N},N))]}),u.jsx("button",{onClick:()=>L(N=>!N),title:"composer",children:"⌨"}),u.jsx("button",{onClick:()=>$(N=>!N),title:"file",children:"📁"}),f&&u.jsx("button",{onClick:()=>f({session:e,node:t}),title:"vista singola",children:"↗"}),h&&u.jsx("button",{className:"nc-tile-close",onClick:()=>h(P),title:"chiudi",children:"✕"})]})]}),u.jsxs("div",{className:"nc-tile-body",children:[u.jsx(wg,{session:e,node:t,token:r,readonly:n,takeSize:!1,focused:a,sendRef:y,actionRef:x,ctrlRef:E,setCtrlArmed:U,onFiles:K,fontSize:p}),G&&u.jsx("div",{className:"nc-tile-files",onMouseDown:N=>N.stopPropagation(),children:u.jsx(Cg,{session:e,node:t,token:r,filesEvent:A,onClose:()=>$(!1)})})]}),M&&u.jsx("div",{className:"nc-tile-composer",onMouseDown:N=>N.stopPropagation(),children:u.jsx(bg,{send:N=>y.current(N),token:r,session:e,node:t})})]})}const Rm=.2,Dm=.28;function iC(e,t,r){const n=(e-r.left)/(r.width||1),a=(t-r.top)/(r.height||1);return n<Dm?"left":n>1-Dm?"right":a<.5?"top":"bottom"}function rC({layout:e,onLayoutChange:t,token:r,readonly:n=!1,sessionsAlive:a,focusSession:l,onFocus:h,onOpenSingle:f,decks:m=[],currentDeck:p,onSendToDeck:S}){Yt();const[g,C]=I.useState(null),v=I.useRef(null),y=I.useRef([]),x=I.useRef(null);function E(P,N){const W=()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",W),window.removeEventListener("pointercancel",W),window.removeEventListener("blur",W),x.current=null};window.addEventListener("pointermove",P),window.addEventListener("pointerup",W),window.addEventListener("pointercancel",W),window.addEventListener("blur",W),x.current=W}I.useEffect(()=>()=>{x.current&&x.current()},[]),I.useEffect(()=>{const P=()=>C(null);return window.addEventListener("dragend",P),window.addEventListener("drop",P),()=>{window.removeEventListener("dragend",P),window.removeEventListener("drop",P)}},[]);const F=e.columns.length,U=P=>g&&g.col===P&&g.row===void 0,M=!!g&&g.col===F,L=(P,N)=>g&&g.col===P&&g.row===N&&g.quadrant?` drop-${g.quadrant}`:"";function G(P){P.preventDefault();const N=P.dataTransfer.getData("text/nc-session"),W=g;if(C(null),!N||!W)return;let O;if(W.quadrant){if(O=eC(e,W.col,W.row,W.quadrant),!O)return}else O={col:W.col};t(Gi(e).includes(N)?G1(e,N,O):ba(e,N,O))}function $(P,N){P.preventDefault(),P.stopPropagation();const W=P.clientX,O=e.columns[N].width,j=v.current&&v.current.clientWidth||1,B=e.columns[N+1];E(Q=>{let ee=Math.max(Rm,O+(Q.clientX-W)/j);if(B){const b=Nm(ee/(ee+B.width));ee=b/(1-b)*B.width}t(Q1(e,N,ee))})}function A(P,N,W){P.preventDefault(),P.stopPropagation();const O=P.clientY,j=e.columns[N].tiles[W].height,B=y.current[N],V=B&&B.clientHeight||1,Q=e.columns[N].tiles[W+1];E(b=>{let Z=Math.max(Rm,j+(b.clientY-O)/V);if(Q){const te=Nm(Z/(Z+Q.height));Z=te/(1-te)*Q.height}t(J1(e,N,W,Z))})}function K(P){t(xa(e,P))}return u.jsxs("div",{className:"nc-grid",ref:v,onDragOver:P=>{P.preventDefault(),g&&g.col===F||C({col:F})},onDrop:G,onDragLeave:P=>{const N=P.relatedTarget;(!N||!(v.current&&v.current.contains(N)))&&C(null)},children:[e.columns.flatMap((P,N)=>{const W=[];return W.push(u.jsx("div",{className:`nc-col${U(N)?" drop-newcol":""}`,ref:O=>{y.current[N]=O},style:{flexGrow:P.width,flexBasis:0},onDragOver:O=>{O.preventDefault(),O.stopPropagation(),g&&g.col===N&&g.row===void 0||C({col:N})},children:P.tiles.flatMap((O,j)=>{const B=[],V=zi(O);return B.push(u.jsx("div",{className:`nc-tile-slot${L(N,j)}`,style:{flexGrow:O.height,flexBasis:0},onDragOver:Q=>{Q.preventDefault(),Q.stopPropagation();const ee=iC(Q.clientX,Q.clientY,Q.currentTarget.getBoundingClientRect());g&&g.col===N&&g.row===j&&g.quadrant===ee||C({col:N,row:j,quadrant:ee})},children:u.jsx(tC,{session:O.session,node:O.node,token:r,readonly:n,focused:l===V,onFocus:h,onClose:K,onOpenSingle:f,alive:!a||a.has(V),fontSize:O.fontSize,onZoom:Q=>t(Z1(e,N,j,Q)),decks:m,currentDeck:p,onSendToDeck:S})},V)),j<P.tiles.length-1&&B.push(u.jsx("div",{className:"nc-divider-h",onPointerDown:Q=>A(Q,N,j)},`h${j}`)),B})},`c${N}`)),N<F-1&&W.push(u.jsx("div",{className:"nc-divider-v",onPointerDown:O=>$(O,N)},`v${N}`)),W}),M&&u.jsx("div",{className:"nc-drop-line-v nc-drop-line-end"}),F===0&&u.jsx("div",{className:"nc-grid-empty",children:k("grid-empty")})]})}const sC=/^[a-z0-9-]{1,32}$/,ti="main",Ng="nc_decks",nC=24;function oC(e){return typeof e!="string"?"":e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").slice(0,32).replace(/-+$/,"")}function bu(e){return typeof e=="string"&&sC.test(e)}function aC(e){const t=String(e||"").match(/^\/deck\/([^/]+)\/?$/);if(t){let r;try{r=decodeURIComponent(t[1])}catch{r=t[1]}return bu(r)?r:ti}return ti}function sa(e,t){const r=e===ti?"/":`/deck/${encodeURIComponent(e)}`;return t?`${r}#token=${encodeURIComponent(t)}`:r}function Rg(e){return e===ti?"nc_grid_v1":`nc_grid_v1__${e}`}function Dg(e){const t=[ti];if(Array.isArray(e)){for(const r of e)if(bu(r)&&r!==ti&&!t.includes(r)&&t.push(r),t.length>=nC)break}return t}function Ma(){return typeof localStorage<"u"?localStorage:null}function lC(){const e=Ma();if(!e)return[ti];try{return Dg(JSON.parse(e.getItem(Ng)||"null"))}catch{return[ti]}}function cC(e){const t=Ma();if(t)try{t.setItem(Ng,JSON.stringify(Dg(e)))}catch{}}function Jh(e){const t=Ma();if(!t)return null;try{return JSON.parse(t.getItem(Rg(e))||"null")}catch{return null}}function hC(e,t){const r=Ma();if(r)try{r.setItem(Rg(e),JSON.stringify(t))}catch{}}function uC({decks:e=[],currentDeck:t=ti,onCreate:r,onRename:n,onDelete:a,onOpenWindow:l,onNavigate:h,saveState:f="idle",error:m=""}){Yt();const[p,S]=I.useState(!1),[g,C]=I.useState(""),[v,y]=I.useState(!1),[x,E]=I.useState(""),[F,U]=I.useState(""),M=oC(g),L=bu(M),G=async()=>{if(L){y(!0),E("");try{r&&await r(M),C(""),S(!1)}catch(A){E(String(A.message||A))}y(!1)}},$=A=>{U(""),l&&l(A)||U(A)};return u.jsxs("div",{className:"nc-deckbar",children:[u.jsx("span",{className:"nc-deckbar-label",children:k("decks")}),u.jsx("div",{className:"nc-deck-chips",children:e.map(A=>u.jsxs("span",{className:`nc-deck-chip${A===t?" current":""}`,children:[u.jsxs("button",{className:"nc-deck-open",title:A===t?k("deck-current"):A,onClick:()=>A!==t&&h&&h(A),children:[A,A===t?" •":""]}),u.jsx("button",{className:"nc-deck-mini",title:k("open-deck-window"),onClick:()=>$(A),children:"↗"}),A!==ti&&u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"nc-deck-mini",title:k("rename-deck"),onClick:()=>{const P=((typeof window<"u"?window.prompt(k("rename-deck"),A):"")||"").trim();P&&P!==A&&n&&n(A,P).catch(N=>E(String(N.message||N)))},children:"✎"}),u.jsx("button",{className:"nc-deck-mini nc-deck-del",title:k("delete-deck"),onClick:()=>{(typeof window>"u"||window.confirm(k("delete-deck-confirm").replace("{name}",A)))&&a&&a(A).catch(K=>E(String(K.message||K)))},children:"✕"})]})]},A))}),p?u.jsxs("span",{className:"nc-deck-add",children:[u.jsx("input",{autoFocus:!0,className:L||!g?"":"invalid",placeholder:k("deck-name"),value:g,onChange:A=>C(A.target.value),onKeyDown:A=>{A.key==="Enter"&&G(),A.key==="Escape"&&(C(""),S(!1))}}),g&&L&&M!==g&&u.jsxs("span",{className:"nc-deck-slug",children:["→ ",M]}),u.jsx("button",{className:"nc-deck-ok",disabled:!L||v,onClick:G,children:k("create")}),u.jsx("button",{className:"nc-deck-cancel",onClick:()=>{C(""),S(!1)},children:k("cancel")})]}):u.jsxs("button",{className:"nc-deck-newbtn",title:k("new-deck"),onClick:()=>S(!0),children:["+ ",k("new-deck")]}),u.jsx("span",{className:`nc-deck-state ${f}`,title:k("deck-autosave"),children:k(f==="saving"?"saving":f==="saved"?"saved":"deck-autosave")}),(x||m)&&u.jsx("span",{className:"nc-deck-error",children:x||m}),F&&u.jsx("a",{className:"nc-deck-fallback",href:`/deck/${encodeURIComponent(F)}`,target:"_blank",rel:"noreferrer",children:k("popup-blocked")})]})}var xs={},Fc,Mm;function dC(){return Mm||(Mm=1,Fc=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Fc}var Hc={},br={},Lm;function Gr(){if(Lm)return br;Lm=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return br.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},br.getSymbolTotalCodewords=function(n){return t[n]},br.getBCHDigit=function(r){let n=0;for(;r!==0;)n++,r>>>=1;return n},br.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');e=n},br.isKanjiModeEnabled=function(){return typeof e<"u"},br.toSJIS=function(n){return e(n)},br}var Wc={},Pm;function xu(){return Pm||(Pm=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,a){if(e.isValid(n))return n;try{return t(n)}catch{return a}}})(Wc)),Wc}var $c,Tm;function fC(){if(Tm)return $c;Tm=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)===1},put:function(t,r){for(let n=0;n<r;n++)this.putBit((t>>>r-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}},$c=e,$c}var Uc,Bm;function pC(){if(Bm)return Uc;Bm=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,r,n,a){const l=t*this.size+r;this.data[l]=n,a&&(this.reservedBit[l]=!0)},e.prototype.get=function(t,r){return this.data[t*this.size+r]},e.prototype.xor=function(t,r,n){this.data[t*this.size+r]^=n},e.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]},Uc=e,Uc}var Kc={},jm;function mC(){return jm||(jm=1,(function(e){const t=Gr().getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const a=Math.floor(n/7)+2,l=t(n),h=l===145?26:Math.ceil((l-13)/(2*a-2))*2,f=[l-7];for(let m=1;m<a-1;m++)f[m]=f[m-1]-h;return f.push(6),f.reverse()},e.getPositions=function(n){const a=[],l=e.getRowColCoords(n),h=l.length;for(let f=0;f<h;f++)for(let m=0;m<h;m++)f===0&&m===0||f===0&&m===h-1||f===h-1&&m===0||a.push([l[f],l[m]]);return a}})(Kc)),Kc}var Vc={},Am;function _C(){if(Am)return Vc;Am=1;const e=Gr().getSymbolSize,t=7;return Vc.getPositions=function(n){const a=e(n);return[[0,0],[a-t,0],[0,a-t]]},Vc}var qc={},Im;function gC(){return Im||(Im=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(a){return a!=null&&a!==""&&!isNaN(a)&&a>=0&&a<=7},e.from=function(a){return e.isValid(a)?parseInt(a,10):void 0},e.getPenaltyN1=function(a){const l=a.size;let h=0,f=0,m=0,p=null,S=null;for(let g=0;g<l;g++){f=m=0,p=S=null;for(let C=0;C<l;C++){let v=a.get(g,C);v===p?f++:(f>=5&&(h+=t.N1+(f-5)),p=v,f=1),v=a.get(C,g),v===S?m++:(m>=5&&(h+=t.N1+(m-5)),S=v,m=1)}f>=5&&(h+=t.N1+(f-5)),m>=5&&(h+=t.N1+(m-5))}return h},e.getPenaltyN2=function(a){const l=a.size;let h=0;for(let f=0;f<l-1;f++)for(let m=0;m<l-1;m++){const p=a.get(f,m)+a.get(f,m+1)+a.get(f+1,m)+a.get(f+1,m+1);(p===4||p===0)&&h++}return h*t.N2},e.getPenaltyN3=function(a){const l=a.size;let h=0,f=0,m=0;for(let p=0;p<l;p++){f=m=0;for(let S=0;S<l;S++)f=f<<1&2047|a.get(p,S),S>=10&&(f===1488||f===93)&&h++,m=m<<1&2047|a.get(S,p),S>=10&&(m===1488||m===93)&&h++}return h*t.N3},e.getPenaltyN4=function(a){let l=0;const h=a.data.length;for(let m=0;m<h;m++)l+=a.data[m];return Math.abs(Math.ceil(l*100/h/5)-10)*t.N4};function r(n,a,l){switch(n){case e.Patterns.PATTERN000:return(a+l)%2===0;case e.Patterns.PATTERN001:return a%2===0;case e.Patterns.PATTERN010:return l%3===0;case e.Patterns.PATTERN011:return(a+l)%3===0;case e.Patterns.PATTERN100:return(Math.floor(a/2)+Math.floor(l/3))%2===0;case e.Patterns.PATTERN101:return a*l%2+a*l%3===0;case e.Patterns.PATTERN110:return(a*l%2+a*l%3)%2===0;case e.Patterns.PATTERN111:return(a*l%3+(a+l)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.applyMask=function(a,l){const h=l.size;for(let f=0;f<h;f++)for(let m=0;m<h;m++)l.isReserved(m,f)||l.xor(m,f,r(a,m,f))},e.getBestMask=function(a,l){const h=Object.keys(e.Patterns).length;let f=0,m=1/0;for(let p=0;p<h;p++){l(p),e.applyMask(p,a);const S=e.getPenaltyN1(a)+e.getPenaltyN2(a)+e.getPenaltyN3(a)+e.getPenaltyN4(a);e.applyMask(p,a),S<m&&(m=S,f=p)}return f}})(qc)),qc}var na={},Om;function Mg(){if(Om)return na;Om=1;const e=xu(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return na.getBlocksCount=function(a,l){switch(l){case e.L:return t[(a-1)*4+0];case e.M:return t[(a-1)*4+1];case e.Q:return t[(a-1)*4+2];case e.H:return t[(a-1)*4+3];default:return}},na.getTotalCodewordsCount=function(a,l){switch(l){case e.L:return r[(a-1)*4+0];case e.M:return r[(a-1)*4+1];case e.Q:return r[(a-1)*4+2];case e.H:return r[(a-1)*4+3];default:return}},na}var Yc={},Cn={},zm;function vC(){if(zm)return Cn;zm=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let n=1;for(let a=0;a<255;a++)e[a]=n,t[n]=a,n<<=1,n&256&&(n^=285);for(let a=255;a<512;a++)e[a]=e[a-255]})(),Cn.log=function(n){if(n<1)throw new Error("log("+n+")");return t[n]},Cn.exp=function(n){return e[n]},Cn.mul=function(n,a){return n===0||a===0?0:e[t[n]+t[a]]},Cn}var Fm;function yC(){return Fm||(Fm=1,(function(e){const t=vC();e.mul=function(n,a){const l=new Uint8Array(n.length+a.length-1);for(let h=0;h<n.length;h++)for(let f=0;f<a.length;f++)l[h+f]^=t.mul(n[h],a[f]);return l},e.mod=function(n,a){let l=new Uint8Array(n);for(;l.length-a.length>=0;){const h=l[0];for(let m=0;m<a.length;m++)l[m]^=t.mul(a[m],h);let f=0;for(;f<l.length&&l[f]===0;)f++;l=l.slice(f)}return l},e.generateECPolynomial=function(n){let a=new Uint8Array([1]);for(let l=0;l<n;l++)a=e.mul(a,new Uint8Array([1,t.exp(l)]));return a}})(Yc)),Yc}var Xc,Hm;function SC(){if(Hm)return Xc;Hm=1;const e=yC();function t(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(n){this.degree=n,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const a=new Uint8Array(n.length+this.degree);a.set(n);const l=e.mod(a,this.genPoly),h=this.degree-l.length;if(h>0){const f=new Uint8Array(this.degree);return f.set(l,h),f}return l},Xc=t,Xc}var Gc={},Qc={},Jc={},Wm;function Lg(){return Wm||(Wm=1,Jc.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Jc}var Bi={},$m;function Pg(){if($m)return Bi;$m=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
|
|
82
|
+
]))+`;Bi.KANJI=new RegExp(r,"g"),Bi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Bi.BYTE=new RegExp(n,"g"),Bi.NUMERIC=new RegExp(e,"g"),Bi.ALPHANUMERIC=new RegExp(t,"g");const a=new RegExp("^"+r+"$"),l=new RegExp("^"+e+"$"),h=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Bi.testKanji=function(m){return a.test(m)},Bi.testNumeric=function(m){return l.test(m)},Bi.testAlphanumeric=function(m){return h.test(m)},Bi}var Um;function Qr(){return Um||(Um=1,(function(e){const t=Lg(),r=Pg();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(l,h){if(!l.ccBits)throw new Error("Invalid mode: "+l);if(!t.isValid(h))throw new Error("Invalid version: "+h);return h>=1&&h<10?l.ccBits[0]:h<27?l.ccBits[1]:l.ccBits[2]},e.getBestModeForData=function(l){return r.testNumeric(l)?e.NUMERIC:r.testAlphanumeric(l)?e.ALPHANUMERIC:r.testKanji(l)?e.KANJI:e.BYTE},e.toString=function(l){if(l&&l.id)return l.id;throw new Error("Invalid mode")},e.isValid=function(l){return l&&l.bit&&l.ccBits};function n(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+a)}}e.from=function(l,h){if(e.isValid(l))return l;try{return n(l)}catch{return h}}})(Qc)),Qc}var Km;function wC(){return Km||(Km=1,(function(e){const t=Gr(),r=Mg(),n=xu(),a=Qr(),l=Lg(),h=7973,f=t.getBCHDigit(h);function m(C,v,y){for(let x=1;x<=40;x++)if(v<=e.getCapacity(x,y,C))return x}function p(C,v){return a.getCharCountIndicator(C,v)+4}function S(C,v){let y=0;return C.forEach(function(x){const E=p(x.mode,v);y+=E+x.getBitsLength()}),y}function g(C,v){for(let y=1;y<=40;y++)if(S(C,y)<=e.getCapacity(y,v,a.MIXED))return y}e.from=function(v,y){return l.isValid(v)?parseInt(v,10):y},e.getCapacity=function(v,y,x){if(!l.isValid(v))throw new Error("Invalid QR Code version");typeof x>"u"&&(x=a.BYTE);const E=t.getSymbolTotalCodewords(v),F=r.getTotalCodewordsCount(v,y),U=(E-F)*8;if(x===a.MIXED)return U;const M=U-p(x,v);switch(x){case a.NUMERIC:return Math.floor(M/10*3);case a.ALPHANUMERIC:return Math.floor(M/11*2);case a.KANJI:return Math.floor(M/13);case a.BYTE:default:return Math.floor(M/8)}},e.getBestVersionForData=function(v,y){let x;const E=n.from(y,n.M);if(Array.isArray(v)){if(v.length>1)return g(v,E);if(v.length===0)return 1;x=v[0]}else x=v;return m(x.mode,x.getLength(),E)},e.getEncodedBits=function(v){if(!l.isValid(v)||v<7)throw new Error("Invalid QR Code version");let y=v<<12;for(;t.getBCHDigit(y)-f>=0;)y^=h<<t.getBCHDigit(y)-f;return v<<12|y}})(Gc)),Gc}var Zc={},Vm;function CC(){if(Vm)return Zc;Vm=1;const e=Gr(),t=1335,r=21522,n=e.getBCHDigit(t);return Zc.getEncodedBits=function(l,h){const f=l.bit<<3|h;let m=f<<10;for(;e.getBCHDigit(m)-n>=0;)m^=t<<e.getBCHDigit(m)-n;return(f<<10|m)^r},Zc}var eh={},th,qm;function bC(){if(qm)return th;qm=1;const e=Qr();function t(r){this.mode=e.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){let a,l,h;for(a=0;a+3<=this.data.length;a+=3)l=this.data.substr(a,3),h=parseInt(l,10),n.put(h,10);const f=this.data.length-a;f>0&&(l=this.data.substr(a),h=parseInt(l,10),n.put(h,f*3+1))},th=t,th}var ih,Ym;function xC(){if(Ym)return ih;Ym=1;const e=Qr(),t=["0","1","2","3","4","5","6","7","8","9","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"," ","$","%","*","+","-",".","/",":"];function r(n){this.mode=e.ALPHANUMERIC,this.data=n}return r.getBitsLength=function(a){return 11*Math.floor(a/2)+6*(a%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(a){let l;for(l=0;l+2<=this.data.length;l+=2){let h=t.indexOf(this.data[l])*45;h+=t.indexOf(this.data[l+1]),a.put(h,11)}this.data.length%2&&a.put(t.indexOf(this.data[l]),6)},ih=r,ih}var rh,Xm;function kC(){if(Xm)return rh;Xm=1;const e=Qr();function t(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(n){return n*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let n=0,a=this.data.length;n<a;n++)r.put(this.data[n],8)},rh=t,rh}var sh,Gm;function EC(){if(Gm)return sh;Gm=1;const e=Qr(),t=Gr();function r(n){this.mode=e.KANJI,this.data=n}return r.getBitsLength=function(a){return a*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(n){let a;for(a=0;a<this.data.length;a++){let l=t.toSJIS(this.data[a]);if(l>=33088&&l<=40956)l-=33088;else if(l>=57408&&l<=60351)l-=49472;else throw new Error("Invalid SJIS character: "+this.data[a]+`
|
|
83
|
+
Make sure your charset is UTF-8`);l=(l>>>8&255)*192+(l&255),n.put(l,13)}},sh=r,sh}var nh={exports:{}},Qm;function NC(){return Qm||(Qm=1,(function(e){var t={single_source_shortest_paths:function(r,n,a){var l={},h={};h[n]=0;var f=t.PriorityQueue.make();f.push(n,0);for(var m,p,S,g,C,v,y,x,E;!f.empty();){m=f.pop(),p=m.value,g=m.cost,C=r[p]||{};for(S in C)C.hasOwnProperty(S)&&(v=C[S],y=g+v,x=h[S],E=typeof h[S]>"u",(E||x>y)&&(h[S]=y,f.push(S,y),l[S]=p))}if(typeof a<"u"&&typeof h[a]>"u"){var F=["Could not find a path from ",n," to ",a,"."].join("");throw new Error(F)}return l},extract_shortest_path_from_predecessor_list:function(r,n){for(var a=[],l=n;l;)a.push(l),r[l],l=r[l];return a.reverse(),a},find_path:function(r,n,a){var l=t.single_source_shortest_paths(r,n,a);return t.extract_shortest_path_from_predecessor_list(l,a)},PriorityQueue:{make:function(r){var n=t.PriorityQueue,a={},l;r=r||{};for(l in n)n.hasOwnProperty(l)&&(a[l]=n[l]);return a.queue=[],a.sorter=r.sorter||n.default_sorter,a},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var a={value:r,cost:n};this.queue.push(a),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(nh)),nh.exports}var Jm;function RC(){return Jm||(Jm=1,(function(e){const t=Qr(),r=bC(),n=xC(),a=kC(),l=EC(),h=Pg(),f=Gr(),m=NC();function p(F){return unescape(encodeURIComponent(F)).length}function S(F,U,M){const L=[];let G;for(;(G=F.exec(M))!==null;)L.push({data:G[0],index:G.index,mode:U,length:G[0].length});return L}function g(F){const U=S(h.NUMERIC,t.NUMERIC,F),M=S(h.ALPHANUMERIC,t.ALPHANUMERIC,F);let L,G;return f.isKanjiModeEnabled()?(L=S(h.BYTE,t.BYTE,F),G=S(h.KANJI,t.KANJI,F)):(L=S(h.BYTE_KANJI,t.BYTE,F),G=[]),U.concat(M,L,G).sort(function(A,K){return A.index-K.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function C(F,U){switch(U){case t.NUMERIC:return r.getBitsLength(F);case t.ALPHANUMERIC:return n.getBitsLength(F);case t.KANJI:return l.getBitsLength(F);case t.BYTE:return a.getBitsLength(F)}}function v(F){return F.reduce(function(U,M){const L=U.length-1>=0?U[U.length-1]:null;return L&&L.mode===M.mode?(U[U.length-1].data+=M.data,U):(U.push(M),U)},[])}function y(F){const U=[];for(let M=0;M<F.length;M++){const L=F[M];switch(L.mode){case t.NUMERIC:U.push([L,{data:L.data,mode:t.ALPHANUMERIC,length:L.length},{data:L.data,mode:t.BYTE,length:L.length}]);break;case t.ALPHANUMERIC:U.push([L,{data:L.data,mode:t.BYTE,length:L.length}]);break;case t.KANJI:U.push([L,{data:L.data,mode:t.BYTE,length:p(L.data)}]);break;case t.BYTE:U.push([{data:L.data,mode:t.BYTE,length:p(L.data)}])}}return U}function x(F,U){const M={},L={start:{}};let G=["start"];for(let $=0;$<F.length;$++){const A=F[$],K=[];for(let P=0;P<A.length;P++){const N=A[P],W=""+$+P;K.push(W),M[W]={node:N,lastCount:0},L[W]={};for(let O=0;O<G.length;O++){const j=G[O];M[j]&&M[j].node.mode===N.mode?(L[j][W]=C(M[j].lastCount+N.length,N.mode)-C(M[j].lastCount,N.mode),M[j].lastCount+=N.length):(M[j]&&(M[j].lastCount=N.length),L[j][W]=C(N.length,N.mode)+4+t.getCharCountIndicator(N.mode,U))}}G=K}for(let $=0;$<G.length;$++)L[G[$]].end=0;return{map:L,table:M}}function E(F,U){let M;const L=t.getBestModeForData(F);if(M=t.from(U,L),M!==t.BYTE&&M.bit<L.bit)throw new Error('"'+F+'" cannot be encoded with mode '+t.toString(M)+`.
|
|
84
|
+
Suggested mode is: `+t.toString(L));switch(M===t.KANJI&&!f.isKanjiModeEnabled()&&(M=t.BYTE),M){case t.NUMERIC:return new r(F);case t.ALPHANUMERIC:return new n(F);case t.KANJI:return new l(F);case t.BYTE:return new a(F)}}e.fromArray=function(U){return U.reduce(function(M,L){return typeof L=="string"?M.push(E(L,null)):L.data&&M.push(E(L.data,L.mode)),M},[])},e.fromString=function(U,M){const L=g(U,f.isKanjiModeEnabled()),G=y(L),$=x(G,M),A=m.find_path($.map,"start","end"),K=[];for(let P=1;P<A.length-1;P++)K.push($.table[A[P]].node);return e.fromArray(v(K))},e.rawSplit=function(U){return e.fromArray(g(U,f.isKanjiModeEnabled()))}})(eh)),eh}var Zm;function DC(){if(Zm)return Hc;Zm=1;const e=Gr(),t=xu(),r=fC(),n=pC(),a=mC(),l=_C(),h=gC(),f=Mg(),m=SC(),p=wC(),S=CC(),g=Qr(),C=RC();function v($,A){const K=$.size,P=l.getPositions(A);for(let N=0;N<P.length;N++){const W=P[N][0],O=P[N][1];for(let j=-1;j<=7;j++)if(!(W+j<=-1||K<=W+j))for(let B=-1;B<=7;B++)O+B<=-1||K<=O+B||(j>=0&&j<=6&&(B===0||B===6)||B>=0&&B<=6&&(j===0||j===6)||j>=2&&j<=4&&B>=2&&B<=4?$.set(W+j,O+B,!0,!0):$.set(W+j,O+B,!1,!0))}}function y($){const A=$.size;for(let K=8;K<A-8;K++){const P=K%2===0;$.set(K,6,P,!0),$.set(6,K,P,!0)}}function x($,A){const K=a.getPositions(A);for(let P=0;P<K.length;P++){const N=K[P][0],W=K[P][1];for(let O=-2;O<=2;O++)for(let j=-2;j<=2;j++)O===-2||O===2||j===-2||j===2||O===0&&j===0?$.set(N+O,W+j,!0,!0):$.set(N+O,W+j,!1,!0)}}function E($,A){const K=$.size,P=p.getEncodedBits(A);let N,W,O;for(let j=0;j<18;j++)N=Math.floor(j/3),W=j%3+K-8-3,O=(P>>j&1)===1,$.set(N,W,O,!0),$.set(W,N,O,!0)}function F($,A,K){const P=$.size,N=S.getEncodedBits(A,K);let W,O;for(W=0;W<15;W++)O=(N>>W&1)===1,W<6?$.set(W,8,O,!0):W<8?$.set(W+1,8,O,!0):$.set(P-15+W,8,O,!0),W<8?$.set(8,P-W-1,O,!0):W<9?$.set(8,15-W-1+1,O,!0):$.set(8,15-W-1,O,!0);$.set(P-8,8,1,!0)}function U($,A){const K=$.size;let P=-1,N=K-1,W=7,O=0;for(let j=K-1;j>0;j-=2)for(j===6&&j--;;){for(let B=0;B<2;B++)if(!$.isReserved(N,j-B)){let V=!1;O<A.length&&(V=(A[O]>>>W&1)===1),$.set(N,j-B,V),W--,W===-1&&(O++,W=7)}if(N+=P,N<0||K<=N){N-=P,P=-P;break}}}function M($,A,K){const P=new r;K.forEach(function(B){P.put(B.mode.bit,4),P.put(B.getLength(),g.getCharCountIndicator(B.mode,$)),B.write(P)});const N=e.getSymbolTotalCodewords($),W=f.getTotalCodewordsCount($,A),O=(N-W)*8;for(P.getLengthInBits()+4<=O&&P.put(0,4);P.getLengthInBits()%8!==0;)P.putBit(0);const j=(O-P.getLengthInBits())/8;for(let B=0;B<j;B++)P.put(B%2?17:236,8);return L(P,$,A)}function L($,A,K){const P=e.getSymbolTotalCodewords(A),N=f.getTotalCodewordsCount(A,K),W=P-N,O=f.getBlocksCount(A,K),j=P%O,B=O-j,V=Math.floor(P/O),Q=Math.floor(W/O),ee=Q+1,b=V-Q,Z=new m(b);let te=0;const R=new Array(O),T=new Array(O);let ne=0;const ce=new Uint8Array($.buffer);for(let xe=0;xe<O;xe++){const Oe=xe<B?Q:ee;R[xe]=ce.slice(te,te+Oe),T[xe]=Z.encode(R[xe]),te+=Oe,ne=Math.max(ne,Oe)}const ue=new Uint8Array(P);let ge=0,Ce,be;for(Ce=0;Ce<ne;Ce++)for(be=0;be<O;be++)Ce<R[be].length&&(ue[ge++]=R[be][Ce]);for(Ce=0;Ce<b;Ce++)for(be=0;be<O;be++)ue[ge++]=T[be][Ce];return ue}function G($,A,K,P){let N;if(Array.isArray($))N=C.fromArray($);else if(typeof $=="string"){let V=A;if(!V){const Q=C.rawSplit($);V=p.getBestVersionForData(Q,K)}N=C.fromString($,V||40)}else throw new Error("Invalid data");const W=p.getBestVersionForData(N,K);if(!W)throw new Error("The amount of data is too big to be stored in a QR Code");if(!A)A=W;else if(A<W)throw new Error(`
|
|
85
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
86
|
+
Minimum version required to store current data is: `+W+`.
|
|
87
|
+
`);const O=M(A,K,N),j=e.getSymbolSize(A),B=new n(j);return v(B,A),y(B),x(B,A),F(B,K,0),A>=7&&E(B,A),U(B,O),isNaN(P)&&(P=h.getBestMask(B,F.bind(null,B,K))),h.applyMask(P,B),F(B,K,P),{modules:B,version:A,errorCorrectionLevel:K,maskPattern:P,segments:N}}return Hc.create=function(A,K){if(typeof A>"u"||A==="")throw new Error("No input text");let P=t.M,N,W;return typeof K<"u"&&(P=t.from(K.errorCorrectionLevel,t.M),N=p.from(K.version),W=h.from(K.maskPattern),K.toSJISFunc&&e.setToSJISFunction(K.toSJISFunc)),G(A,N,P,W)},Hc}var oh={},ah={},e_;function Tg(){return e_||(e_=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(l){return[l,l]}))),n.length===6&&n.push("F","F");const a=parseInt(n.join(""),16);return{r:a>>24&255,g:a>>16&255,b:a>>8&255,a:a&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const a=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,l=n.width&&n.width>=21?n.width:void 0,h=n.scale||4;return{width:l,scale:l?4:h,margin:a,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,a){return a.width&&a.width>=n+a.margin*2?a.width/(n+a.margin*2):a.scale},e.getImageWidth=function(n,a){const l=e.getScale(n,a);return Math.floor((n+a.margin*2)*l)},e.qrToImageData=function(n,a,l){const h=a.modules.size,f=a.modules.data,m=e.getScale(h,l),p=Math.floor((h+l.margin*2)*m),S=l.margin*m,g=[l.color.light,l.color.dark];for(let C=0;C<p;C++)for(let v=0;v<p;v++){let y=(C*p+v)*4,x=l.color.light;if(C>=S&&v>=S&&C<p-S&&v<p-S){const E=Math.floor((C-S)/m),F=Math.floor((v-S)/m);x=g[f[E*h+F]?1:0]}n[y++]=x.r,n[y++]=x.g,n[y++]=x.b,n[y]=x.a}}})(ah)),ah}var t_;function MC(){return t_||(t_=1,(function(e){const t=Tg();function r(a,l,h){a.clearRect(0,0,l.width,l.height),l.style||(l.style={}),l.height=h,l.width=h,l.style.height=h+"px",l.style.width=h+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(l,h,f){let m=f,p=h;typeof m>"u"&&(!h||!h.getContext)&&(m=h,h=void 0),h||(p=n()),m=t.getOptions(m);const S=t.getImageWidth(l.modules.size,m),g=p.getContext("2d"),C=g.createImageData(S,S);return t.qrToImageData(C.data,l,m),r(g,p,S),g.putImageData(C,0,0),p},e.renderToDataURL=function(l,h,f){let m=f;typeof m>"u"&&(!h||!h.getContext)&&(m=h,h=void 0),m||(m={});const p=e.render(l,h,m),S=m.type||"image/png",g=m.rendererOpts||{};return p.toDataURL(S,g.quality)}})(oh)),oh}var lh={},i_;function LC(){if(i_)return lh;i_=1;const e=Tg();function t(a,l){const h=a.a/255,f=l+'="'+a.hex+'"';return h<1?f+" "+l+'-opacity="'+h.toFixed(2).slice(1)+'"':f}function r(a,l,h){let f=a+l;return typeof h<"u"&&(f+=" "+h),f}function n(a,l,h){let f="",m=0,p=!1,S=0;for(let g=0;g<a.length;g++){const C=Math.floor(g%l),v=Math.floor(g/l);!C&&!p&&(p=!0),a[g]?(S++,g>0&&C>0&&a[g-1]||(f+=p?r("M",C+h,.5+v+h):r("m",m,0),m=0,p=!1),C+1<l&&a[g+1]||(f+=r("h",S),S=0)):m++}return f}return lh.render=function(l,h,f){const m=e.getOptions(h),p=l.modules.size,S=l.modules.data,g=p+m.margin*2,C=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+g+"v"+g+'H0z"/>':"",v="<path "+t(m.color.dark,"stroke")+' d="'+n(S,p,m.margin)+'"/>',y='viewBox="0 0 '+g+" "+g+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+y+' shape-rendering="crispEdges">'+C+v+`</svg>
|
|
88
|
+
`;return typeof f=="function"&&f(null,E),E},lh}var r_;function PC(){if(r_)return xs;r_=1;const e=dC(),t=DC(),r=MC(),n=LC();function a(l,h,f,m,p){const S=[].slice.call(arguments,1),g=S.length,C=typeof S[g-1]=="function";if(!C&&!e())throw new Error("Callback required as last argument");if(C){if(g<2)throw new Error("Too few arguments provided");g===2?(p=f,f=h,h=m=void 0):g===3&&(h.getContext&&typeof p>"u"?(p=m,m=void 0):(p=m,m=f,f=h,h=void 0))}else{if(g<1)throw new Error("Too few arguments provided");return g===1?(f=h,h=m=void 0):g===2&&!h.getContext&&(m=f,f=h,h=void 0),new Promise(function(v,y){try{const x=t.create(f,m);v(l(x,h,m))}catch(x){y(x)}})}try{const v=t.create(f,m);p(null,l(v,h,m))}catch(v){p(v)}}return xs.create=t.create,xs.toCanvas=a.bind(null,r.render),xs.toDataURL=a.bind(null,r.renderToDataURL),xs.toString=a.bind(null,function(l,h,f){return n.render(l,f)}),xs}var TC=PC();const BC=su(TC),jC="modulepreload",AC=function(e){return"/"+e},s_={},IC=function(t,r,n){let a=Promise.resolve();if(r&&r.length>0){let h=function(p){return Promise.all(p.map(S=>Promise.resolve(S).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));a=h(r.map(p=>{if(p=AC(p),p in s_)return;s_[p]=!0;const S=p.endsWith(".css"),g=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const C=document.createElement("link");if(C.rel=S?"stylesheet":jC,S||(C.as="script"),C.crossOrigin="",C.href=p,m&&C.setAttribute("nonce",m),document.head.appendChild(C),S)return new Promise((v,y)=>{C.addEventListener("load",v),C.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(h){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=h,window.dispatchEvent(f),!f.defaultPrevented)throw h}return a.then(h=>{for(const f of h||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})};class Be{constructor(t,r,n,a,l){this._legacyCanvasSize=Be.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=t,this.$canvas=document.createElement("canvas"),n&&typeof n=="object"?this._onDecode=r:(console.warn(n||a||l?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=r),r=typeof n=="object"?n:{},this._onDecodeError=r.onDecodeError||(typeof n=="function"?n:this._onDecodeError),this._calculateScanRegion=r.calculateScanRegion||(typeof a=="function"?a:this._calculateScanRegion),this._preferredCamera=r.preferredCamera||l||this._preferredCamera,this._legacyCanvasSize=typeof n=="number"?n:typeof a=="number"?a:this._legacyCanvasSize,this._maxScansPerSecond=r.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),t.disablePictureInPicture=!0,t.playsInline=!0,t.muted=!0;let h=!1;if(t.hidden&&(t.hidden=!1,h=!0),document.body.contains(t)||(document.body.appendChild(t),h=!0),n=t.parentElement,r.highlightScanRegion||r.highlightCodeOutline){if(a=!!r.overlay,this.$overlay=r.overlay||document.createElement("div"),l=this.$overlay.style,l.position="absolute",l.display="none",l.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!a&&r.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}n.insertBefore(this.$overlay,this.$video.nextSibling)}r.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let f=window.getComputedStyle(t);f.display==="none"&&(t.style.setProperty("display","block","important"),h=!0),f.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),h=!0),h&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),t.style.opacity="0",t.style.width="0",t.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),t.addEventListener("play",this._onPlay),t.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=Be.createQrEngine()}static set WORKER_PATH(t){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await Be.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let r=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(a=>a.kind==="videoinput"),n;try{t&&(await r()).every(a=>!a.label)&&(n=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await r()).map((a,l)=>({id:a.deviceId,label:a.label||(l===0?"Default Camera":`Camera ${l+1}`)}))}finally{n&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),Be._stopVideoStream(n))}}async hasFlash(){let t;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;t=this.$video.srcObject}else t=(await this._getCameraStream()).stream;return"torch"in t.getVideoTracks()[0].getSettings()}catch{return!1}finally{t&&t!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),Be._stopVideoStream(t))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(t){throw this._flashOn=!1,t}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),Be._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:t,facingMode:r}=await this._getCameraStream();!this._active||this._paused?Be._stopVideoStream(t):(this._setVideoMirror(r),this.$video.srcObject=t,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(t){if(!this._paused)throw this._active=!1,t}}stop(){this.pause(),this._active=!1}async pause(t=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let r=()=>{this.$video.srcObject instanceof MediaStream&&(Be._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(r(),!0):(await new Promise(n=>setTimeout(n,300)),this._paused?(r(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,r,n,a,l=!1,h=!1){let f,m=!1;r&&("scanRegion"in r||"qrEngine"in r||"canvas"in r||"disallowCanvasResizing"in r||"alsoTryWithoutScanRegion"in r||"returnDetailedScanResult"in r)?(f=r.scanRegion,n=r.qrEngine,a=r.canvas,l=r.disallowCanvasResizing||!1,h=r.alsoTryWithoutScanRegion||!1,m=!0):console.warn(r||n||a||l||h?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),r=!!n;try{let p,S;[n,p]=await Promise.all([n||Be.createQrEngine(),Be._loadImage(t)]),[a,S]=Be._drawToCanvas(p,f,a,l);let g;if(n instanceof Worker){let C=n;r||Be._postWorkerMessageSync(C,"inversionMode","both"),g=await new Promise((v,y)=>{let x,E,F,U=-1;E=L=>{L.data.id===U&&(C.removeEventListener("message",E),C.removeEventListener("error",F),clearTimeout(x),L.data.data!==null?v({data:L.data.data,cornerPoints:Be._convertPoints(L.data.cornerPoints,f)}):y(Be.NO_QR_CODE_FOUND))},F=L=>{C.removeEventListener("message",E),C.removeEventListener("error",F),clearTimeout(x),y("Scanner error: "+(L?L.message||L:"Unknown Error"))},C.addEventListener("message",E),C.addEventListener("error",F),x=setTimeout(()=>F("timeout"),1e4);let M=S.getImageData(0,0,a.width,a.height);U=Be._postWorkerMessageSync(C,"decode",M,[M.data.buffer])})}else g=await Promise.race([new Promise((C,v)=>window.setTimeout(()=>v("Scanner error: timeout"),1e4)),(async()=>{try{var[C]=await n.detect(a);if(!C)throw Be.NO_QR_CODE_FOUND;return{data:C.rawValue,cornerPoints:Be._convertPoints(C.cornerPoints,f)}}catch(v){if(C=v.message||v,/not implemented|service unavailable/.test(C))return Be._disableBarcodeDetector=!0,Be.scanImage(t,{scanRegion:f,canvas:a,disallowCanvasResizing:l,alsoTryWithoutScanRegion:h});throw`Scanner error: ${C}`}})()]);return m?g:g.data}catch(p){if(!f||!h)throw p;let S=await Be.scanImage(t,{qrEngine:n,canvas:a,disallowCanvasResizing:l});return m?S:S.data}finally{r||Be._postWorkerMessage(n,"close")}}setGrayscaleWeights(t,r,n,a=!0){Be._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:r,blue:n,useIntegerApproximation:a})}setInversionMode(t){Be._postWorkerMessage(this._qrEnginePromise,"inversionMode",t)}static async createQrEngine(t){if(t&&console.warn("Specifying a worker path is not required and not supported anymore."),t=()=>IC(()=>import("./qr-scanner-worker.min-D85Z9gVD.js"),[]).then(n=>n.createWorker()),!(!Be._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let r=navigator.userAgentData;return r&&r.brands.some(({brand:n})=>/Chromium/i.test(n))&&/mac ?OS/i.test(r.platform)&&await r.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:n,platformVersion:a})=>/arm/i.test(n||"arm")&&13<=parseInt(a||"13")).catch(()=>!0)?t():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(t){let r=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-r)/2),y:Math.round((t.videoHeight-r)/2),width:r,height:r,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,r=t.videoWidth,n=t.videoHeight,a=t.offsetWidth,l=t.offsetHeight,h=t.offsetLeft,f=t.offsetTop,m=window.getComputedStyle(t),p=m.objectFit,S=r/n,g=a/l;switch(p){case"none":var C=r,v=n;break;case"fill":C=a,v=l;break;default:(p==="cover"?S>g:S<g)?(v=l,C=v*S):(C=a,v=C/S),p==="scale-down"&&(C=Math.min(C,r),v=Math.min(v,n))}var[y,x]=m.objectPosition.split(" ").map((F,U)=>{const M=parseFloat(F);return F.endsWith("%")?(U?l-v:a-C)*M/100:M});m=this._scanRegion.width||r,g=this._scanRegion.height||n,p=this._scanRegion.x||0;var E=this._scanRegion.y||0;S=this.$overlay.style,S.width=`${m/r*C}px`,S.height=`${g/n*v}px`,S.top=`${f+x+E/n*v}px`,n=/scaleX\(-1\)/.test(t.style.transform),S.left=`${h+(n?a-y-C:y)+(n?r-p-m:p)/r*C}px`,S.transform=t.style.transform}})}static _convertPoints(t,r){if(!r)return t;let n=r.x||0,a=r.y||0,l=r.width&&r.downScaledWidth?r.width/r.downScaledWidth:1;r=r.height&&r.downScaledHeight?r.height/r.downScaledHeight:1;for(let h of t)h.x=h.x*l+n,h.y=h.y*r+a;return t}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var t=Date.now()-this._lastScanTimestamp,r=1e3/this._maxScansPerSecond;t<r&&await new Promise(a=>setTimeout(a,r-t)),this._lastScanTimestamp=Date.now();try{var n=await Be.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(a){if(!this._active)return;this._onDecodeError(a)}!Be._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=Be.createQrEngine()),n?(this._onDecode?this._onDecode(n):this._legacyOnDecode&&this._legacyOnDecode(n.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",n.cornerPoints.map(({x:a,y:l})=>`${a},${l}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==Be.NO_QR_CODE_FOUND&&console.log(t)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let t=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",r=[{width:{min:1024}},{width:{min:768}},{}],n=r.map(a=>Object.assign({},a,{[t]:{exact:this._preferredCamera}}));for(let a of[...n,...r])try{let l=await navigator.mediaDevices.getUserMedia({video:a,audio:!1}),h=this._getFacingMode(l)||(a.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:l,facingMode:h}}catch{}throw"Camera not found."}async _restartVideoStream(){let t=this._paused;await this.pause(!0)&&!t&&this._active&&await this.start()}static _stopVideoStream(t){for(let r of t.getTracks())r.stop(),t.removeTrack(r)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,r,n,a=!1){n=n||document.createElement("canvas");let l=r&&r.x?r.x:0,h=r&&r.y?r.y:0,f=r&&r.width?r.width:t.videoWidth||t.width,m=r&&r.height?r.height:t.videoHeight||t.height;return a||(a=r&&r.downScaledWidth?r.downScaledWidth:f,r=r&&r.downScaledHeight?r.downScaledHeight:m,n.width!==a&&(n.width=a),n.height!==r&&(n.height=r)),r=n.getContext("2d",{alpha:!1}),r.imageSmoothingEnabled=!1,r.drawImage(t,l,h,f,m,0,0,n.width,n.height),[n,r]}static async _loadImage(t){if(t instanceof Image)return await Be._awaitImageLoad(t),t;if(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGImageElement||"OffscreenCanvas"in window&&t instanceof OffscreenCanvas||"ImageBitmap"in window&&t instanceof ImageBitmap)return t;if(t instanceof File||t instanceof Blob||t instanceof URL||typeof t=="string"){let r=new Image;r.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await Be._awaitImageLoad(r),r}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(r.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((r,n)=>{let a=l=>{t.removeEventListener("load",a),t.removeEventListener("error",a),l instanceof ErrorEvent?n("Image load error"):r()};t.addEventListener("load",a),t.addEventListener("error",a)})}static async _postWorkerMessage(t,r,n,a){return Be._postWorkerMessageSync(await t,r,n,a)}static _postWorkerMessageSync(t,r,n,a){if(!(t instanceof Worker))return-1;let l=Be._workerMessageId++;return t.postMessage({id:l,type:r,data:n},a),l}}Be.DEFAULT_CANVAS_SIZE=400;Be.NO_QR_CODE_FOUND="No QR code found";Be._disableBarcodeDetector=!1;Be._workerMessageId=0;const OC=64;function Ln(e){if(typeof e!="string")return!1;const t=e.trim();return t.length>0&&t.length<=OC&&!/[\x00-\x1f\x7f]/.test(t)}function Bg(e){return String(e??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32).replace(/-+$/g,"")||"node"}function zC(e,t){if(!e||!t||t<e)return null;const r=Math.floor((t-e)/1e3);return r<60?"ora":r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}g`}function FC(e,t){const r=!!(e&&e.status==="up");return{up:r,label:r?"tunnel-up":"tunnel-down",since:r?zC(e.since,t):null}}function ku(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&typeof Notification<"u"}function HC(e){const t="=".repeat((4-e.length%4)%4),r=(e+t).replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),a=new Uint8Array(n.length);for(let l=0;l<n.length;l+=1)a[l]=n.charCodeAt(l);return a}async function WC(){if(!ku())return"unsupported";if(Notification.permission==="denied")return"denied";try{return await(await navigator.serviceWorker.ready).pushManager.getSubscription()?"subscribed":"idle"}catch{return"idle"}}async function $C(e){if(!ku())throw new Error("push-unsupported");if(await Notification.requestPermission()!=="granted")throw new Error("push-denied");const r=await wt("/api/push/vapid",e),{publicKey:n}=await r.json();if(!n)throw new Error("vapid non disponibile");const l=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:HC(n)}),h=await wt("/api/push/subscribe",e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({subscription:l.toJSON()})});if(!h.ok){try{await l.unsubscribe()}catch{}const f=await h.json().catch(()=>({}));throw new Error(f.error||`HTTP ${h.status}`)}return!0}async function UC(e){if(!ku())return!1;const r=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!r)return!1;const n=r.endpoint;try{await r.unsubscribe()}catch{}try{await wt("/api/push/subscribe",e,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:n})})}catch{}return!0}const KC=()=>({kind:"managed",id:"claude.native",label:"",client:"claude",provider:"native",credentialProfile:"",managedModel:"",permissionPolicy:"unsafe",displayName:"",protocol:"anthropic_messages",baseUrl:"",envKey:"",providerId:"nexuscrew-custom",command:"",argsText:"",rc:!0,promptMode:"send-keys",promptFlag:"",modelFlag:"",modelValue:"",envRows:[]}),VC=(e="")=>({id:"",cwd:"",engine:e,boot:!1,model:"",prompt:""}),jg=e=>e==="claude"?"unsafe":"standard",Zh=(e,t)=>e.find(r=>r.client===t.client&&r.provider===t.provider&&(r.credentialProfile||"")===(t.credentialProfile||"")),qC=(e,t)=>{var r;return((r=Zh(e,t))==null?void 0:r.label)||`${t.client} · ${t.provider}`};function YC(e){var t,r,n,a,l,h,f,m,p,S,g,C,v,y;return{kind:e.managed?"managed":"custom",id:e.id,label:e.label||"",command:e.command||"",argsText:(e.args||[]).join(`
|
|
89
|
+
`),rc:!!e.rc,client:((t=e.managed)==null?void 0:t.client)||"claude",provider:((r=e.managed)==null?void 0:r.provider)||"native",credentialProfile:((n=e.managed)==null?void 0:n.credentialProfile)||"",managedModel:((a=e.managed)==null?void 0:a.model)||"",permissionPolicy:((l=e.managed)==null?void 0:l.permissionPolicy)||jg((h=e.managed)==null?void 0:h.client),displayName:((f=e.managed)==null?void 0:f.displayName)||"",protocol:((m=e.managed)==null?void 0:m.protocol)||"",baseUrl:((p=e.managed)==null?void 0:p.baseUrl)||"",envKey:((S=e.managed)==null?void 0:S.envKey)||"",providerId:((g=e.managed)==null?void 0:g.providerId)||"nexuscrew-custom",modelOptions:e.availableModels||((C=e.managedInfo)==null?void 0:C.models)||[],promptMode:e.promptMode||"send-keys",promptFlag:e.promptFlag||"",modelFlag:((v=e.model)==null?void 0:v.flag)||"",modelValue:((y=e.model)==null?void 0:y.value)||"",envRows:(e.envKeys||[]).map(x=>({key:x,value:"",configured:!0,remove:!1}))}}function XC(e,t,r=[]){if(e.kind==="managed"){const a={client:e.client,provider:e.provider,model:e.managedModel||"",permissionPolicy:e.permissionPolicy||jg(e.client)};return e.credentialProfile&&(a.credentialProfile=e.credentialProfile),e.provider==="custom"&&Object.assign(a,{displayName:e.displayName,protocol:e.protocol,baseUrl:e.baseUrl,envKey:e.envKey,providerId:e.providerId}),{...t?{id:e.id}:{},label:e.label||qC(r,e),rc:!!e.rc,managed:a}}const n={...t?{id:e.id}:{},label:e.label||e.id,rc:!!e.rc,command:e.command,args:e.argsText.split(`
|
|
90
|
+
`).filter(a=>a!==""),promptMode:e.promptMode};return e.modelFlag&&(n.model={flag:e.modelFlag,value:e.modelValue||""}),e.promptMode==="flag"&&(n.promptFlag=e.promptFlag),t&&(n.env=Object.fromEntries(e.envRows.filter(a=>!a.remove&&a.key).map(a=>[a.key,a.value]))),n}function GC({token:e,readonly:t,targets:r=[]}){const[n,a]=I.useState({engines:[],cells:[],managedCatalog:[]}),[l,h]=I.useState({available:!1,capabilities:[]}),[f,m]=I.useState(null),[p,S]=I.useState(null),[g,C]=I.useState(!1),[v,y]=I.useState(""),[x,E]=I.useState(""),[F,U]=I.useState(""),[M,L]=I.useState(!1),G=F?F.split("/"):[],$=I.useCallback(async()=>{try{const B=await Rs(e,G);h(B);try{const V=await w_(e,G);L(!!V.readonlyDefault)}catch{L(!1)}if(B.provider==="builtin"&&(B.capabilities||[]).includes("definitions")){const V=await Xy(e,G),Q=new Map((B.engines||[]).map(ee=>[ee.id,ee]));V.engines=(V.engines||[]).map(ee=>{var b;return{...ee,availableModels:((b=Q.get(ee.id))==null?void 0:b.models)||[]}}),a(V)}}catch(B){y(String(B.message||B))}},[e,F]);I.useEffect(()=>{$();const B=setInterval($,5e3);return()=>clearInterval(B)},[$]);const A=new Set((l.cells||[]).filter(B=>B.active).map(B=>B.cell)),K=l.provider==="builtin"&&(l.capabilities||[]).includes("edit"),P=async B=>{C(!0),y(""),E("");try{await B(),await $()}catch(V){y(String(V.message||V))}C(!1)},N=()=>P(async()=>{const B=f.mode==="new",V=XC(f.form,B,n.managedCatalog||[]);!B&&f.form.kind==="custom"&&!f.form.modelFlag&&(V.model=null),!B&&f.form.kind==="custom"&&f.form.promptMode!=="flag"&&(V.promptFlag=null);let Q;if(B)Q=await Gy(e,V,G);else{const b=f.original,Z=new Set(f.form.envRows.filter(T=>!T.remove).map(T=>T.key)),te=(b.envKeys||[]).filter(T=>!Z.has(T)),R=Object.fromEntries(f.form.envRows.filter(T=>!T.remove&&T.key&&(!T.configured||T.value!=="")).map(T=>[T.key,T.value]));Q=await Qy(e,b.id,V,f.form.kind==="custom"?{set:R,remove:te}:void 0,G)}m(null),E(k("fleet-saved"));const ee=(Q==null?void 0:Q.activeCells)||[];if(ee.length&&window.confirm(k("fleet-restart-confirm").replace("{cells}",ee.join(", "))))for(const b of ee)await hh(e,b,G)}),W=()=>P(async()=>{const B=p.mode==="new",V=p.form,Q={...B?{id:V.id}:{},cwd:V.cwd,engine:V.engine,boot:!!V.boot};B?(V.model&&(Q.model=V.model),V.prompt&&(Q.prompt=V.prompt)):(Q.model=V.model||null,Q.prompt=V.prompt||null);const ee=B?await Zy(e,Q,G):await e0(e,p.original.id,Q,G),b=B?V.id:p.original.id;S(null),E(k("fleet-saved")),!B&&(ee!=null&&ee.active)&&window.confirm(k("fleet-restart-confirm").replace("{cells}",b))&&await hh(e,b,G)}),O=t||M,j=u.jsxs("label",{className:"nc-field",children:[k("location"),u.jsxs("select",{value:F,onChange:B=>{U(B.target.value),m(null),S(null),y(""),E(""),L(!1),h({available:!1,capabilities:[]}),a({engines:[],cells:[],managedCatalog:[]})},children:[u.jsx("option",{value:"",children:k("local")}),r.map(B=>u.jsx("option",{value:B.route.join("/"),children:B.label},B.route.join("/")))]})]});return K?u.jsxs("div",{className:"nc-set-tab nc-fleet-editor",children:[j,u.jsx(n_,{token:e,targets:r,readonly:t}),u.jsxs("div",{className:"nc-fleet-section-head",children:[u.jsx("b",{children:k("fleet-engines")}),u.jsxs("button",{className:"nc-btn primary",disabled:O||g,onClick:()=>m({mode:"new",form:KC()}),children:["+ ",k("add")]})]}),n.engines.map(B=>{var V,Q;return u.jsxs("div",{className:"nc-fleet-item",children:[u.jsxs("span",{children:[u.jsx("b",{children:B.label}),u.jsx("small",{children:B.managed?`${B.id} · ${B.managed.client} / ${B.managed.provider} · ${(V=B.managedInfo)!=null&&V.configured?k("fleet-ready"):((Q=B.managedInfo)==null?void 0:Q.reason)||k("fleet-not-ready")}`:`${B.id} · ${B.command}`})]}),u.jsxs("span",{children:[u.jsx("button",{className:"nc-btn ghost",disabled:O||g,onClick:()=>m({mode:"edit",original:B,form:YC(B)}),children:k("edit")}),u.jsx("button",{className:"nc-btn danger",disabled:O||g,onClick:()=>P(async()=>{window.confirm(k("fleet-remove-engine").replace("{id}",B.id))&&await Jy(e,B.id,G)}),children:"×"})]})]},B.id)}),f&&u.jsx(QC,{state:f,setState:m,busy:g,onSave:N,catalog:n.managedCatalog||[]}),u.jsxs("div",{className:"nc-fleet-section-head",children:[u.jsx("b",{children:k("fleet-cells")}),u.jsxs("button",{className:"nc-btn primary",disabled:O||g||!n.engines.length,onClick:()=>{var B;return S({mode:"new",form:VC((B=n.engines[0])==null?void 0:B.id)})},children:["+ ",k("add")]})]}),n.cells.map(B=>u.jsxs("div",{className:"nc-fleet-item",children:[u.jsxs("span",{children:[u.jsx("b",{children:B.id}),u.jsxs("small",{children:[B.engine," · ",B.cwd,A.has(B.id)?` · ${k("service-active")}`:""]})]}),u.jsxs("span",{children:[u.jsx("button",{className:"nc-btn ghost",disabled:O||g,onClick:()=>S({mode:"edit",original:B,form:{...B}}),children:k("edit")}),u.jsx("button",{className:"nc-btn danger",disabled:O||g,onClick:()=>P(async()=>{window.confirm(k("fleet-remove-cell").replace("{id}",B.id))&&await m_(e,B.id,!0,G)}),children:"×"})]})]},B.id)),p&&u.jsx(JC,{token:e,route:G,targets:r,location:F,setLocation:U,state:p,setState:S,engines:n.engines,busy:g,onSave:W}),x&&u.jsx("div",{className:"nc-set-note",children:x}),v&&u.jsx("div",{className:"nc-err",children:v})]}):u.jsxs("div",{className:"nc-set-tab",children:[j,u.jsx(n_,{token:e,targets:r,readonly:t}),u.jsx("div",{className:"nc-set-info",children:k("fleet-editor-unavailable")}),v&&u.jsx("div",{className:"nc-err",children:v})]})}function n_({token:e,targets:t=[],readonly:r=!1}){const[n,a]=I.useState([]),[l,h]=I.useState(0);I.useEffect(()=>{let y=!0;async function x(){const F=[{route:[],label:k("local")}].concat((t||[]).map(M=>({route:Array.isArray(M.route)?M.route:[],label:M.label||(M.route||[]).join(" › ")}))),U=await Promise.all(F.map(async M=>{const L={...M,available:!1,capabilities:[],provider:null,cells:[],unmanaged:[],err:""};try{const G=await Rs(e,M.route);L.available=!!G.available,L.capabilities=G.capabilities||[],L.provider=G.provider||null,L.cells=(G.cells||[]).map($=>({...$,route:M.route}));try{const $=await S_(e,M.route),A=new Set(L.cells.map(K=>K.tmuxSession).filter(Boolean));L.unmanaged=($.sessions||[]).filter(K=>K&&!A.has(K.name))}catch{}}catch(G){L.err=String(G&&G.message||G)}return L}));y&&a(U)}x();const E=setInterval(x,6e3);return()=>{y=!1,clearInterval(E)}},[e,t,l]);const f=(y,x)=>Array.isArray(y.capabilities)&&y.capabilities.includes(x)&&!r,m=()=>h(y=>y+1),p=async(y,x)=>{try{await ou(e,{cell:y.cell},x)}catch{}m()},S=async(y,x)=>{try{await au(e,{cell:y.cell},x)}catch{}m()},g=async(y,x)=>{try{await hh(e,y.cell,x)}catch{}m()},C=async(y,x)=>{if(window.confirm(k("fleet-remove-cell").replace("{id}",y.cell))){try{await m_(e,y.cell,!0,x)}catch{}m()}},v=async(y,x)=>{if(window.confirm(k("terminate-confirm").replace("{name}",y.name))){try{await lu(e,y.name,x)}catch{}m()}};return u.jsxs("div",{className:"nc-fleet-inventory",children:[u.jsxs("div",{className:"nc-fleet-section-head",children:[u.jsx("b",{children:k("fleet-inventory")}),u.jsx("small",{children:k("fleet-inventory-help")})]}),n.map(y=>{const x=y.route.length?y.route.join("/"):"local";return u.jsxs("div",{className:"nc-fleet-pos",children:[u.jsxs("div",{className:"nc-fleet-pos-title",children:[u.jsx("span",{className:`dot ${y.available?"on":"warn"}`}),u.jsx("b",{children:y.label}),u.jsx("small",{children:y.available?`${y.cells.length} ${k("fleet-cells")} · ${y.unmanaged.length} ${k("fleet-tmux")}`:y.err||k("fleet-not-available")})]}),y.cells.map(E=>u.jsxs("div",{className:"nc-fleet-item nc-fleet-cell",children:[u.jsxs("span",{children:[u.jsx("b",{children:E.cell}),u.jsx("small",{children:`${E.engine||""}${E.key?`·${E.key}`:""}${E.active?"":` · ${k("cell-off")}`}`})]}),u.jsxs("span",{className:"nc-fleet-cell-actions",children:[E.active&&f(y,"down")&&u.jsx("button",{className:"nc-btn ghost",title:k("power-off"),onClick:()=>S(E,y.route),children:k("stop")}),!E.active&&f(y,"up")&&u.jsx("button",{className:"nc-btn ghost",title:k("power-on"),onClick:()=>p(E,y.route),children:k("start")}),f(y,"restart")&&E.active&&u.jsx("button",{className:"nc-btn ghost",title:k("restart"),onClick:()=>g(E,y.route),children:k("restart")}),f(y,"edit")&&u.jsx("button",{className:"nc-btn danger",title:k("delete"),onClick:()=>C(E,y.route),children:"×"})]})]},`${x}:${E.cell}`)),y.unmanaged.map(E=>u.jsxs("div",{className:"nc-fleet-item nc-fleet-unmanaged",children:[u.jsxs("span",{children:[u.jsx("b",{children:E.name}),u.jsx("small",{children:k("fleet-tmux")})]}),u.jsx("span",{className:"nc-fleet-cell-actions",children:u.jsx("button",{className:"nc-btn danger",title:k("terminate"),onClick:()=>v(E,y.route),children:"×"})})]},`${x}:u:${E.name}`)),y.available&&y.cells.length===0&&y.unmanaged.length===0&&u.jsx("div",{className:"nc-empty",children:k("fleet-inventory-empty")})]},x)})]})}function QC({state:e,setState:t,busy:r,onSave:n,catalog:a}){var C;const l=e.form,h=v=>t({...e,form:{...l,...v}}),f=l.envRows||[],m=[...new Map(a.map(v=>[v.client,v.clientLabel||v.client])).entries()],p=a.filter(v=>v.client===l.client),S=Zh(a,l),g=v=>{v&&h({client:v.client,provider:v.provider,credentialProfile:v.credentialProfile||"",managedModel:v.model||"",protocol:v.protocol||"",permissionPolicy:v.permissionPolicyDefault||"standard",rc:!!v.rc,displayName:v.custom?k("fleet-custom-provider-default"):"",baseUrl:v.custom?"":v.endpoint||"",envKey:"",providerId:"nexuscrew-custom",...e.mode==="new"?{id:v.id,label:""}:{}})};return u.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[u.jsx("b",{children:e.mode==="new"?k("fleet-new-engine"):`${k("edit")} ${l.id}`}),u.jsx("input",{value:l.id,disabled:e.mode!=="new",placeholder:"id",onChange:v=>h({id:v.target.value})}),u.jsx("input",{value:l.label,placeholder:k("label"),onChange:v=>h({label:v.target.value})}),u.jsxs("select",{value:l.kind,disabled:e.mode!=="new",onChange:v=>h({kind:v.target.value}),children:[u.jsx("option",{value:"managed",children:k("fleet-managed")}),u.jsx("option",{value:"custom",children:k("fleet-custom")})]}),l.kind==="managed"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"nc-fleet-pair",children:[u.jsx("select",{value:l.client,disabled:e.mode!=="new",onChange:v=>g(a.find(y=>y.client===v.target.value&&y.default)||a.find(y=>y.client===v.target.value)),children:m.map(([v,y])=>u.jsx("option",{value:v,children:y},v))}),u.jsx("select",{value:((C=Zh(a,l))==null?void 0:C.id)||"",disabled:e.mode!=="new",onChange:v=>g(a.find(y=>y.id===v.target.value)),children:p.map(v=>u.jsx("option",{value:v.id,children:v.label},v.id))})]}),u.jsx("input",{value:l.managedModel,list:"nc-managed-models",placeholder:k(S!=null&&S.requiresModel?"fleet-model-required":"fleet-model-default"),onChange:v=>h({managedModel:v.target.value})}),u.jsx("datalist",{id:"nc-managed-models",children:[...(S==null?void 0:S.models)||[],...l.modelOptions||[]].filter((v,y,x)=>v&&x.indexOf(v)===y).map(v=>u.jsx("option",{value:v},v))}),S!=null&&S.supportsUnsafe?u.jsxs("select",{value:l.permissionPolicy,onChange:v=>h({permissionPolicy:v.target.value}),children:[u.jsx("option",{value:"standard",children:k("fleet-standard-permissions")}),u.jsx("option",{value:"unsafe",children:k("fleet-unsafe-permissions")})]}):u.jsx("small",{children:k("fleet-standard-permissions")}),(S==null?void 0:S.supportsUnsafe)&&l.permissionPolicy==="unsafe"&&u.jsx("small",{className:"nc-err",children:k("fleet-unsafe-warning")}),l.provider==="custom"&&u.jsxs(u.Fragment,{children:[u.jsx("input",{value:l.displayName,placeholder:k("fleet-provider-display"),onChange:v=>h({displayName:v.target.value})}),u.jsx("input",{value:l.baseUrl,placeholder:"https://api.example.com/v1",onChange:v=>h({baseUrl:v.target.value})}),((S==null?void 0:S.protocols)||[]).length>1&&u.jsx("select",{value:l.protocol,onChange:v=>h({protocol:v.target.value}),children:S.protocols.map(v=>u.jsx("option",{value:v,children:v},v))}),u.jsxs("div",{className:"nc-fleet-pair",children:[u.jsx("input",{value:l.envKey,placeholder:k("fleet-api-key-env"),onChange:v=>h({envKey:v.target.value})}),u.jsx("input",{value:l.providerId,placeholder:k("fleet-provider-id"),onChange:v=>h({providerId:v.target.value})})]}),u.jsxs("small",{children:[l.protocol," · ",k("fleet-custom-secret-help")]})]}),u.jsx("small",{children:k("fleet-managed-help")})]}):u.jsxs(u.Fragment,{children:[u.jsx("input",{value:l.command,placeholder:k("command-path"),onChange:v=>h({command:v.target.value})}),u.jsx("textarea",{value:l.argsText,placeholder:k("args-lines"),onChange:v=>h({argsText:v.target.value})}),u.jsxs("label",{className:"nc-check",children:[u.jsx("input",{type:"checkbox",checked:l.rc,onChange:v=>h({rc:v.target.checked})})," remote control"]}),u.jsxs("select",{value:l.promptMode,onChange:v=>h({promptMode:v.target.value}),children:[u.jsx("option",{value:"send-keys",children:"send-keys"}),u.jsx("option",{value:"flag",children:"flag"})]}),l.promptMode==="flag"&&u.jsx("input",{value:l.promptFlag,placeholder:"prompt flag",onChange:v=>h({promptFlag:v.target.value})}),u.jsxs("div",{className:"nc-fleet-pair",children:[u.jsx("input",{value:l.modelFlag,placeholder:"model flag",onChange:v=>h({modelFlag:v.target.value})}),u.jsx("input",{value:l.modelValue,placeholder:"model default",onChange:v=>h({modelValue:v.target.value})})]}),u.jsx("small",{children:k("env-write-only")}),f.map((v,y)=>u.jsxs("div",{className:"nc-fleet-env",children:[u.jsx("input",{value:v.key,disabled:v.configured,placeholder:"ENV_KEY",onChange:x=>{const E=f.slice();E[y]={...v,key:x.target.value},h({envRows:E})}}),u.jsx("input",{type:"password",value:v.value,placeholder:v.configured?"•••••• (unchanged)":"value",onChange:x=>{const E=f.slice();E[y]={...v,value:x.target.value},h({envRows:E})}}),u.jsx("button",{className:"nc-btn danger",onClick:()=>h({envRows:f.filter((x,E)=>E!==y)}),children:"×"})]},`${v.key}-${y}`)),u.jsx("button",{className:"nc-btn ghost",onClick:()=>h({envRows:[...f,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),u.jsxs("div",{className:"nc-sheet-actions",children:[u.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:k("cancel")}),u.jsx("button",{className:"nc-btn primary",disabled:r||!l.id||l.kind==="custom"&&!l.command||l.kind==="managed"&&(S==null?void 0:S.requiresModel)&&!l.managedModel||l.kind==="managed"&&l.provider==="custom"&&(!l.displayName||!l.baseUrl||!l.envKey||!l.providerId),onClick:n,children:k("save")})]})]})}function JC({token:e,route:t,targets:r=[],location:n,setLocation:a,state:l,setState:h,engines:f,busy:m,onSave:p}){const[S,g]=I.useState(null),[C,v]=I.useState(""),y=l.form,x=M=>h({...l,form:{...y,...M}}),E=f.find(M=>M.id===y.engine),F=M=>{var G,$,A;const L=f.find(K=>K.id===M);x({engine:M,model:((G=y.models)==null?void 0:G[M])||(($=L==null?void 0:L.managed)==null?void 0:$.model)||((A=L==null?void 0:L.model)==null?void 0:A.value)||""})},U=async M=>{try{const L=await g_(e,M,t);g(L),x({cwd:L.path}),v("")}catch(L){v(String(L.message||L))}};return u.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[u.jsx("b",{children:l.mode==="new"?k("fleet-new-cell"):`${k("edit")} ${y.id}`}),l.mode==="new"&&u.jsxs("label",{className:"nc-field",children:[k("location"),u.jsx("span",{className:"nc-req",children:" *"}),u.jsxs("select",{value:n,onChange:M=>{a(M.target.value),x({engine:""})},children:[u.jsx("option",{value:"",children:k("local")}),r.map(M=>u.jsx("option",{value:M.route.join("/"),children:M.label},M.route.join("/")))]})]}),u.jsx("input",{value:y.id,disabled:l.mode!=="new",placeholder:"id",onChange:M=>x({id:M.target.value})}),u.jsxs("div",{className:"nc-fleet-pair",children:[u.jsx("input",{value:y.cwd,placeholder:k("cwd"),onChange:M=>x({cwd:M.target.value})}),u.jsx("button",{className:"nc-btn ghost",onClick:()=>S?g(null):U(y.cwd),children:k("browse")})]}),S&&u.jsxs("div",{className:"nc-fs",children:[u.jsx("div",{className:"nc-fs-path",children:S.path}),u.jsxs("div",{className:"nc-fs-list",children:[S.parent&&u.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>U(S.parent),children:["↑ ",k("fs-parent")]}),(S.dirs||[]).map(M=>u.jsxs("button",{className:"nc-fs-item",onClick:()=>U(`${S.path.replace(/\/$/,"")}/${M}`),children:["📁 ",M]},M))]})]}),C&&u.jsx("div",{className:"nc-err",children:C}),u.jsx("select",{value:y.engine,onChange:M=>F(M.target.value),children:f.map(M=>u.jsx("option",{value:M.id,children:M.label},M.id))}),u.jsxs("label",{className:"nc-check",children:[u.jsx("input",{type:"checkbox",checked:!!y.boot,onChange:M=>x({boot:M.target.checked})})," boot"]}),u.jsx("input",{value:y.model||"",list:"nc-cell-models",placeholder:k("fleet-model-override"),onChange:M=>x({model:M.target.value})}),u.jsx("datalist",{id:"nc-cell-models",children:((E==null?void 0:E.availableModels)||[]).map(M=>u.jsx("option",{value:M},M))}),u.jsx("textarea",{value:y.prompt||"",placeholder:"prompt",onChange:M=>x({prompt:M.target.value})}),u.jsxs("div",{className:"nc-sheet-actions",children:[u.jsx("button",{className:"nc-btn ghost",onClick:()=>h(null),children:k("cancel")}),u.jsx("button",{className:"nc-btn primary",disabled:m||!y.id||!y.cwd||!y.engine,onClick:p,children:k("save")})]})]})}function ZC({text:e}){const[t,r]=I.useState(!1),n=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return u.jsxs("div",{className:"nc-set-copyline",children:[u.jsx("code",{children:e}),u.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:n,children:[u.jsx(Fe,{name:"copy",size:14})," ",k(t?"copied":"copy")]})]})}function eb({value:e}){const[t,r]=I.useState("");return I.useEffect(()=>{let n=!0;return BC.toDataURL(e,{margin:1,width:220}).then(a=>{n&&r(a)}).catch(()=>{}),()=>{n=!1}},[e]),t?u.jsx("img",{src:t,width:"220",height:"220",alt:"NexusCrew pairing QR"}):null}function tb({token:e,nodes:t,settings:r,readonly:n,refresh:a}){const[l,h]=I.useState(null),[f,m]=I.useState(null),[p,S]=I.useState({}),[g,C]=I.useState({name:"",label:"",ssh:"",pairingUrl:"",localLabel:""}),[v,y]=I.useState(!1),[x,E]=I.useState(null),[F,U]=I.useState(""),M=Date.now(),L=r&&r.deviceName||"",G=async(N,W)=>{h(null),m(`${N}:${W}`);try{const O=await cu(e,N,W);W==="test"&&S(j=>({...j,[N]:O})),await a()}catch(O){h(`${N}: ${String(O.message||O)}`)}m(null)},$=async N=>{if(window.confirm(k("node-remove-confirm").replace("{name}",N))){h(null),m(`${N}:remove`);try{await o0(e,N),await a()}catch(W){h(`${N}: ${String(W.message||W)}`)}m(null)}},A=N=>C(W=>({...W,label:N,name:v?W.name:Bg(N)})),K=N=>{y(!0),C(W=>({...W,name:N}))},P=async()=>{if(h(null),!g.name||!g.ssh||!g.pairingUrl)return h(k("pairing-required"));if(g.label&&!Ln(g.label)||g.localLabel&&!Ln(g.localLabel))return h(k("err-label"));m("add");try{await C_(e,{name:g.name,ssh:g.ssh,pairingUrl:g.pairingUrl,...g.label?{label:g.label}:{},localLabel:g.localLabel||L}),C({name:"",label:"",ssh:"",pairingUrl:"",localLabel:""}),y(!1),await a()}catch(N){h(String(N.message||N))}m(null)};return u.jsxs("div",{className:"nc-set-tab",children:[(t||[]).length===0&&u.jsx("div",{className:"nc-empty",children:k("no-nodes")}),(t||[]).map(N=>{var j,B,V,Q;const W=FC(N.tunnel,M),O=p[N.name];return u.jsxs("div",{className:"nc-set-node",children:[u.jsxs("div",{className:"nc-set-node-head",children:[u.jsx("span",{className:`nc-dot ${W.up?"on":""}`}),u.jsx("b",{children:N.label||N.name}),u.jsxs("small",{children:[N.name," · ",N.ssh,N.sshPort?`:${N.sshPort}`:""," · :",N.localPort,"→:",N.remotePort]}),u.jsxs("span",{className:`nc-set-tunnel${W.up?" up":""}`,children:[k(W.label),W.since?` · ${W.since}`:""]}),u.jsxs("select",{value:N.visibility||"network",disabled:n||!!f,onChange:async ee=>{m(`${N.name}:visibility`);try{await wp(e,N.name,ee.target.value),await a()}catch(b){h(String(b.message||b))}m(null)},children:[u.jsx("option",{value:"network",children:k("visibility-network")}),u.jsx("option",{value:"relay-only",children:k("visibility-relay")}),u.jsx("option",{value:"selected",children:k("visibility-selected")})]})]}),N.visibility==="selected"&&u.jsx("div",{className:"nc-set-row",children:(t||[]).filter(ee=>ee.name!==N.name&&ee.nodeId).map(ee=>{const b=(N.selected||[]).includes(ee.nodeId);return u.jsxs("label",{className:"nc-check",children:[u.jsx("input",{type:"checkbox",checked:b,disabled:n||!!f,onChange:async Z=>{const te=Z.target.checked?[...N.selected||[],ee.nodeId]:(N.selected||[]).filter(R=>R!==ee.nodeId);m(`${N.name}:visibility`);try{await wp(e,N.name,"selected",te),await a()}catch(R){h(String(R.message||R))}m(null)}})," ",ee.name]},ee.nodeId)})}),u.jsxs("div",{className:"nc-set-node-actions",children:[u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||!!f,onClick:async()=>{const ee=window.prompt(k("node-display-label"),N.label||N.name);if(ee!=null){if(!Ln(ee)){h(k("err-label"));return}m(`${N.name}:label`);try{await n0(e,N.name,ee),await a()}catch(b){h(String(b.message||b))}m(null)}},children:k("edit")}),((j=N.health)==null?void 0:j.managed)!==!1&&u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!f,onClick:()=>G(N.name,"test"),children:k("node-test")}),((B=N.health)==null?void 0:B.managed)!==!1&&(W.up?u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!f,onClick:()=>G(N.name,"down"),children:k("tunnel-stop")}):u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!f,onClick:()=>G(N.name,"up"),children:k("tunnel-start")})),((V=N.health)==null?void 0:V.managed)!==!1&&u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!f,onClick:()=>G(N.name,"restart"),children:k("tunnel-restart")}),u.jsx("button",{type:"button",className:"nc-btn danger",disabled:n||!!f,title:k(n?"settings-readonly":"terminate"),onClick:()=>$(N.name),children:u.jsx(Fe,{name:"trash",size:14})})]}),((Q=N.health)==null?void 0:Q.detail)&&u.jsx("div",{className:`nc-set-test${N.health.status==="healthy"?" ok":" ko"}`,children:N.health.detail}),O&&u.jsxs("div",{className:`nc-set-test${O.ok?" ok":" ko"}`,children:[O.result,O.detail?` — ${O.detail}`:""]})]},N.name)}),u.jsxs("div",{className:"nc-set-form",children:[u.jsx("div",{className:"nc-sheet-label",children:k("node-add")}),u.jsxs("label",{className:"nc-field",children:[k("node-display-label"),u.jsx("input",{placeholder:"VPS3",value:g.label,disabled:n,onChange:N=>A(N.target.value)})]}),u.jsxs("label",{className:"nc-field",children:[k("node-name-label"),u.jsx("input",{placeholder:k("node-name-ph"),value:g.name,disabled:n,onChange:N=>K(N.target.value)})]}),u.jsx("small",{className:"nc-set-hint",children:k("node-slug-hint").replace("{slug}",g.name||"vps3")}),u.jsxs("label",{className:"nc-field",children:[k("node-ssh-label"),u.jsx("input",{placeholder:"my-relay",value:g.ssh,disabled:n,onChange:N=>C({...g,ssh:N.target.value})})]}),u.jsxs("label",{className:"nc-field",children:[k("device-name-label"),u.jsx("input",{placeholder:L||"NexusCrew",value:g.localLabel,disabled:n,onChange:N=>C({...g,localLabel:N.target.value})}),u.jsx("small",{className:"nc-set-hint",children:k("device-name-hint")})]}),u.jsxs("label",{className:"nc-field",children:[k("pairing-link"),u.jsx("input",{placeholder:"http://127.0.0.1:…/#pair=…",value:g.pairingUrl,disabled:n,onChange:N=>C({...g,pairingUrl:N.target.value})}),u.jsx("input",{id:"nc-pair-scan",type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:async N=>{const W=N.target.files&&N.target.files[0];if(W){try{const O=await Be.scanImage(W);C(j=>({...j,pairingUrl:O}))}catch{h(k("pairing-qr-invalid"))}N.target.value=""}}}),u.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{var N;return(N=document.getElementById("nc-pair-scan"))==null?void 0:N.click()},children:k("scan-qr")})]}),u.jsx("div",{className:"nc-sheet-actions",children:u.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||f==="add",title:n?k("settings-readonly"):"",onClick:P,children:k("add")})})]}),u.jsxs("div",{className:"nc-set-form",children:[u.jsx("div",{className:"nc-sheet-label",children:k("invite-node")}),u.jsxs("label",{className:"nc-field",children:[k("device-name-label"),u.jsx("input",{placeholder:L||"NexusCrew",value:F,disabled:n,onChange:N=>U(N.target.value)}),u.jsx("small",{className:"nc-set-hint",children:k("device-name-hint")})]}),u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||!!f,onClick:async()=>{m("invite");try{E(await s0(e,F?{label:F}:{}))}catch(N){h(String(N.message||N))}m(null)},children:k("create-pairing-link")}),x&&u.jsxs(u.Fragment,{children:[u.jsx(eb,{value:x.pairingUrl}),u.jsx(ZC,{text:x.pairingUrl})]})]}),l&&u.jsx("div",{className:"nc-err",children:l})]})}function ib({token:e,readonly:t}){const[r,n]=I.useState("idle"),[a,l]=I.useState(!1),[h,f]=I.useState(null);I.useEffect(()=>{let p=!1;return WC().then(S=>{p||n(S)}),()=>{p=!0}},[]);const m=async()=>{f(null),l(!0);try{r==="subscribed"?(await UC(e),n("idle")):(await $C(e),n("subscribed"))}catch(p){const S=String(p.message||p);S==="push-denied"?(n("denied"),f(k("push-denied"))):S==="push-unsupported"?(n("unsupported"),f(k("push-unsupported"))):f(S)}l(!1)};return r==="unsupported"?u.jsx("div",{className:"nc-set-info",children:k("push-unsupported")}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"nc-set-row",children:[u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||a||r==="denied",title:t?k("settings-readonly"):"",onClick:m,children:k(r==="subscribed"?"push-disable":"push-enable")}),u.jsx("span",{className:"nc-set-info",children:k(r==="subscribed"?"push-on":r==="denied"?"push-denied":"push-off")})]}),h&&u.jsx("div",{className:"nc-err",children:h})]})}function rb({token:e,settings:t,readonly:r}){const[n,a]=I.useState(null),[l,h]=I.useState(null),[f,m]=I.useState(!1),[p,S]=I.useState(!1),g=async()=>{a(null),h(null),S(!0);try{const y=await r0(e);h(y.note||"ok"),m(!1)}catch(y){a(String(y.message||y))}S(!1)},C=async()=>{a(null),h(null),S(!0);try{const y=await a0(e);h(`${y.note||"ok"}${y.target?` (${y.target})`:""}`)}catch(y){a(String(y.message||y))}S(!1)},v=t&&t.service;return u.jsxs("div",{className:"nc-set-tab",children:[t&&u.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,u.jsx("br",{}),v&&v.installed?k("service-installed"):k("service-missing"),v&&v.installed?` · ${v.active?k("service-active"):k("service-inactive")}`:"",v?` · boot ${v.boot?"on":"off"}`:""]}),u.jsxs("div",{className:"nc-set-row",children:[u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||p,title:r?k("settings-readonly"):"",onClick:()=>{a(null),h(null),m(!0)},children:k("token-rotate")}),u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||p,title:r?k("settings-readonly"):"",onClick:C,children:k("service-regenerate")})]}),u.jsx(ib,{token:e,readonly:r}),f&&u.jsxs("div",{className:"nc-set-confirm",children:[u.jsx("div",{children:k("token-rotate-explain")}),u.jsxs("div",{className:"nc-sheet-actions",children:[u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:p,onClick:()=>m(!1),children:k("cancel")}),u.jsx("button",{type:"button",className:"nc-btn primary",disabled:p,onClick:g,children:k("confirm")})]})]}),l&&u.jsx("div",{className:"nc-set-note",children:l}),n&&u.jsx("div",{className:"nc-err",children:n})]})}function sb({token:e,onClose:t}){Yt();const[r,n]=I.useState("nodes"),[a,l]=I.useState(null),[h,f]=I.useState([]),[m,p]=I.useState(!1),[S,g]=I.useState(null),C=uu(e),v=I.useCallback(async()=>{try{const y=await v_(e);l(y),g(null)}catch(y){g(String(y.message||y))}try{const y=await y_(e);f(y.nodes||[])}catch(y){g(String(y.message||y))}},[e]);return I.useEffect(()=>{v();const y=setInterval(v,5e3);return()=>clearInterval(y)},[v]),I.useEffect(()=>{let y=!1;return wt("/api/config",e).then(x=>x.json()).then(x=>{y||p(!!x.readonlyDefault)}).catch(()=>{}),()=>{y=!0}},[e]),u.jsx("div",{className:"nc-set-overlay",onClick:t,children:u.jsxs("div",{className:"nc-set-panel",onClick:y=>y.stopPropagation(),children:[u.jsxs("div",{className:"nc-set-head",children:[u.jsx(Fe,{name:"gear",size:18}),u.jsx("b",{children:k("settings")}),u.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:k("close"),children:u.jsx(Fe,{name:"x",size:18})})]}),m&&u.jsx("div",{className:"nc-set-readonly",children:k("settings-readonly")}),S&&u.jsx("div",{className:"nc-err",children:S}),u.jsx("div",{className:"nc-set-tabs",children:["nodes","fleet","system"].map(y=>u.jsx("button",{type:"button",className:`nc-set-tabbtn${r===y?" on":""}`,onClick:()=>n(y),children:k(`tab-${y}`)},y))}),u.jsxs("div",{className:"nc-set-body",children:[r==="nodes"&&u.jsx(tb,{token:e,nodes:h,settings:a,readonly:m,refresh:v}),r==="fleet"&&u.jsx(GC,{token:e,readonly:m,targets:C.filter(y=>y.status==="up").map(y=>({route:y.route,label:y.label||y.name}))}),r==="system"&&u.jsx(rb,{token:e,settings:a,readonly:m})]})]})})}function nb({token:e,initialPair:t,onPairDone:r,onDone:n}){Yt();const[a,l]=I.useState(t?"pair":"welcome"),[h,f]=I.useState({name:"",label:"",ssh:"",pairingUrl:t||"",localLabel:""}),[m,p]=I.useState(!1),[S,g]=I.useState(!1),[C,v]=I.useState(null),y=async()=>{g(!0),v(null);try{await i0(e,{wizardDone:!0}),r&&r(),n()}catch(U){v(String(U.message||U)),g(!1)}},x=U=>f(M=>({...M,label:U,name:m?M.name:Bg(U)})),E=U=>{p(!0),f(M=>({...M,name:U}))},F=async()=>{if(!h.name||!h.ssh||!h.pairingUrl)return v(k("pairing-required"));if(h.label&&!Ln(h.label)||h.localLabel&&!Ln(h.localLabel))return v(k("err-label"));g(!0),v(null);try{await C_(e,{name:h.name,ssh:h.ssh,pairingUrl:h.pairingUrl,...h.label?{label:h.label}:{},localLabel:h.localLabel||void 0}),r&&r(),l("done")}catch(U){v(String(U.message||U))}g(!1)};return u.jsx("div",{className:"nc-wiz-overlay",children:u.jsxs("div",{className:"nc-wiz",children:[u.jsxs("div",{className:"nc-wiz-head",children:[u.jsx("b",{children:k("wizard-title")}),u.jsx("small",{children:k("hydra-simple")})]}),a==="welcome"&&u.jsxs("div",{className:"nc-wiz-body",children:[u.jsx("div",{className:"nc-wiz-done",children:k("local-ready")}),u.jsxs("div",{className:"nc-sheet-actions",children:[u.jsx("button",{className:"nc-btn ghost",disabled:S,onClick:y,children:k("local-only")}),u.jsx("button",{className:"nc-btn primary",disabled:S,onClick:()=>l("pair"),children:k("add-node")})]})]}),a==="pair"&&u.jsxs("div",{className:"nc-wiz-body",children:[u.jsxs("label",{className:"nc-field",children:[k("node-display-label"),u.jsx("input",{value:h.label,onChange:U=>x(U.target.value),placeholder:"VPS3"})]}),u.jsxs("label",{className:"nc-field",children:[k("node-name-label"),u.jsx("input",{value:h.name,onChange:U=>E(U.target.value),placeholder:k("node-name-ph")})]}),u.jsxs("label",{className:"nc-field",children:[k("node-ssh-label"),u.jsx("input",{value:h.ssh,onChange:U=>f({...h,ssh:U.target.value}),placeholder:"my-relay"})]}),u.jsxs("label",{className:"nc-field",children:[k("device-name-label"),u.jsx("input",{value:h.localLabel,onChange:U=>f({...h,localLabel:U.target.value}),placeholder:"NexusCrew"}),u.jsx("small",{className:"nc-set-hint",children:k("device-name-hint")})]}),u.jsxs("label",{className:"nc-field",children:[k("pairing-link"),u.jsx("input",{value:h.pairingUrl,onChange:U=>f({...h,pairingUrl:U.target.value}),placeholder:"http://127.0.0.1:…/#pair=…"})]}),u.jsxs("div",{className:"nc-sheet-actions",children:[u.jsx("button",{className:"nc-btn ghost",disabled:S,onClick:()=>{r&&r(),l("welcome")},children:k("back")}),u.jsx("button",{className:"nc-btn primary",disabled:S,onClick:F,children:k("connect")})]})]}),a==="done"&&u.jsxs("div",{className:"nc-wiz-body",children:[u.jsx("div",{className:"nc-wiz-done",children:k("node-connected")}),u.jsx("div",{className:"nc-sheet-actions",children:u.jsx("button",{className:"nc-btn primary",disabled:S,onClick:y,children:k("finish")})})]}),C&&u.jsx("div",{className:"nc-err",children:C})]})})}function ob(e,t){if(typeof EventSource>"u"||!e)return()=>{};const r=new EventSource(`/api/events?token=${encodeURIComponent(e)}`);return r.onmessage=n=>{try{const a=JSON.parse(n.data);a&&typeof a=="object"&&typeof a.type=="string"&&t(a)}catch{}},()=>{try{r.close()}catch{}}}const ab=6e3,lb=12e3;function cb({n:e,onClose:t}){return u.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[u.jsxs("div",{className:"nc-ntf-toast-txt",children:[u.jsx("b",{children:e.title}),e.body&&u.jsx("small",{children:e.body}),e.session&&u.jsx("span",{className:"nc-ntf-from",children:e.session})]}),u.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:k("close"),children:u.jsx(Fe,{name:"x",size:14})})]})}function hb({ask:e,token:t,onAnswered:r}){const[n,a]=I.useState(""),[l,h]=I.useState(!1),[f,m]=I.useState(null),p=async S=>{const g=String(S||"").trim();if(!(!g||l)){m(null),h(!0);try{await c0(t,e.id,g),r(e.id)}catch(C){m(String(C.message||C))}h(!1)}};return u.jsxs("div",{className:"nc-ask-card",children:[u.jsxs("div",{className:"nc-ask-head",children:[u.jsx("span",{className:"nc-ntf-from",children:e.session}),u.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),u.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&u.jsx("div",{className:"nc-ask-opts",children:e.options.map(S=>u.jsx("button",{type:"button",className:"nc-btn ghost",disabled:l,onClick:()=>p(S),children:S},S))}),u.jsxs("div",{className:"nc-ask-reply",children:[u.jsx("textarea",{rows:2,placeholder:k("ask-reply-ph"),value:n,disabled:l,onChange:S=>a(S.target.value)}),u.jsx("button",{type:"button",className:"nc-btn primary",disabled:l||!n.trim(),onClick:()=>p(n),children:k("send")})]}),f&&u.jsx("div",{className:"nc-err",children:f})]})}function ub({token:e}){Yt();const[t,r]=I.useState([]),[n,a]=I.useState([]),[l,h]=I.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),f=I.useRef(0),m=I.useCallback(g=>{r(C=>C.filter(v=>v.key!==g))},[]),p=I.useCallback(g=>{const C=`t${f.current+=1}`;r(v=>[...v.slice(-3),{...g,key:C}]),setTimeout(()=>m(C),g.urgency==="high"?lb:ab)},[m]);I.useEffect(()=>{if(!e)return;let g=!1;l0(e).then(v=>{g||a(v.asks||[])}).catch(()=>{});const C=ob(e,v=>{v.type==="notify"?p(v):v.type==="ask"&&v.ask&&v.ask.id?a(y=>y.some(x=>x.id===v.ask.id)?y:[...y,v.ask]):v.type==="ask-answered"&&v.id&&a(y=>y.filter(x=>x.id!==v.id))});return()=>{g=!0,C()}},[e,p]);const S=g=>a(C=>C.filter(v=>v.id!==g));return u.jsxs(u.Fragment,{children:[t.length>0&&u.jsx("div",{className:"nc-ntf-toasts",children:t.map(g=>u.jsx(cb,{n:g,onClose:()=>m(g.key)},g.key))}),n.length>0&&!l&&u.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>h(!0),title:k("asks-title"),children:["? ",u.jsx("span",{className:"nc-ask-count",children:n.length})]}),n.length>0&&l&&u.jsxs("div",{className:"nc-ask-panel",children:[u.jsxs("div",{className:"nc-ask-panel-head",children:[u.jsx("b",{children:k("asks-title")}),u.jsx("span",{className:"nc-ask-count",children:n.length}),u.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>h(!1),title:k("close"),children:u.jsx(Fe,{name:"x",size:16})})]}),u.jsx("div",{className:"nc-ask-panel-body",children:n.map(g=>u.jsx(hb,{ask:g,token:e,onAnswered:S},g.id))})]})]})}const ch=e=>Gi(Ur(e)).length===0;function db(e,t,r,n){const[a,l]=I.useState([]),[h,f]=I.useState(!1),[m,p]=I.useState("idle"),[S,g]=I.useState(""),C=I.useRef([]),v=I.useRef(r),y=I.useRef(!1),x=I.useRef(!0);v.current=r,C.current=a;const E=I.useCallback((A,K=!0)=>{C.current=A,l(A);const P=A.find(N=>N.name===t);K&&P&&(x.current=!0,n(Ur(P.layout)),hC(t,P.layout)),cC(A.map(N=>N.name))},[t,n]),F=I.useCallback(async()=>{let A=await xc(e);const K=A.decks.find(P=>P.name==="main");if(A.decks.length===1&&K&&K.revision===0&&ch(K.layout)){const P=lC(),N=Ur(Jh("main")||Ca());if(!ch(N)){const W=await Go(e,"main",N,0);A.decks[0]=W}for(const W of P.filter(O=>O!=="main"))try{let O=await Cp(e,W);const j=Ur(Jh(W)||Ca());ch(j)||(O=await Go(e,W,j,O.revision)),A.decks.push(O)}catch{}A=await xc(e)}E(A.decks,!0),f(!0),g("")},[e,E]);I.useEffect(()=>{e&&F().catch(A=>g(String(A.message||A)))},[F,e]);const U=I.useCallback(async()=>{if(!h)return;const A=C.current.find(K=>K.name===t);if(!A)return g(`deck inesistente: ${t}`);p("saving");try{const K=await Go(e,t,Ur(v.current),A.revision);E(C.current.map(P=>P.name===t?K:P),!1),y.current=!1,p("saved"),g(""),setTimeout(()=>p("idle"),1500)}catch(K){p("error"),g(String(K.message||K)),K.status===409&&K.data&&K.data.current&&E(C.current.map(P=>P.name===t?K.data.current:P),!1)}},[h,t,e,E]);I.useEffect(()=>{if(!h)return;if(x.current){x.current=!1;return}y.current=!0,p("saving");const A=setTimeout(U,650);return()=>clearTimeout(A)},[r,h,U]),I.useEffect(()=>{if(!h)return;const A=setInterval(async()=>{try{const K=await xc(e),P=C.current.find(O=>O.name===t),N=K.decks.find(O=>O.name===t),W=N&&(!P||N.revision>P.revision);E(K.decks,W&&!y.current)}catch{}},5e3);return()=>clearInterval(A)},[h,e,t,E]);const M=async A=>{const K=await Cp(e,A);return E([...C.current,K],!1),K},L=async(A,K)=>{const P=C.current.find(W=>W.name===A);if(!P)throw new Error("deck inesistente");const N=await h0(e,A,K,P.revision);return E(C.current.map(W=>W.name===A?N:W),!1),N},G=async A=>{const K=C.current.find(P=>P.name===A);if(!K)throw new Error("deck inesistente");await u0(e,A,K.revision),E(C.current.filter(P=>P.name!==A),!1)},$=async(A,K)=>{const P=C.current.find(W=>W.name===A);if(!P)throw new Error("deck inesistente");const N=await Go(e,A,Eg(Ur(P.layout),K),P.revision);return E(C.current.map(W=>W.name===A?N:W),!1),N};return{decks:a.map(A=>A.name),records:a,ready:h,saveState:m,error:S,setError:g,saveNow:U,add:M,rename:L,remove:G,addTileTo:$}}const fb="/sw.js",eu="nc-sw-update";let tu=null,iu=!1,ru=null,Ag=Object.freeze({needed:!1,kind:null,version:""}),Ig=!1;function Og(){typeof window<"u"&&window.dispatchEvent(new Event(eu))}function zg(){const e=ru||(iu?{kind:"reload",version:""}:null);Ag=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function o_(){return Ag}function pb(e){return typeof window>"u"?()=>{}:(window.addEventListener(eu,e),()=>window.removeEventListener(eu,e))}function Eu(e){iu!==e&&(iu=e,zg(),Og())}function mb(e,t,r){let n=null;e&&t&&e!==t?n={kind:"install",version:e}:t&&r&&t!==r&&(n={kind:"reload",version:t});const a=JSON.stringify(n)===JSON.stringify(ru);ru=n,zg(),a||Og()}function _b(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&Eu(!0)})}function gb(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{Ig&&location.reload()}),navigator.serviceWorker.register(fb).then(e=>{tu=e,e.waiting&&Eu(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&_b(t)}),setInterval(()=>{e.update().catch(()=>{})},3600*1e3)}).catch(()=>{}))}function vb(){Ig=!0,Eu(!1);const e=tu&&tu.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}function yb({hash:e="",origin:t="",pathname:r="",search:n=""}={}){const a=String(e||"").replace(/^#/,""),l=`${r||""}${n||""}`;if(!a)return{token:"",pair:"",nextUrl:l};const h=new URLSearchParams(a),f=h.get("token")||"",m=h.get("pair")||"",p=m?`${t||""}${r||""}#pair=${m}`:"";return{token:f,pair:p,nextUrl:l}}const Fg=9,Hg=24,Wg="nc_side_w",a_="nc_side_min",Sb=240,l_="(min-width:1024px) and (pointer:fine)";function wb(){const e=Number(localStorage.getItem(Wg));return e>=180&&e<=480?e:Sb}function Cb(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=Fg&&e<=Hg?e:13}function bb(){const e={token:"",pair:""};try{const{token:t,pair:r,nextUrl:n}=yb({hash:location.hash,origin:location.origin,pathname:location.pathname,search:location.search});if(t){e.token=t;try{localStorage.setItem("nc_token",t)}catch{}}if(r){e.pair=r;try{sessionStorage.setItem("nc_pair",r)}catch{}}if(location.hash)try{history.replaceState(null,"",n)}catch{}}catch{}if(e.token||(e.token=sessionStorage.getItem("nc_token")||localStorage.getItem("nc_token")||""),!e.pair){const t=sessionStorage.getItem("nc_pair");t&&(e.pair=t)}return e}function xb(e){try{return Ur(Jh(e))}catch{return Ca()}}function c_(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 kb(){const[e,t]=I.useState(()=>window.matchMedia(l_).matches);return I.useEffect(()=>{const r=window.matchMedia(l_),n=a=>t(a.matches);return r.addEventListener("change",n),()=>r.removeEventListener("change",n)},[]),e}function h_({session:e,node:t,token:r,readonly:n=!1,onBack:a}){Yt();const[l,h]=I.useState(!1),[f,m]=I.useState(()=>window.matchMedia("(pointer: coarse)").matches),[p,S]=I.useState(null),[g,C]=I.useState(Cb),[v,y]=I.useState(""),x=K=>C(P=>{const N=Math.max(Fg,Math.min(Hg,P+K));return localStorage.setItem("nc_fontsize",String(N)),N}),E=I.useRef(()=>{}),F=I.useRef(()=>{}),U=I.useRef(!1),[M,L]=I.useState(!1),[G,$]=I.useState(!1),A=()=>{U.current=!U.current,L(U.current)};return I.useEffect(()=>{let K=!0;const P=t?t.split("/"):[],N=t?`/api/route/${t.split("/").map(encodeURIComponent).join("/")}/_`:"/api";async function W(){let j=null,B=null;try{const ee=await(await wt(`${N}/sessions`,r)).json();Array.isArray(ee.sessions)&&(j=ee.sessions.find(b=>b.name===e))}catch{}try{const Q=await Rs(r,P);Q.available&&Array.isArray(Q.cells)&&(B=Q.cells.find(ee=>ee.tmuxSession===e))}catch{}if(!K)return;let V="";B?V=`${B.engine}${B.key?`·${B.key}`:""}`:j&&(V=j.attached?`attached · ${c_(j.activity)}`:j.activity?c_(j.activity):""),y(V)}W();const O=setInterval(W,4e3);return()=>{K=!1,clearInterval(O)}},[e,t,r]),u.jsxs("div",{className:"nc-app",children:[u.jsxs("header",{className:"nc-bar nc-bar-single",children:[u.jsxs("button",{onClick:a,title:k("sessions"),children:[u.jsx(Fe,{name:"chevronLeft",size:18}),u.jsx("span",{className:"nc-bar-label",children:k("sessions")})]}),u.jsxs("span",{className:"nc-bar-center",children:[u.jsx("b",{children:t?`${t}:${e}`:e}),v&&u.jsx("small",{className:"nc-bar-sub",children:v})]}),u.jsxs("span",{className:"nc-bar-right",children:[u.jsx("button",{onClick:()=>x(-1),title:k("zoom-out"),children:u.jsx(Fe,{name:"zoomOut",size:18})}),u.jsx("button",{onClick:()=>x(1),title:k("zoom-in"),children:u.jsx(Fe,{name:"zoomIn",size:18})}),u.jsx("button",{onClick:()=>m(K=>!K),title:k("composer"),children:u.jsx(Fe,{name:"keyboard",size:20})}),u.jsx("button",{onClick:()=>h(K=>!K),title:k("files"),children:u.jsx(Fe,{name:"folder",size:20})})]})]}),u.jsx("div",{className:"nc-termwrap",children:u.jsx(wg,{session:e,node:t,token:r,readonly:n,takeSize:!0,sendRef:E,actionRef:F,ctrlRef:U,setCtrlArmed:L,onFiles:S,fontSize:g,selectionMode:G,onSelectionModeChange:$})}),u.jsx(F1,{onKeyboard:()=>m(K=>!K),send:K=>E.current(K),action:K=>F.current(K),ctrlArmed:M,onCtrl:A,selectionMode:G,onSelectionMode:$}),f&&u.jsx(bg,{send:K=>E.current(K),token:r,session:e,node:t}),l&&u.jsx(Cg,{session:e,node:t,token:r,filesEvent:p,onClose:()=>h(!1)})]})}function Eb(){Yt();const[e]=I.useState(bb),[t,r]=I.useState(e.token),[n,a]=I.useState(e.pair||""),l=I.useCallback(()=>{a("");try{sessionStorage.removeItem("nc_pair")}catch{}},[]),[h,f]=I.useState(!1),m=kb(),[p]=I.useState(()=>aC(typeof location<"u"?location.pathname:"/")),S=p===ti,[g,C]=I.useState(null),v=he=>C(wa(he)),[y,x]=I.useState([]),[E,F]=I.useState([]),[U,M]=I.useState([]),[L,G]=I.useState(()=>xb(p)),$=db(t,p,L,G),A=$.decks.length?$.decks:[ti],[K,P]=I.useState(null),[N,W]=I.useState(null),O=he=>W(wa(he)),j=uu(t,m),[B,V]=I.useState(null),[Q,ee]=I.useState(!1),[b,Z]=I.useState(!1),[te,R]=I.useState(["shell","claude","codex-vl","pi"]),[T,ne]=I.useState(wb),[ce,ue]=I.useState(!S),[ge,Ce]=I.useState(()=>S?localStorage.getItem(a_)==="1":!0),[be,xe]=I.useState(!1),[Oe,Y]=I.useState(!1),[ye,me]=I.useState(!1);I.useEffect(()=>{try{localStorage.setItem(Wg,String(T))}catch{}},[T]),I.useEffect(()=>{try{localStorage.setItem(a_,ge?"1":"")}catch{}},[ge]),I.useEffect(()=>{if(!t)return;let he=!1;return Promise.all([v_(t),wt("/api/config",t).then(De=>De.json())]).then(([De,_i])=>{he||(me(!!_i.readonlyDefault),(De.firstRun===!0&&!_i.readonlyDefault||n)&&Y(!0))}).catch(()=>{}),()=>{he=!0}},[t,n]);const He=I.useCallback(async()=>{try{const De=await(await wt("/api/sessions",t)).json();De.error||x(De.sessions||[])}catch{}try{const he=await Rs(t);F(he.available?he.cells||[]:[]),M(he.available?he.engines||[]:[])}catch{F([]),M([])}},[t]);I.useEffect(()=>{if(!m)return;He();const he=setInterval(He,4e3);return()=>clearInterval(he)},[m,He]),I.useEffect(()=>{let he=!1;return wt("/api/config",t).then(De=>De.json()).then(De=>{!he&&Array.isArray(De.presets)&&De.presets.length&&R(De.presets),he||mb(De.version,De.uiVersion,"0.8.4")}).catch(()=>{}),()=>{he=!0}},[t]);const Me=new Set([...y.map(he=>he.name),...j.flatMap(he=>he.sessions.map(De=>De.key))]),Nr=Gi(L),Zi=he=>G(De=>Eg(De,he)),ii=async(he,De=[])=>{try{await lu(t,he,De)}catch{return}const _i=De.length?`${De.join("/")}:${he}`:he;G(Ls=>xa(Ls,_i)),He()},ri=async he=>{if(!B)return;const{cell:De}=B,_i=Array.isArray(B.route)?B.route:[];he.action==="up"?await ou(t,{cell:De,engine:he.engine,model:he.model||"",boot:!!he.boot},_i):await au(t,{cell:De,boot:!!he.boot},_i),He()},si=async(he,De=[])=>{await __(t,he,De),He()},zt=async he=>{if(!(!(he!=null&&he.direct)||Q)){ee(!0);try{await cu(t,he.name,he.tunnelStatus==="up"?"down":"up")}finally{ee(!1)}}},pe=he=>{try{const De=window.open(sa(he,t),"_blank");return De&&(De.opener=null),!!De}catch{return!1}},Ae=he=>location.assign(sa(he,t)),bt=async he=>{await $.add(he),Ae(he)},Tt=async(he,De)=>{await $.rename(he,De),he===p&&location.assign(sa(De,t))},ni=async he=>{await $.remove(he),he===p&&location.assign(sa(ti,t))},Ei=async(he,De)=>{!De||De===p||(await $.addTileTo(De,he),G(_i=>xa(_i,he)))};if(!t)return u.jsxs("div",{className:"nc-auth",children:[u.jsx("p",{children:k("auth-prompt")}),u.jsx("input",{onChange:he=>r(he.target.value.trim()),placeholder:"token"}),u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:h,onChange:he=>f(he.target.checked)})," ",k("remember-device")]}),u.jsx("button",{onClick:()=>{(h?localStorage:sessionStorage).setItem("nc_token",t)},children:"ok"})]});const er=u.jsxs(u.Fragment,{children:[be&&u.jsx(sb,{token:t,onClose:()=>xe(!1)}),Oe&&u.jsx(nb,{token:t,initialPair:n,onPairDone:l,onDone:()=>Y(!1)}),u.jsx(ub,{token:t})]});if(!m)return g?u.jsxs(u.Fragment,{children:[u.jsx(h_,{session:g.session,node:g.node,token:t,readonly:ye,onBack:()=>C(null)}),er]}):u.jsxs(u.Fragment,{children:[u.jsx(S0,{onPick:v,token:t,onSettings:()=>xe(!0)}),er]});const Fn=S||!ce;return u.jsxs("div",{className:"nc-workspace",children:[!S&&u.jsx("button",{className:"nc-side-show",title:k("toggle-sidebar"),onClick:()=>ue(he=>!he),children:"☰"}),Fn&&u.jsx(q1,{sessions:y,cells:E,activeSessions:Nr,nodeGroups:j,onPick:O,onAddTile:Zi,onPower:V,onNodePower:zt,onKill:ii,onNew:()=>Z(!0),onSettings:()=>xe(!0),width:T,collapsed:ge,onResize:ne,onToggleCollapse:()=>Ce(he=>!he)}),u.jsxs("div",{className:"nc-workspace-main",children:[u.jsx(uC,{decks:A,currentDeck:p,onCreate:bt,onRename:Tt,onDelete:ni,onOpenWindow:pe,onNavigate:Ae,saveState:$.saveState,error:$.error}),u.jsx(rC,{layout:L,onLayoutChange:G,token:t,readonly:ye,sessionsAlive:Me,focusSession:K,onFocus:P,onOpenSingle:O,decks:A,currentDeck:p,onSendToDeck:Ei})]}),N&&u.jsx("div",{className:"nc-single-overlay",children:u.jsx(h_,{session:N.session,node:N.node,token:t,readonly:ye,onBack:()=>W(null)})}),B&&u.jsx(D_,{cell:B,engines:B.availableEngines||U,onConfirm:ri,onClose:()=>V(null)}),b&&u.jsx(M_,{presets:te,targets:j.filter(he=>he.status==="up").map(he=>({route:he.route,label:he.label||he.name})),token:t,onCreate:si,onClose:()=>Z(!1)}),er]})}function Nb(){Yt();const e=I.useSyncExternalStore(pb,o_,o_);if(!e.needed)return null;const t=e.kind==="install"?k("install-version-mismatch").replace("{v}",e.version):k("update-available").replace("{v}",e.version).replace(" "," ").trim();return u.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[u.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&u.jsx("button",{className:"nc-update-btn",onClick:vb,children:k("reload")})]})}gb();Yy.createRoot(document.getElementById("root")).render(u.jsxs(Hy.StrictMode,{children:[u.jsx(Eb,{}),u.jsx(Nb,{})]}));
|