@mmmbuto/nexuscrew 0.8.4 → 0.8.6
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 +55 -24
- package/frontend/dist/assets/index-CEFh0hI4.js +90 -0
- package/frontend/dist/assets/{index-COsoJxXQ.css → index-kX5IUxt4.css} +2 -2
- package/frontend/dist/index.html +2 -2
- package/frontend/dist/version.json +1 -1
- package/lib/cli/fleet-service.js +8 -3
- package/lib/fleet/builtin.js +146 -23
- package/lib/fleet/definitions.js +20 -0
- package/lib/fleet/index.js +42 -1
- package/lib/fleet/managed.js +63 -30
- package/lib/fleet/provider.js +12 -11
- package/lib/fleet/routes.js +20 -4
- package/lib/nodes/peering.js +59 -7
- package/lib/nodes/store.js +2 -2
- package/lib/settings/routes.js +22 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-C1AFIaRR.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 u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).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 ch(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xc={exports:{}},mn={},kc={exports:{}},Me={};/**
|
|
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 gp;function Uy(){if(gp)return Me;gp=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"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.iterator;function S(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(){}},C=Object.assign,N={};function k(R,E,ee){this.props=R,this.context=E,this.refs=N,this.updater=ee||v}k.prototype.isReactComponent={},k.prototype.setState=function(R,E){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,E,"setState")},k.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function P(){}P.prototype=k.prototype;function F(R,E,ee){this.props=R,this.context=E,this.refs=N,this.updater=ee||v}var B=F.prototype=new P;B.constructor=F,C(B,k.prototype),B.isPureReactComponent=!0;var H=Array.isArray,Y=Object.prototype.hasOwnProperty,$={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function U(R,E,ee){var M,j={},se=null,ce=null;if(E!=null)for(M in E.ref!==void 0&&(ce=E.ref),E.key!==void 0&&(se=""+E.key),E)Y.call(E,M)&&!L.hasOwnProperty(M)&&(j[M]=E[M]);var oe=arguments.length-2;if(oe===1)j.children=ee;else if(1<oe){for(var pe=Array(oe),Ne=0;Ne<oe;Ne++)pe[Ne]=arguments[Ne+2];j.children=pe}if(R&&R.defaultProps)for(M in oe=R.defaultProps,oe)j[M]===void 0&&(j[M]=oe[M]);return{$$typeof:e,type:R,key:se,ref:ce,props:j,_owner:$.current}}function T(R,E){return{$$typeof:e,type:R.type,key:E,ref:R.ref,props:R.props,_owner:R._owner}}function K(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function q(R){var E={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ee){return E[ee]})}var A=/\/+/g;function O(R,E){return typeof R=="object"&&R!==null&&R.key!=null?q(""+R.key):E.toString(36)}function G(R,E,ee,M,j){var se=typeof R;(se==="undefined"||se==="boolean")&&(R=null);var ce=!1;if(R===null)ce=!0;else switch(se){case"string":case"number":ce=!0;break;case"object":switch(R.$$typeof){case e:case t:ce=!0}}if(ce)return ce=R,j=j(ce),R=M===""?"."+O(ce,0):M,H(j)?(ee="",R!=null&&(ee=R.replace(A,"$&/")+"/"),G(j,E,ee,"",function(Ne){return Ne})):j!=null&&(K(j)&&(j=T(j,ee+(!j.key||ce&&ce.key===j.key?"":(""+j.key).replace(A,"$&/")+"/")+R)),E.push(j)),1;if(ce=0,M=M===""?".":M+":",H(R))for(var oe=0;oe<R.length;oe++){se=R[oe];var pe=M+O(se,oe);ce+=G(se,E,ee,pe,j)}else if(pe=S(R),typeof pe=="function")for(R=pe.call(R),oe=0;!(se=R.next()).done;)se=se.value,pe=M+O(se,oe++),ce+=G(se,E,ee,pe,j);else if(se==="object")throw E=String(R),Error("Objects are not valid as a React child (found: "+(E==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":E)+"). If you meant to render a collection of children, use an array instead.");return ce}function Z(R,E,ee){if(R==null)return R;var M=[],j=0;return G(R,M,"","",function(se){return E.call(ee,se,j++)}),M}function ie(R){if(R._status===-1){var E=R._result;E=E(),E.then(function(ee){(R._status===0||R._status===-1)&&(R._status=1,R._result=ee)},function(ee){(R._status===0||R._status===-1)&&(R._status=2,R._result=ee)}),R._status===-1&&(R._status=0,R._result=E)}if(R._status===1)return R._result.default;throw R._result}var Q={current:null},x={transition:null},X={ReactCurrentDispatcher:Q,ReactCurrentBatchConfig:x,ReactCurrentOwner:$};function re(){throw Error("act(...) is not supported in production builds of React.")}return Me.Children={map:Z,forEach:function(R,E,ee){Z(R,function(){E.apply(this,arguments)},ee)},count:function(R){var E=0;return Z(R,function(){E++}),E},toArray:function(R){return Z(R,function(E){return E})||[]},only:function(R){if(!K(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},Me.Component=k,Me.Fragment=r,Me.Profiler=a,Me.PureComponent=F,Me.StrictMode=n,Me.Suspense=m,Me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=X,Me.act=re,Me.cloneElement=function(R,E,ee){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var M=C({},R.props),j=R.key,se=R.ref,ce=R._owner;if(E!=null){if(E.ref!==void 0&&(se=E.ref,ce=$.current),E.key!==void 0&&(j=""+E.key),R.type&&R.type.defaultProps)var oe=R.type.defaultProps;for(pe in E)Y.call(E,pe)&&!L.hasOwnProperty(pe)&&(M[pe]=E[pe]===void 0&&oe!==void 0?oe[pe]:E[pe])}var pe=arguments.length-2;if(pe===1)M.children=ee;else if(1<pe){oe=Array(pe);for(var Ne=0;Ne<pe;Ne++)oe[Ne]=arguments[Ne+2];M.children=oe}return{$$typeof:e,type:R.type,key:j,ref:se,props:M,_owner:ce}},Me.createContext=function(R){return R={$$typeof:u,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},R.Provider={$$typeof:l,_context:R},R.Consumer=R},Me.createElement=U,Me.createFactory=function(R){var E=U.bind(null,R);return E.type=R,E},Me.createRef=function(){return{current:null}},Me.forwardRef=function(R){return{$$typeof:f,render:R}},Me.isValidElement=K,Me.lazy=function(R){return{$$typeof:y,_payload:{_status:-1,_result:R},_init:ie}},Me.memo=function(R,E){return{$$typeof:p,type:R,compare:E===void 0?null:E}},Me.startTransition=function(R){var E=x.transition;x.transition={};try{R()}finally{x.transition=E}},Me.unstable_act=re,Me.useCallback=function(R,E){return Q.current.useCallback(R,E)},Me.useContext=function(R){return Q.current.useContext(R)},Me.useDebugValue=function(){},Me.useDeferredValue=function(R){return Q.current.useDeferredValue(R)},Me.useEffect=function(R,E){return Q.current.useEffect(R,E)},Me.useId=function(){return Q.current.useId()},Me.useImperativeHandle=function(R,E,ee){return Q.current.useImperativeHandle(R,E,ee)},Me.useInsertionEffect=function(R,E){return Q.current.useInsertionEffect(R,E)},Me.useLayoutEffect=function(R,E){return Q.current.useLayoutEffect(R,E)},Me.useMemo=function(R,E){return Q.current.useMemo(R,E)},Me.useReducer=function(R,E,ee){return Q.current.useReducer(R,E,ee)},Me.useRef=function(R){return Q.current.useRef(R)},Me.useState=function(R){return Q.current.useState(R)},Me.useSyncExternalStore=function(R,E,ee){return Q.current.useSyncExternalStore(R,E,ee)},Me.useTransition=function(){return Q.current.useTransition()},Me.version="18.3.1",Me}var vp;function uh(){return vp||(vp=1,kc.exports=Uy()),kc.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 yp;function Ky(){if(yp)return mn;yp=1;var e=uh(),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 u(f,m,p){var y,g={},S=null,v=null;p!==void 0&&(S=""+p),m.key!==void 0&&(S=""+m.key),m.ref!==void 0&&(v=m.ref);for(y in m)n.call(m,y)&&!l.hasOwnProperty(y)&&(g[y]=m[y]);if(f&&f.defaultProps)for(y in m=f.defaultProps,m)g[y]===void 0&&(g[y]=m[y]);return{$$typeof:t,type:f,key:S,ref:v,props:g,_owner:a.current}}return mn.Fragment=r,mn.jsx=u,mn.jsxs=u,mn}var Sp;function qy(){return Sp||(Sp=1,xc.exports=Ky()),xc.exports}var h=qy(),I=uh();const Vy=ch(I);var Go={},Ec={exports:{}},Wt={},Nc={exports:{}},Rc={};/**
|
|
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 wp;function Yy(){return wp||(wp=1,(function(e){function t(x,X){var re=x.length;x.push(X);e:for(;0<re;){var R=re-1>>>1,E=x[R];if(0<a(E,X))x[R]=X,x[re]=E,re=R;else break e}}function r(x){return x.length===0?null:x[0]}function n(x){if(x.length===0)return null;var X=x[0],re=x.pop();if(re!==X){x[0]=re;e:for(var R=0,E=x.length,ee=E>>>1;R<ee;){var M=2*(R+1)-1,j=x[M],se=M+1,ce=x[se];if(0>a(j,re))se<E&&0>a(ce,j)?(x[R]=ce,x[se]=re,R=se):(x[R]=j,x[M]=re,R=M);else if(se<E&&0>a(ce,re))x[R]=ce,x[se]=re,R=se;else break e}}return X}function a(x,X){var re=x.sortIndex-X.sortIndex;return re!==0?re:x.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var m=[],p=[],y=1,g=null,S=3,v=!1,C=!1,N=!1,k=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function B(x){for(var X=r(p);X!==null;){if(X.callback===null)n(p);else if(X.startTime<=x)n(p),X.sortIndex=X.expirationTime,t(m,X);else break;X=r(p)}}function H(x){if(N=!1,B(x),!C)if(r(m)!==null)C=!0,ie(Y);else{var X=r(p);X!==null&&Q(H,X.startTime-x)}}function Y(x,X){C=!1,N&&(N=!1,P(U),U=-1),v=!0;var re=S;try{for(B(X),g=r(m);g!==null&&(!(g.expirationTime>X)||x&&!q());){var R=g.callback;if(typeof R=="function"){g.callback=null,S=g.priorityLevel;var E=R(g.expirationTime<=X);X=e.unstable_now(),typeof E=="function"?g.callback=E:g===r(m)&&n(m),B(X)}else n(m);g=r(m)}if(g!==null)var ee=!0;else{var M=r(p);M!==null&&Q(H,M.startTime-X),ee=!1}return ee}finally{g=null,S=re,v=!1}}var $=!1,L=null,U=-1,T=5,K=-1;function q(){return!(e.unstable_now()-K<T)}function A(){if(L!==null){var x=e.unstable_now();K=x;var X=!0;try{X=L(!0,x)}finally{X?O():($=!1,L=null)}}else $=!1}var O;if(typeof F=="function")O=function(){F(A)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,Z=G.port2;G.port1.onmessage=A,O=function(){Z.postMessage(null)}}else O=function(){k(A,0)};function ie(x){L=x,$||($=!0,O())}function Q(x,X){U=k(function(){x(e.unstable_now())},X)}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(x){x.callback=null},e.unstable_continueExecution=function(){C||v||(C=!0,ie(Y))},e.unstable_forceFrameRate=function(x){0>x||125<x?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<x?Math.floor(1e3/x):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_getFirstCallbackNode=function(){return r(m)},e.unstable_next=function(x){switch(S){case 1:case 2:case 3:var X=3;break;default:X=S}var re=S;S=X;try{return x()}finally{S=re}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(x,X){switch(x){case 1:case 2:case 3:case 4:case 5:break;default:x=3}var re=S;S=x;try{return X()}finally{S=re}},e.unstable_scheduleCallback=function(x,X,re){var R=e.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?R+re:R):re=R,x){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=re+E,x={id:y++,callback:X,priorityLevel:x,startTime:re,expirationTime:E,sortIndex:-1},re>R?(x.sortIndex=re,t(p,x),r(m)===null&&x===r(p)&&(N?(P(U),U=-1):N=!0,Q(H,re-R))):(x.sortIndex=E,t(m,x),C||v||(C=!0,ie(Y))),x},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(x){var X=S;return function(){var re=S;S=X;try{return x.apply(this,arguments)}finally{S=re}}}})(Rc)),Rc}var Cp;function Xy(){return Cp||(Cp=1,Nc.exports=Yy()),Nc.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 bp;function Gy(){if(bp)return Wt;bp=1;var e=uh(),t=Xy();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){u(i,s),u(i+"Capture",s)}function u(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]*$/,y={},g={};function S(i){return m.call(g,i)?!0:m.call(y,i)?!1:p.test(i)?g[i]=!0:(y[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 C(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 N(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 k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){k[i]=new N(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var s=i[0];k[s]=new N(s,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){k[i]=new N(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){k[i]=new N(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){k[i]=new N(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){k[i]=new N(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){k[i]=new N(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){k[i]=new N(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){k[i]=new N(i,5,!1,i.toLowerCase(),null,!1,!1)});var P=/[\-:]([a-z])/g;function F(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(P,F);k[s]=new N(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(P,F);k[s]=new N(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(P,F);k[s]=new N(s,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){k[i]=new N(i,1,!1,i.toLowerCase(),null,!1,!1)}),k.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){k[i]=new N(i,1,!1,i.toLowerCase(),null,!0,!0)});function B(i,s,o,c){var d=k.hasOwnProperty(s)?k[s]:null;(d!==null?d.type!==0:c||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(C(s,o,d,c)&&(o=null),c||d===null?S(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 H=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Y=Symbol.for("react.element"),$=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),K=Symbol.for("react.provider"),q=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),Q=Symbol.for("react.offscreen"),x=Symbol.iterator;function X(i){return i===null||typeof i!="object"?null:(i=x&&i[x]||i["@@iterator"],typeof i=="function"?i:null)}var re=Object.assign,R;function E(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 ee=!1;function M(i,s){if(!i||ee)return"";ee=!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(te){var c=te}Reflect.construct(i,[],s)}else{try{s.call()}catch(te){c=te}i.call(s.prototype)}else{try{throw Error()}catch(te){c=te}i()}}catch(te){if(te&&c&&typeof te.stack=="string"){for(var d=te.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{ee=!1,Error.prepareStackTrace=o}return(i=i?i.displayName||i.name:"")?E(i):""}function j(i){switch(i.tag){case 5:return E(i.type);case 16:return E("Lazy");case 13:return E("Suspense");case 19:return E("SuspenseList");case 0:case 2:case 15:return i=M(i.type,!1),i;case 11:return i=M(i.type.render,!1),i;case 1:return i=M(i.type,!0),i;default:return""}}function se(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 L:return"Fragment";case $:return"Portal";case T:return"Profiler";case U:return"StrictMode";case O:return"Suspense";case G:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case q:return(i.displayName||"Context")+".Consumer";case K:return(i._context.displayName||"Context")+".Provider";case A:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Z:return s=i.displayName||null,s!==null?s:se(i.type)||"Memo";case ie:s=i._payload,i=i._init;try{return se(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 se(s);case 8:return s===U?"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 oe(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function pe(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Ne(i){var s=pe(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 ot(i){i._valueTracker||(i._valueTracker=Ne(i))}function Ge(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var o=s.getValue(),c="";return i&&(c=pe(i)?i.checked?"true":"false":i.value),i=c,i!==o?(s.setValue(i),!0):!1}function ye(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 ti(i,s){var o=s.checked;return re({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??i._wrapperState.initialChecked})}function gi(i,s){var o=s.defaultValue==null?"":s.defaultValue,c=s.checked!=null?s.checked:s.defaultChecked;o=oe(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 Rr(i,s){s=s.checked,s!=null&&B(i,"checked",s,!1)}function Zi(i,s){Rr(i,s);var o=oe(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,oe(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"||ye(i.ownerDocument)!==i)&&(o==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+o&&(i.defaultValue=""+o))}var si=Array.isArray;function It(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=""+oe(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 ge(i,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return re({},s,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function Be(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:oe(o)}}function wt(i,s){var o=oe(s.value),c=oe(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 Mt(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,Hn=(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 fe(i,s){if(s){var o=i.firstChild;if(o&&o===i.lastChild&&o.nodeType===3){o.nodeValue=s;return}}i.textContent=s}var Re={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},qt=["Webkit","ms","Moz","O"];Object.keys(Re).forEach(function(i){qt.forEach(function(s){s=s+i.charAt(0).toUpperCase()+i.substring(1),Re[s]=Re[i]})});function Ms(i,s,o){return s==null||typeof s=="boolean"||s===""?"":o||typeof s!="number"||s===0||Re.hasOwnProperty(i)&&Re[i]?(""+s).trim():s+"px"}function Lh(i,s){i=i.style;for(var o in s)if(s.hasOwnProperty(o)){var c=o.indexOf("--")===0,d=Ms(o,s[o],c);o==="float"&&(o="cssFloat"),c?i.setProperty(o,d):i[o]=d}}var Xg=re({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 Aa(i,s){if(s){if(Xg[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 Ia(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 Oa=null;function za(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Fa=null,es=null,ts=null;function Th(i){if(i=Zs(i)){if(typeof Fa!="function")throw Error(r(280));var s=i.stateNode;s&&(s=uo(s),Fa(i.stateNode,i.type,s))}}function Bh(i){es?ts?ts.push(i):ts=[i]:es=i}function jh(){if(es){var i=es,s=ts;if(ts=es=null,Th(i),s)for(i=0;i<s.length;i++)Th(s[i])}}function Ah(i,s){return i(s)}function Ih(){}var Ha=!1;function Oh(i,s,o){if(Ha)return i(s,o);Ha=!0;try{return Ah(i,s,o)}finally{Ha=!1,(es!==null||ts!==null)&&(Ih(),jh())}}function Ls(i,s){var o=i.stateNode;if(o===null)return null;var c=uo(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 $a=!1;if(f)try{var Ts={};Object.defineProperty(Ts,"passive",{get:function(){$a=!0}}),window.addEventListener("test",Ts,Ts),window.removeEventListener("test",Ts,Ts)}catch{$a=!1}function Gg(i,s,o,c,d,_,w,D,z){var te=Array.prototype.slice.call(arguments,3);try{s.apply(o,te)}catch(le){this.onError(le)}}var Bs=!1,$n=null,Wn=!1,Wa=null,Qg={onError:function(i){Bs=!0,$n=i}};function Jg(i,s,o,c,d,_,w,D,z){Bs=!1,$n=null,Gg.apply(Qg,arguments)}function Zg(i,s,o,c,d,_,w,D,z){if(Jg.apply(this,arguments),Bs){if(Bs){var te=$n;Bs=!1,$n=null}else throw Error(r(198));Wn||(Wn=!0,Wa=te)}}function Pr(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 zh(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 Fh(i){if(Pr(i)!==i)throw Error(r(188))}function ev(i){var s=i.alternate;if(!s){if(s=Pr(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 Fh(d),i;if(_===c)return Fh(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 Hh(i){return i=ev(i),i!==null?$h(i):null}function $h(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var s=$h(i);if(s!==null)return s;i=i.sibling}return null}var Wh=t.unstable_scheduleCallback,Uh=t.unstable_cancelCallback,tv=t.unstable_shouldYield,iv=t.unstable_requestPaint,et=t.unstable_now,rv=t.unstable_getCurrentPriorityLevel,Ua=t.unstable_ImmediatePriority,Kh=t.unstable_UserBlockingPriority,Un=t.unstable_NormalPriority,sv=t.unstable_LowPriority,qh=t.unstable_IdlePriority,Kn=null,Ni=null;function nv(i){if(Ni&&typeof Ni.onCommitFiberRoot=="function")try{Ni.onCommitFiberRoot(Kn,i,void 0,(i.current.flags&128)===128)}catch{}}var vi=Math.clz32?Math.clz32:lv,ov=Math.log,av=Math.LN2;function lv(i){return i>>>=0,i===0?32:31-(ov(i)/av|0)|0}var qn=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 Yn(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-vi(s),d=1<<o,c|=i[o],s&=~d;return c}function cv(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 uv(i,s){for(var o=i.suspendedLanes,c=i.pingedLanes,d=i.expirationTimes,_=i.pendingLanes;0<_;){var w=31-vi(_),D=1<<w,z=d[w];z===-1?((D&o)===0||(D&c)!==0)&&(d[w]=cv(D,s)):z<=s&&(i.expiredLanes|=D),_&=~D}}function Ka(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function Vh(){var i=qn;return qn<<=1,(qn&4194240)===0&&(qn=64),i}function qa(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-vi(s),i[s]=o}function hv(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-vi(o),_=1<<d;s[d]=0,c[d]=-1,i[d]=-1,o&=~_}}function Va(i,s){var o=i.entangledLanes|=s;for(i=i.entanglements;o;){var c=31-vi(o),d=1<<c;d&s|i[c]&s&&(i[c]|=s),o&=~d}}var Oe=0;function Yh(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var Xh,Ya,Gh,Qh,Jh,Xa=!1,Xn=[],tr=null,ir=null,rr=null,Is=new Map,Os=new Map,sr=[],dv="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 Zh(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&&Ya(s)),i):(i.eventSystemFlags|=c,s=i.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),i)}function fv(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 ed(i){var s=Dr(i.target);if(s!==null){var o=Pr(s);if(o!==null){if(s=o.tag,s===13){if(s=zh(o),s!==null){i.blockedOn=s,Jh(i.priority,function(){Gh(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 Gn(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var o=Qa(i.domEventName,i.eventSystemFlags,s[0],i.nativeEvent);if(o===null){o=i.nativeEvent;var c=new o.constructor(o.type,o);Oa=c,o.target.dispatchEvent(c),Oa=null}else return s=Zs(o),s!==null&&Ya(s),i.blockedOn=o,!1;s.shift()}return!0}function td(i,s,o){Gn(i)&&o.delete(s)}function pv(){Xa=!1,tr!==null&&Gn(tr)&&(tr=null),ir!==null&&Gn(ir)&&(ir=null),rr!==null&&Gn(rr)&&(rr=null),Is.forEach(td),Os.forEach(td)}function Fs(i,s){i.blockedOn===s&&(i.blockedOn=null,Xa||(Xa=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,pv)))}function Hs(i){function s(d){return Fs(d,i)}if(0<Xn.length){Fs(Xn[0],i);for(var o=1;o<Xn.length;o++){var c=Xn[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);)ed(o),o.blockedOn===null&&sr.shift()}var is=H.ReactCurrentBatchConfig,Qn=!0;function mv(i,s,o,c){var d=Oe,_=is.transition;is.transition=null;try{Oe=1,Ga(i,s,o,c)}finally{Oe=d,is.transition=_}}function _v(i,s,o,c){var d=Oe,_=is.transition;is.transition=null;try{Oe=4,Ga(i,s,o,c)}finally{Oe=d,is.transition=_}}function Ga(i,s,o,c){if(Qn){var d=Qa(i,s,o,c);if(d===null)pl(i,s,c,Jn,o),Zh(i,c);else if(fv(d,i,s,o,c))c.stopPropagation();else if(Zh(i,c),s&4&&-1<dv.indexOf(i)){for(;d!==null;){var _=Zs(d);if(_!==null&&Xh(_),_=Qa(i,s,o,c),_===null&&pl(i,s,c,Jn,o),_===d)break;d=_}d!==null&&c.stopPropagation()}else pl(i,s,c,null,o)}}var Jn=null;function Qa(i,s,o,c){if(Jn=null,i=za(c),i=Dr(i),i!==null)if(s=Pr(i),s===null)i=null;else if(o=s.tag,o===13){if(i=zh(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 Jn=i,null}function id(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(rv()){case Ua:return 1;case Kh:return 4;case Un:case sv:return 16;case qh:return 536870912;default:return 16}default:return 16}}var nr=null,Ja=null,Zn=null;function rd(){if(Zn)return Zn;var i,s=Ja,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 Zn=d.slice(i,1<c?1-c:void 0)}function eo(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 to(){return!0}function sd(){return!1}function Vt(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)?to:sd,this.isPropagationStopped=sd,this}return re(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=to)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=to)},persist:function(){},isPersistent:to}),s}var rs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Za=Vt(rs),$s=re({},rs,{view:0,detail:0}),gv=Vt($s),el,tl,Ws,io=re({},$s,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rl,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!==Ws&&(Ws&&i.type==="mousemove"?(el=i.screenX-Ws.screenX,tl=i.screenY-Ws.screenY):tl=el=0,Ws=i),el)},movementY:function(i){return"movementY"in i?i.movementY:tl}}),nd=Vt(io),vv=re({},io,{dataTransfer:0}),yv=Vt(vv),Sv=re({},$s,{relatedTarget:0}),il=Vt(Sv),wv=re({},rs,{animationName:0,elapsedTime:0,pseudoElement:0}),Cv=Vt(wv),bv=re({},rs,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),xv=Vt(bv),kv=re({},rs,{data:0}),od=Vt(kv),Ev={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nv={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"},Rv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pv(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=Rv[i])?!!s[i]:!1}function rl(){return Pv}var Dv=re({},$s,{key:function(i){if(i.key){var s=Ev[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=eo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Nv[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rl,charCode:function(i){return i.type==="keypress"?eo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?eo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Mv=Vt(Dv),Lv=re({},io,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ad=Vt(Lv),Tv=re({},$s,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rl}),Bv=Vt(Tv),jv=re({},rs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Av=Vt(jv),Iv=re({},io,{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}),Ov=Vt(Iv),zv=[9,13,27,32],sl=f&&"CompositionEvent"in window,Us=null;f&&"documentMode"in document&&(Us=document.documentMode);var Fv=f&&"TextEvent"in window&&!Us,ld=f&&(!sl||Us&&8<Us&&11>=Us),cd=" ",ud=!1;function hd(i,s){switch(i){case"keyup":return zv.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dd(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ss=!1;function Hv(i,s){switch(i){case"compositionend":return dd(s);case"keypress":return s.which!==32?null:(ud=!0,cd);case"textInput":return i=s.data,i===cd&&ud?null:i;default:return null}}function $v(i,s){if(ss)return i==="compositionend"||!sl&&hd(i,s)?(i=rd(),Zn=Ja=nr=null,ss=!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 ld&&s.locale!=="ko"?null:s.data;default:return null}}var Wv={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 fd(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!Wv[i.type]:s==="textarea"}function pd(i,s,o,c){Bh(c),s=ao(s,"onChange"),0<s.length&&(o=new Za("onChange","change",null,o,c),i.push({event:o,listeners:s}))}var Ks=null,qs=null;function Uv(i){Ld(i,0)}function ro(i){var s=cs(i);if(Ge(s))return i}function Kv(i,s){if(i==="change")return s}var md=!1;if(f){var nl;if(f){var ol="oninput"in document;if(!ol){var _d=document.createElement("div");_d.setAttribute("oninput","return;"),ol=typeof _d.oninput=="function"}nl=ol}else nl=!1;md=nl&&(!document.documentMode||9<document.documentMode)}function gd(){Ks&&(Ks.detachEvent("onpropertychange",vd),qs=Ks=null)}function vd(i){if(i.propertyName==="value"&&ro(qs)){var s=[];pd(s,qs,i,za(i)),Oh(Uv,s)}}function qv(i,s,o){i==="focusin"?(gd(),Ks=s,qs=o,Ks.attachEvent("onpropertychange",vd)):i==="focusout"&&gd()}function Vv(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return ro(qs)}function Yv(i,s){if(i==="click")return ro(s)}function Xv(i,s){if(i==="input"||i==="change")return ro(s)}function Gv(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var yi=typeof Object.is=="function"?Object.is:Gv;function Vs(i,s){if(yi(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)||!yi(i[d],s[d]))return!1}return!0}function yd(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Sd(i,s){var o=yd(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=yd(o)}}function wd(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?wd(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function Cd(){for(var i=window,s=ye();s instanceof i.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)i=s.contentWindow;else break;s=ye(i.document)}return s}function al(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 Qv(i){var s=Cd(),o=i.focusedElem,c=i.selectionRange;if(s!==o&&o&&o.ownerDocument&&wd(o.ownerDocument.documentElement,o)){if(c!==null&&al(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=Sd(o,_);var w=Sd(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 Jv=f&&"documentMode"in document&&11>=document.documentMode,ns=null,ll=null,Ys=null,cl=!1;function bd(i,s,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;cl||ns==null||ns!==ye(c)||(c=ns,"selectionStart"in c&&al(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&&Vs(Ys,c)||(Ys=c,c=ao(ll,"onSelect"),0<c.length&&(s=new Za("onSelect","select",null,s,o),i.push({event:s,listeners:c}),s.target=ns)))}function so(i,s){var o={};return o[i.toLowerCase()]=s.toLowerCase(),o["Webkit"+i]="webkit"+s,o["Moz"+i]="moz"+s,o}var os={animationend:so("Animation","AnimationEnd"),animationiteration:so("Animation","AnimationIteration"),animationstart:so("Animation","AnimationStart"),transitionend:so("Transition","TransitionEnd")},ul={},xd={};f&&(xd=document.createElement("div").style,"AnimationEvent"in window||(delete os.animationend.animation,delete os.animationiteration.animation,delete os.animationstart.animation),"TransitionEvent"in window||delete os.transitionend.transition);function no(i){if(ul[i])return ul[i];if(!os[i])return i;var s=os[i],o;for(o in s)if(s.hasOwnProperty(o)&&o in xd)return ul[i]=s[o];return i}var kd=no("animationend"),Ed=no("animationiteration"),Nd=no("animationstart"),Rd=no("transitionend"),Pd=new Map,Dd="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){Pd.set(i,s),l(s,[i])}for(var hl=0;hl<Dd.length;hl++){var dl=Dd[hl],Zv=dl.toLowerCase(),ey=dl[0].toUpperCase()+dl.slice(1);or(Zv,"on"+ey)}or(kd,"onAnimationEnd"),or(Ed,"onAnimationIteration"),or(Nd,"onAnimationStart"),or("dblclick","onDoubleClick"),or("focusin","onFocus"),or("focusout","onBlur"),or(Rd,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("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(" "),ty=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xs));function Md(i,s,o){var c=i.type||"unknown-event";i.currentTarget=o,Zg(c,s,void 0,i),i.currentTarget=null}function Ld(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,te=D.currentTarget;if(D=D.listener,z!==_&&d.isPropagationStopped())break e;Md(d,D,te),_=z}else for(w=0;w<c.length;w++){if(D=c[w],z=D.instance,te=D.currentTarget,D=D.listener,z!==_&&d.isPropagationStopped())break e;Md(d,D,te),_=z}}}if(Wn)throw i=Wa,Wn=!1,Wa=null,i}function He(i,s){var o=s[Sl];o===void 0&&(o=s[Sl]=new Set);var c=i+"__bubble";o.has(c)||(Td(s,i,2,!1),o.add(c))}function fl(i,s,o){var c=0;s&&(c|=4),Td(o,i,c,s)}var oo="_reactListening"+Math.random().toString(36).slice(2);function Gs(i){if(!i[oo]){i[oo]=!0,n.forEach(function(o){o!=="selectionchange"&&(ty.has(o)||fl(o,!1,i),fl(o,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[oo]||(s[oo]=!0,fl("selectionchange",!1,s))}}function Td(i,s,o,c){switch(id(s)){case 1:var d=mv;break;case 4:d=_v;break;default:d=Ga}o=d.bind(null,s,o,i),d=void 0,!$a||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 pl(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}Oh(function(){var te=_,le=za(o),ue=[];e:{var ae=Pd.get(i);if(ae!==void 0){var _e=Za,Se=i;switch(i){case"keypress":if(eo(o)===0)break e;case"keydown":case"keyup":_e=Mv;break;case"focusin":Se="focus",_e=il;break;case"focusout":Se="blur",_e=il;break;case"beforeblur":case"afterblur":_e=il;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":_e=nd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_e=yv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_e=Bv;break;case kd:case Ed:case Nd:_e=Cv;break;case Rd:_e=Av;break;case"scroll":_e=gv;break;case"wheel":_e=Ov;break;case"copy":case"cut":case"paste":_e=xv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_e=ad}var we=(s&4)!==0,tt=!we&&i==="scroll",V=we?ae!==null?ae+"Capture":null:ae;we=[];for(var W=te,J;W!==null;){J=W;var he=J.stateNode;if(J.tag===5&&he!==null&&(J=he,V!==null&&(he=Ls(W,V),he!=null&&we.push(Qs(W,he,J)))),tt)break;W=W.return}0<we.length&&(ae=new _e(ae,Se,null,o,le),ue.push({event:ae,listeners:we}))}}if((s&7)===0){e:{if(ae=i==="mouseover"||i==="pointerover",_e=i==="mouseout"||i==="pointerout",ae&&o!==Oa&&(Se=o.relatedTarget||o.fromElement)&&(Dr(Se)||Se[Fi]))break e;if((_e||ae)&&(ae=le.window===le?le:(ae=le.ownerDocument)?ae.defaultView||ae.parentWindow:window,_e?(Se=o.relatedTarget||o.toElement,_e=te,Se=Se?Dr(Se):null,Se!==null&&(tt=Pr(Se),Se!==tt||Se.tag!==5&&Se.tag!==6)&&(Se=null)):(_e=null,Se=te),_e!==Se)){if(we=nd,he="onMouseLeave",V="onMouseEnter",W="mouse",(i==="pointerout"||i==="pointerover")&&(we=ad,he="onPointerLeave",V="onPointerEnter",W="pointer"),tt=_e==null?ae:cs(_e),J=Se==null?ae:cs(Se),ae=new we(he,W+"leave",_e,o,le),ae.target=tt,ae.relatedTarget=J,he=null,Dr(le)===te&&(we=new we(V,W+"enter",Se,o,le),we.target=J,we.relatedTarget=tt,he=we),tt=he,_e&&Se)t:{for(we=_e,V=Se,W=0,J=we;J;J=as(J))W++;for(J=0,he=V;he;he=as(he))J++;for(;0<W-J;)we=as(we),W--;for(;0<J-W;)V=as(V),J--;for(;W--;){if(we===V||V!==null&&we===V.alternate)break t;we=as(we),V=as(V)}we=null}else we=null;_e!==null&&Bd(ue,ae,_e,we,!1),Se!==null&&tt!==null&&Bd(ue,tt,Se,we,!0)}}e:{if(ae=te?cs(te):window,_e=ae.nodeName&&ae.nodeName.toLowerCase(),_e==="select"||_e==="input"&&ae.type==="file")var Ce=Kv;else if(fd(ae))if(md)Ce=Xv;else{Ce=Vv;var be=qv}else(_e=ae.nodeName)&&_e.toLowerCase()==="input"&&(ae.type==="checkbox"||ae.type==="radio")&&(Ce=Yv);if(Ce&&(Ce=Ce(i,te))){pd(ue,Ce,o,le);break e}be&&be(i,ae,te),i==="focusout"&&(be=ae._wrapperState)&&be.controlled&&ae.type==="number"&&ri(ae,"number",ae.value)}switch(be=te?cs(te):window,i){case"focusin":(fd(be)||be.contentEditable==="true")&&(ns=be,ll=te,Ys=null);break;case"focusout":Ys=ll=ns=null;break;case"mousedown":cl=!0;break;case"contextmenu":case"mouseup":case"dragend":cl=!1,bd(ue,o,le);break;case"selectionchange":if(Jv)break;case"keydown":case"keyup":bd(ue,o,le)}var xe;if(sl)e:{switch(i){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else ss?hd(i,o)&&(ke="onCompositionEnd"):i==="keydown"&&o.keyCode===229&&(ke="onCompositionStart");ke&&(ld&&o.locale!=="ko"&&(ss||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&ss&&(xe=rd()):(nr=le,Ja="value"in nr?nr.value:nr.textContent,ss=!0)),be=ao(te,ke),0<be.length&&(ke=new od(ke,i,null,o,le),ue.push({event:ke,listeners:be}),xe?ke.data=xe:(xe=dd(o),xe!==null&&(ke.data=xe)))),(xe=Fv?Hv(i,o):$v(i,o))&&(te=ao(te,"onBeforeInput"),0<te.length&&(le=new od("onBeforeInput","beforeinput",null,o,le),ue.push({event:le,listeners:te}),le.data=xe))}Ld(ue,s)})}function Qs(i,s,o){return{instance:i,listener:s,currentTarget:o}}function ao(i,s){for(var o=s+"Capture",c=[];i!==null;){var d=i,_=d.stateNode;d.tag===5&&_!==null&&(d=_,_=Ls(i,o),_!=null&&c.unshift(Qs(i,_,d)),_=Ls(i,s),_!=null&&c.push(Qs(i,_,d))),i=i.return}return c}function as(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function Bd(i,s,o,c,d){for(var _=s._reactName,w=[];o!==null&&o!==c;){var D=o,z=D.alternate,te=D.stateNode;if(z!==null&&z===c)break;D.tag===5&&te!==null&&(D=te,d?(z=Ls(o,_),z!=null&&w.unshift(Qs(o,z,D))):d||(z=Ls(o,_),z!=null&&w.push(Qs(o,z,D)))),o=o.return}w.length!==0&&i.push({event:s,listeners:w})}var iy=/\r\n?/g,ry=/\u0000|\uFFFD/g;function jd(i){return(typeof i=="string"?i:""+i).replace(iy,`
|
|
38
|
+
`).replace(ry,"")}function lo(i,s,o){if(s=jd(s),jd(i)!==s&&o)throw Error(r(425))}function co(){}var ml=null,_l=null;function gl(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 vl=typeof setTimeout=="function"?setTimeout:void 0,sy=typeof clearTimeout=="function"?clearTimeout:void 0,Ad=typeof Promise=="function"?Promise:void 0,ny=typeof queueMicrotask=="function"?queueMicrotask:typeof Ad<"u"?function(i){return Ad.resolve(null).then(i).catch(oy)}:vl;function oy(i){setTimeout(function(){throw i})}function yl(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 Id(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 ls=Math.random().toString(36).slice(2),Ri="__reactFiber$"+ls,Js="__reactProps$"+ls,Fi="__reactContainer$"+ls,Sl="__reactEvents$"+ls,ay="__reactListeners$"+ls,ly="__reactHandles$"+ls;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=Id(i);i!==null;){if(o=i[Ri])return o;i=Id(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 cs(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(r(33))}function uo(i){return i[Js]||null}var wl=[],us=-1;function lr(i){return{current:i}}function $e(i){0>us||(i.current=wl[us],wl[us]=null,us--)}function Fe(i,s){us++,wl[us]=i.current,i.current=s}var cr={},Et=lr(cr),Ot=lr(!1),Mr=cr;function hs(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 zt(i){return i=i.childContextTypes,i!=null}function ho(){$e(Ot),$e(Et)}function Od(i,s,o){if(Et.current!==cr)throw Error(r(168));Fe(Et,s),Fe(Ot,o)}function zd(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 re({},o,c)}function fo(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||cr,Mr=Et.current,Fe(Et,i),Fe(Ot,Ot.current),!0}function Fd(i,s,o){var c=i.stateNode;if(!c)throw Error(r(169));o?(i=zd(i,s,Mr),c.__reactInternalMemoizedMergedChildContext=i,$e(Ot),$e(Et),Fe(Et,i)):$e(Ot),Fe(Ot,o)}var Hi=null,po=!1,Cl=!1;function Hd(i){Hi===null?Hi=[i]:Hi.push(i)}function cy(i){po=!0,Hd(i)}function ur(){if(!Cl&&Hi!==null){Cl=!0;var i=0,s=Oe;try{var o=Hi;for(Oe=1;i<o.length;i++){var c=o[i];do c=c(!0);while(c!==null)}Hi=null,po=!1}catch(d){throw Hi!==null&&(Hi=Hi.slice(i+1)),Wh(Ua,ur),d}finally{Oe=s,Cl=!1}}return null}var ds=[],fs=0,mo=null,_o=0,oi=[],ai=0,Lr=null,$i=1,Wi="";function Tr(i,s){ds[fs++]=_o,ds[fs++]=mo,mo=i,_o=s}function $d(i,s,o){oi[ai++]=$i,oi[ai++]=Wi,oi[ai++]=Lr,Lr=i;var c=$i;i=Wi;var d=32-vi(c)-1;c&=~(1<<d),o+=1;var _=32-vi(s)+d;if(30<_){var w=d-d%5;_=(c&(1<<w)-1).toString(32),c>>=w,d-=w,$i=1<<32-vi(s)+d|o<<d|c,Wi=_+i}else $i=1<<_|o<<d|c,Wi=i}function bl(i){i.return!==null&&(Tr(i,1),$d(i,1,0))}function xl(i){for(;i===mo;)mo=ds[--fs],ds[fs]=null,_o=ds[--fs],ds[fs]=null;for(;i===Lr;)Lr=oi[--ai],oi[ai]=null,Wi=oi[--ai],oi[ai]=null,$i=oi[--ai],oi[ai]=null}var Yt=null,Xt=null,Ue=!1,Si=null;function Wd(i,s){var o=hi(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 Ud(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,Yt=i,Xt=ar(s.firstChild),!0):!1;case 6:return s=i.pendingProps===""||s.nodeType!==3?null:s,s!==null?(i.stateNode=s,Yt=i,Xt=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(o=Lr!==null?{id:$i,overflow:Wi}:null,i.memoizedState={dehydrated:s,treeContext:o,retryLane:1073741824},o=hi(18,null,null,0),o.stateNode=s,o.return=i,i.child=o,Yt=i,Xt=null,!0):!1;default:return!1}}function kl(i){return(i.mode&1)!==0&&(i.flags&128)===0}function El(i){if(Ue){var s=Xt;if(s){var o=s;if(!Ud(i,s)){if(kl(i))throw Error(r(418));s=ar(o.nextSibling);var c=Yt;s&&Ud(i,s)?Wd(c,o):(i.flags=i.flags&-4097|2,Ue=!1,Yt=i)}}else{if(kl(i))throw Error(r(418));i.flags=i.flags&-4097|2,Ue=!1,Yt=i}}}function Kd(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;Yt=i}function go(i){if(i!==Yt)return!1;if(!Ue)return Kd(i),Ue=!0,!1;var s;if((s=i.tag!==3)&&!(s=i.tag!==5)&&(s=i.type,s=s!=="head"&&s!=="body"&&!gl(i.type,i.memoizedProps)),s&&(s=Xt)){if(kl(i))throw qd(),Error(r(418));for(;s;)Wd(i,s),s=ar(s.nextSibling)}if(Kd(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){Xt=ar(i.nextSibling);break e}s--}else o!=="$"&&o!=="$!"&&o!=="$?"||s++}i=i.nextSibling}Xt=null}}else Xt=Yt?ar(i.stateNode.nextSibling):null;return!0}function qd(){for(var i=Xt;i;)i=ar(i.nextSibling)}function ps(){Xt=Yt=null,Ue=!1}function Nl(i){Si===null?Si=[i]:Si.push(i)}var uy=H.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 vo(i,s){throw i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i))}function Vd(i){var s=i._init;return s(i._payload)}function Yd(i){function s(V,W){if(i){var J=V.deletions;J===null?(V.deletions=[W],V.flags|=16):J.push(W)}}function o(V,W){if(!i)return null;for(;W!==null;)s(V,W),W=W.sibling;return null}function c(V,W){for(V=new Map;W!==null;)W.key!==null?V.set(W.key,W):V.set(W.index,W),W=W.sibling;return V}function d(V,W){return V=vr(V,W),V.index=0,V.sibling=null,V}function _(V,W,J){return V.index=J,i?(J=V.alternate,J!==null?(J=J.index,J<W?(V.flags|=2,W):J):(V.flags|=2,W)):(V.flags|=1048576,W)}function w(V){return i&&V.alternate===null&&(V.flags|=2),V}function D(V,W,J,he){return W===null||W.tag!==6?(W=vc(J,V.mode,he),W.return=V,W):(W=d(W,J),W.return=V,W)}function z(V,W,J,he){var Ce=J.type;return Ce===L?le(V,W,J.props.children,he,J.key):W!==null&&(W.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ie&&Vd(Ce)===W.type)?(he=d(W,J.props),he.ref=en(V,W,J),he.return=V,he):(he=$o(J.type,J.key,J.props,null,V.mode,he),he.ref=en(V,W,J),he.return=V,he)}function te(V,W,J,he){return W===null||W.tag!==4||W.stateNode.containerInfo!==J.containerInfo||W.stateNode.implementation!==J.implementation?(W=yc(J,V.mode,he),W.return=V,W):(W=d(W,J.children||[]),W.return=V,W)}function le(V,W,J,he,Ce){return W===null||W.tag!==7?(W=Hr(J,V.mode,he,Ce),W.return=V,W):(W=d(W,J),W.return=V,W)}function ue(V,W,J){if(typeof W=="string"&&W!==""||typeof W=="number")return W=vc(""+W,V.mode,J),W.return=V,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case Y:return J=$o(W.type,W.key,W.props,null,V.mode,J),J.ref=en(V,null,W),J.return=V,J;case $:return W=yc(W,V.mode,J),W.return=V,W;case ie:var he=W._init;return ue(V,he(W._payload),J)}if(si(W)||X(W))return W=Hr(W,V.mode,J,null),W.return=V,W;vo(V,W)}return null}function ae(V,W,J,he){var Ce=W!==null?W.key:null;if(typeof J=="string"&&J!==""||typeof J=="number")return Ce!==null?null:D(V,W,""+J,he);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case Y:return J.key===Ce?z(V,W,J,he):null;case $:return J.key===Ce?te(V,W,J,he):null;case ie:return Ce=J._init,ae(V,W,Ce(J._payload),he)}if(si(J)||X(J))return Ce!==null?null:le(V,W,J,he,null);vo(V,J)}return null}function _e(V,W,J,he,Ce){if(typeof he=="string"&&he!==""||typeof he=="number")return V=V.get(J)||null,D(W,V,""+he,Ce);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case Y:return V=V.get(he.key===null?J:he.key)||null,z(W,V,he,Ce);case $:return V=V.get(he.key===null?J:he.key)||null,te(W,V,he,Ce);case ie:var be=he._init;return _e(V,W,J,be(he._payload),Ce)}if(si(he)||X(he))return V=V.get(J)||null,le(W,V,he,Ce,null);vo(W,he)}return null}function Se(V,W,J,he){for(var Ce=null,be=null,xe=W,ke=W=0,pt=null;xe!==null&&ke<J.length;ke++){xe.index>ke?(pt=xe,xe=null):pt=xe.sibling;var Ae=ae(V,xe,J[ke],he);if(Ae===null){xe===null&&(xe=pt);break}i&&xe&&Ae.alternate===null&&s(V,xe),W=_(Ae,W,ke),be===null?Ce=Ae:be.sibling=Ae,be=Ae,xe=pt}if(ke===J.length)return o(V,xe),Ue&&Tr(V,ke),Ce;if(xe===null){for(;ke<J.length;ke++)xe=ue(V,J[ke],he),xe!==null&&(W=_(xe,W,ke),be===null?Ce=xe:be.sibling=xe,be=xe);return Ue&&Tr(V,ke),Ce}for(xe=c(V,xe);ke<J.length;ke++)pt=_e(xe,V,ke,J[ke],he),pt!==null&&(i&&pt.alternate!==null&&xe.delete(pt.key===null?ke:pt.key),W=_(pt,W,ke),be===null?Ce=pt:be.sibling=pt,be=pt);return i&&xe.forEach(function(yr){return s(V,yr)}),Ue&&Tr(V,ke),Ce}function we(V,W,J,he){var Ce=X(J);if(typeof Ce!="function")throw Error(r(150));if(J=Ce.call(J),J==null)throw Error(r(151));for(var be=Ce=null,xe=W,ke=W=0,pt=null,Ae=J.next();xe!==null&&!Ae.done;ke++,Ae=J.next()){xe.index>ke?(pt=xe,xe=null):pt=xe.sibling;var yr=ae(V,xe,Ae.value,he);if(yr===null){xe===null&&(xe=pt);break}i&&xe&&yr.alternate===null&&s(V,xe),W=_(yr,W,ke),be===null?Ce=yr:be.sibling=yr,be=yr,xe=pt}if(Ae.done)return o(V,xe),Ue&&Tr(V,ke),Ce;if(xe===null){for(;!Ae.done;ke++,Ae=J.next())Ae=ue(V,Ae.value,he),Ae!==null&&(W=_(Ae,W,ke),be===null?Ce=Ae:be.sibling=Ae,be=Ae);return Ue&&Tr(V,ke),Ce}for(xe=c(V,xe);!Ae.done;ke++,Ae=J.next())Ae=_e(xe,V,ke,Ae.value,he),Ae!==null&&(i&&Ae.alternate!==null&&xe.delete(Ae.key===null?ke:Ae.key),W=_(Ae,W,ke),be===null?Ce=Ae:be.sibling=Ae,be=Ae);return i&&xe.forEach(function(Wy){return s(V,Wy)}),Ue&&Tr(V,ke),Ce}function tt(V,W,J,he){if(typeof J=="object"&&J!==null&&J.type===L&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case Y:e:{for(var Ce=J.key,be=W;be!==null;){if(be.key===Ce){if(Ce=J.type,Ce===L){if(be.tag===7){o(V,be.sibling),W=d(be,J.props.children),W.return=V,V=W;break e}}else if(be.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ie&&Vd(Ce)===be.type){o(V,be.sibling),W=d(be,J.props),W.ref=en(V,be,J),W.return=V,V=W;break e}o(V,be);break}else s(V,be);be=be.sibling}J.type===L?(W=Hr(J.props.children,V.mode,he,J.key),W.return=V,V=W):(he=$o(J.type,J.key,J.props,null,V.mode,he),he.ref=en(V,W,J),he.return=V,V=he)}return w(V);case $:e:{for(be=J.key;W!==null;){if(W.key===be)if(W.tag===4&&W.stateNode.containerInfo===J.containerInfo&&W.stateNode.implementation===J.implementation){o(V,W.sibling),W=d(W,J.children||[]),W.return=V,V=W;break e}else{o(V,W);break}else s(V,W);W=W.sibling}W=yc(J,V.mode,he),W.return=V,V=W}return w(V);case ie:return be=J._init,tt(V,W,be(J._payload),he)}if(si(J))return Se(V,W,J,he);if(X(J))return we(V,W,J,he);vo(V,J)}return typeof J=="string"&&J!==""||typeof J=="number"?(J=""+J,W!==null&&W.tag===6?(o(V,W.sibling),W=d(W,J),W.return=V,V=W):(o(V,W),W=vc(J,V.mode,he),W.return=V,V=W),w(V)):o(V,W)}return tt}var ms=Yd(!0),Xd=Yd(!1),yo=lr(null),So=null,_s=null,Rl=null;function Pl(){Rl=_s=So=null}function Dl(i){var s=yo.current;$e(yo),i._currentValue=s}function Ml(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 gs(i,s){So=i,Rl=_s=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&s)!==0&&(Ft=!0),i.firstContext=null)}function li(i){var s=i._currentValue;if(Rl!==i)if(i={context:i,memoizedValue:s,next:null},_s===null){if(So===null)throw Error(r(308));_s=i,So.dependencies={lanes:0,firstContext:i}}else _s=_s.next=i;return s}var Br=null;function Ll(i){Br===null?Br=[i]:Br.push(i)}function Gd(i,s,o,c){var d=s.interleaved;return d===null?(o.next=o,Ll(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 hr=!1;function Tl(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Qd(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,(je&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,Ll(c)):(s.next=d.next,d.next=s),c.interleaved=s,Ui(i,o)}function wo(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,Va(i,o)}}function Jd(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 Co(i,s,o,c){var d=i.updateQueue;hr=!1;var _=d.firstBaseUpdate,w=d.lastBaseUpdate,D=d.shared.pending;if(D!==null){d.shared.pending=null;var z=D,te=z.next;z.next=null,w===null?_=te:w.next=te,w=z;var le=i.alternate;le!==null&&(le=le.updateQueue,D=le.lastBaseUpdate,D!==w&&(D===null?le.firstBaseUpdate=te:D.next=te,le.lastBaseUpdate=z))}if(_!==null){var ue=d.baseState;w=0,le=te=z=null,D=_;do{var ae=D.lane,_e=D.eventTime;if((c&ae)===ae){le!==null&&(le=le.next={eventTime:_e,lane:0,tag:D.tag,payload:D.payload,callback:D.callback,next:null});e:{var Se=i,we=D;switch(ae=s,_e=o,we.tag){case 1:if(Se=we.payload,typeof Se=="function"){ue=Se.call(_e,ue,ae);break e}ue=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=we.payload,ae=typeof Se=="function"?Se.call(_e,ue,ae):Se,ae==null)break e;ue=re({},ue,ae);break e;case 2:hr=!0}}D.callback!==null&&D.lane!==0&&(i.flags|=64,ae=d.effects,ae===null?d.effects=[D]:ae.push(D))}else _e={eventTime:_e,lane:ae,tag:D.tag,payload:D.payload,callback:D.callback,next:null},le===null?(te=le=_e,z=ue):le=le.next=_e,w|=ae;if(D=D.next,D===null){if(D=d.shared.pending,D===null)break;ae=D,D=ae.next,ae.next=null,d.lastBaseUpdate=ae,d.shared.pending=null}}while(!0);if(le===null&&(z=ue),d.baseState=z,d.firstBaseUpdate=te,d.lastBaseUpdate=le,s=d.shared.interleaved,s!==null){d=s;do w|=d.lane,d=d.next;while(d!==s)}else _===null&&(d.shared.lanes=0);Ir|=w,i.lanes=w,i.memoizedState=ue}}function Zd(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={},Pi=lr(tn),rn=lr(tn),sn=lr(tn);function jr(i){if(i===tn)throw Error(r(174));return i}function Bl(i,s){switch(Fe(sn,s),Fe(rn,i),Fe(Pi,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)}$e(Pi),Fe(Pi,s)}function vs(){$e(Pi),$e(rn),$e(sn)}function ef(i){jr(sn.current);var s=jr(Pi.current),o=Ei(s,i.type);s!==o&&(Fe(rn,i),Fe(Pi,o))}function jl(i){rn.current===i&&($e(Pi),$e(rn))}var qe=lr(0);function bo(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 Al=[];function Il(){for(var i=0;i<Al.length;i++)Al[i]._workInProgressVersionPrimary=null;Al.length=0}var xo=H.ReactCurrentDispatcher,Ol=H.ReactCurrentBatchConfig,Ar=0,Ve=null,at=null,dt=null,ko=!1,nn=!1,on=0,hy=0;function Nt(){throw Error(r(321))}function zl(i,s){if(s===null)return!1;for(var o=0;o<s.length&&o<i.length;o++)if(!yi(i[o],s[o]))return!1;return!0}function Fl(i,s,o,c,d,_){if(Ar=_,Ve=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,xo.current=i===null||i.memoizedState===null?my:_y,i=o(c,d),nn){_=0;do{if(nn=!1,on=0,25<=_)throw Error(r(301));_+=1,dt=at=null,s.updateQueue=null,xo.current=gy,i=o(c,d)}while(nn)}if(xo.current=Ro,s=at!==null&&at.next!==null,Ar=0,dt=at=Ve=null,ko=!1,s)throw Error(r(300));return i}function Hl(){var i=on!==0;return on=0,i}function Di(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Ve.memoizedState=dt=i:dt=dt.next=i,dt}function ci(){if(at===null){var i=Ve.alternate;i=i!==null?i.memoizedState:null}else i=at.next;var s=dt===null?Ve.memoizedState:dt.next;if(s!==null)dt=s,at=i;else{if(i===null)throw Error(r(310));at=i,i={memoizedState:at.memoizedState,baseState:at.baseState,baseQueue:at.baseQueue,queue:at.queue,next:null},dt===null?Ve.memoizedState=dt=i:dt=dt.next=i}return dt}function an(i,s){return typeof s=="function"?s(i):s}function $l(i){var s=ci(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var c=at,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,te=_;do{var le=te.lane;if((Ar&le)===le)z!==null&&(z=z.next={lane:0,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),c=te.hasEagerState?te.eagerState:i(c,te.action);else{var ue={lane:le,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null};z===null?(D=z=ue,w=c):z=z.next=ue,Ve.lanes|=le,Ir|=le}te=te.next}while(te!==null&&te!==_);z===null?w=c:z.next=D,yi(c,s.memoizedState)||(Ft=!0),s.memoizedState=c,s.baseState=w,s.baseQueue=z,o.lastRenderedState=c}if(i=o.interleaved,i!==null){d=i;do _=d.lane,Ve.lanes|=_,Ir|=_,d=d.next;while(d!==i)}else d===null&&(o.lanes=0);return[s.memoizedState,o.dispatch]}function Wl(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);yi(_,s.memoizedState)||(Ft=!0),s.memoizedState=_,s.baseQueue===null&&(s.baseState=_),o.lastRenderedState=_}return[_,c]}function tf(){}function rf(i,s){var o=Ve,c=ci(),d=s(),_=!yi(c.memoizedState,d);if(_&&(c.memoizedState=d,Ft=!0),c=c.queue,Ul(of.bind(null,o,c,i),[i]),c.getSnapshot!==s||_||dt!==null&&dt.memoizedState.tag&1){if(o.flags|=2048,ln(9,nf.bind(null,o,c,d,s),void 0,null),ft===null)throw Error(r(349));(Ar&30)!==0||sf(o,s,d)}return d}function sf(i,s,o){i.flags|=16384,i={getSnapshot:s,value:o},s=Ve.updateQueue,s===null?(s={lastEffect:null,stores:null},Ve.updateQueue=s,s.stores=[i]):(o=s.stores,o===null?s.stores=[i]:o.push(i))}function nf(i,s,o,c){s.value=o,s.getSnapshot=c,af(s)&&lf(i)}function of(i,s,o){return o(function(){af(s)&&lf(i)})}function af(i){var s=i.getSnapshot;i=i.value;try{var o=s();return!yi(i,o)}catch{return!0}}function lf(i){var s=Ui(i,1);s!==null&&xi(s,i,1,-1)}function cf(i){var s=Di();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=py.bind(null,Ve,i),[s.memoizedState,i]}function ln(i,s,o,c){return i={tag:i,create:s,destroy:o,deps:c,next:null},s=Ve.updateQueue,s===null?(s={lastEffect:null,stores:null},Ve.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 uf(){return ci().memoizedState}function Eo(i,s,o,c){var d=Di();Ve.flags|=i,d.memoizedState=ln(1|s,o,void 0,c===void 0?null:c)}function No(i,s,o,c){var d=ci();c=c===void 0?null:c;var _=void 0;if(at!==null){var w=at.memoizedState;if(_=w.destroy,c!==null&&zl(c,w.deps)){d.memoizedState=ln(s,o,_,c);return}}Ve.flags|=i,d.memoizedState=ln(1|s,o,_,c)}function hf(i,s){return Eo(8390656,8,i,s)}function Ul(i,s){return No(2048,8,i,s)}function df(i,s){return No(4,2,i,s)}function ff(i,s){return No(4,4,i,s)}function pf(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 mf(i,s,o){return o=o!=null?o.concat([i]):null,No(4,4,pf.bind(null,s,i),o)}function Kl(){}function _f(i,s){var o=ci();s=s===void 0?null:s;var c=o.memoizedState;return c!==null&&s!==null&&zl(s,c[1])?c[0]:(o.memoizedState=[i,s],i)}function gf(i,s){var o=ci();s=s===void 0?null:s;var c=o.memoizedState;return c!==null&&s!==null&&zl(s,c[1])?c[0]:(i=i(),o.memoizedState=[i,s],i)}function vf(i,s,o){return(Ar&21)===0?(i.baseState&&(i.baseState=!1,Ft=!0),i.memoizedState=o):(yi(o,s)||(o=Vh(),Ve.lanes|=o,Ir|=o,i.baseState=!0),s)}function dy(i,s){var o=Oe;Oe=o!==0&&4>o?o:4,i(!0);var c=Ol.transition;Ol.transition={};try{i(!1),s()}finally{Oe=o,Ol.transition=c}}function yf(){return ci().memoizedState}function fy(i,s,o){var c=_r(i);if(o={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null},Sf(i))wf(s,o);else if(o=Gd(i,s,o,c),o!==null){var d=Tt();xi(o,i,c,d),Cf(o,s,c)}}function py(i,s,o){var c=_r(i),d={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null};if(Sf(i))wf(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,yi(D,w)){var z=s.interleaved;z===null?(d.next=d,Ll(s)):(d.next=z.next,z.next=d),s.interleaved=d;return}}catch{}finally{}o=Gd(i,s,d,c),o!==null&&(d=Tt(),xi(o,i,c,d),Cf(o,s,c))}}function Sf(i){var s=i.alternate;return i===Ve||s!==null&&s===Ve}function wf(i,s){nn=ko=!0;var o=i.pending;o===null?s.next=s:(s.next=o.next,o.next=s),i.pending=s}function Cf(i,s,o){if((o&4194240)!==0){var c=s.lanes;c&=i.pendingLanes,o|=c,s.lanes=o,Va(i,o)}}var Ro={readContext:li,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useInsertionEffect:Nt,useLayoutEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useMutableSource:Nt,useSyncExternalStore:Nt,useId:Nt,unstable_isNewReconciler:!1},my={readContext:li,useCallback:function(i,s){return Di().memoizedState=[i,s===void 0?null:s],i},useContext:li,useEffect:hf,useImperativeHandle:function(i,s,o){return o=o!=null?o.concat([i]):null,Eo(4194308,4,pf.bind(null,s,i),o)},useLayoutEffect:function(i,s){return Eo(4194308,4,i,s)},useInsertionEffect:function(i,s){return Eo(4,2,i,s)},useMemo:function(i,s){var o=Di();return s=s===void 0?null:s,i=i(),o.memoizedState=[i,s],i},useReducer:function(i,s,o){var c=Di();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=fy.bind(null,Ve,i),[c.memoizedState,i]},useRef:function(i){var s=Di();return i={current:i},s.memoizedState=i},useState:cf,useDebugValue:Kl,useDeferredValue:function(i){return Di().memoizedState=i},useTransition:function(){var i=cf(!1),s=i[0];return i=dy.bind(null,i[1]),Di().memoizedState=i,[s,i]},useMutableSource:function(){},useSyncExternalStore:function(i,s,o){var c=Ve,d=Di();if(Ue){if(o===void 0)throw Error(r(407));o=o()}else{if(o=s(),ft===null)throw Error(r(349));(Ar&30)!==0||sf(c,s,o)}d.memoizedState=o;var _={value:o,getSnapshot:s};return d.queue=_,hf(of.bind(null,c,_,i),[i]),c.flags|=2048,ln(9,nf.bind(null,c,_,o,s),void 0,null),o},useId:function(){var i=Di(),s=ft.identifierPrefix;if(Ue){var o=Wi,c=$i;o=(c&~(1<<32-vi(c)-1)).toString(32)+o,s=":"+s+"R"+o,o=on++,0<o&&(s+="H"+o.toString(32)),s+=":"}else o=hy++,s=":"+s+"r"+o.toString(32)+":";return i.memoizedState=s},unstable_isNewReconciler:!1},_y={readContext:li,useCallback:_f,useContext:li,useEffect:Ul,useImperativeHandle:mf,useInsertionEffect:df,useLayoutEffect:ff,useMemo:gf,useReducer:$l,useRef:uf,useState:function(){return $l(an)},useDebugValue:Kl,useDeferredValue:function(i){var s=ci();return vf(s,at.memoizedState,i)},useTransition:function(){var i=$l(an)[0],s=ci().memoizedState;return[i,s]},useMutableSource:tf,useSyncExternalStore:rf,useId:yf,unstable_isNewReconciler:!1},gy={readContext:li,useCallback:_f,useContext:li,useEffect:Ul,useImperativeHandle:mf,useInsertionEffect:df,useLayoutEffect:ff,useMemo:gf,useReducer:Wl,useRef:uf,useState:function(){return Wl(an)},useDebugValue:Kl,useDeferredValue:function(i){var s=ci();return at===null?s.memoizedState=i:vf(s,at.memoizedState,i)},useTransition:function(){var i=Wl(an)[0],s=ci().memoizedState;return[i,s]},useMutableSource:tf,useSyncExternalStore:rf,useId:yf,unstable_isNewReconciler:!1};function wi(i,s){if(i&&i.defaultProps){s=re({},s),i=i.defaultProps;for(var o in i)s[o]===void 0&&(s[o]=i[o]);return s}return s}function ql(i,s,o,c){s=i.memoizedState,o=o(c,s),o=o==null?s:re({},s,o),i.memoizedState=o,i.lanes===0&&(i.updateQueue.baseState=o)}var Po={isMounted:function(i){return(i=i._reactInternals)?Pr(i)===i:!1},enqueueSetState:function(i,s,o){i=i._reactInternals;var c=Tt(),d=_r(i),_=Ki(c,d);_.payload=s,o!=null&&(_.callback=o),s=dr(i,_,d),s!==null&&(xi(s,i,d,c),wo(s,i,d))},enqueueReplaceState:function(i,s,o){i=i._reactInternals;var c=Tt(),d=_r(i),_=Ki(c,d);_.tag=1,_.payload=s,o!=null&&(_.callback=o),s=dr(i,_,d),s!==null&&(xi(s,i,d,c),wo(s,i,d))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var o=Tt(),c=_r(i),d=Ki(o,c);d.tag=2,s!=null&&(d.callback=s),s=dr(i,d,c),s!==null&&(xi(s,i,c,o),wo(s,i,c))}};function bf(i,s,o,c,d,_,w){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,_,w):s.prototype&&s.prototype.isPureReactComponent?!Vs(o,c)||!Vs(d,_):!0}function xf(i,s,o){var c=!1,d=cr,_=s.contextType;return typeof _=="object"&&_!==null?_=li(_):(d=zt(s)?Mr:Et.current,c=s.contextTypes,_=(c=c!=null)?hs(i,d):cr),s=new s(o,_),i.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Po,i.stateNode=s,s._reactInternals=i,c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=d,i.__reactInternalMemoizedMaskedChildContext=_),s}function kf(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&&Po.enqueueReplaceState(s,s.state,null)}function Vl(i,s,o,c){var d=i.stateNode;d.props=o,d.state=i.memoizedState,d.refs={},Tl(i);var _=s.contextType;typeof _=="object"&&_!==null?d.context=li(_):(_=zt(s)?Mr:Et.current,d.context=hs(i,_)),d.state=i.memoizedState,_=s.getDerivedStateFromProps,typeof _=="function"&&(ql(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&&Po.enqueueReplaceState(d,d.state,null),Co(i,o,d,c),d.state=i.memoizedState),typeof d.componentDidMount=="function"&&(i.flags|=4194308)}function ys(i,s){try{var o="",c=s;do o+=j(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 Yl(i,s,o){return{value:i,source:null,stack:o??null,digest:s??null}}function Xl(i,s){try{console.error(s.value)}catch(o){setTimeout(function(){throw o})}}var vy=typeof WeakMap=="function"?WeakMap:Map;function Ef(i,s,o){o=Ki(-1,o),o.tag=3,o.payload={element:null};var c=s.value;return o.callback=function(){Ao||(Ao=!0,uc=c),Xl(i,s)},o}function Nf(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(){Xl(i,s)}}var _=i.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(o.callback=function(){Xl(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 Rf(i,s,o){var c=i.pingCache;if(c===null){c=i.pingCache=new vy;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=Ly.bind(null,i,s,o),s.then(i,i))}function Pf(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 Df(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 yy=H.ReactCurrentOwner,Ft=!1;function Lt(i,s,o,c){s.child=i===null?Xd(s,null,o,c):ms(s,i.child,o,c)}function Mf(i,s,o,c,d){o=o.render;var _=s.ref;return gs(s,d),c=Fl(i,s,o,c,_,d),o=Hl(),i!==null&&!Ft?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~d,qi(i,s,d)):(Ue&&o&&bl(s),s.flags|=1,Lt(i,s,c,d),s.child)}function Lf(i,s,o,c,d){if(i===null){var _=o.type;return typeof _=="function"&&!gc(_)&&_.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(s.tag=15,s.type=_,Tf(i,s,_,c,d)):(i=$o(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:Vs,o(w,c)&&i.ref===s.ref)return qi(i,s,d)}return s.flags|=1,i=vr(_,c),i.ref=s.ref,i.return=s,s.child=i}function Tf(i,s,o,c,d){if(i!==null){var _=i.memoizedProps;if(Vs(_,c)&&i.ref===s.ref)if(Ft=!1,s.pendingProps=c=_,(i.lanes&d)!==0)(i.flags&131072)!==0&&(Ft=!0);else return s.lanes=i.lanes,qi(i,s,d)}return Gl(i,s,o,c,d)}function Bf(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},Fe(ws,Gt),Gt|=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,Fe(ws,Gt),Gt|=i,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=_!==null?_.baseLanes:o,Fe(ws,Gt),Gt|=c}else _!==null?(c=_.baseLanes|o,s.memoizedState=null):c=o,Fe(ws,Gt),Gt|=c;return Lt(i,s,d,o),s.child}function jf(i,s){var o=s.ref;(i===null&&o!==null||i!==null&&i.ref!==o)&&(s.flags|=512,s.flags|=2097152)}function Gl(i,s,o,c,d){var _=zt(o)?Mr:Et.current;return _=hs(s,_),gs(s,d),o=Fl(i,s,o,c,_,d),c=Hl(),i!==null&&!Ft?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~d,qi(i,s,d)):(Ue&&c&&bl(s),s.flags|=1,Lt(i,s,o,d),s.child)}function Af(i,s,o,c,d){if(zt(o)){var _=!0;fo(s)}else _=!1;if(gs(s,d),s.stateNode===null)Mo(i,s),xf(s,o,c),Vl(s,o,c,d),c=!0;else if(i===null){var w=s.stateNode,D=s.memoizedProps;w.props=D;var z=w.context,te=o.contextType;typeof te=="object"&&te!==null?te=li(te):(te=zt(o)?Mr:Et.current,te=hs(s,te));var le=o.getDerivedStateFromProps,ue=typeof le=="function"||typeof w.getSnapshotBeforeUpdate=="function";ue||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(D!==c||z!==te)&&kf(s,w,c,te),hr=!1;var ae=s.memoizedState;w.state=ae,Co(s,c,w,d),z=s.memoizedState,D!==c||ae!==z||Ot.current||hr?(typeof le=="function"&&(ql(s,o,le,c),z=s.memoizedState),(D=hr||bf(s,o,D,c,ae,z,te))?(ue||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=te,c=D):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{w=s.stateNode,Qd(i,s),D=s.memoizedProps,te=s.type===s.elementType?D:wi(s.type,D),w.props=te,ue=s.pendingProps,ae=w.context,z=o.contextType,typeof z=="object"&&z!==null?z=li(z):(z=zt(o)?Mr:Et.current,z=hs(s,z));var _e=o.getDerivedStateFromProps;(le=typeof _e=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(D!==ue||ae!==z)&&kf(s,w,c,z),hr=!1,ae=s.memoizedState,w.state=ae,Co(s,c,w,d);var Se=s.memoizedState;D!==ue||ae!==Se||Ot.current||hr?(typeof _e=="function"&&(ql(s,o,_e,c),Se=s.memoizedState),(te=hr||bf(s,o,te,c,ae,Se,z)||!1)?(le||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(c,Se,z),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(c,Se,z)),typeof w.componentDidUpdate=="function"&&(s.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof w.componentDidUpdate!="function"||D===i.memoizedProps&&ae===i.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||D===i.memoizedProps&&ae===i.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=Se),w.props=c,w.state=Se,w.context=z,c=te):(typeof w.componentDidUpdate!="function"||D===i.memoizedProps&&ae===i.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||D===i.memoizedProps&&ae===i.memoizedState||(s.flags|=1024),c=!1)}return Ql(i,s,o,c,_,d)}function Ql(i,s,o,c,d,_){jf(i,s);var w=(s.flags&128)!==0;if(!c&&!w)return d&&Fd(s,o,!1),qi(i,s,_);c=s.stateNode,yy.current=s;var D=w&&typeof o.getDerivedStateFromError!="function"?null:c.render();return s.flags|=1,i!==null&&w?(s.child=ms(s,i.child,null,_),s.child=ms(s,null,D,_)):Lt(i,s,D,_),s.memoizedState=c.state,d&&Fd(s,o,!0),s.child}function If(i){var s=i.stateNode;s.pendingContext?Od(i,s.pendingContext,s.pendingContext!==s.context):s.context&&Od(i,s.context,!1),Bl(i,s.containerInfo)}function Of(i,s,o,c,d){return ps(),Nl(d),s.flags|=256,Lt(i,s,o,c),s.child}var Jl={dehydrated:null,treeContext:null,retryLane:0};function Zl(i){return{baseLanes:i,cachePool:null,transitions:null}}function zf(i,s,o){var c=s.pendingProps,d=qe.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),Fe(qe,d&1),i===null)return El(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=Hr(i,c,o,null),_.return=s,i.return=s,_.sibling=i,s.child=_,s.child.memoizedState=Zl(o),s.memoizedState=Jl,i):ec(s,w));if(d=i.memoizedState,d!==null&&(D=d.dehydrated,D!==null))return Sy(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,_):(_=Hr(_,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?Zl(o):{baseLanes:w.baseLanes|o,cachePool:null,transitions:w.transitions},_.memoizedState=w,_.childLanes=i.childLanes&~o,s.memoizedState=Jl,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 ec(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&&Nl(c),ms(s,i.child,null,o),i=ec(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Sy(i,s,o,c,d,_,w){if(o)return s.flags&256?(s.flags&=-257,c=Yl(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),_=Hr(_,d,w,null),_.flags|=2,c.return=s,_.return=s,c.sibling=_,s.child=c,(s.mode&1)!==0&&ms(s,i.child,null,w),s.child.memoizedState=Zl(w),s.memoizedState=Jl,_);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=Yl(_,c,void 0),Do(i,s,w,c)}if(D=(w&i.childLanes)!==0,Ft||D){if(c=ft,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),xi(c,i,d,-1))}return _c(),c=Yl(Error(r(421))),Do(i,s,w,c)}return d.data==="$?"?(s.flags|=128,s.child=i.child,s=Ty.bind(null,i),d._reactRetry=s,null):(i=_.treeContext,Xt=ar(d.nextSibling),Yt=s,Ue=!0,Si=null,i!==null&&(oi[ai++]=$i,oi[ai++]=Wi,oi[ai++]=Lr,$i=i.id,Wi=i.overflow,Lr=s),s=ec(s,c.children),s.flags|=4096,s)}function Ff(i,s,o){i.lanes|=s;var c=i.alternate;c!==null&&(c.lanes|=s),Ml(i.return,s,o)}function tc(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 Hf(i,s,o){var c=s.pendingProps,d=c.revealOrder,_=c.tail;if(Lt(i,s,c.children,o),c=qe.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&&Ff(i,o,s);else if(i.tag===19)Ff(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(Fe(qe,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&&bo(i)===null&&(d=o),o=o.sibling;o=d,o===null?(d=s.child,s.child=null):(d=o.sibling,o.sibling=null),tc(s,!1,d,o,_);break;case"backwards":for(o=null,d=s.child,s.child=null;d!==null;){if(i=d.alternate,i!==null&&bo(i)===null){s.child=d;break}i=d.sibling,d.sibling=o,o=d,d=i}tc(s,!0,o,null,_);break;case"together":tc(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 qi(i,s,o){if(i!==null&&(s.dependencies=i.dependencies),Ir|=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 wy(i,s,o){switch(s.tag){case 3:If(s),ps();break;case 5:ef(s);break;case 1:zt(s.type)&&fo(s);break;case 4:Bl(s,s.stateNode.containerInfo);break;case 10:var c=s.type._context,d=s.memoizedProps.value;Fe(yo,c._currentValue),c._currentValue=d;break;case 13:if(c=s.memoizedState,c!==null)return c.dehydrated!==null?(Fe(qe,qe.current&1),s.flags|=128,null):(o&s.child.childLanes)!==0?zf(i,s,o):(Fe(qe,qe.current&1),i=qi(i,s,o),i!==null?i.sibling:null);Fe(qe,qe.current&1);break;case 19:if(c=(o&s.childLanes)!==0,(i.flags&128)!==0){if(c)return Hf(i,s,o);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),Fe(qe,qe.current),c)break;return null;case 22:case 23:return s.lanes=0,Bf(i,s,o)}return qi(i,s,o)}var $f,ic,Wf,Uf;$f=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}},ic=function(){},Wf=function(i,s,o,c){var d=i.memoizedProps;if(d!==c){i=s.stateNode,jr(Pi.current);var _=null;switch(o){case"input":d=ti(i,d),c=ti(i,c),_=[];break;case"select":d=re({},d,{value:void 0}),c=re({},c,{value:void 0}),_=[];break;case"textarea":d=ge(i,d),c=ge(i,c),_=[];break;default:typeof d.onClick!="function"&&typeof c.onClick=="function"&&(i.onclick=co)}Aa(o,c);var w;o=null;for(te in d)if(!c.hasOwnProperty(te)&&d.hasOwnProperty(te)&&d[te]!=null)if(te==="style"){var D=d[te];for(w in D)D.hasOwnProperty(w)&&(o||(o={}),o[w]="")}else te!=="dangerouslySetInnerHTML"&&te!=="children"&&te!=="suppressContentEditableWarning"&&te!=="suppressHydrationWarning"&&te!=="autoFocus"&&(a.hasOwnProperty(te)?_||(_=[]):(_=_||[]).push(te,null));for(te in c){var z=c[te];if(D=d!=null?d[te]:void 0,c.hasOwnProperty(te)&&z!==D&&(z!=null||D!=null))if(te==="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(te,o)),o=z;else te==="dangerouslySetInnerHTML"?(z=z?z.__html:void 0,D=D?D.__html:void 0,z!=null&&D!==z&&(_=_||[]).push(te,z)):te==="children"?typeof z!="string"&&typeof z!="number"||(_=_||[]).push(te,""+z):te!=="suppressContentEditableWarning"&&te!=="suppressHydrationWarning"&&(a.hasOwnProperty(te)?(z!=null&&te==="onScroll"&&He("scroll",i),_||D===z||(_=[])):(_=_||[]).push(te,z))}o&&(_=_||[]).push("style",o);var te=_;(s.updateQueue=te)&&(s.flags|=4)}},Uf=function(i,s,o,c){o!==c&&(s.flags|=4)};function cn(i,s){if(!Ue)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 Rt(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 Cy(i,s,o){var c=s.pendingProps;switch(xl(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(s),null;case 1:return zt(s.type)&&ho(),Rt(s),null;case 3:return c=s.stateNode,vs(),$e(Ot),$e(Et),Il(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(go(s)?s.flags|=4:i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Si!==null&&(fc(Si),Si=null))),ic(i,s),Rt(s),null;case 5:jl(s);var d=jr(sn.current);if(o=s.type,i!==null&&s.stateNode!=null)Wf(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 Rt(s),null}if(i=jr(Pi.current),go(s)){c=s.stateNode,o=s.type;var _=s.memoizedProps;switch(c[Ri]=s,c[Js]=_,i=(s.mode&1)!==0,o){case"dialog":He("cancel",c),He("close",c);break;case"iframe":case"object":case"embed":He("load",c);break;case"video":case"audio":for(d=0;d<Xs.length;d++)He(Xs[d],c);break;case"source":He("error",c);break;case"img":case"image":case"link":He("error",c),He("load",c);break;case"details":He("toggle",c);break;case"input":gi(c,_),He("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!_.multiple},He("invalid",c);break;case"textarea":Be(c,_),He("invalid",c)}Aa(o,_),d=null;for(var w in _)if(_.hasOwnProperty(w)){var D=_[w];w==="children"?typeof D=="string"?c.textContent!==D&&(_.suppressHydrationWarning!==!0&&lo(c.textContent,D,i),d=["children",D]):typeof D=="number"&&c.textContent!==""+D&&(_.suppressHydrationWarning!==!0&&lo(c.textContent,D,i),d=["children",""+D]):a.hasOwnProperty(w)&&D!=null&&w==="onScroll"&&He("scroll",c)}switch(o){case"input":ot(c),ii(c,_,!0);break;case"textarea":ot(c),Mt(c);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(c.onclick=co)}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,$f(i,s,!1,!1),s.stateNode=i;e:{switch(w=Ia(o,c),o){case"dialog":He("cancel",i),He("close",i),d=c;break;case"iframe":case"object":case"embed":He("load",i),d=c;break;case"video":case"audio":for(d=0;d<Xs.length;d++)He(Xs[d],i);d=c;break;case"source":He("error",i),d=c;break;case"img":case"image":case"link":He("error",i),He("load",i),d=c;break;case"details":He("toggle",i),d=c;break;case"input":gi(i,c),d=ti(i,c),He("invalid",i);break;case"option":d=c;break;case"select":i._wrapperState={wasMultiple:!!c.multiple},d=re({},c,{value:void 0}),He("invalid",i);break;case"textarea":Be(i,c),d=ge(i,c),He("invalid",i);break;default:d=c}Aa(o,d),D=d;for(_ in D)if(D.hasOwnProperty(_)){var z=D[_];_==="style"?Lh(i,z):_==="dangerouslySetInnerHTML"?(z=z?z.__html:void 0,z!=null&&Hn(i,z)):_==="children"?typeof z=="string"?(o!=="textarea"||z!=="")&&fe(i,z):typeof z=="number"&&fe(i,""+z):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(a.hasOwnProperty(_)?z!=null&&_==="onScroll"&&He("scroll",i):z!=null&&B(i,_,z,w))}switch(o){case"input":ot(i),ii(i,c,!1);break;case"textarea":ot(i),Mt(i);break;case"option":c.value!=null&&i.setAttribute("value",""+oe(c.value));break;case"select":i.multiple=!!c.multiple,_=c.value,_!=null?It(i,!!c.multiple,_,!1):c.defaultValue!=null&&It(i,!!c.multiple,c.defaultValue,!0);break;default:typeof d.onClick=="function"&&(i.onclick=co)}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 Rt(s),null;case 6:if(i&&s.stateNode!=null)Uf(i,s,i.memoizedProps,c);else{if(typeof c!="string"&&s.stateNode===null)throw Error(r(166));if(o=jr(sn.current),jr(Pi.current),go(s)){if(c=s.stateNode,o=s.memoizedProps,c[Ri]=s,(_=c.nodeValue!==o)&&(i=Yt,i!==null))switch(i.tag){case 3:lo(c.nodeValue,o,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&lo(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 Rt(s),null;case 13:if($e(qe),c=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(Ue&&Xt!==null&&(s.mode&1)!==0&&(s.flags&128)===0)qd(),ps(),s.flags|=98560,_=!1;else if(_=go(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 ps(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Rt(s),_=!1}else Si!==null&&(fc(Si),Si=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||(qe.current&1)!==0?lt===0&&(lt=3):_c())),s.updateQueue!==null&&(s.flags|=4),Rt(s),null);case 4:return vs(),ic(i,s),i===null&&Gs(s.stateNode.containerInfo),Rt(s),null;case 10:return Dl(s.type._context),Rt(s),null;case 17:return zt(s.type)&&ho(),Rt(s),null;case 19:if($e(qe),_=s.memoizedState,_===null)return Rt(s),null;if(c=(s.flags&128)!==0,w=_.rendering,w===null)if(c)cn(_,!1);else{if(lt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(w=bo(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 Fe(qe,qe.current&1|2),s.child}i=i.sibling}_.tail!==null&&et()>Cs&&(s.flags|=128,c=!0,cn(_,!1),s.lanes=4194304)}else{if(!c)if(i=bo(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&&!Ue)return Rt(s),null}else 2*et()-_.renderingStartTime>Cs&&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=et(),s.sibling=null,o=qe.current,Fe(qe,c?o&1|2:o&1),s):(Rt(s),null);case 22:case 23:return mc(),c=s.memoizedState!==null,i!==null&&i.memoizedState!==null!==c&&(s.flags|=8192),c&&(s.mode&1)!==0?(Gt&1073741824)!==0&&(Rt(s),s.subtreeFlags&6&&(s.flags|=8192)):Rt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function by(i,s){switch(xl(s),s.tag){case 1:return zt(s.type)&&ho(),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return vs(),$e(Ot),$e(Et),Il(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 5:return jl(s),null;case 13:if($e(qe),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ps()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return $e(qe),null;case 4:return vs(),null;case 10:return Dl(s.type._context),null;case 22:case 23:return mc(),null;case 24:return null;default:return null}}var Lo=!1,Pt=!1,xy=typeof WeakSet=="function"?WeakSet:Set,ve=null;function Ss(i,s){var o=i.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(c){Qe(i,s,c)}else o.current=null}function rc(i,s,o){try{o()}catch(c){Qe(i,s,c)}}var Kf=!1;function ky(i,s){if(ml=Qn,i=Cd(),al(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,te=0,le=0,ue=i,ae=null;t:for(;;){for(var _e;ue!==o||d!==0&&ue.nodeType!==3||(D=w+d),ue!==_||c!==0&&ue.nodeType!==3||(z=w+c),ue.nodeType===3&&(w+=ue.nodeValue.length),(_e=ue.firstChild)!==null;)ae=ue,ue=_e;for(;;){if(ue===i)break t;if(ae===o&&++te===d&&(D=w),ae===_&&++le===c&&(z=w),(_e=ue.nextSibling)!==null)break;ue=ae,ae=ue.parentNode}ue=_e}o=D===-1||z===-1?null:{start:D,end:z}}else o=null}o=o||{start:0,end:0}}else o=null;for(_l={focusedElem:i,selectionRange:o},Qn=!1,ve=s;ve!==null;)if(s=ve,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,ve=i;else for(;ve!==null;){s=ve;try{var Se=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var we=Se.memoizedProps,tt=Se.memoizedState,V=s.stateNode,W=V.getSnapshotBeforeUpdate(s.elementType===s.type?we:wi(s.type,we),tt);V.__reactInternalSnapshotBeforeUpdate=W}break;case 3:var J=s.stateNode.containerInfo;J.nodeType===1?J.textContent="":J.nodeType===9&&J.documentElement&&J.removeChild(J.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(he){Qe(s,s.return,he)}if(i=s.sibling,i!==null){i.return=s.return,ve=i;break}ve=s.return}return Se=Kf,Kf=!1,Se}function un(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&&rc(s,o,_)}d=d.next}while(d!==c)}}function To(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 sc(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 qf(i){var s=i.alternate;s!==null&&(i.alternate=null,qf(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[Sl],delete s[ay],delete s[ly])),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 Vf(i){return i.tag===5||i.tag===3||i.tag===4}function Yf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Vf(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 nc(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=co));else if(c!==4&&(i=i.child,i!==null))for(nc(i,s,o),i=i.sibling;i!==null;)nc(i,s,o),i=i.sibling}function oc(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(oc(i,s,o),i=i.sibling;i!==null;)oc(i,s,o),i=i.sibling}var Ct=null,Ci=!1;function fr(i,s,o){for(o=o.child;o!==null;)Xf(i,s,o),o=o.sibling}function Xf(i,s,o){if(Ni&&typeof Ni.onCommitFiberUnmount=="function")try{Ni.onCommitFiberUnmount(Kn,o)}catch{}switch(o.tag){case 5:Pt||Ss(o,s);case 6:var c=Ct,d=Ci;Ct=null,fr(i,s,o),Ct=c,Ci=d,Ct!==null&&(Ci?(i=Ct,o=o.stateNode,i.nodeType===8?i.parentNode.removeChild(o):i.removeChild(o)):Ct.removeChild(o.stateNode));break;case 18:Ct!==null&&(Ci?(i=Ct,o=o.stateNode,i.nodeType===8?yl(i.parentNode,o):i.nodeType===1&&yl(i,o),Hs(i)):yl(Ct,o.stateNode));break;case 4:c=Ct,d=Ci,Ct=o.stateNode.containerInfo,Ci=!0,fr(i,s,o),Ct=c,Ci=d;break;case 0:case 11:case 14:case 15:if(!Pt&&(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)&&rc(o,s,w),d=d.next}while(d!==c)}fr(i,s,o);break;case 1:if(!Pt&&(Ss(o,s),c=o.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=o.memoizedProps,c.state=o.memoizedState,c.componentWillUnmount()}catch(D){Qe(o,s,D)}fr(i,s,o);break;case 21:fr(i,s,o);break;case 22:o.mode&1?(Pt=(c=Pt)||o.memoizedState!==null,fr(i,s,o),Pt=c):fr(i,s,o);break;default:fr(i,s,o)}}function Gf(i){var s=i.updateQueue;if(s!==null){i.updateQueue=null;var o=i.stateNode;o===null&&(o=i.stateNode=new xy),s.forEach(function(c){var d=By.bind(null,i,c);o.has(c)||(o.add(c),c.then(d,d))})}}function bi(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:Ct=D.stateNode,Ci=!1;break e;case 3:Ct=D.stateNode.containerInfo,Ci=!0;break e;case 4:Ct=D.stateNode.containerInfo,Ci=!0;break e}D=D.return}if(Ct===null)throw Error(r(160));Xf(_,w,d),Ct=null,Ci=!1;var z=d.alternate;z!==null&&(z.return=null),d.return=null}catch(te){Qe(d,s,te)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Qf(s,i),s=s.sibling}function Qf(i,s){var o=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(bi(s,i),Mi(i),c&4){try{un(3,i,i.return),To(3,i)}catch(we){Qe(i,i.return,we)}try{un(5,i,i.return)}catch(we){Qe(i,i.return,we)}}break;case 1:bi(s,i),Mi(i),c&512&&o!==null&&Ss(o,o.return);break;case 5:if(bi(s,i),Mi(i),c&512&&o!==null&&Ss(o,o.return),i.flags&32){var d=i.stateNode;try{fe(d,"")}catch(we){Qe(i,i.return,we)}}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&&Rr(d,_),Ia(D,w);var te=Ia(D,_);for(w=0;w<z.length;w+=2){var le=z[w],ue=z[w+1];le==="style"?Lh(d,ue):le==="dangerouslySetInnerHTML"?Hn(d,ue):le==="children"?fe(d,ue):B(d,le,ue,te)}switch(D){case"input":Zi(d,_);break;case"textarea":wt(d,_);break;case"select":var ae=d._wrapperState.wasMultiple;d._wrapperState.wasMultiple=!!_.multiple;var _e=_.value;_e!=null?It(d,!!_.multiple,_e,!1):ae!==!!_.multiple&&(_.defaultValue!=null?It(d,!!_.multiple,_.defaultValue,!0):It(d,!!_.multiple,_.multiple?[]:"",!1))}d[Js]=_}catch(we){Qe(i,i.return,we)}}break;case 6:if(bi(s,i),Mi(i),c&4){if(i.stateNode===null)throw Error(r(162));d=i.stateNode,_=i.memoizedProps;try{d.nodeValue=_}catch(we){Qe(i,i.return,we)}}break;case 3:if(bi(s,i),Mi(i),c&4&&o!==null&&o.memoizedState.isDehydrated)try{Hs(s.containerInfo)}catch(we){Qe(i,i.return,we)}break;case 4:bi(s,i),Mi(i);break;case 13:bi(s,i),Mi(i),d=i.child,d.flags&8192&&(_=d.memoizedState!==null,d.stateNode.isHidden=_,!_||d.alternate!==null&&d.alternate.memoizedState!==null||(cc=et())),c&4&&Gf(i);break;case 22:if(le=o!==null&&o.memoizedState!==null,i.mode&1?(Pt=(te=Pt)||le,bi(s,i),Pt=te):bi(s,i),Mi(i),c&8192){if(te=i.memoizedState!==null,(i.stateNode.isHidden=te)&&!le&&(i.mode&1)!==0)for(ve=i,le=i.child;le!==null;){for(ue=ve=le;ve!==null;){switch(ae=ve,_e=ae.child,ae.tag){case 0:case 11:case 14:case 15:un(4,ae,ae.return);break;case 1:Ss(ae,ae.return);var Se=ae.stateNode;if(typeof Se.componentWillUnmount=="function"){c=ae,o=ae.return;try{s=c,Se.props=s.memoizedProps,Se.state=s.memoizedState,Se.componentWillUnmount()}catch(we){Qe(c,o,we)}}break;case 5:Ss(ae,ae.return);break;case 22:if(ae.memoizedState!==null){ep(ue);continue}}_e!==null?(_e.return=ae,ve=_e):ep(ue)}le=le.sibling}e:for(le=null,ue=i;;){if(ue.tag===5){if(le===null){le=ue;try{d=ue.stateNode,te?(_=d.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(D=ue.stateNode,z=ue.memoizedProps.style,w=z!=null&&z.hasOwnProperty("display")?z.display:null,D.style.display=Ms("display",w))}catch(we){Qe(i,i.return,we)}}}else if(ue.tag===6){if(le===null)try{ue.stateNode.nodeValue=te?"":ue.memoizedProps}catch(we){Qe(i,i.return,we)}}else if((ue.tag!==22&&ue.tag!==23||ue.memoizedState===null||ue===i)&&ue.child!==null){ue.child.return=ue,ue=ue.child;continue}if(ue===i)break e;for(;ue.sibling===null;){if(ue.return===null||ue.return===i)break e;le===ue&&(le=null),ue=ue.return}le===ue&&(le=null),ue.sibling.return=ue.return,ue=ue.sibling}}break;case 19:bi(s,i),Mi(i),c&4&&Gf(i);break;case 21:break;default:bi(s,i),Mi(i)}}function Mi(i){var s=i.flags;if(s&2){try{e:{for(var o=i.return;o!==null;){if(Vf(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&&(fe(d,""),c.flags&=-33);var _=Yf(i);oc(i,_,d);break;case 3:case 4:var w=c.stateNode.containerInfo,D=Yf(i);nc(i,D,w);break;default:throw Error(r(161))}}catch(z){Qe(i,i.return,z)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function Ey(i,s,o){ve=i,Jf(i)}function Jf(i,s,o){for(var c=(i.mode&1)!==0;ve!==null;){var d=ve,_=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||Pt;D=Lo;var te=Pt;if(Lo=w,(Pt=z)&&!te)for(ve=d;ve!==null;)w=ve,z=w.child,w.tag===22&&w.memoizedState!==null?tp(d):z!==null?(z.return=w,ve=z):tp(d);for(;_!==null;)ve=_,Jf(_),_=_.sibling;ve=d,Lo=D,Pt=te}Zf(i)}else(d.subtreeFlags&8772)!==0&&_!==null?(_.return=d,ve=_):Zf(i)}}function Zf(i){for(;ve!==null;){var s=ve;if((s.flags&8772)!==0){var o=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Pt||To(5,s);break;case 1:var c=s.stateNode;if(s.flags&4&&!Pt)if(o===null)c.componentDidMount();else{var d=s.elementType===s.type?o.memoizedProps:wi(s.type,o.memoizedProps);c.componentDidUpdate(d,o.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var _=s.updateQueue;_!==null&&Zd(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}Zd(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 te=s.alternate;if(te!==null){var le=te.memoizedState;if(le!==null){var ue=le.dehydrated;ue!==null&&Hs(ue)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Pt||s.flags&512&&sc(s)}catch(ae){Qe(s,s.return,ae)}}if(s===i){ve=null;break}if(o=s.sibling,o!==null){o.return=s.return,ve=o;break}ve=s.return}}function ep(i){for(;ve!==null;){var s=ve;if(s===i){ve=null;break}var o=s.sibling;if(o!==null){o.return=s.return,ve=o;break}ve=s.return}}function tp(i){for(;ve!==null;){var s=ve;try{switch(s.tag){case 0:case 11:case 15:var o=s.return;try{To(4,s)}catch(z){Qe(s,o,z)}break;case 1:var c=s.stateNode;if(typeof c.componentDidMount=="function"){var d=s.return;try{c.componentDidMount()}catch(z){Qe(s,d,z)}}var _=s.return;try{sc(s)}catch(z){Qe(s,_,z)}break;case 5:var w=s.return;try{sc(s)}catch(z){Qe(s,w,z)}}}catch(z){Qe(s,s.return,z)}if(s===i){ve=null;break}var D=s.sibling;if(D!==null){D.return=s.return,ve=D;break}ve=s.return}}var Ny=Math.ceil,Bo=H.ReactCurrentDispatcher,ac=H.ReactCurrentOwner,ui=H.ReactCurrentBatchConfig,je=0,ft=null,rt=null,bt=0,Gt=0,ws=lr(0),lt=0,hn=null,Ir=0,jo=0,lc=0,dn=null,Ht=null,cc=0,Cs=1/0,Vi=null,Ao=!1,uc=null,pr=null,Io=!1,mr=null,Oo=0,fn=0,hc=null,zo=-1,Fo=0;function Tt(){return(je&6)!==0?et():zo!==-1?zo:zo=et()}function _r(i){return(i.mode&1)===0?1:(je&2)!==0&&bt!==0?bt&-bt:uy.transition!==null?(Fo===0&&(Fo=Vh()),Fo):(i=Oe,i!==0||(i=window.event,i=i===void 0?16:id(i.type)),i)}function xi(i,s,o,c){if(50<fn)throw fn=0,hc=null,Error(r(185));As(i,o,c),((je&2)===0||i!==ft)&&(i===ft&&((je&2)===0&&(jo|=o),lt===4&&gr(i,bt)),$t(i,c),o===1&&je===0&&(s.mode&1)===0&&(Cs=et()+500,po&&ur()))}function $t(i,s){var o=i.callbackNode;uv(i,s);var c=Yn(i,i===ft?bt:0);if(c===0)o!==null&&Uh(o),i.callbackNode=null,i.callbackPriority=0;else if(s=c&-c,i.callbackPriority!==s){if(o!=null&&Uh(o),s===1)i.tag===0?cy(rp.bind(null,i)):Hd(rp.bind(null,i)),ny(function(){(je&6)===0&&ur()}),o=null;else{switch(Yh(c)){case 1:o=Ua;break;case 4:o=Kh;break;case 16:o=Un;break;case 536870912:o=qh;break;default:o=Un}o=hp(o,ip.bind(null,i))}i.callbackPriority=s,i.callbackNode=o}}function ip(i,s){if(zo=-1,Fo=0,(je&6)!==0)throw Error(r(327));var o=i.callbackNode;if(bs()&&i.callbackNode!==o)return null;var c=Yn(i,i===ft?bt:0);if(c===0)return null;if((c&30)!==0||(c&i.expiredLanes)!==0||s)s=Ho(i,c);else{s=c;var d=je;je|=2;var _=np();(ft!==i||bt!==s)&&(Vi=null,Cs=et()+500,zr(i,s));do try{Dy();break}catch(D){sp(i,D)}while(!0);Pl(),Bo.current=_,je=d,rt!==null?s=0:(ft=null,bt=0,s=lt)}if(s!==0){if(s===2&&(d=Ka(i),d!==0&&(c=d,s=dc(i,d))),s===1)throw o=hn,zr(i,0),gr(i,c),$t(i,et()),o;if(s===6)gr(i,c);else{if(d=i.current.alternate,(c&30)===0&&!Ry(d)&&(s=Ho(i,c),s===2&&(_=Ka(i),_!==0&&(c=_,s=dc(i,_))),s===1))throw o=hn,zr(i,0),gr(i,c),$t(i,et()),o;switch(i.finishedWork=d,i.finishedLanes=c,s){case 0:case 1:throw Error(r(345));case 2:Fr(i,Ht,Vi);break;case 3:if(gr(i,c),(c&130023424)===c&&(s=cc+500-et(),10<s)){if(Yn(i,0)!==0)break;if(d=i.suspendedLanes,(d&c)!==c){Tt(),i.pingedLanes|=i.suspendedLanes&d;break}i.timeoutHandle=vl(Fr.bind(null,i,Ht,Vi),s);break}Fr(i,Ht,Vi);break;case 4:if(gr(i,c),(c&4194240)===c)break;for(s=i.eventTimes,d=-1;0<c;){var w=31-vi(c);_=1<<w,w=s[w],w>d&&(d=w),c&=~_}if(c=d,c=et()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*Ny(c/1960))-c,10<c){i.timeoutHandle=vl(Fr.bind(null,i,Ht,Vi),c);break}Fr(i,Ht,Vi);break;case 5:Fr(i,Ht,Vi);break;default:throw Error(r(329))}}}return $t(i,et()),i.callbackNode===o?ip.bind(null,i):null}function dc(i,s){var o=dn;return i.current.memoizedState.isDehydrated&&(zr(i,s).flags|=256),i=Ho(i,s),i!==2&&(s=Ht,Ht=o,s!==null&&fc(s)),i}function fc(i){Ht===null?Ht=i:Ht.push.apply(Ht,i)}function Ry(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(!yi(_(),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&=~lc,s&=~jo,i.suspendedLanes|=s,i.pingedLanes&=~s,i=i.expirationTimes;0<s;){var o=31-vi(s),c=1<<o;i[o]=-1,s&=~c}}function rp(i){if((je&6)!==0)throw Error(r(327));bs();var s=Yn(i,0);if((s&1)===0)return $t(i,et()),null;var o=Ho(i,s);if(i.tag!==0&&o===2){var c=Ka(i);c!==0&&(s=c,o=dc(i,c))}if(o===1)throw o=hn,zr(i,0),gr(i,s),$t(i,et()),o;if(o===6)throw Error(r(345));return i.finishedWork=i.current.alternate,i.finishedLanes=s,Fr(i,Ht,Vi),$t(i,et()),null}function pc(i,s){var o=je;je|=1;try{return i(s)}finally{je=o,je===0&&(Cs=et()+500,po&&ur())}}function Or(i){mr!==null&&mr.tag===0&&(je&6)===0&&bs();var s=je;je|=1;var o=ui.transition,c=Oe;try{if(ui.transition=null,Oe=1,i)return i()}finally{Oe=c,ui.transition=o,je=s,(je&6)===0&&ur()}}function mc(){Gt=ws.current,$e(ws)}function zr(i,s){i.finishedWork=null,i.finishedLanes=0;var o=i.timeoutHandle;if(o!==-1&&(i.timeoutHandle=-1,sy(o)),rt!==null)for(o=rt.return;o!==null;){var c=o;switch(xl(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&ho();break;case 3:vs(),$e(Ot),$e(Et),Il();break;case 5:jl(c);break;case 4:vs();break;case 13:$e(qe);break;case 19:$e(qe);break;case 10:Dl(c.type._context);break;case 22:case 23:mc()}o=o.return}if(ft=i,rt=i=vr(i.current,null),bt=Gt=s,lt=0,hn=null,lc=jo=Ir=0,Ht=dn=null,Br!==null){for(s=0;s<Br.length;s++)if(o=Br[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}Br=null}return i}function sp(i,s){do{var o=rt;try{if(Pl(),xo.current=Ro,ko){for(var c=Ve.memoizedState;c!==null;){var d=c.queue;d!==null&&(d.pending=null),c=c.next}ko=!1}if(Ar=0,dt=at=Ve=null,nn=!1,on=0,ac.current=null,o===null||o.return===null){lt=1,hn=s,rt=null;break}e:{var _=i,w=o.return,D=o,z=s;if(s=bt,D.flags|=32768,z!==null&&typeof z=="object"&&typeof z.then=="function"){var te=z,le=D,ue=le.tag;if((le.mode&1)===0&&(ue===0||ue===11||ue===15)){var ae=le.alternate;ae?(le.updateQueue=ae.updateQueue,le.memoizedState=ae.memoizedState,le.lanes=ae.lanes):(le.updateQueue=null,le.memoizedState=null)}var _e=Pf(w);if(_e!==null){_e.flags&=-257,Df(_e,w,D,_,s),_e.mode&1&&Rf(_,te,s),s=_e,z=te;var Se=s.updateQueue;if(Se===null){var we=new Set;we.add(z),s.updateQueue=we}else Se.add(z);break e}else{if((s&1)===0){Rf(_,te,s),_c();break e}z=Error(r(426))}}else if(Ue&&D.mode&1){var tt=Pf(w);if(tt!==null){(tt.flags&65536)===0&&(tt.flags|=256),Df(tt,w,D,_,s),Nl(ys(z,D));break e}}_=z=ys(z,D),lt!==4&&(lt=2),dn===null?dn=[_]:dn.push(_),_=w;do{switch(_.tag){case 3:_.flags|=65536,s&=-s,_.lanes|=s;var V=Ef(_,z,s);Jd(_,V);break e;case 1:D=z;var W=_.type,J=_.stateNode;if((_.flags&128)===0&&(typeof W.getDerivedStateFromError=="function"||J!==null&&typeof J.componentDidCatch=="function"&&(pr===null||!pr.has(J)))){_.flags|=65536,s&=-s,_.lanes|=s;var he=Nf(_,D,s);Jd(_,he);break e}}_=_.return}while(_!==null)}ap(o)}catch(Ce){s=Ce,rt===o&&o!==null&&(rt=o=o.return);continue}break}while(!0)}function np(){var i=Bo.current;return Bo.current=Ro,i===null?Ro:i}function _c(){(lt===0||lt===3||lt===2)&&(lt=4),ft===null||(Ir&268435455)===0&&(jo&268435455)===0||gr(ft,bt)}function Ho(i,s){var o=je;je|=2;var c=np();(ft!==i||bt!==s)&&(Vi=null,zr(i,s));do try{Py();break}catch(d){sp(i,d)}while(!0);if(Pl(),je=o,Bo.current=c,rt!==null)throw Error(r(261));return ft=null,bt=0,lt}function Py(){for(;rt!==null;)op(rt)}function Dy(){for(;rt!==null&&!tv();)op(rt)}function op(i){var s=up(i.alternate,i,Gt);i.memoizedProps=i.pendingProps,s===null?ap(i):rt=s,ac.current=null}function ap(i){var s=i;do{var o=s.alternate;if(i=s.return,(s.flags&32768)===0){if(o=Cy(o,s,Gt),o!==null){rt=o;return}}else{if(o=by(o,s),o!==null){o.flags&=32767,rt=o;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{lt=6,rt=null;return}}if(s=s.sibling,s!==null){rt=s;return}rt=s=i}while(s!==null);lt===0&&(lt=5)}function Fr(i,s,o){var c=Oe,d=ui.transition;try{ui.transition=null,Oe=1,My(i,s,o,c)}finally{ui.transition=d,Oe=c}return null}function My(i,s,o,c){do bs();while(mr!==null);if((je&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(hv(i,_),i===ft&&(rt=ft=null,bt=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||Io||(Io=!0,hp(Un,function(){return bs(),null})),_=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||_){_=ui.transition,ui.transition=null;var w=Oe;Oe=1;var D=je;je|=4,ac.current=null,ky(i,o),Qf(o,i),Qv(_l),Qn=!!ml,_l=ml=null,i.current=o,Ey(o),iv(),je=D,Oe=w,ui.transition=_}else i.current=o;if(Io&&(Io=!1,mr=i,Oo=d),_=i.pendingLanes,_===0&&(pr=null),nv(o.stateNode),$t(i,et()),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(Ao)throw Ao=!1,i=uc,uc=null,i;return(Oo&1)!==0&&i.tag!==0&&bs(),_=i.pendingLanes,(_&1)!==0?i===hc?fn++:(fn=0,hc=i):fn=0,ur(),null}function bs(){if(mr!==null){var i=Yh(Oo),s=ui.transition,o=Oe;try{if(ui.transition=null,Oe=16>i?16:i,mr===null)var c=!1;else{if(i=mr,mr=null,Oo=0,(je&6)!==0)throw Error(r(331));var d=je;for(je|=4,ve=i.current;ve!==null;){var _=ve,w=_.child;if((ve.flags&16)!==0){var D=_.deletions;if(D!==null){for(var z=0;z<D.length;z++){var te=D[z];for(ve=te;ve!==null;){var le=ve;switch(le.tag){case 0:case 11:case 15:un(8,le,_)}var ue=le.child;if(ue!==null)ue.return=le,ve=ue;else for(;ve!==null;){le=ve;var ae=le.sibling,_e=le.return;if(qf(le),le===te){ve=null;break}if(ae!==null){ae.return=_e,ve=ae;break}ve=_e}}}var Se=_.alternate;if(Se!==null){var we=Se.child;if(we!==null){Se.child=null;do{var tt=we.sibling;we.sibling=null,we=tt}while(we!==null)}}ve=_}}if((_.subtreeFlags&2064)!==0&&w!==null)w.return=_,ve=w;else e:for(;ve!==null;){if(_=ve,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:un(9,_,_.return)}var V=_.sibling;if(V!==null){V.return=_.return,ve=V;break e}ve=_.return}}var W=i.current;for(ve=W;ve!==null;){w=ve;var J=w.child;if((w.subtreeFlags&2064)!==0&&J!==null)J.return=w,ve=J;else e:for(w=W;ve!==null;){if(D=ve,(D.flags&2048)!==0)try{switch(D.tag){case 0:case 11:case 15:To(9,D)}}catch(Ce){Qe(D,D.return,Ce)}if(D===w){ve=null;break e}var he=D.sibling;if(he!==null){he.return=D.return,ve=he;break e}ve=D.return}}if(je=d,ur(),Ni&&typeof Ni.onPostCommitFiberRoot=="function")try{Ni.onPostCommitFiberRoot(Kn,i)}catch{}c=!0}return c}finally{Oe=o,ui.transition=s}}return!1}function lp(i,s,o){s=ys(o,s),s=Ef(i,s,1),i=dr(i,s,1),s=Tt(),i!==null&&(As(i,1,s),$t(i,s))}function Qe(i,s,o){if(i.tag===3)lp(i,i,o);else for(;s!==null;){if(s.tag===3){lp(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=ys(o,i),i=Nf(s,i,1),s=dr(s,i,1),i=Tt(),s!==null&&(As(s,1,i),$t(s,i));break}}s=s.return}}function Ly(i,s,o){var c=i.pingCache;c!==null&&c.delete(s),s=Tt(),i.pingedLanes|=i.suspendedLanes&o,ft===i&&(bt&o)===o&&(lt===4||lt===3&&(bt&130023424)===bt&&500>et()-cc?zr(i,0):lc|=o),$t(i,s)}function cp(i,s){s===0&&((i.mode&1)===0?s=1:(s=Vn,Vn<<=1,(Vn&130023424)===0&&(Vn=4194304)));var o=Tt();i=Ui(i,s),i!==null&&(As(i,s,o),$t(i,o))}function Ty(i){var s=i.memoizedState,o=0;s!==null&&(o=s.retryLane),cp(i,o)}function By(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),cp(i,o)}var up;up=function(i,s,o){if(i!==null)if(i.memoizedProps!==s.pendingProps||Ot.current)Ft=!0;else{if((i.lanes&o)===0&&(s.flags&128)===0)return Ft=!1,wy(i,s,o);Ft=(i.flags&131072)!==0}else Ft=!1,Ue&&(s.flags&1048576)!==0&&$d(s,_o,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;Mo(i,s),i=s.pendingProps;var d=hs(s,Et.current);gs(s,o),d=Fl(null,s,c,i,d,o);var _=Hl();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,zt(c)?(_=!0,fo(s)):_=!1,s.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,Tl(s),d.updater=Po,s.stateNode=d,d._reactInternals=s,Vl(s,c,i,o),s=Ql(null,s,c,!0,_,o)):(s.tag=0,Ue&&_&&bl(s),Lt(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=Ay(c),i=wi(c,i),d){case 0:s=Gl(null,s,c,i,o);break e;case 1:s=Af(null,s,c,i,o);break e;case 11:s=Mf(null,s,c,i,o);break e;case 14:s=Lf(null,s,c,wi(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:wi(c,d),Gl(i,s,c,d,o);case 1:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:wi(c,d),Af(i,s,c,d,o);case 3:e:{if(If(s),i===null)throw Error(r(387));c=s.pendingProps,_=s.memoizedState,d=_.element,Qd(i,s),Co(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=ys(Error(r(423)),s),s=Of(i,s,c,o,d);break e}else if(c!==d){d=ys(Error(r(424)),s),s=Of(i,s,c,o,d);break e}else for(Xt=ar(s.stateNode.containerInfo.firstChild),Yt=s,Ue=!0,Si=null,o=Xd(s,null,c,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ps(),c===d){s=qi(i,s,o);break e}Lt(i,s,c,o)}s=s.child}return s;case 5:return ef(s),i===null&&El(s),c=s.type,d=s.pendingProps,_=i!==null?i.memoizedProps:null,w=d.children,gl(c,d)?w=null:_!==null&&gl(c,_)&&(s.flags|=32),jf(i,s),Lt(i,s,w,o),s.child;case 6:return i===null&&El(s),null;case 13:return zf(i,s,o);case 4:return Bl(s,s.stateNode.containerInfo),c=s.pendingProps,i===null?s.child=ms(s,null,c,o):Lt(i,s,c,o),s.child;case 11:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:wi(c,d),Mf(i,s,c,d,o);case 7:return Lt(i,s,s.pendingProps,o),s.child;case 8:return Lt(i,s,s.pendingProps.children,o),s.child;case 12:return Lt(i,s,s.pendingProps.children,o),s.child;case 10:e:{if(c=s.type._context,d=s.pendingProps,_=s.memoizedProps,w=d.value,Fe(yo,c._currentValue),c._currentValue=w,_!==null)if(yi(_.value,w)){if(_.children===d.children&&!Ot.current){s=qi(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 te=_.updateQueue;if(te!==null){te=te.shared;var le=te.pending;le===null?z.next=z:(z.next=le.next,le.next=z),te.pending=z}}_.lanes|=o,z=_.alternate,z!==null&&(z.lanes|=o),Ml(_.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),Ml(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}Lt(i,s,d.children,o),s=s.child}return s;case 9:return d=s.type,c=s.pendingProps.children,gs(s,o),d=li(d),c=c(d),s.flags|=1,Lt(i,s,c,o),s.child;case 14:return c=s.type,d=wi(c,s.pendingProps),d=wi(c.type,d),Lf(i,s,c,d,o);case 15:return Tf(i,s,s.type,s.pendingProps,o);case 17:return c=s.type,d=s.pendingProps,d=s.elementType===c?d:wi(c,d),Mo(i,s),s.tag=1,zt(c)?(i=!0,fo(s)):i=!1,gs(s,o),xf(s,c,d),Vl(s,c,d,o),Ql(null,s,c,!0,i,o);case 19:return Hf(i,s,o);case 22:return Bf(i,s,o)}throw Error(r(156,s.tag))};function hp(i,s){return Wh(i,s)}function jy(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 hi(i,s,o,c){return new jy(i,s,o,c)}function gc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Ay(i){if(typeof i=="function")return gc(i)?1:0;if(i!=null){if(i=i.$$typeof,i===A)return 11;if(i===Z)return 14}return 2}function vr(i,s){var o=i.alternate;return o===null?(o=hi(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 $o(i,s,o,c,d,_){var w=2;if(c=i,typeof i=="function")gc(i)&&(w=1);else if(typeof i=="string")w=5;else e:switch(i){case L:return Hr(o.children,d,_,s);case U:w=8,d|=8;break;case T:return i=hi(12,o,s,d|2),i.elementType=T,i.lanes=_,i;case O:return i=hi(13,o,s,d),i.elementType=O,i.lanes=_,i;case G:return i=hi(19,o,s,d),i.elementType=G,i.lanes=_,i;case Q:return Wo(o,d,_,s);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case K:w=10;break e;case q:w=9;break e;case A:w=11;break e;case Z:w=14;break e;case ie:w=16,c=null;break e}throw Error(r(130,i==null?i:typeof i,""))}return s=hi(w,o,s,d),s.elementType=i,s.type=c,s.lanes=_,s}function Hr(i,s,o,c){return i=hi(7,i,c,s),i.lanes=o,i}function Wo(i,s,o,c){return i=hi(22,i,c,s),i.elementType=Q,i.lanes=o,i.stateNode={isHidden:!1},i}function vc(i,s,o){return i=hi(6,i,null,s),i.lanes=o,i}function yc(i,s,o){return s=hi(4,i.children!==null?i.children:[],i.key,s),s.lanes=o,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}function Iy(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=qa(0),this.expirationTimes=qa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qa(0),this.identifierPrefix=c,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function Sc(i,s,o,c,d,_,w,D,z){return i=new Iy(i,s,o,D,z),s===1?(s=1,_===!0&&(s|=8)):s=0,_=hi(3,null,null,s),i.current=_,_.stateNode=i,_.memoizedState={element:c,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tl(_),i}function Oy(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 dp(i){if(!i)return cr;i=i._reactInternals;e:{if(Pr(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(zt(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(zt(o))return zd(i,o,s)}return s}function fp(i,s,o,c,d,_,w,D,z){return i=Sc(o,c,!0,i,d,_,w,D,z),i.context=dp(null),o=i.current,c=Tt(),d=_r(o),_=Ki(c,d),_.callback=s??null,dr(o,_,d),i.current.lanes=d,As(i,d,c),$t(i,c),i}function Uo(i,s,o,c){var d=s.current,_=Tt(),w=_r(d);return o=dp(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&&(xi(i,d,w,_),wo(i,d,w)),w}function Ko(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 pp(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var o=i.retryLane;i.retryLane=o!==0&&o<s?o:s}}function wc(i,s){pp(i,s),(i=i.alternate)&&pp(i,s)}function zy(){return null}var mp=typeof reportError=="function"?reportError:function(i){console.error(i)};function Cc(i){this._internalRoot=i}qo.prototype.render=Cc.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));Uo(i,s,null,null)},qo.prototype.unmount=Cc.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Or(function(){Uo(null,i,null,null)}),s[Fi]=null}};function qo(i){this._internalRoot=i}qo.prototype.unstable_scheduleHydration=function(i){if(i){var s=Qh();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&&ed(i)}};function bc(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 _p(){}function Fy(i,s,o,c,d){if(d){if(typeof c=="function"){var _=c;c=function(){var te=Ko(w);_.call(te)}}var w=fp(s,c,i,0,null,!1,!1,"",_p);return i._reactRootContainer=w,i[Fi]=w.current,Gs(i.nodeType===8?i.parentNode:i),Or(),w}for(;d=i.lastChild;)i.removeChild(d);if(typeof c=="function"){var D=c;c=function(){var te=Ko(z);D.call(te)}}var z=Sc(i,0,!1,null,null,!1,!1,"",_p);return i._reactRootContainer=z,i[Fi]=z.current,Gs(i.nodeType===8?i.parentNode:i),Or(function(){Uo(s,z,o,c)}),z}function Yo(i,s,o,c,d){var _=o._reactRootContainer;if(_){var w=_;if(typeof d=="function"){var D=d;d=function(){var z=Ko(w);D.call(z)}}Uo(s,w,i,d)}else w=Fy(o,s,i,d,c);return Ko(w)}Xh=function(i){switch(i.tag){case 3:var s=i.stateNode;if(s.current.memoizedState.isDehydrated){var o=js(s.pendingLanes);o!==0&&(Va(s,o|1),$t(s,et()),(je&6)===0&&(Cs=et()+500,ur()))}break;case 13:Or(function(){var c=Ui(i,1);if(c!==null){var d=Tt();xi(c,i,1,d)}}),wc(i,1)}},Ya=function(i){if(i.tag===13){var s=Ui(i,134217728);if(s!==null){var o=Tt();xi(s,i,134217728,o)}wc(i,134217728)}},Gh=function(i){if(i.tag===13){var s=_r(i),o=Ui(i,s);if(o!==null){var c=Tt();xi(o,i,s,c)}wc(i,s)}},Qh=function(){return Oe},Jh=function(i,s){var o=Oe;try{return Oe=i,s()}finally{Oe=o}},Fa=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=uo(c);if(!d)throw Error(r(90));Ge(c),Zi(c,d)}}}break;case"textarea":wt(i,o);break;case"select":s=o.value,s!=null&&It(i,!!o.multiple,s,!1)}},Ah=pc,Ih=Or;var Hy={usingClientEntryPoint:!1,Events:[Zs,cs,uo,Bh,jh,pc]},pn={findFiberByHostInstance:Dr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$y={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:H.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Hh(i),i===null?null:i.stateNode},findFiberByHostInstance:pn.findFiberByHostInstance||zy,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 Xo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xo.isDisabled&&Xo.supportsFiber)try{Kn=Xo.inject($y),Ni=Xo}catch{}}return Wt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hy,Wt.createPortal=function(i,s){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bc(s))throw Error(r(200));return Oy(i,s,null,o)},Wt.createRoot=function(i,s){if(!bc(i))throw Error(r(299));var o=!1,c="",d=mp;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onRecoverableError!==void 0&&(d=s.onRecoverableError)),s=Sc(i,1,!1,null,null,o,!1,c,d),i[Fi]=s.current,Gs(i.nodeType===8?i.parentNode:i),new Cc(s)},Wt.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=Hh(s),i=i===null?null:i.stateNode,i},Wt.flushSync=function(i){return Or(i)},Wt.hydrate=function(i,s,o){if(!Vo(s))throw Error(r(200));return Yo(null,i,s,!0,o)},Wt.hydrateRoot=function(i,s,o){if(!bc(i))throw Error(r(405));var c=o!=null&&o.hydratedSources||null,d=!1,_="",w=mp;if(o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(_=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),s=fp(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 qo(s)},Wt.render=function(i,s,o){if(!Vo(s))throw Error(r(200));return Yo(null,i,s,!1,o)},Wt.unmountComponentAtNode=function(i){if(!Vo(i))throw Error(r(40));return i._reactRootContainer?(Or(function(){Yo(null,null,i,!1,function(){i._reactRootContainer=null,i[Fi]=null})}),!0):!1},Wt.unstable_batchedUpdates=pc,Wt.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 Yo(i,s,o,!1,c)},Wt.version="18.3.1-next-f1338f8080-20240426",Wt}var xp;function Qy(){if(xp)return Ec.exports;xp=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(),Ec.exports=Gy(),Ec.exports}var kp;function Jy(){if(kp)return Go;kp=1;var e=Qy();return Go.createRoot=e.createRoot,Go.hydrateRoot=e.hydrateRoot,Go}var Zy=Jy();const e0=ch(Zy);function yt(e,t,r={}){return fetch(e,{...r,headers:{...r.headers||{},Authorization:`Bearer ${t}`}})}const C_=e=>`nc_seen_${e}`;async function Te(e,t,r={}){const n=await yt(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 jn=e=>Array.isArray(e)&&e.length?`/api/route/${e.map(encodeURIComponent).join("/")}/_`:"/api",_i=(e,t)=>`${jn(e)}/fleet/${t}`,Gr=(e,t)=>Te(_i(t,"status"),e),hh=(e,t,r)=>Te(_i(r,"up"),e,{method:"POST",body:t}),ma=(e,t,r)=>Te(_i(r,"down"),e,{method:"POST",body:t}),aa=(e,t,r)=>Te(_i(r,"restart"),e,{method:"POST",body:{cell:t}}),dh=(e,t)=>Te(_i(t,"definitions"),e),t0=(e,t,r)=>Te(_i(r,"define-engine"),e,{method:"POST",body:{def:t}}),i0=(e,t,r,n,a)=>Te(_i(a,"edit-engine"),e,{method:"POST",body:{id:t,patch:r,envChanges:n}}),r0=(e,t,r)=>Te(_i(r,"remove-engine"),e,{method:"POST",body:{id:t}}),s0=(e,t,r)=>Te(_i(r,"define-cell"),e,{method:"POST",body:{def:t}}),n0=(e,t,r,n)=>Te(_i(n,"edit-cell"),e,{method:"POST",body:{id:t,patch:r}}),b_=(e,t,r=!1,n)=>Te(_i(n,"remove-cell"),e,{method:"POST",body:{id:t,stop:r}}),o0=(e,t,r)=>Te(_i(r,"import-cell"),e,{method:"POST",body:t}),fh=(e,t,r)=>Te(`${jn(r)}/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),x_=(e,t,r)=>Te(`${jn(r)}/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),k_=e=>Te("/api/settings",e),E_=e=>Te("/api/nodes",e),a0=e=>Te("/api/topology",e),N_=(e,t)=>Te(`${jn(t)}/sessions`,e),R_=(e,t)=>Te(`${jn(t)}/config`,e),l0=(e,t)=>Te("/api/settings/config",e,{method:"POST",body:t}),c0=e=>Te("/api/settings/token/rotate",e,{method:"POST"}),P_=(e,t)=>Te("/api/settings/nodes/pair",e,{method:"POST",body:t}),u0=(e,t)=>Te("/api/settings/peering/invite",e,{method:"POST",body:t||{}}),h0=(e,t,r)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/label`,e,{method:"PATCH",body:{label:r}}),d0=(e,t)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),ph=(e,t,r)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/${r}`,e,{method:"POST"}),Ep=(e,t,r,n=[])=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{visibility:r,selected:n}}),f0=e=>Te("/api/settings/service/regenerate",e,{method:"POST"}),p0=(e,t=!0)=>Te(`/api/asks${t?"?open=1":""}`,e),m0=(e,t,r)=>Te(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:r}}),Pc=e=>Te("/api/decks",e),Np=(e,t)=>Te("/api/decks",e,{method:"POST",body:{name:t}}),Qo=(e,t,r,n)=>Te(`/api/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:r,expectedRevision:n}}),_0=(e,t,r,n)=>Te(`/api/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:r,expectedRevision:n}}),g0=(e,t,r)=>Te(`/api/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:r}}),v0={power:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 3v8"}),h.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:h.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h3.6a2 2 0 0 1 1.4.6L12.4 6H18a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z"}),keyboard:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),h.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),h.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),h.jsx("path",{d:"M12 18v3"})]}),enter:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),h.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),h.jsx("path",{d:"M22 2 11 13"})]}),trash:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M4 7h16"}),h.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),h.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),h.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:h.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),h.jsx("polyline",{points:"21 3 21 8 16 8"})]}),upload:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 16V5"}),h.jsx("polyline",{points:"8 9 12 5 16 9"}),h.jsx("path",{d:"M5 20h14"})]}),chevronLeft:h.jsx("polyline",{points:"14 6 8 12 14 18"}),attach:h.jsx("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"}),file:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M14.5 4h-5L7.5 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.5z"}),h.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),h.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),h.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"M21 21l-4.35-4.35"}),h.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"M21 21l-4.35-4.35"}),h.jsx("path",{d:"M8 11h6"})]}),gear:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),copy:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),h.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})};function Ie({name:e,size:t=20}){return h.jsx("svg",{className:"nc-icon",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:v0[e]||null})}const D_="nc_pins";function M_(){try{const e=JSON.parse(localStorage.getItem(D_));return Array.isArray(e)?e:[]}catch{return[]}}function L_(e,t){const r=e.includes(t)?e.filter(n=>n!==t):[...e,t];try{localStorage.setItem(D_,JSON.stringify(r))}catch{}return r}function bn(e,t,r){const n=e.indexOf(t);return[n===-1?1e9:n,-(r||0)]}function mu(e,t){return e[0]-t[0]||e[1]-t[1]}const mh=["it","en","es"];function y0(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return mh.includes(t)?t:"en"}catch{return"en"}}const la=y0(),T_="nc_lang",_u="nc-lang";function B_(){return typeof localStorage<"u"?localStorage:null}const Jo={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","power-config-in-settings":"Engine, provider, profilo, modello e permessi si modificano in Impostazioni → Flotta.","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","pairing-connect-help":"Per collegare un nodo servono: nome, Host SSH già funzionante e link/QR creato sull’altra installazione NexusCrew.","pairing-localhost-hint":"127.0.0.1 nel link è corretto: non aprirlo qui. NexusCrew usa invito e porta attraverso l’Host SSH.","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 o alias)","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","save-and-start":"salva e avvia",permissions:"Permessi","power-on-hint":"Spegni la cella; puoi anche toglierla dal boot.","launch-engine-help":"Provider, credenziali e nuovi engine si creano in Impostazioni → Flotta. Modello e permessi sono per questa cella.","launch-external-hint":"Provider esterno: engine/modello si configurano nel fleet esterno.","import-as-cell":"Importa come cella","import-help":"Riconcilia una sessione tmux esistente in una cella gestita. Scegli un engine già dichiarato: nessun engine viene inventato.","import-engine-required":"scegli un engine (obbligatorio)","test-and-connect":"testa e collega","pairing-v2-hint":"Incolla o scansiona UN solo link: precompila nome, Host SSH ed etichetta quando il link li include (v2).","invite-v2-hint":"Includi l’Host SSH raggiungibile così chi riceve incolla un solo link con tutto precompilato. Niente segreti nel link.","invite-ssh-hint":"Come ti raggiungono via SSH (user@host o alias). Obbligatorio: viene incluso nel link."},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","power-config-in-settings":"Edit engine, provider, profile, model and permissions in Settings → Fleet.","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","pairing-connect-help":"Connecting a node requires a name, a working SSH Host, and a link/QR created by the other NexusCrew installation.","pairing-localhost-hint":"127.0.0.1 in the link is correct: do not open it here. NexusCrew carries the invite and port through the SSH Host.","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 or alias)","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","save-and-start":"save and start",permissions:"Permissions","power-on-hint":"Stop the cell; you can also remove it from boot.","launch-engine-help":"Providers, credentials and new engines are created in Settings → Fleet. Model and permissions are per cell.","launch-external-hint":"External provider: engine/model are configured in the external fleet.","import-as-cell":"Import as cell","import-help":"Reconcile an existing tmux session into a managed cell. Pick an already-declared engine: no engine is invented.","import-engine-required":"pick an engine (required)","test-and-connect":"test and connect","pairing-v2-hint":"Paste or scan ONE link: it prefills name, SSH host and label when the link carries them (v2).","invite-v2-hint":"Include the reachable SSH host so the receiver pastes one link with everything prefilled. No secrets in the link.","invite-ssh-hint":"How they reach you over SSH (user@host or alias). Required: it is included in the link."},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","power-config-in-settings":"Modifica motor, proveedor, perfil, modelo y permisos en Ajustes → Flota.","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","pairing-connect-help":"Para conectar un nodo necesitas un nombre, un Host SSH funcional y el enlace/QR creado por la otra instalación NexusCrew.","pairing-localhost-hint":"127.0.0.1 en el enlace es correcto: no lo abras aquí. NexusCrew usa la invitación y el puerto mediante el Host SSH.","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 o alias)","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","save-and-start":"guardar e iniciar",permissions:"Permisos","power-on-hint":"Detén la celda; también puedes quitarla del boot.","launch-engine-help":"Proveedores, credenciales y nuevos motores se crean en Ajustes → Flota. Modelo y permisos son por celda.","launch-external-hint":"Proveedor externo: motor/modelo se configuran en el fleet externo.","import-as-cell":"Importar como celda","import-help":"Reconcilia una sesión tmux existente en una celda gestionada. Elige un motor ya declarado: no se inventa ninguno.","import-engine-required":"elige un motor (obligatorio)","test-and-connect":"probar y conectar","pairing-v2-hint":"Pega o escanea UN solo enlace: rellena nombre, Host SSH y etiqueta cuando los incluye (v2).","invite-v2-hint":"Incluye el Host SSH alcanzable para que quien recibe pegue un solo enlace con todo rellenado. Sin secretos en el enlace.","invite-ssh-hint":"Cómo te alcanzan por SSH (usuario@host o alias). Obligatorio: se incluye en el enlace."}};function gu(){const e=B_(),t=e?e.getItem(T_):null;return mh.includes(t)?t:la}function S0(e){const t=B_();if(t)try{t.setItem(T_,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(_u))}function b(e){const t=gu(),r=Jo[t]||Jo[la];return Object.prototype.hasOwnProperty.call(r,e)?r[e]:Object.prototype.hasOwnProperty.call(Jo[la],e)?Jo[la][e]:e}function w0(e){return typeof window>"u"?()=>{}:(window.addEventListener(_u,e),()=>window.removeEventListener(_u,e))}const j_=mh;function ei(){return[I.useSyncExternalStore(w0,gu,gu),S0]}function _a({cell:e,token:t,route:r=[],onConfirm:n,onClose:a}){var Z,ie;ei();const l=!!(e&&e.active),u=Array.isArray(r)?r.join("/"):"",[f,m]=I.useState([]),[p,y]=I.useState(!1);I.useEffect(()=>{let Q=!0;return(async()=>{if(t)try{const x=await Gr(t,u?u.split("/"):[]);if(!Q)return;if(y(x.provider==="builtin"&&(x.capabilities||[]).includes("edit")),x.provider==="builtin"&&(x.capabilities||[]).includes("definitions")){const X=await dh(t,u?u.split("/"):[]);if(!Q)return;const re=new Map((x.engines||[]).map(R=>[R.id,R]));m((X.engines||[]).map(R=>{var E,ee,M,j,se,ce,oe;return{id:R.id,label:R.label||R.id,client:((E=R.managed)==null?void 0:E.client)||"",models:[...new Set([...((ee=re.get(R.id))==null?void 0:ee.models)||[],...((M=R.managedInfo)==null?void 0:M.models)||[]])].filter(Boolean),defaultModel:((j=R.managed)==null?void 0:j.model)||((se=R.managedInfo)==null?void 0:se.defaultModel)||"",policyDefault:((ce=R.managed)==null?void 0:ce.permissionPolicy)||((oe=R.managed)!=null&&oe.client&&R.managed.client==="claude"?"unsafe":"standard")}}))}}catch{}})(),()=>{Q=!1}},[t,u]);const g=(e==null?void 0:e.engine)||((Z=f[0])==null?void 0:Z.id)||"",S=Q=>(e==null?void 0:e.models)&&e.models[Q]||"",v=Q=>{const x=(e==null?void 0:e.permissionPolicies)&&e.permissionPolicies[Q];if(x==="standard"||x==="unsafe")return x;const X=f.find(re=>re.id===Q);return X?X.policyDefault:"standard"},[C,N]=I.useState(g),[k,P]=I.useState((e==null?void 0:e.model)||""),F=(e==null?void 0:e.permissionPolicy)==="standard"||(e==null?void 0:e.permissionPolicy)==="unsafe"?e.permissionPolicy:((ie=e==null?void 0:e.permissionPolicies)==null?void 0:ie[e==null?void 0:e.engine])||"",[B,H]=I.useState(F),[Y,$]=I.useState((e==null?void 0:e.boot)??!0),[L,U]=I.useState(!1),[T,K]=I.useState(null);I.useEffect(()=>{f.length&&(N(Q=>Q||g),P(Q=>Q||S((e==null?void 0:e.engine)||g)||""),H(Q=>Q==="standard"||Q==="unsafe"?Q:v((e==null?void 0:e.engine)||g)))},[f.length]);const q=I.useMemo(()=>f.find(Q=>Q.id===C)||null,[f,C]),A=!!(q&&["claude","codex","codex-vl"].includes(q.client));function O(Q){N(Q);const x=f.find(X=>X.id===Q);P(S(Q)||(x==null?void 0:x.defaultModel)||""),H(v(Q))}async function G(Q){Q.preventDefault(),U(!0),K(null);try{if(l)await n({action:"down",boot:Y});else{const x=B==="standard"||B==="unsafe"?B:(q==null?void 0:q.policyDefault)||"standard";await n({action:"up",...p?{engine:C,model:k||"",...A?{permissionPolicy:x}:(q==null?void 0:q.client)==="pi"?{permissionPolicy:"standard"}:{}}:{},boot:Y})}a()}catch(x){K(String(x&&x.message||x)),U(!1)}}return h.jsx("div",{className:"nc-sheet-overlay nc-launch-overlay",onClick:a,children:h.jsxs("form",{className:"nc-sheet nc-power-sheet nc-launch-sheet",onClick:Q=>Q.stopPropagation(),onSubmit:G,children:[h.jsxs("div",{className:"nc-sheet-head",children:[h.jsx("b",{children:e==null?void 0:e.cell}),h.jsx("span",{className:"nc-sheet-state",children:b(l?"state-on":"state-off")})]}),l?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-power-config",children:[h.jsx("span",{children:b("engine")}),h.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&h.jsxs("small",{children:[b("model"),": ",e.model]}),h.jsx("small",{children:b("power-on-hint")})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:Y,onChange:Q=>$(Q.target.checked)}),b("remove-boot")]})]}):h.jsxs(h.Fragment,{children:[p&&f.length>0?h.jsxs("div",{className:"nc-launch-fields",children:[h.jsxs("label",{className:"nc-field",children:[b("engine"),h.jsx("select",{value:C,onChange:Q=>O(Q.target.value),children:f.map(Q=>h.jsx("option",{value:Q.id,children:Q.label},Q.id))})]}),h.jsxs("label",{className:"nc-field",children:[b("model"),h.jsx("input",{value:k,list:"nc-launch-models",placeholder:b("model-default"),onChange:Q=>P(Q.target.value)}),h.jsx("datalist",{id:"nc-launch-models",children:((q==null?void 0:q.models)||[]).map(Q=>h.jsx("option",{value:Q},Q))})]}),A?h.jsxs("label",{className:"nc-field",children:[b("permissions"),h.jsxs("select",{value:B,onChange:Q=>H(Q.target.value),children:[h.jsx("option",{value:"standard",children:b("fleet-standard-permissions")}),h.jsx("option",{value:"unsafe",children:b("fleet-unsafe-permissions")})]})]}):h.jsx("small",{className:"nc-note",children:b("fleet-standard-permissions")}),A&&B==="unsafe"&&h.jsx("small",{className:"nc-err",children:b("fleet-unsafe-warning")}),h.jsx("small",{className:"nc-note",children:b("launch-engine-help")})]}):h.jsxs("div",{className:"nc-power-config",children:[h.jsx("span",{children:b("engine")}),h.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&h.jsxs("small",{children:[b("model"),": ",e.model]}),h.jsx("small",{children:b("launch-external-hint")})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:Y,onChange:Q=>$(Q.target.checked)}),b("boot-persist")]})]}),T&&h.jsx("div",{className:"nc-err",children:T}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:a,disabled:L,children:b("cancel")}),h.jsx("button",{type:"submit",className:"nc-btn primary",disabled:L,children:b(l?"power-off":"save-and-start")})]})]})})}const Rp=/^[a-z0-9-]{1,32}$/;function C0(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 u=l.join("/");a.status==="up"||a.tunnel&&a.tunnel.status==="up"||(n[u]=e&&e[u]||r)}return n}function Pp(e,t,r){return!e||!Array.isArray(e.cells)?[]:e.cells.map(n=>({...n,route:t,key:`${r}:${n.cell||n.tmuxSession}`}))}function Dp({nodes:e,topology:t,remote:r,down:n,fleet:a}={}){var m,p,y;const l=[],u=new Set,f=new Set;for(const g of Array.isArray(e)?e:[]){if(!g||typeof g.name!="string"||!Rp.test(g.name))continue;const S=[g.name],v=g.name;u.add(v);const C=((m=g.tunnel)==null?void 0:m.status)||"unknown",N=C==="up",k={name:g.name,label:g.label||g.name,route:S,direct:!0,tunnelStatus:C,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({...k,status:"needs-repair",downSince:n&&n[v]||null});continue}if(((p=g.health)==null?void 0:p.auth)==="failed"||C==="degraded"&&((y=g.health)==null?void 0:y.status)==="degraded"){l.push({...k,status:"needs-repair",downSince:n&&n[v]||null});continue}if(!N){l.push({...k,status:"down",downSince:n&&n[v]||null});continue}const P=r&&(r[v]||r[g.name])||null;if(!P||P.error||!Array.isArray(P.sessions)){l.push({...k,status:"unreachable"});continue}const F=P.sessions.filter($=>$&&typeof $.name=="string"&&$.name).map($=>({...$,node:v,route:S,key:`${v}:${$.name}`})),B=a&&(a[v]||a[g.name]),H=Pp(B,S,v),Y=new Set(H.map($=>$.tmuxSession).filter(Boolean));l.push({...k,status:"up",sessions:F,cells:H,unmanaged:F.filter($=>!Y.has($.name)),fleetAvailable:!!(B&&B.available),capabilities:B&&B.capabilities||[],engines:B&&B.engines||[],fleetProvider:B&&B.provider||null})}for(const g of Array.isArray(t)?t:[]){if(!g||!Array.isArray(g.route)||g.route.length<1||g.route.some(B=>!Rp.test(B)))continue;const S=g.route.join("/");if(u.has(S)||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[S]||g.lastSeen||null});continue}const C=r&&r[S]||null;if(!C||C.error||!Array.isArray(C.sessions)){l.push({...v,status:"unreachable",downSince:n&&n[S]||null});continue}const N=C.sessions.filter(B=>B&&typeof B.name=="string"&&B.name).map(B=>({...B,node:S,route:g.route,key:`${S}:${B.name}`})),k=a&&a[S],P=Pp(k,g.route,S),F=new Set(P.map(B=>B.tmuxSession).filter(Boolean));l.push({...v,status:"up",sessions:N,cells:P,unmanaged:N.filter(B=>!F.has(B.name)),fleetAvailable:!!(k&&k.available),capabilities:k&&k.capabilities||[],engines:k&&k.engines||[],fleetProvider:k&&k.provider||null,lastSeen:g.lastSeen||null})}return l.sort((g,S)=>g.label.localeCompare(S.label))}const b0=4e3;function _h(e,t=!0){const[r,n]=I.useState([]),a=I.useRef({});return I.useEffect(()=>{if(!t||!e){n([]);return}let l=!0;async function u(){var N;let m=[],p=[];if(await Promise.all([E_(e).then(k=>{m=Array.isArray(k.nodes)?k.nodes:[]}).catch(()=>{}),a0(e).then(k=>{p=Array.isArray(k.nodes)?k.nodes:[]}).catch(()=>{})]),!l)return;const y={},g={},S=new Set(m.map(k=>k.name)),v=[];for(const k of m)((N=k.tunnel)==null?void 0:N.status)==="up"&&(k.nodeId||k.paired!==!1)&&v.push([k.name]);for(const k of p)!k.stale&&Array.isArray(k.route)&&!(k.route.length===1&&S.has(k.route[0]))&&v.push(k.route);if(await Promise.all(v.map(async k=>{const P=k.join("/");try{y[P]=await N_(e,k)}catch{y[P]={error:"unreachable"}}try{g[P]=await Gr(e,k)}catch{g[P]={available:!1}}})),!l)return;const C=Dp({nodes:m,topology:p,remote:y,fleet:g,down:a.current});a.current=C0(a.current,C,Math.floor(Date.now()/1e3)),n(Dp({nodes:m,topology:p,remote:y,fleet:g,down:a.current}))}u();const f=setInterval(u,b0);return()=>{l=!1,clearInterval(f)}},[e,t]),r}function Mp(e,t){return t?0:e.attached?1:2}function Pn(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 Dc(e){return e.status==="down"?e.downSince?b("tunnel-down-since").replace("{t}",Pn(e.downSince)):b("tunnel-down"):e.status==="unreachable"?b("node-unreachable"):e.status==="offline"?e.lastSeen?b("node-offline-seen").replace("{t}",Pn(e.lastSeen)):b("node-offline"):e.status==="needs-repair"?b("node-needs-repair"):""}function x0(e){return e?e.status==="healthy"?"on":"warn":null}function Lp(e){return e&&(e.detail||e.status)||""}function k0({onPick:e,token:t,onSettings:r}){const[n,a]=ei(),l=_h(t),[u,f]=I.useState(null),[m,p]=I.useState(null),[y,g]=I.useState(""),[S,v]=I.useState(""),[C,N]=I.useState({bind:"127.0.0.1",port:""}),[k,P]=I.useState([]),[F,B]=I.useState(!1),[H,Y]=I.useState(null),[$,L]=I.useState(null);async function U(){try{const j=await(await yt("/api/sessions",t)).json();j.error?(p(j.error),f([])):(p(null),f(j.sessions||[]))}catch(M){p(String(M)),f([])}try{const M=await Gr(t);B(!!M.available),P(M.available?M.cells||[]:[])}catch{B(!1),P([])}}I.useEffect(()=>{U(),yt("/api/config",t).then(j=>j.json()).then(j=>{v(j.version||""),N({bind:j.bind||"127.0.0.1",port:j.port||""})}).catch(()=>{});const M=setInterval(U,4e3);return()=>clearInterval(M)},[]);async function T(){if(!C.port)return;const M=`http://${C.bind}:${C.port}/#token=${t}`;try{await navigator.clipboard.writeText(M)}catch{}}async function K(M){if(!H)return;const{cell:j}=H,se=Array.isArray(H.route)?H.route:[];M.action==="up"?await hh(t,{cell:j,boot:!!M.boot,...M.engine?{engine:M.engine}:{},...M.model!==void 0?{model:M.model}:{},...M.permissionPolicy?{permissionPolicy:M.permissionPolicy}:{}},se):await ma(t,{cell:j,boot:!!M.boot},se),U()}async function q(M,j=[]){try{await fh(t,M,j)}catch{return}U()}async function A(M){if(!(!(M!=null&&M.direct)||$)){L(M.name);try{await ph(t,M.name,M.tunnelStatus==="up"?"down":"up")}catch{}L(null)}}const O=I.useMemo(()=>{const M=new Map;for(const j of u||[])M.set(j.name,j);return M},[u]),G=I.useMemo(()=>new Set(k.map(M=>M.tmuxSession)),[k]),[Z,ie]=I.useState(M_),Q=M=>ie(j=>L_(j,M)),x=I.useMemo(()=>{const M=(u||[]).map(se=>{const ce=Number(localStorage.getItem(C_(se.name))||0),oe=!!(se.outbox&&se.outbox.count>0&&se.outbox.latest>ce);return{...se,fresh:oe}}),j=y.trim().toLowerCase();return M.filter(se=>!j||se.name.toLowerCase().includes(j)).sort((se,ce)=>mu(bn(Z,se.name,se.activity),bn(Z,ce.name,ce.activity))||Mp(se,se.fresh)-Mp(ce,ce.fresh)||se.name.localeCompare(ce.name))},[u,y,Z]),X=x.filter(M=>!G.has(M.name)),re=I.useMemo(()=>[...k].sort((M,j)=>mu(bn(Z,M.tmuxSession,(O.get(M.tmuxSession)||{}).activity),bn(Z,j.tmuxSession,(O.get(j.tmuxSession)||{}).activity))||Number(j.active)-Number(M.active)||M.cell.localeCompare(j.cell)),[k,Z,O]),R=u?u.length:0,E=(u||[]).filter(M=>M.attached).length,ee=C.port?`${C.bind}:${C.port}`:C.bind;return h.jsxs("div",{className:"nc-home",children:[h.jsxs("header",{className:"nc-home-head",children:[h.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",h.jsx("span",{className:"nc-cursor"})]}),h.jsxs("div",{className:"nc-home-sub",children:[b("fleet-tmux")," · ",R," ",b("sessions"),E>0&&` · ${E} attached`]}),h.jsxs("span",{className:"nc-head-actions",children:[h.jsx("button",{className:"nc-refresh",onClick:()=>r("nodes",!1),title:b("settings"),children:h.jsx(Ie,{name:"gear",size:18})}),h.jsx("button",{className:"nc-refresh",onClick:U,title:b("refresh"),children:h.jsx(Ie,{name:"refresh",size:18})})]})]}),R>8&&h.jsx("input",{className:"nc-filter",type:"search",placeholder:b("filter-placeholder"),value:y,onChange:M=>g(M.target.value)}),m&&h.jsx("div",{className:"nc-err",children:m}),F&&k.length>0&&h.jsxs("section",{className:"nc-group",children:[h.jsx("div",{className:"nc-group-title",children:b("fleet")}),re.map(M=>{const j=O.get(M.tmuxSession)||{},se=M.degraded?"warn":M.tmux?"on":"",ce=[`${M.engine}${M.key?`·${M.key}`:""}`,j.preview].filter(Boolean).join(" · ");return h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>M.tmux&&e(M.tmuxSession),title:M.degraded?b("cell-degraded"):M.tmux?b("cell-on"):b("cell-off"),children:[h.jsx("span",{className:`dot ${se}`}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:M.cell}),h.jsx("small",{children:ce})]})]}),j.activity?h.jsx("span",{className:"nc-rel",children:Pn(j.activity)}):null,j.outbox&&j.outbox.count>0&&h.jsx("span",{className:"nc-badge",title:b("new-files-outbox"),children:j.outbox.count}),h.jsx("button",{className:`nc-act pin${Z.includes(M.tmuxSession)?" on":""}`,title:b("pin"),onClick:()=>Q(M.tmuxSession),children:Z.includes(M.tmuxSession)?"★":"☆"}),h.jsx("button",{className:`nc-act power${M.tmux?" on":""}${M.degraded?" warn":""}`,onClick:()=>Y(M),title:M.active?b("power-off"):b("power-on"),children:h.jsx(Ie,{name:"power",size:16})})]},M.cell)})]}),h.jsxs("section",{className:"nc-group",children:[h.jsx("div",{className:"nc-group-title",children:b("local")}),X.map(M=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>e(M.name),children:[h.jsx("span",{className:M.attached?"dot on":"dot"}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:M.name}),h.jsx("small",{children:M.preview?M.preview:M.cmd?M.cmd:b("windows").replace("{n}",String(M.windows||0))})]})]}),M.activity?h.jsx("span",{className:"nc-rel",children:Pn(M.activity)}):null,M.fresh&&h.jsx("span",{className:"nc-badge",title:b("new-files-outbox"),children:M.outbox.count}),h.jsx("button",{className:`nc-act pin${Z.includes(M.name)?" on":""}`,title:b("pin"),onClick:()=>Q(M.name),children:Z.includes(M.name)?"★":"☆"}),h.jsx("button",{className:"nc-menu",title:b("terminate"),onClick:()=>{window.confirm(b("terminate-confirm").replace("{name}",M.name))&&q(M.name)},children:"⋯"})]},M.name)),u===null&&h.jsx("div",{className:"nc-empty",children:b("loading-fleet")}),u!==null&&X.length===0&&x.length===0&&!m&&h.jsx("div",{className:"nc-empty",children:y?b("no-match").replace("{q}",y):b("no-sessions")})]}),l.map(M=>{const se=x0(M.health)||(M.status==="up"?"on":"warn"),ce=M.health?Lp(M.health):M.status==="up"?"":Dc(M);return h.jsxs("section",{className:"nc-group",children:[h.jsxs("div",{className:"nc-group-title nc-node-title",children:[h.jsx("span",{className:`dot ${se}`,title:ce}),M.label||M.name," · ",M.status==="up"?b("node-sessions").replace("{n}",String(M.cells.length+M.unmanaged.length)):M.health&&Lp(M.health)||Dc(M),M.direct&&M.health&&M.health.managed!==!1&&h.jsx("button",{type:"button",className:`nc-act power${M.tunnelStatus==="up"?" on":""}`,disabled:$===M.name,title:M.tunnelStatus==="up"?b("power-off"):b("power-on"),onClick:()=>A(M),children:h.jsx(Ie,{name:"power",size:15})})]}),M.status==="up"&&M.cells.length>0&&M.cells.map(oe=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>oe.tmux&&e({session:oe.tmuxSession,node:(M.route||[M.name]).join("/")}),title:oe.active?b("cell-on"):b("cell-off"),children:[h.jsx("span",{className:`dot ${oe.degraded?"warn":oe.tmux?"on":""}`}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:oe.cell}),h.jsxs("small",{children:[`${oe.engine}${oe.key?`·${oe.key}`:""}`,oe.active?"":` · ${b("cell-off")}`]})]})]}),(M.capabilities||[]).includes(oe.active?"down":"up")&&h.jsx("button",{className:`nc-act power${oe.active?" on":""}${oe.degraded?" warn":""}`,title:oe.active?b("power-off"):b("power-on"),onClick:()=>Y({...oe,route:M.route}),children:h.jsx(Ie,{name:"power",size:15})})]},oe.key)),M.status==="up"&&M.unmanaged.map(oe=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>e({session:oe.name,node:oe.node}),children:[h.jsx("span",{className:oe.attached?"dot on":"dot"}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:oe.name}),h.jsx("small",{children:oe.preview?oe.preview:oe.cmd?oe.cmd:b("windows").replace("{n}",String(oe.windows||0))})]})]}),oe.activity?h.jsx("span",{className:"nc-rel",children:Pn(oe.activity)}):null,h.jsx("button",{className:"nc-menu",title:b("terminate"),onClick:()=>{window.confirm(b("terminate-confirm").replace("{name}",oe.name))&&q(oe.name,M.route)},children:"⋯"})]},oe.key)),M.status==="up"&&M.cells.length===0&&M.unmanaged.length===0&&h.jsx("div",{className:"nc-empty",children:b("no-sessions-short")})]},`nodo-${(M.route||[M.name]).join("/")}`)}),h.jsxs("footer",{className:"nc-home-foot",onClick:T,title:b("copy-url"),children:[S&&h.jsxs("span",{children:["v",S]}),h.jsxs("span",{children:[ee," · ",b("ssh-only")]}),h.jsx("span",{className:"nc-lang",onClick:M=>M.stopPropagation(),children:j_.map((M,j)=>h.jsxs("span",{children:[j>0&&" · ",h.jsx("button",{className:`nc-lang-btn${n===M?" on":""}`,onClick:()=>a(M),title:M,children:M.toUpperCase()})]},M))})]}),h.jsx("button",{className:"nc-fab",onClick:()=>r("fleet",!0),title:b("fleet-new-cell"),"aria-label":b("fleet-new-cell"),children:"+"}),H&&h.jsx(_a,{cell:H,token:t,route:Array.isArray(H.route)?H.route:[],onConfirm:K,onClose:()=>Y(null)})]})}/**
|
|
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 A_=Object.defineProperty,E0=Object.getOwnPropertyDescriptor,N0=(e,t)=>{for(var r in t)A_(e,r,{get:t[r],enumerable:!0})},Ze=(e,t,r,n)=>{for(var a=n>1?void 0:n?E0(t,r):t,l=e.length-1,u;l>=0;l--)(u=e[l])&&(a=(n?u(t,r,a):u(a))||a);return n&&a&&A_(t,r,a),a},me=(e,t)=>(r,n)=>t(r,n,e),Tp="Terminal input",vu={get:()=>Tp,set:e=>Tp=e},Bp="Too much output to announce, navigate to rows manually to read",yu={get:()=>Bp,set:e=>Bp=e};function R0(e){return e.replace(/\r?\n/g,"\r")}function P0(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function D0(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function M0(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");I_(a,t,r,n)}}function I_(e,t,r,n){e=R0(e),e=P0(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function O_(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 jp(e,t,r,n,a){O_(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 Da(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 L0=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 u=e.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=r)return this._interim=u,n;let f=e.charCodeAt(l);56320<=f&&f<=57343?t[n++]=(u-55296)*1024+f-56320+65536:(t[n++]=u,t[n++]=f);continue}u!==65279&&(t[n++]=u)}return n}},T0=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,u,f,m=0,p=0;if(this.interim[0]){let S=!1,v=this.interim[0];v&=(v&224)===192?31:(v&240)===224?15:7;let C=0,N;for(;(N=this.interim[++C]&63)&&C<4;)v<<=6,v|=N;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,P=k-C;for(;p<P;){if(p>=r)return 0;if(N=e[p++],(N&192)!==128){p--,S=!0;break}else this.interim[C++]=N,v<<=6,v|=N&63}S||(k===2?v<128?p--:t[n++]=v:k===3?v<2048||v>=55296&&v<=57343||v===65279||(t[n++]=v):v<65536||v>1114111||(t[n++]=v)),this.interim.fill(0)}let y=r-4,g=p;for(;g<r;){for(;g<y&&!((a=e[g])&128)&&!((l=e[g+1])&128)&&!((u=e[g+2])&128)&&!((f=e[g+3])&128);)t[n++]=a,t[n++]=l,t[n++]=u,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(u=e[g++],(u&192)!==128){g--;continue}if(m=(a&15)<<12|(l&63)<<6|u&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(u=e[g++],(u&192)!==128){g--;continue}if(g>=r)return this.interim[0]=a,this.interim[1]=l,this.interim[2]=u,n;if(f=e[g++],(f&192)!==128){g--;continue}if(m=(a&7)<<18|(l&63)<<12|(u&63)<<6|f&63,m<65536||m>1114111)continue;t[n++]=m}}return n}},z_="",Er=" ",An=class F_{constructor(){this.fg=0,this.bg=0,this.extended=new ga}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 F_;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}},ga=class H_{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 H_(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},mi=class $_ extends An{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ga,this.combinedData=""}static fromCharData(t){let r=new $_;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()]}},Ap="di$target",Su="di$dependencies",Mc=new Map;function B0(e){return e[Su]||[]}function St(e){if(Mc.has(e))return Mc.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");j0(t,r,a)};return t._id=e,Mc.set(e,t),t}function j0(e,t,r){t[Ap]===t?t[Su].push({id:e,index:r}):(t[Su]=[{id:e,index:r}],t[Ap]=t)}var jt=St("BufferService"),W_=St("CoreMouseService"),Qr=St("CoreService"),A0=St("CharsetService"),gh=St("InstantiationService"),U_=St("LogService"),At=St("OptionsService"),K_=St("OscLinkService"),I0=St("UnicodeService"),In=St("DecorationService"),wu=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var y;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,u=r.getTrimmedLength(),f=-1,m=-1,p=!1;for(let g=0;g<u;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===u-1){let S=(y=this._oscLinkService.getLinkData(f))==null?void 0:y.uri;if(S){let v={start:{x:m+1,y:e},end:{x:g+(!p&&g===u-1?1:0),y:e}},C=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let N=new URL(S);["http:","https:"].includes(N.protocol)||(C=!0)}catch{C=!0}C||n.push({text:S,range:v,activate:(N,k)=>a?a.activate(N,k,v):O0(N,k),hover:(N,k)=>{var P;return(P=a==null?void 0:a.hover)==null?void 0:P.call(a,N,k,v)},leave:(N,k)=>{var P;return(P=a==null?void 0:a.leave)==null?void 0:P.call(a,N,k,v)}})}p=!1,l.hasExtendedAttrs()&&l.extended.urlId?(m=g,f=l.extended.urlId):(m=-1,f=-1)}}t(n)}};wu=Ze([me(0,jt),me(1,At),me(2,K_)],wu);function O0(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 Ma=St("CharSizeService"),Qi=St("CoreBrowserService"),vh=St("MouseService"),Ji=St("RenderService"),z0=St("SelectionService"),q_=St("CharacterJoinerService"),Ps=St("ThemeService"),V_=St("LinkProviderService"),F0=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ip.isErrorNoTelemetry(e)?new Ip(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)}},H0=new F0;function ca(e){$0(e)||H0.onUnexpectedError(e)}var Cu="Canceled";function $0(e){return e instanceof W0?!0:e instanceof Error&&e.name===Cu&&e.message===Cu}var W0=class extends Error{constructor(){super(Cu),this.name=this.message}};function U0(e){return new Error(`Illegal argument: ${e}`)}var Ip=class bu extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof bu)return t;let r=new bu;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},xu=class Y_ extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Y_.prototype)}};function Qt(e,t=0){return e[e.length-(1+t)]}var K0;(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})(K0||(K0={}));function q0(e,t){let r=this,n=!1,a;return function(){return n||(n=!0,t||(a=e.apply(r,arguments))),a}}var X_;(e=>{function t(H){return H&&typeof H=="object"&&typeof H[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*a(H){yield H}e.single=a;function l(H){return t(H)?H:a(H)}e.wrap=l;function u(H){return H||r}e.from=u;function*f(H){for(let Y=H.length-1;Y>=0;Y--)yield H[Y]}e.reverse=f;function m(H){return!H||H[Symbol.iterator]().next().done===!0}e.isEmpty=m;function p(H){return H[Symbol.iterator]().next().value}e.first=p;function y(H,Y){let $=0;for(let L of H)if(Y(L,$++))return!0;return!1}e.some=y;function g(H,Y){for(let $ of H)if(Y($))return $}e.find=g;function*S(H,Y){for(let $ of H)Y($)&&(yield $)}e.filter=S;function*v(H,Y){let $=0;for(let L of H)yield Y(L,$++)}e.map=v;function*C(H,Y){let $=0;for(let L of H)yield*Y(L,$++)}e.flatMap=C;function*N(...H){for(let Y of H)yield*Y}e.concat=N;function k(H,Y,$){let L=$;for(let U of H)L=Y(L,U);return L}e.reduce=k;function*P(H,Y,$=H.length){for(Y<0&&(Y+=H.length),$<0?$+=H.length:$>H.length&&($=H.length);Y<$;Y++)yield H[Y]}e.slice=P;function F(H,Y=Number.POSITIVE_INFINITY){let $=[];if(Y===0)return[$,H];let L=H[Symbol.iterator]();for(let U=0;U<Y;U++){let T=L.next();if(T.done)return[$,e.empty()];$.push(T.value)}return[$,{[Symbol.iterator](){return L}}]}e.consume=F;async function B(H){let Y=[];for await(let $ of H)Y.push($);return Promise.resolve(Y)}e.asyncToArray=B})(X_||(X_={}));function Yr(e){if(X_.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 V0(...e){return Ke(()=>Yr(e))}function Ke(e){return{dispose:q0(()=>{e()})}}var G_=class Q_{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{Yr(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?Q_.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)}};G_.DISABLE_DISPOSED_WARNING=!1;var Nr=G_,De=class{constructor(){this._store=new Nr,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)}};De.None=Object.freeze({dispose(){}});var Rs=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,ku=class Eu{constructor(t){this.element=t,this.next=Eu.Undefined,this.prev=Eu.Undefined}};ku.Undefined=new ku(void 0);var Ye=ku,Op=class{constructor(){this._first=Ye.Undefined,this._last=Ye.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ye.Undefined}clear(){let e=this._first;for(;e!==Ye.Undefined;){let t=e.next;e.prev=Ye.Undefined,e.next=Ye.Undefined,e=t}this._first=Ye.Undefined,this._last=Ye.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Ye(e);if(this._first===Ye.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!==Ye.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ye.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ye.Undefined&&e.next!==Ye.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ye.Undefined&&e.next===Ye.Undefined?(this._first=Ye.Undefined,this._last=Ye.Undefined):e.next===Ye.Undefined?(this._last=this._last.prev,this._last.next=Ye.Undefined):e.prev===Ye.Undefined&&(this._first=this._first.next,this._first.prev=Ye.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ye.Undefined;)yield e.element,e=e.next}},Y0=globalThis.performance&&typeof globalThis.performance.now=="function",X0=class J_{static create(t){return new J_(t)}constructor(t){this._now=Y0&&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}},kt;(e=>{e.None=()=>De.None;function t(A,O){return g(A,()=>{},0,void 0,!0,void 0,O)}e.defer=t;function r(A){return(O,G=null,Z)=>{let ie=!1,Q;return Q=A(x=>{if(!ie)return Q?Q.dispose():ie=!0,O.call(G,x)},null,Z),ie&&Q.dispose(),Q}}e.once=r;function n(A,O,G){return p((Z,ie=null,Q)=>A(x=>Z.call(ie,O(x)),null,Q),G)}e.map=n;function a(A,O,G){return p((Z,ie=null,Q)=>A(x=>{O(x),Z.call(ie,x)},null,Q),G)}e.forEach=a;function l(A,O,G){return p((Z,ie=null,Q)=>A(x=>O(x)&&Z.call(ie,x),null,Q),G)}e.filter=l;function u(A){return A}e.signal=u;function f(...A){return(O,G=null,Z)=>{let ie=V0(...A.map(Q=>Q(x=>O.call(G,x))));return y(ie,Z)}}e.any=f;function m(A,O,G,Z){let ie=G;return n(A,Q=>(ie=O(ie,Q),ie),Z)}e.reduce=m;function p(A,O){let G,Z={onWillAddFirstListener(){G=A(ie.fire,ie)},onDidRemoveLastListener(){G==null||G.dispose()}},ie=new de(Z);return O==null||O.add(ie),ie.event}function y(A,O){return O instanceof Array?O.push(A):O&&O.add(A),A}function g(A,O,G=100,Z=!1,ie=!1,Q,x){let X,re,R,E=0,ee,M={leakWarningThreshold:Q,onWillAddFirstListener(){X=A(se=>{E++,re=O(re,se),Z&&!R&&(j.fire(re),re=void 0),ee=()=>{let ce=re;re=void 0,R=void 0,(!Z||E>1)&&j.fire(ce),E=0},typeof G=="number"?(clearTimeout(R),R=setTimeout(ee,G)):R===void 0&&(R=0,queueMicrotask(ee))})},onWillRemoveListener(){ie&&E>0&&(ee==null||ee())},onDidRemoveLastListener(){ee=void 0,X.dispose()}},j=new de(M);return x==null||x.add(j),j.event}e.debounce=g;function S(A,O=0,G){return e.debounce(A,(Z,ie)=>Z?(Z.push(ie),Z):[ie],O,void 0,!0,void 0,G)}e.accumulate=S;function v(A,O=(Z,ie)=>Z===ie,G){let Z=!0,ie;return l(A,Q=>{let x=Z||!O(Q,ie);return Z=!1,ie=Q,x},G)}e.latch=v;function C(A,O,G){return[e.filter(A,O,G),e.filter(A,Z=>!O(Z),G)]}e.split=C;function N(A,O=!1,G=[],Z){let ie=G.slice(),Q=A(re=>{ie?ie.push(re):X.fire(re)});Z&&Z.add(Q);let x=()=>{ie==null||ie.forEach(re=>X.fire(re)),ie=null},X=new de({onWillAddFirstListener(){Q||(Q=A(re=>X.fire(re)),Z&&Z.add(Q))},onDidAddFirstListener(){ie&&(O?setTimeout(x):x())},onDidRemoveLastListener(){Q&&Q.dispose(),Q=null}});return Z&&Z.add(X),X.event}e.buffer=N;function k(A,O){return(G,Z,ie)=>{let Q=O(new F);return A(function(x){let X=Q.evaluate(x);X!==P&&G.call(Z,X)},void 0,ie)}}e.chain=k;let P=Symbol("HaltChainable");class F{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(G=>(O(G),G)),this}filter(O){return this.steps.push(G=>O(G)?G:P),this}reduce(O,G){let Z=G;return this.steps.push(ie=>(Z=O(Z,ie),Z)),this}latch(O=(G,Z)=>G===Z){let G=!0,Z;return this.steps.push(ie=>{let Q=G||!O(ie,Z);return G=!1,Z=ie,Q?ie:P}),this}evaluate(O){for(let G of this.steps)if(O=G(O),O===P)break;return O}}function B(A,O,G=Z=>Z){let Z=(...X)=>x.fire(G(...X)),ie=()=>A.on(O,Z),Q=()=>A.removeListener(O,Z),x=new de({onWillAddFirstListener:ie,onDidRemoveLastListener:Q});return x.event}e.fromNodeEventEmitter=B;function H(A,O,G=Z=>Z){let Z=(...X)=>x.fire(G(...X)),ie=()=>A.addEventListener(O,Z),Q=()=>A.removeEventListener(O,Z),x=new de({onWillAddFirstListener:ie,onDidRemoveLastListener:Q});return x.event}e.fromDOMEventEmitter=H;function Y(A){return new Promise(O=>r(A)(O))}e.toPromise=Y;function $(A){let O=new de;return A.then(G=>{O.fire(G)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}e.fromPromise=$;function L(A,O){return A(G=>O.fire(G))}e.forward=L;function U(A,O,G){return O(G),A(Z=>O(Z))}e.runAndSubscribe=U;class T{constructor(O,G){this._observable=O,this._counter=0,this._hasChanged=!1;let Z={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};this.emitter=new de(Z),G&&G.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,G){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function K(A,O){return new T(A,O).emitter.event}e.fromObservable=K;function q(A){return(O,G,Z)=>{let ie=0,Q=!1,x={beginUpdate(){ie++},endUpdate(){ie--,ie===0&&(A.reportChanges(),Q&&(Q=!1,O.call(G)))},handlePossibleChange(){},handleChange(){Q=!0}};A.addObserver(x),A.reportChanges();let X={dispose(){A.removeObserver(x)}};return Z instanceof Nr?Z.add(X):Array.isArray(Z)&&Z.push(X),X}}e.fromObservableLight=q})(kt||(kt={}));var Nu=class Ru{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ru._idPool++}`,Ru.all.add(this)}start(t){this._stopWatch=new X0,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}}};Nu.all=new Set,Nu._idPool=0;var G0=Nu,Q0=-1,Z_=class eg{constructor(t,r,n=(eg._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,u]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${u}):`;console.warn(f),console.warn(l);let m=new eS(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}};Z_._idPool=1;var J0=Z_,Z0=class tg{constructor(t){this.value=t}static create(){let t=new Error;return new tg(t.stack??"")}print(){console.warn(this.value.split(`
|
|
58
|
+
`).slice(2).join(`
|
|
59
|
+
`))}},eS=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},tS=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},iS=0,Lc=class{constructor(e){this.value=e,this.id=iS++}},rS=2,sS,de=class{constructor(e){var t,r,n,a;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new J0((e==null?void 0:e.onListenerError)??ca,((r=this._options)==null?void 0:r.leakWarningThreshold)??Q0):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new G0(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 u,f,m,p,y;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 S=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],v=new tS(`${g}. HINT: Stack shows most frequent listener (${S[1]}-times)`,S[0]);return(((u=this._options)==null?void 0:u.onListenerError)||ca)(v),De.None}if(this._disposed)return De.None;t&&(e=e.bind(t));let n=new Lc(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=Z0.create(),a=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof Lc?(this._deliveryQueue??(this._deliveryQueue=new nS),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,(y=(p=this._options)==null?void 0:p.onDidAddFirstListener)==null||y.call(p,this)),this._size++;let l=Ke(()=>{a==null||a(),this._removeListener(n)});return r instanceof Nr?r.add(l):Array.isArray(r)&&r.push(l),l}),this._event}_removeListener(e){var a,l,u,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=(u=this._options)==null?void 0:u.onDidRemoveLastListener)==null||f.call(u,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*rS<=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)||ca;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 Lc)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}},nS=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}},Pu=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new de,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new de,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}};Pu.INSTANCE=new Pu;var yh=Pu;function oS(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}yh.INSTANCE.onDidChangeZoomLevel;function aS(e){return yh.INSTANCE.getZoomFactor(e)}yh.INSTANCE.onDidChangeFullscreen;var Ds=typeof navigator=="object"?navigator.userAgent:"",Du=Ds.indexOf("Firefox")>=0,lS=Ds.indexOf("AppleWebKit")>=0,Sh=Ds.indexOf("Chrome")>=0,cS=!Sh&&Ds.indexOf("Safari")>=0;Ds.indexOf("Electron/")>=0;Ds.indexOf("Android")>=0;var Tc=!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)");Tc=e.matches,oS(Xi,e,({matches:r})=>{Tc&&t.matches||(Tc=r)})}var Ns="en",Mu=!1,Lu=!1,ua=!1,ig=!1,Zo,ha=Ns,zp=Ns,uS,ki,Vr=globalThis,xt,y_;typeof Vr.vscode<"u"&&typeof Vr.vscode.process<"u"?xt=Vr.vscode.process:typeof process<"u"&&typeof((y_=process==null?void 0:process.versions)==null?void 0:y_.node)=="string"&&(xt=process);var S_,hS=typeof((S_=xt==null?void 0:xt.versions)==null?void 0:S_.electron)=="string",dS=hS&&(xt==null?void 0:xt.type)==="renderer",w_;if(typeof xt=="object"){Mu=xt.platform==="win32",Lu=xt.platform==="darwin",ua=xt.platform==="linux",ua&&xt.env.SNAP&&xt.env.SNAP_REVISION,xt.env.CI||xt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zo=Ns,ha=Ns;let e=xt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Zo=t.userLocale,zp=t.osLocale,ha=t.resolvedLanguage||Ns,uS=(w_=t.languagePack)==null?void 0:w_.translationsConfigFile}catch{}ig=!0}else typeof navigator=="object"&&!dS?(ki=navigator.userAgent,Mu=ki.indexOf("Windows")>=0,Lu=ki.indexOf("Macintosh")>=0,(ki.indexOf("Macintosh")>=0||ki.indexOf("iPad")>=0||ki.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ua=ki.indexOf("Linux")>=0,(ki==null?void 0:ki.indexOf("Mobi"))>=0,ha=globalThis._VSCODE_NLS_LANGUAGE||Ns,Zo=navigator.language.toLowerCase(),zp=Zo):console.error("Unable to resolve platform.");var rg=Mu,Ii=Lu,fS=ua,Fp=ig,Oi=ki,Sr=ha,pS;(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})(pS||(pS={}));var mS=typeof Vr.postMessage=="function"&&!Vr.importScripts;(()=>{if(mS){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 _S=!!(Oi&&Oi.indexOf("Chrome")>=0);Oi&&Oi.indexOf("Firefox")>=0;!_S&&Oi&&Oi.indexOf("Safari")>=0;Oi&&Oi.indexOf("Edg/")>=0;Oi&&Oi.indexOf("Android")>=0;var xs=typeof navigator=="object"?navigator:{};Fp||document.queryCommandSupported&&document.queryCommandSupported("copy")||xs&&xs.clipboard&&xs.clipboard.writeText,Fp||xs&&xs.clipboard&&xs.clipboard.readText;var wh=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}},Bc=new wh,Hp=new wh,$p=new wh,gS=new Array(230),sg;(e=>{function t(f){return Bc.keyCodeToStr(f)}e.toString=t;function r(f){return Bc.strToKeyCode(f)}e.fromString=r;function n(f){return Hp.keyCodeToStr(f)}e.toUserSettingsUS=n;function a(f){return $p.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function l(f){return Hp.strToKeyCode(f)||$p.strToKeyCode(f)}e.fromUserSettings=l;function u(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 Bc.keyCodeToStr(f)}e.toElectronAccelerator=u})(sg||(sg={}));var vS=class ng{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 ng&&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 yS([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},yS=class{constructor(e){if(e.length===0)throw U0("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 SS(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return sg.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Du)switch(t){case 59:return 85;case 60:if(fS)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(lS&&(Ii&&t===93||!Ii&&t===92))return 57;return gS[t]||0}var wS=Ii?256:2048,CS=512,bS=1024,xS=Ii?2048:256,Wp=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=SS(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|=wS),this.altKey&&(t|=CS),this.shiftKey&&(t|=bS),this.metaKey&&(t|=xS),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new vS(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Up=new WeakMap;function kS(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 ES=class{static getSameOriginWindowChain(e){let t=Up.get(e);if(!t){t=[],Up.set(e,t);let r=e,n;do n=kS(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 u=l.window.deref();if(r+=(u==null?void 0:u.scrollY)??0,n+=(u==null?void 0:u.scrollX)??0,u===t||!l.iframeElement)break;let f=l.iframeElement.getBoundingClientRect();r+=f.top,n+=f.left}return{top:r,left:n}}},ea=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=ES.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Kp=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(Sh){let l=navigator.userAgent.match(/Chrome\/(\d+)/);n=(l?parseInt(l[1]):123)<=122}if(e){let l=e,u=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 u.VERTICAL_AXIS<"u"&&u.axis===u.VERTICAL_AXIS)this.deltaY=-u.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?Du&&!Ii?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")cS&&rg?this.deltaX=-(l.wheelDeltaX/120):n?this.deltaX=l.wheelDeltaX/(120*f):this.deltaX=l.wheelDeltaX/120;else if(typeof u.HORIZONTAL_AXIS<"u"&&u.axis===u.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?Du&&!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()}},og=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),NS;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof RS?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:og})})(NS||(NS={}));var RS=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?og:(this._emitter||(this._emitter=new de),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ch=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 xu("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new xu("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},PS=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 xu("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=Ke(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},DS;(e=>{async function t(n){let a,l=await Promise.all(n.map(u=>u.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(u){l(u)}})}e.withAsyncBody=r})(DS||(DS={}));var qp=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 de,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 kt.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())}};qp.EMPTY=qp.fromArray([]);var{getWindow:Ai,getWindowId:MS,onDidRegisterWindow:LS}=(function(){let e=new Map,t={window:Xi,disposables:new Nr};e.set(Xi.vscodeWindowId,t);let r=new de,n=new de,a=new de;function l(u,f){return(typeof u=="number"?e.get(u):void 0)??(f?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:n.event,registerWindow(u){if(e.has(u.vscodeWindowId))return De.None;let f=new Nr,m={window:u,disposables:f.add(new Nr)};return e.set(u.vscodeWindowId,m),f.add(Ke(()=>{e.delete(u.vscodeWindowId),n.fire(u)})),f.add(Ee(u,mt.BEFORE_UNLOAD,()=>{a.fire(u)})),r.fire(m),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:l,getWindow(u){var p;let f=u;if((p=f==null?void 0:f.ownerDocument)!=null&&p.defaultView)return f.ownerDocument.defaultView.window;let m=u;return m!=null&&m.view?m.view.window:Xi},getDocument(u){return Ai(u).document}}})(),TS=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 Ee(e,t,r,n){return new TS(e,t,r,n)}var Vp=function(e,t,r,n){return Ee(e,t,r,n)},bh,BS=class extends PS{constructor(e){super(),this.defaultTarget=e&&Ai(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},Yp=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){ca(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 u=e.get(l)??[];for(t.set(l,u),e.set(l,[]),n.set(l,!0);u.length>0;)u.sort(Yp.sort),u.shift().execute();n.set(l,!1)};bh=(l,u,f=0)=>{let m=MS(l),p=new Yp(u,f),y=e.get(m);return y||(y=[],e.set(m,y)),y.push(p),r.get(m)||(r.set(m,!0),l.requestAnimationFrame(()=>a(m))),p}})();function jS(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 mt={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"},AS=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=Ut(t);this._maxWidth!==r&&(this._maxWidth=r,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let r=Ut(t);this._width!==r&&(this._width=r,this.domNode.style.width=this._width)}setHeight(t){let r=Ut(t);this._height!==r&&(this._height=r,this.domNode.style.height=this._height)}setTop(t){let r=Ut(t);this._top!==r&&(this._top=r,this.domNode.style.top=this._top)}setLeft(t){let r=Ut(t);this._left!==r&&(this._left=r,this.domNode.style.left=this._left)}setBottom(t){let r=Ut(t);this._bottom!==r&&(this._bottom=r,this.domNode.style.bottom=this._bottom)}setRight(t){let r=Ut(t);this._right!==r&&(this._right=r,this.domNode.style.right=this._right)}setPaddingTop(t){let r=Ut(t);this._paddingTop!==r&&(this._paddingTop=r,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let r=Ut(t);this._paddingLeft!==r&&(this._paddingLeft=r,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let r=Ut(t);this._paddingBottom!==r&&(this._paddingBottom=r,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let r=Ut(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=Ut(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=Ut(t);this._lineHeight!==r&&(this._lineHeight=r,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let r=Ut(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 Ut(e){return typeof e=="number"?`${e}px`:e}function Dn(e){return new AS(e)}var ag=class{constructor(){this._hooks=new Nr,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(Ke(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Ai(e)}this._hooks.add(Ee(l,mt.POINTER_MOVE,u=>{if(u.buttons!==r){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(Ee(l,mt.POINTER_UP,u=>this.stopMonitoring(!0)))}};function IS(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(...u){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,u)}),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 Dt extends De{constructor(){super(),this.dispatched=!1,this.targets=new Op,this.ignoreTargets=new Op,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(kt.runAndSubscribe(LS,({window:t,disposables:r})=>{r.add(Ee(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(Ee(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(Ee(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Xi,disposables:this._store}))}static addTarget(t){if(!Dt.isTouchDevice())return De.None;Dt.INSTANCE||(Dt.INSTANCE=new Dt);let r=Dt.INSTANCE.targets.push(t);return Ke(r)}static ignoreTarget(t){if(!Dt.isTouchDevice())return De.None;Dt.INSTANCE||(Dt.INSTANCE=new Dt);let r=Dt.INSTANCE.ignoreTargets.push(t);return Ke(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 u=this.newGestureEvent(ji.Start,l.target);u.pageX=l.pageX,u.pageY=l.pageY,this.dispatchEvent(u)}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,u=r.changedTouches.length;l<u;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<Dt.HOLD_DELAY&&Math.abs(m.initialPageX-Qt(m.rollingPageX))<30&&Math.abs(m.initialPageY-Qt(m.rollingPageY))<30){let y=this.newGestureEvent(ji.Tap,m.initialTarget);y.pageX=Qt(m.rollingPageX),y.pageY=Qt(m.rollingPageY),this.dispatchEvent(y)}else if(p>=Dt.HOLD_DELAY&&Math.abs(m.initialPageX-Qt(m.rollingPageX))<30&&Math.abs(m.initialPageY-Qt(m.rollingPageY))<30){let y=this.newGestureEvent(ji.Contextmenu,m.initialTarget);y.pageX=Qt(m.rollingPageX),y.pageY=Qt(m.rollingPageY),this.dispatchEvent(y)}else if(a===1){let y=Qt(m.rollingPageX),g=Qt(m.rollingPageY),S=Qt(m.rollingTimestamps)-m.rollingTimestamps[0],v=y-m.rollingPageX[0],C=g-m.rollingPageY[0],N=[...this.targets].filter(k=>m.initialTarget instanceof Node&&k.contains(m.initialTarget));this.inertia(t,N,n,Math.abs(v)/S,v>0?1:-1,y,Math.abs(C)/S,C>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>Dt.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,u,f,m,p){this.handle=bh(t,()=>{let y=Date.now(),g=y-n,S=0,v=0,C=!0;a+=Dt.SCROLL_FRICTION*g,f+=Dt.SCROLL_FRICTION*g,a>0&&(C=!1,S=l*a*g),f>0&&(C=!1,v=m*f*g);let N=this.newGestureEvent(ji.Change);N.translationX=S,N.translationY=v,r.forEach(k=>k.dispatchEvent(N)),C||this.inertia(t,r,y,a,l,u+S,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 u=this.activeTouches[l.identifier],f=this.newGestureEvent(ji.Change,u.initialTarget);f.translationX=l.pageX-Qt(u.rollingPageX),f.translationY=l.pageY-Qt(u.rollingPageY),f.pageX=l.pageX,f.pageY=l.pageY,this.dispatchEvent(f),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(l.pageX),u.rollingPageY.push(l.pageY),u.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,Ze([IS],xn,"isTouchDevice",1);var OS=xn,xh=class extends De{onclick(e,t){this._register(Ee(e,mt.CLICK,r=>t(new ea(Ai(e),r))))}onmousedown(e,t){this._register(Ee(e,mt.MOUSE_DOWN,r=>t(new ea(Ai(e),r))))}onmouseover(e,t){this._register(Ee(e,mt.MOUSE_OVER,r=>t(new ea(Ai(e),r))))}onmouseleave(e,t){this._register(Ee(e,mt.MOUSE_LEAVE,r=>t(new ea(Ai(e),r))))}onkeydown(e,t){this._register(Ee(e,mt.KEY_DOWN,r=>t(new Wp(r))))}onkeyup(e,t){this._register(Ee(e,mt.KEY_UP,r=>t(new Wp(r))))}oninput(e,t){this._register(Ee(e,mt.INPUT,t))}onblur(e,t){this._register(Ee(e,mt.BLUR,t))}onfocus(e,t){this._register(Ee(e,mt.FOCUS,t))}onchange(e,t){this._register(Ee(e,mt.CHANGE,t))}ignoreGesture(e){return OS.ignoreTarget(e)}},Xp=11,zS=class extends xh{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=Xp+"px",this.domNode.style.height=Xp+"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 ag),this._register(Vp(this.bgDomNode,mt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Vp(this.domNode,mt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new BS),this._pointerdownScheduleRepeatTimer=this._register(new Ch)}_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()}},FS=class Tu{constructor(t,r,n,a,l,u,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,a=a|0,l=l|0,u=u|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>u&&(f=u-l),f<0&&(f=0),this.width=r,this.scrollWidth=n,this.scrollLeft=a,this.height=l,this.scrollHeight=u,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 Tu(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 Tu(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,u=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:u,scrollHeightChanged:f,scrollTopChanged:m}}},HS=class extends De{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new FS(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 Qp(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=Qp.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)))}},Gp=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function jc(e,t){let r=t-e;return function(n){return e+r*US(n)}}function $S(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var Qp=class Bu{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),$S(jc(t,a),jc(l,r),.33)}return jc(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 Gp(n,a,!1)}return new Gp(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return Bu.start(t,r,n)}static start(t,r,n){n=n+10;let a=Date.now()-10;return new Bu(t,r,a,n)}};function WS(e){return Math.pow(e,3)}function US(e){return 1-WS(1-e)}var KS=class extends De{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 Ch)}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":"")))}},qS=140,lg=class extends xh{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 KS(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ag),this._shouldRender=!0,this.domNode=Dn(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(Ee(this.domNode.domNode,mt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new zS(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=Dn(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(Ee(this.slider.domNode,mt.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=jS(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),u=Math.abs(l-r);if(rg&&u>qS){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()}},cg=class ju{constructor(t,r,n,a,l,u){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=l,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new ju(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 u=Math.max(0,n-t),f=Math.max(0,u-2*r),m=a>0&&a>n;if(!m)return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(n*f/a))),y=(f-p)/(a-n),g=l*y;return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(p),computedSliderRatio:y,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=ju._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)}},VS=class extends lg{constructor(e,t,r){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new cg(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}},YS=class extends lg{constructor(e,t,r){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new cg(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}},XS=500,Jp=50,GS=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Au=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(Sh){let r=Ai(t.browserEvent),n=aS(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 GS(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),u=Math.abs(r.deltaX),f=Math.abs(r.deltaY),m=Math.max(Math.min(a,u),1),p=Math.max(Math.min(l,f),1),y=Math.max(a,u),g=Math.max(l,f);y%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}};Au.INSTANCE=new Au;var QS=Au,JS=class extends xh{constructor(e,t,r){super(),this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new de),this.onWillScroll=this._onWillScroll.event,this._options=ew(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 YS(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new VS(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=Dn(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Dn(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Dn(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 Ch),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Yr(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 Kp(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Yr(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new Kp(r))};this._mouseWheelToDispose.push(Ee(this._listenOnDomNode,mt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=QS.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,u=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&u+l===0?u=l=0:Math.abs(l)>=Math.abs(u)?u=0:l=0),this._options.flipAxes&&([l,u]=[u,l]);let f=!Ii&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||f)&&!u&&(u=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(u=u*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let m=this._scrollable.getFutureScrollPosition(),p={};if(l){let y=Jp*l,g=m.scrollTop-(y<0?Math.floor(y):Math.ceil(y));this._verticalScrollbar.writeScrollPosition(p,g)}if(u){let y=Jp*u,g=m.scrollLeft-(y<0?Math.floor(y):Math.ceil(y));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(),XS)}},ZS=class extends JS{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 ew(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 Iu=class extends De{constructor(e,t,r,n,a,l,u,f){super(),this._bufferService=r,this._optionsService=u,this._renderService=f,this._onRequestScrollLines=this._register(new de),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new HS({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>bh(n.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new ZS(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(kt.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ke(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ke(()=>this._styleElement.remove())),this._register(kt.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}};Iu=Ze([me(2,jt),me(3,Qi),me(4,W_),me(5,Ps),me(6,At),me(7,Ji)],Iu);var Ou=class extends De{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(Ke(()=>{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()}};Ou=Ze([me(1,jt),me(2,Qi),me(3,In),me(4,Ji)],Ou);var tw=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)}},Li={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},va=class extends De{constructor(e,t,r,n,a,l,u,f){var p;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=a,this._optionsService=l,this._themeService=u,this._coreBrowserService=f,this._colorZoneStore=new tw,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(Ke(()=>{var y;return(y=this._canvas)==null?void 0:y.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(){Li.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);Li.left=t,Li.center=t,Li.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Li.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Li.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Li.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Li.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)-Li[e.position||"full"]/2),wr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Li[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}))}};va=Ze([me(2,jt),me(3,In),me(4,Ji),me(5,At),me(6,Ps),me(7,Qi)],va);var ne;(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=""))(ne||(ne={}));var da;(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=""))(da||(da={}));var ug;(e=>e.ST=`${ne.ESC}\\`)(ug||(ug={}));var zu=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(`${ne.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)}}};zu=Ze([me(2,jt),me(3,At),me(4,Qr),me(5,Ji)],zu);var _t=0,gt=0,vt=0,Je=0,Zp={css:"#00000000",rgba:0},nt;(e=>{function t(a,l,u,f){return f!==void 0?`#${$r(a)}${$r(l)}${$r(u)}${$r(f)}`:`#${$r(a)}${$r(l)}${$r(u)}`}e.toCss=t;function r(a,l,u,f=255){return(a<<24|l<<16|u<<8|f)>>>0}e.toRgba=r;function n(a,l,u,f){return{css:e.toCss(a,l,u,f),rgba:e.toRgba(a,l,u,f)}}e.toColor=n})(nt||(nt={}));var We;(e=>{function t(m,p){if(Je=(p.rgba&255)/255,Je===1)return{css:p.css,rgba:p.rgba};let y=p.rgba>>24&255,g=p.rgba>>16&255,S=p.rgba>>8&255,v=m.rgba>>24&255,C=m.rgba>>16&255,N=m.rgba>>8&255;_t=v+Math.round((y-v)*Je),gt=C+Math.round((g-C)*Je),vt=N+Math.round((S-N)*Je);let k=nt.toCss(_t,gt,vt),P=nt.toRgba(_t,gt,vt);return{css:k,rgba:P}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function n(m,p,y){let g=fa.ensureContrastRatio(m.rgba,p.rgba,y);if(g)return nt.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=n;function a(m){let p=(m.rgba|255)>>>0;return[_t,gt,vt]=fa.toChannels(p),{css:nt.toCss(_t,gt,vt),rgba:p}}e.opaque=a;function l(m,p){return Je=Math.round(p*255),[_t,gt,vt]=fa.toChannels(m.rgba),{css:nt.toCss(_t,gt,vt,Je),rgba:nt.toRgba(_t,gt,vt,Je)}}e.opacity=l;function u(m,p){return Je=m.rgba&255,l(m,Je*p/255)}e.multiplyOpacity=u;function f(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=f})(We||(We={}));var Xe;(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 _t=parseInt(a.slice(1,2).repeat(2),16),gt=parseInt(a.slice(2,3).repeat(2),16),vt=parseInt(a.slice(3,4).repeat(2),16),nt.toColor(_t,gt,vt);case 5:return _t=parseInt(a.slice(1,2).repeat(2),16),gt=parseInt(a.slice(2,3).repeat(2),16),vt=parseInt(a.slice(3,4).repeat(2),16),Je=parseInt(a.slice(4,5).repeat(2),16),nt.toColor(_t,gt,vt,Je);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 _t=parseInt(l[1]),gt=parseInt(l[2]),vt=parseInt(l[3]),Je=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),nt.toColor(_t,gt,vt,Je);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),[_t,gt,vt,Je]=t.getImageData(0,0,1,1).data,Je!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:nt.toRgba(_t,gt,vt,Je),css:a}}e.toColor=n})(Xe||(Xe={}));var Bt;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,l){let u=n/255,f=a/255,m=l/255,p=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),y=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+y*.7152+g*.0722}e.relativeLuminance2=r})(Bt||(Bt={}));var fa;(e=>{function t(u,f){if(Je=(f&255)/255,Je===1)return f;let m=f>>24&255,p=f>>16&255,y=f>>8&255,g=u>>24&255,S=u>>16&255,v=u>>8&255;return _t=g+Math.round((m-g)*Je),gt=S+Math.round((p-S)*Je),vt=v+Math.round((y-v)*Je),nt.toRgba(_t,gt,vt)}e.blend=t;function r(u,f,m){let p=Bt.relativeLuminance(u>>8),y=Bt.relativeLuminance(f>>8);if(Yi(p,y)<m){if(y<p){let v=n(u,f,m),C=Yi(p,Bt.relativeLuminance(v>>8));if(C<m){let N=a(u,f,m),k=Yi(p,Bt.relativeLuminance(N>>8));return C>k?v:N}return v}let g=a(u,f,m),S=Yi(p,Bt.relativeLuminance(g>>8));if(S<m){let v=n(u,f,m),C=Yi(p,Bt.relativeLuminance(v>>8));return S>C?g:v}return g}}e.ensureContrastRatio=r;function n(u,f,m){let p=u>>24&255,y=u>>16&255,g=u>>8&255,S=f>>24&255,v=f>>16&255,C=f>>8&255,N=Yi(Bt.relativeLuminance2(S,v,C),Bt.relativeLuminance2(p,y,g));for(;N<m&&(S>0||v>0||C>0);)S-=Math.max(0,Math.ceil(S*.1)),v-=Math.max(0,Math.ceil(v*.1)),C-=Math.max(0,Math.ceil(C*.1)),N=Yi(Bt.relativeLuminance2(S,v,C),Bt.relativeLuminance2(p,y,g));return(S<<24|v<<16|C<<8|255)>>>0}e.reduceLuminance=n;function a(u,f,m){let p=u>>24&255,y=u>>16&255,g=u>>8&255,S=f>>24&255,v=f>>16&255,C=f>>8&255,N=Yi(Bt.relativeLuminance2(S,v,C),Bt.relativeLuminance2(p,y,g));for(;N<m&&(S<255||v<255||C<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),N=Yi(Bt.relativeLuminance2(S,v,C),Bt.relativeLuminance2(p,y,g));return(S<<24|v<<16|C<<8|255)>>>0}e.increaseLuminance=a;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(fa||(fa={}));function $r(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 iw=class extends An{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()]}},ya=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,u=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 y=this._getJoinedRanges(n,u,l,t,a);for(let g=0;g<y.length;g++)r.push(y[g])}a=p,u=l,f=this._workCell.fg,m=this._workCell.bg}l+=this._workCell.getChars().length||Er.length}if(this._bufferService.cols-a>1){let p=this._getJoinedRanges(n,u,l,t,a);for(let y=0;y<p.length;y++)r.push(p[y])}return r}_getJoinedRanges(e,t,r,n,a){let l=e.substring(t,r),u=[];try{u=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++)ya._mergeRanges(u,m[p])}catch(m){console.error(m)}return this._stringRangesToCellRanges(u,n,a),u}_stringRangesToCellRanges(e,t,r){let n=0,a=!1,l=0,u=e[n];if(u){for(let f=r;f<this._bufferService.cols;f++){let m=t.getWidth(f),p=t.getString(f).length||Er.length;if(m!==0){if(!a&&u[0]<=l&&(u[0]=f,a=!0),u[1]<=l){if(u[1]=f,u=e[++n],!u)break;u[0]<=l?(u[0]=f,a=!0):a=!1}l+=p}}u&&(u[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}};ya=Ze([me(0,jt)],ya);function rw(e){return 57508<=e&&e<=57558}function sw(e){return 9472<=e&&e<=9631}function nw(e){return rw(e)||sw(e)}function ow(){return{css:{canvas:ta(),cell:ta()},device:{canvas:ta(),cell:ta(),char:{width:0,height:0,left:0,top:0}}}}function ta(){return{width:0,height:0}}var Fu=class{constructor(e,t,r,n,a,l,u){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=a,this._decorationService=l,this._themeService=u,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,u,f,m,p,y){let g=[],S=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,C=e.getNoBgTrimmedLength();r&&C<l+1&&(C=l+1);let N,k=0,P="",F=0,B=0,H=0,Y=0,$=!1,L=0,U=!1,T=0,K=0,q=[],A=p!==-1&&y!==-1;for(let O=0;O<C;O++){e.loadCell(O,this._workCell);let G=this._workCell.getWidth();if(G===0)continue;let Z=!1,ie=O>=K,Q=O,x=this._workCell;if(S.length>0&&O===S[0][0]&&ie){let ye=S.shift(),ti=this._isCellInSelection(ye[0],t);for(F=ye[0]+1;F<ye[1];F++)ie&&(ie=ti===this._isCellInSelection(F,t));ie&&(ie=!r||l<ye[0]||l>=ye[1]),ie?(Z=!0,x=new iw(this._workCell,e.translateToString(!0,ye[0],ye[1]),ye[1]-ye[0]),Q=ye[1]-1,G=x.getWidth()):K=ye[1]}let X=this._isCellInSelection(O,t),re=r&&O===l,R=A&&O>=p&&O<=y,E=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,ye=>{E=!0});let ee=x.getChars()||Er;if(ee===" "&&(x.isUnderline()||x.isOverline())&&(ee=" "),T=G*f-m.get(ee,x.isBold(),x.isItalic()),!N)N=this._document.createElement("span");else if(k&&(X&&U||!X&&!U&&x.bg===B)&&(X&&U&&v.selectionForeground||x.fg===H)&&x.extended.ext===Y&&R===$&&T===L&&!re&&!Z&&!E&&ie){x.isInvisible()?P+=Er:P+=ee,k++;continue}else k&&(N.textContent=P),N=this._document.createElement("span"),k=0,P="";if(B=x.bg,H=x.fg,Y=x.extended.ext,$=R,L=T,U=X,Z&&l>=O&&l<=Q&&(l=O),!this._coreService.isCursorHidden&&re&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&q.push("xterm-cursor-blink"),q.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break}}if(x.isBold()&&q.push("xterm-bold"),x.isItalic()&&q.push("xterm-italic"),x.isDim()&&q.push("xterm-dim"),x.isInvisible()?P=Er:P=x.getChars()||Er,x.isUnderline()&&(q.push(`xterm-underline-${x.extended.underlineStyle}`),P===" "&&(P=" "),!x.isUnderlineColorDefault()))if(x.isUnderlineColorRGB())N.style.textDecorationColor=`rgb(${An.toColorRGB(x.getUnderlineColor()).join(",")})`;else{let ye=x.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&x.isBold()&&ye<8&&(ye+=8),N.style.textDecorationColor=v.ansi[ye].css}x.isOverline()&&(q.push("xterm-overline"),P===" "&&(P=" ")),x.isStrikethrough()&&q.push("xterm-strikethrough"),R&&(N.style.textDecoration="underline");let M=x.getFgColor(),j=x.getFgColorMode(),se=x.getBgColor(),ce=x.getBgColorMode(),oe=!!x.isInverse();if(oe){let ye=M;M=se,se=ye;let ti=j;j=ce,ce=ti}let pe,Ne,ot=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,ye=>{ye.options.layer!=="top"&&ot||(ye.backgroundColorRGB&&(ce=50331648,se=ye.backgroundColorRGB.rgba>>8&16777215,pe=ye.backgroundColorRGB),ye.foregroundColorRGB&&(j=50331648,M=ye.foregroundColorRGB.rgba>>8&16777215,Ne=ye.foregroundColorRGB),ot=ye.options.layer==="top")}),!ot&&X&&(pe=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,se=pe.rgba>>8&16777215,ce=50331648,ot=!0,v.selectionForeground&&(j=50331648,M=v.selectionForeground.rgba>>8&16777215,Ne=v.selectionForeground)),ot&&q.push("xterm-decoration-top");let Ge;switch(ce){case 16777216:case 33554432:Ge=v.ansi[se],q.push(`xterm-bg-${se}`);break;case 50331648:Ge=nt.toColor(se>>16,se>>8&255,se&255),this._addStyle(N,`background-color:#${em((se>>>0).toString(16),"0",6)}`);break;case 0:default:oe?(Ge=v.foreground,q.push("xterm-bg-257")):Ge=v.background}switch(pe||x.isDim()&&(pe=We.multiplyOpacity(Ge,.5)),j){case 16777216:case 33554432:x.isBold()&&M<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(M+=8),this._applyMinimumContrast(N,Ge,v.ansi[M],x,pe,void 0)||q.push(`xterm-fg-${M}`);break;case 50331648:let ye=nt.toColor(M>>16&255,M>>8&255,M&255);this._applyMinimumContrast(N,Ge,ye,x,pe,Ne)||this._addStyle(N,`color:#${em(M.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(N,Ge,v.foreground,x,pe,Ne)||oe&&q.push("xterm-fg-257")}q.length&&(N.className=q.join(" "),q.length=0),!re&&!Z&&!E&&ie?k++:N.textContent=P,T!==this.defaultSpacing&&(N.style.letterSpacing=`${T}px`),g.push(N),O=Q}return N&&k&&(N.textContent=P),g}_applyMinimumContrast(e,t,r,n,a,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||nw(n.getCode()))return!1;let u=this._getContrastCache(n),f;if(!a&&!l&&(f=u.getColor(t.rgba,r.rgba)),f===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);f=We.ensureContrastRatio(a||t,l||r,m),u.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]}};Fu=Ze([me(1,q_),me(2,At),me(3,Qi),me(4,Qr),me(5,In),me(6,Ps)],Fu);function em(e,t,r){for(;e.length<r;)e=t+e;return e}var aw=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 u=this._measure(e,0);return u>0&&(this._flat[n]=u),u}let a=e;t&&(a+="B"),r&&(a+="I");let l=this._holey.get(a);if(l===void 0){let u=0;t&&(u|=1),r&&(u|=2),l=this._measure(e,u),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}},lw=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,u=r[1]-a,f=Math.max(l,0),m=Math.min(u,e.rows-1);if(f>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=l,this.viewportEndRow=u,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 cw(){return new lw}var Ac="xterm-dom-renderer-owner-",di="xterm-rows",ia="xterm-fg-",tm="xterm-bg-",gn="xterm-focus",ra="xterm-selection",uw=1,Hu=class extends De{constructor(e,t,r,n,a,l,u,f,m,p,y,g,S,v){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=a,this._helperContainer=l,this._linkifier2=u,this._charSizeService=m,this._optionsService=p,this._bufferService=y,this._coreService=g,this._coreBrowserService=S,this._themeService=v,this._terminalClass=uw++,this._rowElements=[],this._selectionRenderModel=cw(),this.onRequestRedraw=this._register(new de).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(ra),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=ow(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(C=>this._injectCss(C))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(Fu,document),this._element.classList.add(Ac+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(C=>this._handleLinkHover(C))),this._register(this._linkifier2.onHideLinkUnderline(C=>this._handleLinkLeave(C))),this._register(Ke(()=>{this._element.classList.remove(Ac+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new aw(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: ${We.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} .${ra} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ra} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ra} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,u]of e.ansi.entries())t+=`${this._terminalSelector} .${ia}${l} { color: ${u.css}; }${this._terminalSelector} .${ia}${l}.xterm-dim { color: ${We.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${tm}${l} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${ia}257 { color: ${We.opaque(e.background).css}; }${this._terminalSelector} .${ia}257.xterm-dim { color: ${We.multiplyOpacity(We.opaque(e.background),.5).css}; }${this._terminalSelector} .${tm}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,u=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],u-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 y=u-l-1;if(f.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,y)),l!==u){let g=a===u?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(u,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,u=this.dimensions.css.cell.width*(r-t);return l+u>this.dimensions.css.canvas.width&&(u=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=`${u}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,u=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,y=this._rowElements[m],g=r.lines.get(p);if(!y||!g)break;y.replaceChildren(...this._rowFactory.createRow(g,p,p===n,u,f,a,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Ac}${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 u=this._bufferService.rows-1;r=Math.max(Math.min(r,u),0),n=Math.max(Math.min(n,u),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),y=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let v=r;v<=n;++v){let C=v+f.ydisp,N=this._rowElements[v],k=f.lines.get(C);if(!N||!k)break;N.replaceChildren(...this._rowFactory.createRow(k,C,C===m,g,S,p,y,this.dimensions.css.cell.width,this._widthCache,l?v===r?e:0:-1,l?(v===n?t:a)-1:-1))}}};Hu=Ze([me(7,gh),me(8,Ma),me(9,At),me(10,jt),me(11,Qr),me(12,Qi),me(13,Ps)],Hu);var $u=class extends De{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new de),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new dw(this._optionsService))}catch{this._measureStrategy=this._register(new hw(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())}};$u=Ze([me(2,At)],$u);var hg=class extends De{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)}},hw=class extends hg{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}},dw=class extends hg{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}},fw=class extends De{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 pw(this._window)),this._onDprChange=this._register(new de),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new de),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(kt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ee(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ee(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}},pw=class extends De{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Rs),this._onDprChange=this._register(new de),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ke(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ee(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)}},mw=class extends De{constructor(){super(),this.linkProviders=[],this._register(Ke(()=>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 kh(e,t,r){let n=r.getBoundingClientRect(),a=e.getComputedStyle(r),l=parseInt(a.getPropertyValue("padding-left")),u=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-n.left-l,t.clientY-n.top-u]}function _w(e,t,r,n,a,l,u,f,m){if(!l)return;let p=kh(e,t,r);if(p)return p[0]=Math.ceil((p[0]+(m?u/2:0))/u),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 Wu=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,a){return _w(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=kh(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])}}};Wu=Ze([me(0,Ji),me(1,Ma)],Wu);var gw=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=[]}},dg={};N0(dg,{getSafariVersion:()=>yw,isChromeOS:()=>_g,isFirefox:()=>fg,isIpad:()=>Sw,isIphone:()=>ww,isLegacyEdge:()=>vw,isLinux:()=>Eh,isMac:()=>Sa,isNode:()=>La,isSafari:()=>pg,isWindows:()=>mg});var La=typeof process<"u"&&"title"in process,On=La?"node":navigator.userAgent,zn=La?"node":navigator.platform,fg=On.includes("Firefox"),vw=On.includes("Edge"),pg=/^((?!chrome|android).)*safari/i.test(On);function yw(){if(!pg)return 0;let e=On.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Sa=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(zn),Sw=zn==="iPad",ww=zn==="iPhone",mg=["Windows","Win16","Win32","WinCE"].includes(zn),Eh=zn.indexOf("Linux")>=0,_g=/\bCrOS\b/.test(On),gg=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()}},Cw=class extends gg{_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())}}},bw=class extends gg{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},wa=!La&&"requestIdleCallback"in window?bw:Cw,xw=class{constructor(){this._queue=new wa}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Uu=class extends De{constructor(e,t,r,n,a,l,u,f,m){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new Rs),this._pausedResizeTask=new xw,this._observerDisposable=this._register(new Rs),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 de),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new de),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new de),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new de),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new gw((p,y)=>this._renderRows(p,y),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new kw(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ke(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.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(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.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=Ke(()=>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()}};Uu=Ze([me(2,At),me(3,Ma),me(4,Qr),me(5,In),me(6,jt),me(7,Qi),me(8,Ps)],Uu);var kw=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 Ew(e,t,r,n){let a=r.buffer.x,l=r.buffer.y;if(!r.buffer.hasScrollback)return Pw(a,l,e,t,r,n)+Ta(l,t,r,n)+Dw(a,l,e,t,r,n);let u;if(l===t)return u=a>e?"D":"C",Tn(Math.abs(a-e),Ln(u,n));u=l>t?"D":"C";let f=Math.abs(l-t),m=Rw(l>t?e:a,r)+(f-1)*r.cols+1+Nw(l>t?a:e);return Tn(m,Ln(u,n))}function Nw(e,t){return e-1}function Rw(e,t){return t.cols-e}function Pw(e,t,r,n,a,l){return Ta(t,n,a,l).length===0?"":Tn(yg(e,t,e,t-Xr(t,a),!1,a).length,Ln("D",l))}function Ta(e,t,r,n){let a=e-Xr(e,r),l=t-Xr(t,r),u=Math.abs(a-l)-Mw(e,t,r);return Tn(u,Ln(vg(e,t),n))}function Dw(e,t,r,n,a,l){let u;Ta(t,n,a,l).length>0?u=n-Xr(n,a):u=t;let f=n,m=Lw(e,t,r,n,a,l);return Tn(yg(e,u,r,f,m==="C",a).length,Ln(m,l))}function Mw(e,t,r){var u;let n=0,a=e-Xr(e,r),l=t-Xr(t,r);for(let f=0;f<Math.abs(a-l);f++){let m=vg(e,t)==="A"?-1:1;(u=r.buffer.lines.get(a+m*f))!=null&&u.isWrapped&&n++}return n}function Xr(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 Lw(e,t,r,n,a,l){let u;return Ta(r,n,a,l).length>0?u=n-Xr(n,a):u=t,e<r&&u<=n||e>=r&&u<n?"C":"D"}function vg(e,t){return e>t?"A":"B"}function yg(e,t,r,n,a,l){let u=e,f=t,m="";for(;(u!==r||f!==n)&&f>=0&&f<l.buffer.lines.length;)u+=a?1:-1,a&&u>l.cols-1?(m+=l.buffer.translateBufferLineToString(f,!1,e,u),u=0,e=0,f++):!a&&u<0&&(m+=l.buffer.translateBufferLineToString(f,!1,0,e+1),u=l.cols-1,e=u,f--);return m+l.buffer.translateBufferLineToString(f,!1,e,u)}function Ln(e,t){let r=t?"O":"[";return ne.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 Tw=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 im(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 Ic=50,Bw=15,jw=50,Aw=500,Iw=" ",Ow=new RegExp(Iw,"g"),Ku=class extends De{constructor(e,t,r,n,a,l,u,f,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=a,this._mouseService=l,this._optionsService=u,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 de),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new de),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new de),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new de),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 Tw(this._bufferService),this._activeSelectionMode=0,this._register(Ke(()=>{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 u=e[1];u<=t[1];u++){let f=r.translateBufferLineToString(u,!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 u=r.lines.get(l),f=r.translateBufferLineToString(l,!0);u!=null&&u.isWrapped?n[n.length-1]+=f:n.push(f)}if(e[1]!==t[1]){let l=r.lines.get(t[1]),u=r.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?n[n.length-1]+=u:n.push(u)}}return n.map(a=>a.replace(Ow," ")).join(mg?`\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())),Eh&&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=im(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=kh(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,-Ic),Ic),t/=Ic,t/Math.abs(t)+Math.round(t*(Bw-1)))}shouldForceSelection(e){return Sa?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(),jw)}_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&&!(Sa&&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<Aw&&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=Ew(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 u=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(l,e[0]),m=f,p=e[0]-f,y=0,g=0,S=0,v=0;if(u.charAt(f)===" "){for(;f>0&&u.charAt(f-1)===" ";)f--;for(;m<u.length&&u.charAt(m+1)===" ";)m++}else{let k=e[0],P=e[0];l.getWidth(k)===0&&(y++,k--),l.getWidth(P)===2&&(g++,P++);let F=l.getString(P).length;for(F>1&&(v+=F-1,m+=F-1);k>0&&f>0&&!this._isCharWordSeparator(l.loadCell(k-1,this._workCell));){l.loadCell(k-1,this._workCell);let B=this._workCell.getChars().length;this._workCell.getWidth()===0?(y++,k--):B>1&&(S+=B-1,f-=B-1),f--,k--}for(;P<l.length&&m+1<u.length&&!this._isCharWordSeparator(l.loadCell(P+1,this._workCell));){l.loadCell(P+1,this._workCell);let B=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,P++):B>1&&(v+=B-1,m+=B-1),m++,P++}}m++;let C=f+p-y+S,N=Math.min(this._bufferService.cols,m-f+y+g-S-v);if(!(!t&&u.slice(f,m).trim()==="")){if(r&&C===0&&l.getCodePoint(0)!==32){let k=a.lines.get(e[1]-1);if(k&&l.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let P=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(P){let F=this._bufferService.cols-P.start;C-=F,N+=F}}}if(n&&C+N===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let k=a.lines.get(e[1]+1);if(k!=null&&k.isWrapped&&k.getCodePoint(0)!==32){let P=this._getWordAt([0,e[1]+1],!1,!1,!0);P&&(N+=P.length)}}return{start:C,length:N}}}_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=im(r,this._bufferService.cols)}};Ku=Ze([me(3,jt),me(4,Qr),me(5,vh),me(6,At),me(7,Ji),me(8,Qi)],Ku);var rm=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={}}},sm=class{constructor(){this._color=new rm,this._css=new rm}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()}},ct=Object.freeze((()=>{let e=[Xe.toColor("#2e3436"),Xe.toColor("#cc0000"),Xe.toColor("#4e9a06"),Xe.toColor("#c4a000"),Xe.toColor("#3465a4"),Xe.toColor("#75507b"),Xe.toColor("#06989a"),Xe.toColor("#d3d7cf"),Xe.toColor("#555753"),Xe.toColor("#ef2929"),Xe.toColor("#8ae234"),Xe.toColor("#fce94f"),Xe.toColor("#729fcf"),Xe.toColor("#ad7fa8"),Xe.toColor("#34e2e2"),Xe.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:nt.toCss(n,a,l),rgba:nt.toRgba(n,a,l)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:nt.toCss(n,n,n),rgba:nt.toRgba(n,n,n)})}return e})()),Wr=Xe.toColor("#ffffff"),kn=Xe.toColor("#000000"),nm=Xe.toColor("#ffffff"),om=kn,vn={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},zw=Wr,qu=class extends De{constructor(e){super(),this._optionsService=e,this._contrastCache=new sm,this._halfContrastCache=new sm,this._onChangeColors=this._register(new de),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Wr,background:kn,cursor:nm,cursorAccent:om,selectionForeground:void 0,selectionBackgroundTransparent:vn,selectionBackgroundOpaque:We.blend(kn,vn),selectionInactiveBackgroundTransparent:vn,selectionInactiveBackgroundOpaque:We.blend(kn,vn),scrollbarSliderBackground:We.opacity(Wr,.2),scrollbarSliderHoverBackground:We.opacity(Wr,.4),scrollbarSliderActiveBackground:We.opacity(Wr,.5),overviewRulerBorder:Wr,ansi:ct.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=ze(e.foreground,Wr),t.background=ze(e.background,kn),t.cursor=We.blend(t.background,ze(e.cursor,nm)),t.cursorAccent=We.blend(t.background,ze(e.cursorAccent,om)),t.selectionBackgroundTransparent=ze(e.selectionBackground,vn),t.selectionBackgroundOpaque=We.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ze(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=We.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ze(e.selectionForeground,Zp):void 0,t.selectionForeground===Zp&&(t.selectionForeground=void 0),We.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=We.opacity(t.selectionBackgroundTransparent,.3)),We.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=We.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ze(e.scrollbarSliderBackground,We.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ze(e.scrollbarSliderHoverBackground,We.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ze(e.scrollbarSliderActiveBackground,We.opacity(t.foreground,.5)),t.overviewRulerBorder=ze(e.overviewRulerBorder,zw),t.ansi=ct.slice(),t.ansi[0]=ze(e.black,ct[0]),t.ansi[1]=ze(e.red,ct[1]),t.ansi[2]=ze(e.green,ct[2]),t.ansi[3]=ze(e.yellow,ct[3]),t.ansi[4]=ze(e.blue,ct[4]),t.ansi[5]=ze(e.magenta,ct[5]),t.ansi[6]=ze(e.cyan,ct[6]),t.ansi[7]=ze(e.white,ct[7]),t.ansi[8]=ze(e.brightBlack,ct[8]),t.ansi[9]=ze(e.brightRed,ct[9]),t.ansi[10]=ze(e.brightGreen,ct[10]),t.ansi[11]=ze(e.brightYellow,ct[11]),t.ansi[12]=ze(e.brightBlue,ct[12]),t.ansi[13]=ze(e.brightMagenta,ct[13]),t.ansi[14]=ze(e.brightCyan,ct[14]),t.ansi[15]=ze(e.brightWhite,ct[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]=ze(e.extendedAnsi[n],ct[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()}}};qu=Ze([me(0,At)],qu);function ze(e,t){if(e!==void 0)try{return Xe.toColor(e)}catch{}return t}var Fw=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)}},Hw=class{constructor(){this._services=new Fw,this._services.set(gh,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=B0(e).sort((l,u)=>l.index-u.index),n=[];for(let l of r){let u=this._services.get(l.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);n.push(u)}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)}},$w={trace:0,debug:1,info:2,warn:3,error:4,off:5},Ww="xterm.js: ",Vu=class extends De{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=$w[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?"":Ww)+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)}};Vu=Ze([me(0,At)],Vu);var am=class extends De{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new de),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new de),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new de),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}},Pe=3,st=Object.freeze(new An),sa=0,Oc=2,En=class Sg{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Pe);let a=r||mi.fromCharData([0,z_,1,0]);for(let l=0;l<t;++l)this.setCell(l,a);this.length=t}get(t){let r=this._data[t*Pe+0],n=r&2097151;return[this._data[t*Pe+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*Pe+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Pe+0]=t|2097152|r[2]<<22):this._data[t*Pe+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Pe+0]>>22}hasWidth(t){return this._data[t*Pe+0]&12582912}getFg(t){return this._data[t*Pe+1]}getBg(t){return this._data[t*Pe+2]}hasContent(t){return this._data[t*Pe+0]&4194303}getCodePoint(t){let r=this._data[t*Pe+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Pe+0]&2097152}getString(t){let r=this._data[t*Pe+0];return r&2097152?this._combined[t]:r&2097151?xr(r&2097151):""}isProtected(t){return this._data[t*Pe+2]&536870912}loadCell(t,r){return sa=t*Pe,r.content=this._data[sa+0],r.fg=this._data[sa+1],r.bg=this._data[sa+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*Pe+0]=r.content,this._data[t*Pe+1]=r.fg,this._data[t*Pe+2]=r.bg}setCellFromCodepoint(t,r,n,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Pe+0]=r|n<<22,this._data[t*Pe+1]=a.fg,this._data[t*Pe+2]=a.bg}addCodepointToCell(t,r,n){let a=this._data[t*Pe+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*Pe+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*Oc<this._data.buffer.byteLength;let n=t*Pe;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 u=0;u<a.length;u++){let f=parseInt(a[u],10);f>=t&&delete this._combined[f]}let l=Object.keys(this._extendedAttrs);for(let u=0;u<l.length;u++){let f=parseInt(l[u],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,n*4*Oc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Oc<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 Sg(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*Pe+0]&4194303)return t+(this._data[t*Pe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Pe+0]&4194303||this._data[t*Pe+2]&50331648)return t+(this._data[t*Pe+0]>>22);return 0}copyCellsFrom(t,r,n,a,l){let u=t._data;if(l)for(let m=a-1;m>=0;m--){for(let p=0;p<Pe;p++)this._data[(n+m)*Pe+p]=u[(r+m)*Pe+p];u[(r+m)*Pe+2]&268435456&&(this._extendedAttrs[n+m]=t._extendedAttrs[r+m])}else for(let m=0;m<a;m++){for(let p=0;p<Pe;p++)this._data[(n+m)*Pe+p]=u[(r+m)*Pe+p];u[(r+m)*Pe+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 u=this._data[r*Pe+0],f=u&2097151,m=u&2097152?this._combined[r]:f?xr(f):Er;if(l+=m,a)for(let p=0;p<m.length;++p)a.push(r);r+=u>>22||1}return a&&a.push(r),l}};function Uw(e,t,r,n,a,l){let u=[];for(let f=0;f<e.length-1;f++){let m=f,p=e.get(++m);if(!p.isWrapped)continue;let y=[e.get(f)];for(;m<e.length&&p.isWrapped;)y.push(p),p=e.get(++m);if(!l&&n>=f&&n<m){f+=y.length-1;continue}let g=0,S=Bn(y,g,t),v=1,C=0;for(;v<y.length;){let k=Bn(y,v,t),P=k-C,F=r-S,B=Math.min(P,F);y[g].copyCellsFrom(y[v],C,S,B,!1),S+=B,S===r&&(g++,S=0),C+=B,C===k&&(v++,C=0),S===0&&g!==0&&y[g-1].getWidth(r-1)===2&&(y[g].copyCellsFrom(y[g-1],r-1,S++,1,!1),y[g-1].setCell(r-1,a))}y[g].replaceCells(S,r,a);let N=0;for(let k=y.length-1;k>0&&(k>g||y[k].getTrimmedLength()===0);k--)N++;N>0&&(u.push(f+y.length-N),u.push(N)),f+=y.length-1}return u}function Kw(e,t){let r=[],n=0,a=t[n],l=0;for(let u=0;u<e.length;u++)if(a===u){let f=t[++n];e.onDeleteEmitter.fire({index:u-l,amount:f}),u+=f-1,l+=f,a=t[++n]}else r.push(u);return{layout:r,countRemoved:l}}function qw(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 Vw(e,t,r){let n=[],a=e.map((m,p)=>Bn(e,p,t)).reduce((m,p)=>m+p),l=0,u=0,f=0;for(;f<a;){if(a-f<r){n.push(a-f);break}l+=r;let m=Bn(e,u,t);l>m&&(l-=m,u++);let p=e[u].getWidth(l-1)===2;p&&l--;let y=p?r-1:r;n.push(y),f+=y}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 wg=class Cg{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Cg._nextId++,this._onDispose=this.register(new de),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Yr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};wg._nextId=1;var Yw=wg,ht={},Ur=ht.B;ht[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ht.A={"#":"£"};ht.B=void 0;ht[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ht.C=ht[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ht.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ht.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ht.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ht.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ht.E=ht[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ht.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ht.H=ht[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ht["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var lm=4294967295,cm=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=st.clone(),this.savedCharset=Ur,this.markers=[],this._nullCell=mi.fromCharData([0,z_,1,0]),this._whitespaceCell=mi.fromCharData([0,Er,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new wa,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new am(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 ga),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 ga),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>lm?lm:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=st);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 am(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(st),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 u=0;u<this.lines.length;u++)n+=+this.lines.get(u).resize(e,r);let l=0;if(this._rows<t)for(let u=this._rows;u<t;u++)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 u=this._rows;u>t;u--)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 u=this.lines.length-a;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,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=Uw(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(st),r);if(n.length>0){let a=Kw(this.lines,n);qw(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(st),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(st),a=[],l=0;for(let u=this.lines.length-1;u>=0;u--){let f=this.lines.get(u);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let m=[f];for(;f.isWrapped&&u>0;)f=this.lines.get(--u),m.unshift(f);if(!r){let B=this.ybase+this.y;if(B>=u&&B<u+m.length)continue}let p=m[m.length-1].getTrimmedLength(),y=Vw(m,this._cols,e),g=y.length-m.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+g):S=Math.max(0,this.lines.length-this.lines.maxLength+g);let v=[];for(let B=0;B<g;B++){let H=this.getBlankLine(st,!0);v.push(H)}v.length>0&&(a.push({start:u+m.length+l,newLines:v}),l+=v.length),m.push(...v);let C=y.length-1,N=y[C];N===0&&(C--,N=y[C]);let k=m.length-g-1,P=p;for(;k>=0;){let B=Math.min(P,N);if(m[C]===void 0)break;if(m[C].copyCellsFrom(m[k],P-B,N-B,B,!0),N-=B,N===0&&(C--,N=y[C]),P-=B,P===0){k--;let H=Math.max(k,0);P=Bn(m,H,this._cols)}}for(let B=0;B<m.length;B++)y[B]<e&&m[B].setCell(y[B],n);let F=g-S;for(;F-- >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 u=[],f=[];for(let N=0;N<this.lines.length;N++)f.push(this.lines.get(N));let m=this.lines.length,p=m-1,y=0,g=a[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let S=0;for(let N=Math.min(this.lines.maxLength-1,m+l-1);N>=0;N--)if(g&&g.start>p+S){for(let k=g.newLines.length-1;k>=0;k--)this.lines.set(N--,g.newLines[k]);N++,u.push({index:p+1,amount:g.newLines.length}),S+=g.newLines.length,g=a[++y]}else this.lines.set(N,f[p--]);let v=0;for(let N=u.length-1;N>=0;N--)u[N].index+=v,this.lines.onInsertEmitter.fire(u[N]),v+=u[N].amount;let C=Math.max(0,m+l-this.lines.maxLength);C>0&&this.lines.onTrimEmitter.fire(C)}}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 Yw(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)}},Xw=class extends De{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new de),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 cm(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new cm(!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)}},bg=2,xg=1,Yu=class extends De{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new de),this.onResize=this._onResize.event,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,bg),this.rows=Math.max(e.rawOptions.rows||0,xg),this.buffers=this._register(new Xw(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 u=r.lines.isFull;l===r.lines.length-1?u?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(l+1,0,n.clone()),u?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let u=l-a+1;r.lines.shiftElements(a+1,u-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))}};Yu=Ze([me(0,At)],Yu);var ks={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:Sa,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Gw=["normal","bold","100","200","300","400","500","600","700","800","900"],Qw=class extends De{constructor(e){super(),this._onOptionChange=this._register(new de),this.onOptionChange=this._onOptionChange.event;let t={...ks};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(Ke(()=>{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 ks))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in ks))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=ks[e]),!Jw(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=ks[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Gw.includes(t)?t:ks[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 Jw(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 um=Object.freeze({insertMode:!1}),hm=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Xu=class extends De{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 de),this.onData=this._onData.event,this._onUserInput=this._register(new de),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new de),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new de),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Nn(um),this.decPrivateModes=Nn(hm)}reset(){this.modes=Nn(um),this.decPrivateModes=Nn(hm)}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))}};Xu=Ze([me(0,jt),me(1,U_),me(2,At)],Xu);var dm={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 zc(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 Fc=String.fromCharCode,fm={DEFAULT:e=>{let t=[zc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Fc(t[0])}${Fc(t[1])}${Fc(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${zc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${zc(e,!0)};${e.x};${e.y}${t}`}},Gu=class extends De{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 de),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(dm))this.addProtocol(n,dm[n]);for(let n of Object.keys(fm))this.addEncoding(n,fm[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)}};Gu=Ze([me(0,jt),me(1,Qr),me(2,At)],Gu);var Hc=[[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]],Zw=[[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]],ut;function e1(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 t1=class{constructor(){if(this.version="6",!ut){ut=new Uint8Array(65536),ut.fill(1),ut[0]=0,ut.fill(0,1,32),ut.fill(0,127,160),ut.fill(2,4352,4448),ut[9001]=2,ut[9002]=2,ut.fill(2,11904,42192),ut[12351]=1,ut.fill(2,44032,55204),ut.fill(2,63744,64256),ut.fill(2,65040,65050),ut.fill(2,65072,65136),ut.fill(2,65280,65377),ut.fill(2,65504,65511);for(let e=0;e<Hc.length;++e)ut.fill(0,Hc[e][0],Hc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ut[e]:e1(e,Zw)?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=qr.extractWidth(t);a===0?n=!1:a>r&&(r=a)}return qr.createPropertyValue(0,r,n)}},qr=class pa{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new de,this.onChange=this._onChange.event;let t=new t1;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 u=t.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=a)return r+this.wcwidth(u);let p=t.charCodeAt(l);56320<=p&&p<=57343?u=(u-55296)*1024+p-56320+65536:r+=this.wcwidth(p)}let f=this.charProperties(u,n),m=pa.extractWidth(f);pa.extractShouldJoin(f)&&(m-=pa.extractWidth(n)),r+=m,n=f}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},i1=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 pm(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,r1=256,kg=class Qu{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>r1)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 Qu;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 Qu(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=[],s1=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",Da(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}}},Jt=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+=Da(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=[],n1=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",Da(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 kg;Rn.addParam(0);var mm=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+=Da(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}},o1=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,a1=(function(){let e=new o1(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),u;e.setDefault(1,0),e.addMany(n,0,2,0);for(u in l)e.addMany([24,26,153,154],u,3,0),e.addMany(r(128,144),u,3,0),e.addMany(r(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,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})(),l1=class extends De{constructor(e=a1){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 kg,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(Ke(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new s1),this._dcsParser=this._register(new n1),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,u;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&&(u=f[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(u=f[m](),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(n!==24&&n!==26,r),u)return u;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],u=this._oscParser.end(n!==24&&n!==26,r),u)return u;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 S=f+1;;++S){if(S>=t||(n=e[S])<32||n>126&&n<pi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(n=e[S])<32||n>126&&n<pi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(n=e[S])<32||n>126&&n<pi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(n=e[S])<32||n>126&&n<pi){this._printHandler(e,f,S),f=S-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&&(u=m[p](this._params),u!==!0);p--)if(u instanceof Promise)return this._preserveStack(3,m,p,a,f),u;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 y=this._escHandlers[this._collect<<8|n],g=y?y.length-1:-1;for(;g>=0&&(u=y[g](),u!==!0);g--)if(u instanceof Promise)return this._preserveStack(4,y,g,a,f),u;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 S=f+1;;++S)if(S>=t||(n=e[S])===24||n===26||n===27||n>127&&n<pi){this._dcsParser.put(e,f,S),f=S-1;break}break;case 14:if(u=this._dcsParser.unhook(n!==24&&n!==26),u)return this._preserveStack(6,[],0,a,f),u;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 S=f+1;;S++)if(S>=t||(n=e[S])<32||n>127&&n<pi){this._oscParser.put(e,f,S),f=S-1;break}break;case 6:if(u=this._oscParser.end(n!==24&&n!==26),u)return this._preserveStack(5,[],0,a,f),u;n===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},c1=/^([\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})$/,u1=/^[\da-f]+$/;function _m(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=c1.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),u1.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 $c(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 h1(e,t=16){let[r,n,a]=e;return`rgb:${$c(r,t)}/${$c(n,t)}/${$c(a,t)}`}var d1={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Cr=131072,gm=10;function vm(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 ym=5e3,Sm=0,f1=class extends De{constructor(e,t,r,n,a,l,u,f,m=new l1){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=a,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=f,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new L0,this._utf8Decoder=new T0,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=st.clone(),this._eraseAttrDataInternal=st.clone(),this._onRequestBell=this._register(new de),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new de),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new de),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new de),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new de),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new de),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new de),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new de),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new de),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new de),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new de),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new de),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 Ju(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,y)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:y.toArray()})}),this._parser.setEscHandlerFallback(p=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(p)})}),this._parser.setExecuteHandlerFallback(p=>{this._logService.debug("Unknown EXECUTE code: ",{code:p})}),this._parser.setOscHandlerFallback((p,y,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:y,data:g})}),this._parser.setDcsHandlerFallback((p,y,g)=>{y==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:y,payload:g})}),this._parser.setPrintHandler((p,y,g)=>this.print(p,y,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(ne.BEL,()=>this.bell()),this._parser.setExecuteHandler(ne.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ne.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ne.BS,()=>this.backspace()),this._parser.setExecuteHandler(ne.HT,()=>this.tab()),this._parser.setExecuteHandler(ne.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ne.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(da.IND,()=>this.index()),this._parser.setExecuteHandler(da.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(da.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Jt(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new Jt(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new Jt(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new Jt(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new Jt(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new Jt(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new Jt(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new Jt(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new Jt(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new Jt(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new Jt(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new Jt(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 ht)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 mm((p,y)=>this.requestStatusString(p,y)))}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"),ym))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${ym} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,a=this._activeBuffer.y,l=0,u=this._parseStack.paused;if(u){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))),u||this._dirtyRowTracker.clearRange(),e.length>Cr)for(let p=l;p<e.length;p+=Cr){let y=p+Cr<e.length?p+Cr:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(p,y),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,y),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,g))return this._preserveStack(n,a,g,p),this._logSlowResolvingAsync(r),r}else if(!u){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,u=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,y=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,y);let S=this._parser.precedingJoinState;for(let v=t;v<r;++v){if(n=e[v],n<127&&l){let P=l[String.fromCharCode(n)];P&&(n=P.charCodeAt(0))}let C=this._unicodeService.charProperties(n,S);a=qr.extractWidth(C);let N=qr.extractShouldJoin(C),k=N?qr.extractWidth(S):0;if(S=C,u&&this._onA11yChar.fire(xr(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-k>f){if(m){let P=g,F=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&g instanceof En&&g.copyCellsFrom(P,F,0,k,!1);F<f;)P.setCellFromCodepoint(F++,0,1,y)}else if(this._activeBuffer.x=f-1,a===2)continue}if(N&&this._activeBuffer.x){let P=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-P,n,a);for(let F=a-k;--F>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,y);continue}if(p&&(g.insertCells(this._activeBuffer.x,a-k,this._activeBuffer.getNullCell(y)),g.getWidth(f-1)===2&&g.setCellFromCodepoint(f-1,0,1,y)),g.setCellFromCodepoint(this._activeBuffer.x++,n,a,y),a>0)for(;--a;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,y)}this._parser.precedingJoinState=S,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,y),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>vm(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new mm(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Jt(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(st));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=qr.extractWidth(t),a=this._activeBuffer.x-n,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),u=new Uint32Array(l.length*r),f=0;for(let p=0;p<l.length;){let y=l.codePointAt(p)||0;u[f++]=y,p+=y>65535?2:1}let m=f;for(let p=1;p<r;++p)u.copyWithin(m,0,f),m+=f;return this.print(u,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ne.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ne.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ne.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ne.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ne.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,Ur),this._charsetService.setgCharset(1,Ur),this._charsetService.setgCharset(2,Ur),this._charsetService.setgCharset(3,Ur);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){(N=>(N[N.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",N[N.SET=1]="SET",N[N.RESET=2]="RESET",N[N.PERMANENTLY_SET=3]="PERMANENTLY_SET",N[N.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let n=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:l}=this._coreMouseService,u=this._coreService,{buffers:f,cols:m}=this._bufferService,{active:p,alt:y}=f,g=this._optionsService.rawOptions,S=(N,k)=>(u.triggerDataEvent(`${ne.ESC}[${t?"":"?"}${N};${k}$y`),!0),v=N=>N?1:2,C=e.params[0];return t?C===2?S(C,4):C===4?S(C,v(u.modes.insertMode)):C===12?S(C,3):C===20?S(C,v(g.convertEol)):S(C,0):C===1?S(C,v(n.applicationCursorKeys)):C===3?S(C,g.windowOptions.setWinLines?m===80?2:m===132?1:0:0):C===6?S(C,v(n.origin)):C===7?S(C,v(n.wraparound)):C===8?S(C,3):C===9?S(C,v(a==="X10")):C===12?S(C,v(g.cursorBlink)):C===25?S(C,v(!u.isCursorHidden)):C===45?S(C,v(n.reverseWraparound)):C===66?S(C,v(n.applicationKeypad)):C===67?S(C,4):C===1e3?S(C,v(a==="VT200")):C===1002?S(C,v(a==="DRAG")):C===1003?S(C,v(a==="ANY")):C===1004?S(C,v(n.sendFocus)):C===1005?S(C,4):C===1006?S(C,v(l==="SGR")):C===1015?S(C,4):C===1016?S(C,v(l==="SGR_PIXELS")):C===1048?S(C,1):C===47||C===1047||C===1049?S(C,v(p===y)):C===2004?S(C,v(n.bracketedPasteMode)):C===2026?S(C,v(n.synchronizedOutput)):S(C,0)}_updateAttrColor(e,t,r,n,a){return t===2?(e|=50331648,e&=-16777216,e|=An.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 u=e.getSubParams(t+l),f=0;do n[1]===5&&(a=1),n[l+f+1+a]=u[f];while(++f<u.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 u=2;u<n.length;++u)n[u]===-1&&(n[u]=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=st.fg,e.bg=st.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|=st.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=st.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|=st.fg&16777215,n.bg&=-67108864,n.bg|=st.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ne.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ne.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(`${ne.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=st.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(!vm(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(`${ne.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>gm&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>gm&&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(wm(l))if(a==="?")t.push({type:0,index:l});else{let u=_m(a);u&&t.push({type:1,index:l,color:u})}}}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=_m(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]);wm(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,Ur),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(d1[e[0]],ht[e[1]]||Ur),!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=st.clone(),this._eraseAttrDataInternal=st.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=u=>(this._coreService.triggerDataEvent(`${ne.ESC}${u}${ne.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)}},Ju=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&&(Sm=e,e=t,t=Sm),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Ju=Ze([me(0,jt)],Ju);function wm(e){return 0<=e&&e<256}var p1=5e7,Cm=12,m1=50,_1=class extends De{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 de),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>p1)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 u=f=>performance.now()-r>=Cm?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(r,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(u);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=Cm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>m1&&(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()}},Zu=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),u={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.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)))}};Zu=Ze([me(0,jt)],Zu);var bm=!1,g1=class extends De{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Rs),this._onBinary=this._register(new de),this.onBinary=this._onBinary.event,this._onData=this._register(new de),this.onData=this._onData.event,this._onLineFeed=this._register(new de),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new de),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new de),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new de),this._instantiationService=new Hw,this.optionsService=this._register(new Qw(e)),this._instantiationService.setService(At,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Yu)),this._instantiationService.setService(jt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Vu)),this._instantiationService.setService(U_,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Xu)),this._instantiationService.setService(Qr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Gu)),this._instantiationService.setService(W_,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(qr)),this._instantiationService.setService(I0,this.unicodeService),this._charsetService=this._instantiationService.createInstance(i1),this._instantiationService.setService(A0,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Zu),this._instantiationService.setService(K_,this._oscLinkService),this._inputHandler=this._register(new f1(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(kt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(kt.forward(this._bufferService.onResize,this._onResize)),this._register(kt.forward(this.coreService.onData,this._onData)),this._register(kt.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 _1((t,r)=>this._inputHandler.parse(t,r))),this._register(kt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new de),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&&!bm&&(this._logService.warn("writeSync is unreliable and will be removed soon."),bm=!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,bg),t=Math.max(t,xg),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(pm.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(pm(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ke(()=>{for(let t of e)t.dispose()})}}},v1={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 y1(e,t,r,n){var u;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=ne.ESC+"OA":a.key=ne.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=ne.ESC+"OD":a.key=ne.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=ne.ESC+"OC":a.key=ne.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=ne.ESC+"OB":a.key=ne.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":ne.DEL,e.altKey&&(a.key=ne.ESC+a.key);break;case 9:if(e.shiftKey){a.key=ne.ESC+"[Z";break}a.key=ne.HT,a.cancel=!0;break;case 13:a.key=e.altKey?ne.ESC+ne.CR:ne.CR,a.cancel=!0;break;case 27:a.key=ne.ESC,e.altKey&&(a.key=ne.ESC+ne.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;l?a.key=ne.ESC+"[1;"+(l+1)+"D":t?a.key=ne.ESC+"OD":a.key=ne.ESC+"[D";break;case 39:if(e.metaKey)break;l?a.key=ne.ESC+"[1;"+(l+1)+"C":t?a.key=ne.ESC+"OC":a.key=ne.ESC+"[C";break;case 38:if(e.metaKey)break;l?a.key=ne.ESC+"[1;"+(l+1)+"A":t?a.key=ne.ESC+"OA":a.key=ne.ESC+"[A";break;case 40:if(e.metaKey)break;l?a.key=ne.ESC+"[1;"+(l+1)+"B":t?a.key=ne.ESC+"OB":a.key=ne.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=ne.ESC+"[2~");break;case 46:l?a.key=ne.ESC+"[3;"+(l+1)+"~":a.key=ne.ESC+"[3~";break;case 36:l?a.key=ne.ESC+"[1;"+(l+1)+"H":t?a.key=ne.ESC+"OH":a.key=ne.ESC+"[H";break;case 35:l?a.key=ne.ESC+"[1;"+(l+1)+"F":t?a.key=ne.ESC+"OF":a.key=ne.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=ne.ESC+"[5;"+(l+1)+"~":a.key=ne.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=ne.ESC+"[6;"+(l+1)+"~":a.key=ne.ESC+"[6~";break;case 112:l?a.key=ne.ESC+"[1;"+(l+1)+"P":a.key=ne.ESC+"OP";break;case 113:l?a.key=ne.ESC+"[1;"+(l+1)+"Q":a.key=ne.ESC+"OQ";break;case 114:l?a.key=ne.ESC+"[1;"+(l+1)+"R":a.key=ne.ESC+"OR";break;case 115:l?a.key=ne.ESC+"[1;"+(l+1)+"S":a.key=ne.ESC+"OS";break;case 116:l?a.key=ne.ESC+"[15;"+(l+1)+"~":a.key=ne.ESC+"[15~";break;case 117:l?a.key=ne.ESC+"[17;"+(l+1)+"~":a.key=ne.ESC+"[17~";break;case 118:l?a.key=ne.ESC+"[18;"+(l+1)+"~":a.key=ne.ESC+"[18~";break;case 119:l?a.key=ne.ESC+"[19;"+(l+1)+"~":a.key=ne.ESC+"[19~";break;case 120:l?a.key=ne.ESC+"[20;"+(l+1)+"~":a.key=ne.ESC+"[20~";break;case 121:l?a.key=ne.ESC+"[21;"+(l+1)+"~":a.key=ne.ESC+"[21~";break;case 122:l?a.key=ne.ESC+"[23;"+(l+1)+"~":a.key=ne.ESC+"[23~";break;case 123:l?a.key=ne.ESC+"[24;"+(l+1)+"~":a.key=ne.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=ne.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=ne.DEL:e.keyCode===219?a.key=ne.ESC:e.keyCode===220?a.key=ne.FS:e.keyCode===221&&(a.key=ne.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let f=(u=v1[e.keyCode])==null?void 0:u[e.shiftKey?1:0];if(f)a.key=ne.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=ne.ESC+p}else if(e.keyCode===32)a.key=ne.ESC+(e.ctrlKey?ne.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let m=e.code.slice(3,4);e.shiftKey||(m=m.toLowerCase()),a.key=ne.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=ne.US),e.key==="@"&&(a.key=ne.NUL));break}return a}var it=0,S1=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new wa,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new wa,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||(it=this._search(t),it===-1)||this._getKey(this._array[it])!==t)return!1;do if(this._array[it]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(it),!0;while(++it<this._array.length&&this._getKey(this._array[it])===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&&(it=this._search(e),!(it<0||it>=this._array.length)&&this._getKey(this._array[it])===e))do yield this._array[it];while(++it<this._array.length&&this._getKey(this._array[it])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(it=this._search(e),!(it<0||it>=this._array.length)&&this._getKey(this._array[it])===e))do t(this._array[it]);while(++it<this._array.length&&this._getKey(this._array[it])===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}},Wc=0,xm=0,w1=class extends De{constructor(){super(),this._decorations=new S1(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new de),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new de),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ke(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new C1(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=>{Wc=a.options.x??0,xm=Wc+(a.options.width??1),e>=Wc&&e<xm&&(!r||(a.options.layer??"bottom")===r)&&n(a)})}},C1=class extends Nr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new de),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new de),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=Xe.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Xe.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},b1=1e3,x1=class{constructor(e,t=b1){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)}},km=20,Ca=class extends De{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 x1(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(Ee(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ke(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<km+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
65
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===km+1&&(this._liveRegion.textContent+=yu.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),u=[],f=(l==null?void 0:l.translateToString(!0,void 0,void 0,u))||"",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,u)),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 u,f;if(t===0?(u=r,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(u=this._rowElements.shift(),f=r,this._rowContainer.removeChild(u)),u.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 y=m instanceof Text?m.parentNode:m,g=parseInt(y==null?void 0:y.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let S=this._rowColumns.get(y);if(!S)return console.warn("columns is null. Race condition?"),null;let v=p<S.length?S[p]:S.slice(-1)[0]+1;return v>=this._terminal.cols&&(++g,v=0),{row:g,column:v}},l=a(t),u=a(r);if(!(!l||!u)){if(l.row>u.row||l.row===u.row&&l.column>=u.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(u.row-l.row)*this._terminal.cols-l.column+u.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})`}};Ca=Ze([me(1,gh),me(2,Qi),me(3,Ji)],Ca);var eh=class extends De{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 de),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new de),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ke(()=>{var l;Yr(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(Ee(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ee(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ee(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ee(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(u=>{u.link.dispose&&u.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[l,u]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(l)&&(r=this._checkLinkProviderResult(l,e,r)):u.provideLinks(e.y,f=>{var p,y;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),((y=this._activeProviderReplies)==null?void 0:y.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 u=a[l],f=u.link.range.start.y<e?0:u.link.range.start.x,m=u.link.range.end.y>e?this._bufferService.cols:u.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 u=0;u<e;u++)(!this._activeProviderReplies.has(u)||this._activeProviderReplies.get(u))&&(a=!0);if(!a&&n){let u=n.find(f=>this._linkAtPosition(f.link,t));u&&(r=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let u=0;u<this._activeProviderReplies.size;u++){let f=(l=this._activeProviderReplies.get(u))==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&&k1(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,Yr(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}}};eh=Ze([me(1,vh),me(2,Ji),me(3,jt),me(4,V_)],eh);function k1(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 E1=class extends g1{constructor(e={}){super(e),this._linkifier=this._register(new Rs),this.browser=dg,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Rs),this._onCursorMove=this._register(new de),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new de),this.onKey=this._onKey.event,this._onRender=this._register(new de),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new de),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new de),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new de),this.onBell=this._onBell.event,this._onFocus=this._register(new de),this._onBlur=this._register(new de),this._onA11yCharEmitter=this._register(new de),this._onA11yTabEmitter=this._register(new de),this._onWillOpen=this._register(new de),this._setup(),this._decorationService=this._instantiationService.createInstance(w1),this._instantiationService.setService(In,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(mw),this._instantiationService.setService(V_,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(wu)),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(kt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(kt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(kt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(kt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ke(()=>{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=We.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ne.ESC}]${n};${h1(a)}${ug.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=nt.toColor(...t.color));else{let l=r;this._themeService.modifyColors(u=>u[l]=nt.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(Ca,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ne.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(ne.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,u=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=u+"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(Ee(this.element,"copy",t=>{this.hasSelection()&&D0(t,this._selectionService)}));let e=t=>M0(t,this.textarea,this.coreService,this.optionsService);this._register(Ee(this.textarea,"paste",e)),this._register(Ee(this.element,"paste",e)),fg?this._register(Ee(this.element,"mousedown",t=>{t.button===2&&jp(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ee(this.element,"contextmenu",t=>{jp(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Eh&&this._register(Ee(this.element,"auxclick",t=>{t.button===1&&O_(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ee(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ee(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ee(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ee(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ee(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ee(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ee(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(Ee(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",vu.get()),_g||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(fw,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Qi,this._coreBrowserService),this._register(Ee(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Ee(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance($u,this._document,this._helperContainer),this._instantiationService.setService(Ma,this._charSizeService),this._themeService=this._instantiationService.createInstance(qu),this._instantiationService.setService(Ps,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ya),this._instantiationService.setService(q_,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Uu,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(zu,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Wu),this._instantiationService.setService(vh,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(eh,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(Iu,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(Ku,this.element,this.screenElement,n)),this._instantiationService.setService(z0,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(kt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var l;this._selectionService.refresh(),(l=this._viewport)==null||l.queueSync()})),this._register(this._instantiationService.createInstance(Ou,this.screenElement)),this._register(Ee(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(Ca,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(va,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(va,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Hu,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,y,g,S,v;let u=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!u)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 C=l.deltaY;if(C===0||e.coreMouseService.consumeWheelEvent(l,(S=(g=(y=(p=e._renderService)==null?void 0:p.dimensions)==null?void 0:y.device)==null?void 0:g.cell)==null?void 0:S.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return!1;m=C<0?0:1,f=4;break;default:return!1}return m===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.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(Ee(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(Ee(t,"wheel",l=>{var u,f,m,p,y;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=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:f.device)==null?void 0:m.cell)==null?void 0:p.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return this.cancel(l,!0);let g=ne.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){I_(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=y1(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===ne.ETX||r.key===ne.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)&&(N1(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(st));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(ne.ESC+"[I"):this.coreService.triggerDataEvent(ne.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(`${ne.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(`${ne.ESC}[6;${a};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function N1(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var R1=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)}},P1=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)}},Em=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 P1(t)}getNullCell(){return new mi}},D1=class extends De{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new de),this.onBufferChange=this._onBufferChange.event,this._normal=new Em(this._core.buffers.normal,"normal"),this._alternate=new Em(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)}},M1=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)}},L1=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}},T1=["cols","rows"],Ti=0,B1=class extends De{constructor(e){super(),this._core=this._register(new E1(e)),this._addonManager=this._register(new R1),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(T1.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 M1(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new L1(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 D1(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 vu.get()},set promptLabel(e){vu.set(e)},get tooMuchOutput(){return yu.get()},set tooMuchOutput(e){yu.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 j1=2,A1=1,I1=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var 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),u={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=u.top+u.bottom,m=u.right+u.left,p=n-f,y=a-m-t;return{cols:Math.max(j1,Math.floor(y/e.css.cell.width)),rows:Math.max(A1,Math.floor(p/e.css.cell.height))}}};function O1(e,t){return e?`/api/route/${String(e).split("/").map(encodeURIComponent).join("/")}/_/ws?token=${encodeURIComponent(t||"")}`:"/ws"}function z1({session:e,node:t,token:r,cols:n,rows:a,readonly:l=!1,takeSize:u,focused:f,onData:m,onExit:p,onFiles:y,retryBaseMs:g=250}){const S=["localhost","127.0.0.1","::1","[::1]"].includes(location.hostname);if(location.protocol!=="https:"&&!S)throw new Error("nexuscrew: ws:// rifiutato su origine non-locale e non-TLS (apri via tunnel su localhost o servi in HTTPS)");const C=`${location.protocol==="https:"?"wss":"ws"}://${location.host}${O1(t,r)}`;let N=null,k=!1,P=!1,F=null,B=0,H=f;const Y=()=>{if(k||P||F)return;const L=Math.min(5e3,Math.max(0,g)*2**Math.min(B++,5));F=setTimeout(()=>{F=null,$()},L)},$=()=>{if(k||P)return;const L=new WebSocket(C);N=L,L.binaryType="arraybuffer",L.onopen=()=>{if(N!==L||k)return;B=0;const U={type:"attach",session:e,token:r,cols:n,rows:a,readonly:l};u!==void 0&&(U.takeSize=u),L.send(JSON.stringify(U)),H!==void 0&&L.send(JSON.stringify({type:"focus",on:!!H}))},L.onmessage=U=>{if(!(N!==L||k))if(typeof U.data=="string"){let T;try{T=JSON.parse(U.data)}catch{return}T.type==="exit"&&(P=!0,p&&p(T.code)),T.type==="files"&&y&&y(T)}else m&&m(new Uint8Array(U.data))},L.onerror=()=>{if(N===L)try{L.close()}catch{}},L.onclose=U=>{N!==L||k||P||[1e3,1002,4401,4404].includes(U==null?void 0:U.code)||Y()}};return $(),{sendInput:L=>{!N||N.readyState!==1||N.send(typeof L=="string"?new TextEncoder().encode(L):L)},resize:(L,U)=>{n=L,a=U,(N==null?void 0:N.readyState)===1&&N.send(JSON.stringify({type:"resize",cols:L,rows:U}))},action:L=>{(N==null?void 0:N.readyState)===1&&N.send(JSON.stringify({type:"action",name:L}))},focus:L=>{H=L,(N==null?void 0:N.readyState)===1&&N.send(JSON.stringify({type:"focus",on:!!L}))},close:()=>{if(k=!0,F&&clearTimeout(F),F=null,N)try{N.close()}catch{}},get raw(){return N}}}async function Nm(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 F1(e){return!e||typeof e!="object"?!1:!!e.shiftKey}function H1(e){return!e||typeof e!="object"||String(e.key||"").toLowerCase()!=="c"?!1:!!(e.metaKey||e.ctrlKey&&e.shiftKey)}const $1=450,Rm=8;function W1(e,t,r,n){return Math.abs(Number(r)-Number(e))>Rm||Math.abs(Number(n)-Number(t))>Rm}function Eg({session:e,node:t,token:r,readonly:n,takeSize:a,focused:l,sendRef:u,actionRef:f,ctrlRef:m,setCtrlArmed:p,onFiles:y,fontSize:g=13,selectionMode:S=!1,onSelectionModeChange:v}){const C=I.useRef(null),N=I.useRef(null),k=I.useRef(g);k.current=g;const P=I.useRef(l);P.current=l;const F=I.useRef(S);F.current=S;const[B,H]=I.useState(""),[Y,$]=I.useState(""),L=async()=>{var q,A,O,G;const T=((A=(q=N.current)==null?void 0:q.term)==null?void 0:A.getSelection())||B;if(!T){$(b("copy-empty")),setTimeout(()=>$(""),1500);return}const K=await Nm(T);$(b(K?"copied":"copy-manual")),K&&((G=(O=N.current)==null?void 0:O.term)==null||G.clearSelection(),v==null||v(!1)),setTimeout(()=>$(""),1800)},U=I.useRef(L);return U.current=L,I.useEffect(()=>{const T=N.current;T&&T.sock&&T.sock.focus&&T.sock.focus(!!l)},[l]),I.useEffect(()=>{const T=N.current;T&&(T.term.options.fontSize=g,T.fit.fit(),T.sock.resize(T.term.cols,T.term.rows))},[g]),I.useEffect(()=>{const T=new B1({cursorBlink:!0,fontSize:k.current,scrollback:1e3,theme:{background:"#0a0e0a"}}),K=new I1;T.loadAddon(K),T.open(C.current),K.fit();const q=new TextDecoder;let A;try{A=z1({session:e,node:t,token:r,readonly:n,takeSize:a,focused:P.current,onFiles:y,cols:T.cols,rows:T.rows,onData:ge=>T.write(q.decode(ge)),onExit:()=>T.write(`\r
|
|
78
|
+
\x1B[33m[sessione finita]\x1B[0m\r
|
|
79
|
+
`)})}catch(ge){return T.write(`\r
|
|
80
|
+
\x1B[31m${ge.message}\x1B[0m\r
|
|
81
|
+
`),()=>T.dispose()}N.current={term:T,fit:K,sock:A},u&&(u.current=ge=>A.sendInput(ge)),f&&(f.current=ge=>A.action(ge));const O=T.onData(ge=>{if(!n){if(m&&m.current&&ge.length===1){const Be=ge.charCodeAt(0);let wt=Be;Be>=97&&Be<=122?wt=Be-96:Be>=64&&Be<=95?wt=Be-64:Be===32&&(wt=0),ge=String.fromCharCode(wt),m.current=!1,p&&p(!1)}A.sendInput(ge)}}),G=T.onSelectionChange(()=>H(T.getSelection()));T.attachCustomKeyEventHandler(ge=>(ge.ctrlKey||ge.metaKey)&&ge.key.toLowerCase()==="c"&&T.getSelection()?(ge.type==="keydown"&&Nm(T.getSelection()),!1):!0);const Z=C.current,ie=24;let Q=null,x=null,X=0,re=null,R=null,E=null,ee=!1;const M=()=>{E&&clearTimeout(E),E=null},j=(ge,Be)=>{const Mt=(Z.querySelector(".xterm-screen")||Z).getBoundingClientRect(),ni=Math.max(0,Math.min(T.cols-1,Math.floor((ge-Mt.left)/Math.max(1,Mt.width)*T.cols))),Ei=Math.max(0,Math.min(T.rows-1,Math.floor((Be-Mt.top)/Math.max(1,Mt.height)*T.rows)));return{col:ni,row:T.buffer.active.viewportY+Ei}},se=ge=>j(ge.clientX,ge.clientY),ce=ge=>{if(M(),ee=!1,ge.touches.length!==1){Q=null;return}if(F.current){ge.preventDefault(),ge.stopPropagation(),R=se(ge.touches[0]),T.clearSelection();return}Q=ge.touches[0].clientY,x=ge.touches[0].clientX,X=0,re=null;const Be={x,y:Q};E=setTimeout(()=>{E=null,ee=!0,F.current=!0,v==null||v(!0),R=j(Be.x,Be.y),T.clearSelection(),T.select(R.col,R.row,1),Q=null,x=null,re=null,X=0},$1)},oe=ge=>{if((F.current||ee)&&R&&ge.touches.length===1){ge.preventDefault(),ge.stopPropagation();const wt=se(ge.touches[0]),Mt=R.row*T.cols+R.col,ni=wt.row*T.cols+wt.col,Ei=Mt<=ni?R:wt;T.select(Ei.col,Ei.row,Math.abs(ni-Mt)+1);return}if(Q===null||ge.touches.length!==1)return;ge.preventDefault(),ge.stopPropagation();const Be=ge.touches[0];if(E&&W1(x,Q,Be.clientX,Be.clientY)&&M(),re===null&&(Math.abs(Be.clientY-Q)>8||Math.abs(Be.clientX-x)>8)&&(re=Math.abs(Be.clientY-Q)>Math.abs(Be.clientX-x)),!!re){for(X+=Be.clientY-Q,Q=Be.clientY;X>=ie;)A.action("scroll-up"),X-=ie;for(;X<=-ie;)A.action("scroll-down"),X+=ie}},pe=()=>{M(),Q=null,x=null,R=null,ee=!1};let Ne=0;const ot=ge=>{for(ge.preventDefault(),ge.stopPropagation(),Ne+=ge.deltaY;Ne<=-ie;)A.action("scroll-up"),Ne+=ie;for(;Ne>=ie;)A.action("scroll-down"),Ne-=ie};Z.addEventListener("touchstart",ce,{passive:!1}),Z.addEventListener("touchmove",oe,{passive:!1,capture:!0}),Z.addEventListener("touchend",pe,{passive:!0}),Z.addEventListener("touchcancel",pe,{passive:!0});const Ge=ge=>{(F.current||ee)&&(ge.preventDefault(),ge.stopPropagation())};Z.addEventListener("contextmenu",Ge,!0),Z.addEventListener("wheel",ot,{passive:!1,capture:!0});let ye=null;const ti=ge=>{F1(ge)&&(ge.preventDefault(),ge.stopPropagation(),ye=j(ge.clientX,ge.clientY),T.clearSelection())},gi=ge=>{if(!ye)return;ge.preventDefault(),ge.stopPropagation();const Be=j(ge.clientX,ge.clientY),wt=ye.row*T.cols+ye.col,Mt=Be.row*T.cols+Be.col,ni=wt<=Mt?ye:Be;T.select(ni.col,ni.row,Math.abs(Mt-wt)+1)},Rr=ge=>{ye&&(ge.stopPropagation(),ye=null)};Z.addEventListener("mousedown",ti,!0),Z.addEventListener("mousemove",gi,!0),Z.addEventListener("mouseup",Rr,!0);const Zi=ge=>{!H1(ge)||!(N.current&&N.current.term&&N.current.term.getSelection())||(ge.preventDefault(),ge.stopPropagation(),U.current&&U.current())};Z.addEventListener("keydown",Zi,!0);const ii=()=>{K.fit(),A.resize(T.cols,T.rows)};window.addEventListener("resize",ii);const ri=window.visualViewport;ri&&(ri.addEventListener("resize",ii),ri.addEventListener("scroll",ii));let si=null,It=0;return typeof ResizeObserver<"u"&&(si=new ResizeObserver(()=>{It&&cancelAnimationFrame(It),It=requestAnimationFrame(ii)}),si.observe(Z)),()=>{N.current=null,O.dispose(),G.dispose(),Z.removeEventListener("touchstart",ce),Z.removeEventListener("touchmove",oe,{capture:!0}),Z.removeEventListener("touchend",pe),Z.removeEventListener("touchcancel",pe),Z.removeEventListener("contextmenu",Ge,!0),M(),Z.removeEventListener("wheel",ot,{capture:!0}),Z.removeEventListener("mousedown",ti,!0),Z.removeEventListener("mousemove",gi,!0),Z.removeEventListener("mouseup",Rr,!0),Z.removeEventListener("keydown",Zi,!0),window.removeEventListener("resize",ii),ri&&(ri.removeEventListener("resize",ii),ri.removeEventListener("scroll",ii)),si&&si.disconnect(),It&&cancelAnimationFrame(It),A.close(),T.dispose()}},[e,t,r,n,a,u,f,m,p,y]),h.jsxs("div",{className:`nc-terminal${S?" selecting":""}`,children:[h.jsx("div",{className:"nc-terminal-host",ref:C}),(B||S)&&h.jsxs("div",{className:"nc-selection-tools",children:[B?h.jsx("button",{type:"button",onClick:L,children:Y||b("copy")}):h.jsx("span",{children:b("select-drag")}),h.jsx("button",{type:"button",onClick:()=>{var T,K;(K=(T=N.current)==null?void 0:T.term)==null||K.clearSelection(),H(""),v==null||v(!1)},children:b("cancel")}),Y===b("copy-manual")&&h.jsx("textarea",{readOnly:!0,value:B,onFocus:T=>T.target.select()})]})]})}const Pm="",Kt="\x1B",U1=[{label:"↑",seq:Kt+"[A"},{label:"↓",seq:Kt+"[B"},{label:"PGUP",seq:Kt+"[5~"},{label:"PGDN",seq:Kt+"[6~"}];function K1({send:e,action:t,ctrlArmed:r=!1,onCtrl:n,onKeyboard:a,selectionMode:l=!1,onSelectionMode:u}){const[f,m]=I.useState(!1),[p,y]=I.useState(!1),[g,S]=I.useState(!1),v=k=>{g?(e(Kt+k),S(!1)):e(k)},C=(k,P,F)=>h.jsx("button",{onMouseDown:B=>{B.preventDefault(),v(P),F&&F()},children:k},k),N=(k,P)=>h.jsx("button",{onMouseDown:F=>{F.preventDefault(),t(P),y(!1)},children:k},k);return f?h.jsxs("div",{className:"nc-keybar copy",children:[h.jsx("span",{className:"tag",children:"copy-mode"}),U1.map(k=>C(k.label,k.seq)),C("ESCI (q)","q",()=>m(!1))]}):h.jsxs("div",{className:"nc-keybar termux",children:[p&&h.jsxs("div",{className:"nc-keymenu",children:[N("←WIN","prev-window"),N("WIN→","next-window"),N("⬅PANE","pane-left"),N("PANE➡","pane-right"),C("SCROLL",Pm+"[",()=>{m(!0),y(!1)}),h.jsx("button",{className:l?"armed":"",onMouseDown:k=>{k.preventDefault(),u==null||u(!l),y(!1)},children:"SELECT"}),C("⌃C","",()=>y(!1)),C("DETACH",Pm+"d",()=>y(!1))]}),h.jsxs("div",{className:"row",children:[C("ESC",Kt),h.jsx("button",{className:p?"armed":"",onMouseDown:k=>{k.preventDefault(),y(P=>!P)},children:"☰"},"menu"),C("/","/"),C("—","-"),C("HOME",Kt+"[H"),C("↑",Kt+"[A"),C("END",Kt+"[F"),C("PGUP",Kt+"[5~")]}),h.jsxs("div",{className:"row",children:[C("⇥"," "),h.jsx("button",{onMouseDown:k=>{k.preventDefault(),a&&a()},children:"⌨"},"kbd"),h.jsx("button",{className:r?"armed":"",onMouseDown:k=>{k.preventDefault(),n&&n()},children:"CTRL"},"ctrl"),h.jsx("button",{className:g?"armed":"",onMouseDown:k=>{k.preventDefault(),S(P=>!P)},children:"ALT"},"alt"),C("←",Kt+"[D"),C("↓",Kt+"[B"),C("→",Kt+"[C"),C("PGDN",Kt+"[6~")]})]})}const q1=e=>e>1048576?`${(e/1048576).toFixed(1)}M`:e>1024?`${(e/1024).toFixed(0)}K`:`${e}B`;function Ng({session:e,node:t,token:r,filesEvent:n,onClose:a}){ei();const l=t?`/api/route/${String(t).split("/").map(encodeURIComponent).join("/")}/_`:"/api",u=t?`${t}:${e}`:e,[f,m]=I.useState("outbox"),[p,y]=I.useState({inbox:[],outbox:[]}),[g,S]=I.useState(""),v=I.useRef(null);async function C(){try{const B=await(await yt(`${l}/files?session=${encodeURIComponent(e)}`,r)).json();if(B.error){S(B.error);return}y(B);const H=B.outbox[0]?B.outbox[0].mtime:0;localStorage.setItem(C_(u),String(H))}catch(F){S(String(F))}}I.useEffect(()=>{C()},[e,t]),I.useEffect(()=>{n&&n.session===e&&C()},[n]);async function N(F){for(const B of F){S(`carico ${B.name}…`);const H=new FormData;H.append("session",e),H.append("file",B);try{const $=await(await yt(`${l}/files/upload`,r,{method:"POST",body:H})).json();S($.error?`errore: ${$.error}`:"")}catch(Y){S(String(Y))}}C()}async function k(F){const B=await yt(`${l}/files/download?session=${encodeURIComponent(e)}&box=${f}&name=${encodeURIComponent(F)}`,r);if(!B.ok){S("errore download");return}const H=await B.blob(),Y=URL.createObjectURL(H),$=document.createElement("a");$.href=Y,$.download=F,$.click(),URL.revokeObjectURL(Y)}async function P(F){await yt(`${l}/files?session=${encodeURIComponent(e)}&box=${f}&name=${encodeURIComponent(F)}`,r,{method:"DELETE"}),C()}return h.jsxs("div",{className:"nc-files",children:[h.jsxs("header",{children:[h.jsx("b",{children:t?`${t}:${e}`:e}),h.jsx("button",{onClick:a,title:b("close"),children:h.jsx(Ie,{name:"x",size:20})})]}),h.jsxs("nav",{children:[h.jsx("button",{className:f==="outbox"?"on":"",onClick:()=>m("outbox"),children:"outbox"}),h.jsx("button",{className:f==="inbox"?"on":"",onClick:()=>m("inbox"),children:"inbox"}),h.jsxs("button",{className:"up",onClick:()=>v.current&&v.current.click(),children:[h.jsx(Ie,{name:"upload",size:18})," ",b("upload")]}),h.jsx("input",{type:"file",multiple:!0,ref:v,style:{display:"none"},onChange:F=>{N(Array.from(F.target.files||[])),F.target.value=""}})]}),g&&h.jsx("div",{className:"nc-busy",children:g}),h.jsxs("ul",{children:[p[f].map(F=>h.jsxs("li",{children:[h.jsx("span",{className:"name",onClick:()=>k(F.name),children:F.name}),h.jsx("small",{children:q1(F.size)}),h.jsx("button",{onClick:()=>P(F.name),title:"elimina",children:h.jsx(Ie,{name:"trash",size:18})})]},F.name)),p[f].length===0&&h.jsx("li",{className:"empty",children:b("empty-files")})]})]})}const V1="\r";function Y1(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 Rg({send:e,token:t,session:r,node:n}){ei();const a=n?`/api/route/${String(n).split("/").map(encodeURIComponent).join("/")}/_`:"/api",[l,u]=I.useState(""),[f,m]=I.useState(!1),[p,y]=I.useState(""),[g,S]=I.useState(!1),v=I.useRef(null),C=I.useRef(null),N=I.useRef(null),[k,P]=I.useState(!1),[F,B]=I.useState({left:0,bottom:0}),[H,Y]=I.useState(!1),$=I.useRef(null),L=I.useRef(null),U=I.useRef(null),T=I.useRef(null),K=I.useRef(null),q=I.useRef(`nc-attach-${Math.random().toString(36).slice(2,8)}`);I.useEffect(()=>{let R=!1;if(n){S(!1);return}return yt(`${a}/voice/status`,t).then(E=>E.json()).then(E=>{R||S(!!E.serverSttConfigured)}).catch(()=>{R||S(!1)}),()=>{R=!0}},[t,a]);const O=!!(typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)||g);function G(){const R=Y1(l);R&&(e(R),e(V1),u(""),requestAnimationFrame(()=>{var E;return(E=N.current)==null?void 0:E.focus({preventScroll:!0})}))}function Z(){const R=$.current&&$.current.getBoundingClientRect();R&&B({left:Math.max(6,Math.min(R.left,window.innerWidth-186)),bottom:window.innerHeight-R.top+6}),P(!0)}function ie(R){P(!1),R&&$.current&&$.current.focus()}I.useEffect(()=>{if(!k)return;const R=ee=>{ee.key==="Escape"&&ie(!0)},E=ee=>{const M=L.current&&L.current.contains(ee.target),j=$.current&&$.current.contains(ee.target);!M&&!j&&ie(!1)};return document.addEventListener("keydown",R),document.addEventListener("pointerdown",E),()=>{document.removeEventListener("keydown",R),document.removeEventListener("pointerdown",E)}},[k]);function Q(R){ie(!1),R.current&&R.current.click()}async function x(R){if(!R.length||!r)return;Y(!0),y("");const E=[];for(const ee of R)try{const M=new FormData;M.append("session",r),M.append("paste","false"),M.append("file",ee,ee.name);const se=await(await yt(`${a}/files/upload`,t,{method:"POST",body:M})).json();if(se.error){y(se.error);break}E.push(se.path)}catch(M){y(String(M));break}E.length&&u(ee=>ee+(ee&&!ee.endsWith(" ")?" ":"")+E.join(" ")),Y(!1)}function X(){v.current&&v.current.stop(),C.current&&C.current.stop(),m(!1)}async function re(){y("");const R=window.SpeechRecognition||window.webkitSpeechRecognition;if(R){const E=new R;E.lang="it-IT",E.continuous=!1,E.interimResults=!0;const ee=l?`${l} `:"";E.onresult=M=>{const j=Array.from(M.results).map(se=>se[0].transcript).join("");u(ee+j)},E.onend=()=>m(!1),E.onerror=M=>{y(`voice: ${M.error||"errore"}`),m(!1)},v.current=E,E.start(),m(!0);return}try{const E=await navigator.mediaDevices.getUserMedia({audio:!0}),ee=new MediaRecorder(E),M=[];ee.ondataavailable=j=>M.push(j.data),ee.onstop=async()=>{E.getTracks().forEach(j=>j.stop()),m(!1),y("trascrivo…");try{const j=new Blob(M,{type:ee.mimeType||"audio/webm"}),ce=await(await yt(`${a}/voice/transcribe`,t,{method:"POST",headers:{"content-type":"application/octet-stream"},body:j})).json();ce.error?y(ce.error):(y(""),u(oe=>oe+(oe?" ":"")+(ce.text||"")))}catch(j){y(String(j))}},C.current={stop:()=>ee.state!=="inactive"&&ee.stop()},ee.start(),m(!0)}catch{y("microfono non disponibile"),m(!1)}}return h.jsxs("div",{className:"nc-composer",children:[p&&h.jsx("div",{className:"nc-composer-err",children:p}),h.jsxs("div",{className:"nc-composer-row",children:[r&&h.jsx("button",{ref:$,className:H?"attach busy":"attach",disabled:H,onClick:()=>k?ie(!1):Z(),title:b(H?"attach-uploading":"attach"),"aria-label":b("attach"),"aria-haspopup":"menu","aria-expanded":k,"aria-controls":q.current,children:h.jsx(Ie,{name:"attach",size:22})}),k&&h.jsxs("div",{ref:L,id:q.current,role:"menu",className:"nc-attach-menu",style:{left:F.left,bottom:F.bottom},children:[h.jsxs("button",{role:"menuitem",onClick:()=>Q(U),children:[h.jsx(Ie,{name:"file",size:18})," ",b("attach-file")]}),h.jsxs("button",{role:"menuitem",onClick:()=>Q(T),children:[h.jsx(Ie,{name:"camera",size:18})," ",b("attach-camera")]}),h.jsxs("button",{role:"menuitem",onClick:()=>Q(K),children:[h.jsx(Ie,{name:"image",size:18})," ",b("attach-gallery")]})]}),h.jsx("input",{ref:U,type:"file",multiple:!0,hidden:!0,onChange:R=>{x(Array.from(R.target.files||[])),R.target.value=""}}),h.jsx("input",{ref:T,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:R=>{x(Array.from(R.target.files||[])),R.target.value=""}}),h.jsx("input",{ref:K,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:R=>{x(Array.from(R.target.files||[])),R.target.value=""}}),h.jsx("textarea",{ref:N,rows:2,value:l,placeholder:b("composer-placeholder"),onChange:R=>u(R.target.value)}),O&&h.jsx("button",{className:f?"mic on":"mic",onClick:f?X:re,title:b("voice"),children:h.jsx(Ie,{name:"mic",size:22})}),h.jsx("button",{type:"button",className:"go",onPointerDown:R=>R.preventDefault(),onClick:G,title:b("send"),children:h.jsx(Ie,{name:"enter",size:22})})]})]})}function ba(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 Dm(e){return String(e||"?").replace(/^[^a-zA-Z0-9]+/,"").charAt(0).toUpperCase()||"?"}const X1=180,G1=480;function Uc(e){return e.status==="down"?e.downSince?b("tunnel-down-since").replace("{t}",ba(e.downSince)):b("tunnel-down"):e.status==="unreachable"?b("node-unreachable"):e.status==="offline"?e.lastSeen?b("node-offline-seen").replace("{t}",ba(e.lastSeen)):b("node-offline"):e.status==="needs-repair"?b("node-needs-repair"):""}function Q1(e){return e?e.status==="healthy"?"on":"warn":null}function Mm(e){return e&&(e.detail||e.status)||""}function J1({sessions:e=[],cells:t=[],activeSessions:r=[],nodeGroups:n=[],onPick:a,onAddTile:l,onPower:u,onNodePower:f,onKill:m,onNew:p,onSettings:y,width:g=240,collapsed:S=!1,onResize:v,onToggleCollapse:C}){const[N,k]=ei(),[P,F]=I.useState(M_),B=x=>F(X=>L_(X,x)),H=new Set((t||[]).map(x=>x.tmuxSession)),Y=new Map((e||[]).map(x=>[x.name,x])),$=(x,X)=>bn(P,x,X),L=mu,U=[...t||[]].sort((x,X)=>L($(x.tmuxSession,(Y.get(x.tmuxSession)||{}).activity),$(X.tmuxSession,(Y.get(X.tmuxSession)||{}).activity))),T=(e||[]).filter(x=>!H.has(x.name)).sort((x,X)=>L($(x.name,x.activity),$(X.name,X.activity))||x.name.localeCompare(X.name)),K=new Set(r||[]),[q,A]=I.useState(null),O=(x,X)=>{const re=x.currentTarget.getBoundingClientRect();A({text:X,y:re.top+re.height/2})},G=()=>A(null),Z=I.useRef(null);I.useEffect(()=>()=>{Z.current&&Z.current()},[]);function ie(x){x.preventDefault(),x.stopPropagation();const X=x.clientX,re=g,R=ee=>{const M=Math.max(X1,Math.min(G1,re+(ee.clientX-X)));v&&v(M)},E=()=>{window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E),window.removeEventListener("blur",E),Z.current=null};window.addEventListener("pointermove",R),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),window.addEventListener("blur",E),Z.current=E}const Q=S?{width:48,flex:"0 0 48px"}:{width:g,flex:`0 0 ${g}px`};return S?h.jsxs("aside",{className:"nc-sidebar mini",style:Q,children:[h.jsx("div",{className:"nc-side-head mini",children:h.jsx("button",{className:"nc-collapse-btn",onClick:C,title:b("expand"),children:"⟩"})}),h.jsxs("div",{className:"nc-side-group mini",children:[U.map(x=>{const X=x.degraded?"warn":x.tmux?"on":"",re=!!x.tmux;return h.jsx("button",{type:"button",className:`nc-mini-dot${K.has(x.tmuxSession)?" active":""}`,onMouseEnter:R=>O(R,x.cell),onMouseLeave:G,draggable:re,onDragStart:re?R=>R.dataTransfer.setData("text/nc-session",x.tmuxSession):void 0,onClick:re?()=>l&&l(x.tmuxSession):()=>u&&u(x),onDoubleClick:re?()=>a&&a(x.tmuxSession):void 0,children:h.jsx("span",{className:`nc-dot ${X}`})},x.cell)}),T.map(x=>h.jsx("button",{type:"button",className:`nc-mini-init${K.has(x.name)?" active":""}`,onMouseEnter:X=>O(X,x.name),onMouseLeave:G,draggable:!0,onDragStart:X=>X.dataTransfer.setData("text/nc-session",x.name),onClick:()=>l&&l(x.name),onDoubleClick:()=>a&&a(x.name),children:Dm(x.name)},x.name)),(n||[]).flatMap(x=>x.status==="up"?x.sessions.map(X=>h.jsx("button",{type:"button",className:`nc-mini-init${K.has(X.key)?" active":""}`,onMouseEnter:re=>O(re,X.key),onMouseLeave:G,draggable:!0,onDragStart:re=>re.dataTransfer.setData("text/nc-session",X.key),onClick:()=>l&&l(X.key),onDoubleClick:()=>a&&a({session:X.name,node:X.node}),children:Dm(X.name)},X.key)):[h.jsx("button",{type:"button",className:"nc-mini-dot",onMouseEnter:X=>O(X,`${x.label||(x.route||[x.name]).join(" › ")}: ${Uc(x)}`),onMouseLeave:G,children:h.jsx("span",{className:"nc-dot warn"})},`nodo-${(x.route||[x.name]).join("/")}`)])]}),h.jsx("button",{className:"nc-side-gear mini",onClick:()=>y&&y("nodes",!1),title:b("settings"),onMouseEnter:x=>O(x,b("settings")),onMouseLeave:G,children:h.jsx(Ie,{name:"gear",size:16})}),q&&h.jsx("div",{className:"nc-mini-tip",style:{top:q.y},children:q.text})]}):h.jsxs("aside",{className:"nc-sidebar",style:Q,children:[h.jsxs("div",{className:"nc-side-head",children:[h.jsx("button",{className:"nc-collapse-btn",onClick:C,title:b("collapse"),children:"⟨"}),h.jsx("span",{className:"nc-side-title",children:b("fleet")}),h.jsxs("button",{className:"nc-new-btn",onClick:p,title:b("fleet-new-cell"),children:["+ ",b("new")]})]}),(t||[]).length>0&&h.jsx("div",{className:"nc-side-group",children:U.map(x=>{const X=x.degraded?"warn":x.tmux?"on":"",re=x.degraded?b("cell-degraded"):x.tmux?b("cell-on"):b("cell-off"),R=!!x.tmux;return h.jsxs("div",{className:`nc-cell${R?" live":""}${K.has(x.tmuxSession)?" active":""}`,title:re,draggable:R,onDragStart:R?E=>E.dataTransfer.setData("text/nc-session",x.tmuxSession):void 0,onClick:R?()=>l&&l(x.tmuxSession):void 0,onDoubleClick:R?()=>a&&a(x.tmuxSession):void 0,children:[h.jsx("span",{className:`nc-dot ${X}`}),h.jsxs("span",{className:"nc-cell-main",children:[h.jsx("b",{children:x.cell}),h.jsxs("small",{children:[x.engine,x.key?`·${x.key}`:""]})]}),h.jsx("button",{className:`nc-pin${P.includes(x.tmuxSession)?" on":""}`,title:b("pin"),onClick:E=>{E.stopPropagation(),B(x.tmuxSession)},children:P.includes(x.tmuxSession)?"★":"☆"}),h.jsx("button",{className:`nc-power${x.tmux?" on":""}${x.degraded?" warn":""}`,onClick:E=>{E.stopPropagation(),u&&u(x)},title:x.active?b("power-off"):b("power-on"),children:h.jsx(Ie,{name:"power",size:14})})]},x.cell)})}),h.jsxs("button",{className:"nc-side-gear",onClick:()=>y&&y("nodes",!1),title:b("settings"),children:[h.jsx(Ie,{name:"gear",size:15})," ",b("settings")]}),h.jsx("div",{className:"nc-side-group-title",children:b("other-sessions")}),h.jsxs("div",{className:"nc-side-group",children:[T.map(x=>h.jsxs("div",{className:`nc-side-card${K.has(x.name)?" active":""}`,draggable:!0,onDragStart:X=>X.dataTransfer.setData("text/nc-session",x.name),onClick:()=>l&&l(x.name),onDoubleClick:()=>a&&a(x.name),children:[h.jsx("span",{className:x.attached?"nc-dot on":"nc-dot"}),h.jsxs("span",{className:"nc-card-main",children:[h.jsx("b",{children:x.name}),h.jsxs("small",{children:[x.preview?x.preview:x.cmd?x.cmd:b("windows").replace("{n}",String(x.windows||0)),x.outbox&&x.outbox.count>0?` · 📦${x.outbox.count}`:""]})]}),x.activity?h.jsx("span",{className:"nc-rel",children:ba(x.activity)}):null,h.jsx("button",{className:`nc-pin${P.includes(x.name)?" on":""}`,title:b("pin"),onClick:X=>{X.stopPropagation(),B(x.name)},children:P.includes(x.name)?"★":"☆"}),h.jsx("button",{className:"nc-menu",title:b("terminate"),onClick:X=>{X.stopPropagation(),window.confirm(b("terminate-confirm").replace("{name}",x.name))&&m&&m(x.name)},children:"⋯"})]},x.name)),T.length===0&&h.jsx("div",{className:"nc-empty",children:b("no-sessions-short")})]}),(n||[]).map(x=>{const re=Q1(x.health)||(x.status==="up"?"on":"warn"),R=(x.route||[x.name]).join("/");return h.jsxs("div",{children:[h.jsxs("div",{className:"nc-side-group-title nc-node-title",children:[h.jsx("span",{className:`nc-dot ${re}`,title:x.health?Mm(x.health):""}),h.jsx("b",{children:x.label||x.name}),h.jsxs("small",{children:[" · ",x.status==="up"?b("node-sessions").replace("{n}",String((x.cells||[]).length+(x.unmanaged||[]).length)):x.health&&Mm(x.health)||Uc(x)]}),x.direct&&x.health&&x.health.managed!==!1&&h.jsx("button",{type:"button",className:`nc-power${x.tunnelStatus==="up"?" on":""}`,title:x.tunnelStatus==="up"?b("power-off"):b("power-on"),onClick:()=>f&&f(x),children:h.jsx(Ie,{name:"power",size:14})})]}),x.status==="up"&&h.jsxs("div",{className:"nc-side-group",children:[(x.cells||[]).map(E=>{const ee=!!E.tmux,M=E.degraded?"warn":E.tmux?"on":"";return h.jsxs("div",{className:`nc-side-card nc-cell${ee?" live":""}${K.has(E.key)?" active":""}`,title:E.active?b("cell-on"):b("cell-off"),draggable:ee,onDragStart:ee?j=>j.dataTransfer.setData("text/nc-session",E.key):void 0,onClick:ee?()=>l&&l(E.key):void 0,onDoubleClick:ee?()=>a&&a({session:E.tmuxSession,node:R}):void 0,children:[h.jsx("span",{className:`nc-dot ${M}`}),h.jsxs("span",{className:"nc-card-main",children:[h.jsx("b",{children:E.cell}),h.jsxs("small",{children:[E.engine,E.key?`·${E.key}`:"",E.active?"":` · ${b("cell-off")}`]})]}),(x.capabilities||[]).includes(E.active?"down":"up")&&h.jsx("button",{className:`nc-power${E.active?" on":""}${E.degraded?" warn":""}`,onClick:j=>{j.stopPropagation(),u&&u({...E,route:x.route,availableEngines:x.engines||[]})},title:E.active?b("power-off"):b("power-on"),children:h.jsx(Ie,{name:"power",size:14})})]},E.key)}),(x.unmanaged||[]).map(E=>h.jsxs("div",{className:`nc-side-card${K.has(E.key)?" active":""}`,draggable:!0,onDragStart:ee=>ee.dataTransfer.setData("text/nc-session",E.key),onClick:()=>l&&l(E.key),onDoubleClick:()=>a&&a({session:E.name,node:E.node}),children:[h.jsx("span",{className:E.attached?"nc-dot on":"nc-dot"}),h.jsxs("span",{className:"nc-card-main",children:[h.jsx("b",{children:E.name}),h.jsx("small",{children:E.preview?E.preview:E.cmd?E.cmd:b("windows").replace("{n}",String(E.windows||0))})]}),E.activity?h.jsx("span",{className:"nc-rel",children:ba(E.activity)}):null,h.jsx("button",{className:"nc-menu",title:b("terminate"),onClick:ee=>{ee.stopPropagation(),window.confirm(b("terminate-confirm").replace("{name}",E.name))&&m&&m(E.name,x.route)},children:"⋯"})]},E.key)),(x.cells||[]).length===0&&(x.unmanaged||[]).length===0&&h.jsx("div",{className:"nc-empty",children:b("no-sessions-short")})]})]},`nodo-${(x.route||[x.name]).join("/")}`)}),h.jsx("div",{className:"nc-side-lang",children:j_.map((x,X)=>h.jsxs("span",{children:[X>0&&" · ",h.jsx("button",{className:`nc-lang-btn${N===x?" on":""}`,onClick:()=>k(x),title:x,children:x.toUpperCase()})]},x))}),h.jsx("div",{className:"nc-side-resize",onPointerDown:ie,title:""})]})}const Nh=9,xa=.2,Z1=/^[a-z0-9-]{1,32}(?:\/[a-z0-9-]{1,32}){0,3}$/,th=e=>Z1.test(e)&&new Set(e.split("/")).size===e.split("/").length;function ka(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!th(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"&&th(e.node)?{session:e.session,node:e.node}:null:null}function zi(e){const t=ka(e);return t?t.node?`${t.node}:${t.session}`:t.session:""}const Pg=9,Dg=24,Ba=11,eC=e=>{const t=Number(e);return t>=Pg&&t<=Dg?t:Ba};function Ea(){return{columns:[]}}function Gi(e){return e.columns.flatMap(t=>t.tiles.map(r=>zi(r)))}const Fn=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(r=>({...r}))}))});function Na(e,t,r,n){const a=ka(t);if(!a||Gi(e).includes(zi(a))||Gi(e).length>=Nh)return e;const l=Fn(e),u={session:a.session,height:1,fontSize:Ba,...n||{}};if(a.node&&(u.node=a.node),r==="end")return l.columns.push({width:1,tiles:[u]}),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,u),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:[u]}),l}return l.columns.push({width:1,tiles:[u]}),l}function Mg(e,t){const r=zi(t);if(!r||Gi(e).includes(r)||Gi(e).length>=Nh)return e;const n=Gi(e).length+1,a=Math.ceil(Math.sqrt(n));if(e.columns.length<a)return Na(e,t,"end");let l=0;for(let u=1;u<e.columns.length;u+=1)e.columns[u].tiles.length<e.columns[l].tiles.length&&(l=u);return Na(e,t,{col:l,row:e.columns[l].tiles.length})}function Ra(e,t){const r=zi(t),n=Fn(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 tC(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 Na(Ra(e,n),n,r,{fontSize:a.fontSize})}function iC(e,t,r){const n=Fn(e);return n.columns[t]&&(n.columns[t].width=Math.max(xa,Number(r)||1)),n}function rC(e,t,r,n){const a=Fn(e),l=a.columns[t]&&a.columns[t].tiles[r];return l&&(l.height=Math.max(xa,Number(n)||1)),a}function sC(e,t,r,n){if(!(e.columns[t]&&e.columns[t].tiles[r]))return e;const l=Fn(e),u=l.columns[t].tiles[r],f=Number(u.fontSize)||Ba;return u.fontSize=Math.max(Pg,Math.min(Dg,f+(Number(n)||0))),l}function nC(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 Lm(e){for(const t of[.25,.5,.75])if(Math.abs(e-t)<=.03)return t;return e}function Kr(e){if(!e||!Array.isArray(e.columns))return Ea();const t=e.columns.map(n=>({width:Math.max(xa,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"&&th(a.node)).map(a=>{const l={session:a.session,height:Math.max(xa,Number(a.height)||1),fontSize:eC(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<=Nh);return{columns:t.filter(n=>n.tiles.length>0)}}function oC({session:e,node:t,token:r,readonly:n=!1,focused:a,onFocus:l,onClose:u,onOpenSingle:f,alive:m=!0,fontSize:p=Ba,onZoom:y,decks:g=[],currentDeck:S,onSendToDeck:v}){const C=I.useRef(()=>{}),N=I.useRef(()=>{}),k=I.useRef(!1),[P,F]=I.useState(!1),[B,H]=I.useState(!1),[Y,$]=I.useState(!1),[L,U]=I.useState(null),T=t?`${t}:${e}`:e;return h.jsxs("div",{className:`nc-tile${a?" focused":""}`,onMouseDown:()=>l&&l(T),children:[h.jsxs("div",{className:"nc-tile-head",draggable:!0,onDragStart:K=>{K.dataTransfer.setData("text/nc-session",T),K.dataTransfer.effectAllowed="move"},children:[h.jsxs("button",{className:"nc-tile-name",onClick:()=>l&&l(T),children:[h.jsx("span",{className:m?"nc-dot on":"nc-dot"}),h.jsx("b",{children:e}),t&&h.jsxs("small",{className:"nc-tile-node",children:["@",t]})]}),h.jsxs("span",{className:"nc-tile-actions",children:[y&&h.jsx("button",{onClick:()=>y(-1),title:b("zoom-out"),children:h.jsx(Ie,{name:"zoomOut",size:14})}),y&&h.jsx("button",{onClick:()=>y(1),title:b("zoom-in"),children:h.jsx(Ie,{name:"zoomIn",size:14})}),v&&g.filter(K=>K!==S).length>0&&h.jsxs("select",{className:"nc-tile-deck",title:b("send-to-deck"),value:"",onMouseDown:K=>K.stopPropagation(),onChange:K=>{const q=K.target.value;q&&v(T,q),K.target.value=""},children:[h.jsx("option",{value:"",children:b("send-to-deck")}),g.filter(K=>K!==S).map(K=>h.jsx("option",{value:K,children:K},K))]}),h.jsx("button",{onClick:()=>H(K=>!K),title:"composer",children:"⌨"}),h.jsx("button",{onClick:()=>$(K=>!K),title:"file",children:"📁"}),f&&h.jsx("button",{onClick:()=>f({session:e,node:t}),title:"vista singola",children:"↗"}),u&&h.jsx("button",{className:"nc-tile-close",onClick:()=>u(T),title:"chiudi",children:"✕"})]})]}),h.jsxs("div",{className:"nc-tile-body",children:[h.jsx(Eg,{session:e,node:t,token:r,readonly:n,takeSize:!1,focused:a,sendRef:C,actionRef:N,ctrlRef:k,setCtrlArmed:F,onFiles:U,fontSize:p}),Y&&h.jsx("div",{className:"nc-tile-files",onMouseDown:K=>K.stopPropagation(),children:h.jsx(Ng,{session:e,node:t,token:r,filesEvent:L,onClose:()=>$(!1)})})]}),B&&h.jsx("div",{className:"nc-tile-composer",onMouseDown:K=>K.stopPropagation(),children:h.jsx(Rg,{send:K=>C.current(K),token:r,session:e,node:t})})]})}const Tm=.2,Bm=.28;function aC(e,t,r){const n=(e-r.left)/(r.width||1),a=(t-r.top)/(r.height||1);return n<Bm?"left":n>1-Bm?"right":a<.5?"top":"bottom"}function lC({layout:e,onLayoutChange:t,token:r,readonly:n=!1,sessionsAlive:a,focusSession:l,onFocus:u,onOpenSingle:f,decks:m=[],currentDeck:p,onSendToDeck:y}){ei();const[g,S]=I.useState(null),v=I.useRef(null),C=I.useRef([]),N=I.useRef(null);function k(T,K){const q=()=>{window.removeEventListener("pointermove",T),window.removeEventListener("pointerup",q),window.removeEventListener("pointercancel",q),window.removeEventListener("blur",q),N.current=null};window.addEventListener("pointermove",T),window.addEventListener("pointerup",q),window.addEventListener("pointercancel",q),window.addEventListener("blur",q),N.current=q}I.useEffect(()=>()=>{N.current&&N.current()},[]),I.useEffect(()=>{const T=()=>S(null);return window.addEventListener("dragend",T),window.addEventListener("drop",T),()=>{window.removeEventListener("dragend",T),window.removeEventListener("drop",T)}},[]);const P=e.columns.length,F=T=>g&&g.col===T&&g.row===void 0,B=!!g&&g.col===P,H=(T,K)=>g&&g.col===T&&g.row===K&&g.quadrant?` drop-${g.quadrant}`:"";function Y(T){T.preventDefault();const K=T.dataTransfer.getData("text/nc-session"),q=g;if(S(null),!K||!q)return;let A;if(q.quadrant){if(A=nC(e,q.col,q.row,q.quadrant),!A)return}else A={col:q.col};t(Gi(e).includes(K)?tC(e,K,A):Na(e,K,A))}function $(T,K){T.preventDefault(),T.stopPropagation();const q=T.clientX,A=e.columns[K].width,O=v.current&&v.current.clientWidth||1,G=e.columns[K+1];k(ie=>{let Q=Math.max(Tm,A+(ie.clientX-q)/O);if(G){const x=Lm(Q/(Q+G.width));Q=x/(1-x)*G.width}t(iC(e,K,Q))})}function L(T,K,q){T.preventDefault(),T.stopPropagation();const A=T.clientY,O=e.columns[K].tiles[q].height,G=C.current[K],Z=G&&G.clientHeight||1,ie=e.columns[K].tiles[q+1];k(x=>{let X=Math.max(Tm,O+(x.clientY-A)/Z);if(ie){const re=Lm(X/(X+ie.height));X=re/(1-re)*ie.height}t(rC(e,K,q,X))})}function U(T){t(Ra(e,T))}return h.jsxs("div",{className:"nc-grid",ref:v,onDragOver:T=>{T.preventDefault(),g&&g.col===P||S({col:P})},onDrop:Y,onDragLeave:T=>{const K=T.relatedTarget;(!K||!(v.current&&v.current.contains(K)))&&S(null)},children:[e.columns.flatMap((T,K)=>{const q=[];return q.push(h.jsx("div",{className:`nc-col${F(K)?" drop-newcol":""}`,ref:A=>{C.current[K]=A},style:{flexGrow:T.width,flexBasis:0},onDragOver:A=>{A.preventDefault(),A.stopPropagation(),g&&g.col===K&&g.row===void 0||S({col:K})},children:T.tiles.flatMap((A,O)=>{const G=[],Z=zi(A);return G.push(h.jsx("div",{className:`nc-tile-slot${H(K,O)}`,style:{flexGrow:A.height,flexBasis:0},onDragOver:ie=>{ie.preventDefault(),ie.stopPropagation();const Q=aC(ie.clientX,ie.clientY,ie.currentTarget.getBoundingClientRect());g&&g.col===K&&g.row===O&&g.quadrant===Q||S({col:K,row:O,quadrant:Q})},children:h.jsx(oC,{session:A.session,node:A.node,token:r,readonly:n,focused:l===Z,onFocus:u,onClose:U,onOpenSingle:f,alive:!a||a.has(Z),fontSize:A.fontSize,onZoom:ie=>t(sC(e,K,O,ie)),decks:m,currentDeck:p,onSendToDeck:y})},Z)),O<T.tiles.length-1&&G.push(h.jsx("div",{className:"nc-divider-h",onPointerDown:ie=>L(ie,K,O)},`h${O}`)),G})},`c${K}`)),K<P-1&&q.push(h.jsx("div",{className:"nc-divider-v",onPointerDown:A=>$(A,K)},`v${K}`)),q}),B&&h.jsx("div",{className:"nc-drop-line-v nc-drop-line-end"}),P===0&&h.jsx("div",{className:"nc-grid-empty",children:b("grid-empty")})]})}const cC=/^[a-z0-9-]{1,32}$/,Zt="main",Lg="nc_decks",uC=24;function hC(e){return typeof e!="string"?"":e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").slice(0,32).replace(/-+$/,"")}function Rh(e){return typeof e=="string"&&cC.test(e)}function dC(e){const t=String(e||"").match(/^\/deck\/([^/]+)\/?$/);if(t){let r;try{r=decodeURIComponent(t[1])}catch{r=t[1]}return Rh(r)?r:Zt}return Zt}function na(e,t){const r=e===Zt?"/":`/deck/${encodeURIComponent(e)}`;return t?`${r}#token=${encodeURIComponent(t)}`:r}function Tg(e){return e===Zt?"nc_grid_v1":`nc_grid_v1__${e}`}function Bg(e){const t=[Zt];if(Array.isArray(e)){for(const r of e)if(Rh(r)&&r!==Zt&&!t.includes(r)&&t.push(r),t.length>=uC)break}return t}function ja(){return typeof localStorage<"u"?localStorage:null}function fC(){const e=ja();if(!e)return[Zt];try{return Bg(JSON.parse(e.getItem(Lg)||"null"))}catch{return[Zt]}}function pC(e){const t=ja();if(t)try{t.setItem(Lg,JSON.stringify(Bg(e)))}catch{}}function ih(e){const t=ja();if(!t)return null;try{return JSON.parse(t.getItem(Tg(e))||"null")}catch{return null}}function mC(e,t){const r=ja();if(r)try{r.setItem(Tg(e),JSON.stringify(t))}catch{}}function _C({decks:e=[],currentDeck:t=Zt,onCreate:r,onRename:n,onDelete:a,onOpenWindow:l,onNavigate:u,saveState:f="idle",error:m=""}){ei();const[p,y]=I.useState(!1),[g,S]=I.useState(""),[v,C]=I.useState(!1),[N,k]=I.useState(""),[P,F]=I.useState(""),B=hC(g),H=Rh(B),Y=async()=>{if(H){C(!0),k("");try{r&&await r(B),S(""),y(!1)}catch(L){k(String(L.message||L))}C(!1)}},$=L=>{F(""),l&&l(L)||F(L)};return h.jsxs("div",{className:"nc-deckbar",children:[h.jsx("span",{className:"nc-deckbar-label",children:b("decks")}),h.jsx("div",{className:"nc-deck-chips",children:e.map(L=>h.jsxs("span",{className:`nc-deck-chip${L===t?" current":""}`,children:[h.jsxs("button",{className:"nc-deck-open",title:L===t?b("deck-current"):L,onClick:()=>L!==t&&u&&u(L),children:[L,L===t?" •":""]}),h.jsx("button",{className:"nc-deck-mini",title:b("open-deck-window"),onClick:()=>$(L),children:"↗"}),L!==Zt&&h.jsxs(h.Fragment,{children:[h.jsx("button",{className:"nc-deck-mini",title:b("rename-deck"),onClick:()=>{const T=((typeof window<"u"?window.prompt(b("rename-deck"),L):"")||"").trim();T&&T!==L&&n&&n(L,T).catch(K=>k(String(K.message||K)))},children:"✎"}),h.jsx("button",{className:"nc-deck-mini nc-deck-del",title:b("delete-deck"),onClick:()=>{(typeof window>"u"||window.confirm(b("delete-deck-confirm").replace("{name}",L)))&&a&&a(L).catch(U=>k(String(U.message||U)))},children:"✕"})]})]},L))}),p?h.jsxs("span",{className:"nc-deck-add",children:[h.jsx("input",{autoFocus:!0,className:H||!g?"":"invalid",placeholder:b("deck-name"),value:g,onChange:L=>S(L.target.value),onKeyDown:L=>{L.key==="Enter"&&Y(),L.key==="Escape"&&(S(""),y(!1))}}),g&&H&&B!==g&&h.jsxs("span",{className:"nc-deck-slug",children:["→ ",B]}),h.jsx("button",{className:"nc-deck-ok",disabled:!H||v,onClick:Y,children:b("create")}),h.jsx("button",{className:"nc-deck-cancel",onClick:()=>{S(""),y(!1)},children:b("cancel")})]}):h.jsxs("button",{className:"nc-deck-newbtn",title:b("new-deck"),onClick:()=>y(!0),children:["+ ",b("new-deck")]}),h.jsx("span",{className:`nc-deck-state ${f}`,title:b("deck-autosave"),children:b(f==="saving"?"saving":f==="saved"?"saved":"deck-autosave")}),(N||m)&&h.jsx("span",{className:"nc-deck-error",children:N||m}),P&&h.jsx("a",{className:"nc-deck-fallback",href:`/deck/${encodeURIComponent(P)}`,target:"_blank",rel:"noreferrer",children:b("popup-blocked")})]})}var Es={},Kc,jm;function gC(){return jm||(jm=1,Kc=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Kc}var qc={},br={},Am;function Jr(){if(Am)return br;Am=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 Vc={},Im;function Ph(){return Im||(Im=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}}})(Vc)),Vc}var Yc,Om;function vC(){if(Om)return Yc;Om=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++}},Yc=e,Yc}var Xc,zm;function yC(){if(zm)return Xc;zm=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]},Xc=e,Xc}var Gc={},Fm;function SC(){return Fm||(Fm=1,(function(e){const t=Jr().getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const a=Math.floor(n/7)+2,l=t(n),u=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]-u;return f.push(6),f.reverse()},e.getPositions=function(n){const a=[],l=e.getRowColCoords(n),u=l.length;for(let f=0;f<u;f++)for(let m=0;m<u;m++)f===0&&m===0||f===0&&m===u-1||f===u-1&&m===0||a.push([l[f],l[m]]);return a}})(Gc)),Gc}var Qc={},Hm;function wC(){if(Hm)return Qc;Hm=1;const e=Jr().getSymbolSize,t=7;return Qc.getPositions=function(n){const a=e(n);return[[0,0],[a-t,0],[0,a-t]]},Qc}var Jc={},$m;function CC(){return $m||($m=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 u=0,f=0,m=0,p=null,y=null;for(let g=0;g<l;g++){f=m=0,p=y=null;for(let S=0;S<l;S++){let v=a.get(g,S);v===p?f++:(f>=5&&(u+=t.N1+(f-5)),p=v,f=1),v=a.get(S,g),v===y?m++:(m>=5&&(u+=t.N1+(m-5)),y=v,m=1)}f>=5&&(u+=t.N1+(f-5)),m>=5&&(u+=t.N1+(m-5))}return u},e.getPenaltyN2=function(a){const l=a.size;let u=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)&&u++}return u*t.N2},e.getPenaltyN3=function(a){const l=a.size;let u=0,f=0,m=0;for(let p=0;p<l;p++){f=m=0;for(let y=0;y<l;y++)f=f<<1&2047|a.get(p,y),y>=10&&(f===1488||f===93)&&u++,m=m<<1&2047|a.get(y,p),y>=10&&(m===1488||m===93)&&u++}return u*t.N3},e.getPenaltyN4=function(a){let l=0;const u=a.data.length;for(let m=0;m<u;m++)l+=a.data[m];return Math.abs(Math.ceil(l*100/u/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 u=l.size;for(let f=0;f<u;f++)for(let m=0;m<u;m++)l.isReserved(m,f)||l.xor(m,f,r(a,m,f))},e.getBestMask=function(a,l){const u=Object.keys(e.Patterns).length;let f=0,m=1/0;for(let p=0;p<u;p++){l(p),e.applyMask(p,a);const y=e.getPenaltyN1(a)+e.getPenaltyN2(a)+e.getPenaltyN3(a)+e.getPenaltyN4(a);e.applyMask(p,a),y<m&&(m=y,f=p)}return f}})(Jc)),Jc}var oa={},Wm;function jg(){if(Wm)return oa;Wm=1;const e=Ph(),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 oa.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}},oa.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}},oa}var Zc={},Cn={},Um;function bC(){if(Um)return Cn;Um=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 Km;function xC(){return Km||(Km=1,(function(e){const t=bC();e.mul=function(n,a){const l=new Uint8Array(n.length+a.length-1);for(let u=0;u<n.length;u++)for(let f=0;f<a.length;f++)l[u+f]^=t.mul(n[u],a[f]);return l},e.mod=function(n,a){let l=new Uint8Array(n);for(;l.length-a.length>=0;){const u=l[0];for(let m=0;m<a.length;m++)l[m]^=t.mul(a[m],u);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}})(Zc)),Zc}var eu,qm;function kC(){if(qm)return eu;qm=1;const e=xC();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),u=this.degree-l.length;if(u>0){const f=new Uint8Array(this.degree);return f.set(l,u),f}return l},eu=t,eu}var tu={},iu={},ru={},Vm;function Ag(){return Vm||(Vm=1,ru.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),ru}var Bi={},Ym;function Ig(){if(Ym)return Bi;Ym=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+"$"),u=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 u.test(m)},Bi}var Xm;function Zr(){return Xm||(Xm=1,(function(e){const t=Ag(),r=Ig();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,u){if(!l.ccBits)throw new Error("Invalid mode: "+l);if(!t.isValid(u))throw new Error("Invalid version: "+u);return u>=1&&u<10?l.ccBits[0]:u<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,u){if(e.isValid(l))return l;try{return n(l)}catch{return u}}})(iu)),iu}var Gm;function EC(){return Gm||(Gm=1,(function(e){const t=Jr(),r=jg(),n=Ph(),a=Zr(),l=Ag(),u=7973,f=t.getBCHDigit(u);function m(S,v,C){for(let N=1;N<=40;N++)if(v<=e.getCapacity(N,C,S))return N}function p(S,v){return a.getCharCountIndicator(S,v)+4}function y(S,v){let C=0;return S.forEach(function(N){const k=p(N.mode,v);C+=k+N.getBitsLength()}),C}function g(S,v){for(let C=1;C<=40;C++)if(y(S,C)<=e.getCapacity(C,v,a.MIXED))return C}e.from=function(v,C){return l.isValid(v)?parseInt(v,10):C},e.getCapacity=function(v,C,N){if(!l.isValid(v))throw new Error("Invalid QR Code version");typeof N>"u"&&(N=a.BYTE);const k=t.getSymbolTotalCodewords(v),P=r.getTotalCodewordsCount(v,C),F=(k-P)*8;if(N===a.MIXED)return F;const B=F-p(N,v);switch(N){case a.NUMERIC:return Math.floor(B/10*3);case a.ALPHANUMERIC:return Math.floor(B/11*2);case a.KANJI:return Math.floor(B/13);case a.BYTE:default:return Math.floor(B/8)}},e.getBestVersionForData=function(v,C){let N;const k=n.from(C,n.M);if(Array.isArray(v)){if(v.length>1)return g(v,k);if(v.length===0)return 1;N=v[0]}else N=v;return m(N.mode,N.getLength(),k)},e.getEncodedBits=function(v){if(!l.isValid(v)||v<7)throw new Error("Invalid QR Code version");let C=v<<12;for(;t.getBCHDigit(C)-f>=0;)C^=u<<t.getBCHDigit(C)-f;return v<<12|C}})(tu)),tu}var su={},Qm;function NC(){if(Qm)return su;Qm=1;const e=Jr(),t=1335,r=21522,n=e.getBCHDigit(t);return su.getEncodedBits=function(l,u){const f=l.bit<<3|u;let m=f<<10;for(;e.getBCHDigit(m)-n>=0;)m^=t<<e.getBCHDigit(m)-n;return(f<<10|m)^r},su}var nu={},ou,Jm;function RC(){if(Jm)return ou;Jm=1;const e=Zr();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,u;for(a=0;a+3<=this.data.length;a+=3)l=this.data.substr(a,3),u=parseInt(l,10),n.put(u,10);const f=this.data.length-a;f>0&&(l=this.data.substr(a),u=parseInt(l,10),n.put(u,f*3+1))},ou=t,ou}var au,Zm;function PC(){if(Zm)return au;Zm=1;const e=Zr(),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 u=t.indexOf(this.data[l])*45;u+=t.indexOf(this.data[l+1]),a.put(u,11)}this.data.length%2&&a.put(t.indexOf(this.data[l]),6)},au=r,au}var lu,e_;function DC(){if(e_)return lu;e_=1;const e=Zr();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)},lu=t,lu}var cu,t_;function MC(){if(t_)return cu;t_=1;const e=Zr(),t=Jr();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)}},cu=r,cu}var uu={exports:{}},i_;function LC(){return i_||(i_=1,(function(e){var t={single_source_shortest_paths:function(r,n,a){var l={},u={};u[n]=0;var f=t.PriorityQueue.make();f.push(n,0);for(var m,p,y,g,S,v,C,N,k;!f.empty();){m=f.pop(),p=m.value,g=m.cost,S=r[p]||{};for(y in S)S.hasOwnProperty(y)&&(v=S[y],C=g+v,N=u[y],k=typeof u[y]>"u",(k||N>C)&&(u[y]=C,f.push(y,C),l[y]=p))}if(typeof a<"u"&&typeof u[a]>"u"){var P=["Could not find a path from ",n," to ",a,"."].join("");throw new Error(P)}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})(uu)),uu.exports}var r_;function TC(){return r_||(r_=1,(function(e){const t=Zr(),r=RC(),n=PC(),a=DC(),l=MC(),u=Ig(),f=Jr(),m=LC();function p(P){return unescape(encodeURIComponent(P)).length}function y(P,F,B){const H=[];let Y;for(;(Y=P.exec(B))!==null;)H.push({data:Y[0],index:Y.index,mode:F,length:Y[0].length});return H}function g(P){const F=y(u.NUMERIC,t.NUMERIC,P),B=y(u.ALPHANUMERIC,t.ALPHANUMERIC,P);let H,Y;return f.isKanjiModeEnabled()?(H=y(u.BYTE,t.BYTE,P),Y=y(u.KANJI,t.KANJI,P)):(H=y(u.BYTE_KANJI,t.BYTE,P),Y=[]),F.concat(B,H,Y).sort(function(L,U){return L.index-U.index}).map(function(L){return{data:L.data,mode:L.mode,length:L.length}})}function S(P,F){switch(F){case t.NUMERIC:return r.getBitsLength(P);case t.ALPHANUMERIC:return n.getBitsLength(P);case t.KANJI:return l.getBitsLength(P);case t.BYTE:return a.getBitsLength(P)}}function v(P){return P.reduce(function(F,B){const H=F.length-1>=0?F[F.length-1]:null;return H&&H.mode===B.mode?(F[F.length-1].data+=B.data,F):(F.push(B),F)},[])}function C(P){const F=[];for(let B=0;B<P.length;B++){const H=P[B];switch(H.mode){case t.NUMERIC:F.push([H,{data:H.data,mode:t.ALPHANUMERIC,length:H.length},{data:H.data,mode:t.BYTE,length:H.length}]);break;case t.ALPHANUMERIC:F.push([H,{data:H.data,mode:t.BYTE,length:H.length}]);break;case t.KANJI:F.push([H,{data:H.data,mode:t.BYTE,length:p(H.data)}]);break;case t.BYTE:F.push([{data:H.data,mode:t.BYTE,length:p(H.data)}])}}return F}function N(P,F){const B={},H={start:{}};let Y=["start"];for(let $=0;$<P.length;$++){const L=P[$],U=[];for(let T=0;T<L.length;T++){const K=L[T],q=""+$+T;U.push(q),B[q]={node:K,lastCount:0},H[q]={};for(let A=0;A<Y.length;A++){const O=Y[A];B[O]&&B[O].node.mode===K.mode?(H[O][q]=S(B[O].lastCount+K.length,K.mode)-S(B[O].lastCount,K.mode),B[O].lastCount+=K.length):(B[O]&&(B[O].lastCount=K.length),H[O][q]=S(K.length,K.mode)+4+t.getCharCountIndicator(K.mode,F))}}Y=U}for(let $=0;$<Y.length;$++)H[Y[$]].end=0;return{map:H,table:B}}function k(P,F){let B;const H=t.getBestModeForData(P);if(B=t.from(F,H),B!==t.BYTE&&B.bit<H.bit)throw new Error('"'+P+'" cannot be encoded with mode '+t.toString(B)+`.
|
|
84
|
+
Suggested mode is: `+t.toString(H));switch(B===t.KANJI&&!f.isKanjiModeEnabled()&&(B=t.BYTE),B){case t.NUMERIC:return new r(P);case t.ALPHANUMERIC:return new n(P);case t.KANJI:return new l(P);case t.BYTE:return new a(P)}}e.fromArray=function(F){return F.reduce(function(B,H){return typeof H=="string"?B.push(k(H,null)):H.data&&B.push(k(H.data,H.mode)),B},[])},e.fromString=function(F,B){const H=g(F,f.isKanjiModeEnabled()),Y=C(H),$=N(Y,B),L=m.find_path($.map,"start","end"),U=[];for(let T=1;T<L.length-1;T++)U.push($.table[L[T]].node);return e.fromArray(v(U))},e.rawSplit=function(F){return e.fromArray(g(F,f.isKanjiModeEnabled()))}})(nu)),nu}var s_;function BC(){if(s_)return qc;s_=1;const e=Jr(),t=Ph(),r=vC(),n=yC(),a=SC(),l=wC(),u=CC(),f=jg(),m=kC(),p=EC(),y=NC(),g=Zr(),S=TC();function v($,L){const U=$.size,T=l.getPositions(L);for(let K=0;K<T.length;K++){const q=T[K][0],A=T[K][1];for(let O=-1;O<=7;O++)if(!(q+O<=-1||U<=q+O))for(let G=-1;G<=7;G++)A+G<=-1||U<=A+G||(O>=0&&O<=6&&(G===0||G===6)||G>=0&&G<=6&&(O===0||O===6)||O>=2&&O<=4&&G>=2&&G<=4?$.set(q+O,A+G,!0,!0):$.set(q+O,A+G,!1,!0))}}function C($){const L=$.size;for(let U=8;U<L-8;U++){const T=U%2===0;$.set(U,6,T,!0),$.set(6,U,T,!0)}}function N($,L){const U=a.getPositions(L);for(let T=0;T<U.length;T++){const K=U[T][0],q=U[T][1];for(let A=-2;A<=2;A++)for(let O=-2;O<=2;O++)A===-2||A===2||O===-2||O===2||A===0&&O===0?$.set(K+A,q+O,!0,!0):$.set(K+A,q+O,!1,!0)}}function k($,L){const U=$.size,T=p.getEncodedBits(L);let K,q,A;for(let O=0;O<18;O++)K=Math.floor(O/3),q=O%3+U-8-3,A=(T>>O&1)===1,$.set(K,q,A,!0),$.set(q,K,A,!0)}function P($,L,U){const T=$.size,K=y.getEncodedBits(L,U);let q,A;for(q=0;q<15;q++)A=(K>>q&1)===1,q<6?$.set(q,8,A,!0):q<8?$.set(q+1,8,A,!0):$.set(T-15+q,8,A,!0),q<8?$.set(8,T-q-1,A,!0):q<9?$.set(8,15-q-1+1,A,!0):$.set(8,15-q-1,A,!0);$.set(T-8,8,1,!0)}function F($,L){const U=$.size;let T=-1,K=U-1,q=7,A=0;for(let O=U-1;O>0;O-=2)for(O===6&&O--;;){for(let G=0;G<2;G++)if(!$.isReserved(K,O-G)){let Z=!1;A<L.length&&(Z=(L[A]>>>q&1)===1),$.set(K,O-G,Z),q--,q===-1&&(A++,q=7)}if(K+=T,K<0||U<=K){K-=T,T=-T;break}}}function B($,L,U){const T=new r;U.forEach(function(G){T.put(G.mode.bit,4),T.put(G.getLength(),g.getCharCountIndicator(G.mode,$)),G.write(T)});const K=e.getSymbolTotalCodewords($),q=f.getTotalCodewordsCount($,L),A=(K-q)*8;for(T.getLengthInBits()+4<=A&&T.put(0,4);T.getLengthInBits()%8!==0;)T.putBit(0);const O=(A-T.getLengthInBits())/8;for(let G=0;G<O;G++)T.put(G%2?17:236,8);return H(T,$,L)}function H($,L,U){const T=e.getSymbolTotalCodewords(L),K=f.getTotalCodewordsCount(L,U),q=T-K,A=f.getBlocksCount(L,U),O=T%A,G=A-O,Z=Math.floor(T/A),ie=Math.floor(q/A),Q=ie+1,x=Z-ie,X=new m(x);let re=0;const R=new Array(A),E=new Array(A);let ee=0;const M=new Uint8Array($.buffer);for(let pe=0;pe<A;pe++){const Ne=pe<G?ie:Q;R[pe]=M.slice(re,re+Ne),E[pe]=X.encode(R[pe]),re+=Ne,ee=Math.max(ee,Ne)}const j=new Uint8Array(T);let se=0,ce,oe;for(ce=0;ce<ee;ce++)for(oe=0;oe<A;oe++)ce<R[oe].length&&(j[se++]=R[oe][ce]);for(ce=0;ce<x;ce++)for(oe=0;oe<A;oe++)j[se++]=E[oe][ce];return j}function Y($,L,U,T){let K;if(Array.isArray($))K=S.fromArray($);else if(typeof $=="string"){let Z=L;if(!Z){const ie=S.rawSplit($);Z=p.getBestVersionForData(ie,U)}K=S.fromString($,Z||40)}else throw new Error("Invalid data");const q=p.getBestVersionForData(K,U);if(!q)throw new Error("The amount of data is too big to be stored in a QR Code");if(!L)L=q;else if(L<q)throw new Error(`
|
|
85
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
86
|
+
Minimum version required to store current data is: `+q+`.
|
|
87
|
+
`);const A=B(L,U,K),O=e.getSymbolSize(L),G=new n(O);return v(G,L),C(G),N(G,L),P(G,U,0),L>=7&&k(G,L),F(G,A),isNaN(T)&&(T=u.getBestMask(G,P.bind(null,G,U))),u.applyMask(T,G),P(G,U,T),{modules:G,version:L,errorCorrectionLevel:U,maskPattern:T,segments:K}}return qc.create=function(L,U){if(typeof L>"u"||L==="")throw new Error("No input text");let T=t.M,K,q;return typeof U<"u"&&(T=t.from(U.errorCorrectionLevel,t.M),K=p.from(U.version),q=u.from(U.maskPattern),U.toSJISFunc&&e.setToSJISFunction(U.toSJISFunc)),Y(L,K,T,q)},qc}var hu={},du={},n_;function Og(){return n_||(n_=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,u=n.scale||4;return{width:l,scale:l?4:u,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 u=a.modules.size,f=a.modules.data,m=e.getScale(u,l),p=Math.floor((u+l.margin*2)*m),y=l.margin*m,g=[l.color.light,l.color.dark];for(let S=0;S<p;S++)for(let v=0;v<p;v++){let C=(S*p+v)*4,N=l.color.light;if(S>=y&&v>=y&&S<p-y&&v<p-y){const k=Math.floor((S-y)/m),P=Math.floor((v-y)/m);N=g[f[k*u+P]?1:0]}n[C++]=N.r,n[C++]=N.g,n[C++]=N.b,n[C]=N.a}}})(du)),du}var o_;function jC(){return o_||(o_=1,(function(e){const t=Og();function r(a,l,u){a.clearRect(0,0,l.width,l.height),l.style||(l.style={}),l.height=u,l.width=u,l.style.height=u+"px",l.style.width=u+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(l,u,f){let m=f,p=u;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),u||(p=n()),m=t.getOptions(m);const y=t.getImageWidth(l.modules.size,m),g=p.getContext("2d"),S=g.createImageData(y,y);return t.qrToImageData(S.data,l,m),r(g,p,y),g.putImageData(S,0,0),p},e.renderToDataURL=function(l,u,f){let m=f;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),m||(m={});const p=e.render(l,u,m),y=m.type||"image/png",g=m.rendererOpts||{};return p.toDataURL(y,g.quality)}})(hu)),hu}var fu={},a_;function AC(){if(a_)return fu;a_=1;const e=Og();function t(a,l){const u=a.a/255,f=l+'="'+a.hex+'"';return u<1?f+" "+l+'-opacity="'+u.toFixed(2).slice(1)+'"':f}function r(a,l,u){let f=a+l;return typeof u<"u"&&(f+=" "+u),f}function n(a,l,u){let f="",m=0,p=!1,y=0;for(let g=0;g<a.length;g++){const S=Math.floor(g%l),v=Math.floor(g/l);!S&&!p&&(p=!0),a[g]?(y++,g>0&&S>0&&a[g-1]||(f+=p?r("M",S+u,.5+v+u):r("m",m,0),m=0,p=!1),S+1<l&&a[g+1]||(f+=r("h",y),y=0)):m++}return f}return fu.render=function(l,u,f){const m=e.getOptions(u),p=l.modules.size,y=l.modules.data,g=p+m.margin*2,S=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(y,p,m.margin)+'"/>',C='viewBox="0 0 '+g+" "+g+'"',k='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+C+' shape-rendering="crispEdges">'+S+v+`</svg>
|
|
88
|
+
`;return typeof f=="function"&&f(null,k),k},fu}var l_;function IC(){if(l_)return Es;l_=1;const e=gC(),t=BC(),r=jC(),n=AC();function a(l,u,f,m,p){const y=[].slice.call(arguments,1),g=y.length,S=typeof y[g-1]=="function";if(!S&&!e())throw new Error("Callback required as last argument");if(S){if(g<2)throw new Error("Too few arguments provided");g===2?(p=f,f=u,u=m=void 0):g===3&&(u.getContext&&typeof p>"u"?(p=m,m=void 0):(p=m,m=f,f=u,u=void 0))}else{if(g<1)throw new Error("Too few arguments provided");return g===1?(f=u,u=m=void 0):g===2&&!u.getContext&&(m=f,f=u,u=void 0),new Promise(function(v,C){try{const N=t.create(f,m);v(l(N,u,m))}catch(N){C(N)}})}try{const v=t.create(f,m);p(null,l(v,u,m))}catch(v){p(v)}}return Es.create=t.create,Es.toCanvas=a.bind(null,r.render),Es.toDataURL=a.bind(null,r.renderToDataURL),Es.toString=a.bind(null,function(l,u,f){return n.render(l,f)}),Es}var OC=IC();const zC=ch(OC),FC="modulepreload",HC=function(e){return"/"+e},c_={},$C=function(t,r,n){let a=Promise.resolve();if(r&&r.length>0){let u=function(p){return Promise.all(p.map(y=>Promise.resolve(y).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=u(r.map(p=>{if(p=HC(p),p in c_)return;c_[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const S=document.createElement("link");if(S.rel=y?"stylesheet":FC,y||(S.as="script"),S.crossOrigin="",S.href=p,m&&S.setAttribute("nonce",m),document.head.appendChild(S),y)return new Promise((v,C)=>{S.addEventListener("load",v),S.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return a.then(u=>{for(const f of u||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})};class Le{constructor(t,r,n,a,l){this._legacyCanvasSize=Le.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 u=!1;if(t.hidden&&(t.hidden=!1,u=!0),document.body.contains(t)||(document.body.appendChild(t),u=!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"),u=!0),f.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),u=!0),u&&(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=Le.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 Le.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"),Le._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"),Le._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(),Le._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?Le._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&&(Le._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,u=!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,u=r.alsoTryWithoutScanRegion||!1,m=!0):console.warn(r||n||a||l||u?"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,y;[n,p]=await Promise.all([n||Le.createQrEngine(),Le._loadImage(t)]),[a,y]=Le._drawToCanvas(p,f,a,l);let g;if(n instanceof Worker){let S=n;r||Le._postWorkerMessageSync(S,"inversionMode","both"),g=await new Promise((v,C)=>{let N,k,P,F=-1;k=H=>{H.data.id===F&&(S.removeEventListener("message",k),S.removeEventListener("error",P),clearTimeout(N),H.data.data!==null?v({data:H.data.data,cornerPoints:Le._convertPoints(H.data.cornerPoints,f)}):C(Le.NO_QR_CODE_FOUND))},P=H=>{S.removeEventListener("message",k),S.removeEventListener("error",P),clearTimeout(N),C("Scanner error: "+(H?H.message||H:"Unknown Error"))},S.addEventListener("message",k),S.addEventListener("error",P),N=setTimeout(()=>P("timeout"),1e4);let B=y.getImageData(0,0,a.width,a.height);F=Le._postWorkerMessageSync(S,"decode",B,[B.data.buffer])})}else g=await Promise.race([new Promise((S,v)=>window.setTimeout(()=>v("Scanner error: timeout"),1e4)),(async()=>{try{var[S]=await n.detect(a);if(!S)throw Le.NO_QR_CODE_FOUND;return{data:S.rawValue,cornerPoints:Le._convertPoints(S.cornerPoints,f)}}catch(v){if(S=v.message||v,/not implemented|service unavailable/.test(S))return Le._disableBarcodeDetector=!0,Le.scanImage(t,{scanRegion:f,canvas:a,disallowCanvasResizing:l,alsoTryWithoutScanRegion:u});throw`Scanner error: ${S}`}})()]);return m?g:g.data}catch(p){if(!f||!u)throw p;let y=await Le.scanImage(t,{qrEngine:n,canvas:a,disallowCanvasResizing:l});return m?y:y.data}finally{r||Le._postWorkerMessage(n,"close")}}setGrayscaleWeights(t,r,n,a=!0){Le._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:r,blue:n,useIntegerApproximation:a})}setInversionMode(t){Le._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=()=>$C(()=>import("./qr-scanner-worker.min-D85Z9gVD.js"),[]).then(n=>n.createWorker()),!(!Le._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,u=t.offsetLeft,f=t.offsetTop,m=window.getComputedStyle(t),p=m.objectFit,y=r/n,g=a/l;switch(p){case"none":var S=r,v=n;break;case"fill":S=a,v=l;break;default:(p==="cover"?y>g:y<g)?(v=l,S=v*y):(S=a,v=S/y),p==="scale-down"&&(S=Math.min(S,r),v=Math.min(v,n))}var[C,N]=m.objectPosition.split(" ").map((P,F)=>{const B=parseFloat(P);return P.endsWith("%")?(F?l-v:a-S)*B/100:B});m=this._scanRegion.width||r,g=this._scanRegion.height||n,p=this._scanRegion.x||0;var k=this._scanRegion.y||0;y=this.$overlay.style,y.width=`${m/r*S}px`,y.height=`${g/n*v}px`,y.top=`${f+N+k/n*v}px`,n=/scaleX\(-1\)/.test(t.style.transform),y.left=`${u+(n?a-C-S:C)+(n?r-p-m:p)/r*S}px`,y.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 u of t)u.x=u.x*l+n,u.y=u.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 Le.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(a){if(!this._active)return;this._onDecodeError(a)}!Le._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=Le.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!==Le.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}),u=this._getFacingMode(l)||(a.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:l,facingMode:u}}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,u=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,u,f,m,0,0,n.width,n.height),[n,r]}static async _loadImage(t){if(t instanceof Image)return await Le._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 Le._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 Le._postWorkerMessageSync(await t,r,n,a)}static _postWorkerMessageSync(t,r,n,a){if(!(t instanceof Worker))return-1;let l=Le._workerMessageId++;return t.postMessage({id:l,type:r,data:n},a),l}}Le.DEFAULT_CANVAS_SIZE=400;Le.NO_QR_CODE_FOUND="No QR code found";Le._disableBarcodeDetector=!1;Le._workerMessageId=0;const zg=/^[a-z0-9-]{1,32}$/,WC=/^[A-Za-z0-9._-]{1,32}$/,UC=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/,KC=320;function qC(e){return typeof e=="string"&&zg.test(e)}const VC=64;function Mn(e){if(typeof e!="string")return!1;const t=e.trim();return t.length>0&&t.length<=VC&&!/[\x00-\x1f\x7f]/.test(t)}function kr(e){return String(e??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32).replace(/-+$/g,"")||"node"}function Fg(e){if(typeof e!="string"||!e||e.length>KC||e.startsWith("-")||/[\0-\x20\x7f]/.test(e))return!1;if(!e.includes("@"))return/^[A-Za-z0-9][A-Za-z0-9._:-]{0,254}$/.test(e);const t=e.indexOf("@");return t<=0||t!==e.lastIndexOf("@")?!1:WC.test(e.slice(0,t))&&UC.test(e.slice(t+1))}function u_(e){if(e===""||e===null||e===void 0)return null;const t=String(e).trim();if(!/^[0-9]{1,5}$/.test(t))return;const r=Number(t);return Number.isInteger(r)&&r>=1&&r<=65535?r:void 0}function YC({name:e,ssh:t,sshPort:r,remotePort:n}={}){const a=typeof e=="string"?e.trim():e,l=typeof t=="string"?t.trim():t;if(!qC(a))return{ok:!1,error:"err-node-name"};if(!Fg(l))return{ok:!1,error:"err-ssh"};const u=u_(r);if(u===void 0)return{ok:!1,error:"err-ssh-port"};const f=u_(n);if(f===void 0)return{ok:!1,error:"err-node-port"};const m={name:a,ssh:l};return u!==null&&(m.sshPort=u),f!==null&&(m.remotePort=f),{ok:!0,value:m}}function XC(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 GC(e,t){const r=!!(e&&e.status==="up");return{up:r,label:r?"tunnel-up":"tunnel-down",since:r?XC(e.since,t):null}}const QC=new Set(["v","instanceId","port","label","invite"]),JC=new Set(["v","instanceId","port","label","invite","name","ssh","sshPort"]);function ZC(e){const t=String(e).replace(/-/g,"+").replace(/_/g,"/"),r=t+"=".repeat((4-t.length%4)%4),n=typeof atob=="function"?atob(r):Buffer.from(r,"base64").toString("binary"),a=Uint8Array.from(n,l=>l.charCodeAt(0));return typeof TextDecoder<"u"?new TextDecoder().decode(a):Buffer.from(a).toString("utf8")}function rh(e){let t="";try{const u=new URL(String(e));t=new URLSearchParams(u.hash.replace(/^#/,"")).get("pair")||""}catch{return{ok:!1}}if(!t)return{ok:!1};let r;try{r=JSON.parse(ZC(t))}catch{return{ok:!1}}if(!r||typeof r!="object"||Array.isArray(r))return{ok:!1};const n=r.v===1?QC:r.v===2?JC:null;if(!n)return{ok:!1};for(const u of Object.keys(r))if(!n.has(u))return{ok:!1};if(!/^[a-f0-9]{16,64}$/.test(String(r.instanceId)))return{ok:!1};const a=Number(r.port);if(!Number.isInteger(a)||a<1||a>65535)return{ok:!1};if(typeof r.label!="string")return{ok:!1};if(typeof r.invite!="string"||!r.invite)return{ok:!1};const l={ok:!0,version:r.v,label:r.label,invite:r.invite,instanceId:r.instanceId,port:a};if(r.v===2){if(r.name!==void 0){if(typeof r.name!="string"||!zg.test(r.name))return{ok:!1};l.name=r.name}if(r.ssh!==void 0){if(!Fg(r.ssh))return{ok:!1};l.ssh=String(r.ssh).trim()}if(r.sshPort!==void 0){const u=Number(r.sshPort);if(!Number.isInteger(u)||u<1||u>65535)return{ok:!1};l.sshPort=u}}return l}function sh(e,t,r=new Set){if(!t||!t.ok)return e;const n={...e},a=(l,u)=>{u==null||u===""||r.has(l)||(n[l]=u)};return a("label",t.label),t.version===2&&(a("name",t.name||(t.ssh?kr(t.label):"")),a("ssh",t.ssh),t.sshPort!==void 0&&a("sshPort",String(t.sshPort))),n}function Dh(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&typeof Notification<"u"}function eb(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 tb(){if(!Dh())return"unsupported";if(Notification.permission==="denied")return"denied";try{return await(await navigator.serviceWorker.ready).pushManager.getSubscription()?"subscribed":"idle"}catch{return"idle"}}async function ib(e){if(!Dh())throw new Error("push-unsupported");if(await Notification.requestPermission()!=="granted")throw new Error("push-denied");const r=await yt("/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:eb(n)}),u=await yt("/api/push/subscribe",e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({subscription:l.toJSON()})});if(!u.ok){try{await l.unsubscribe()}catch{}const f=await u.json().catch(()=>({}));throw new Error(f.error||`HTTP ${u.status}`)}return!0}async function rb(e){if(!Dh())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 yt("/api/push/subscribe",e,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:n})})}catch{}return!0}const sb=()=>({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:[]}),h_=(e="")=>({id:"",cwd:"",engine:e,boot:!1,model:"",prompt:""}),Hg=e=>e==="claude"?"unsafe":"standard",Pa=(e,t)=>e.find(r=>r.client===t.client&&r.provider===t.provider&&(r.credentialProfile||"")===(t.credentialProfile||"")),nb=(e,t)=>{var r;return((r=Pa(e,t))==null?void 0:r.label)||`${t.client} · ${t.provider}`};function ob(e){var t,r,n,a,l,u,f,m,p,y,g,S,v,C;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)||Hg((u=e.managed)==null?void 0:u.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:((y=e.managed)==null?void 0:y.envKey)||"",providerId:((g=e.managed)==null?void 0:g.providerId)||"nexuscrew-custom",modelOptions:e.availableModels||((S=e.managedInfo)==null?void 0:S.models)||[],promptMode:e.promptMode||"send-keys",promptFlag:e.promptFlag||"",modelFlag:((v=e.model)==null?void 0:v.flag)||"",modelValue:((C=e.model)==null?void 0:C.value)||"",envRows:(e.envKeys||[]).map(N=>({key:N,value:"",configured:!0,remove:!1}))}}function ab(e,t,r=[]){if(e.kind==="managed"){const a={client:e.client,provider:e.provider,model:e.managedModel||"",permissionPolicy:e.permissionPolicy||Hg(e.client)};e.credentialProfile&&(a.credentialProfile=e.credentialProfile);const l=Pa(r,e);return l!=null&&l.credentialEnv&&(a.envKey=e.envKey),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||nb(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 lb({token:e,readonly:t,targets:r=[],startNewCell:n=!1,initialLocation:a=""}){const[l,u]=I.useState({engines:[],cells:[],managedCatalog:[]}),[f,m]=I.useState({available:!1,capabilities:[]}),[p,y]=I.useState(null),[g,S]=I.useState(null),[v,C]=I.useState(!1),[N,k]=I.useState(""),[P,F]=I.useState(""),[B,H]=I.useState(a),[Y,$]=I.useState(!1),[L,U]=I.useState(null),[T,K]=I.useState(null),q=I.useRef(!1),A=B?B.split("/"):[],O=I.useCallback(async()=>{try{const j=await Gr(e,A);m(j);try{const se=await R_(e,A);$(!!se.readonlyDefault)}catch{$(!1)}if(j.provider==="builtin"&&(j.capabilities||[]).includes("definitions")){const se=await dh(e,A),ce=new Map((j.engines||[]).map(oe=>[oe.id,oe]));se.engines=(se.engines||[]).map(oe=>{var pe;return{...oe,availableModels:((pe=ce.get(oe.id))==null?void 0:pe.models)||[]}}),u(se)}}catch(j){k(String(j.message||j))}},[e,B]);I.useEffect(()=>{O();const j=setInterval(O,5e3);return()=>clearInterval(j)},[O]);const G=new Set((f.cells||[]).filter(j=>j.active).map(j=>j.cell)),Z=f.provider==="builtin"&&(f.capabilities||[]).includes("edit");I.useEffect(()=>{!n||q.current||!Z||!l.engines.length||(q.current=!0,S({mode:"new",form:h_(l.engines[0].id)}))},[n,Z,l.engines]);const ie=async j=>{C(!0),k(""),F("");try{await j(),await O()}catch(se){k(String(se.message||se))}C(!1)},Q=()=>ie(async()=>{const j=p.mode==="new",se=ab(p.form,j,l.managedCatalog||[]);!j&&p.form.kind==="custom"&&!p.form.modelFlag&&(se.model=null),!j&&p.form.kind==="custom"&&p.form.promptMode!=="flag"&&(se.promptFlag=null);let ce;if(j)ce=await t0(e,se,A);else{const pe=p.original,Ne=new Set(p.form.envRows.filter(ye=>!ye.remove).map(ye=>ye.key)),ot=(pe.envKeys||[]).filter(ye=>!Ne.has(ye)),Ge=Object.fromEntries(p.form.envRows.filter(ye=>!ye.remove&&ye.key&&(!ye.configured||ye.value!=="")).map(ye=>[ye.key,ye.value]));ce=await i0(e,pe.id,se,p.form.kind==="custom"?{set:Ge,remove:ot}:void 0,A)}y(null),F(b("fleet-saved"));const oe=(ce==null?void 0:ce.activeCells)||[];if(oe.length&&window.confirm(b("fleet-restart-confirm").replace("{cells}",oe.join(", "))))for(const pe of oe)await aa(e,pe,A)}),x=()=>ie(async()=>{const j=g.mode==="new",se=g.form,ce={...j?{id:se.id}:{},cwd:se.cwd,engine:se.engine,boot:!!se.boot};j?(se.model&&(ce.model=se.model),se.prompt&&(ce.prompt=se.prompt)):(ce.model=se.model||null,ce.prompt=se.prompt||null);const oe=j?await s0(e,ce,A):await n0(e,g.original.id,ce,A),pe=j?se.id:g.original.id;S(null),F(b("fleet-saved")),!j&&(oe!=null&&oe.active)&&window.confirm(b("fleet-restart-confirm").replace("{cells}",pe))&&await aa(e,pe,A)}),X=t||Y,re=j=>U({...j,route:Array.isArray(j==null?void 0:j.route)?j.route:A}),R=async j=>{if(!L)return;const se=L.cell||L.id,ce=Array.isArray(L.route)?L.route:A;j.action==="up"?await hh(e,{cell:se,boot:!!j.boot,...j.engine?{engine:j.engine}:{},...j.model!==void 0?{model:j.model}:{},...j.permissionPolicy?{permissionPolicy:j.permissionPolicy}:{}},ce):await ma(e,{cell:se,boot:!!j.boot},ce)},E=(j,se)=>K({mode:"new",route:Array.isArray(se)?se:A,form:{tmuxSession:j.name,id:"",engine:"",cwd:"",boot:!1},err:""}),ee=()=>ie(async()=>{const j=T.form;if(!j.engine){K({...T,err:b("import-engine-required")});return}await o0(e,{tmuxSession:j.tmuxSession,id:j.id||void 0,engine:j.engine,cwd:j.cwd||void 0,boot:!!j.boot},j.route||A),K(null),F(b("fleet-saved"))}),M=h.jsxs("label",{className:"nc-field",children:[b("location"),h.jsxs("select",{value:B,onChange:j=>{H(j.target.value),y(null),S(null),k(""),F(""),$(!1),m({available:!1,capabilities:[]}),u({engines:[],cells:[],managedCatalog:[]})},children:[h.jsx("option",{value:"",children:b("local")}),r.map(j=>h.jsxs("option",{value:j.route.join("/"),disabled:j.status&&j.status!=="up",children:[j.label,j.status&&j.status!=="up"?` · ${b("node-offline")}`:""]},j.route.join("/")))]})]});return Z?h.jsxs("div",{className:"nc-set-tab nc-fleet-editor",children:[M,h.jsx(d_,{token:e,targets:r,readonly:t,onPower:re,onImport:E}),h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:b("fleet-engines")}),h.jsxs("button",{className:"nc-btn primary",disabled:X||v,onClick:()=>y({mode:"new",form:sb()}),children:["+ ",b("add")]})]}),l.engines.map(j=>{var se,ce;return h.jsxs("div",{className:"nc-fleet-item",children:[h.jsxs("span",{children:[h.jsx("b",{children:j.label}),h.jsx("small",{children:j.managed?`${j.id} · ${j.managed.client} / ${j.managed.provider} · ${(se=j.managedInfo)!=null&&se.configured?b("fleet-ready"):((ce=j.managedInfo)==null?void 0:ce.reason)||b("fleet-not-ready")}`:`${j.id} · ${j.command}`})]}),h.jsxs("span",{children:[h.jsx("button",{className:"nc-btn ghost",disabled:X||v,onClick:()=>y({mode:"edit",original:j,form:ob(j)}),children:b("edit")}),h.jsx("button",{className:"nc-btn danger",disabled:X||v,onClick:()=>ie(async()=>{window.confirm(b("fleet-remove-engine").replace("{id}",j.id))&&await r0(e,j.id,A)}),children:"×"})]})]},j.id)}),p&&h.jsx(cb,{state:p,setState:y,busy:v,onSave:Q,catalog:l.managedCatalog||[]}),h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:b("fleet-cells")}),h.jsxs("button",{className:"nc-btn primary",disabled:X||v||!l.engines.length,onClick:()=>{var j;return S({mode:"new",form:h_((j=l.engines[0])==null?void 0:j.id)})},children:["+ ",b("add")]})]}),l.cells.map(j=>{const se=G.has(j.id),ce=f.capabilities||[];return h.jsxs("div",{className:"nc-fleet-item",children:[h.jsxs("span",{children:[h.jsx("b",{children:j.id}),h.jsxs("small",{children:[j.engine," · ",j.cwd,se?` · ${b("service-active")}`:` · ${b("cell-off")}`]})]}),h.jsxs("span",{children:[se&&ce.includes("down")&&h.jsx("button",{className:"nc-btn ghost",disabled:X||v,onClick:()=>ie(()=>ma(e,{cell:j.id},A)),children:b("stop")}),!se&&ce.includes("up")&&h.jsx("button",{className:"nc-btn primary",disabled:X||v,onClick:()=>re({cell:j.id,id:j.id,engine:j.engine,model:j.model,models:j.models,permissionPolicies:j.permissionPolicies,active:!1,boot:j.boot}),children:b("start")}),se&&ce.includes("restart")&&h.jsx("button",{className:"nc-btn ghost",disabled:X||v,onClick:()=>ie(()=>aa(e,j.id,A)),children:b("restart")}),h.jsx("button",{className:"nc-btn ghost",disabled:X||v,onClick:()=>S({mode:"edit",original:j,form:{...j}}),children:b("edit")}),h.jsx("button",{className:"nc-btn danger",disabled:X||v,onClick:()=>ie(async()=>{window.confirm(b("fleet-remove-cell").replace("{id}",j.id))&&await b_(e,j.id,!0,A)}),children:"×"})]})]},j.id)}),g&&h.jsx(ub,{token:e,route:A,targets:r,location:B,setLocation:H,state:g,setState:S,engines:l.engines,busy:v,onSave:x}),P&&h.jsx("div",{className:"nc-set-note",children:P}),N&&h.jsx("div",{className:"nc-err",children:N}),T&&h.jsx(f_,{token:e,route:T.route||A,state:T,setState:K,busy:v,onSave:ee}),L&&h.jsx(_a,{cell:L,token:e,route:Array.isArray(L.route)?L.route:A,onConfirm:async j=>{try{await R(j)}finally{await O()}},onClose:()=>U(null)})]}):h.jsxs("div",{className:"nc-set-tab",children:[M,h.jsx(d_,{token:e,targets:r,readonly:t,onPower:re,onImport:E}),h.jsx("div",{className:"nc-set-info",children:b("fleet-editor-unavailable")}),N&&h.jsx("div",{className:"nc-err",children:N}),T&&h.jsx(f_,{token:e,route:T.route||A,state:T,setState:K,busy:v,onSave:ee}),L&&h.jsx(_a,{cell:L,token:e,route:Array.isArray(L.route)?L.route:A,onConfirm:async j=>{try{await R(j)}finally{await O()}},onClose:()=>U(null)})]})}function d_({token:e,targets:t=[],readonly:r=!1,onPower:n,onImport:a}){const[l,u]=I.useState([]),[f,m]=I.useState(0);I.useEffect(()=>{let k=!0;async function P(){const B=[{route:[],label:b("local")}].concat((t||[]).map(Y=>({route:Array.isArray(Y.route)?Y.route:[],label:Y.label||(Y.route||[]).join(" › ")}))),H=await Promise.all(B.map(async Y=>{const $={...Y,available:!1,readonly:!1,capabilities:[],provider:null,cells:[],unmanaged:[],err:""};try{const L=await Gr(e,Y.route);$.available=!!L.available,$.capabilities=L.capabilities||[],$.provider=L.provider||null,$.cells=(L.cells||[]).map(U=>({...U,route:Y.route}));try{$.readonly=!!(await R_(e,Y.route)).readonlyDefault}catch{}try{const U=await N_(e,Y.route),T=new Set($.cells.map(K=>K.tmuxSession).filter(Boolean));$.unmanaged=(U.sessions||[]).filter(K=>K&&!T.has(K.name))}catch{}}catch(L){$.err=String(L&&L.message||L)}return $}));k&&u(H)}P();const F=setInterval(P,6e3);return()=>{k=!1,clearInterval(F)}},[e,t,f]);const p=(k,P)=>Array.isArray(k.capabilities)&&k.capabilities.includes(P)&&!r&&!k.readonly,y=()=>m(k=>k+1),g=(k,P)=>{n&&n({...k,route:P})},S=(k,P)=>{n&&n({...k,route:P})},v=async(k,P)=>{try{await aa(e,k.cell,P)}catch{}y()},C=async(k,P)=>{if(window.confirm(b("fleet-remove-cell").replace("{id}",k.cell))){try{await b_(e,k.cell,!0,P)}catch{}y()}},N=async(k,P)=>{if(window.confirm(b("terminate-confirm").replace("{name}",k.name))){try{await fh(e,k.name,P)}catch{}y()}};return h.jsxs("div",{className:"nc-fleet-inventory",children:[h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:b("fleet-inventory")}),h.jsx("small",{children:b("fleet-inventory-help")})]}),l.map(k=>{const P=k.route.length?k.route.join("/"):"local";return h.jsxs("div",{className:"nc-fleet-pos",children:[h.jsxs("div",{className:"nc-fleet-pos-title",children:[h.jsx("span",{className:`dot ${k.available?"on":"warn"}`}),h.jsx("b",{children:k.label}),h.jsx("small",{children:k.available?`${k.cells.length} ${b("fleet-cells")} · ${k.unmanaged.length} ${b("fleet-tmux")}`:k.err||b("fleet-not-available")})]}),k.cells.map(F=>h.jsxs("div",{className:"nc-fleet-item nc-fleet-cell",children:[h.jsxs("span",{children:[h.jsx("b",{children:F.cell}),h.jsx("small",{children:`${F.engine||""}${F.key?`·${F.key}`:""}${F.active?"":` · ${b("cell-off")}`}`})]}),h.jsxs("span",{className:"nc-fleet-cell-actions",children:[F.active&&p(k,"down")&&h.jsx("button",{className:"nc-btn ghost",title:b("power-off"),onClick:()=>S(F,k.route),children:b("stop")}),!F.active&&p(k,"up")&&h.jsx("button",{className:"nc-btn ghost",title:b("power-on"),onClick:()=>g(F,k.route),children:b("start")}),p(k,"restart")&&F.active&&h.jsx("button",{className:"nc-btn ghost",title:b("restart"),onClick:()=>v(F,k.route),children:b("restart")}),p(k,"remove")&&h.jsx("button",{className:"nc-btn danger",title:b("delete"),onClick:()=>C(F,k.route),children:"×"})]})]},`${P}:${F.cell}`)),k.unmanaged.map(F=>h.jsxs("div",{className:"nc-fleet-item nc-fleet-unmanaged",children:[h.jsxs("span",{children:[h.jsx("b",{children:F.name}),h.jsx("small",{children:b("fleet-tmux")})]}),h.jsxs("span",{className:"nc-fleet-cell-actions",children:[p(k,"import")&&a&&h.jsx("button",{className:"nc-btn ghost",title:b("import-as-cell"),onClick:()=>a(F,k.route),children:b("import-as-cell")}),h.jsx("button",{className:"nc-btn danger",title:b("terminate"),onClick:()=>N(F,k.route),children:"×"})]})]},`${P}:u:${F.name}`)),k.available&&k.cells.length===0&&k.unmanaged.length===0&&h.jsx("div",{className:"nc-empty",children:b("fleet-inventory-empty")})]},P)})]})}function cb({state:e,setState:t,busy:r,onSave:n,catalog:a}){var S;const l=e.form,u=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),y=Pa(a,l),g=v=>{v&&u({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?b("fleet-custom-provider-default"):"",baseUrl:v.custom?"":v.endpoint||"",envKey:v.defaultEnvKey||"",providerId:"nexuscrew-custom",...e.mode==="new"?{id:v.id,label:""}:{}})};return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsx("b",{children:e.mode==="new"?b("fleet-new-engine"):`${b("edit")} ${l.id}`}),h.jsx("input",{value:l.id,disabled:e.mode!=="new",placeholder:"id",onChange:v=>u({id:v.target.value})}),h.jsx("input",{value:l.label,placeholder:b("label"),onChange:v=>u({label:v.target.value})}),h.jsxs("select",{value:l.kind,disabled:e.mode!=="new",onChange:v=>u({kind:v.target.value}),children:[h.jsx("option",{value:"managed",children:b("fleet-managed")}),h.jsx("option",{value:"custom",children:b("fleet-custom")})]}),l.kind==="managed"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("select",{value:l.client,disabled:e.mode!=="new",onChange:v=>g(a.find(C=>C.client===v.target.value&&C.default)||a.find(C=>C.client===v.target.value)),children:m.map(([v,C])=>h.jsx("option",{value:v,children:C},v))}),h.jsx("select",{value:((S=Pa(a,l))==null?void 0:S.id)||"",disabled:e.mode!=="new",onChange:v=>g(a.find(C=>C.id===v.target.value)),children:p.map(v=>h.jsx("option",{value:v.id,children:v.label},v.id))})]}),h.jsx("input",{value:l.managedModel,list:"nc-managed-models",placeholder:b(y!=null&&y.requiresModel?"fleet-model-required":"fleet-model-default"),onChange:v=>u({managedModel:v.target.value})}),h.jsx("datalist",{id:"nc-managed-models",children:[...(y==null?void 0:y.models)||[],...l.modelOptions||[]].filter((v,C,N)=>v&&N.indexOf(v)===C).map(v=>h.jsx("option",{value:v},v))}),y!=null&&y.supportsUnsafe?h.jsxs("select",{value:l.permissionPolicy,onChange:v=>u({permissionPolicy:v.target.value}),children:[h.jsx("option",{value:"standard",children:b("fleet-standard-permissions")}),h.jsx("option",{value:"unsafe",children:b("fleet-unsafe-permissions")})]}):h.jsx("small",{children:b("fleet-standard-permissions")}),(y==null?void 0:y.supportsUnsafe)&&l.permissionPolicy==="unsafe"&&h.jsx("small",{className:"nc-err",children:b("fleet-unsafe-warning")}),(y==null?void 0:y.credentialEnv)&&h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.envKey,placeholder:b("fleet-api-key-env"),onChange:v=>u({envKey:v.target.value})}),h.jsx("small",{children:b("fleet-custom-secret-help")})]}),l.provider==="custom"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.displayName,placeholder:b("fleet-provider-display"),onChange:v=>u({displayName:v.target.value})}),h.jsx("input",{value:l.baseUrl,placeholder:"https://api.example.com/v1",onChange:v=>u({baseUrl:v.target.value})}),((y==null?void 0:y.protocols)||[]).length>1&&h.jsx("select",{value:l.protocol,onChange:v=>u({protocol:v.target.value}),children:y.protocols.map(v=>h.jsx("option",{value:v,children:v},v))}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:l.envKey,placeholder:b("fleet-api-key-env"),onChange:v=>u({envKey:v.target.value})}),h.jsx("input",{value:l.providerId,placeholder:b("fleet-provider-id"),onChange:v=>u({providerId:v.target.value})})]}),h.jsxs("small",{children:[l.protocol," · ",b("fleet-custom-secret-help")]})]}),h.jsx("small",{children:b("fleet-managed-help")})]}):h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.command,placeholder:b("command-path"),onChange:v=>u({command:v.target.value})}),h.jsx("textarea",{value:l.argsText,placeholder:b("args-lines"),onChange:v=>u({argsText:v.target.value})}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:l.rc,onChange:v=>u({rc:v.target.checked})})," remote control"]}),h.jsxs("select",{value:l.promptMode,onChange:v=>u({promptMode:v.target.value}),children:[h.jsx("option",{value:"send-keys",children:"send-keys"}),h.jsx("option",{value:"flag",children:"flag"})]}),l.promptMode==="flag"&&h.jsx("input",{value:l.promptFlag,placeholder:"prompt flag",onChange:v=>u({promptFlag:v.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:l.modelFlag,placeholder:"model flag",onChange:v=>u({modelFlag:v.target.value})}),h.jsx("input",{value:l.modelValue,placeholder:"model default",onChange:v=>u({modelValue:v.target.value})})]}),h.jsx("small",{children:b("env-write-only")}),f.map((v,C)=>h.jsxs("div",{className:"nc-fleet-env",children:[h.jsx("input",{value:v.key,disabled:v.configured,placeholder:"ENV_KEY",onChange:N=>{const k=f.slice();k[C]={...v,key:N.target.value},u({envRows:k})}}),h.jsx("input",{type:"password",value:v.value,placeholder:v.configured?"•••••• (unchanged)":"value",onChange:N=>{const k=f.slice();k[C]={...v,value:N.target.value},u({envRows:k})}}),h.jsx("button",{className:"nc-btn danger",onClick:()=>u({envRows:f.filter((N,k)=>k!==C)}),children:"×"})]},`${v.key}-${C}`)),h.jsx("button",{className:"nc-btn ghost",onClick:()=>u({envRows:[...f,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:b("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:r||!l.id||l.kind==="custom"&&!l.command||l.kind==="managed"&&(y==null?void 0:y.requiresModel)&&!l.managedModel||l.kind==="managed"&&(y==null?void 0:y.credentialEnv)&&!l.envKey||l.kind==="managed"&&l.provider==="custom"&&(!l.displayName||!l.baseUrl||!l.envKey||!l.providerId),onClick:n,children:b("save")})]})]})}function ub({token:e,route:t,targets:r=[],location:n,setLocation:a,state:l,setState:u,engines:f,busy:m,onSave:p}){const[y,g]=I.useState(null),[S,v]=I.useState(""),C=l.form,N=B=>u({...l,form:{...C,...B}}),k=f.find(B=>B.id===C.engine),P=B=>{var Y,$,L;const H=f.find(U=>U.id===B);N({engine:B,model:((Y=C.models)==null?void 0:Y[B])||(($=H==null?void 0:H.managed)==null?void 0:$.model)||((L=H==null?void 0:H.model)==null?void 0:L.value)||""})},F=async B=>{try{const H=await x_(e,B,t);g(H),N({cwd:H.path}),v("")}catch(H){v(String(H.message||H))}};return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsx("b",{children:l.mode==="new"?b("fleet-new-cell"):`${b("edit")} ${C.id}`}),l.mode==="new"&&h.jsxs("label",{className:"nc-field",children:[b("location"),h.jsx("span",{className:"nc-req",children:" *"}),h.jsxs("select",{value:n,onChange:B=>{a(B.target.value),N({engine:""})},children:[h.jsx("option",{value:"",children:b("local")}),r.map(B=>h.jsxs("option",{value:B.route.join("/"),disabled:B.status&&B.status!=="up",children:[B.label,B.status&&B.status!=="up"?` · ${b("node-offline")}`:""]},B.route.join("/")))]})]}),h.jsx("input",{value:C.id,disabled:l.mode!=="new",placeholder:"id",onChange:B=>N({id:B.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:C.cwd,placeholder:b("cwd"),onChange:B=>N({cwd:B.target.value})}),h.jsx("button",{className:"nc-btn ghost",onClick:()=>y?g(null):F(C.cwd),children:b("browse")})]}),y&&h.jsxs("div",{className:"nc-fs",children:[h.jsx("div",{className:"nc-fs-path",children:y.path}),h.jsxs("div",{className:"nc-fs-list",children:[y.parent&&h.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>F(y.parent),children:["↑ ",b("fs-parent")]}),(y.dirs||[]).map(B=>h.jsxs("button",{className:"nc-fs-item",onClick:()=>F(`${y.path.replace(/\/$/,"")}/${B}`),children:["📁 ",B]},B))]})]}),S&&h.jsx("div",{className:"nc-err",children:S}),h.jsx("select",{value:C.engine,onChange:B=>P(B.target.value),children:f.map(B=>h.jsx("option",{value:B.id,children:B.label},B.id))}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!C.boot,onChange:B=>N({boot:B.target.checked})})," boot"]}),h.jsx("input",{value:C.model||"",list:"nc-cell-models",placeholder:b("fleet-model-override"),onChange:B=>N({model:B.target.value})}),h.jsx("datalist",{id:"nc-cell-models",children:((k==null?void 0:k.availableModels)||[]).map(B=>h.jsx("option",{value:B},B))}),h.jsx("textarea",{value:C.prompt||"",placeholder:"prompt",onChange:B=>N({prompt:B.target.value})}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>u(null),children:b("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:m||!C.id||!C.cwd||!C.engine,onClick:p,children:b("save")})]})]})}function f_({token:e,route:t=[],state:r,setState:n,busy:a,onSave:l}){const[u,f]=I.useState(null),[m,p]=I.useState([]),[y,g]=I.useState(""),S=Array.isArray(t)?t.join("/"):"";I.useEffect(()=>{let P=!0;return dh(e,S?S.split("/"):[]).then(F=>{P&&(p(F.engines||[]),g(""))}).catch(F=>{P&&(p([]),g(String(F.message||F)))}),()=>{P=!1}},[e,S]);const v=r.form,C=P=>n({...r,form:{...v,...P}}),N=async P=>{try{const F=await x_(e,P,t);f(F),C({cwd:F.path})}catch{}},k=!v.id&&v.tmuxSession?v.tmuxSession.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32):v.id;return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsxs("b",{children:[b("import-as-cell")," · ",v.tmuxSession]}),h.jsx("small",{children:b("import-help")}),h.jsx("input",{value:v.tmuxSession,disabled:!0,placeholder:"tmux session",readOnly:!0}),h.jsx("input",{value:v.id,placeholder:b("name"),onChange:P=>C({id:P.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:v.cwd,placeholder:b("cwd"),onChange:P=>C({cwd:P.target.value})}),h.jsx("button",{className:"nc-btn ghost",type:"button",onClick:()=>u?f(null):N(v.cwd),children:b("browse")})]}),u&&h.jsxs("div",{className:"nc-fs",children:[h.jsx("div",{className:"nc-fs-path",children:u.path}),h.jsxs("div",{className:"nc-fs-list",children:[u.parent&&h.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>N(u.parent),children:["↑ ",b("fs-parent")]}),(u.dirs||[]).map(P=>h.jsxs("button",{className:"nc-fs-item",onClick:()=>N(`${u.path.replace(/\/$/,"")}/${P}`),children:["📁 ",P]},P))]})]}),h.jsxs("select",{value:v.engine,onChange:P=>C({engine:P.target.value}),children:[h.jsx("option",{value:"",children:b("import-engine-required")}),m.map(P=>h.jsx("option",{value:P.id,children:P.label},P.id))]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!v.boot,onChange:P=>C({boot:P.target.checked})})," boot"]}),(r.err||y)&&h.jsx("div",{className:"nc-err",children:r.err||y}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>n(null),children:b("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:a||!v.tmuxSession||!v.engine||!m.length,onClick:l,children:b(k?"import-as-cell":"save")})]})]})}function hb({text:e}){const[t,r]=I.useState(!1),n=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return h.jsxs("div",{className:"nc-set-copyline",children:[h.jsx("code",{children:e}),h.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:n,children:[h.jsx(Ie,{name:"copy",size:14})," ",b(t?"copied":"copy")]})]})}function db({value:e}){const[t,r]=I.useState("");return I.useEffect(()=>{let n=!0;return zC.toDataURL(e,{margin:1,width:220}).then(a=>{n&&r(a)}).catch(()=>{}),()=>{n=!1}},[e]),t?h.jsx("img",{src:t,width:"220",height:"220",alt:"NexusCrew pairing QR"}):null}function fb({token:e,nodes:t,settings:r,readonly:n,refresh:a}){const[l,u]=I.useState(null),[f,m]=I.useState(null),[p,y]=I.useState({}),[g,S]=I.useState({name:"",label:"",ssh:"",sshPort:"",pairingUrl:"",localLabel:""}),[v,C]=I.useState(null),N=I.useRef(null),k=I.useRef(null),P=I.useRef(null),F=I.useRef(new Set),[B,H]=I.useState(!1),[Y,$]=I.useState(null),[L,U]=I.useState({ssh:"",sshPort:"",name:""}),[T,K]=I.useState(""),q=Date.now(),A=r&&r.deviceName||"",O=async(E,ee)=>{u(null),m(`${E}:${ee}`);try{const M=await ph(e,E,ee);ee==="test"&&y(j=>({...j,[E]:M})),await a()}catch(M){u(`${E}: ${String(M.message||M)}`)}m(null)},G=async E=>{if(window.confirm(b("node-remove-confirm").replace("{name}",E))){u(null),m(`${E}:remove`);try{await d0(e,E),await a()}catch(ee){u(`${E}: ${String(ee.message||ee)}`)}m(null)}},Z=E=>{F.current.add("label"),S(ee=>({...ee,label:E,name:B?ee.name:kr(E)}))},ie=E=>{F.current.add("name"),H(!0),S(ee=>({...ee,name:E?kr(E):""}))},Q=E=>{F.current.add("ssh"),S(ee=>({...ee,ssh:E}))},x=E=>{F.current.add("sshPort"),S(ee=>({...ee,sshPort:E}))},X=E=>{S(M=>({...M,pairingUrl:E}));const ee=rh(E);ee.ok&&S(M=>{const j=sh(M,ee,F.current);return ee.version===2&&ee.name&&!F.current.has("name")&&!B&&(j.name=ee.name),!F.current.has("label")&&!j.label&&ee.label&&(j.label=ee.label),j})},re=async()=>{C(null);const E=g.name?g.ssh?g.pairingUrl?null:P:k:N;if(E){C(b("pairing-required")),requestAnimationFrame(()=>{var ee,M;(ee=E.current)==null||ee.focus({preventScroll:!0}),(M=E.current)==null||M.scrollIntoView({block:"center",behavior:"smooth"})});return}if(g.label&&!Mn(g.label)||g.localLabel&&!Mn(g.localLabel))return C(b("err-label"));m("add");try{const ee={name:g.name,ssh:g.ssh,pairingUrl:g.pairingUrl,...g.label?{label:g.label}:{},...g.sshPort?{sshPort:Number(g.sshPort)}:{},localLabel:g.localLabel||A};await P_(e,ee),S({name:"",label:"",ssh:"",sshPort:"",pairingUrl:"",localLabel:""}),F.current=new Set,C(null),H(!1),await a()}catch(ee){C(String(ee.message||ee))}m(null)},R=async()=>{u(null);const E=kr(L.name||T||A||"NexusCrew"),ee=YC({name:E,ssh:L.ssh,sshPort:L.sshPort});if(!ee.ok){u(b(ee.error));return}m("invite");try{$(await u0(e,{...T||A?{label:T||A}:{},name:E,ssh:ee.value.ssh,...ee.value.sshPort?{sshPort:ee.value.sshPort}:{}}))}catch(M){u(String(M.message||M))}m(null)};return h.jsxs("div",{className:"nc-set-tab",children:[(t||[]).length===0&&h.jsx("div",{className:"nc-empty",children:b("no-nodes")}),(t||[]).map(E=>{var j,se,ce,oe;const ee=GC(E.tunnel,q),M=p[E.name];return h.jsxs("div",{className:"nc-set-node",children:[h.jsxs("div",{className:"nc-set-node-head",children:[h.jsx("span",{className:`nc-dot ${ee.up?"on":""}`}),h.jsx("b",{children:E.label||E.name}),h.jsxs("small",{children:[E.name," · ",E.ssh,E.sshPort?`:${E.sshPort}`:""," · :",E.localPort,"→:",E.remotePort]}),h.jsxs("span",{className:`nc-set-tunnel${ee.up?" up":""}`,children:[b(ee.label),ee.since?` · ${ee.since}`:""]}),h.jsxs("select",{value:E.visibility||"network",disabled:n||!!f,onChange:async pe=>{m(`${E.name}:visibility`);try{await Ep(e,E.name,pe.target.value),await a()}catch(Ne){u(String(Ne.message||Ne))}m(null)},children:[h.jsx("option",{value:"network",children:b("visibility-network")}),h.jsx("option",{value:"relay-only",children:b("visibility-relay")}),h.jsx("option",{value:"selected",children:b("visibility-selected")})]})]}),E.visibility==="selected"&&h.jsx("div",{className:"nc-set-row",children:(t||[]).filter(pe=>pe.name!==E.name&&pe.nodeId).map(pe=>{const Ne=(E.selected||[]).includes(pe.nodeId);return h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:Ne,disabled:n||!!f,onChange:async ot=>{const Ge=ot.target.checked?[...E.selected||[],pe.nodeId]:(E.selected||[]).filter(ye=>ye!==pe.nodeId);m(`${E.name}:visibility`);try{await Ep(e,E.name,"selected",Ge),await a()}catch(ye){u(String(ye.message||ye))}m(null)}})," ",pe.name]},pe.nodeId)})}),h.jsxs("div",{className:"nc-set-node-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||!!f,onClick:async()=>{const pe=window.prompt(b("node-display-label"),E.label||E.name);if(pe!=null){if(!Mn(pe)){u(b("err-label"));return}m(`${E.name}:label`);try{await h0(e,E.name,pe),await a()}catch(Ne){u(String(Ne.message||Ne))}m(null)}},children:b("edit")}),((j=E.health)==null?void 0:j.managed)!==!1&&h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!f,onClick:()=>O(E.name,"test"),children:b("node-test")}),((se=E.health)==null?void 0:se.managed)!==!1&&(ee.up?h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!f,onClick:()=>O(E.name,"down"),children:b("tunnel-stop")}):h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!f,onClick:()=>O(E.name,"up"),children:b("tunnel-start")})),((ce=E.health)==null?void 0:ce.managed)!==!1&&h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!f,onClick:()=>O(E.name,"restart"),children:b("tunnel-restart")}),h.jsx("button",{type:"button",className:"nc-btn danger",disabled:n||!!f,title:b(n?"settings-readonly":"terminate"),onClick:()=>G(E.name),children:h.jsx(Ie,{name:"trash",size:14})})]}),((oe=E.health)==null?void 0:oe.detail)&&h.jsx("div",{className:`nc-set-test${E.health.status==="healthy"?" ok":" ko"}`,children:E.health.detail}),M&&h.jsxs("div",{className:`nc-set-test${M.ok?" ok":" ko"}`,children:[M.result,M.detail?` — ${M.detail}`:""]})]},E.name)}),h.jsxs("div",{className:"nc-set-form",children:[h.jsx("div",{className:"nc-sheet-label",children:b("node-add")}),h.jsx("div",{className:"nc-set-info",children:b("pairing-connect-help")}),h.jsxs("label",{className:"nc-field",children:[b("node-display-label"),h.jsx("input",{placeholder:"Home Relay",value:g.label,disabled:n,onChange:E=>Z(E.target.value)})]}),h.jsxs("label",{className:"nc-field",children:[b("node-name-label"),h.jsx("input",{ref:N,required:!0,placeholder:b("node-name-ph"),value:g.name,disabled:n,onChange:E=>ie(E.target.value)})]}),h.jsx("small",{className:"nc-set-hint",children:b("node-slug-hint").replace("{slug}",g.name||"home-relay")}),h.jsxs("label",{className:"nc-field",children:[b("node-ssh-label"),h.jsx("input",{ref:k,required:!0,placeholder:"my-relay",value:g.ssh,disabled:n,onChange:E=>Q(E.target.value)})]}),h.jsxs("label",{className:"nc-field",children:[b("node-ssh-port-label"),h.jsx("input",{inputMode:"numeric",placeholder:b("node-ssh-port-help"),value:g.sshPort,disabled:n,onChange:E=>x(E.target.value.replace(/[^0-9]/g,"").slice(0,5))})]}),h.jsxs("label",{className:"nc-field",children:[b("device-name-label"),h.jsx("input",{placeholder:A||"NexusCrew",value:g.localLabel,disabled:n,onChange:E=>S({...g,localLabel:E.target.value})}),h.jsx("small",{className:"nc-set-hint",children:b("device-name-hint")})]}),h.jsxs("label",{className:"nc-field",children:[b("pairing-link"),h.jsx("input",{ref:P,required:!0,placeholder:"http://127.0.0.1:…/#pair=…",value:g.pairingUrl,disabled:n,onChange:E=>X(E.target.value)}),h.jsx("small",{className:"nc-set-hint",children:b("pairing-v2-hint")}),h.jsx("input",{id:"nc-pair-scan",type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:async E=>{const ee=E.target.files&&E.target.files[0];if(ee){try{const M=await Le.scanImage(ee);X(M)}catch{u(b("pairing-qr-invalid"))}E.target.value=""}}}),h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{var E;return(E=document.getElementById("nc-pair-scan"))==null?void 0:E.click()},children:b("scan-qr")})]}),v&&h.jsx("div",{className:"nc-err",role:"alert",children:v}),h.jsx("div",{className:"nc-sheet-actions",children:h.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||f==="add",title:n?b("settings-readonly"):"",onClick:re,children:b("test-and-connect")})})]}),h.jsxs("div",{className:"nc-set-form",children:[h.jsx("div",{className:"nc-sheet-label",children:b("invite-node")}),h.jsx("small",{className:"nc-set-hint",children:b("invite-v2-hint")}),h.jsxs("label",{className:"nc-field",children:[b("device-name-label"),h.jsx("input",{placeholder:A||"NexusCrew",value:T,disabled:n,onChange:E=>K(E.target.value)}),h.jsx("small",{className:"nc-set-hint",children:b("device-name-hint")})]}),h.jsxs("label",{className:"nc-field",children:[b("node-ssh-label"),h.jsx("input",{placeholder:"user@host o alias",value:L.ssh,disabled:n,onChange:E=>U({...L,ssh:E.target.value})}),h.jsx("small",{className:"nc-set-hint",children:b("invite-ssh-hint")})]}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsxs("label",{className:"nc-field",children:[b("node-ssh-port-label"),h.jsx("input",{inputMode:"numeric",placeholder:b("node-ssh-port-help"),value:L.sshPort,disabled:n,onChange:E=>U({...L,sshPort:E.target.value.replace(/[^0-9]/g,"").slice(0,5)})})]}),h.jsxs("label",{className:"nc-field",children:[b("node-name-label"),h.jsx("input",{placeholder:kr(T||A||b("node-name-ph")),value:L.name,disabled:n,onChange:E=>U({...L,name:E.target.value?kr(E.target.value):""})})]})]}),h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||!!f||!L.ssh.trim(),onClick:R,children:b("create-pairing-link")}),Y&&h.jsxs(h.Fragment,{children:[h.jsx(db,{value:Y.pairingUrl}),h.jsx(hb,{text:Y.pairingUrl})]})]}),l&&h.jsx("div",{className:"nc-err",children:l})]})}function pb({token:e,readonly:t}){const[r,n]=I.useState("idle"),[a,l]=I.useState(!1),[u,f]=I.useState(null);I.useEffect(()=>{let p=!1;return tb().then(y=>{p||n(y)}),()=>{p=!0}},[]);const m=async()=>{f(null),l(!0);try{r==="subscribed"?(await rb(e),n("idle")):(await ib(e),n("subscribed"))}catch(p){const y=String(p.message||p);y==="push-denied"?(n("denied"),f(b("push-denied"))):y==="push-unsupported"?(n("unsupported"),f(b("push-unsupported"))):f(y)}l(!1)};return r==="unsupported"?h.jsx("div",{className:"nc-set-info",children:b("push-unsupported")}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||a||r==="denied",title:t?b("settings-readonly"):"",onClick:m,children:b(r==="subscribed"?"push-disable":"push-enable")}),h.jsx("span",{className:"nc-set-info",children:b(r==="subscribed"?"push-on":r==="denied"?"push-denied":"push-off")})]}),u&&h.jsx("div",{className:"nc-err",children:u})]})}function mb({token:e,settings:t,readonly:r}){const[n,a]=I.useState(null),[l,u]=I.useState(null),[f,m]=I.useState(!1),[p,y]=I.useState(!1),g=async()=>{a(null),u(null),y(!0);try{const C=await c0(e);u(C.note||"ok"),m(!1)}catch(C){a(String(C.message||C))}y(!1)},S=async()=>{a(null),u(null),y(!0);try{const C=await f0(e);u(`${C.note||"ok"}${C.target?` (${C.target})`:""}`)}catch(C){a(String(C.message||C))}y(!1)},v=t&&t.service;return h.jsxs("div",{className:"nc-set-tab",children:[t&&h.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,h.jsx("br",{}),v&&v.installed?b("service-installed"):b("service-missing"),v&&v.installed?` · ${v.active?b("service-active"):b("service-inactive")}`:"",v?` · boot ${v.boot?"on":"off"}`:""]}),h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||p,title:r?b("settings-readonly"):"",onClick:()=>{a(null),u(null),m(!0)},children:b("token-rotate")}),h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||p,title:r?b("settings-readonly"):"",onClick:S,children:b("service-regenerate")})]}),h.jsx(pb,{token:e,readonly:r}),f&&h.jsxs("div",{className:"nc-set-confirm",children:[h.jsx("div",{children:b("token-rotate-explain")}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:p,onClick:()=>m(!1),children:b("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:p,onClick:g,children:b("confirm")})]})]}),l&&h.jsx("div",{className:"nc-set-note",children:l}),n&&h.jsx("div",{className:"nc-err",children:n})]})}function _b({token:e,onClose:t,initialTab:r="nodes",initialLocation:n="",startNewCell:a=!1}){ei();const[l,u]=I.useState(r),[f,m]=I.useState(null),[p,y]=I.useState([]),[g,S]=I.useState(!1),[v,C]=I.useState(null),N=_h(e),k=I.useCallback(async()=>{try{const P=await k_(e);m(P),C(null)}catch(P){C(String(P.message||P))}try{const P=await E_(e);y(P.nodes||[])}catch(P){C(String(P.message||P))}},[e]);return I.useEffect(()=>{k();const P=setInterval(k,5e3);return()=>clearInterval(P)},[k]),I.useEffect(()=>{let P=!1;return yt("/api/config",e).then(F=>F.json()).then(F=>{P||S(!!F.readonlyDefault)}).catch(()=>{}),()=>{P=!0}},[e]),h.jsx("div",{className:"nc-set-overlay",onClick:t,children:h.jsxs("div",{className:"nc-set-panel",onClick:P=>P.stopPropagation(),children:[h.jsxs("div",{className:"nc-set-head",children:[h.jsx(Ie,{name:"gear",size:18}),h.jsx("b",{children:b("settings")}),h.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:b("close"),children:h.jsx(Ie,{name:"x",size:18})})]}),g&&h.jsx("div",{className:"nc-set-readonly",children:b("settings-readonly")}),v&&h.jsx("div",{className:"nc-err",children:v}),h.jsx("div",{className:"nc-set-tabs",children:["nodes","fleet","system"].map(P=>h.jsx("button",{type:"button",className:`nc-set-tabbtn${l===P?" on":""}`,onClick:()=>u(P),children:b(`tab-${P}`)},P))}),h.jsxs("div",{className:"nc-set-body",children:[l==="nodes"&&h.jsx(fb,{token:e,nodes:p,settings:f,readonly:g,refresh:k}),l==="fleet"&&h.jsx(lb,{token:e,readonly:g,startNewCell:a,initialLocation:n,targets:N.map(P=>({route:P.route,label:P.label||P.name,status:P.status}))}),l==="system"&&h.jsx(mb,{token:e,settings:f,readonly:g})]})]})})}function gb({token:e,initialPair:t,onPairDone:r,onDone:n}){ei();const[a,l]=I.useState(t?"pair":"welcome"),[u,f]=I.useState(()=>{const Y={name:"",label:"",ssh:"",sshPort:"",pairingUrl:t||"",localLabel:""};if(!t)return Y;const $=rh(t);return $&&$.ok?{...sh(Y,$,new Set),pairingUrl:t}:Y}),m=I.useRef(new Set),[p,y]=I.useState(!1),[g,S]=I.useState(!1),[v,C]=I.useState(null),N=async()=>{S(!0),C(null);try{await l0(e,{wizardDone:!0}),r&&r(),n()}catch(Y){C(String(Y.message||Y)),S(!1)}},k=Y=>{m.current.add("label"),f($=>({...$,label:Y,name:p?$.name:kr(Y)}))},P=Y=>{m.current.add("name"),y(!0),f($=>({...$,name:Y?kr(Y):""}))},F=Y=>{m.current.add("ssh"),f($=>({...$,ssh:Y}))},B=Y=>{f($=>{const L=rh(Y);if(!L||!L.ok)return{...$,pairingUrl:Y};const U=sh($,L,m.current);return L.version===2&&L.name&&!m.current.has("name")&&!p&&(U.name=L.name),{...U,pairingUrl:Y}})},H=async()=>{if(!u.name||!u.ssh||!u.pairingUrl)return C(b("pairing-required"));if(u.label&&!Mn(u.label)||u.localLabel&&!Mn(u.localLabel))return C(b("err-label"));S(!0),C(null);try{await P_(e,{name:u.name,ssh:u.ssh,pairingUrl:u.pairingUrl,...u.label?{label:u.label}:{},...u.sshPort?{sshPort:Number(u.sshPort)}:{},localLabel:u.localLabel||void 0}),r&&r(),l("done")}catch(Y){C(String(Y.message||Y))}S(!1)};return h.jsx("div",{className:"nc-wiz-overlay",children:h.jsxs("div",{className:"nc-wiz",children:[h.jsxs("div",{className:"nc-wiz-head",children:[h.jsx("b",{children:b("wizard-title")}),h.jsx("small",{children:b("hydra-simple")})]}),a==="welcome"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("div",{className:"nc-wiz-done",children:b("local-ready")}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",disabled:g,onClick:N,children:b("local-only")}),h.jsx("button",{className:"nc-btn primary",disabled:g,onClick:()=>l("pair"),children:b("add-node")})]})]}),a==="pair"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsxs("label",{className:"nc-field",children:[b("node-display-label"),h.jsx("input",{value:u.label,onChange:Y=>k(Y.target.value),placeholder:"Home Relay"})]}),h.jsxs("label",{className:"nc-field",children:[b("node-name-label"),h.jsx("input",{value:u.name,onChange:Y=>P(Y.target.value),placeholder:b("node-name-ph")})]}),h.jsxs("label",{className:"nc-field",children:[b("node-ssh-label"),h.jsx("input",{value:u.ssh,onChange:Y=>F(Y.target.value),placeholder:"my-relay"})]}),h.jsxs("label",{className:"nc-field",children:[b("device-name-label"),h.jsx("input",{value:u.localLabel,onChange:Y=>f({...u,localLabel:Y.target.value}),placeholder:"NexusCrew"}),h.jsx("small",{className:"nc-set-hint",children:b("device-name-hint")})]}),h.jsxs("label",{className:"nc-field",children:[b("pairing-link"),h.jsx("input",{value:u.pairingUrl,onChange:Y=>B(Y.target.value),placeholder:"http://127.0.0.1:…/#pair=…"}),h.jsx("small",{className:"nc-set-hint",children:b("pairing-v2-hint")})]}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",disabled:g,onClick:()=>{r&&r(),l("welcome")},children:b("back")}),h.jsx("button",{className:"nc-btn primary",disabled:g,onClick:H,children:b("test-and-connect")})]})]}),a==="done"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("div",{className:"nc-wiz-done",children:b("node-connected")}),h.jsx("div",{className:"nc-sheet-actions",children:h.jsx("button",{className:"nc-btn primary",disabled:g,onClick:N,children:b("finish")})})]}),v&&h.jsx("div",{className:"nc-err",children:v})]})})}function vb(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 yb=6e3,Sb=12e3;function wb({n:e,onClose:t}){return h.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[h.jsxs("div",{className:"nc-ntf-toast-txt",children:[h.jsx("b",{children:e.title}),e.body&&h.jsx("small",{children:e.body}),e.session&&h.jsx("span",{className:"nc-ntf-from",children:e.session})]}),h.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:b("close"),children:h.jsx(Ie,{name:"x",size:14})})]})}function Cb({ask:e,token:t,onAnswered:r}){const[n,a]=I.useState(""),[l,u]=I.useState(!1),[f,m]=I.useState(null),p=async y=>{const g=String(y||"").trim();if(!(!g||l)){m(null),u(!0);try{await m0(t,e.id,g),r(e.id)}catch(S){m(String(S.message||S))}u(!1)}};return h.jsxs("div",{className:"nc-ask-card",children:[h.jsxs("div",{className:"nc-ask-head",children:[h.jsx("span",{className:"nc-ntf-from",children:e.session}),h.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),h.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&h.jsx("div",{className:"nc-ask-opts",children:e.options.map(y=>h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:l,onClick:()=>p(y),children:y},y))}),h.jsxs("div",{className:"nc-ask-reply",children:[h.jsx("textarea",{rows:2,placeholder:b("ask-reply-ph"),value:n,disabled:l,onChange:y=>a(y.target.value)}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:l||!n.trim(),onClick:()=>p(n),children:b("send")})]}),f&&h.jsx("div",{className:"nc-err",children:f})]})}function bb({token:e}){ei();const[t,r]=I.useState([]),[n,a]=I.useState([]),[l,u]=I.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),f=I.useRef(0),m=I.useCallback(g=>{r(S=>S.filter(v=>v.key!==g))},[]),p=I.useCallback(g=>{const S=`t${f.current+=1}`;r(v=>[...v.slice(-3),{...g,key:S}]),setTimeout(()=>m(S),g.urgency==="high"?Sb:yb)},[m]);I.useEffect(()=>{if(!e)return;let g=!1;p0(e).then(v=>{g||a(v.asks||[])}).catch(()=>{});const S=vb(e,v=>{v.type==="notify"?p(v):v.type==="ask"&&v.ask&&v.ask.id?a(C=>C.some(N=>N.id===v.ask.id)?C:[...C,v.ask]):v.type==="ask-answered"&&v.id&&a(C=>C.filter(N=>N.id!==v.id))});return()=>{g=!0,S()}},[e,p]);const y=g=>a(S=>S.filter(v=>v.id!==g));return h.jsxs(h.Fragment,{children:[t.length>0&&h.jsx("div",{className:"nc-ntf-toasts",children:t.map(g=>h.jsx(wb,{n:g,onClose:()=>m(g.key)},g.key))}),n.length>0&&!l&&h.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>u(!0),title:b("asks-title"),children:["? ",h.jsx("span",{className:"nc-ask-count",children:n.length})]}),n.length>0&&l&&h.jsxs("div",{className:"nc-ask-panel",children:[h.jsxs("div",{className:"nc-ask-panel-head",children:[h.jsx("b",{children:b("asks-title")}),h.jsx("span",{className:"nc-ask-count",children:n.length}),h.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>u(!1),title:b("close"),children:h.jsx(Ie,{name:"x",size:16})})]}),h.jsx("div",{className:"nc-ask-panel-body",children:n.map(g=>h.jsx(Cb,{ask:g,token:e,onAnswered:y},g.id))})]})]})}const pu=e=>Gi(Kr(e)).length===0;function xb(e,t,r,n){const[a,l]=I.useState([]),[u,f]=I.useState(!1),[m,p]=I.useState("idle"),[y,g]=I.useState(""),S=I.useRef([]),v=I.useRef(r),C=I.useRef(!1),N=I.useRef(!0);v.current=r,S.current=a;const k=I.useCallback((L,U=!0)=>{S.current=L,l(L);const T=L.find(K=>K.name===t);U&&T&&(N.current=!0,n(Kr(T.layout)),mC(t,T.layout)),pC(L.map(K=>K.name))},[t,n]),P=I.useCallback(async()=>{let L=await Pc(e);const U=L.decks.find(T=>T.name==="main");if(L.decks.length===1&&U&&U.revision===0&&pu(U.layout)){const T=fC(),K=Kr(ih("main")||Ea());if(!pu(K)){const q=await Qo(e,"main",K,0);L.decks[0]=q}for(const q of T.filter(A=>A!=="main"))try{let A=await Np(e,q);const O=Kr(ih(q)||Ea());pu(O)||(A=await Qo(e,q,O,A.revision)),L.decks.push(A)}catch{}L=await Pc(e)}k(L.decks,!0),f(!0),g("")},[e,k]);I.useEffect(()=>{e&&P().catch(L=>g(String(L.message||L)))},[P,e]);const F=I.useCallback(async()=>{if(!u)return;const L=S.current.find(U=>U.name===t);if(!L)return g(`deck inesistente: ${t}`);p("saving");try{const U=await Qo(e,t,Kr(v.current),L.revision);k(S.current.map(T=>T.name===t?U:T),!1),C.current=!1,p("saved"),g(""),setTimeout(()=>p("idle"),1500)}catch(U){p("error"),g(String(U.message||U)),U.status===409&&U.data&&U.data.current&&k(S.current.map(T=>T.name===t?U.data.current:T),!1)}},[u,t,e,k]);I.useEffect(()=>{if(!u)return;if(N.current){N.current=!1;return}C.current=!0,p("saving");const L=setTimeout(F,650);return()=>clearTimeout(L)},[r,u,F]),I.useEffect(()=>{if(!u)return;const L=setInterval(async()=>{try{const U=await Pc(e),T=S.current.find(A=>A.name===t),K=U.decks.find(A=>A.name===t),q=K&&(!T||K.revision>T.revision);k(U.decks,q&&!C.current)}catch{}},5e3);return()=>clearInterval(L)},[u,e,t,k]);const B=async L=>{const U=await Np(e,L);return k([...S.current,U],!1),U},H=async(L,U)=>{const T=S.current.find(q=>q.name===L);if(!T)throw new Error("deck inesistente");const K=await _0(e,L,U,T.revision);return k(S.current.map(q=>q.name===L?K:q),!1),K},Y=async L=>{const U=S.current.find(T=>T.name===L);if(!U)throw new Error("deck inesistente");await g0(e,L,U.revision),k(S.current.filter(T=>T.name!==L),!1)},$=async(L,U)=>{const T=S.current.find(q=>q.name===L);if(!T)throw new Error("deck inesistente");const K=await Qo(e,L,Mg(Kr(T.layout),U),T.revision);return k(S.current.map(q=>q.name===L?K:q),!1),K};return{decks:a.map(L=>L.name),records:a,ready:u,saveState:m,error:y,setError:g,saveNow:F,add:B,rename:H,remove:Y,addTileTo:$}}const kb="/sw.js",nh="nc-sw-update";let oh=null,ah=!1,lh=null,$g=Object.freeze({needed:!1,kind:null,version:""}),Wg=!1;function Ug(){typeof window<"u"&&window.dispatchEvent(new Event(nh))}function Kg(){const e=lh||(ah?{kind:"reload",version:""}:null);$g=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function p_(){return $g}function Eb(e){return typeof window>"u"?()=>{}:(window.addEventListener(nh,e),()=>window.removeEventListener(nh,e))}function Mh(e){ah!==e&&(ah=e,Kg(),Ug())}function Nb(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(lh);lh=n,Kg(),a||Ug()}function Rb(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&Mh(!0)})}function Pb(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{Wg&&location.reload()}),navigator.serviceWorker.register(kb).then(e=>{oh=e,e.waiting&&Mh(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&Rb(t)}),setInterval(()=>{e.update().catch(()=>{})},3600*1e3)}).catch(()=>{}))}function Db(){Wg=!0,Mh(!1);const e=oh&&oh.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}function Mb({hash:e="",origin:t="",pathname:r="",search:n=""}={}){const a=String(e||"").replace(/^#/,""),l=`${r||""}${n||""}`;if(!a)return{token:"",pair:"",nextUrl:l};const u=new URLSearchParams(a),f=u.get("token")||"",m=u.get("pair")||"",p=m?`${t||""}${r||""}#pair=${m}`:"";return{token:f,pair:p,nextUrl:l}}const qg=9,Vg=24,Yg="nc_side_w",m_="nc_side_min",Lb=240,__="(min-width:1024px) and (pointer:fine)";function Tb(){const e=Number(localStorage.getItem(Yg));return e>=180&&e<=480?e:Lb}function Bb(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=qg&&e<=Vg?e:13}function jb(){const e={token:"",pair:""};try{const{token:t,pair:r,nextUrl:n}=Mb({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 Ab(e){try{return Kr(ih(e))}catch{return Ea()}}function g_(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 Ib(){const[e,t]=I.useState(()=>window.matchMedia(__).matches);return I.useEffect(()=>{const r=window.matchMedia(__),n=a=>t(a.matches);return r.addEventListener("change",n),()=>r.removeEventListener("change",n)},[]),e}function v_({session:e,node:t,token:r,readonly:n=!1,onBack:a}){ei();const[l,u]=I.useState(!1),[f,m]=I.useState(()=>window.matchMedia("(pointer: coarse)").matches),[p,y]=I.useState(null),[g,S]=I.useState(Bb),[v,C]=I.useState(""),N=U=>S(T=>{const K=Math.max(qg,Math.min(Vg,T+U));return localStorage.setItem("nc_fontsize",String(K)),K}),k=I.useRef(()=>{}),P=I.useRef(()=>{}),F=I.useRef(!1),[B,H]=I.useState(!1),[Y,$]=I.useState(!1),L=()=>{F.current=!F.current,H(F.current)};return I.useEffect(()=>{let U=!0;const T=t?t.split("/"):[],K=t?`/api/route/${t.split("/").map(encodeURIComponent).join("/")}/_`:"/api";async function q(){let O=null,G=null;try{const Q=await(await yt(`${K}/sessions`,r)).json();Array.isArray(Q.sessions)&&(O=Q.sessions.find(x=>x.name===e))}catch{}try{const ie=await Gr(r,T);ie.available&&Array.isArray(ie.cells)&&(G=ie.cells.find(Q=>Q.tmuxSession===e))}catch{}if(!U)return;let Z="";G?Z=`${G.engine}${G.key?`·${G.key}`:""}`:O&&(Z=O.attached?`attached · ${g_(O.activity)}`:O.activity?g_(O.activity):""),C(Z)}q();const A=setInterval(q,4e3);return()=>{U=!1,clearInterval(A)}},[e,t,r]),h.jsxs("div",{className:"nc-app",children:[h.jsxs("header",{className:"nc-bar nc-bar-single",children:[h.jsxs("button",{onClick:a,title:b("sessions"),children:[h.jsx(Ie,{name:"chevronLeft",size:18}),h.jsx("span",{className:"nc-bar-label",children:b("sessions")})]}),h.jsxs("span",{className:"nc-bar-center",children:[h.jsx("b",{children:t?`${t}:${e}`:e}),v&&h.jsx("small",{className:"nc-bar-sub",children:v})]}),h.jsxs("span",{className:"nc-bar-right",children:[h.jsx("button",{onClick:()=>N(-1),title:b("zoom-out"),children:h.jsx(Ie,{name:"zoomOut",size:18})}),h.jsx("button",{onClick:()=>N(1),title:b("zoom-in"),children:h.jsx(Ie,{name:"zoomIn",size:18})}),h.jsx("button",{onClick:()=>m(U=>!U),title:b("composer"),children:h.jsx(Ie,{name:"keyboard",size:20})}),h.jsx("button",{onClick:()=>u(U=>!U),title:b("files"),children:h.jsx(Ie,{name:"folder",size:20})})]})]}),h.jsx("div",{className:"nc-termwrap",children:h.jsx(Eg,{session:e,node:t,token:r,readonly:n,takeSize:!0,sendRef:k,actionRef:P,ctrlRef:F,setCtrlArmed:H,onFiles:y,fontSize:g,selectionMode:Y,onSelectionModeChange:$})}),h.jsx(K1,{onKeyboard:()=>m(U=>!U),send:U=>k.current(U),action:U=>P.current(U),ctrlArmed:B,onCtrl:L,selectionMode:Y,onSelectionMode:$}),f&&h.jsx(Rg,{send:U=>k.current(U),token:r,session:e,node:t}),l&&h.jsx(Ng,{session:e,node:t,token:r,filesEvent:p,onClose:()=>u(!1)})]})}function Ob(){ei();const[e]=I.useState(jb),[t,r]=I.useState(e.token),[n,a]=I.useState(e.pair||""),l=I.useCallback(()=>{a("");try{sessionStorage.removeItem("nc_pair")}catch{}},[]),[u,f]=I.useState(!1),m=Ib(),[p]=I.useState(()=>dC(typeof location<"u"?location.pathname:"/")),y=p===Zt,[g,S]=I.useState(null),v=fe=>S(ka(fe)),[C,N]=I.useState([]),[k,P]=I.useState([]),[F,B]=I.useState(()=>Ab(p)),H=xb(t,p,F,B),Y=H.decks.length?H.decks:[Zt],[$,L]=I.useState(null),[U,T]=I.useState(null),K=fe=>T(ka(fe)),q=_h(t,m),[A,O]=I.useState(null),[G,Z]=I.useState(!1),[ie,Q]=I.useState(Tb),[x,X]=I.useState(!y),[re,R]=I.useState(()=>y?localStorage.getItem(m_)==="1":!0),[E,ee]=I.useState(!1),[M,j]=I.useState("nodes"),[se,ce]=I.useState(!1),[oe,pe]=I.useState(""),Ne=(fe="nodes",Re=!1,qt="")=>{j(fe),ce(Re),pe(qt),ee(!0)},[ot,Ge]=I.useState(!1),[ye,ti]=I.useState(!1);I.useEffect(()=>{try{localStorage.setItem(Yg,String(ie))}catch{}},[ie]),I.useEffect(()=>{try{localStorage.setItem(m_,re?"1":"")}catch{}},[re]),I.useEffect(()=>{if(!t)return;let fe=!1;return Promise.all([k_(t),yt("/api/config",t).then(Re=>Re.json())]).then(([Re,qt])=>{fe||(ti(!!qt.readonlyDefault),(Re.firstRun===!0&&!qt.readonlyDefault||n)&&Ge(!0))}).catch(()=>{}),()=>{fe=!0}},[t,n]);const gi=I.useCallback(async()=>{try{const Re=await(await yt("/api/sessions",t)).json();Re.error||N(Re.sessions||[])}catch{}try{const fe=await Gr(t);P(fe.available?fe.cells||[]:[])}catch{P([])}},[t]);I.useEffect(()=>{if(!m)return;gi();const fe=setInterval(gi,4e3);return()=>clearInterval(fe)},[m,gi]),I.useEffect(()=>{let fe=!1;return yt("/api/config",t).then(Re=>Re.json()).then(Re=>{fe||Nb(Re.version,Re.uiVersion,"0.8.6")}).catch(()=>{}),()=>{fe=!0}},[t]);const Rr=new Set([...C.map(fe=>fe.name),...q.flatMap(fe=>fe.sessions.map(Re=>Re.key))]),Zi=Gi(F),ii=fe=>B(Re=>Mg(Re,fe)),ri=async(fe,Re=[])=>{try{await fh(t,fe,Re)}catch{return}const qt=Re.length?`${Re.join("/")}:${fe}`:fe;B(Ms=>Ra(Ms,qt)),gi()},si=async fe=>{if(!A)return;const{cell:Re}=A,qt=Array.isArray(A.route)?A.route:[];fe.action==="up"?await hh(t,{cell:Re,boot:!!fe.boot,...fe.engine?{engine:fe.engine}:{},...fe.model!==void 0?{model:fe.model}:{},...fe.permissionPolicy?{permissionPolicy:fe.permissionPolicy}:{}},qt):await ma(t,{cell:Re,boot:!!fe.boot},qt),gi()},It=async fe=>{if(!(!(fe!=null&&fe.direct)||G)){Z(!0);try{await ph(t,fe.name,fe.tunnelStatus==="up"?"down":"up")}finally{Z(!1)}}},ge=fe=>{try{const Re=window.open(na(fe,t),"_blank");return Re&&(Re.opener=null),!!Re}catch{return!1}},Be=fe=>location.assign(na(fe,t)),wt=async fe=>{await H.add(fe),Be(fe)},Mt=async(fe,Re)=>{await H.rename(fe,Re),fe===p&&location.assign(na(Re,t))},ni=async fe=>{await H.remove(fe),fe===p&&location.assign(na(Zt,t))},Ei=async(fe,Re)=>{!Re||Re===p||(await H.addTileTo(Re,fe),B(qt=>Ra(qt,fe)))};if(!t)return h.jsxs("div",{className:"nc-auth",children:[h.jsx("p",{children:b("auth-prompt")}),h.jsx("input",{onChange:fe=>r(fe.target.value.trim()),placeholder:"token"}),h.jsxs("label",{children:[h.jsx("input",{type:"checkbox",checked:u,onChange:fe=>f(fe.target.checked)})," ",b("remember-device")]}),h.jsx("button",{onClick:()=>{(u?localStorage:sessionStorage).setItem("nc_token",t)},children:"ok"})]});const er=h.jsxs(h.Fragment,{children:[E&&h.jsx(_b,{token:t,initialTab:M,initialLocation:oe,startNewCell:se,onClose:()=>{ee(!1),ce(!1),pe("")}}),ot&&h.jsx(gb,{token:t,initialPair:n,onPairDone:l,onDone:()=>Ge(!1)}),h.jsx(bb,{token:t})]});if(!m)return g?h.jsxs(h.Fragment,{children:[h.jsx(v_,{session:g.session,node:g.node,token:t,readonly:ye,onBack:()=>S(null)}),er]}):h.jsxs(h.Fragment,{children:[h.jsx(k0,{onPick:v,token:t,onSettings:Ne}),er]});const Hn=y||!x;return h.jsxs("div",{className:"nc-workspace",children:[!y&&h.jsx("button",{className:"nc-side-show",title:b("toggle-sidebar"),onClick:()=>X(fe=>!fe),children:"☰"}),Hn&&h.jsx(J1,{sessions:C,cells:k,activeSessions:Zi,nodeGroups:q,onPick:K,onAddTile:ii,onPower:O,onNodePower:It,onKill:ri,onNew:()=>Ne("fleet",!0),onSettings:Ne,width:ie,collapsed:re,onResize:Q,onToggleCollapse:()=>R(fe=>!fe)}),h.jsxs("div",{className:"nc-workspace-main",children:[h.jsx(_C,{decks:Y,currentDeck:p,onCreate:wt,onRename:Mt,onDelete:ni,onOpenWindow:ge,onNavigate:Be,saveState:H.saveState,error:H.error}),h.jsx(lC,{layout:F,onLayoutChange:B,token:t,readonly:ye,sessionsAlive:Rr,focusSession:$,onFocus:L,onOpenSingle:K,decks:Y,currentDeck:p,onSendToDeck:Ei})]}),U&&h.jsx("div",{className:"nc-single-overlay",children:h.jsx(v_,{session:U.session,node:U.node,token:t,readonly:ye,onBack:()=>T(null)})}),A&&h.jsx(_a,{cell:A,token:t,route:Array.isArray(A.route)?A.route:[],onConfirm:si,onClose:()=>O(null)}),er]})}function zb(){ei();const e=I.useSyncExternalStore(Eb,p_,p_);if(!e.needed)return null;const t=e.kind==="install"?b("install-version-mismatch").replace("{v}",e.version):b("update-available").replace("{v}",e.version).replace(" "," ").trim();return h.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[h.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&h.jsx("button",{className:"nc-update-btn",onClick:Db,children:b("reload")})]})}Pb();e0.createRoot(document.getElementById("root")).render(h.jsxs(Vy.StrictMode,{children:[h.jsx(Ob,{}),h.jsx(zb,{})]}));
|