@mmmbuto/nexuscrew 0.8.0 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -60
- package/bin/nexuscrew.js +10 -4
- package/frontend/dist/assets/index-BFyPeZsL.js +90 -0
- package/frontend/dist/assets/index-COsoJxXQ.css +32 -0
- package/frontend/dist/assets/qr-scanner-worker.min-D85Z9gVD.js +98 -0
- package/frontend/dist/index.html +2 -2
- package/frontend/dist/version.json +1 -1
- package/lib/cli/commands.js +314 -110
- package/lib/cli/doctor.js +1 -1
- package/lib/cli/init.js +40 -10
- package/lib/cli/pidfile.js +2 -2
- package/lib/cli/service.js +0 -5
- package/lib/decks/store.js +8 -2
- package/lib/files/routes.js +3 -1
- package/lib/fleet/builtin.js +15 -5
- package/lib/fleet/managed.js +278 -107
- package/lib/mcp/server.js +24 -5
- package/lib/nodes/commands.js +27 -12
- package/lib/nodes/peering.js +116 -0
- package/lib/nodes/store.js +91 -24
- package/lib/nodes/topology-cache.js +75 -0
- package/lib/nodes/tunnel.js +22 -7
- package/lib/proxy/federation.js +263 -0
- package/lib/proxy/node-proxy.js +21 -8
- package/lib/server.js +91 -7
- package/lib/settings/routes.js +221 -5
- package/package.json +2 -2
- package/frontend/dist/assets/index-BBOgTCoO.css +0 -32
- package/frontend/dist/assets/index-DQrDBogT.js +0 -83
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const h of l.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&n(h)}).observe(document,{childList:!0,subtree:!0});function r(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(a){if(a.ep)return;a.ep=!0;const l=r(a);fetch(a.href,l)}})();function Jh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _c={exports:{}},hn={},gc={exports:{}},Pe={};/**
|
|
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 sp;function Ry(){if(sp)return Pe;sp=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),h=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.iterator;function S(R){return R===null||typeof R!="object"?null:(R=y&&R[y]||R["@@iterator"],typeof R=="function"?R:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function E(R,$,ce){this.props=R,this.context=$,this.refs=b,this.updater=ce||g}E.prototype.isReactComponent={},E.prototype.setState=function(R,$){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,$,"setState")},E.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function j(){}j.prototype=E.prototype;function T(R,$,ce){this.props=R,this.context=$,this.refs=b,this.updater=ce||g}var W=T.prototype=new j;W.constructor=T,C(W,E.prototype),W.isPureReactComponent=!0;var M=Array.isArray,J=Object.prototype.hasOwnProperty,Y={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function P(R,$,ce){var ue,pe={},ye=null,Se=null;if($!=null)for(ue in $.ref!==void 0&&(Se=$.ref),$.key!==void 0&&(ye=""+$.key),$)J.call($,ue)&&!A.hasOwnProperty(ue)&&(pe[ue]=$[ue]);var Ce=arguments.length-2;if(Ce===1)pe.children=ce;else if(1<Ce){for(var ke=Array(Ce),Te=0;Te<Ce;Te++)ke[Te]=arguments[Te+2];pe.children=ke}if(R&&R.defaultProps)for(ue in Ce=R.defaultProps,Ce)pe[ue]===void 0&&(pe[ue]=Ce[ue]);return{$$typeof:e,type:R,key:ye,ref:Se,props:pe,_owner:Y.current}}function z(R,$){return{$$typeof:e,type:R.type,key:$,ref:R.ref,props:R.props,_owner:R._owner}}function O(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function K(R){var $={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ce){return $[ce]})}var H=/\/+/g;function B(R,$){return typeof R=="object"&&R!==null&&R.key!=null?K(""+R.key):$.toString(36)}function D(R,$,ce,ue,pe){var ye=typeof R;(ye==="undefined"||ye==="boolean")&&(R=null);var Se=!1;if(R===null)Se=!0;else switch(ye){case"string":case"number":Se=!0;break;case"object":switch(R.$$typeof){case e:case t:Se=!0}}if(Se)return Se=R,pe=pe(Se),R=ue===""?"."+B(Se,0):ue,M(pe)?(ce="",R!=null&&(ce=R.replace(H,"$&/")+"/"),D(pe,$,ce,"",function(Te){return Te})):pe!=null&&(O(pe)&&(pe=z(pe,ce+(!pe.key||Se&&Se.key===pe.key?"":(""+pe.key).replace(H,"$&/")+"/")+R)),$.push(pe)),1;if(Se=0,ue=ue===""?".":ue+":",M(R))for(var Ce=0;Ce<R.length;Ce++){ye=R[Ce];var ke=ue+B(ye,Ce);Se+=D(ye,$,ce,ke,pe)}else if(ke=S(R),typeof ke=="function")for(R=ke.call(R),Ce=0;!(ye=R.next()).done;)ye=ye.value,ke=ue+B(ye,Ce++),Se+=D(ye,$,ce,ke,pe);else if(ye==="object")throw $=String(R),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.");return Se}function X(R,$,ce){if(R==null)return R;var ue=[],pe=0;return D(R,ue,"","",function(ye){return $.call(ce,ye,pe++)}),ue}function ee(R){if(R._status===-1){var $=R._result;$=$(),$.then(function(ce){(R._status===0||R._status===-1)&&(R._status=1,R._result=ce)},function(ce){(R._status===0||R._status===-1)&&(R._status=2,R._result=ce)}),R._status===-1&&(R._status=0,R._result=$)}if(R._status===1)return R._result.default;throw R._result}var ie={current:null},x={transition:null},Q={ReactCurrentDispatcher:ie,ReactCurrentBatchConfig:x,ReactCurrentOwner:Y};function q(){throw Error("act(...) is not supported in production builds of React.")}return Pe.Children={map:X,forEach:function(R,$,ce){X(R,function(){$.apply(this,arguments)},ce)},count:function(R){var $=0;return X(R,function(){$++}),$},toArray:function(R){return X(R,function($){return $})||[]},only:function(R){if(!O(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},Pe.Component=E,Pe.Fragment=r,Pe.Profiler=a,Pe.PureComponent=T,Pe.StrictMode=n,Pe.Suspense=m,Pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,Pe.act=q,Pe.cloneElement=function(R,$,ce){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var ue=C({},R.props),pe=R.key,ye=R.ref,Se=R._owner;if($!=null){if($.ref!==void 0&&(ye=$.ref,Se=Y.current),$.key!==void 0&&(pe=""+$.key),R.type&&R.type.defaultProps)var Ce=R.type.defaultProps;for(ke in $)J.call($,ke)&&!A.hasOwnProperty(ke)&&(ue[ke]=$[ke]===void 0&&Ce!==void 0?Ce[ke]:$[ke])}var ke=arguments.length-2;if(ke===1)ue.children=ce;else if(1<ke){Ce=Array(ke);for(var Te=0;Te<ke;Te++)Ce[Te]=arguments[Te+2];ue.children=Ce}return{$$typeof:e,type:R.type,key:pe,ref:ye,props:ue,_owner:Se}},Pe.createContext=function(R){return R={$$typeof:h,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},R.Provider={$$typeof:l,_context:R},R.Consumer=R},Pe.createElement=P,Pe.createFactory=function(R){var $=P.bind(null,R);return $.type=R,$},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(R){return{$$typeof:d,render:R}},Pe.isValidElement=O,Pe.lazy=function(R){return{$$typeof:v,_payload:{_status:-1,_result:R},_init:ee}},Pe.memo=function(R,$){return{$$typeof:p,type:R,compare:$===void 0?null:$}},Pe.startTransition=function(R){var $=x.transition;x.transition={};try{R()}finally{x.transition=$}},Pe.unstable_act=q,Pe.useCallback=function(R,$){return ie.current.useCallback(R,$)},Pe.useContext=function(R){return ie.current.useContext(R)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(R){return ie.current.useDeferredValue(R)},Pe.useEffect=function(R,$){return ie.current.useEffect(R,$)},Pe.useId=function(){return ie.current.useId()},Pe.useImperativeHandle=function(R,$,ce){return ie.current.useImperativeHandle(R,$,ce)},Pe.useInsertionEffect=function(R,$){return ie.current.useInsertionEffect(R,$)},Pe.useLayoutEffect=function(R,$){return ie.current.useLayoutEffect(R,$)},Pe.useMemo=function(R,$){return ie.current.useMemo(R,$)},Pe.useReducer=function(R,$,ce){return ie.current.useReducer(R,$,ce)},Pe.useRef=function(R){return ie.current.useRef(R)},Pe.useState=function(R){return ie.current.useState(R)},Pe.useSyncExternalStore=function(R,$,ce){return ie.current.useSyncExternalStore(R,$,ce)},Pe.useTransition=function(){return ie.current.useTransition()},Pe.version="18.3.1",Pe}var np;function Zh(){return np||(np=1,gc.exports=Ry()),gc.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 op;function Dy(){if(op)return hn;op=1;var e=Zh(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function h(d,m,p){var v,y={},S=null,g=null;p!==void 0&&(S=""+p),m.key!==void 0&&(S=""+m.key),m.ref!==void 0&&(g=m.ref);for(v in m)n.call(m,v)&&!l.hasOwnProperty(v)&&(y[v]=m[v]);if(d&&d.defaultProps)for(v in m=d.defaultProps,m)y[v]===void 0&&(y[v]=m[v]);return{$$typeof:t,type:d,key:S,ref:g,props:y,_owner:a.current}}return hn.Fragment=r,hn.jsx=h,hn.jsxs=h,hn}var ap;function My(){return ap||(ap=1,_c.exports=Dy()),_c.exports}var f=My(),I=Zh();const Py=Jh(I);var Ko={},vc={exports:{}},zt={},yc={exports:{}},Sc={};/**
|
|
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 lp;function Ly(){return lp||(lp=1,(function(e){function t(x,Q){var q=x.length;x.push(Q);e:for(;0<q;){var R=q-1>>>1,$=x[R];if(0<a($,Q))x[R]=Q,x[q]=$,q=R;else break e}}function r(x){return x.length===0?null:x[0]}function n(x){if(x.length===0)return null;var Q=x[0],q=x.pop();if(q!==Q){x[0]=q;e:for(var R=0,$=x.length,ce=$>>>1;R<ce;){var ue=2*(R+1)-1,pe=x[ue],ye=ue+1,Se=x[ye];if(0>a(pe,q))ye<$&&0>a(Se,pe)?(x[R]=Se,x[ye]=q,R=ye):(x[R]=pe,x[ue]=q,R=ue);else if(ye<$&&0>a(Se,q))x[R]=Se,x[ye]=q,R=ye;else break e}}return Q}function a(x,Q){var q=x.sortIndex-Q.sortIndex;return q!==0?q:x.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var h=Date,d=h.now();e.unstable_now=function(){return h.now()-d}}var m=[],p=[],v=1,y=null,S=3,g=!1,C=!1,b=!1,E=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function W(x){for(var Q=r(p);Q!==null;){if(Q.callback===null)n(p);else if(Q.startTime<=x)n(p),Q.sortIndex=Q.expirationTime,t(m,Q);else break;Q=r(p)}}function M(x){if(b=!1,W(x),!C)if(r(m)!==null)C=!0,ee(J);else{var Q=r(p);Q!==null&&ie(M,Q.startTime-x)}}function J(x,Q){C=!1,b&&(b=!1,j(P),P=-1),g=!0;var q=S;try{for(W(Q),y=r(m);y!==null&&(!(y.expirationTime>Q)||x&&!K());){var R=y.callback;if(typeof R=="function"){y.callback=null,S=y.priorityLevel;var $=R(y.expirationTime<=Q);Q=e.unstable_now(),typeof $=="function"?y.callback=$:y===r(m)&&n(m),W(Q)}else n(m);y=r(m)}if(y!==null)var ce=!0;else{var ue=r(p);ue!==null&&ie(M,ue.startTime-Q),ce=!1}return ce}finally{y=null,S=q,g=!1}}var Y=!1,A=null,P=-1,z=5,O=-1;function K(){return!(e.unstable_now()-O<z)}function H(){if(A!==null){var x=e.unstable_now();O=x;var Q=!0;try{Q=A(!0,x)}finally{Q?B():(Y=!1,A=null)}}else Y=!1}var B;if(typeof T=="function")B=function(){T(H)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,X=D.port2;D.port1.onmessage=H,B=function(){X.postMessage(null)}}else B=function(){E(H,0)};function ee(x){A=x,Y||(Y=!0,B())}function ie(x,Q){P=E(function(){x(e.unstable_now())},Q)}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||g||(C=!0,ee(J))},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"):z=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 Q=3;break;default:Q=S}var q=S;S=Q;try{return x()}finally{S=q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(x,Q){switch(x){case 1:case 2:case 3:case 4:case 5:break;default:x=3}var q=S;S=x;try{return Q()}finally{S=q}},e.unstable_scheduleCallback=function(x,Q,q){var R=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?R+q:R):q=R,x){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=q+$,x={id:v++,callback:Q,priorityLevel:x,startTime:q,expirationTime:$,sortIndex:-1},q>R?(x.sortIndex=q,t(p,x),r(m)===null&&x===r(p)&&(b?(j(P),P=-1):b=!0,ie(M,q-R))):(x.sortIndex=$,t(m,x),C||g||(C=!0,ee(J))),x},e.unstable_shouldYield=K,e.unstable_wrapCallback=function(x){var Q=S;return function(){var q=S;S=Q;try{return x.apply(this,arguments)}finally{S=q}}}})(Sc)),Sc}var cp;function Ty(){return cp||(cp=1,yc.exports=Ly()),yc.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 hp;function By(){if(hp)return zt;hp=1;var e=Zh(),t=Ty();function r(i){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+i,o=1;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,a={};function l(i,s){h(i,s),h(i+"Capture",s)}function h(i,s){for(a[i]=s,i=0;i<s.length;i++)n.add(s[i])}var d=!(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]*$/,v={},y={};function S(i){return m.call(y,i)?!0:m.call(v,i)?!1:p.test(i)?y[i]=!0:(v[i]=!0,!1)}function g(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"||g(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 b(i,s,o,c,u,_,w){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=c,this.attributeNamespace=u,this.mustUseProperty=o,this.propertyName=i,this.type=s,this.sanitizeURL=_,this.removeEmptyString=w}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){E[i]=new b(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var s=i[0];E[s]=new b(s,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){E[i]=new b(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){E[i]=new b(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){E[i]=new b(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){E[i]=new b(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){E[i]=new b(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){E[i]=new b(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){E[i]=new b(i,5,!1,i.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function T(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(j,T);E[s]=new b(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(j,T);E[s]=new b(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(j,T);E[s]=new b(s,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){E[i]=new b(i,1,!1,i.toLowerCase(),null,!1,!1)}),E.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){E[i]=new b(i,1,!1,i.toLowerCase(),null,!0,!0)});function W(i,s,o,c){var u=E.hasOwnProperty(s)?E[s]:null;(u!==null?u.type!==0:c||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(C(s,o,u,c)&&(o=null),c||u===null?S(s)&&(o===null?i.removeAttribute(s):i.setAttribute(s,""+o)):u.mustUseProperty?i[u.propertyName]=o===null?u.type===3?!1:"":o:(s=u.attributeName,c=u.attributeNamespace,o===null?i.removeAttribute(s):(u=u.type,o=u===3||u===4&&o===!0?"":""+o,c?i.setAttributeNS(c,s,o):i.setAttribute(s,o))))}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,J=Symbol.for("react.element"),Y=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),K=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),ie=Symbol.for("react.offscreen"),x=Symbol.iterator;function Q(i){return i===null||typeof i!="object"?null:(i=x&&i[x]||i["@@iterator"],typeof i=="function"?i:null)}var q=Object.assign,R;function $(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 ce=!1;function ue(i,s){if(!i||ce)return"";ce=!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(Z){var c=Z}Reflect.construct(i,[],s)}else{try{s.call()}catch(Z){c=Z}i.call(s.prototype)}else{try{throw Error()}catch(Z){c=Z}i()}}catch(Z){if(Z&&c&&typeof Z.stack=="string"){for(var u=Z.stack.split(`
|
|
35
|
+
`),_=c.stack.split(`
|
|
36
|
+
`),w=u.length-1,N=_.length-1;1<=w&&0<=N&&u[w]!==_[N];)N--;for(;1<=w&&0<=N;w--,N--)if(u[w]!==_[N]){if(w!==1||N!==1)do if(w--,N--,0>N||u[w]!==_[N]){var L=`
|
|
37
|
+
`+u[w].replace(" at new "," at ");return i.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",i.displayName)),L}while(1<=w&&0<=N);break}}}finally{ce=!1,Error.prepareStackTrace=o}return(i=i?i.displayName||i.name:"")?$(i):""}function pe(i){switch(i.tag){case 5:return $(i.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return i=ue(i.type,!1),i;case 11:return i=ue(i.type.render,!1),i;case 1:return i=ue(i.type,!0),i;default:return""}}function ye(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case A:return"Fragment";case Y:return"Portal";case z:return"Profiler";case P:return"StrictMode";case B:return"Suspense";case D:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case K:return(i.displayName||"Context")+".Consumer";case O:return(i._context.displayName||"Context")+".Provider";case H:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case X:return s=i.displayName||null,s!==null?s:ye(i.type)||"Memo";case ee:s=i._payload,i=i._init;try{return ye(i(s))}catch{}}return null}function Se(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 ye(s);case 8:return s===P?"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 Ce(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ke(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Te(i){var s=ke(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 u=o.get,_=o.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.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 U(i){i._valueTracker||(i._valueTracker=Te(i))}function oe(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var o=s.getValue(),c="";return i&&(c=ke(i)?i.checked?"true":"false":i.value),i=c,i!==o?(s.setValue(i),!0):!1}function me(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function Ue(i,s){var o=s.checked;return q({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??i._wrapperState.initialChecked})}function oi(i,s){var o=s.defaultValue==null?"":s.defaultValue,c=s.checked!=null?s.checked:s.defaultChecked;o=Ce(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 _r(i,s){s=s.checked,s!=null&&W(i,"checked",s,!1)}function Cs(i,s){_r(i,s);var o=Ce(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")?Wr(i,s.type,o):s.hasOwnProperty("defaultValue")&&Wr(i,s.type,Ce(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(i.defaultChecked=!!s.defaultChecked)}function Bn(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 Wr(i,s,o){(s!=="number"||me(i.ownerDocument)!==i)&&(o==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+o&&(i.defaultValue=""+o))}var gr=Array.isArray;function $i(i,s,o,c){if(i=i.options,s){s={};for(var u=0;u<o.length;u++)s["$"+o[u]]=!0;for(o=0;o<i.length;o++)u=s.hasOwnProperty("$"+i[o].value),i[o].selected!==u&&(i[o].selected=u),u&&c&&(i[o].defaultSelected=!0)}else{for(o=""+Ce(o),s=null,u=0;u<i.length;u++){if(i[u].value===o){i[u].selected=!0,c&&(i[u].defaultSelected=!0);return}s!==null||i[u].disabled||(s=i[u])}s!==null&&(s.selected=!0)}}function bs(i,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return q({},s,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function An(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(gr(o)){if(1<o.length)throw Error(r(93));o=o[0]}s=o}s==null&&(s=""),o=s}i._wrapperState={initialValue:Ce(o)}}function $r(i,s){var o=Ce(s.value),c=Ce(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 jn(i){var s=i.textContent;s===i._wrapperState.initialValue&&s!==""&&s!==null&&(i.value=s)}function he(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 Re(i,s){return i==null||i==="http://www.w3.org/1999/xhtml"?he(s):i==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var ai,xs=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,o,c,u){MSApp.execUnsafeLocalFunction(function(){return i(s,o,c,u)})}:i})(function(i,s){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=s;else{for(ai=ai||document.createElement("div"),ai.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=ai.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;s.firstChild;)i.appendChild(s.firstChild)}});function ks(i,s){if(s){var o=i.firstChild;if(o&&o===i.lastChild&&o.nodeType===3){o.nodeValue=s;return}}i.textContent=s}var Es={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},Lg=["Webkit","ms","Moz","O"];Object.keys(Es).forEach(function(i){Lg.forEach(function(s){s=s+i.charAt(0).toUpperCase()+i.substring(1),Es[s]=Es[i]})});function vu(i,s,o){return s==null||typeof s=="boolean"||s===""?"":o||typeof s!="number"||s===0||Es.hasOwnProperty(i)&&Es[i]?(""+s).trim():s+"px"}function yu(i,s){i=i.style;for(var o in s)if(s.hasOwnProperty(o)){var c=o.indexOf("--")===0,u=vu(o,s[o],c);o==="float"&&(o="cssFloat"),c?i.setProperty(o,u):i[o]=u}}var Tg=q({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 Ra(i,s){if(s){if(Tg[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 Da(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 Ma=null;function Pa(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var La=null,Ur=null,Kr=null;function Su(i){if(i=Ys(i)){if(typeof La!="function")throw Error(r(280));var s=i.stateNode;s&&(s=no(s),La(i.stateNode,i.type,s))}}function wu(i){Ur?Kr?Kr.push(i):Kr=[i]:Ur=i}function Cu(){if(Ur){var i=Ur,s=Kr;if(Kr=Ur=null,Su(i),s)for(i=0;i<s.length;i++)Su(s[i])}}function bu(i,s){return i(s)}function xu(){}var Ta=!1;function ku(i,s,o){if(Ta)return i(s,o);Ta=!0;try{return bu(i,s,o)}finally{Ta=!1,(Ur!==null||Kr!==null)&&(xu(),Cu())}}function Ns(i,s){var o=i.stateNode;if(o===null)return null;var c=no(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 Ba=!1;if(d)try{var Rs={};Object.defineProperty(Rs,"passive",{get:function(){Ba=!0}}),window.addEventListener("test",Rs,Rs),window.removeEventListener("test",Rs,Rs)}catch{Ba=!1}function Bg(i,s,o,c,u,_,w,N,L){var Z=Array.prototype.slice.call(arguments,3);try{s.apply(o,Z)}catch(se){this.onError(se)}}var Ds=!1,In=null,On=!1,Aa=null,Ag={onError:function(i){Ds=!0,In=i}};function jg(i,s,o,c,u,_,w,N,L){Ds=!1,In=null,Bg.apply(Ag,arguments)}function Ig(i,s,o,c,u,_,w,N,L){if(jg.apply(this,arguments),Ds){if(Ds){var Z=In;Ds=!1,In=null}else throw Error(r(198));On||(On=!0,Aa=Z)}}function vr(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 Eu(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 Nu(i){if(vr(i)!==i)throw Error(r(188))}function Og(i){var s=i.alternate;if(!s){if(s=vr(i),s===null)throw Error(r(188));return s!==i?null:i}for(var o=i,c=s;;){var u=o.return;if(u===null)break;var _=u.alternate;if(_===null){if(c=u.return,c!==null){o=c;continue}break}if(u.child===_.child){for(_=u.child;_;){if(_===o)return Nu(u),i;if(_===c)return Nu(u),s;_=_.sibling}throw Error(r(188))}if(o.return!==c.return)o=u,c=_;else{for(var w=!1,N=u.child;N;){if(N===o){w=!0,o=u,c=_;break}if(N===c){w=!0,c=u,o=_;break}N=N.sibling}if(!w){for(N=_.child;N;){if(N===o){w=!0,o=_,c=u;break}if(N===c){w=!0,c=_,o=u;break}N=N.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 Ru(i){return i=Og(i),i!==null?Du(i):null}function Du(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var s=Du(i);if(s!==null)return s;i=i.sibling}return null}var Mu=t.unstable_scheduleCallback,Pu=t.unstable_cancelCallback,zg=t.unstable_shouldYield,Fg=t.unstable_requestPaint,et=t.unstable_now,Hg=t.unstable_getCurrentPriorityLevel,ja=t.unstable_ImmediatePriority,Lu=t.unstable_UserBlockingPriority,zn=t.unstable_NormalPriority,Wg=t.unstable_LowPriority,Tu=t.unstable_IdlePriority,Fn=null,gi=null;function $g(i){if(gi&&typeof gi.onCommitFiberRoot=="function")try{gi.onCommitFiberRoot(Fn,i,void 0,(i.current.flags&128)===128)}catch{}}var li=Math.clz32?Math.clz32:Vg,Ug=Math.log,Kg=Math.LN2;function Vg(i){return i>>>=0,i===0?32:31-(Ug(i)/Kg|0)|0}var Hn=64,Wn=4194304;function Ms(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 $n(i,s){var o=i.pendingLanes;if(o===0)return 0;var c=0,u=i.suspendedLanes,_=i.pingedLanes,w=o&268435455;if(w!==0){var N=w&~u;N!==0?c=Ms(N):(_&=w,_!==0&&(c=Ms(_)))}else w=o&~u,w!==0?c=Ms(w):_!==0&&(c=Ms(_));if(c===0)return 0;if(s!==0&&s!==c&&(s&u)===0&&(u=c&-c,_=s&-s,u>=_||u===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-li(s),u=1<<o,c|=i[o],s&=~u;return c}function qg(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 Yg(i,s){for(var o=i.suspendedLanes,c=i.pingedLanes,u=i.expirationTimes,_=i.pendingLanes;0<_;){var w=31-li(_),N=1<<w,L=u[w];L===-1?((N&o)===0||(N&c)!==0)&&(u[w]=qg(N,s)):L<=s&&(i.expiredLanes|=N),_&=~N}}function Ia(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function Bu(){var i=Hn;return Hn<<=1,(Hn&4194240)===0&&(Hn=64),i}function Oa(i){for(var s=[],o=0;31>o;o++)s.push(i);return s}function Ps(i,s,o){i.pendingLanes|=s,s!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,s=31-li(s),i[s]=o}function Xg(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 u=31-li(o),_=1<<u;s[u]=0,c[u]=-1,i[u]=-1,o&=~_}}function za(i,s){var o=i.entangledLanes|=s;for(i=i.entanglements;o;){var c=31-li(o),u=1<<c;u&s|i[c]&s&&(i[c]|=s),o&=~u}}var Oe=0;function Au(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var ju,Fa,Iu,Ou,zu,Ha=!1,Un=[],Ui=null,Ki=null,Vi=null,Ls=new Map,Ts=new Map,qi=[],Gg="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 Fu(i,s){switch(i){case"focusin":case"focusout":Ui=null;break;case"dragenter":case"dragleave":Ki=null;break;case"mouseover":case"mouseout":Vi=null;break;case"pointerover":case"pointerout":Ls.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ts.delete(s.pointerId)}}function Bs(i,s,o,c,u,_){return i===null||i.nativeEvent!==_?(i={blockedOn:s,domEventName:o,eventSystemFlags:c,nativeEvent:_,targetContainers:[u]},s!==null&&(s=Ys(s),s!==null&&Fa(s)),i):(i.eventSystemFlags|=c,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function Qg(i,s,o,c,u){switch(s){case"focusin":return Ui=Bs(Ui,i,s,o,c,u),!0;case"dragenter":return Ki=Bs(Ki,i,s,o,c,u),!0;case"mouseover":return Vi=Bs(Vi,i,s,o,c,u),!0;case"pointerover":var _=u.pointerId;return Ls.set(_,Bs(Ls.get(_)||null,i,s,o,c,u)),!0;case"gotpointercapture":return _=u.pointerId,Ts.set(_,Bs(Ts.get(_)||null,i,s,o,c,u)),!0}return!1}function Hu(i){var s=yr(i.target);if(s!==null){var o=vr(s);if(o!==null){if(s=o.tag,s===13){if(s=Eu(o),s!==null){i.blockedOn=s,zu(i.priority,function(){Iu(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 Kn(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var o=$a(i.domEventName,i.eventSystemFlags,s[0],i.nativeEvent);if(o===null){o=i.nativeEvent;var c=new o.constructor(o.type,o);Ma=c,o.target.dispatchEvent(c),Ma=null}else return s=Ys(o),s!==null&&Fa(s),i.blockedOn=o,!1;s.shift()}return!0}function Wu(i,s,o){Kn(i)&&o.delete(s)}function Jg(){Ha=!1,Ui!==null&&Kn(Ui)&&(Ui=null),Ki!==null&&Kn(Ki)&&(Ki=null),Vi!==null&&Kn(Vi)&&(Vi=null),Ls.forEach(Wu),Ts.forEach(Wu)}function As(i,s){i.blockedOn===s&&(i.blockedOn=null,Ha||(Ha=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Jg)))}function js(i){function s(u){return As(u,i)}if(0<Un.length){As(Un[0],i);for(var o=1;o<Un.length;o++){var c=Un[o];c.blockedOn===i&&(c.blockedOn=null)}}for(Ui!==null&&As(Ui,i),Ki!==null&&As(Ki,i),Vi!==null&&As(Vi,i),Ls.forEach(s),Ts.forEach(s),o=0;o<qi.length;o++)c=qi[o],c.blockedOn===i&&(c.blockedOn=null);for(;0<qi.length&&(o=qi[0],o.blockedOn===null);)Hu(o),o.blockedOn===null&&qi.shift()}var Vr=M.ReactCurrentBatchConfig,Vn=!0;function Zg(i,s,o,c){var u=Oe,_=Vr.transition;Vr.transition=null;try{Oe=1,Wa(i,s,o,c)}finally{Oe=u,Vr.transition=_}}function ev(i,s,o,c){var u=Oe,_=Vr.transition;Vr.transition=null;try{Oe=4,Wa(i,s,o,c)}finally{Oe=u,Vr.transition=_}}function Wa(i,s,o,c){if(Vn){var u=$a(i,s,o,c);if(u===null)ol(i,s,c,qn,o),Fu(i,c);else if(Qg(u,i,s,o,c))c.stopPropagation();else if(Fu(i,c),s&4&&-1<Gg.indexOf(i)){for(;u!==null;){var _=Ys(u);if(_!==null&&ju(_),_=$a(i,s,o,c),_===null&&ol(i,s,c,qn,o),_===u)break;u=_}u!==null&&c.stopPropagation()}else ol(i,s,c,null,o)}}var qn=null;function $a(i,s,o,c){if(qn=null,i=Pa(c),i=yr(i),i!==null)if(s=vr(i),s===null)i=null;else if(o=s.tag,o===13){if(i=Eu(s),i!==null)return i;i=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null);return qn=i,null}function $u(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(Hg()){case ja:return 1;case Lu:return 4;case zn:case Wg:return 16;case Tu:return 536870912;default:return 16}default:return 16}}var Yi=null,Ua=null,Yn=null;function Uu(){if(Yn)return Yn;var i,s=Ua,o=s.length,c,u="value"in Yi?Yi.value:Yi.textContent,_=u.length;for(i=0;i<o&&s[i]===u[i];i++);var w=o-i;for(c=1;c<=w&&s[o-c]===u[_-c];c++);return Yn=u.slice(i,1<c?1-c:void 0)}function Xn(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 Gn(){return!0}function Ku(){return!1}function $t(i){function s(o,c,u,_,w){this._reactName=o,this._targetInst=u,this.type=c,this.nativeEvent=_,this.target=w,this.currentTarget=null;for(var N in i)i.hasOwnProperty(N)&&(o=i[N],this[N]=o?o(_):_[N]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?Gn:Ku,this.isPropagationStopped=Ku,this}return q(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=Gn)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Gn)},persist:function(){},isPersistent:Gn}),s}var qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ka=$t(qr),Is=q({},qr,{view:0,detail:0}),tv=$t(Is),Va,qa,Os,Qn=q({},Is,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xa,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!==Os&&(Os&&i.type==="mousemove"?(Va=i.screenX-Os.screenX,qa=i.screenY-Os.screenY):qa=Va=0,Os=i),Va)},movementY:function(i){return"movementY"in i?i.movementY:qa}}),Vu=$t(Qn),iv=q({},Qn,{dataTransfer:0}),rv=$t(iv),sv=q({},Is,{relatedTarget:0}),Ya=$t(sv),nv=q({},qr,{animationName:0,elapsedTime:0,pseudoElement:0}),ov=$t(nv),av=q({},qr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),lv=$t(av),cv=q({},qr,{data:0}),qu=$t(cv),hv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uv={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"},dv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fv(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=dv[i])?!!s[i]:!1}function Xa(){return fv}var pv=q({},Is,{key:function(i){if(i.key){var s=hv[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Xn(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?uv[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xa,charCode:function(i){return i.type==="keypress"?Xn(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Xn(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),mv=$t(pv),_v=q({},Qn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yu=$t(_v),gv=q({},Is,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xa}),vv=$t(gv),yv=q({},qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Sv=$t(yv),wv=q({},Qn,{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}),Cv=$t(wv),bv=[9,13,27,32],Ga=d&&"CompositionEvent"in window,zs=null;d&&"documentMode"in document&&(zs=document.documentMode);var xv=d&&"TextEvent"in window&&!zs,Xu=d&&(!Ga||zs&&8<zs&&11>=zs),Gu=" ",Qu=!1;function Ju(i,s){switch(i){case"keyup":return bv.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zu(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Yr=!1;function kv(i,s){switch(i){case"compositionend":return Zu(s);case"keypress":return s.which!==32?null:(Qu=!0,Gu);case"textInput":return i=s.data,i===Gu&&Qu?null:i;default:return null}}function Ev(i,s){if(Yr)return i==="compositionend"||!Ga&&Ju(i,s)?(i=Uu(),Yn=Ua=Yi=null,Yr=!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 Xu&&s.locale!=="ko"?null:s.data;default:return null}}var Nv={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 ed(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!Nv[i.type]:s==="textarea"}function td(i,s,o,c){wu(c),s=io(s,"onChange"),0<s.length&&(o=new Ka("onChange","change",null,o,c),i.push({event:o,listeners:s}))}var Fs=null,Hs=null;function Rv(i){yd(i,0)}function Jn(i){var s=Zr(i);if(oe(s))return i}function Dv(i,s){if(i==="change")return s}var id=!1;if(d){var Qa;if(d){var Ja="oninput"in document;if(!Ja){var rd=document.createElement("div");rd.setAttribute("oninput","return;"),Ja=typeof rd.oninput=="function"}Qa=Ja}else Qa=!1;id=Qa&&(!document.documentMode||9<document.documentMode)}function sd(){Fs&&(Fs.detachEvent("onpropertychange",nd),Hs=Fs=null)}function nd(i){if(i.propertyName==="value"&&Jn(Hs)){var s=[];td(s,Hs,i,Pa(i)),ku(Rv,s)}}function Mv(i,s,o){i==="focusin"?(sd(),Fs=s,Hs=o,Fs.attachEvent("onpropertychange",nd)):i==="focusout"&&sd()}function Pv(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Jn(Hs)}function Lv(i,s){if(i==="click")return Jn(s)}function Tv(i,s){if(i==="input"||i==="change")return Jn(s)}function Bv(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var ci=typeof Object.is=="function"?Object.is:Bv;function Ws(i,s){if(ci(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 u=o[c];if(!m.call(s,u)||!ci(i[u],s[u]))return!1}return!0}function od(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function ad(i,s){var o=od(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=od(o)}}function ld(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?ld(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function cd(){for(var i=window,s=me();s instanceof i.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)i=s.contentWindow;else break;s=me(i.document)}return s}function Za(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 Av(i){var s=cd(),o=i.focusedElem,c=i.selectionRange;if(s!==o&&o&&o.ownerDocument&&ld(o.ownerDocument.documentElement,o)){if(c!==null&&Za(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 u=o.textContent.length,_=Math.min(c.start,u);c=c.end===void 0?_:Math.min(c.end,u),!i.extend&&_>c&&(u=c,c=_,_=u),u=ad(o,_);var w=ad(o,c);u&&w&&(i.rangeCount!==1||i.anchorNode!==u.node||i.anchorOffset!==u.offset||i.focusNode!==w.node||i.focusOffset!==w.offset)&&(s=s.createRange(),s.setStart(u.node,u.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=d&&"documentMode"in document&&11>=document.documentMode,Xr=null,el=null,$s=null,tl=!1;function hd(i,s,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;tl||Xr==null||Xr!==me(c)||(c=Xr,"selectionStart"in c&&Za(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}),$s&&Ws($s,c)||($s=c,c=io(el,"onSelect"),0<c.length&&(s=new Ka("onSelect","select",null,s,o),i.push({event:s,listeners:c}),s.target=Xr)))}function Zn(i,s){var o={};return o[i.toLowerCase()]=s.toLowerCase(),o["Webkit"+i]="webkit"+s,o["Moz"+i]="moz"+s,o}var Gr={animationend:Zn("Animation","AnimationEnd"),animationiteration:Zn("Animation","AnimationIteration"),animationstart:Zn("Animation","AnimationStart"),transitionend:Zn("Transition","TransitionEnd")},il={},ud={};d&&(ud=document.createElement("div").style,"AnimationEvent"in window||(delete Gr.animationend.animation,delete Gr.animationiteration.animation,delete Gr.animationstart.animation),"TransitionEvent"in window||delete Gr.transitionend.transition);function eo(i){if(il[i])return il[i];if(!Gr[i])return i;var s=Gr[i],o;for(o in s)if(s.hasOwnProperty(o)&&o in ud)return il[i]=s[o];return i}var dd=eo("animationend"),fd=eo("animationiteration"),pd=eo("animationstart"),md=eo("transitionend"),_d=new Map,gd="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 Xi(i,s){_d.set(i,s),l(s,[i])}for(var rl=0;rl<gd.length;rl++){var sl=gd[rl],Iv=sl.toLowerCase(),Ov=sl[0].toUpperCase()+sl.slice(1);Xi(Iv,"on"+Ov)}Xi(dd,"onAnimationEnd"),Xi(fd,"onAnimationIteration"),Xi(pd,"onAnimationStart"),Xi("dblclick","onDoubleClick"),Xi("focusin","onFocus"),Xi("focusout","onBlur"),Xi(md,"onTransitionEnd"),h("onMouseEnter",["mouseout","mouseover"]),h("onMouseLeave",["mouseout","mouseover"]),h("onPointerEnter",["pointerout","pointerover"]),h("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Us="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(" "),zv=new Set("cancel close invalid load scroll toggle".split(" ").concat(Us));function vd(i,s,o){var c=i.type||"unknown-event";i.currentTarget=o,Ig(c,s,void 0,i),i.currentTarget=null}function yd(i,s){s=(s&4)!==0;for(var o=0;o<i.length;o++){var c=i[o],u=c.event;c=c.listeners;e:{var _=void 0;if(s)for(var w=c.length-1;0<=w;w--){var N=c[w],L=N.instance,Z=N.currentTarget;if(N=N.listener,L!==_&&u.isPropagationStopped())break e;vd(u,N,Z),_=L}else for(w=0;w<c.length;w++){if(N=c[w],L=N.instance,Z=N.currentTarget,N=N.listener,L!==_&&u.isPropagationStopped())break e;vd(u,N,Z),_=L}}}if(On)throw i=Aa,On=!1,Aa=null,i}function He(i,s){var o=s[dl];o===void 0&&(o=s[dl]=new Set);var c=i+"__bubble";o.has(c)||(Sd(s,i,2,!1),o.add(c))}function nl(i,s,o){var c=0;s&&(c|=4),Sd(o,i,c,s)}var to="_reactListening"+Math.random().toString(36).slice(2);function Ks(i){if(!i[to]){i[to]=!0,n.forEach(function(o){o!=="selectionchange"&&(zv.has(o)||nl(o,!1,i),nl(o,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[to]||(s[to]=!0,nl("selectionchange",!1,s))}}function Sd(i,s,o,c){switch($u(s)){case 1:var u=Zg;break;case 4:u=ev;break;default:u=Wa}o=u.bind(null,s,o,i),u=void 0,!Ba||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),c?u!==void 0?i.addEventListener(s,o,{capture:!0,passive:u}):i.addEventListener(s,o,!0):u!==void 0?i.addEventListener(s,o,{passive:u}):i.addEventListener(s,o,!1)}function ol(i,s,o,c,u){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 N=c.stateNode.containerInfo;if(N===u||N.nodeType===8&&N.parentNode===u)break;if(w===4)for(w=c.return;w!==null;){var L=w.tag;if((L===3||L===4)&&(L=w.stateNode.containerInfo,L===u||L.nodeType===8&&L.parentNode===u))return;w=w.return}for(;N!==null;){if(w=yr(N),w===null)return;if(L=w.tag,L===5||L===6){c=_=w;continue e}N=N.parentNode}}c=c.return}ku(function(){var Z=_,se=Pa(o),ne=[];e:{var re=_d.get(i);if(re!==void 0){var fe=Ka,ge=i;switch(i){case"keypress":if(Xn(o)===0)break e;case"keydown":case"keyup":fe=mv;break;case"focusin":ge="focus",fe=Ya;break;case"focusout":ge="blur",fe=Ya;break;case"beforeblur":case"afterblur":fe=Ya;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=Vu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=rv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=vv;break;case dd:case fd:case pd:fe=ov;break;case md:fe=Sv;break;case"scroll":fe=tv;break;case"wheel":fe=Cv;break;case"copy":case"cut":case"paste":fe=lv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=Yu}var ve=(s&4)!==0,tt=!ve&&i==="scroll",V=ve?re!==null?re+"Capture":null:re;ve=[];for(var F=Z,G;F!==null;){G=F;var ae=G.stateNode;if(G.tag===5&&ae!==null&&(G=ae,V!==null&&(ae=Ns(F,V),ae!=null&&ve.push(Vs(F,ae,G)))),tt)break;F=F.return}0<ve.length&&(re=new fe(re,ge,null,o,se),ne.push({event:re,listeners:ve}))}}if((s&7)===0){e:{if(re=i==="mouseover"||i==="pointerover",fe=i==="mouseout"||i==="pointerout",re&&o!==Ma&&(ge=o.relatedTarget||o.fromElement)&&(yr(ge)||ge[Mi]))break e;if((fe||re)&&(re=se.window===se?se:(re=se.ownerDocument)?re.defaultView||re.parentWindow:window,fe?(ge=o.relatedTarget||o.toElement,fe=Z,ge=ge?yr(ge):null,ge!==null&&(tt=vr(ge),ge!==tt||ge.tag!==5&&ge.tag!==6)&&(ge=null)):(fe=null,ge=Z),fe!==ge)){if(ve=Vu,ae="onMouseLeave",V="onMouseEnter",F="mouse",(i==="pointerout"||i==="pointerover")&&(ve=Yu,ae="onPointerLeave",V="onPointerEnter",F="pointer"),tt=fe==null?re:Zr(fe),G=ge==null?re:Zr(ge),re=new ve(ae,F+"leave",fe,o,se),re.target=tt,re.relatedTarget=G,ae=null,yr(se)===Z&&(ve=new ve(V,F+"enter",ge,o,se),ve.target=G,ve.relatedTarget=tt,ae=ve),tt=ae,fe&&ge)t:{for(ve=fe,V=ge,F=0,G=ve;G;G=Qr(G))F++;for(G=0,ae=V;ae;ae=Qr(ae))G++;for(;0<F-G;)ve=Qr(ve),F--;for(;0<G-F;)V=Qr(V),G--;for(;F--;){if(ve===V||V!==null&&ve===V.alternate)break t;ve=Qr(ve),V=Qr(V)}ve=null}else ve=null;fe!==null&&wd(ne,re,fe,ve,!1),ge!==null&&tt!==null&&wd(ne,tt,ge,ve,!0)}}e:{if(re=Z?Zr(Z):window,fe=re.nodeName&&re.nodeName.toLowerCase(),fe==="select"||fe==="input"&&re.type==="file")var we=Dv;else if(ed(re))if(id)we=Tv;else{we=Pv;var be=Mv}else(fe=re.nodeName)&&fe.toLowerCase()==="input"&&(re.type==="checkbox"||re.type==="radio")&&(we=Lv);if(we&&(we=we(i,Z))){td(ne,we,o,se);break e}be&&be(i,re,Z),i==="focusout"&&(be=re._wrapperState)&&be.controlled&&re.type==="number"&&Wr(re,"number",re.value)}switch(be=Z?Zr(Z):window,i){case"focusin":(ed(be)||be.contentEditable==="true")&&(Xr=be,el=Z,$s=null);break;case"focusout":$s=el=Xr=null;break;case"mousedown":tl=!0;break;case"contextmenu":case"mouseup":case"dragend":tl=!1,hd(ne,o,se);break;case"selectionchange":if(jv)break;case"keydown":case"keyup":hd(ne,o,se)}var xe;if(Ga)e:{switch(i){case"compositionstart":var Ee="onCompositionStart";break e;case"compositionend":Ee="onCompositionEnd";break e;case"compositionupdate":Ee="onCompositionUpdate";break e}Ee=void 0}else Yr?Ju(i,o)&&(Ee="onCompositionEnd"):i==="keydown"&&o.keyCode===229&&(Ee="onCompositionStart");Ee&&(Xu&&o.locale!=="ko"&&(Yr||Ee!=="onCompositionStart"?Ee==="onCompositionEnd"&&Yr&&(xe=Uu()):(Yi=se,Ua="value"in Yi?Yi.value:Yi.textContent,Yr=!0)),be=io(Z,Ee),0<be.length&&(Ee=new qu(Ee,i,null,o,se),ne.push({event:Ee,listeners:be}),xe?Ee.data=xe:(xe=Zu(o),xe!==null&&(Ee.data=xe)))),(xe=xv?kv(i,o):Ev(i,o))&&(Z=io(Z,"onBeforeInput"),0<Z.length&&(se=new qu("onBeforeInput","beforeinput",null,o,se),ne.push({event:se,listeners:Z}),se.data=xe))}yd(ne,s)})}function Vs(i,s,o){return{instance:i,listener:s,currentTarget:o}}function io(i,s){for(var o=s+"Capture",c=[];i!==null;){var u=i,_=u.stateNode;u.tag===5&&_!==null&&(u=_,_=Ns(i,o),_!=null&&c.unshift(Vs(i,_,u)),_=Ns(i,s),_!=null&&c.push(Vs(i,_,u))),i=i.return}return c}function Qr(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function wd(i,s,o,c,u){for(var _=s._reactName,w=[];o!==null&&o!==c;){var N=o,L=N.alternate,Z=N.stateNode;if(L!==null&&L===c)break;N.tag===5&&Z!==null&&(N=Z,u?(L=Ns(o,_),L!=null&&w.unshift(Vs(o,L,N))):u||(L=Ns(o,_),L!=null&&w.push(Vs(o,L,N)))),o=o.return}w.length!==0&&i.push({event:s,listeners:w})}var Fv=/\r\n?/g,Hv=/\u0000|\uFFFD/g;function Cd(i){return(typeof i=="string"?i:""+i).replace(Fv,`
|
|
38
|
+
`).replace(Hv,"")}function ro(i,s,o){if(s=Cd(s),Cd(i)!==s&&o)throw Error(r(425))}function so(){}var al=null,ll=null;function cl(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 hl=typeof setTimeout=="function"?setTimeout:void 0,Wv=typeof clearTimeout=="function"?clearTimeout:void 0,bd=typeof Promise=="function"?Promise:void 0,$v=typeof queueMicrotask=="function"?queueMicrotask:typeof bd<"u"?function(i){return bd.resolve(null).then(i).catch(Uv)}:hl;function Uv(i){setTimeout(function(){throw i})}function ul(i,s){var o=s,c=0;do{var u=o.nextSibling;if(i.removeChild(o),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(c===0){i.removeChild(u),js(s);return}c--}else o!=="$"&&o!=="$?"&&o!=="$!"||c++;o=u}while(o);js(s)}function Gi(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 xd(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 Jr=Math.random().toString(36).slice(2),vi="__reactFiber$"+Jr,qs="__reactProps$"+Jr,Mi="__reactContainer$"+Jr,dl="__reactEvents$"+Jr,Kv="__reactListeners$"+Jr,Vv="__reactHandles$"+Jr;function yr(i){var s=i[vi];if(s)return s;for(var o=i.parentNode;o;){if(s=o[Mi]||o[vi]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(i=xd(i);i!==null;){if(o=i[vi])return o;i=xd(i)}return s}i=o,o=i.parentNode}return null}function Ys(i){return i=i[vi]||i[Mi],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function Zr(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(r(33))}function no(i){return i[qs]||null}var fl=[],es=-1;function Qi(i){return{current:i}}function We(i){0>es||(i.current=fl[es],fl[es]=null,es--)}function Fe(i,s){es++,fl[es]=i.current,i.current=s}var Ji={},xt=Qi(Ji),Bt=Qi(!1),Sr=Ji;function ts(i,s){var o=i.type.contextTypes;if(!o)return Ji;var c=i.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===s)return c.__reactInternalMemoizedMaskedChildContext;var u={},_;for(_ in o)u[_]=s[_];return c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=s,i.__reactInternalMemoizedMaskedChildContext=u),u}function At(i){return i=i.childContextTypes,i!=null}function oo(){We(Bt),We(xt)}function kd(i,s,o){if(xt.current!==Ji)throw Error(r(168));Fe(xt,s),Fe(Bt,o)}function Ed(i,s,o){var c=i.stateNode;if(s=s.childContextTypes,typeof c.getChildContext!="function")return o;c=c.getChildContext();for(var u in c)if(!(u in s))throw Error(r(108,Se(i)||"Unknown",u));return q({},o,c)}function ao(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Ji,Sr=xt.current,Fe(xt,i),Fe(Bt,Bt.current),!0}function Nd(i,s,o){var c=i.stateNode;if(!c)throw Error(r(169));o?(i=Ed(i,s,Sr),c.__reactInternalMemoizedMergedChildContext=i,We(Bt),We(xt),Fe(xt,i)):We(Bt),Fe(Bt,o)}var Pi=null,lo=!1,pl=!1;function Rd(i){Pi===null?Pi=[i]:Pi.push(i)}function qv(i){lo=!0,Rd(i)}function Zi(){if(!pl&&Pi!==null){pl=!0;var i=0,s=Oe;try{var o=Pi;for(Oe=1;i<o.length;i++){var c=o[i];do c=c(!0);while(c!==null)}Pi=null,lo=!1}catch(u){throw Pi!==null&&(Pi=Pi.slice(i+1)),Mu(ja,Zi),u}finally{Oe=s,pl=!1}}return null}var is=[],rs=0,co=null,ho=0,Gt=[],Qt=0,wr=null,Li=1,Ti="";function Cr(i,s){is[rs++]=ho,is[rs++]=co,co=i,ho=s}function Dd(i,s,o){Gt[Qt++]=Li,Gt[Qt++]=Ti,Gt[Qt++]=wr,wr=i;var c=Li;i=Ti;var u=32-li(c)-1;c&=~(1<<u),o+=1;var _=32-li(s)+u;if(30<_){var w=u-u%5;_=(c&(1<<w)-1).toString(32),c>>=w,u-=w,Li=1<<32-li(s)+u|o<<u|c,Ti=_+i}else Li=1<<_|o<<u|c,Ti=i}function ml(i){i.return!==null&&(Cr(i,1),Dd(i,1,0))}function _l(i){for(;i===co;)co=is[--rs],is[rs]=null,ho=is[--rs],is[rs]=null;for(;i===wr;)wr=Gt[--Qt],Gt[Qt]=null,Ti=Gt[--Qt],Gt[Qt]=null,Li=Gt[--Qt],Gt[Qt]=null}var Ut=null,Kt=null,Ke=!1,hi=null;function Md(i,s){var o=ti(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 Pd(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,Ut=i,Kt=Gi(s.firstChild),!0):!1;case 6:return s=i.pendingProps===""||s.nodeType!==3?null:s,s!==null?(i.stateNode=s,Ut=i,Kt=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(o=wr!==null?{id:Li,overflow:Ti}:null,i.memoizedState={dehydrated:s,treeContext:o,retryLane:1073741824},o=ti(18,null,null,0),o.stateNode=s,o.return=i,i.child=o,Ut=i,Kt=null,!0):!1;default:return!1}}function gl(i){return(i.mode&1)!==0&&(i.flags&128)===0}function vl(i){if(Ke){var s=Kt;if(s){var o=s;if(!Pd(i,s)){if(gl(i))throw Error(r(418));s=Gi(o.nextSibling);var c=Ut;s&&Pd(i,s)?Md(c,o):(i.flags=i.flags&-4097|2,Ke=!1,Ut=i)}}else{if(gl(i))throw Error(r(418));i.flags=i.flags&-4097|2,Ke=!1,Ut=i}}}function Ld(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;Ut=i}function uo(i){if(i!==Ut)return!1;if(!Ke)return Ld(i),Ke=!0,!1;var s;if((s=i.tag!==3)&&!(s=i.tag!==5)&&(s=i.type,s=s!=="head"&&s!=="body"&&!cl(i.type,i.memoizedProps)),s&&(s=Kt)){if(gl(i))throw Td(),Error(r(418));for(;s;)Md(i,s),s=Gi(s.nextSibling)}if(Ld(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){Kt=Gi(i.nextSibling);break e}s--}else o!=="$"&&o!=="$!"&&o!=="$?"||s++}i=i.nextSibling}Kt=null}}else Kt=Ut?Gi(i.stateNode.nextSibling):null;return!0}function Td(){for(var i=Kt;i;)i=Gi(i.nextSibling)}function ss(){Kt=Ut=null,Ke=!1}function yl(i){hi===null?hi=[i]:hi.push(i)}var Yv=M.ReactCurrentBatchConfig;function Xs(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 u=c,_=""+i;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===_?s.ref:(s=function(w){var N=u.refs;w===null?delete N[_]:N[_]=w},s._stringRef=_,s)}if(typeof i!="string")throw Error(r(284));if(!o._owner)throw Error(r(290,i))}return i}function fo(i,s){throw i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i))}function Bd(i){var s=i._init;return s(i._payload)}function Ad(i){function s(V,F){if(i){var G=V.deletions;G===null?(V.deletions=[F],V.flags|=16):G.push(F)}}function o(V,F){if(!i)return null;for(;F!==null;)s(V,F),F=F.sibling;return null}function c(V,F){for(V=new Map;F!==null;)F.key!==null?V.set(F.key,F):V.set(F.index,F),F=F.sibling;return V}function u(V,F){return V=ar(V,F),V.index=0,V.sibling=null,V}function _(V,F,G){return V.index=G,i?(G=V.alternate,G!==null?(G=G.index,G<F?(V.flags|=2,F):G):(V.flags|=2,F)):(V.flags|=1048576,F)}function w(V){return i&&V.alternate===null&&(V.flags|=2),V}function N(V,F,G,ae){return F===null||F.tag!==6?(F=hc(G,V.mode,ae),F.return=V,F):(F=u(F,G),F.return=V,F)}function L(V,F,G,ae){var we=G.type;return we===A?se(V,F,G.props.children,ae,G.key):F!==null&&(F.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===ee&&Bd(we)===F.type)?(ae=u(F,G.props),ae.ref=Xs(V,F,G),ae.return=V,ae):(ae=Io(G.type,G.key,G.props,null,V.mode,ae),ae.ref=Xs(V,F,G),ae.return=V,ae)}function Z(V,F,G,ae){return F===null||F.tag!==4||F.stateNode.containerInfo!==G.containerInfo||F.stateNode.implementation!==G.implementation?(F=uc(G,V.mode,ae),F.return=V,F):(F=u(F,G.children||[]),F.return=V,F)}function se(V,F,G,ae,we){return F===null||F.tag!==7?(F=Mr(G,V.mode,ae,we),F.return=V,F):(F=u(F,G),F.return=V,F)}function ne(V,F,G){if(typeof F=="string"&&F!==""||typeof F=="number")return F=hc(""+F,V.mode,G),F.return=V,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case J:return G=Io(F.type,F.key,F.props,null,V.mode,G),G.ref=Xs(V,null,F),G.return=V,G;case Y:return F=uc(F,V.mode,G),F.return=V,F;case ee:var ae=F._init;return ne(V,ae(F._payload),G)}if(gr(F)||Q(F))return F=Mr(F,V.mode,G,null),F.return=V,F;fo(V,F)}return null}function re(V,F,G,ae){var we=F!==null?F.key:null;if(typeof G=="string"&&G!==""||typeof G=="number")return we!==null?null:N(V,F,""+G,ae);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case J:return G.key===we?L(V,F,G,ae):null;case Y:return G.key===we?Z(V,F,G,ae):null;case ee:return we=G._init,re(V,F,we(G._payload),ae)}if(gr(G)||Q(G))return we!==null?null:se(V,F,G,ae,null);fo(V,G)}return null}function fe(V,F,G,ae,we){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return V=V.get(G)||null,N(F,V,""+ae,we);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case J:return V=V.get(ae.key===null?G:ae.key)||null,L(F,V,ae,we);case Y:return V=V.get(ae.key===null?G:ae.key)||null,Z(F,V,ae,we);case ee:var be=ae._init;return fe(V,F,G,be(ae._payload),we)}if(gr(ae)||Q(ae))return V=V.get(G)||null,se(F,V,ae,we,null);fo(F,ae)}return null}function ge(V,F,G,ae){for(var we=null,be=null,xe=F,Ee=F=0,ft=null;xe!==null&&Ee<G.length;Ee++){xe.index>Ee?(ft=xe,xe=null):ft=xe.sibling;var je=re(V,xe,G[Ee],ae);if(je===null){xe===null&&(xe=ft);break}i&&xe&&je.alternate===null&&s(V,xe),F=_(je,F,Ee),be===null?we=je:be.sibling=je,be=je,xe=ft}if(Ee===G.length)return o(V,xe),Ke&&Cr(V,Ee),we;if(xe===null){for(;Ee<G.length;Ee++)xe=ne(V,G[Ee],ae),xe!==null&&(F=_(xe,F,Ee),be===null?we=xe:be.sibling=xe,be=xe);return Ke&&Cr(V,Ee),we}for(xe=c(V,xe);Ee<G.length;Ee++)ft=fe(xe,V,Ee,G[Ee],ae),ft!==null&&(i&&ft.alternate!==null&&xe.delete(ft.key===null?Ee:ft.key),F=_(ft,F,Ee),be===null?we=ft:be.sibling=ft,be=ft);return i&&xe.forEach(function(lr){return s(V,lr)}),Ke&&Cr(V,Ee),we}function ve(V,F,G,ae){var we=Q(G);if(typeof we!="function")throw Error(r(150));if(G=we.call(G),G==null)throw Error(r(151));for(var be=we=null,xe=F,Ee=F=0,ft=null,je=G.next();xe!==null&&!je.done;Ee++,je=G.next()){xe.index>Ee?(ft=xe,xe=null):ft=xe.sibling;var lr=re(V,xe,je.value,ae);if(lr===null){xe===null&&(xe=ft);break}i&&xe&&lr.alternate===null&&s(V,xe),F=_(lr,F,Ee),be===null?we=lr:be.sibling=lr,be=lr,xe=ft}if(je.done)return o(V,xe),Ke&&Cr(V,Ee),we;if(xe===null){for(;!je.done;Ee++,je=G.next())je=ne(V,je.value,ae),je!==null&&(F=_(je,F,Ee),be===null?we=je:be.sibling=je,be=je);return Ke&&Cr(V,Ee),we}for(xe=c(V,xe);!je.done;Ee++,je=G.next())je=fe(xe,V,Ee,je.value,ae),je!==null&&(i&&je.alternate!==null&&xe.delete(je.key===null?Ee:je.key),F=_(je,F,Ee),be===null?we=je:be.sibling=je,be=je);return i&&xe.forEach(function(Ny){return s(V,Ny)}),Ke&&Cr(V,Ee),we}function tt(V,F,G,ae){if(typeof G=="object"&&G!==null&&G.type===A&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case J:e:{for(var we=G.key,be=F;be!==null;){if(be.key===we){if(we=G.type,we===A){if(be.tag===7){o(V,be.sibling),F=u(be,G.props.children),F.return=V,V=F;break e}}else if(be.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===ee&&Bd(we)===be.type){o(V,be.sibling),F=u(be,G.props),F.ref=Xs(V,be,G),F.return=V,V=F;break e}o(V,be);break}else s(V,be);be=be.sibling}G.type===A?(F=Mr(G.props.children,V.mode,ae,G.key),F.return=V,V=F):(ae=Io(G.type,G.key,G.props,null,V.mode,ae),ae.ref=Xs(V,F,G),ae.return=V,V=ae)}return w(V);case Y:e:{for(be=G.key;F!==null;){if(F.key===be)if(F.tag===4&&F.stateNode.containerInfo===G.containerInfo&&F.stateNode.implementation===G.implementation){o(V,F.sibling),F=u(F,G.children||[]),F.return=V,V=F;break e}else{o(V,F);break}else s(V,F);F=F.sibling}F=uc(G,V.mode,ae),F.return=V,V=F}return w(V);case ee:return be=G._init,tt(V,F,be(G._payload),ae)}if(gr(G))return ge(V,F,G,ae);if(Q(G))return ve(V,F,G,ae);fo(V,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,F!==null&&F.tag===6?(o(V,F.sibling),F=u(F,G),F.return=V,V=F):(o(V,F),F=hc(G,V.mode,ae),F.return=V,V=F),w(V)):o(V,F)}return tt}var ns=Ad(!0),jd=Ad(!1),po=Qi(null),mo=null,os=null,Sl=null;function wl(){Sl=os=mo=null}function Cl(i){var s=po.current;We(po),i._currentValue=s}function bl(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 as(i,s){mo=i,Sl=os=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&s)!==0&&(jt=!0),i.firstContext=null)}function Jt(i){var s=i._currentValue;if(Sl!==i)if(i={context:i,memoizedValue:s,next:null},os===null){if(mo===null)throw Error(r(308));os=i,mo.dependencies={lanes:0,firstContext:i}}else os=os.next=i;return s}var br=null;function xl(i){br===null?br=[i]:br.push(i)}function Id(i,s,o,c){var u=s.interleaved;return u===null?(o.next=o,xl(s)):(o.next=u.next,u.next=o),s.interleaved=o,Bi(i,c)}function Bi(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 er=!1;function kl(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Od(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 Ai(i,s){return{eventTime:i,lane:s,tag:0,payload:null,callback:null,next:null}}function tr(i,s,o){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,(Ae&2)!==0){var u=c.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),c.pending=s,Bi(i,o)}return u=c.interleaved,u===null?(s.next=s,xl(c)):(s.next=u.next,u.next=s),c.interleaved=s,Bi(i,o)}function _o(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,za(i,o)}}function zd(i,s){var o=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var u=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?u=_=w:_=_.next=w,o=o.next}while(o!==null);_===null?u=_=s:_=_.next=s}else u=_=s;o={baseState:c.baseState,firstBaseUpdate:u,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 go(i,s,o,c){var u=i.updateQueue;er=!1;var _=u.firstBaseUpdate,w=u.lastBaseUpdate,N=u.shared.pending;if(N!==null){u.shared.pending=null;var L=N,Z=L.next;L.next=null,w===null?_=Z:w.next=Z,w=L;var se=i.alternate;se!==null&&(se=se.updateQueue,N=se.lastBaseUpdate,N!==w&&(N===null?se.firstBaseUpdate=Z:N.next=Z,se.lastBaseUpdate=L))}if(_!==null){var ne=u.baseState;w=0,se=Z=L=null,N=_;do{var re=N.lane,fe=N.eventTime;if((c&re)===re){se!==null&&(se=se.next={eventTime:fe,lane:0,tag:N.tag,payload:N.payload,callback:N.callback,next:null});e:{var ge=i,ve=N;switch(re=s,fe=o,ve.tag){case 1:if(ge=ve.payload,typeof ge=="function"){ne=ge.call(fe,ne,re);break e}ne=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=ve.payload,re=typeof ge=="function"?ge.call(fe,ne,re):ge,re==null)break e;ne=q({},ne,re);break e;case 2:er=!0}}N.callback!==null&&N.lane!==0&&(i.flags|=64,re=u.effects,re===null?u.effects=[N]:re.push(N))}else fe={eventTime:fe,lane:re,tag:N.tag,payload:N.payload,callback:N.callback,next:null},se===null?(Z=se=fe,L=ne):se=se.next=fe,w|=re;if(N=N.next,N===null){if(N=u.shared.pending,N===null)break;re=N,N=re.next,re.next=null,u.lastBaseUpdate=re,u.shared.pending=null}}while(!0);if(se===null&&(L=ne),u.baseState=L,u.firstBaseUpdate=Z,u.lastBaseUpdate=se,s=u.shared.interleaved,s!==null){u=s;do w|=u.lane,u=u.next;while(u!==s)}else _===null&&(u.shared.lanes=0);Er|=w,i.lanes=w,i.memoizedState=ne}}function Fd(i,s,o){if(i=s.effects,s.effects=null,i!==null)for(s=0;s<i.length;s++){var c=i[s],u=c.callback;if(u!==null){if(c.callback=null,c=o,typeof u!="function")throw Error(r(191,u));u.call(c)}}}var Gs={},yi=Qi(Gs),Qs=Qi(Gs),Js=Qi(Gs);function xr(i){if(i===Gs)throw Error(r(174));return i}function El(i,s){switch(Fe(Js,s),Fe(Qs,i),Fe(yi,Gs),i=s.nodeType,i){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:Re(null,"");break;default:i=i===8?s.parentNode:s,s=i.namespaceURI||null,i=i.tagName,s=Re(s,i)}We(yi),Fe(yi,s)}function ls(){We(yi),We(Qs),We(Js)}function Hd(i){xr(Js.current);var s=xr(yi.current),o=Re(s,i.type);s!==o&&(Fe(Qs,i),Fe(yi,o))}function Nl(i){Qs.current===i&&(We(yi),We(Qs))}var qe=Qi(0);function vo(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 Rl=[];function Dl(){for(var i=0;i<Rl.length;i++)Rl[i]._workInProgressVersionPrimary=null;Rl.length=0}var yo=M.ReactCurrentDispatcher,Ml=M.ReactCurrentBatchConfig,kr=0,Ye=null,ot=null,ut=null,So=!1,Zs=!1,en=0,Xv=0;function kt(){throw Error(r(321))}function Pl(i,s){if(s===null)return!1;for(var o=0;o<s.length&&o<i.length;o++)if(!ci(i[o],s[o]))return!1;return!0}function Ll(i,s,o,c,u,_){if(kr=_,Ye=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,yo.current=i===null||i.memoizedState===null?Zv:ey,i=o(c,u),Zs){_=0;do{if(Zs=!1,en=0,25<=_)throw Error(r(301));_+=1,ut=ot=null,s.updateQueue=null,yo.current=ty,i=o(c,u)}while(Zs)}if(yo.current=bo,s=ot!==null&&ot.next!==null,kr=0,ut=ot=Ye=null,So=!1,s)throw Error(r(300));return i}function Tl(){var i=en!==0;return en=0,i}function Si(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ut===null?Ye.memoizedState=ut=i:ut=ut.next=i,ut}function Zt(){if(ot===null){var i=Ye.alternate;i=i!==null?i.memoizedState:null}else i=ot.next;var s=ut===null?Ye.memoizedState:ut.next;if(s!==null)ut=s,ot=i;else{if(i===null)throw Error(r(310));ot=i,i={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},ut===null?Ye.memoizedState=ut=i:ut=ut.next=i}return ut}function tn(i,s){return typeof s=="function"?s(i):s}function Bl(i){var s=Zt(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var c=ot,u=c.baseQueue,_=o.pending;if(_!==null){if(u!==null){var w=u.next;u.next=_.next,_.next=w}c.baseQueue=u=_,o.pending=null}if(u!==null){_=u.next,c=c.baseState;var N=w=null,L=null,Z=_;do{var se=Z.lane;if((kr&se)===se)L!==null&&(L=L.next={lane:0,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),c=Z.hasEagerState?Z.eagerState:i(c,Z.action);else{var ne={lane:se,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null};L===null?(N=L=ne,w=c):L=L.next=ne,Ye.lanes|=se,Er|=se}Z=Z.next}while(Z!==null&&Z!==_);L===null?w=c:L.next=N,ci(c,s.memoizedState)||(jt=!0),s.memoizedState=c,s.baseState=w,s.baseQueue=L,o.lastRenderedState=c}if(i=o.interleaved,i!==null){u=i;do _=u.lane,Ye.lanes|=_,Er|=_,u=u.next;while(u!==i)}else u===null&&(o.lanes=0);return[s.memoizedState,o.dispatch]}function Al(i){var s=Zt(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var c=o.dispatch,u=o.pending,_=s.memoizedState;if(u!==null){o.pending=null;var w=u=u.next;do _=i(_,w.action),w=w.next;while(w!==u);ci(_,s.memoizedState)||(jt=!0),s.memoizedState=_,s.baseQueue===null&&(s.baseState=_),o.lastRenderedState=_}return[_,c]}function Wd(){}function $d(i,s){var o=Ye,c=Zt(),u=s(),_=!ci(c.memoizedState,u);if(_&&(c.memoizedState=u,jt=!0),c=c.queue,jl(Vd.bind(null,o,c,i),[i]),c.getSnapshot!==s||_||ut!==null&&ut.memoizedState.tag&1){if(o.flags|=2048,rn(9,Kd.bind(null,o,c,u,s),void 0,null),dt===null)throw Error(r(349));(kr&30)!==0||Ud(o,s,u)}return u}function Ud(i,s,o){i.flags|=16384,i={getSnapshot:s,value:o},s=Ye.updateQueue,s===null?(s={lastEffect:null,stores:null},Ye.updateQueue=s,s.stores=[i]):(o=s.stores,o===null?s.stores=[i]:o.push(i))}function Kd(i,s,o,c){s.value=o,s.getSnapshot=c,qd(s)&&Yd(i)}function Vd(i,s,o){return o(function(){qd(s)&&Yd(i)})}function qd(i){var s=i.getSnapshot;i=i.value;try{var o=s();return!ci(i,o)}catch{return!0}}function Yd(i){var s=Bi(i,1);s!==null&&pi(s,i,1,-1)}function Xd(i){var s=Si();return typeof i=="function"&&(i=i()),s.memoizedState=s.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:i},s.queue=i,i=i.dispatch=Jv.bind(null,Ye,i),[s.memoizedState,i]}function rn(i,s,o,c){return i={tag:i,create:s,destroy:o,deps:c,next:null},s=Ye.updateQueue,s===null?(s={lastEffect:null,stores:null},Ye.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 Gd(){return Zt().memoizedState}function wo(i,s,o,c){var u=Si();Ye.flags|=i,u.memoizedState=rn(1|s,o,void 0,c===void 0?null:c)}function Co(i,s,o,c){var u=Zt();c=c===void 0?null:c;var _=void 0;if(ot!==null){var w=ot.memoizedState;if(_=w.destroy,c!==null&&Pl(c,w.deps)){u.memoizedState=rn(s,o,_,c);return}}Ye.flags|=i,u.memoizedState=rn(1|s,o,_,c)}function Qd(i,s){return wo(8390656,8,i,s)}function jl(i,s){return Co(2048,8,i,s)}function Jd(i,s){return Co(4,2,i,s)}function Zd(i,s){return Co(4,4,i,s)}function ef(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 tf(i,s,o){return o=o!=null?o.concat([i]):null,Co(4,4,ef.bind(null,s,i),o)}function Il(){}function rf(i,s){var o=Zt();s=s===void 0?null:s;var c=o.memoizedState;return c!==null&&s!==null&&Pl(s,c[1])?c[0]:(o.memoizedState=[i,s],i)}function sf(i,s){var o=Zt();s=s===void 0?null:s;var c=o.memoizedState;return c!==null&&s!==null&&Pl(s,c[1])?c[0]:(i=i(),o.memoizedState=[i,s],i)}function nf(i,s,o){return(kr&21)===0?(i.baseState&&(i.baseState=!1,jt=!0),i.memoizedState=o):(ci(o,s)||(o=Bu(),Ye.lanes|=o,Er|=o,i.baseState=!0),s)}function Gv(i,s){var o=Oe;Oe=o!==0&&4>o?o:4,i(!0);var c=Ml.transition;Ml.transition={};try{i(!1),s()}finally{Oe=o,Ml.transition=c}}function of(){return Zt().memoizedState}function Qv(i,s,o){var c=nr(i);if(o={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null},af(i))lf(s,o);else if(o=Id(i,s,o,c),o!==null){var u=Mt();pi(o,i,c,u),cf(o,s,c)}}function Jv(i,s,o){var c=nr(i),u={lane:c,action:o,hasEagerState:!1,eagerState:null,next:null};if(af(i))lf(s,u);else{var _=i.alternate;if(i.lanes===0&&(_===null||_.lanes===0)&&(_=s.lastRenderedReducer,_!==null))try{var w=s.lastRenderedState,N=_(w,o);if(u.hasEagerState=!0,u.eagerState=N,ci(N,w)){var L=s.interleaved;L===null?(u.next=u,xl(s)):(u.next=L.next,L.next=u),s.interleaved=u;return}}catch{}finally{}o=Id(i,s,u,c),o!==null&&(u=Mt(),pi(o,i,c,u),cf(o,s,c))}}function af(i){var s=i.alternate;return i===Ye||s!==null&&s===Ye}function lf(i,s){Zs=So=!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,za(i,o)}}var bo={readContext:Jt,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useInsertionEffect:kt,useLayoutEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useMutableSource:kt,useSyncExternalStore:kt,useId:kt,unstable_isNewReconciler:!1},Zv={readContext:Jt,useCallback:function(i,s){return Si().memoizedState=[i,s===void 0?null:s],i},useContext:Jt,useEffect:Qd,useImperativeHandle:function(i,s,o){return o=o!=null?o.concat([i]):null,wo(4194308,4,ef.bind(null,s,i),o)},useLayoutEffect:function(i,s){return wo(4194308,4,i,s)},useInsertionEffect:function(i,s){return wo(4,2,i,s)},useMemo:function(i,s){var o=Si();return s=s===void 0?null:s,i=i(),o.memoizedState=[i,s],i},useReducer:function(i,s,o){var c=Si();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=Qv.bind(null,Ye,i),[c.memoizedState,i]},useRef:function(i){var s=Si();return i={current:i},s.memoizedState=i},useState:Xd,useDebugValue:Il,useDeferredValue:function(i){return Si().memoizedState=i},useTransition:function(){var i=Xd(!1),s=i[0];return i=Gv.bind(null,i[1]),Si().memoizedState=i,[s,i]},useMutableSource:function(){},useSyncExternalStore:function(i,s,o){var c=Ye,u=Si();if(Ke){if(o===void 0)throw Error(r(407));o=o()}else{if(o=s(),dt===null)throw Error(r(349));(kr&30)!==0||Ud(c,s,o)}u.memoizedState=o;var _={value:o,getSnapshot:s};return u.queue=_,Qd(Vd.bind(null,c,_,i),[i]),c.flags|=2048,rn(9,Kd.bind(null,c,_,o,s),void 0,null),o},useId:function(){var i=Si(),s=dt.identifierPrefix;if(Ke){var o=Ti,c=Li;o=(c&~(1<<32-li(c)-1)).toString(32)+o,s=":"+s+"R"+o,o=en++,0<o&&(s+="H"+o.toString(32)),s+=":"}else o=Xv++,s=":"+s+"r"+o.toString(32)+":";return i.memoizedState=s},unstable_isNewReconciler:!1},ey={readContext:Jt,useCallback:rf,useContext:Jt,useEffect:jl,useImperativeHandle:tf,useInsertionEffect:Jd,useLayoutEffect:Zd,useMemo:sf,useReducer:Bl,useRef:Gd,useState:function(){return Bl(tn)},useDebugValue:Il,useDeferredValue:function(i){var s=Zt();return nf(s,ot.memoizedState,i)},useTransition:function(){var i=Bl(tn)[0],s=Zt().memoizedState;return[i,s]},useMutableSource:Wd,useSyncExternalStore:$d,useId:of,unstable_isNewReconciler:!1},ty={readContext:Jt,useCallback:rf,useContext:Jt,useEffect:jl,useImperativeHandle:tf,useInsertionEffect:Jd,useLayoutEffect:Zd,useMemo:sf,useReducer:Al,useRef:Gd,useState:function(){return Al(tn)},useDebugValue:Il,useDeferredValue:function(i){var s=Zt();return ot===null?s.memoizedState=i:nf(s,ot.memoizedState,i)},useTransition:function(){var i=Al(tn)[0],s=Zt().memoizedState;return[i,s]},useMutableSource:Wd,useSyncExternalStore:$d,useId:of,unstable_isNewReconciler:!1};function ui(i,s){if(i&&i.defaultProps){s=q({},s),i=i.defaultProps;for(var o in i)s[o]===void 0&&(s[o]=i[o]);return s}return s}function Ol(i,s,o,c){s=i.memoizedState,o=o(c,s),o=o==null?s:q({},s,o),i.memoizedState=o,i.lanes===0&&(i.updateQueue.baseState=o)}var xo={isMounted:function(i){return(i=i._reactInternals)?vr(i)===i:!1},enqueueSetState:function(i,s,o){i=i._reactInternals;var c=Mt(),u=nr(i),_=Ai(c,u);_.payload=s,o!=null&&(_.callback=o),s=tr(i,_,u),s!==null&&(pi(s,i,u,c),_o(s,i,u))},enqueueReplaceState:function(i,s,o){i=i._reactInternals;var c=Mt(),u=nr(i),_=Ai(c,u);_.tag=1,_.payload=s,o!=null&&(_.callback=o),s=tr(i,_,u),s!==null&&(pi(s,i,u,c),_o(s,i,u))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var o=Mt(),c=nr(i),u=Ai(o,c);u.tag=2,s!=null&&(u.callback=s),s=tr(i,u,c),s!==null&&(pi(s,i,c,o),_o(s,i,c))}};function hf(i,s,o,c,u,_,w){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,_,w):s.prototype&&s.prototype.isPureReactComponent?!Ws(o,c)||!Ws(u,_):!0}function uf(i,s,o){var c=!1,u=Ji,_=s.contextType;return typeof _=="object"&&_!==null?_=Jt(_):(u=At(s)?Sr:xt.current,c=s.contextTypes,_=(c=c!=null)?ts(i,u):Ji),s=new s(o,_),i.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=xo,i.stateNode=s,s._reactInternals=i,c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=u,i.__reactInternalMemoizedMaskedChildContext=_),s}function df(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&&xo.enqueueReplaceState(s,s.state,null)}function zl(i,s,o,c){var u=i.stateNode;u.props=o,u.state=i.memoizedState,u.refs={},kl(i);var _=s.contextType;typeof _=="object"&&_!==null?u.context=Jt(_):(_=At(s)?Sr:xt.current,u.context=ts(i,_)),u.state=i.memoizedState,_=s.getDerivedStateFromProps,typeof _=="function"&&(Ol(i,s,_,o),u.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(s=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),s!==u.state&&xo.enqueueReplaceState(u,u.state,null),go(i,o,u,c),u.state=i.memoizedState),typeof u.componentDidMount=="function"&&(i.flags|=4194308)}function cs(i,s){try{var o="",c=s;do o+=pe(c),c=c.return;while(c);var u=o}catch(_){u=`
|
|
39
|
+
Error generating stack: `+_.message+`
|
|
40
|
+
`+_.stack}return{value:i,source:s,stack:u,digest:null}}function Fl(i,s,o){return{value:i,source:null,stack:o??null,digest:s??null}}function Hl(i,s){try{console.error(s.value)}catch(o){setTimeout(function(){throw o})}}var iy=typeof WeakMap=="function"?WeakMap:Map;function ff(i,s,o){o=Ai(-1,o),o.tag=3,o.payload={element:null};var c=s.value;return o.callback=function(){Po||(Po=!0,ic=c),Hl(i,s)},o}function pf(i,s,o){o=Ai(-1,o),o.tag=3;var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var u=s.value;o.payload=function(){return c(u)},o.callback=function(){Hl(i,s)}}var _=i.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(o.callback=function(){Hl(i,s),typeof c!="function"&&(rr===null?rr=new Set([this]):rr.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})}),o}function mf(i,s,o){var c=i.pingCache;if(c===null){c=i.pingCache=new iy;var u=new Set;c.set(s,u)}else u=c.get(s),u===void 0&&(u=new Set,c.set(s,u));u.has(o)||(u.add(o),i=_y.bind(null,i,s,o),s.then(i,i))}function _f(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 gf(i,s,o,c,u){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=Ai(-1,1),s.tag=2,tr(o,s,1))),o.lanes|=1),i):(i.flags|=65536,i.lanes=u,i)}var ry=M.ReactCurrentOwner,jt=!1;function Dt(i,s,o,c){s.child=i===null?jd(s,null,o,c):ns(s,i.child,o,c)}function vf(i,s,o,c,u){o=o.render;var _=s.ref;return as(s,u),c=Ll(i,s,o,c,_,u),o=Tl(),i!==null&&!jt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~u,ji(i,s,u)):(Ke&&o&&ml(s),s.flags|=1,Dt(i,s,c,u),s.child)}function yf(i,s,o,c,u){if(i===null){var _=o.type;return typeof _=="function"&&!cc(_)&&_.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(s.tag=15,s.type=_,Sf(i,s,_,c,u)):(i=Io(o.type,null,c,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(_=i.child,(i.lanes&u)===0){var w=_.memoizedProps;if(o=o.compare,o=o!==null?o:Ws,o(w,c)&&i.ref===s.ref)return ji(i,s,u)}return s.flags|=1,i=ar(_,c),i.ref=s.ref,i.return=s,s.child=i}function Sf(i,s,o,c,u){if(i!==null){var _=i.memoizedProps;if(Ws(_,c)&&i.ref===s.ref)if(jt=!1,s.pendingProps=c=_,(i.lanes&u)!==0)(i.flags&131072)!==0&&(jt=!0);else return s.lanes=i.lanes,ji(i,s,u)}return Wl(i,s,o,c,u)}function wf(i,s,o){var c=s.pendingProps,u=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(us,Vt),Vt|=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(us,Vt),Vt|=i,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=_!==null?_.baseLanes:o,Fe(us,Vt),Vt|=c}else _!==null?(c=_.baseLanes|o,s.memoizedState=null):c=o,Fe(us,Vt),Vt|=c;return Dt(i,s,u,o),s.child}function Cf(i,s){var o=s.ref;(i===null&&o!==null||i!==null&&i.ref!==o)&&(s.flags|=512,s.flags|=2097152)}function Wl(i,s,o,c,u){var _=At(o)?Sr:xt.current;return _=ts(s,_),as(s,u),o=Ll(i,s,o,c,_,u),c=Tl(),i!==null&&!jt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~u,ji(i,s,u)):(Ke&&c&&ml(s),s.flags|=1,Dt(i,s,o,u),s.child)}function bf(i,s,o,c,u){if(At(o)){var _=!0;ao(s)}else _=!1;if(as(s,u),s.stateNode===null)Eo(i,s),uf(s,o,c),zl(s,o,c,u),c=!0;else if(i===null){var w=s.stateNode,N=s.memoizedProps;w.props=N;var L=w.context,Z=o.contextType;typeof Z=="object"&&Z!==null?Z=Jt(Z):(Z=At(o)?Sr:xt.current,Z=ts(s,Z));var se=o.getDerivedStateFromProps,ne=typeof se=="function"||typeof w.getSnapshotBeforeUpdate=="function";ne||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(N!==c||L!==Z)&&df(s,w,c,Z),er=!1;var re=s.memoizedState;w.state=re,go(s,c,w,u),L=s.memoizedState,N!==c||re!==L||Bt.current||er?(typeof se=="function"&&(Ol(s,o,se,c),L=s.memoizedState),(N=er||hf(s,o,N,c,re,L,Z))?(ne||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=L),w.props=c,w.state=L,w.context=Z,c=N):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{w=s.stateNode,Od(i,s),N=s.memoizedProps,Z=s.type===s.elementType?N:ui(s.type,N),w.props=Z,ne=s.pendingProps,re=w.context,L=o.contextType,typeof L=="object"&&L!==null?L=Jt(L):(L=At(o)?Sr:xt.current,L=ts(s,L));var fe=o.getDerivedStateFromProps;(se=typeof fe=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(N!==ne||re!==L)&&df(s,w,c,L),er=!1,re=s.memoizedState,w.state=re,go(s,c,w,u);var ge=s.memoizedState;N!==ne||re!==ge||Bt.current||er?(typeof fe=="function"&&(Ol(s,o,fe,c),ge=s.memoizedState),(Z=er||hf(s,o,Z,c,re,ge,L)||!1)?(se||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(c,ge,L),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(c,ge,L)),typeof w.componentDidUpdate=="function"&&(s.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof w.componentDidUpdate!="function"||N===i.memoizedProps&&re===i.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||N===i.memoizedProps&&re===i.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=ge),w.props=c,w.state=ge,w.context=L,c=Z):(typeof w.componentDidUpdate!="function"||N===i.memoizedProps&&re===i.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||N===i.memoizedProps&&re===i.memoizedState||(s.flags|=1024),c=!1)}return $l(i,s,o,c,_,u)}function $l(i,s,o,c,u,_){Cf(i,s);var w=(s.flags&128)!==0;if(!c&&!w)return u&&Nd(s,o,!1),ji(i,s,_);c=s.stateNode,ry.current=s;var N=w&&typeof o.getDerivedStateFromError!="function"?null:c.render();return s.flags|=1,i!==null&&w?(s.child=ns(s,i.child,null,_),s.child=ns(s,null,N,_)):Dt(i,s,N,_),s.memoizedState=c.state,u&&Nd(s,o,!0),s.child}function xf(i){var s=i.stateNode;s.pendingContext?kd(i,s.pendingContext,s.pendingContext!==s.context):s.context&&kd(i,s.context,!1),El(i,s.containerInfo)}function kf(i,s,o,c,u){return ss(),yl(u),s.flags|=256,Dt(i,s,o,c),s.child}var Ul={dehydrated:null,treeContext:null,retryLane:0};function Kl(i){return{baseLanes:i,cachePool:null,transitions:null}}function Ef(i,s,o){var c=s.pendingProps,u=qe.current,_=!1,w=(s.flags&128)!==0,N;if((N=w)||(N=i!==null&&i.memoizedState===null?!1:(u&2)!==0),N?(_=!0,s.flags&=-129):(i===null||i.memoizedState!==null)&&(u|=1),Fe(qe,u&1),i===null)return vl(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):_=Oo(w,c,0,null),i=Mr(i,c,o,null),_.return=s,i.return=s,_.sibling=i,s.child=_,s.child.memoizedState=Kl(o),s.memoizedState=Ul,i):Vl(s,w));if(u=i.memoizedState,u!==null&&(N=u.dehydrated,N!==null))return sy(i,s,w,c,N,u,o);if(_){_=c.fallback,w=s.mode,u=i.child,N=u.sibling;var L={mode:"hidden",children:c.children};return(w&1)===0&&s.child!==u?(c=s.child,c.childLanes=0,c.pendingProps=L,s.deletions=null):(c=ar(u,L),c.subtreeFlags=u.subtreeFlags&14680064),N!==null?_=ar(N,_):(_=Mr(_,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?Kl(o):{baseLanes:w.baseLanes|o,cachePool:null,transitions:w.transitions},_.memoizedState=w,_.childLanes=i.childLanes&~o,s.memoizedState=Ul,c}return _=i.child,i=_.sibling,c=ar(_,{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 Vl(i,s){return s=Oo({mode:"visible",children:s},i.mode,0,null),s.return=i,i.child=s}function ko(i,s,o,c){return c!==null&&yl(c),ns(s,i.child,null,o),i=Vl(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function sy(i,s,o,c,u,_,w){if(o)return s.flags&256?(s.flags&=-257,c=Fl(Error(r(422))),ko(i,s,w,c)):s.memoizedState!==null?(s.child=i.child,s.flags|=128,null):(_=c.fallback,u=s.mode,c=Oo({mode:"visible",children:c.children},u,0,null),_=Mr(_,u,w,null),_.flags|=2,c.return=s,_.return=s,c.sibling=_,s.child=c,(s.mode&1)!==0&&ns(s,i.child,null,w),s.child.memoizedState=Kl(w),s.memoizedState=Ul,_);if((s.mode&1)===0)return ko(i,s,w,null);if(u.data==="$!"){if(c=u.nextSibling&&u.nextSibling.dataset,c)var N=c.dgst;return c=N,_=Error(r(419)),c=Fl(_,c,void 0),ko(i,s,w,c)}if(N=(w&i.childLanes)!==0,jt||N){if(c=dt,c!==null){switch(w&-w){case 4:u=2;break;case 16:u=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:u=32;break;case 536870912:u=268435456;break;default:u=0}u=(u&(c.suspendedLanes|w))!==0?0:u,u!==0&&u!==_.retryLane&&(_.retryLane=u,Bi(i,u),pi(c,i,u,-1))}return lc(),c=Fl(Error(r(421))),ko(i,s,w,c)}return u.data==="$?"?(s.flags|=128,s.child=i.child,s=gy.bind(null,i),u._reactRetry=s,null):(i=_.treeContext,Kt=Gi(u.nextSibling),Ut=s,Ke=!0,hi=null,i!==null&&(Gt[Qt++]=Li,Gt[Qt++]=Ti,Gt[Qt++]=wr,Li=i.id,Ti=i.overflow,wr=s),s=Vl(s,c.children),s.flags|=4096,s)}function Nf(i,s,o){i.lanes|=s;var c=i.alternate;c!==null&&(c.lanes|=s),bl(i.return,s,o)}function ql(i,s,o,c,u){var _=i.memoizedState;_===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:u}:(_.isBackwards=s,_.rendering=null,_.renderingStartTime=0,_.last=c,_.tail=o,_.tailMode=u)}function Rf(i,s,o){var c=s.pendingProps,u=c.revealOrder,_=c.tail;if(Dt(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&&Nf(i,o,s);else if(i.tag===19)Nf(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(u){case"forwards":for(o=s.child,u=null;o!==null;)i=o.alternate,i!==null&&vo(i)===null&&(u=o),o=o.sibling;o=u,o===null?(u=s.child,s.child=null):(u=o.sibling,o.sibling=null),ql(s,!1,u,o,_);break;case"backwards":for(o=null,u=s.child,s.child=null;u!==null;){if(i=u.alternate,i!==null&&vo(i)===null){s.child=u;break}i=u.sibling,u.sibling=o,o=u,u=i}ql(s,!0,o,null,_);break;case"together":ql(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Eo(i,s){(s.mode&1)===0&&i!==null&&(i.alternate=null,s.alternate=null,s.flags|=2)}function ji(i,s,o){if(i!==null&&(s.dependencies=i.dependencies),Er|=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=ar(i,i.pendingProps),s.child=o,o.return=s;i.sibling!==null;)i=i.sibling,o=o.sibling=ar(i,i.pendingProps),o.return=s;o.sibling=null}return s.child}function ny(i,s,o){switch(s.tag){case 3:xf(s),ss();break;case 5:Hd(s);break;case 1:At(s.type)&&ao(s);break;case 4:El(s,s.stateNode.containerInfo);break;case 10:var c=s.type._context,u=s.memoizedProps.value;Fe(po,c._currentValue),c._currentValue=u;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?Ef(i,s,o):(Fe(qe,qe.current&1),i=ji(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 Rf(i,s,o);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Fe(qe,qe.current),c)break;return null;case 22:case 23:return s.lanes=0,wf(i,s,o)}return ji(i,s,o)}var Df,Yl,Mf,Pf;Df=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}},Yl=function(){},Mf=function(i,s,o,c){var u=i.memoizedProps;if(u!==c){i=s.stateNode,xr(yi.current);var _=null;switch(o){case"input":u=Ue(i,u),c=Ue(i,c),_=[];break;case"select":u=q({},u,{value:void 0}),c=q({},c,{value:void 0}),_=[];break;case"textarea":u=bs(i,u),c=bs(i,c),_=[];break;default:typeof u.onClick!="function"&&typeof c.onClick=="function"&&(i.onclick=so)}Ra(o,c);var w;o=null;for(Z in u)if(!c.hasOwnProperty(Z)&&u.hasOwnProperty(Z)&&u[Z]!=null)if(Z==="style"){var N=u[Z];for(w in N)N.hasOwnProperty(w)&&(o||(o={}),o[w]="")}else Z!=="dangerouslySetInnerHTML"&&Z!=="children"&&Z!=="suppressContentEditableWarning"&&Z!=="suppressHydrationWarning"&&Z!=="autoFocus"&&(a.hasOwnProperty(Z)?_||(_=[]):(_=_||[]).push(Z,null));for(Z in c){var L=c[Z];if(N=u!=null?u[Z]:void 0,c.hasOwnProperty(Z)&&L!==N&&(L!=null||N!=null))if(Z==="style")if(N){for(w in N)!N.hasOwnProperty(w)||L&&L.hasOwnProperty(w)||(o||(o={}),o[w]="");for(w in L)L.hasOwnProperty(w)&&N[w]!==L[w]&&(o||(o={}),o[w]=L[w])}else o||(_||(_=[]),_.push(Z,o)),o=L;else Z==="dangerouslySetInnerHTML"?(L=L?L.__html:void 0,N=N?N.__html:void 0,L!=null&&N!==L&&(_=_||[]).push(Z,L)):Z==="children"?typeof L!="string"&&typeof L!="number"||(_=_||[]).push(Z,""+L):Z!=="suppressContentEditableWarning"&&Z!=="suppressHydrationWarning"&&(a.hasOwnProperty(Z)?(L!=null&&Z==="onScroll"&&He("scroll",i),_||N===L||(_=[])):(_=_||[]).push(Z,L))}o&&(_=_||[]).push("style",o);var Z=_;(s.updateQueue=Z)&&(s.flags|=4)}},Pf=function(i,s,o,c){o!==c&&(s.flags|=4)};function sn(i,s){if(!Ke)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 Et(i){var s=i.alternate!==null&&i.alternate.child===i.child,o=0,c=0;if(s)for(var u=i.child;u!==null;)o|=u.lanes|u.childLanes,c|=u.subtreeFlags&14680064,c|=u.flags&14680064,u.return=i,u=u.sibling;else for(u=i.child;u!==null;)o|=u.lanes|u.childLanes,c|=u.subtreeFlags,c|=u.flags,u.return=i,u=u.sibling;return i.subtreeFlags|=c,i.childLanes=o,s}function oy(i,s,o){var c=s.pendingProps;switch(_l(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Et(s),null;case 1:return At(s.type)&&oo(),Et(s),null;case 3:return c=s.stateNode,ls(),We(Bt),We(xt),Dl(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(uo(s)?s.flags|=4:i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,hi!==null&&(nc(hi),hi=null))),Yl(i,s),Et(s),null;case 5:Nl(s);var u=xr(Js.current);if(o=s.type,i!==null&&s.stateNode!=null)Mf(i,s,o,c,u),i.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!c){if(s.stateNode===null)throw Error(r(166));return Et(s),null}if(i=xr(yi.current),uo(s)){c=s.stateNode,o=s.type;var _=s.memoizedProps;switch(c[vi]=s,c[qs]=_,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(u=0;u<Us.length;u++)He(Us[u],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":oi(c,_),He("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!_.multiple},He("invalid",c);break;case"textarea":An(c,_),He("invalid",c)}Ra(o,_),u=null;for(var w in _)if(_.hasOwnProperty(w)){var N=_[w];w==="children"?typeof N=="string"?c.textContent!==N&&(_.suppressHydrationWarning!==!0&&ro(c.textContent,N,i),u=["children",N]):typeof N=="number"&&c.textContent!==""+N&&(_.suppressHydrationWarning!==!0&&ro(c.textContent,N,i),u=["children",""+N]):a.hasOwnProperty(w)&&N!=null&&w==="onScroll"&&He("scroll",c)}switch(o){case"input":U(c),Bn(c,_,!0);break;case"textarea":U(c),jn(c);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(c.onclick=so)}c=u,s.updateQueue=c,c!==null&&(s.flags|=4)}else{w=u.nodeType===9?u:u.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=he(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[vi]=s,i[qs]=c,Df(i,s,!1,!1),s.stateNode=i;e:{switch(w=Da(o,c),o){case"dialog":He("cancel",i),He("close",i),u=c;break;case"iframe":case"object":case"embed":He("load",i),u=c;break;case"video":case"audio":for(u=0;u<Us.length;u++)He(Us[u],i);u=c;break;case"source":He("error",i),u=c;break;case"img":case"image":case"link":He("error",i),He("load",i),u=c;break;case"details":He("toggle",i),u=c;break;case"input":oi(i,c),u=Ue(i,c),He("invalid",i);break;case"option":u=c;break;case"select":i._wrapperState={wasMultiple:!!c.multiple},u=q({},c,{value:void 0}),He("invalid",i);break;case"textarea":An(i,c),u=bs(i,c),He("invalid",i);break;default:u=c}Ra(o,u),N=u;for(_ in N)if(N.hasOwnProperty(_)){var L=N[_];_==="style"?yu(i,L):_==="dangerouslySetInnerHTML"?(L=L?L.__html:void 0,L!=null&&xs(i,L)):_==="children"?typeof L=="string"?(o!=="textarea"||L!=="")&&ks(i,L):typeof L=="number"&&ks(i,""+L):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(a.hasOwnProperty(_)?L!=null&&_==="onScroll"&&He("scroll",i):L!=null&&W(i,_,L,w))}switch(o){case"input":U(i),Bn(i,c,!1);break;case"textarea":U(i),jn(i);break;case"option":c.value!=null&&i.setAttribute("value",""+Ce(c.value));break;case"select":i.multiple=!!c.multiple,_=c.value,_!=null?$i(i,!!c.multiple,_,!1):c.defaultValue!=null&&$i(i,!!c.multiple,c.defaultValue,!0);break;default:typeof u.onClick=="function"&&(i.onclick=so)}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 Et(s),null;case 6:if(i&&s.stateNode!=null)Pf(i,s,i.memoizedProps,c);else{if(typeof c!="string"&&s.stateNode===null)throw Error(r(166));if(o=xr(Js.current),xr(yi.current),uo(s)){if(c=s.stateNode,o=s.memoizedProps,c[vi]=s,(_=c.nodeValue!==o)&&(i=Ut,i!==null))switch(i.tag){case 3:ro(c.nodeValue,o,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&ro(c.nodeValue,o,(i.mode&1)!==0)}_&&(s.flags|=4)}else c=(o.nodeType===9?o:o.ownerDocument).createTextNode(c),c[vi]=s,s.stateNode=c}return Et(s),null;case 13:if(We(qe),c=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(Ke&&Kt!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Td(),ss(),s.flags|=98560,_=!1;else if(_=uo(s),c!==null&&c.dehydrated!==null){if(i===null){if(!_)throw Error(r(318));if(_=s.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(r(317));_[vi]=s}else ss(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Et(s),_=!1}else hi!==null&&(nc(hi),hi=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?at===0&&(at=3):lc())),s.updateQueue!==null&&(s.flags|=4),Et(s),null);case 4:return ls(),Yl(i,s),i===null&&Ks(s.stateNode.containerInfo),Et(s),null;case 10:return Cl(s.type._context),Et(s),null;case 17:return At(s.type)&&oo(),Et(s),null;case 19:if(We(qe),_=s.memoizedState,_===null)return Et(s),null;if(c=(s.flags&128)!==0,w=_.rendering,w===null)if(c)sn(_,!1);else{if(at!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(w=vo(i),w!==null){for(s.flags|=128,sn(_,!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()>ds&&(s.flags|=128,c=!0,sn(_,!1),s.lanes=4194304)}else{if(!c)if(i=vo(w),i!==null){if(s.flags|=128,c=!0,o=i.updateQueue,o!==null&&(s.updateQueue=o,s.flags|=4),sn(_,!0),_.tail===null&&_.tailMode==="hidden"&&!w.alternate&&!Ke)return Et(s),null}else 2*et()-_.renderingStartTime>ds&&o!==1073741824&&(s.flags|=128,c=!0,sn(_,!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):(Et(s),null);case 22:case 23:return ac(),c=s.memoizedState!==null,i!==null&&i.memoizedState!==null!==c&&(s.flags|=8192),c&&(s.mode&1)!==0?(Vt&1073741824)!==0&&(Et(s),s.subtreeFlags&6&&(s.flags|=8192)):Et(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function ay(i,s){switch(_l(s),s.tag){case 1:return At(s.type)&&oo(),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return ls(),We(Bt),We(xt),Dl(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 5:return Nl(s),null;case 13:if(We(qe),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ss()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return We(qe),null;case 4:return ls(),null;case 10:return Cl(s.type._context),null;case 22:case 23:return ac(),null;case 24:return null;default:return null}}var No=!1,Nt=!1,ly=typeof WeakSet=="function"?WeakSet:Set,_e=null;function hs(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 Xl(i,s,o){try{o()}catch(c){Qe(i,s,c)}}var Lf=!1;function cy(i,s){if(al=Vn,i=cd(),Za(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 u=c.anchorOffset,_=c.focusNode;c=c.focusOffset;try{o.nodeType,_.nodeType}catch{o=null;break e}var w=0,N=-1,L=-1,Z=0,se=0,ne=i,re=null;t:for(;;){for(var fe;ne!==o||u!==0&&ne.nodeType!==3||(N=w+u),ne!==_||c!==0&&ne.nodeType!==3||(L=w+c),ne.nodeType===3&&(w+=ne.nodeValue.length),(fe=ne.firstChild)!==null;)re=ne,ne=fe;for(;;){if(ne===i)break t;if(re===o&&++Z===u&&(N=w),re===_&&++se===c&&(L=w),(fe=ne.nextSibling)!==null)break;ne=re,re=ne.parentNode}ne=fe}o=N===-1||L===-1?null:{start:N,end:L}}else o=null}o=o||{start:0,end:0}}else o=null;for(ll={focusedElem:i,selectionRange:o},Vn=!1,_e=s;_e!==null;)if(s=_e,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,_e=i;else for(;_e!==null;){s=_e;try{var ge=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(ge!==null){var ve=ge.memoizedProps,tt=ge.memoizedState,V=s.stateNode,F=V.getSnapshotBeforeUpdate(s.elementType===s.type?ve:ui(s.type,ve),tt);V.__reactInternalSnapshotBeforeUpdate=F}break;case 3:var G=s.stateNode.containerInfo;G.nodeType===1?G.textContent="":G.nodeType===9&&G.documentElement&&G.removeChild(G.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ae){Qe(s,s.return,ae)}if(i=s.sibling,i!==null){i.return=s.return,_e=i;break}_e=s.return}return ge=Lf,Lf=!1,ge}function nn(i,s,o){var c=s.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var u=c=c.next;do{if((u.tag&i)===i){var _=u.destroy;u.destroy=void 0,_!==void 0&&Xl(s,o,_)}u=u.next}while(u!==c)}}function Ro(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 Gl(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 Tf(i){var s=i.alternate;s!==null&&(i.alternate=null,Tf(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&(delete s[vi],delete s[qs],delete s[dl],delete s[Kv],delete s[Vv])),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 Bf(i){return i.tag===5||i.tag===3||i.tag===4}function Af(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Bf(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 Ql(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=so));else if(c!==4&&(i=i.child,i!==null))for(Ql(i,s,o),i=i.sibling;i!==null;)Ql(i,s,o),i=i.sibling}function Jl(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(Jl(i,s,o),i=i.sibling;i!==null;)Jl(i,s,o),i=i.sibling}var St=null,di=!1;function ir(i,s,o){for(o=o.child;o!==null;)jf(i,s,o),o=o.sibling}function jf(i,s,o){if(gi&&typeof gi.onCommitFiberUnmount=="function")try{gi.onCommitFiberUnmount(Fn,o)}catch{}switch(o.tag){case 5:Nt||hs(o,s);case 6:var c=St,u=di;St=null,ir(i,s,o),St=c,di=u,St!==null&&(di?(i=St,o=o.stateNode,i.nodeType===8?i.parentNode.removeChild(o):i.removeChild(o)):St.removeChild(o.stateNode));break;case 18:St!==null&&(di?(i=St,o=o.stateNode,i.nodeType===8?ul(i.parentNode,o):i.nodeType===1&&ul(i,o),js(i)):ul(St,o.stateNode));break;case 4:c=St,u=di,St=o.stateNode.containerInfo,di=!0,ir(i,s,o),St=c,di=u;break;case 0:case 11:case 14:case 15:if(!Nt&&(c=o.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){u=c=c.next;do{var _=u,w=_.destroy;_=_.tag,w!==void 0&&((_&2)!==0||(_&4)!==0)&&Xl(o,s,w),u=u.next}while(u!==c)}ir(i,s,o);break;case 1:if(!Nt&&(hs(o,s),c=o.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=o.memoizedProps,c.state=o.memoizedState,c.componentWillUnmount()}catch(N){Qe(o,s,N)}ir(i,s,o);break;case 21:ir(i,s,o);break;case 22:o.mode&1?(Nt=(c=Nt)||o.memoizedState!==null,ir(i,s,o),Nt=c):ir(i,s,o);break;default:ir(i,s,o)}}function If(i){var s=i.updateQueue;if(s!==null){i.updateQueue=null;var o=i.stateNode;o===null&&(o=i.stateNode=new ly),s.forEach(function(c){var u=vy.bind(null,i,c);o.has(c)||(o.add(c),c.then(u,u))})}}function fi(i,s){var o=s.deletions;if(o!==null)for(var c=0;c<o.length;c++){var u=o[c];try{var _=i,w=s,N=w;e:for(;N!==null;){switch(N.tag){case 5:St=N.stateNode,di=!1;break e;case 3:St=N.stateNode.containerInfo,di=!0;break e;case 4:St=N.stateNode.containerInfo,di=!0;break e}N=N.return}if(St===null)throw Error(r(160));jf(_,w,u),St=null,di=!1;var L=u.alternate;L!==null&&(L.return=null),u.return=null}catch(Z){Qe(u,s,Z)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Of(s,i),s=s.sibling}function Of(i,s){var o=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(fi(s,i),wi(i),c&4){try{nn(3,i,i.return),Ro(3,i)}catch(ve){Qe(i,i.return,ve)}try{nn(5,i,i.return)}catch(ve){Qe(i,i.return,ve)}}break;case 1:fi(s,i),wi(i),c&512&&o!==null&&hs(o,o.return);break;case 5:if(fi(s,i),wi(i),c&512&&o!==null&&hs(o,o.return),i.flags&32){var u=i.stateNode;try{ks(u,"")}catch(ve){Qe(i,i.return,ve)}}if(c&4&&(u=i.stateNode,u!=null)){var _=i.memoizedProps,w=o!==null?o.memoizedProps:_,N=i.type,L=i.updateQueue;if(i.updateQueue=null,L!==null)try{N==="input"&&_.type==="radio"&&_.name!=null&&_r(u,_),Da(N,w);var Z=Da(N,_);for(w=0;w<L.length;w+=2){var se=L[w],ne=L[w+1];se==="style"?yu(u,ne):se==="dangerouslySetInnerHTML"?xs(u,ne):se==="children"?ks(u,ne):W(u,se,ne,Z)}switch(N){case"input":Cs(u,_);break;case"textarea":$r(u,_);break;case"select":var re=u._wrapperState.wasMultiple;u._wrapperState.wasMultiple=!!_.multiple;var fe=_.value;fe!=null?$i(u,!!_.multiple,fe,!1):re!==!!_.multiple&&(_.defaultValue!=null?$i(u,!!_.multiple,_.defaultValue,!0):$i(u,!!_.multiple,_.multiple?[]:"",!1))}u[qs]=_}catch(ve){Qe(i,i.return,ve)}}break;case 6:if(fi(s,i),wi(i),c&4){if(i.stateNode===null)throw Error(r(162));u=i.stateNode,_=i.memoizedProps;try{u.nodeValue=_}catch(ve){Qe(i,i.return,ve)}}break;case 3:if(fi(s,i),wi(i),c&4&&o!==null&&o.memoizedState.isDehydrated)try{js(s.containerInfo)}catch(ve){Qe(i,i.return,ve)}break;case 4:fi(s,i),wi(i);break;case 13:fi(s,i),wi(i),u=i.child,u.flags&8192&&(_=u.memoizedState!==null,u.stateNode.isHidden=_,!_||u.alternate!==null&&u.alternate.memoizedState!==null||(tc=et())),c&4&&If(i);break;case 22:if(se=o!==null&&o.memoizedState!==null,i.mode&1?(Nt=(Z=Nt)||se,fi(s,i),Nt=Z):fi(s,i),wi(i),c&8192){if(Z=i.memoizedState!==null,(i.stateNode.isHidden=Z)&&!se&&(i.mode&1)!==0)for(_e=i,se=i.child;se!==null;){for(ne=_e=se;_e!==null;){switch(re=_e,fe=re.child,re.tag){case 0:case 11:case 14:case 15:nn(4,re,re.return);break;case 1:hs(re,re.return);var ge=re.stateNode;if(typeof ge.componentWillUnmount=="function"){c=re,o=re.return;try{s=c,ge.props=s.memoizedProps,ge.state=s.memoizedState,ge.componentWillUnmount()}catch(ve){Qe(c,o,ve)}}break;case 5:hs(re,re.return);break;case 22:if(re.memoizedState!==null){Hf(ne);continue}}fe!==null?(fe.return=re,_e=fe):Hf(ne)}se=se.sibling}e:for(se=null,ne=i;;){if(ne.tag===5){if(se===null){se=ne;try{u=ne.stateNode,Z?(_=u.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(N=ne.stateNode,L=ne.memoizedProps.style,w=L!=null&&L.hasOwnProperty("display")?L.display:null,N.style.display=vu("display",w))}catch(ve){Qe(i,i.return,ve)}}}else if(ne.tag===6){if(se===null)try{ne.stateNode.nodeValue=Z?"":ne.memoizedProps}catch(ve){Qe(i,i.return,ve)}}else if((ne.tag!==22&&ne.tag!==23||ne.memoizedState===null||ne===i)&&ne.child!==null){ne.child.return=ne,ne=ne.child;continue}if(ne===i)break e;for(;ne.sibling===null;){if(ne.return===null||ne.return===i)break e;se===ne&&(se=null),ne=ne.return}se===ne&&(se=null),ne.sibling.return=ne.return,ne=ne.sibling}}break;case 19:fi(s,i),wi(i),c&4&&If(i);break;case 21:break;default:fi(s,i),wi(i)}}function wi(i){var s=i.flags;if(s&2){try{e:{for(var o=i.return;o!==null;){if(Bf(o)){var c=o;break e}o=o.return}throw Error(r(160))}switch(c.tag){case 5:var u=c.stateNode;c.flags&32&&(ks(u,""),c.flags&=-33);var _=Af(i);Jl(i,_,u);break;case 3:case 4:var w=c.stateNode.containerInfo,N=Af(i);Ql(i,N,w);break;default:throw Error(r(161))}}catch(L){Qe(i,i.return,L)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function hy(i,s,o){_e=i,zf(i)}function zf(i,s,o){for(var c=(i.mode&1)!==0;_e!==null;){var u=_e,_=u.child;if(u.tag===22&&c){var w=u.memoizedState!==null||No;if(!w){var N=u.alternate,L=N!==null&&N.memoizedState!==null||Nt;N=No;var Z=Nt;if(No=w,(Nt=L)&&!Z)for(_e=u;_e!==null;)w=_e,L=w.child,w.tag===22&&w.memoizedState!==null?Wf(u):L!==null?(L.return=w,_e=L):Wf(u);for(;_!==null;)_e=_,zf(_),_=_.sibling;_e=u,No=N,Nt=Z}Ff(i)}else(u.subtreeFlags&8772)!==0&&_!==null?(_.return=u,_e=_):Ff(i)}}function Ff(i){for(;_e!==null;){var s=_e;if((s.flags&8772)!==0){var o=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Nt||Ro(5,s);break;case 1:var c=s.stateNode;if(s.flags&4&&!Nt)if(o===null)c.componentDidMount();else{var u=s.elementType===s.type?o.memoizedProps:ui(s.type,o.memoizedProps);c.componentDidUpdate(u,o.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var _=s.updateQueue;_!==null&&Fd(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}Fd(s,w,o)}break;case 5:var N=s.stateNode;if(o===null&&s.flags&4){o=N;var L=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":L.autoFocus&&o.focus();break;case"img":L.src&&(o.src=L.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var Z=s.alternate;if(Z!==null){var se=Z.memoizedState;if(se!==null){var ne=se.dehydrated;ne!==null&&js(ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Nt||s.flags&512&&Gl(s)}catch(re){Qe(s,s.return,re)}}if(s===i){_e=null;break}if(o=s.sibling,o!==null){o.return=s.return,_e=o;break}_e=s.return}}function Hf(i){for(;_e!==null;){var s=_e;if(s===i){_e=null;break}var o=s.sibling;if(o!==null){o.return=s.return,_e=o;break}_e=s.return}}function Wf(i){for(;_e!==null;){var s=_e;try{switch(s.tag){case 0:case 11:case 15:var o=s.return;try{Ro(4,s)}catch(L){Qe(s,o,L)}break;case 1:var c=s.stateNode;if(typeof c.componentDidMount=="function"){var u=s.return;try{c.componentDidMount()}catch(L){Qe(s,u,L)}}var _=s.return;try{Gl(s)}catch(L){Qe(s,_,L)}break;case 5:var w=s.return;try{Gl(s)}catch(L){Qe(s,w,L)}}}catch(L){Qe(s,s.return,L)}if(s===i){_e=null;break}var N=s.sibling;if(N!==null){N.return=s.return,_e=N;break}_e=s.return}}var uy=Math.ceil,Do=M.ReactCurrentDispatcher,Zl=M.ReactCurrentOwner,ei=M.ReactCurrentBatchConfig,Ae=0,dt=null,rt=null,wt=0,Vt=0,us=Qi(0),at=0,on=null,Er=0,Mo=0,ec=0,an=null,It=null,tc=0,ds=1/0,Ii=null,Po=!1,ic=null,rr=null,Lo=!1,sr=null,To=0,ln=0,rc=null,Bo=-1,Ao=0;function Mt(){return(Ae&6)!==0?et():Bo!==-1?Bo:Bo=et()}function nr(i){return(i.mode&1)===0?1:(Ae&2)!==0&&wt!==0?wt&-wt:Yv.transition!==null?(Ao===0&&(Ao=Bu()),Ao):(i=Oe,i!==0||(i=window.event,i=i===void 0?16:$u(i.type)),i)}function pi(i,s,o,c){if(50<ln)throw ln=0,rc=null,Error(r(185));Ps(i,o,c),((Ae&2)===0||i!==dt)&&(i===dt&&((Ae&2)===0&&(Mo|=o),at===4&&or(i,wt)),Ot(i,c),o===1&&Ae===0&&(s.mode&1)===0&&(ds=et()+500,lo&&Zi()))}function Ot(i,s){var o=i.callbackNode;Yg(i,s);var c=$n(i,i===dt?wt:0);if(c===0)o!==null&&Pu(o),i.callbackNode=null,i.callbackPriority=0;else if(s=c&-c,i.callbackPriority!==s){if(o!=null&&Pu(o),s===1)i.tag===0?qv(Uf.bind(null,i)):Rd(Uf.bind(null,i)),$v(function(){(Ae&6)===0&&Zi()}),o=null;else{switch(Au(c)){case 1:o=ja;break;case 4:o=Lu;break;case 16:o=zn;break;case 536870912:o=Tu;break;default:o=zn}o=Jf(o,$f.bind(null,i))}i.callbackPriority=s,i.callbackNode=o}}function $f(i,s){if(Bo=-1,Ao=0,(Ae&6)!==0)throw Error(r(327));var o=i.callbackNode;if(fs()&&i.callbackNode!==o)return null;var c=$n(i,i===dt?wt:0);if(c===0)return null;if((c&30)!==0||(c&i.expiredLanes)!==0||s)s=jo(i,c);else{s=c;var u=Ae;Ae|=2;var _=Vf();(dt!==i||wt!==s)&&(Ii=null,ds=et()+500,Rr(i,s));do try{py();break}catch(N){Kf(i,N)}while(!0);wl(),Do.current=_,Ae=u,rt!==null?s=0:(dt=null,wt=0,s=at)}if(s!==0){if(s===2&&(u=Ia(i),u!==0&&(c=u,s=sc(i,u))),s===1)throw o=on,Rr(i,0),or(i,c),Ot(i,et()),o;if(s===6)or(i,c);else{if(u=i.current.alternate,(c&30)===0&&!dy(u)&&(s=jo(i,c),s===2&&(_=Ia(i),_!==0&&(c=_,s=sc(i,_))),s===1))throw o=on,Rr(i,0),or(i,c),Ot(i,et()),o;switch(i.finishedWork=u,i.finishedLanes=c,s){case 0:case 1:throw Error(r(345));case 2:Dr(i,It,Ii);break;case 3:if(or(i,c),(c&130023424)===c&&(s=tc+500-et(),10<s)){if($n(i,0)!==0)break;if(u=i.suspendedLanes,(u&c)!==c){Mt(),i.pingedLanes|=i.suspendedLanes&u;break}i.timeoutHandle=hl(Dr.bind(null,i,It,Ii),s);break}Dr(i,It,Ii);break;case 4:if(or(i,c),(c&4194240)===c)break;for(s=i.eventTimes,u=-1;0<c;){var w=31-li(c);_=1<<w,w=s[w],w>u&&(u=w),c&=~_}if(c=u,c=et()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*uy(c/1960))-c,10<c){i.timeoutHandle=hl(Dr.bind(null,i,It,Ii),c);break}Dr(i,It,Ii);break;case 5:Dr(i,It,Ii);break;default:throw Error(r(329))}}}return Ot(i,et()),i.callbackNode===o?$f.bind(null,i):null}function sc(i,s){var o=an;return i.current.memoizedState.isDehydrated&&(Rr(i,s).flags|=256),i=jo(i,s),i!==2&&(s=It,It=o,s!==null&&nc(s)),i}function nc(i){It===null?It=i:It.push.apply(It,i)}function dy(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 u=o[c],_=u.getSnapshot;u=u.value;try{if(!ci(_(),u))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 or(i,s){for(s&=~ec,s&=~Mo,i.suspendedLanes|=s,i.pingedLanes&=~s,i=i.expirationTimes;0<s;){var o=31-li(s),c=1<<o;i[o]=-1,s&=~c}}function Uf(i){if((Ae&6)!==0)throw Error(r(327));fs();var s=$n(i,0);if((s&1)===0)return Ot(i,et()),null;var o=jo(i,s);if(i.tag!==0&&o===2){var c=Ia(i);c!==0&&(s=c,o=sc(i,c))}if(o===1)throw o=on,Rr(i,0),or(i,s),Ot(i,et()),o;if(o===6)throw Error(r(345));return i.finishedWork=i.current.alternate,i.finishedLanes=s,Dr(i,It,Ii),Ot(i,et()),null}function oc(i,s){var o=Ae;Ae|=1;try{return i(s)}finally{Ae=o,Ae===0&&(ds=et()+500,lo&&Zi())}}function Nr(i){sr!==null&&sr.tag===0&&(Ae&6)===0&&fs();var s=Ae;Ae|=1;var o=ei.transition,c=Oe;try{if(ei.transition=null,Oe=1,i)return i()}finally{Oe=c,ei.transition=o,Ae=s,(Ae&6)===0&&Zi()}}function ac(){Vt=us.current,We(us)}function Rr(i,s){i.finishedWork=null,i.finishedLanes=0;var o=i.timeoutHandle;if(o!==-1&&(i.timeoutHandle=-1,Wv(o)),rt!==null)for(o=rt.return;o!==null;){var c=o;switch(_l(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&oo();break;case 3:ls(),We(Bt),We(xt),Dl();break;case 5:Nl(c);break;case 4:ls();break;case 13:We(qe);break;case 19:We(qe);break;case 10:Cl(c.type._context);break;case 22:case 23:ac()}o=o.return}if(dt=i,rt=i=ar(i.current,null),wt=Vt=s,at=0,on=null,ec=Mo=Er=0,It=an=null,br!==null){for(s=0;s<br.length;s++)if(o=br[s],c=o.interleaved,c!==null){o.interleaved=null;var u=c.next,_=o.pending;if(_!==null){var w=_.next;_.next=u,c.next=w}o.pending=c}br=null}return i}function Kf(i,s){do{var o=rt;try{if(wl(),yo.current=bo,So){for(var c=Ye.memoizedState;c!==null;){var u=c.queue;u!==null&&(u.pending=null),c=c.next}So=!1}if(kr=0,ut=ot=Ye=null,Zs=!1,en=0,Zl.current=null,o===null||o.return===null){at=1,on=s,rt=null;break}e:{var _=i,w=o.return,N=o,L=s;if(s=wt,N.flags|=32768,L!==null&&typeof L=="object"&&typeof L.then=="function"){var Z=L,se=N,ne=se.tag;if((se.mode&1)===0&&(ne===0||ne===11||ne===15)){var re=se.alternate;re?(se.updateQueue=re.updateQueue,se.memoizedState=re.memoizedState,se.lanes=re.lanes):(se.updateQueue=null,se.memoizedState=null)}var fe=_f(w);if(fe!==null){fe.flags&=-257,gf(fe,w,N,_,s),fe.mode&1&&mf(_,Z,s),s=fe,L=Z;var ge=s.updateQueue;if(ge===null){var ve=new Set;ve.add(L),s.updateQueue=ve}else ge.add(L);break e}else{if((s&1)===0){mf(_,Z,s),lc();break e}L=Error(r(426))}}else if(Ke&&N.mode&1){var tt=_f(w);if(tt!==null){(tt.flags&65536)===0&&(tt.flags|=256),gf(tt,w,N,_,s),yl(cs(L,N));break e}}_=L=cs(L,N),at!==4&&(at=2),an===null?an=[_]:an.push(_),_=w;do{switch(_.tag){case 3:_.flags|=65536,s&=-s,_.lanes|=s;var V=ff(_,L,s);zd(_,V);break e;case 1:N=L;var F=_.type,G=_.stateNode;if((_.flags&128)===0&&(typeof F.getDerivedStateFromError=="function"||G!==null&&typeof G.componentDidCatch=="function"&&(rr===null||!rr.has(G)))){_.flags|=65536,s&=-s,_.lanes|=s;var ae=pf(_,N,s);zd(_,ae);break e}}_=_.return}while(_!==null)}Yf(o)}catch(we){s=we,rt===o&&o!==null&&(rt=o=o.return);continue}break}while(!0)}function Vf(){var i=Do.current;return Do.current=bo,i===null?bo:i}function lc(){(at===0||at===3||at===2)&&(at=4),dt===null||(Er&268435455)===0&&(Mo&268435455)===0||or(dt,wt)}function jo(i,s){var o=Ae;Ae|=2;var c=Vf();(dt!==i||wt!==s)&&(Ii=null,Rr(i,s));do try{fy();break}catch(u){Kf(i,u)}while(!0);if(wl(),Ae=o,Do.current=c,rt!==null)throw Error(r(261));return dt=null,wt=0,at}function fy(){for(;rt!==null;)qf(rt)}function py(){for(;rt!==null&&!zg();)qf(rt)}function qf(i){var s=Qf(i.alternate,i,Vt);i.memoizedProps=i.pendingProps,s===null?Yf(i):rt=s,Zl.current=null}function Yf(i){var s=i;do{var o=s.alternate;if(i=s.return,(s.flags&32768)===0){if(o=oy(o,s,Vt),o!==null){rt=o;return}}else{if(o=ay(o,s),o!==null){o.flags&=32767,rt=o;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{at=6,rt=null;return}}if(s=s.sibling,s!==null){rt=s;return}rt=s=i}while(s!==null);at===0&&(at=5)}function Dr(i,s,o){var c=Oe,u=ei.transition;try{ei.transition=null,Oe=1,my(i,s,o,c)}finally{ei.transition=u,Oe=c}return null}function my(i,s,o,c){do fs();while(sr!==null);if((Ae&6)!==0)throw Error(r(327));o=i.finishedWork;var u=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(Xg(i,_),i===dt&&(rt=dt=null,wt=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||Lo||(Lo=!0,Jf(zn,function(){return fs(),null})),_=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||_){_=ei.transition,ei.transition=null;var w=Oe;Oe=1;var N=Ae;Ae|=4,Zl.current=null,cy(i,o),Of(o,i),Av(ll),Vn=!!al,ll=al=null,i.current=o,hy(o),Fg(),Ae=N,Oe=w,ei.transition=_}else i.current=o;if(Lo&&(Lo=!1,sr=i,To=u),_=i.pendingLanes,_===0&&(rr=null),$g(o.stateNode),Ot(i,et()),s!==null)for(c=i.onRecoverableError,o=0;o<s.length;o++)u=s[o],c(u.value,{componentStack:u.stack,digest:u.digest});if(Po)throw Po=!1,i=ic,ic=null,i;return(To&1)!==0&&i.tag!==0&&fs(),_=i.pendingLanes,(_&1)!==0?i===rc?ln++:(ln=0,rc=i):ln=0,Zi(),null}function fs(){if(sr!==null){var i=Au(To),s=ei.transition,o=Oe;try{if(ei.transition=null,Oe=16>i?16:i,sr===null)var c=!1;else{if(i=sr,sr=null,To=0,(Ae&6)!==0)throw Error(r(331));var u=Ae;for(Ae|=4,_e=i.current;_e!==null;){var _=_e,w=_.child;if((_e.flags&16)!==0){var N=_.deletions;if(N!==null){for(var L=0;L<N.length;L++){var Z=N[L];for(_e=Z;_e!==null;){var se=_e;switch(se.tag){case 0:case 11:case 15:nn(8,se,_)}var ne=se.child;if(ne!==null)ne.return=se,_e=ne;else for(;_e!==null;){se=_e;var re=se.sibling,fe=se.return;if(Tf(se),se===Z){_e=null;break}if(re!==null){re.return=fe,_e=re;break}_e=fe}}}var ge=_.alternate;if(ge!==null){var ve=ge.child;if(ve!==null){ge.child=null;do{var tt=ve.sibling;ve.sibling=null,ve=tt}while(ve!==null)}}_e=_}}if((_.subtreeFlags&2064)!==0&&w!==null)w.return=_,_e=w;else e:for(;_e!==null;){if(_=_e,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:nn(9,_,_.return)}var V=_.sibling;if(V!==null){V.return=_.return,_e=V;break e}_e=_.return}}var F=i.current;for(_e=F;_e!==null;){w=_e;var G=w.child;if((w.subtreeFlags&2064)!==0&&G!==null)G.return=w,_e=G;else e:for(w=F;_e!==null;){if(N=_e,(N.flags&2048)!==0)try{switch(N.tag){case 0:case 11:case 15:Ro(9,N)}}catch(we){Qe(N,N.return,we)}if(N===w){_e=null;break e}var ae=N.sibling;if(ae!==null){ae.return=N.return,_e=ae;break e}_e=N.return}}if(Ae=u,Zi(),gi&&typeof gi.onPostCommitFiberRoot=="function")try{gi.onPostCommitFiberRoot(Fn,i)}catch{}c=!0}return c}finally{Oe=o,ei.transition=s}}return!1}function Xf(i,s,o){s=cs(o,s),s=ff(i,s,1),i=tr(i,s,1),s=Mt(),i!==null&&(Ps(i,1,s),Ot(i,s))}function Qe(i,s,o){if(i.tag===3)Xf(i,i,o);else for(;s!==null;){if(s.tag===3){Xf(s,i,o);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(rr===null||!rr.has(c))){i=cs(o,i),i=pf(s,i,1),s=tr(s,i,1),i=Mt(),s!==null&&(Ps(s,1,i),Ot(s,i));break}}s=s.return}}function _y(i,s,o){var c=i.pingCache;c!==null&&c.delete(s),s=Mt(),i.pingedLanes|=i.suspendedLanes&o,dt===i&&(wt&o)===o&&(at===4||at===3&&(wt&130023424)===wt&&500>et()-tc?Rr(i,0):ec|=o),Ot(i,s)}function Gf(i,s){s===0&&((i.mode&1)===0?s=1:(s=Wn,Wn<<=1,(Wn&130023424)===0&&(Wn=4194304)));var o=Mt();i=Bi(i,s),i!==null&&(Ps(i,s,o),Ot(i,o))}function gy(i){var s=i.memoizedState,o=0;s!==null&&(o=s.retryLane),Gf(i,o)}function vy(i,s){var o=0;switch(i.tag){case 13:var c=i.stateNode,u=i.memoizedState;u!==null&&(o=u.retryLane);break;case 19:c=i.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(s),Gf(i,o)}var Qf;Qf=function(i,s,o){if(i!==null)if(i.memoizedProps!==s.pendingProps||Bt.current)jt=!0;else{if((i.lanes&o)===0&&(s.flags&128)===0)return jt=!1,ny(i,s,o);jt=(i.flags&131072)!==0}else jt=!1,Ke&&(s.flags&1048576)!==0&&Dd(s,ho,s.index);switch(s.lanes=0,s.tag){case 2:var c=s.type;Eo(i,s),i=s.pendingProps;var u=ts(s,xt.current);as(s,o),u=Ll(null,s,c,i,u,o);var _=Tl();return s.flags|=1,typeof u=="object"&&u!==null&&typeof u.render=="function"&&u.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,At(c)?(_=!0,ao(s)):_=!1,s.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,kl(s),u.updater=xo,s.stateNode=u,u._reactInternals=s,zl(s,c,i,o),s=$l(null,s,c,!0,_,o)):(s.tag=0,Ke&&_&&ml(s),Dt(null,s,u,o),s=s.child),s;case 16:c=s.elementType;e:{switch(Eo(i,s),i=s.pendingProps,u=c._init,c=u(c._payload),s.type=c,u=s.tag=Sy(c),i=ui(c,i),u){case 0:s=Wl(null,s,c,i,o);break e;case 1:s=bf(null,s,c,i,o);break e;case 11:s=vf(null,s,c,i,o);break e;case 14:s=yf(null,s,c,ui(c.type,i),o);break e}throw Error(r(306,c,""))}return s;case 0:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:ui(c,u),Wl(i,s,c,u,o);case 1:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:ui(c,u),bf(i,s,c,u,o);case 3:e:{if(xf(s),i===null)throw Error(r(387));c=s.pendingProps,_=s.memoizedState,u=_.element,Od(i,s),go(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){u=cs(Error(r(423)),s),s=kf(i,s,c,o,u);break e}else if(c!==u){u=cs(Error(r(424)),s),s=kf(i,s,c,o,u);break e}else for(Kt=Gi(s.stateNode.containerInfo.firstChild),Ut=s,Ke=!0,hi=null,o=jd(s,null,c,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ss(),c===u){s=ji(i,s,o);break e}Dt(i,s,c,o)}s=s.child}return s;case 5:return Hd(s),i===null&&vl(s),c=s.type,u=s.pendingProps,_=i!==null?i.memoizedProps:null,w=u.children,cl(c,u)?w=null:_!==null&&cl(c,_)&&(s.flags|=32),Cf(i,s),Dt(i,s,w,o),s.child;case 6:return i===null&&vl(s),null;case 13:return Ef(i,s,o);case 4:return El(s,s.stateNode.containerInfo),c=s.pendingProps,i===null?s.child=ns(s,null,c,o):Dt(i,s,c,o),s.child;case 11:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:ui(c,u),vf(i,s,c,u,o);case 7:return Dt(i,s,s.pendingProps,o),s.child;case 8:return Dt(i,s,s.pendingProps.children,o),s.child;case 12:return Dt(i,s,s.pendingProps.children,o),s.child;case 10:e:{if(c=s.type._context,u=s.pendingProps,_=s.memoizedProps,w=u.value,Fe(po,c._currentValue),c._currentValue=w,_!==null)if(ci(_.value,w)){if(_.children===u.children&&!Bt.current){s=ji(i,s,o);break e}}else for(_=s.child,_!==null&&(_.return=s);_!==null;){var N=_.dependencies;if(N!==null){w=_.child;for(var L=N.firstContext;L!==null;){if(L.context===c){if(_.tag===1){L=Ai(-1,o&-o),L.tag=2;var Z=_.updateQueue;if(Z!==null){Z=Z.shared;var se=Z.pending;se===null?L.next=L:(L.next=se.next,se.next=L),Z.pending=L}}_.lanes|=o,L=_.alternate,L!==null&&(L.lanes|=o),bl(_.return,o,s),N.lanes|=o;break}L=L.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,N=w.alternate,N!==null&&(N.lanes|=o),bl(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}Dt(i,s,u.children,o),s=s.child}return s;case 9:return u=s.type,c=s.pendingProps.children,as(s,o),u=Jt(u),c=c(u),s.flags|=1,Dt(i,s,c,o),s.child;case 14:return c=s.type,u=ui(c,s.pendingProps),u=ui(c.type,u),yf(i,s,c,u,o);case 15:return Sf(i,s,s.type,s.pendingProps,o);case 17:return c=s.type,u=s.pendingProps,u=s.elementType===c?u:ui(c,u),Eo(i,s),s.tag=1,At(c)?(i=!0,ao(s)):i=!1,as(s,o),uf(s,c,u),zl(s,c,u,o),$l(null,s,c,!0,i,o);case 19:return Rf(i,s,o);case 22:return wf(i,s,o)}throw Error(r(156,s.tag))};function Jf(i,s){return Mu(i,s)}function yy(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 ti(i,s,o,c){return new yy(i,s,o,c)}function cc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Sy(i){if(typeof i=="function")return cc(i)?1:0;if(i!=null){if(i=i.$$typeof,i===H)return 11;if(i===X)return 14}return 2}function ar(i,s){var o=i.alternate;return o===null?(o=ti(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 Io(i,s,o,c,u,_){var w=2;if(c=i,typeof i=="function")cc(i)&&(w=1);else if(typeof i=="string")w=5;else e:switch(i){case A:return Mr(o.children,u,_,s);case P:w=8,u|=8;break;case z:return i=ti(12,o,s,u|2),i.elementType=z,i.lanes=_,i;case B:return i=ti(13,o,s,u),i.elementType=B,i.lanes=_,i;case D:return i=ti(19,o,s,u),i.elementType=D,i.lanes=_,i;case ie:return Oo(o,u,_,s);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case O:w=10;break e;case K:w=9;break e;case H:w=11;break e;case X:w=14;break e;case ee:w=16,c=null;break e}throw Error(r(130,i==null?i:typeof i,""))}return s=ti(w,o,s,u),s.elementType=i,s.type=c,s.lanes=_,s}function Mr(i,s,o,c){return i=ti(7,i,c,s),i.lanes=o,i}function Oo(i,s,o,c){return i=ti(22,i,c,s),i.elementType=ie,i.lanes=o,i.stateNode={isHidden:!1},i}function hc(i,s,o){return i=ti(6,i,null,s),i.lanes=o,i}function uc(i,s,o){return s=ti(4,i.children!==null?i.children:[],i.key,s),s.lanes=o,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}function wy(i,s,o,c,u){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=Oa(0),this.expirationTimes=Oa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Oa(0),this.identifierPrefix=c,this.onRecoverableError=u,this.mutableSourceEagerHydrationData=null}function dc(i,s,o,c,u,_,w,N,L){return i=new wy(i,s,o,N,L),s===1?(s=1,_===!0&&(s|=8)):s=0,_=ti(3,null,null,s),i.current=_,_.stateNode=i,_.memoizedState={element:c,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},kl(_),i}function Cy(i,s,o){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Y,key:c==null?null:""+c,children:i,containerInfo:s,implementation:o}}function Zf(i){if(!i)return Ji;i=i._reactInternals;e:{if(vr(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(At(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(At(o))return Ed(i,o,s)}return s}function ep(i,s,o,c,u,_,w,N,L){return i=dc(o,c,!0,i,u,_,w,N,L),i.context=Zf(null),o=i.current,c=Mt(),u=nr(o),_=Ai(c,u),_.callback=s??null,tr(o,_,u),i.current.lanes=u,Ps(i,u,c),Ot(i,c),i}function zo(i,s,o,c){var u=s.current,_=Mt(),w=nr(u);return o=Zf(o),s.context===null?s.context=o:s.pendingContext=o,s=Ai(_,w),s.payload={element:i},c=c===void 0?null:c,c!==null&&(s.callback=c),i=tr(u,s,w),i!==null&&(pi(i,u,w,_),_o(i,u,w)),w}function Fo(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 tp(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var o=i.retryLane;i.retryLane=o!==0&&o<s?o:s}}function fc(i,s){tp(i,s),(i=i.alternate)&&tp(i,s)}function by(){return null}var ip=typeof reportError=="function"?reportError:function(i){console.error(i)};function pc(i){this._internalRoot=i}Ho.prototype.render=pc.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));zo(i,s,null,null)},Ho.prototype.unmount=pc.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Nr(function(){zo(null,i,null,null)}),s[Mi]=null}};function Ho(i){this._internalRoot=i}Ho.prototype.unstable_scheduleHydration=function(i){if(i){var s=Ou();i={blockedOn:null,target:i,priority:s};for(var o=0;o<qi.length&&s!==0&&s<qi[o].priority;o++);qi.splice(o,0,i),o===0&&Hu(i)}};function mc(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Wo(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function rp(){}function xy(i,s,o,c,u){if(u){if(typeof c=="function"){var _=c;c=function(){var Z=Fo(w);_.call(Z)}}var w=ep(s,c,i,0,null,!1,!1,"",rp);return i._reactRootContainer=w,i[Mi]=w.current,Ks(i.nodeType===8?i.parentNode:i),Nr(),w}for(;u=i.lastChild;)i.removeChild(u);if(typeof c=="function"){var N=c;c=function(){var Z=Fo(L);N.call(Z)}}var L=dc(i,0,!1,null,null,!1,!1,"",rp);return i._reactRootContainer=L,i[Mi]=L.current,Ks(i.nodeType===8?i.parentNode:i),Nr(function(){zo(s,L,o,c)}),L}function $o(i,s,o,c,u){var _=o._reactRootContainer;if(_){var w=_;if(typeof u=="function"){var N=u;u=function(){var L=Fo(w);N.call(L)}}zo(s,w,i,u)}else w=xy(o,s,i,u,c);return Fo(w)}ju=function(i){switch(i.tag){case 3:var s=i.stateNode;if(s.current.memoizedState.isDehydrated){var o=Ms(s.pendingLanes);o!==0&&(za(s,o|1),Ot(s,et()),(Ae&6)===0&&(ds=et()+500,Zi()))}break;case 13:Nr(function(){var c=Bi(i,1);if(c!==null){var u=Mt();pi(c,i,1,u)}}),fc(i,1)}},Fa=function(i){if(i.tag===13){var s=Bi(i,134217728);if(s!==null){var o=Mt();pi(s,i,134217728,o)}fc(i,134217728)}},Iu=function(i){if(i.tag===13){var s=nr(i),o=Bi(i,s);if(o!==null){var c=Mt();pi(o,i,s,c)}fc(i,s)}},Ou=function(){return Oe},zu=function(i,s){var o=Oe;try{return Oe=i,s()}finally{Oe=o}},La=function(i,s,o){switch(s){case"input":if(Cs(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 u=no(c);if(!u)throw Error(r(90));oe(c),Cs(c,u)}}}break;case"textarea":$r(i,o);break;case"select":s=o.value,s!=null&&$i(i,!!o.multiple,s,!1)}},bu=oc,xu=Nr;var ky={usingClientEntryPoint:!1,Events:[Ys,Zr,no,wu,Cu,oc]},cn={findFiberByHostInstance:yr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ey={bundleType:cn.bundleType,version:cn.version,rendererPackageName:cn.rendererPackageName,rendererConfig:cn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Ru(i),i===null?null:i.stateNode},findFiberByHostInstance:cn.findFiberByHostInstance||by,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 Uo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Uo.isDisabled&&Uo.supportsFiber)try{Fn=Uo.inject(Ey),gi=Uo}catch{}}return zt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ky,zt.createPortal=function(i,s){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mc(s))throw Error(r(200));return Cy(i,s,null,o)},zt.createRoot=function(i,s){if(!mc(i))throw Error(r(299));var o=!1,c="",u=ip;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onRecoverableError!==void 0&&(u=s.onRecoverableError)),s=dc(i,1,!1,null,null,o,!1,c,u),i[Mi]=s.current,Ks(i.nodeType===8?i.parentNode:i),new pc(s)},zt.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=Ru(s),i=i===null?null:i.stateNode,i},zt.flushSync=function(i){return Nr(i)},zt.hydrate=function(i,s,o){if(!Wo(s))throw Error(r(200));return $o(null,i,s,!0,o)},zt.hydrateRoot=function(i,s,o){if(!mc(i))throw Error(r(405));var c=o!=null&&o.hydratedSources||null,u=!1,_="",w=ip;if(o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(_=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),s=ep(s,null,i,1,o??null,u,!1,_,w),i[Mi]=s.current,Ks(i),c)for(i=0;i<c.length;i++)o=c[i],u=o._getVersion,u=u(o._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[o,u]:s.mutableSourceEagerHydrationData.push(o,u);return new Ho(s)},zt.render=function(i,s,o){if(!Wo(s))throw Error(r(200));return $o(null,i,s,!1,o)},zt.unmountComponentAtNode=function(i){if(!Wo(i))throw Error(r(40));return i._reactRootContainer?(Nr(function(){$o(null,null,i,!1,function(){i._reactRootContainer=null,i[Mi]=null})}),!0):!1},zt.unstable_batchedUpdates=oc,zt.unstable_renderSubtreeIntoContainer=function(i,s,o,c){if(!Wo(o))throw Error(r(200));if(i==null||i._reactInternals===void 0)throw Error(r(38));return $o(i,s,o,!1,c)},zt.version="18.3.1-next-f1338f8080-20240426",zt}var up;function Ay(){if(up)return vc.exports;up=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(),vc.exports=By(),vc.exports}var dp;function jy(){if(dp)return Ko;dp=1;var e=Ay();return Ko.createRoot=e.createRoot,Ko.hydrateRoot=e.hydrateRoot,Ko}var Iy=jy();const Oy=Jh(Iy);function vt(e,t,r={}){return fetch(e,{...r,headers:{...r.headers||{},Authorization:`Bearer ${t}`}})}const r_=e=>`nc_seen_${e}`;async function Be(e,t,r={}){const n=await vt(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 ys=e=>Array.isArray(e)&&e.length?`/api/route/${e.map(encodeURIComponent).join("/")}/_`:"/api",_i=(e,t)=>`${ys(e)}/fleet/${t}`,wa=(e,t)=>Be(_i(t,"status"),e),s_=(e,t,r)=>Be(_i(r,"up"),e,{method:"POST",body:t}),n_=(e,t,r)=>Be(_i(r,"down"),e,{method:"POST",body:t}),fp=(e,t,r)=>Be(_i(r,"restart"),e,{method:"POST",body:{cell:t}}),zy=(e,t)=>Be(_i(t,"definitions"),e),Fy=(e,t,r)=>Be(_i(r,"define-engine"),e,{method:"POST",body:{def:t}}),Hy=(e,t,r,n,a)=>Be(_i(a,"edit-engine"),e,{method:"POST",body:{id:t,patch:r,envChanges:n}}),Wy=(e,t,r)=>Be(_i(r,"remove-engine"),e,{method:"POST",body:{id:t}}),$y=(e,t,r)=>Be(_i(r,"define-cell"),e,{method:"POST",body:{def:t}}),Uy=(e,t,r,n)=>Be(_i(n,"edit-cell"),e,{method:"POST",body:{id:t,patch:r}}),Ky=(e,t,r=!1,n)=>Be(_i(n,"remove-cell"),e,{method:"POST",body:{id:t,stop:r}}),o_=(e,t,r)=>Be(`${ys(r)}/sessions`,e,{method:"POST",body:t}),a_=(e,t,r)=>Be(`${ys(r)}/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),l_=(e,t,r)=>Be(`${ys(r)}/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),c_=e=>Be("/api/settings",e),h_=e=>Be("/api/nodes",e),Vy=e=>Be("/api/topology",e),qy=(e,t)=>Be(`${ys(t)}/sessions`,e),u_=(e,t)=>Be(`${ys(t)}/config`,e),Yy=(e,t)=>Be("/api/settings/config",e,{method:"POST",body:t}),Xy=e=>Be("/api/settings/token/rotate",e,{method:"POST"}),d_=(e,t)=>Be("/api/settings/nodes/pair",e,{method:"POST",body:t}),Gy=e=>Be("/api/settings/peering/invite",e,{method:"POST"}),Qy=(e,t)=>Be(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),eu=(e,t,r)=>Be(`/api/settings/nodes/${encodeURIComponent(t)}/${r}`,e,{method:"POST"}),pp=(e,t,r,n=[])=>Be(`/api/settings/nodes/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{visibility:r,selected:n}}),Jy=e=>Be("/api/settings/service/regenerate",e,{method:"POST"}),Zy=(e,t=!0)=>Be(`/api/asks${t?"?open=1":""}`,e),e0=(e,t,r)=>Be(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:r}}),wc=e=>Be("/api/decks",e),mp=(e,t)=>Be("/api/decks",e,{method:"POST",body:{name:t}}),Vo=(e,t,r,n)=>Be(`/api/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:r,expectedRevision:n}}),t0=(e,t,r,n)=>Be(`/api/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:r,expectedRevision:n}}),i0=(e,t,r)=>Be(`/api/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:r}}),r0={power:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M12 3v8"}),f.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:f.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:f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),f.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),f.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),f.jsx("path",{d:"M12 18v3"})]}),enter:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),f.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),f.jsx("path",{d:"M22 2 11 13"})]}),trash:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M4 7h16"}),f.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),f.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),f.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:f.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),f.jsx("polyline",{points:"21 3 21 8 16 8"})]}),upload:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M12 16V5"}),f.jsx("polyline",{points:"8 9 12 5 16 9"}),f.jsx("path",{d:"M5 20h14"})]}),chevronLeft:f.jsx("polyline",{points:"14 6 8 12 14 18"}),attach:f.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:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),f.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:f.jsxs(f.Fragment,{children:[f.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"}),f.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),f.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),f.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:f.jsxs(f.Fragment,{children:[f.jsx("circle",{cx:"11",cy:"11",r:"7"}),f.jsx("path",{d:"M21 21l-4.35-4.35"}),f.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:f.jsxs(f.Fragment,{children:[f.jsx("circle",{cx:"11",cy:"11",r:"7"}),f.jsx("path",{d:"M21 21l-4.35-4.35"}),f.jsx("path",{d:"M8 11h6"})]}),gear:f.jsxs(f.Fragment,{children:[f.jsx("circle",{cx:"12",cy:"12",r:"3"}),f.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:f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),f.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 f.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:r0[e]||null})}const f_="nc_pins";function p_(){try{const e=JSON.parse(localStorage.getItem(f_));return Array.isArray(e)?e:[]}catch{return[]}}function m_(e,t){const r=e.includes(t)?e.filter(n=>n!==t):[...e,t];try{localStorage.setItem(f_,JSON.stringify(r))}catch{}return r}function vn(e,t,r){const n=e.indexOf(t);return[n===-1?1e9:n,-(r||0)]}function nh(e,t){return e[0]-t[0]||e[1]-t[1]}const tu=["it","en","es"];function s0(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return tu.includes(t)?t:"en"}catch{return"en"}}const ia=s0(),__="nc_lang",oh="nc-lang";function g_(){return typeof localStorage<"u"?localStorage:null}const qo={it:{"update-available":"nuova versione {v} disponibile","install-version-mismatch":"installazione incompleta: frontend e server non coincidono (v{v})",reload:"ricarica","grid-empty":"trascina qui una sessione dalla sidebar, o doppio-clic per la vista singola",pin:"fissa in cima",sessions:"sessioni","new-session":"nuova sessione",new:"nuova",fleet:"Flotta","fleet-tmux":"flotta tmux","other-sessions":"Altre sessioni",files:"file",refresh:"aggiorna","filter-placeholder":"filtra sessioni…","loading-fleet":"carico la flotta…","no-sessions":"nessuna sessione tmux viva — la flotta parte al boot (systemd)","no-match":'nessuna sessione contiene "{q}"',"copy-url":"clicca per copiare l'URL","ssh-only":"solo tunnel SSH/VPN","new-files-outbox":"nuovi file in outbox",terminate:"termina","terminate-confirm":'Terminare la sessione "{name}"?',"cell-on":"tmux vivo","cell-off":"spenta","cell-degraded":"degradata: unit attiva, tmux morto","power-on":"accendi","power-off":"spegni","state-on":"accesa","state-off":"spenta",engine:"Engine",model:"Modello","model-default":"Modello predefinito del provider","model-remembered":"Ultimo modello usato con questo engine","boot-persist":"avvia al boot","remove-boot":"togli anche dal boot","no-remote-control":"⚠ engine non-native: niente RC da app claude.ai (da qui la piloti comunque)",cancel:"annulla",name:"nome","name-invalid":"nome non valido: a-zA-Z0-9._- max 64, senza '-' iniziale",cwd:"cartella",browse:"sfoglia","fs-home":"home","fs-parent":".. su",preset:"preset","preset-2x2":"griglia 2×2","preset-columns":"colonne","preset-equalize":"equalizza",collapse:"comprimi",expand:"espandi",create:"crea","auth-prompt":"Incolla il token (stampato dal server):","remember-device":"ricorda su questo device","zoom-out":"testo più piccolo","zoom-in":"testo più grande",composer:"composer",windows:"{n} finestre","empty-files":"vuota",upload:"carica","no-sessions-short":"nessuna sessione","composer-placeholder":"scrivi o detta…",attach:"allega","attach-file":"File","attach-camera":"Fotocamera","attach-gallery":"Galleria","attach-uploading":"carico…",voice:"voice",send:"invia",close:"chiudi","lang-label":"lingua",decks:"deck","new-deck":"nuovo deck","deck-name":"nome deck","open-deck-window":"apri in una nuova finestra","deck-current":"questo deck (finestra corrente)","rename-deck":"rinomina deck","delete-deck":"elimina deck","delete-deck-confirm":'Eliminare il deck "{name}"?',"send-to-deck":"manda al deck…","deck-autosave":"salvataggio automatico",saving:"salvataggio…",saved:"salvato","popup-blocked":"popup bloccato: apri qui","select-drag":"trascina per selezionare","copy-manual":"seleziona e copia manualmente","toggle-sidebar":"mostra/nascondi la barra laterale",settings:"impostazioni","tab-roles":"ruoli","tab-nodes":"nodi",local:"Locale",location:"Dove","pairing-link":"link di pairing","pairing-required":"nome, alias SSH e link di pairing sono obbligatori","scan-qr":"scansiona QR","pairing-qr-invalid":"QR di pairing non valido","invite-node":"invita un nodo","create-pairing-link":"crea link / QR","visibility-network":"tutta la rete","visibility-relay":"solo relay","visibility-selected":"nodi selezionati","hydra-simple":"locale + nodi, una sola rete","local-ready":"Questo dispositivo è pronto. Puoi usarlo da solo o collegarlo a un nodo.","local-only":"solo locale","add-node":"aggiungi nodo",connect:"collega","node-connected":"Nodo collegato. La rete verrà sincronizzata automaticamente.","tab-system":"sistema","tab-fleet":"flotta","fleet-editor-unavailable":"Editor disponibile solo con il provider fleet builtin.","fleet-managed":"gestito da NexusCrew","fleet-custom":"comando personalizzato","fleet-managed-help":"Client, provider e avvio sono gestiti internamente; i segreti non vengono mostrati.","fleet-model-default":"modello predefinito (opzionale)","fleet-model-required":"modello (obbligatorio)","fleet-standard-permissions":"permessi standard","fleet-unsafe-permissions":"non sicuro · ignora approvazioni/sandbox","fleet-unsafe-warning":"Modalità non sicura esplicita: il worker può agire senza le normali approvazioni o protezioni sandbox.","fleet-provider-display":"nome visualizzato del provider","fleet-custom-provider-default":"Provider personalizzato","fleet-api-key-env":"NOME_VARIABILE_API_KEY","fleet-provider-id":"id-provider","fleet-custom-secret-help":"NexusCrew salva solo il nome della variabile d’ambiente, mai il suo valore.","fleet-model-override":"modello alternativo","fleet-ready":"pronto","fleet-not-ready":"non configurato","fleet-engines":"Engine","fleet-cells":"Celle / sessioni cloud",edit:"modifica",save:"salva",label:"etichetta","command-path":"path assoluto del comando","args-lines":"argomenti, uno per riga","env-write-only":"I valori env sono write-only: vuoto mantiene il valore esistente.","fleet-new-engine":"Nuovo engine","fleet-new-cell":"Nuova cella","fleet-saved":"Definizione salvata.","fleet-restart-confirm":"Modifica salvata. Riavviare ora: {cells}?","fleet-remove-engine":'Eliminare l’engine "{id}"?',"fleet-remove-cell":'Eliminare la cella "{id}"? Se è attiva verrà prima fermata.',"settings-readonly":"READONLY attivo: le modifiche sono bloccate dal server (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"questa macchina guarda altri nodi via tunnel SSH","role-node":"nodo (raggiungibile)","role-node-desc":"questa macchina si pubblica via reverse tunnel su un rendezvous","rendezvous-ssh":"rendezvous ssh (user@host)","published-port":"porta pubblicata (opzionale)","no-nodes":"nessun nodo remoto configurato","node-add":"collega installazione NexusCrew","node-connect-help":"La porta SSH serve a raggiungere il server SSH. La porta NexusCrew è invece la porta locale mostrata da `nexuscrew status` sul nodo remoto.","node-name-label":"Nome del nodo","node-ssh-label":"Host SSH","node-ssh-port-label":"Porta SSH","node-ssh-port-help":"Di solito 22; usa la porta pubblica del server SSH.","node-app-port-label":"Porta NexusCrew sul nodo","node-app-port-help":"È la porta mostrata da `nexuscrew status` sul nodo remoto.","node-name-ph":"nome (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"porta remota (opz.)","node-remove-confirm":'Rimuovere il nodo "{name}"?',"node-test":"test","tunnel-start":"avvia tunnel","tunnel-stop":"ferma tunnel","tunnel-restart":"riavvia tunnel","tunnel-up":"tunnel su","tunnel-down":"tunnel giù","authorized-keys-hint":"incolla questa riga in ~/.ssh/authorized_keys sull'host remoto:",copy:"copia",copied:"copiato","token-rotate":"ruota token","token-rotate-explain":"Il nuovo token NON verrà mostrato: recuperalo con `nexuscrew url`. La sessione si invalida al riavvio del service.","service-regenerate":"rigenera service","service-installed":"service installato","service-missing":"service non installato","service-active":"attivo","service-inactive":"non attivo",confirm:"conferma",add:"aggiungi",enable:"attiva","wizard-title":"benvenuto in NexusCrew","wizard-skip":"configura dopo dai settings","wizard-step-roles":"ruoli di questa installazione","wizard-step-node":"primo nodo remoto (opzionale)","wizard-step-rendezvous":"rendezvous per il ruolo nodo","wizard-done":"tutto pronto","wizard-done-desc":"setup completato — puoi cambiare tutto dai settings",next:"continua",back:"indietro",skip:"salta",finish:"fine","err-node-name":"nome non valido (a-z, 0-9, -, max 32)","err-ssh":"ssh non valido (atteso user@host)","err-port":"porta non valida (1–65535)","err-ssh-port":"porta SSH non valida (1–65535)","err-node-port":"porta NexusCrew non valida (1–65535)","err-rendezvous-required":"serve un rendezvous ssh (user@host) per attivare il ruolo nodo","node-sessions":"{n} sessioni","tunnel-down-since":"tunnel giù da {t}","node-unreachable":"nodo non raggiungibile","node-offline":"nodo offline","node-offline-seen":"offline · visto {t} fa","node-needs-repair":"legacy · ripeti il pairing","asks-title":"domande dalle celle","ask-reply-ph":"scrivi la risposta…","push-enable":"attiva notifiche push","push-disable":"disattiva notifiche push","push-on":"push attive su questo device","push-off":"push non attive","push-denied":"permesso notifiche negato dal browser","push-unsupported":"push non supportate in questo browser"},en:{"update-available":"new version {v} available","install-version-mismatch":"incomplete installation: frontend and server do not match (v{v})",reload:"reload","grid-empty":"drag a session here from the sidebar, or double-click for single view",pin:"pin to top",sessions:"sessions","new-session":"new session",new:"new",fleet:"Fleet","fleet-tmux":"tmux fleet","other-sessions":"Other sessions",files:"files",refresh:"refresh","filter-placeholder":"filter sessions…","loading-fleet":"loading fleet…","no-sessions":"no live tmux sessions — the fleet starts at boot (systemd)","no-match":'no session matches "{q}"',"copy-url":"click to copy URL","ssh-only":"SSH/VPN tunnel only","new-files-outbox":"new files in outbox",terminate:"terminate","terminate-confirm":'Terminate session "{name}"?',"cell-on":"tmux alive","cell-off":"off","cell-degraded":"degraded: unit active, tmux dead","power-on":"power on","power-off":"power off","state-on":"running","state-off":"stopped",engine:"Engine",model:"Model","model-default":"Provider default model","model-remembered":"Last model used with this engine","boot-persist":"start at boot","remove-boot":"also remove from boot","no-remote-control":"⚠ non-native engine: no claude.ai app RC (you can still drive it from here)",cancel:"cancel",name:"name","name-invalid":"invalid name: a-zA-Z0-9._- max 64, no leading '-'",cwd:"folder",browse:"browse","fs-home":"home","fs-parent":".. up",preset:"preset","preset-2x2":"2×2 grid","preset-columns":"columns","preset-equalize":"equalize",collapse:"collapse",expand:"expand",create:"create","auth-prompt":"Paste the token (printed by the server):","remember-device":"remember on this device","zoom-out":"smaller text","zoom-in":"bigger text",composer:"composer",windows:"{n} windows","empty-files":"empty",upload:"upload","no-sessions-short":"no sessions","composer-placeholder":"type or dictate…",attach:"attach","attach-file":"File","attach-camera":"Camera","attach-gallery":"Gallery","attach-uploading":"uploading…",voice:"voice",send:"send",close:"close","lang-label":"language",decks:"decks","new-deck":"new deck","deck-name":"deck name","open-deck-window":"open in a new window","deck-current":"this deck (current window)","rename-deck":"rename deck","delete-deck":"delete deck","delete-deck-confirm":'Delete deck "{name}"?',"send-to-deck":"send to deck…","deck-autosave":"autosave",saving:"saving…",saved:"saved","popup-blocked":"popup blocked: open here","select-drag":"drag to select","copy-manual":"select and copy manually","toggle-sidebar":"show/hide the sidebar",settings:"settings","tab-roles":"roles","tab-nodes":"nodes",local:"Local",location:"Location","pairing-link":"pairing link","pairing-required":"name, SSH alias and pairing link are required","scan-qr":"scan QR","pairing-qr-invalid":"invalid pairing QR","invite-node":"invite a node","create-pairing-link":"create link / QR","visibility-network":"whole network","visibility-relay":"relay only","visibility-selected":"selected nodes","hydra-simple":"local + nodes, one network","local-ready":"This device is ready. Use it alone or connect it to a node.","local-only":"local only","add-node":"add node",connect:"connect","node-connected":"Node connected. The network will synchronize automatically.","tab-system":"system","tab-fleet":"fleet","fleet-editor-unavailable":"The editor is available only with the builtin fleet provider.","fleet-managed":"managed by NexusCrew","fleet-custom":"custom command","fleet-managed-help":"Client, provider and launch are managed internally; secrets are never displayed.","fleet-model-default":"default model (optional)","fleet-model-required":"model (required)","fleet-standard-permissions":"standard permissions","fleet-unsafe-permissions":"unsafe · bypass approvals/sandbox","fleet-unsafe-warning":"Explicit unsafe mode: the worker can act without normal approval or sandbox gates.","fleet-provider-display":"provider display name","fleet-custom-provider-default":"Custom provider","fleet-api-key-env":"API_KEY_ENV_NAME","fleet-provider-id":"provider-id","fleet-custom-secret-help":"NexusCrew stores only the environment-variable name, never its value.","fleet-model-override":"model override","fleet-ready":"ready","fleet-not-ready":"not configured","fleet-engines":"Engines","fleet-cells":"Cells / cloud sessions",edit:"edit",save:"save",label:"label","command-path":"absolute command path","args-lines":"arguments, one per line","env-write-only":"Environment values are write-only: blank keeps the existing value.","fleet-new-engine":"New engine","fleet-new-cell":"New cell","fleet-saved":"Definition saved.","fleet-restart-confirm":"Change saved. Restart now: {cells}?","fleet-remove-engine":'Delete engine "{id}"?',"fleet-remove-cell":'Delete cell "{id}"? If active it will be stopped first.',"settings-readonly":"READONLY active: changes are blocked by the server (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"this machine watches other nodes via SSH tunnels","role-node":"node (reachable)","role-node-desc":"this machine publishes itself via reverse tunnel to a rendezvous","rendezvous-ssh":"rendezvous ssh (user@host)","published-port":"published port (optional)","no-nodes":"no remote nodes configured","node-add":"connect a NexusCrew installation","node-connect-help":"The SSH port reaches the SSH server. The NexusCrew port is the local port reported by `nexuscrew status` on the remote node.","node-name-label":"Node name","node-ssh-label":"SSH host","node-ssh-port-label":"SSH port","node-ssh-port-help":"Usually 22; use the SSH server public port.","node-app-port-label":"NexusCrew port on node","node-app-port-help":"The port reported by `nexuscrew status` on the remote node.","node-name-ph":"name (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"remote port (opt.)","node-remove-confirm":'Remove node "{name}"?',"node-test":"test","tunnel-start":"start tunnel","tunnel-stop":"stop tunnel","tunnel-restart":"restart tunnel","tunnel-up":"tunnel up","tunnel-down":"tunnel down","authorized-keys-hint":"paste this line into ~/.ssh/authorized_keys on the remote host:",copy:"copy",copied:"copied","token-rotate":"rotate token","token-rotate-explain":"The new token will NOT be shown: retrieve it with `nexuscrew url`. The session is invalidated when the service restarts.","service-regenerate":"regenerate service","service-installed":"service installed","service-missing":"service not installed","service-active":"active","service-inactive":"not active",confirm:"confirm",add:"add",enable:"enable","wizard-title":"welcome to NexusCrew","wizard-skip":"configure later from settings","wizard-step-roles":"roles of this install","wizard-step-node":"first remote node (optional)","wizard-step-rendezvous":"rendezvous for the node role","wizard-done":"all set","wizard-done-desc":"setup complete — you can change everything from settings",next:"continue",back:"back",skip:"skip",finish:"finish","err-node-name":"invalid name (a-z, 0-9, -, max 32)","err-ssh":"invalid ssh (expected user@host)","err-port":"invalid port (1–65535)","err-ssh-port":"invalid SSH port (1–65535)","err-node-port":"invalid NexusCrew port (1–65535)","err-rendezvous-required":"a rendezvous ssh (user@host) is required to enable the node role","node-sessions":"{n} sessions","tunnel-down-since":"tunnel down for {t}","node-unreachable":"node unreachable","node-offline":"node offline","node-offline-seen":"offline · seen {t} ago","node-needs-repair":"legacy · pair again","asks-title":"questions from the cells","ask-reply-ph":"type your answer…","push-enable":"enable push notifications","push-disable":"disable push notifications","push-on":"push active on this device","push-off":"push not active","push-denied":"notification permission denied by the browser","push-unsupported":"push not supported in this browser"},es:{"update-available":"nueva versión {v} disponible","install-version-mismatch":"instalación incompleta: frontend y servidor no coinciden (v{v})",reload:"recargar","grid-empty":"arrastra aquí una sesión desde la barra lateral, o doble clic para vista única",pin:"fijar arriba",sessions:"sesiones","new-session":"nueva sesión",new:"nueva",fleet:"Flota","fleet-tmux":"flota tmux","other-sessions":"Otras sesiones",files:"archivos",refresh:"actualizar","filter-placeholder":"filtrar sesiones…","loading-fleet":"cargando flota…","no-sessions":"sin sesiones tmux vivas — la flota arranca en el boot (systemd)","no-match":"ninguna sesión coincide con «{q}»","copy-url":"clic para copiar la URL","ssh-only":"solo túnel SSH/VPN","new-files-outbox":"archivos nuevos en outbox",terminate:"terminar","terminate-confirm":"¿Terminar la sesión «{name}»?","cell-on":"tmux activo","cell-off":"apagada","cell-degraded":"degradada: unit activa, tmux muerto","power-on":"encender","power-off":"apagar","state-on":"encendida","state-off":"apagada",engine:"Motor",model:"Modelo","model-default":"Modelo predeterminado del proveedor","model-remembered":"Último modelo usado con este motor","boot-persist":"iniciar en el boot","remove-boot":"quitar también del boot","no-remote-control":"⚠ motor no nativo: sin RC de la app claude.ai (aquí puedes pilotarla igual)",cancel:"cancelar",name:"nombre","name-invalid":"nombre inválido: a-zA-Z0-9._- máx 64, sin '-' inicial",cwd:"carpeta",browse:"explorar","fs-home":"home","fs-parent":".. arriba",preset:"preset","preset-2x2":"cuadrícula 2×2","preset-columns":"columnas","preset-equalize":"igualar",collapse:"contraer",expand:"expandir",create:"crear","auth-prompt":"Pega el token (impreso por el servidor):","remember-device":"recordar en este dispositivo","zoom-out":"texto más pequeño","zoom-in":"texto más grande",composer:"composer",windows:"{n} ventanas","empty-files":"vacía",upload:"subir","no-sessions-short":"sin sesiones","composer-placeholder":"escribe o dicta…",attach:"adjuntar","attach-file":"Archivo","attach-camera":"Cámara","attach-gallery":"Galería","attach-uploading":"subiendo…",voice:"voz",send:"enviar",close:"cerrar","lang-label":"idioma",decks:"decks","new-deck":"nuevo deck","deck-name":"nombre del deck","open-deck-window":"abrir en una ventana nueva","deck-current":"este deck (ventana actual)","rename-deck":"renombrar deck","delete-deck":"eliminar deck","delete-deck-confirm":"¿Eliminar el deck «{name}»?","send-to-deck":"enviar al deck…","deck-autosave":"guardado automático",saving:"guardando…",saved:"guardado","popup-blocked":"ventana bloqueada: abrir aquí","select-drag":"arrastra para seleccionar","copy-manual":"selecciona y copia manualmente","toggle-sidebar":"mostrar/ocultar la barra lateral",settings:"ajustes","tab-roles":"roles","tab-nodes":"nodos",local:"Local",location:"Ubicación","pairing-link":"enlace de emparejamiento","pairing-required":"nombre, alias SSH y enlace son obligatorios","scan-qr":"escanear QR","pairing-qr-invalid":"QR de emparejamiento no válido","invite-node":"invitar un nodo","create-pairing-link":"crear enlace / QR","visibility-network":"toda la red","visibility-relay":"solo relay","visibility-selected":"nodos seleccionados","hydra-simple":"local + nodos, una red","local-ready":"Este dispositivo está listo. Úsalo solo o conéctalo a un nodo.","local-only":"solo local","add-node":"añadir nodo",connect:"conectar","node-connected":"Nodo conectado. La red se sincronizará automáticamente.","tab-system":"sistema","tab-fleet":"flota","fleet-editor-unavailable":"El editor solo está disponible con el proveedor builtin.","fleet-managed":"gestionado por NexusCrew","fleet-custom":"comando personalizado","fleet-managed-help":"Cliente, proveedor e inicio se gestionan internamente; los secretos nunca se muestran.","fleet-model-default":"modelo predeterminado (opcional)","fleet-model-required":"modelo (obligatorio)","fleet-standard-permissions":"permisos estándar","fleet-unsafe-permissions":"inseguro · omitir aprobaciones/sandbox","fleet-unsafe-warning":"Modo inseguro explícito: el worker puede actuar sin las aprobaciones normales ni las protecciones del sandbox.","fleet-provider-display":"nombre visible del proveedor","fleet-custom-provider-default":"Proveedor personalizado","fleet-api-key-env":"NOMBRE_VARIABLE_API_KEY","fleet-provider-id":"id-proveedor","fleet-custom-secret-help":"NexusCrew guarda solo el nombre de la variable de entorno, nunca su valor.","fleet-model-override":"modelo alternativo","fleet-ready":"listo","fleet-not-ready":"no configurado","fleet-engines":"Motores","fleet-cells":"Celdas / sesiones cloud",edit:"editar",save:"guardar",label:"etiqueta","command-path":"ruta absoluta del comando","args-lines":"argumentos, uno por línea","env-write-only":"Los valores env son de solo escritura: vacío conserva el valor existente.","fleet-new-engine":"Nuevo motor","fleet-new-cell":"Nueva celda","fleet-saved":"Definición guardada.","fleet-restart-confirm":"Cambio guardado. ¿Reiniciar ahora: {cells}?","fleet-remove-engine":'¿Eliminar el motor "{id}"?',"fleet-remove-cell":'¿Eliminar la celda "{id}"? Si está activa se detendrá primero.',"settings-readonly":"READONLY activo: los cambios están bloqueados por el servidor (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"esta máquina observa otros nodos vía túneles SSH","role-node":"nodo (alcanzable)","role-node-desc":"esta máquina se publica vía túnel inverso hacia un rendezvous","rendezvous-ssh":"rendezvous ssh (user@host)","published-port":"puerto publicado (opcional)","no-nodes":"sin nodos remotos configurados","node-add":"conectar una instalación NexusCrew","node-connect-help":"El puerto SSH conecta con el servidor SSH. El puerto NexusCrew es el puerto local indicado por `nexuscrew status` en el nodo remoto.","node-name-label":"Nombre del nodo","node-ssh-label":"Host SSH","node-ssh-port-label":"Puerto SSH","node-ssh-port-help":"Normalmente 22; usa el puerto público del servidor SSH.","node-app-port-label":"Puerto NexusCrew del nodo","node-app-port-help":"El puerto indicado por `nexuscrew status` en el nodo remoto.","node-name-ph":"nombre (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"puerto remoto (opc.)","node-remove-confirm":"¿Eliminar el nodo «{name}»?","node-test":"test","tunnel-start":"iniciar túnel","tunnel-stop":"detener túnel","tunnel-restart":"reiniciar túnel","tunnel-up":"túnel activo","tunnel-down":"túnel caído","authorized-keys-hint":"pega esta línea en ~/.ssh/authorized_keys del host remoto:",copy:"copiar",copied:"copiado","token-rotate":"rotar token","token-rotate-explain":"El nuevo token NO se mostrará: recupéralo con `nexuscrew url`. La sesión se invalida al reiniciar el service.","service-regenerate":"regenerar service","service-installed":"service instalado","service-missing":"service no instalado","service-active":"activo","service-inactive":"no activo",confirm:"confirmar",add:"añadir",enable:"activar","wizard-title":"bienvenido a NexusCrew","wizard-skip":"configura después desde ajustes","wizard-step-roles":"roles de esta instalación","wizard-step-node":"primer nodo remoto (opcional)","wizard-step-rendezvous":"rendezvous para el rol nodo","wizard-done":"todo listo","wizard-done-desc":"configuración completa — puedes cambiarlo todo desde ajustes",next:"continuar",back:"atrás",skip:"omitir",finish:"terminar","err-node-name":"nombre inválido (a-z, 0-9, -, máx 32)","err-ssh":"ssh inválido (se espera user@host)","err-port":"puerto inválido (1–65535)","err-ssh-port":"puerto SSH inválido (1–65535)","err-node-port":"puerto NexusCrew inválido (1–65535)","err-rendezvous-required":"se necesita un rendezvous ssh (user@host) para activar el rol nodo","node-sessions":"{n} sesiones","tunnel-down-since":"túnel caído desde hace {t}","node-unreachable":"nodo inalcanzable","node-offline":"nodo desconectado","node-offline-seen":"sin conexión · visto hace {t}","node-needs-repair":"legacy · vuelve a enlazar","asks-title":"preguntas de las celdas","ask-reply-ph":"escribe la respuesta…","push-enable":"activar notificaciones push","push-disable":"desactivar notificaciones push","push-on":"push activas en este dispositivo","push-off":"push no activas","push-denied":"permiso de notificaciones denegado por el navegador","push-unsupported":"push no soportadas en este navegador"}};function ah(){const e=g_(),t=e?e.getItem(__):null;return tu.includes(t)?t:ia}function n0(e){const t=g_();if(t)try{t.setItem(__,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(oh))}function k(e){const t=ah(),r=qo[t]||qo[ia];return Object.prototype.hasOwnProperty.call(r,e)?r[e]:Object.prototype.hasOwnProperty.call(qo[ia],e)?qo[ia][e]:e}function o0(e){return typeof window>"u"?()=>{}:(window.addEventListener(oh,e),()=>window.removeEventListener(oh,e))}const v_=tu;function Wt(){return[I.useSyncExternalStore(o0,ah,ah),n0]}function y_({cell:e,engines:t=[],onConfirm:r,onClose:n}){var W;Wt();const a=!!(e&&e.active),l=t.length?t:[{id:(e==null?void 0:e.engine)||"native",label:(e==null?void 0:e.engine)||"native",rc:((e==null?void 0:e.engine)||"native")==="native"}],[h,d]=I.useState((e==null?void 0:e.engine)||l[0].id),m=l.find(M=>M.id===h),p=M=>{var Y,A;const J=l.find(P=>P.id===M);return((Y=e==null?void 0:e.models)==null?void 0:Y[M])||((e==null?void 0:e.engine)===M?e==null?void 0:e.model:"")||(J==null?void 0:J.model)||((A=J==null?void 0:J.models)==null?void 0:A[0])||""},[v,y]=I.useState(()=>p((e==null?void 0:e.engine)||l[0].id)),[S,g]=I.useState((e==null?void 0:e.boot)??!0),[C,b]=I.useState(!1),[E,j]=I.useState(null);async function T(M){M.preventDefault(),b(!0),j(null);try{a?await r({action:"down",boot:S}):await r({action:"up",engine:h,model:v,boot:S}),n()}catch(J){j(String(J&&J.message||J)),b(!1)}}return f.jsx("div",{className:"nc-sheet-overlay",onClick:n,children:f.jsxs("form",{className:"nc-sheet",onClick:M=>M.stopPropagation(),onSubmit:T,children:[f.jsxs("div",{className:"nc-sheet-head",children:[f.jsx("b",{children:e==null?void 0:e.cell}),f.jsx("span",{className:"nc-sheet-state",children:k(a?"state-on":"state-off")})]}),a?f.jsxs("label",{className:"nc-check",children:[f.jsx("input",{type:"checkbox",checked:S,onChange:M=>g(M.target.checked)}),k("remove-boot")]}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"nc-sheet-label",children:k("engine")}),f.jsx("div",{className:"nc-engines",children:l.map(M=>f.jsxs("label",{className:`nc-engine${h===M.id?" sel":""}`,children:[f.jsx("input",{type:"radio",name:"ps-engine",checked:h===M.id,onChange:()=>{d(M.id),y(p(M.id))}}),M.label,M.label.toLowerCase()!==M.id.toLowerCase()&&f.jsxs("small",{className:"nc-engine-id",children:[" (",M.id,")"]})]},M.id))}),m&&(m.models||[]).length>0&&f.jsxs("label",{className:"nc-field",children:[f.jsx("span",{children:k("model")}),f.jsx("select",{value:v,onChange:M=>y(M.target.value),children:m.models.map(M=>f.jsx("option",{value:M,children:M},M))}),f.jsx("small",{children:(W=e==null?void 0:e.models)!=null&&W[h]?k("model-remembered"):k("model-default")})]}),f.jsxs("label",{className:"nc-check",children:[f.jsx("input",{type:"checkbox",checked:S,onChange:M=>g(M.target.checked)}),k("boot-persist")]}),m&&!m.rc&&f.jsx("div",{className:"nc-note",children:k("no-remote-control")})]}),E&&f.jsx("div",{className:"nc-err",children:E}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",onClick:n,disabled:C,children:k("cancel")}),f.jsx("button",{type:"submit",className:"nc-btn primary",disabled:C,children:k(a?"power-off":"power-on")})]})]})})}const a0=/^[\w.-]{1,64}$/;function S_({presets:e=["shell"],targets:t=[],token:r,onCreate:n,onClose:a}){Wt();const[l,h]=I.useState(""),[d,m]=I.useState("~"),[p,v]=I.useState(e[0]||"shell"),[y,S]=I.useState(e),[g,C]=I.useState(""),[b,E]=I.useState(!1),[j,T]=I.useState(null),[W,M]=I.useState(null),[J,Y]=I.useState(null),A=a0.test(l)&&!l.startsWith("-");async function P(O){Y(null);try{const K=g?g.split("/"):[],H=await l_(r,O,K);M(H),m(H.path)}catch(K){Y(String(K&&K.message||K))}}async function z(O){if(O.preventDefault(),!!A){E(!0),T(null);try{await n({name:l,cwd:d==="~"?"":d,preset:p},g?g.split("/"):[]),a()}catch(K){T(String(K&&K.message||K)),E(!1)}}}return f.jsx("div",{className:"nc-sheet-overlay",onClick:a,children:f.jsxs("form",{className:"nc-sheet",onClick:O=>O.stopPropagation(),onSubmit:z,children:[f.jsx("div",{className:"nc-sheet-head",children:f.jsx("b",{children:k("new-session")})}),f.jsxs("label",{className:"nc-field",children:[k("location"),f.jsxs("select",{value:g,onChange:async O=>{const K=O.target.value;C(K),M(null);try{const H=await u_(r,K?K.split("/"):[]),B=Array.isArray(H.presets)&&H.presets.length?H.presets:["shell"];S(B),v(B[0])}catch{S(["shell"]),v("shell")}},children:[f.jsx("option",{value:"",children:k("local")}),t.map(O=>f.jsx("option",{value:O.route.join("/"),children:O.label},O.route.join("/")))]})]}),f.jsxs("label",{className:"nc-field",children:[k("name"),f.jsx("input",{value:l,onChange:O=>h(O.target.value),autoFocus:!0,placeholder:"worker-1"})]}),l&&!A&&f.jsx("div",{className:"nc-err",children:k("name-invalid")}),f.jsxs("label",{className:"nc-field",children:[k("cwd"),f.jsxs("div",{className:"nc-cwd-row",children:[f.jsx("input",{value:d,onChange:O=>m(O.target.value),placeholder:"~"}),r&&f.jsx("button",{type:"button",className:"nc-btn ghost nc-cwd-browse",onClick:()=>W?M(null):P(d==="~"?"":d),children:k("browse")})]})]}),W&&f.jsxs("div",{className:"nc-fs",onMouseDown:O=>O.stopPropagation(),children:[f.jsx("div",{className:"nc-fs-path",title:W.path,children:W.path}),f.jsxs("div",{className:"nc-fs-list",children:[f.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:()=>P(W.home),children:["⌂ ",k("fs-home")]}),W.parent&&f.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:()=>P(W.parent),children:["↑ ",k("fs-parent")]}),W.dirs.map(O=>f.jsxs("button",{type:"button",className:"nc-fs-item",onClick:()=>P(`${W.path.replace(/\/$/,"")}/${O}`),children:["📁 ",O]},O)),W.dirs.length===0&&f.jsx("div",{className:"nc-fs-empty",children:"—"})]}),J&&f.jsx("div",{className:"nc-err",children:J})]}),f.jsxs("label",{className:"nc-field",children:[k("preset"),f.jsx("select",{value:p,onChange:O=>v(O.target.value),children:y.map(O=>f.jsx("option",{value:O,children:O},O))})]}),j&&f.jsx("div",{className:"nc-err",children:j}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",onClick:a,disabled:b,children:k("cancel")}),f.jsx("button",{type:"submit",className:"nc-btn primary",disabled:b||!A,children:k("create")})]})]})})}const _p=/^[a-z0-9-]{1,32}$/;function l0(e,t,r){const n={};for(const a of Array.isArray(t)?t:[]){const l=Array.isArray(a==null?void 0:a.route)?a.route:typeof(a==null?void 0:a.name)=="string"?[a.name]:[];if(!l.length)continue;const h=l.join("/");a.status==="up"||a.tunnel&&a.tunnel.status==="up"||(n[h]=e&&e[h]||r)}return n}function gp({nodes:e,topology:t,remote:r,down:n}={}){const a=[],l=new Set,h=new Set;for(const d of Array.isArray(e)?e:[]){if(!d||typeof d.name!="string"||!_p.test(d.name))continue;const m=[d.name],p=d.name;l.add(p);const v=d.tunnel&&d.tunnel.status==="up",y={name:d.name,label:d.name,route:m,direct:!0,tunnelStatus:v?"up":"down",sessions:[]};if(d.nodeId&&h.add(d.nodeId),!d.nodeId&&d.paired===!1){a.push({...y,status:"needs-repair",downSince:n&&n[p]||null});continue}if(!v){a.push({...y,status:"down",downSince:n&&n[p]||null});continue}const S=r&&(r[p]||r[d.name])||null;if(!S||S.error||!Array.isArray(S.sessions)){a.push({...y,status:"unreachable"});continue}const g=S.sessions.filter(C=>C&&typeof C.name=="string"&&C.name).map(C=>({...C,node:p,route:m,key:`${p}:${C.name}`}));a.push({...y,status:"up",sessions:g})}for(const d of Array.isArray(t)?t:[]){if(!d||!Array.isArray(d.route)||d.route.length<1||d.route.some(S=>!_p.test(S)))continue;const m=d.route.join("/");if(l.has(m)||d.instanceId&&h.has(d.instanceId))continue;d.instanceId&&h.add(d.instanceId);const p={name:d.name,label:d.route.join(" › "),route:[...d.route],direct:!1,tunnelStatus:null,sessions:[],lastSeen:d.lastSeen||null};if(d.stale){a.push({...p,status:"offline",downSince:n&&n[m]||d.lastSeen||null});continue}const v=r&&r[m]||null;if(!v||v.error||!Array.isArray(v.sessions)){a.push({...p,status:"unreachable",downSince:n&&n[m]||null});continue}const y=v.sessions.filter(S=>S&&typeof S.name=="string"&&S.name).map(S=>({...S,node:m,route:d.route,key:`${m}:${S.name}`}));a.push({...p,status:"up",sessions:y,lastSeen:d.lastSeen||null})}return a.sort((d,m)=>d.label.localeCompare(m.label))}const c0=4e3;function iu(e,t=!0){const[r,n]=I.useState([]),a=I.useRef({});return I.useEffect(()=>{if(!t||!e){n([]);return}let l=!0;async function h(){var C;let m=[],p=[];if(await Promise.all([h_(e).then(b=>{m=Array.isArray(b.nodes)?b.nodes:[]}).catch(()=>{}),Vy(e).then(b=>{p=Array.isArray(b.nodes)?b.nodes:[]}).catch(()=>{})]),!l)return;const v={},y=new Set(m.map(b=>b.name)),S=[];for(const b of m)((C=b.tunnel)==null?void 0:C.status)==="up"&&(b.nodeId||b.paired!==!1)&&S.push([b.name]);for(const b of p)!b.stale&&Array.isArray(b.route)&&!(b.route.length===1&&y.has(b.route[0]))&&S.push(b.route);if(await Promise.all(S.map(async b=>{const E=b.join("/");try{v[E]=await qy(e,b)}catch{v[E]={error:"unreachable"}}})),!l)return;const g=gp({nodes:m,topology:p,remote:v,down:a.current});a.current=l0(a.current,g,Math.floor(Date.now()/1e3)),n(gp({nodes:m,topology:p,remote:v,down:a.current}))}h();const d=setInterval(h,c0);return()=>{l=!1,clearInterval(d)}},[e,t]),r}function vp(e,t){return t?0:e.attached?1:2}function xn(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 h0(e){return e.status==="down"?e.downSince?k("tunnel-down-since").replace("{t}",xn(e.downSince)):k("tunnel-down"):e.status==="unreachable"?k("node-unreachable"):e.status==="offline"?e.lastSeen?k("node-offline-seen").replace("{t}",xn(e.lastSeen)):k("node-offline"):e.status==="needs-repair"?k("node-needs-repair"):""}function u0({onPick:e,token:t,onSettings:r}){const[n,a]=Wt(),l=iu(t),[h,d]=I.useState(null),[m,p]=I.useState(null),[v,y]=I.useState(""),[S,g]=I.useState(""),[C,b]=I.useState({bind:"127.0.0.1",port:""}),[E,j]=I.useState([]),[T,W]=I.useState(!1),[M,J]=I.useState([]),[Y,A]=I.useState(["shell","claude","codex-vl","pi"]),[P,z]=I.useState(null),[O,K]=I.useState(!1),[H,B]=I.useState(null);async function D(){try{const oe=await(await vt("/api/sessions",t)).json();oe.error?(p(oe.error),d([])):(p(null),d(oe.sessions||[]))}catch(U){p(String(U)),d([])}try{const U=await wa(t);W(!!U.available),j(U.available?U.cells||[]:[]),J(U.available?U.engines||[]:[])}catch{W(!1),j([]),J([])}}I.useEffect(()=>{D(),vt("/api/config",t).then(oe=>oe.json()).then(oe=>{g(oe.version||""),b({bind:oe.bind||"127.0.0.1",port:oe.port||""}),Array.isArray(oe.presets)&&oe.presets.length&&A(oe.presets)}).catch(()=>{});const U=setInterval(D,4e3);return()=>clearInterval(U)},[]);async function X(){if(!C.port)return;const U=`http://${C.bind}:${C.port}/#token=${t}`;try{await navigator.clipboard.writeText(U)}catch{}}async function ee(U){if(!P)return;const{cell:oe}=P;U.action==="up"?await s_(t,{cell:oe,engine:U.engine,model:U.model||"",boot:!!U.boot}):await n_(t,{cell:oe,boot:!!U.boot}),D()}async function ie(U,oe=[]){try{await a_(t,U,oe)}catch{return}D()}async function x(U,oe=[]){await o_(t,U,oe),K(!1),D()}async function Q(U){if(!(!(U!=null&&U.direct)||H)){B(U.name);try{await eu(t,U.name,U.tunnelStatus==="up"?"down":"up")}catch{}B(null)}}const q=I.useMemo(()=>{const U=new Map;for(const oe of h||[])U.set(oe.name,oe);return U},[h]),R=I.useMemo(()=>new Set(E.map(U=>U.tmuxSession)),[E]),[$,ce]=I.useState(p_),ue=U=>ce(oe=>m_(oe,U)),pe=I.useMemo(()=>{const U=(h||[]).map(me=>{const Ue=Number(localStorage.getItem(r_(me.name))||0),oi=!!(me.outbox&&me.outbox.count>0&&me.outbox.latest>Ue);return{...me,fresh:oi}}),oe=v.trim().toLowerCase();return U.filter(me=>!oe||me.name.toLowerCase().includes(oe)).sort((me,Ue)=>nh(vn($,me.name,me.activity),vn($,Ue.name,Ue.activity))||vp(me,me.fresh)-vp(Ue,Ue.fresh)||me.name.localeCompare(Ue.name))},[h,v,$]),ye=pe.filter(U=>!R.has(U.name)),Se=I.useMemo(()=>[...E].sort((U,oe)=>nh(vn($,U.tmuxSession,(q.get(U.tmuxSession)||{}).activity),vn($,oe.tmuxSession,(q.get(oe.tmuxSession)||{}).activity))||Number(oe.active)-Number(U.active)||U.cell.localeCompare(oe.cell)),[E,$,q]),Ce=h?h.length:0,ke=(h||[]).filter(U=>U.attached).length,Te=C.port?`${C.bind}:${C.port}`:C.bind;return f.jsxs("div",{className:"nc-home",children:[f.jsxs("header",{className:"nc-home-head",children:[f.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",f.jsx("span",{className:"nc-cursor"})]}),f.jsxs("div",{className:"nc-home-sub",children:[k("fleet-tmux")," · ",Ce," ",k("sessions"),ke>0&&` · ${ke} attached`]}),f.jsxs("span",{className:"nc-head-actions",children:[f.jsx("button",{className:"nc-refresh",onClick:r,title:k("settings"),children:f.jsx(Ie,{name:"gear",size:18})}),f.jsx("button",{className:"nc-refresh",onClick:D,title:k("refresh"),children:f.jsx(Ie,{name:"refresh",size:18})})]})]}),Ce>8&&f.jsx("input",{className:"nc-filter",type:"search",placeholder:k("filter-placeholder"),value:v,onChange:U=>y(U.target.value)}),m&&f.jsx("div",{className:"nc-err",children:m}),T&&E.length>0&&f.jsxs("section",{className:"nc-group",children:[f.jsx("div",{className:"nc-group-title",children:k("fleet")}),Se.map(U=>{const oe=q.get(U.tmuxSession)||{},me=U.degraded?"warn":U.tmux?"on":"",Ue=[`${U.engine}${U.key?`·${U.key}`:""}`,oe.preview].filter(Boolean).join(" · ");return f.jsxs("div",{className:"nc-mcard",children:[f.jsxs("button",{className:"nc-mcard-main",onClick:()=>U.tmux&&e(U.tmuxSession),title:U.degraded?k("cell-degraded"):U.tmux?k("cell-on"):k("cell-off"),children:[f.jsx("span",{className:`dot ${me}`}),f.jsxs("span",{className:"nc-mcard-text",children:[f.jsx("b",{children:U.cell}),f.jsx("small",{children:Ue})]})]}),oe.activity?f.jsx("span",{className:"nc-rel",children:xn(oe.activity)}):null,oe.outbox&&oe.outbox.count>0&&f.jsx("span",{className:"nc-badge",title:k("new-files-outbox"),children:oe.outbox.count}),f.jsx("button",{className:`nc-act pin${$.includes(U.tmuxSession)?" on":""}`,title:k("pin"),onClick:()=>ue(U.tmuxSession),children:$.includes(U.tmuxSession)?"★":"☆"}),f.jsx("button",{className:`nc-act power${U.tmux?" on":""}${U.degraded?" warn":""}`,onClick:()=>z(U),title:U.active?k("power-off"):k("power-on"),children:f.jsx(Ie,{name:"power",size:16})})]},U.cell)})]}),f.jsxs("section",{className:"nc-group",children:[f.jsx("div",{className:"nc-group-title",children:k("local")}),ye.map(U=>f.jsxs("div",{className:"nc-mcard",children:[f.jsxs("button",{className:"nc-mcard-main",onClick:()=>e(U.name),children:[f.jsx("span",{className:U.attached?"dot on":"dot"}),f.jsxs("span",{className:"nc-mcard-text",children:[f.jsx("b",{children:U.name}),f.jsx("small",{children:U.preview?U.preview:U.cmd?U.cmd:k("windows").replace("{n}",String(U.windows||0))})]})]}),U.activity?f.jsx("span",{className:"nc-rel",children:xn(U.activity)}):null,U.fresh&&f.jsx("span",{className:"nc-badge",title:k("new-files-outbox"),children:U.outbox.count}),f.jsx("button",{className:`nc-act pin${$.includes(U.name)?" on":""}`,title:k("pin"),onClick:()=>ue(U.name),children:$.includes(U.name)?"★":"☆"}),f.jsx("button",{className:"nc-menu",title:k("terminate"),onClick:()=>{window.confirm(k("terminate-confirm").replace("{name}",U.name))&&ie(U.name)},children:"⋯"})]},U.name)),h===null&&f.jsx("div",{className:"nc-empty",children:k("loading-fleet")}),h!==null&&ye.length===0&&pe.length===0&&!m&&f.jsx("div",{className:"nc-empty",children:v?k("no-match").replace("{q}",v):k("no-sessions")})]}),l.map(U=>f.jsxs("section",{className:"nc-group",children:[f.jsxs("div",{className:"nc-group-title nc-node-title",children:[f.jsx("span",{className:`dot ${U.status==="up"?"on":"warn"}`}),U.label||U.name," · ",U.status==="up"?k("node-sessions").replace("{n}",String(U.sessions.length)):h0(U),U.direct&&f.jsx("button",{type:"button",className:`nc-act power${U.tunnelStatus==="up"?" on":""}`,disabled:H===U.name,title:U.tunnelStatus==="up"?k("power-off"):k("power-on"),onClick:()=>Q(U),children:f.jsx(Ie,{name:"power",size:15})})]}),U.status==="up"&&U.sessions.map(oe=>f.jsxs("div",{className:"nc-mcard",children:[f.jsxs("button",{className:"nc-mcard-main",onClick:()=>e({session:oe.name,node:oe.node}),children:[f.jsx("span",{className:oe.attached?"dot on":"dot"}),f.jsxs("span",{className:"nc-mcard-text",children:[f.jsx("b",{children:oe.name}),f.jsx("small",{children:oe.preview?oe.preview:oe.cmd?oe.cmd:k("windows").replace("{n}",String(oe.windows||0))})]})]}),oe.activity?f.jsx("span",{className:"nc-rel",children:xn(oe.activity)}):null,f.jsx("button",{className:"nc-menu",title:k("terminate"),onClick:()=>{window.confirm(k("terminate-confirm").replace("{name}",oe.name))&&ie(oe.name,U.route)},children:"⋯"})]},oe.key)),U.status==="up"&&U.sessions.length===0&&f.jsx("div",{className:"nc-empty",children:k("no-sessions-short")})]},`nodo-${(U.route||[U.name]).join("/")}`)),f.jsxs("footer",{className:"nc-home-foot",onClick:X,title:k("copy-url"),children:[S&&f.jsxs("span",{children:["v",S]}),f.jsxs("span",{children:[Te," · ",k("ssh-only")]}),f.jsx("span",{className:"nc-lang",onClick:U=>U.stopPropagation(),children:v_.map((U,oe)=>f.jsxs("span",{children:[oe>0&&" · ",f.jsx("button",{className:`nc-lang-btn${n===U?" on":""}`,onClick:()=>a(U),title:U,children:U.toUpperCase()})]},U))})]}),f.jsx("button",{className:"nc-fab",onClick:()=>K(!0),title:k("new-session"),"aria-label":k("new-session"),children:"+"}),P&&f.jsx(y_,{cell:P,engines:M,onConfirm:ee,onClose:()=>z(null)}),O&&f.jsx(S_,{presets:Y,targets:l.filter(U=>U.status==="up").map(U=>({route:U.route,label:U.label||U.name})),token:t,onCreate:x,onClose:()=>K(!1)})]})}/**
|
|
41
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
42
|
+
* @license MIT
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
45
|
+
* @license MIT
|
|
46
|
+
*
|
|
47
|
+
* Originally forked from (with the author's permission):
|
|
48
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
49
|
+
* http://bellard.org/jslinux/
|
|
50
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
51
|
+
*/var w_=Object.defineProperty,d0=Object.getOwnPropertyDescriptor,f0=(e,t)=>{for(var r in t)w_(e,r,{get:t[r],enumerable:!0})},Ze=(e,t,r,n)=>{for(var a=n>1?void 0:n?d0(t,r):t,l=e.length-1,h;l>=0;l--)(h=e[l])&&(a=(n?h(t,r,a):h(a))||a);return n&&a&&w_(t,r,a),a},de=(e,t)=>(r,n)=>t(r,n,e),yp="Terminal input",lh={get:()=>yp,set:e=>yp=e},Sp="Too much output to announce, navigate to rows manually to read",ch={get:()=>Sp,set:e=>Sp=e};function p0(e){return e.replace(/\r?\n/g,"\r")}function m0(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function _0(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function g0(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");C_(a,t,r,n)}}function C_(e,t,r,n){e=p0(e),e=m0(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function b_(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 wp(e,t,r,n,a){b_(e,t,r),a&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function fr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Ca(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 v0=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let n=0,a=0;if(this._interim){let l=e.charCodeAt(a++);56320<=l&&l<=57343?t[n++]=(this._interim-55296)*1024+l-56320+65536:(t[n++]=this._interim,t[n++]=l),this._interim=0}for(let l=a;l<r;++l){let h=e.charCodeAt(l);if(55296<=h&&h<=56319){if(++l>=r)return this._interim=h,n;let d=e.charCodeAt(l);56320<=d&&d<=57343?t[n++]=(h-55296)*1024+d-56320+65536:(t[n++]=h,t[n++]=d);continue}h!==65279&&(t[n++]=h)}return n}},y0=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let n=0,a,l,h,d,m=0,p=0;if(this.interim[0]){let S=!1,g=this.interim[0];g&=(g&224)===192?31:(g&240)===224?15:7;let C=0,b;for(;(b=this.interim[++C]&63)&&C<4;)g<<=6,g|=b;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,j=E-C;for(;p<j;){if(p>=r)return 0;if(b=e[p++],(b&192)!==128){p--,S=!0;break}else this.interim[C++]=b,g<<=6,g|=b&63}S||(E===2?g<128?p--:t[n++]=g:E===3?g<2048||g>=55296&&g<=57343||g===65279||(t[n++]=g):g<65536||g>1114111||(t[n++]=g)),this.interim.fill(0)}let v=r-4,y=p;for(;y<r;){for(;y<v&&!((a=e[y])&128)&&!((l=e[y+1])&128)&&!((h=e[y+2])&128)&&!((d=e[y+3])&128);)t[n++]=a,t[n++]=l,t[n++]=h,t[n++]=d,y+=4;if(a=e[y++],a<128)t[n++]=a;else if((a&224)===192){if(y>=r)return this.interim[0]=a,n;if(l=e[y++],(l&192)!==128){y--;continue}if(m=(a&31)<<6|l&63,m<128){y--;continue}t[n++]=m}else if((a&240)===224){if(y>=r)return this.interim[0]=a,n;if(l=e[y++],(l&192)!==128){y--;continue}if(y>=r)return this.interim[0]=a,this.interim[1]=l,n;if(h=e[y++],(h&192)!==128){y--;continue}if(m=(a&15)<<12|(l&63)<<6|h&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[n++]=m}else if((a&248)===240){if(y>=r)return this.interim[0]=a,n;if(l=e[y++],(l&192)!==128){y--;continue}if(y>=r)return this.interim[0]=a,this.interim[1]=l,n;if(h=e[y++],(h&192)!==128){y--;continue}if(y>=r)return this.interim[0]=a,this.interim[1]=l,this.interim[2]=h,n;if(d=e[y++],(d&192)!==128){y--;continue}if(m=(a&7)<<18|(l&63)<<12|(h&63)<<6|d&63,m<65536||m>1114111)continue;t[n++]=m}}return n}},x_="",pr=" ",Dn=class k_{constructor(){this.fg=0,this.bg=0,this.extended=new ca}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 k_;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}},ca=class E_{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 E_(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ni=class N_ extends Dn{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ca,this.combinedData=""}static fromCharData(t){let r=new N_;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?fr(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()]}},Cp="di$target",hh="di$dependencies",Cc=new Map;function S0(e){return e[hh]||[]}function yt(e){if(Cc.has(e))return Cc.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");w0(t,r,a)};return t._id=e,Cc.set(e,t),t}function w0(e,t,r){t[Cp]===t?t[hh].push({id:e,index:r}):(t[hh]=[{id:e,index:r}],t[Cp]=t)}var Lt=yt("BufferService"),R_=yt("CoreMouseService"),zr=yt("CoreService"),C0=yt("CharsetService"),ru=yt("InstantiationService"),D_=yt("LogService"),Tt=yt("OptionsService"),M_=yt("OscLinkService"),b0=yt("UnicodeService"),Mn=yt("DecorationService"),uh=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var v;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let n=[],a=this._optionsService.rawOptions.linkHandler,l=new ni,h=r.getTrimmedLength(),d=-1,m=-1,p=!1;for(let y=0;y<h;y++)if(!(m===-1&&!r.hasContent(y))){if(r.loadCell(y,l),l.hasExtendedAttrs()&&l.extended.urlId)if(m===-1){m=y,d=l.extended.urlId;continue}else p=l.extended.urlId!==d;else m!==-1&&(p=!0);if(p||m!==-1&&y===h-1){let S=(v=this._oscLinkService.getLinkData(d))==null?void 0:v.uri;if(S){let g={start:{x:m+1,y:e},end:{x:y+(!p&&y===h-1?1:0),y:e}},C=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let b=new URL(S);["http:","https:"].includes(b.protocol)||(C=!0)}catch{C=!0}C||n.push({text:S,range:g,activate:(b,E)=>a?a.activate(b,E,g):x0(b,E),hover:(b,E)=>{var j;return(j=a==null?void 0:a.hover)==null?void 0:j.call(a,b,E,g)},leave:(b,E)=>{var j;return(j=a==null?void 0:a.leave)==null?void 0:j.call(a,b,E,g)}})}p=!1,l.hasExtendedAttrs()&&l.extended.urlId?(m=y,d=l.extended.urlId):(m=-1,d=-1)}}t(n)}};uh=Ze([de(0,Lt),de(1,Tt),de(2,M_)],uh);function x0(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 ba=yt("CharSizeService"),Hi=yt("CoreBrowserService"),su=yt("MouseService"),Wi=yt("RenderService"),k0=yt("SelectionService"),P_=yt("CharacterJoinerService"),Ss=yt("ThemeService"),L_=yt("LinkProviderService"),E0=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?bp.isErrorNoTelemetry(e)?new bp(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)}},N0=new E0;function ra(e){R0(e)||N0.onUnexpectedError(e)}var dh="Canceled";function R0(e){return e instanceof D0?!0:e instanceof Error&&e.name===dh&&e.message===dh}var D0=class extends Error{constructor(){super(dh),this.name=this.message}};function M0(e){return new Error(`Illegal argument: ${e}`)}var bp=class fh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof fh)return t;let r=new fh;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},ph=class T_ extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,T_.prototype)}};function qt(e,t=0){return e[e.length-(1+t)]}var P0;(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})(P0||(P0={}));function L0(e,t){let r=this,n=!1,a;return function(){return n||(n=!0,t||(a=e.apply(r,arguments))),a}}var B_;(e=>{function t(M){return M&&typeof M=="object"&&typeof M[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*a(M){yield M}e.single=a;function l(M){return t(M)?M:a(M)}e.wrap=l;function h(M){return M||r}e.from=h;function*d(M){for(let J=M.length-1;J>=0;J--)yield M[J]}e.reverse=d;function m(M){return!M||M[Symbol.iterator]().next().done===!0}e.isEmpty=m;function p(M){return M[Symbol.iterator]().next().value}e.first=p;function v(M,J){let Y=0;for(let A of M)if(J(A,Y++))return!0;return!1}e.some=v;function y(M,J){for(let Y of M)if(J(Y))return Y}e.find=y;function*S(M,J){for(let Y of M)J(Y)&&(yield Y)}e.filter=S;function*g(M,J){let Y=0;for(let A of M)yield J(A,Y++)}e.map=g;function*C(M,J){let Y=0;for(let A of M)yield*J(A,Y++)}e.flatMap=C;function*b(...M){for(let J of M)yield*J}e.concat=b;function E(M,J,Y){let A=Y;for(let P of M)A=J(A,P);return A}e.reduce=E;function*j(M,J,Y=M.length){for(J<0&&(J+=M.length),Y<0?Y+=M.length:Y>M.length&&(Y=M.length);J<Y;J++)yield M[J]}e.slice=j;function T(M,J=Number.POSITIVE_INFINITY){let Y=[];if(J===0)return[Y,M];let A=M[Symbol.iterator]();for(let P=0;P<J;P++){let z=A.next();if(z.done)return[Y,e.empty()];Y.push(z.value)}return[Y,{[Symbol.iterator](){return A}}]}e.consume=T;async function W(M){let J=[];for await(let Y of M)J.push(Y);return Promise.resolve(J)}e.asyncToArray=W})(B_||(B_={}));function Ir(e){if(B_.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 T0(...e){return Ve(()=>Ir(e))}function Ve(e){return{dispose:L0(()=>{e()})}}var A_=class j_{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{Ir(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?j_.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)}};A_.DISABLE_DISPOSED_WARNING=!1;var mr=A_,Me=class{constructor(){this._store=new mr,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)}};Me.None=Object.freeze({dispose(){}});var vs=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},zi=typeof window=="object"?window:globalThis,mh=class _h{constructor(t){this.element=t,this.next=_h.Undefined,this.prev=_h.Undefined}};mh.Undefined=new mh(void 0);var Xe=mh,xp=class{constructor(){this._first=Xe.Undefined,this._last=Xe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Xe.Undefined}clear(){let e=this._first;for(;e!==Xe.Undefined;){let t=e.next;e.prev=Xe.Undefined,e.next=Xe.Undefined,e=t}this._first=Xe.Undefined,this._last=Xe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Xe(e);if(this._first===Xe.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!==Xe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Xe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Xe.Undefined&&e.next!==Xe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Xe.Undefined&&e.next===Xe.Undefined?(this._first=Xe.Undefined,this._last=Xe.Undefined):e.next===Xe.Undefined?(this._last=this._last.prev,this._last.next=Xe.Undefined):e.prev===Xe.Undefined&&(this._first=this._first.next,this._first.prev=Xe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Xe.Undefined;)yield e.element,e=e.next}},B0=globalThis.performance&&typeof globalThis.performance.now=="function",A0=class I_{static create(t){return new I_(t)}constructor(t){this._now=B0&&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}},bt;(e=>{e.None=()=>Me.None;function t(H,B){return y(H,()=>{},0,void 0,!0,void 0,B)}e.defer=t;function r(H){return(B,D=null,X)=>{let ee=!1,ie;return ie=H(x=>{if(!ee)return ie?ie.dispose():ee=!0,B.call(D,x)},null,X),ee&&ie.dispose(),ie}}e.once=r;function n(H,B,D){return p((X,ee=null,ie)=>H(x=>X.call(ee,B(x)),null,ie),D)}e.map=n;function a(H,B,D){return p((X,ee=null,ie)=>H(x=>{B(x),X.call(ee,x)},null,ie),D)}e.forEach=a;function l(H,B,D){return p((X,ee=null,ie)=>H(x=>B(x)&&X.call(ee,x),null,ie),D)}e.filter=l;function h(H){return H}e.signal=h;function d(...H){return(B,D=null,X)=>{let ee=T0(...H.map(ie=>ie(x=>B.call(D,x))));return v(ee,X)}}e.any=d;function m(H,B,D,X){let ee=D;return n(H,ie=>(ee=B(ee,ie),ee),X)}e.reduce=m;function p(H,B){let D,X={onWillAddFirstListener(){D=H(ee.fire,ee)},onDidRemoveLastListener(){D==null||D.dispose()}},ee=new le(X);return B==null||B.add(ee),ee.event}function v(H,B){return B instanceof Array?B.push(H):B&&B.add(H),H}function y(H,B,D=100,X=!1,ee=!1,ie,x){let Q,q,R,$=0,ce,ue={leakWarningThreshold:ie,onWillAddFirstListener(){Q=H(ye=>{$++,q=B(q,ye),X&&!R&&(pe.fire(q),q=void 0),ce=()=>{let Se=q;q=void 0,R=void 0,(!X||$>1)&&pe.fire(Se),$=0},typeof D=="number"?(clearTimeout(R),R=setTimeout(ce,D)):R===void 0&&(R=0,queueMicrotask(ce))})},onWillRemoveListener(){ee&&$>0&&(ce==null||ce())},onDidRemoveLastListener(){ce=void 0,Q.dispose()}},pe=new le(ue);return x==null||x.add(pe),pe.event}e.debounce=y;function S(H,B=0,D){return e.debounce(H,(X,ee)=>X?(X.push(ee),X):[ee],B,void 0,!0,void 0,D)}e.accumulate=S;function g(H,B=(X,ee)=>X===ee,D){let X=!0,ee;return l(H,ie=>{let x=X||!B(ie,ee);return X=!1,ee=ie,x},D)}e.latch=g;function C(H,B,D){return[e.filter(H,B,D),e.filter(H,X=>!B(X),D)]}e.split=C;function b(H,B=!1,D=[],X){let ee=D.slice(),ie=H(q=>{ee?ee.push(q):Q.fire(q)});X&&X.add(ie);let x=()=>{ee==null||ee.forEach(q=>Q.fire(q)),ee=null},Q=new le({onWillAddFirstListener(){ie||(ie=H(q=>Q.fire(q)),X&&X.add(ie))},onDidAddFirstListener(){ee&&(B?setTimeout(x):x())},onDidRemoveLastListener(){ie&&ie.dispose(),ie=null}});return X&&X.add(Q),Q.event}e.buffer=b;function E(H,B){return(D,X,ee)=>{let ie=B(new T);return H(function(x){let Q=ie.evaluate(x);Q!==j&&D.call(X,Q)},void 0,ee)}}e.chain=E;let j=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(B){return this.steps.push(B),this}forEach(B){return this.steps.push(D=>(B(D),D)),this}filter(B){return this.steps.push(D=>B(D)?D:j),this}reduce(B,D){let X=D;return this.steps.push(ee=>(X=B(X,ee),X)),this}latch(B=(D,X)=>D===X){let D=!0,X;return this.steps.push(ee=>{let ie=D||!B(ee,X);return D=!1,X=ee,ie?ee:j}),this}evaluate(B){for(let D of this.steps)if(B=D(B),B===j)break;return B}}function W(H,B,D=X=>X){let X=(...Q)=>x.fire(D(...Q)),ee=()=>H.on(B,X),ie=()=>H.removeListener(B,X),x=new le({onWillAddFirstListener:ee,onDidRemoveLastListener:ie});return x.event}e.fromNodeEventEmitter=W;function M(H,B,D=X=>X){let X=(...Q)=>x.fire(D(...Q)),ee=()=>H.addEventListener(B,X),ie=()=>H.removeEventListener(B,X),x=new le({onWillAddFirstListener:ee,onDidRemoveLastListener:ie});return x.event}e.fromDOMEventEmitter=M;function J(H){return new Promise(B=>r(H)(B))}e.toPromise=J;function Y(H){let B=new le;return H.then(D=>{B.fire(D)},()=>{B.fire(void 0)}).finally(()=>{B.dispose()}),B.event}e.fromPromise=Y;function A(H,B){return H(D=>B.fire(D))}e.forward=A;function P(H,B,D){return B(D),H(X=>B(X))}e.runAndSubscribe=P;class z{constructor(B,D){this._observable=B,this._counter=0,this._hasChanged=!1;let X={onWillAddFirstListener:()=>{B.addObserver(this)},onDidRemoveLastListener:()=>{B.removeObserver(this)}};this.emitter=new le(X),D&&D.add(this.emitter)}beginUpdate(B){this._counter++}handlePossibleChange(B){}handleChange(B,D){this._hasChanged=!0}endUpdate(B){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function O(H,B){return new z(H,B).emitter.event}e.fromObservable=O;function K(H){return(B,D,X)=>{let ee=0,ie=!1,x={beginUpdate(){ee++},endUpdate(){ee--,ee===0&&(H.reportChanges(),ie&&(ie=!1,B.call(D)))},handlePossibleChange(){},handleChange(){ie=!0}};H.addObserver(x),H.reportChanges();let Q={dispose(){H.removeObserver(x)}};return X instanceof mr?X.add(Q):Array.isArray(X)&&X.push(Q),Q}}e.fromObservableLight=K})(bt||(bt={}));var gh=class vh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${vh._idPool++}`,vh.all.add(this)}start(t){this._stopWatch=new A0,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}}};gh.all=new Set,gh._idPool=0;var j0=gh,I0=-1,O_=class z_{constructor(t,r,n=(z_._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let n=this.threshold;if(n<=0||r<n)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[l,h]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${h}):`;console.warn(d),console.warn(l);let m=new F0(d,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}};O_._idPool=1;var O0=O_,z0=class F_{constructor(t){this.value=t}static create(){let t=new Error;return new F_(t.stack??"")}print(){console.warn(this.value.split(`
|
|
58
|
+
`).slice(2).join(`
|
|
59
|
+
`))}},F0=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},H0=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},W0=0,bc=class{constructor(e){this.value=e,this.id=W0++}},$0=2,U0,le=class{constructor(e){var t,r,n,a;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new O0((e==null?void 0:e.onListenerError)??ra,((r=this._options)==null?void 0:r.leakWarningThreshold)??I0):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new j0(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var e,t,r,n;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(n=this._leakageMon)==null||n.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var h,d,m,p,v;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let y=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(y);let S=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],g=new H0(`${y}. HINT: Stack shows most frequent listener (${S[1]}-times)`,S[0]);return(((h=this._options)==null?void 0:h.onListenerError)||ra)(g),Me.None}if(this._disposed)return Me.None;t&&(e=e.bind(t));let n=new bc(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 bc?(this._deliveryQueue??(this._deliveryQueue=new K0),this._listeners=[this._listeners,n]):this._listeners.push(n):((m=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||m.call(d,this),this._listeners=n,(v=(p=this._options)==null?void 0:p.onDidAddFirstListener)==null||v.call(p,this)),this._size++;let l=Ve(()=>{a==null||a(),this._removeListener(n)});return r instanceof mr?r.add(l):Array.isArray(r)&&r.push(l),l}),this._event}_removeListener(e){var a,l,h,d;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,(d=(h=this._options)==null?void 0:h.onDidRemoveLastListener)==null||d.call(h,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let n=this._deliveryQueue.current===this;if(this._size*$0<=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)||ra;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 bc)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}},K0=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}},yh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new le,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new le,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};yh.INSTANCE=new yh;var nu=yh;function V0(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}nu.INSTANCE.onDidChangeZoomLevel;function q0(e){return nu.INSTANCE.getZoomFactor(e)}nu.INSTANCE.onDidChangeFullscreen;var ws=typeof navigator=="object"?navigator.userAgent:"",Sh=ws.indexOf("Firefox")>=0,Y0=ws.indexOf("AppleWebKit")>=0,ou=ws.indexOf("Chrome")>=0,X0=!ou&&ws.indexOf("Safari")>=0;ws.indexOf("Electron/")>=0;ws.indexOf("Android")>=0;var xc=!1;if(typeof zi.matchMedia=="function"){let e=zi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=zi.matchMedia("(display-mode: fullscreen)");xc=e.matches,V0(zi,e,({matches:r})=>{xc&&t.matches||(xc=r)})}var gs="en",wh=!1,Ch=!1,sa=!1,H_=!1,Yo,na=gs,kp=gs,G0,mi,jr=globalThis,Ct,e_;typeof jr.vscode<"u"&&typeof jr.vscode.process<"u"?Ct=jr.vscode.process:typeof process<"u"&&typeof((e_=process==null?void 0:process.versions)==null?void 0:e_.node)=="string"&&(Ct=process);var t_,Q0=typeof((t_=Ct==null?void 0:Ct.versions)==null?void 0:t_.electron)=="string",J0=Q0&&(Ct==null?void 0:Ct.type)==="renderer",i_;if(typeof Ct=="object"){wh=Ct.platform==="win32",Ch=Ct.platform==="darwin",sa=Ct.platform==="linux",sa&&Ct.env.SNAP&&Ct.env.SNAP_REVISION,Ct.env.CI||Ct.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Yo=gs,na=gs;let e=Ct.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Yo=t.userLocale,kp=t.osLocale,na=t.resolvedLanguage||gs,G0=(i_=t.languagePack)==null?void 0:i_.translationsConfigFile}catch{}H_=!0}else typeof navigator=="object"&&!J0?(mi=navigator.userAgent,wh=mi.indexOf("Windows")>=0,Ch=mi.indexOf("Macintosh")>=0,(mi.indexOf("Macintosh")>=0||mi.indexOf("iPad")>=0||mi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,sa=mi.indexOf("Linux")>=0,(mi==null?void 0:mi.indexOf("Mobi"))>=0,na=globalThis._VSCODE_NLS_LANGUAGE||gs,Yo=navigator.language.toLowerCase(),kp=Yo):console.error("Unable to resolve platform.");var W_=wh,Ni=Ch,Z0=sa,Ep=H_,Ri=mi,cr=na,eS;(e=>{function t(){return cr}e.value=t;function r(){return cr.length===2?cr==="en":cr.length>=3?cr[0]==="e"&&cr[1]==="n"&&cr[2]==="-":!1}e.isDefaultVariant=r;function n(){return cr==="en"}e.isDefault=n})(eS||(eS={}));var tS=typeof jr.postMessage=="function"&&!jr.importScripts;(()=>{if(tS){let e=[];jr.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}),jr.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var iS=!!(Ri&&Ri.indexOf("Chrome")>=0);Ri&&Ri.indexOf("Firefox")>=0;!iS&&Ri&&Ri.indexOf("Safari")>=0;Ri&&Ri.indexOf("Edg/")>=0;Ri&&Ri.indexOf("Android")>=0;var ps=typeof navigator=="object"?navigator:{};Ep||document.queryCommandSupported&&document.queryCommandSupported("copy")||ps&&ps.clipboard&&ps.clipboard.writeText,Ep||ps&&ps.clipboard&&ps.clipboard.readText;var au=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}},kc=new au,Np=new au,Rp=new au,rS=new Array(230),$_;(e=>{function t(d){return kc.keyCodeToStr(d)}e.toString=t;function r(d){return kc.strToKeyCode(d)}e.fromString=r;function n(d){return Np.keyCodeToStr(d)}e.toUserSettingsUS=n;function a(d){return Rp.keyCodeToStr(d)}e.toUserSettingsGeneral=a;function l(d){return Np.strToKeyCode(d)||Rp.strToKeyCode(d)}e.fromUserSettings=l;function h(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return kc.keyCodeToStr(d)}e.toElectronAccelerator=h})($_||($_={}));var sS=class U_{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 U_&&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 nS([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},nS=class{constructor(e){if(e.length===0)throw M0("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 oS(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return $_.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Sh)switch(t){case 59:return 85;case 60:if(Z0)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ni)return 57;break}else if(Y0&&(Ni&&t===93||!Ni&&t===92))return 57;return rS[t]||0}var aS=Ni?256:2048,lS=512,cS=1024,hS=Ni?2048:256,Dp=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=oS(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|=aS),this.altKey&&(t|=lS),this.shiftKey&&(t|=cS),this.metaKey&&(t|=hS),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new sS(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Mp=new WeakMap;function uS(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 dS=class{static getSameOriginWindowChain(e){let t=Mp.get(e);if(!t){t=[],Mp.set(e,t);let r=e,n;do n=uS(r),n?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=n;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,n=0,a=this.getSameOriginWindowChain(e);for(let l of a){let h=l.window.deref();if(r+=(h==null?void 0:h.scrollY)??0,n+=(h==null?void 0:h.scrollX)??0,h===t||!l.iframeElement)break;let d=l.iframeElement.getBoundingClientRect();r+=d.top,n+=d.left}return{top:r,left:n}}},Xo=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=dS.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Pp=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(ou){let l=navigator.userAgent.match(/Chrome\/(\d+)/);n=(l?parseInt(l[1]):123)<=122}if(e){let l=e,h=e,d=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof l.wheelDeltaY<"u")n?this.deltaY=l.wheelDeltaY/(120*d):this.deltaY=l.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?Sh&&!Ni?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")X0&&W_?this.deltaX=-(l.wheelDeltaX/120):n?this.deltaX=l.wheelDeltaX/(120*d):this.deltaX=l.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?Sh&&!Ni?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*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},K_=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),fS;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof pS?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:bt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:K_})})(fS||(fS={}));var pS=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?K_:(this._emitter||(this._emitter=new le),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},lu=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 ph("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new ph("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},mS=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 ph("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=Ve(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},_S;(e=>{async function t(n){let a,l=await Promise.all(n.map(h=>h.then(d=>d,d=>{a||(a=d)})));if(typeof a<"u")throw a;return l}e.settled=t;function r(n){return new Promise(async(a,l)=>{try{await n(a,l)}catch(h){l(h)}})}e.withAsyncBody=r})(_S||(_S={}));var Lp=class ri{static fromArray(t){return new ri(r=>{r.emitMany(t)})}static fromPromise(t){return new ri(async r=>{r.emitMany(await t)})}static fromPromises(t){return new ri(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new ri(async r=>{await Promise.all(t.map(async n=>{for await(let a of n)r.emitOne(a)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new le,queueMicrotask(async()=>{let n={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(n)),this.resolve()}catch(a){this.reject(a)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await bt.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 ri(async n=>{for await(let a of t)n.emitOne(r(a))})}map(t){return ri.map(this,t)}static filter(t,r){return new ri(async n=>{for await(let a of t)r(a)&&n.emitOne(a)})}filter(t){return ri.filter(this,t)}static coalesce(t){return ri.filter(t,r=>!!r)}coalesce(){return ri.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return ri.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())}};Lp.EMPTY=Lp.fromArray([]);var{getWindow:Ei,getWindowId:gS,onDidRegisterWindow:vS}=(function(){let e=new Map,t={window:zi,disposables:new mr};e.set(zi.vscodeWindowId,t);let r=new le,n=new le,a=new le;function l(h,d){return(typeof h=="number"?e.get(h):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:n.event,registerWindow(h){if(e.has(h.vscodeWindowId))return Me.None;let d=new mr,m={window:h,disposables:d.add(new mr)};return e.set(h.vscodeWindowId,m),d.add(Ve(()=>{e.delete(h.vscodeWindowId),n.fire(h)})),d.add(Ne(h,pt.BEFORE_UNLOAD,()=>{a.fire(h)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:l,getWindow(h){var p;let d=h;if((p=d==null?void 0:d.ownerDocument)!=null&&p.defaultView)return d.ownerDocument.defaultView.window;let m=h;return m!=null&&m.view?m.view.window:zi},getDocument(h){return Ei(h).document}}})(),yS=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 Ne(e,t,r,n){return new yS(e,t,r,n)}var Tp=function(e,t,r,n){return Ne(e,t,r,n)},cu,SS=class extends mS{constructor(e){super(),this.defaultTarget=e&&Ei(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},Bp=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){ra(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,n=new Map,a=l=>{r.set(l,!1);let h=e.get(l)??[];for(t.set(l,h),e.set(l,[]),n.set(l,!0);h.length>0;)h.sort(Bp.sort),h.shift().execute();n.set(l,!1)};cu=(l,h,d=0)=>{let m=gS(l),p=new Bp(h,d),v=e.get(m);return v||(v=[],e.set(m,v)),v.push(p),r.get(m)||(r.set(m,!0),l.requestAnimationFrame(()=>a(m))),p}})();function wS(e){let t=e.getBoundingClientRect(),r=Ei(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var pt={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"},CS=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=Ft(t);this._maxWidth!==r&&(this._maxWidth=r,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let r=Ft(t);this._width!==r&&(this._width=r,this.domNode.style.width=this._width)}setHeight(t){let r=Ft(t);this._height!==r&&(this._height=r,this.domNode.style.height=this._height)}setTop(t){let r=Ft(t);this._top!==r&&(this._top=r,this.domNode.style.top=this._top)}setLeft(t){let r=Ft(t);this._left!==r&&(this._left=r,this.domNode.style.left=this._left)}setBottom(t){let r=Ft(t);this._bottom!==r&&(this._bottom=r,this.domNode.style.bottom=this._bottom)}setRight(t){let r=Ft(t);this._right!==r&&(this._right=r,this.domNode.style.right=this._right)}setPaddingTop(t){let r=Ft(t);this._paddingTop!==r&&(this._paddingTop=r,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let r=Ft(t);this._paddingLeft!==r&&(this._paddingLeft=r,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let r=Ft(t);this._paddingBottom!==r&&(this._paddingBottom=r,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let r=Ft(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=Ft(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=Ft(t);this._lineHeight!==r&&(this._lineHeight=r,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let r=Ft(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 Ft(e){return typeof e=="number"?`${e}px`:e}function kn(e){return new CS(e)}var V_=class{constructor(){this._hooks=new mr,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(Ve(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Ei(e)}this._hooks.add(Ne(l,pt.POINTER_MOVE,h=>{if(h.buttons!==r){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(Ne(l,pt.POINTER_UP,h=>this.stopMonitoring(!0)))}};function bS(e,t,r){let n=null,a=null;if(typeof r.value=="function"?(n="value",a=r.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",a=r.get),!a)throw new Error("not supported");let l=`$memoize$${t}`;r[n]=function(...h){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,h)}),this[l]}}var ki;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ki||(ki={}));var yn=class Rt extends Me{constructor(){super(),this.dispatched=!1,this.targets=new xp,this.ignoreTargets=new xp,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(bt.runAndSubscribe(vS,({window:t,disposables:r})=>{r.add(Ne(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(Ne(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(Ne(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:zi,disposables:this._store}))}static addTarget(t){if(!Rt.isTouchDevice())return Me.None;Rt.INSTANCE||(Rt.INSTANCE=new Rt);let r=Rt.INSTANCE.targets.push(t);return Ve(r)}static ignoreTarget(t){if(!Rt.isTouchDevice())return Me.None;Rt.INSTANCE||(Rt.INSTANCE=new Rt);let r=Rt.INSTANCE.ignoreTargets.push(t);return Ve(r)}static isTouchDevice(){return"ontouchstart"in zi||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,a=t.targetTouches.length;n<a;n++){let l=t.targetTouches.item(n);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:r,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[r],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let h=this.newGestureEvent(ki.Start,l.target);h.pageX=l.pageX,h.pageY=l.pageY,this.dispatchEvent(h)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let n=Date.now(),a=Object.keys(this.activeTouches).length;for(let l=0,h=r.changedTouches.length;l<h;l++){let d=r.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let m=this.activeTouches[d.identifier],p=Date.now()-m.initialTimeStamp;if(p<Rt.HOLD_DELAY&&Math.abs(m.initialPageX-qt(m.rollingPageX))<30&&Math.abs(m.initialPageY-qt(m.rollingPageY))<30){let v=this.newGestureEvent(ki.Tap,m.initialTarget);v.pageX=qt(m.rollingPageX),v.pageY=qt(m.rollingPageY),this.dispatchEvent(v)}else if(p>=Rt.HOLD_DELAY&&Math.abs(m.initialPageX-qt(m.rollingPageX))<30&&Math.abs(m.initialPageY-qt(m.rollingPageY))<30){let v=this.newGestureEvent(ki.Contextmenu,m.initialTarget);v.pageX=qt(m.rollingPageX),v.pageY=qt(m.rollingPageY),this.dispatchEvent(v)}else if(a===1){let v=qt(m.rollingPageX),y=qt(m.rollingPageY),S=qt(m.rollingTimestamps)-m.rollingTimestamps[0],g=v-m.rollingPageX[0],C=y-m.rollingPageY[0],b=[...this.targets].filter(E=>m.initialTarget instanceof Node&&E.contains(m.initialTarget));this.inertia(t,b,n,Math.abs(g)/S,g>0?1:-1,v,Math.abs(C)/S,C>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(ki.End,m.initialTarget)),delete this.activeTouches[d.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===ki.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Rt.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===ki.Change||t.type===ki.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let r=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let a=0,l=t.initialTarget;for(;l&&l!==n;)a++,l=l.parentElement;r.push([a,n])}r.sort((n,a)=>n[0]-a[0]);for(let[n,a]of r)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,n,a,l,h,d,m,p){this.handle=cu(t,()=>{let v=Date.now(),y=v-n,S=0,g=0,C=!0;a+=Rt.SCROLL_FRICTION*y,d+=Rt.SCROLL_FRICTION*y,a>0&&(C=!1,S=l*a*y),d>0&&(C=!1,g=m*d*y);let b=this.newGestureEvent(ki.Change);b.translationX=S,b.translationY=g,r.forEach(E=>E.dispatchEvent(b)),C||this.inertia(t,r,v,a,l,h+S,d,m,p+g)})}onTouchMove(t){let r=Date.now();for(let n=0,a=t.changedTouches.length;n<a;n++){let l=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let h=this.activeTouches[l.identifier],d=this.newGestureEvent(ki.Change,h.initialTarget);d.translationX=l.pageX-qt(h.rollingPageX),d.translationY=l.pageY-qt(h.rollingPageY),d.pageX=l.pageX,d.pageY=l.pageY,this.dispatchEvent(d),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(l.pageX),h.rollingPageY.push(l.pageY),h.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};yn.SCROLL_FRICTION=-.005,yn.HOLD_DELAY=700,yn.CLEAR_TAP_COUNT_TIME=400,Ze([bS],yn,"isTouchDevice",1);var xS=yn,hu=class extends Me{onclick(e,t){this._register(Ne(e,pt.CLICK,r=>t(new Xo(Ei(e),r))))}onmousedown(e,t){this._register(Ne(e,pt.MOUSE_DOWN,r=>t(new Xo(Ei(e),r))))}onmouseover(e,t){this._register(Ne(e,pt.MOUSE_OVER,r=>t(new Xo(Ei(e),r))))}onmouseleave(e,t){this._register(Ne(e,pt.MOUSE_LEAVE,r=>t(new Xo(Ei(e),r))))}onkeydown(e,t){this._register(Ne(e,pt.KEY_DOWN,r=>t(new Dp(r))))}onkeyup(e,t){this._register(Ne(e,pt.KEY_UP,r=>t(new Dp(r))))}oninput(e,t){this._register(Ne(e,pt.INPUT,t))}onblur(e,t){this._register(Ne(e,pt.BLUR,t))}onfocus(e,t){this._register(Ne(e,pt.FOCUS,t))}onchange(e,t){this._register(Ne(e,pt.CHANGE,t))}ignoreGesture(e){return xS.ignoreTarget(e)}},Ap=11,kS=class extends hu{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=Ap+"px",this.domNode.style.height=Ap+"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 V_),this._register(Tp(this.bgDomNode,pt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Tp(this.domNode,pt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new SS),this._pointerdownScheduleRepeatTimer=this._register(new lu)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ei(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()}},ES=class bh{constructor(t,r,n,a,l,h,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,a=a|0,l=l|0,h=h|0,d=d|0),this.rawScrollLeft=a,this.rawScrollTop=d,r<0&&(r=0),a+r>n&&(a=n-r),a<0&&(a=0),l<0&&(l=0),d+l>h&&(d=h-l),d<0&&(d=0),this.width=r,this.scrollWidth=n,this.scrollLeft=a,this.height=l,this.scrollHeight=h,this.scrollTop=d}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 bh(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 bh(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let n=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,h=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:a,scrollLeftChanged:l,heightChanged:h,scrollHeightChanged:d,scrollTopChanged:m}}},NS=class extends Me{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new le),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new ES(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 Ip(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=Ip.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)))}},jp=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function Ec(e,t){let r=t-e;return function(n){return e+r*MS(n)}}function RS(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var Ip=class xh{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),RS(Ec(t,a),Ec(l,r),.33)}return Ec(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 jp(n,a,!1)}return new jp(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return xh.start(t,r,n)}static start(t,r,n){n=n+10;let a=Date.now()-10;return new xh(t,r,a,n)}};function DS(e){return Math.pow(e,3)}function MS(e){return 1-DS(1-e)}var PS=class extends Me{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 lu)}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":"")))}},LS=140,q_=class extends hu{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 PS(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new V_),this._shouldRender=!0,this.domNode=kn(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(Ne(this.domNode.domNode,pt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new kS(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=kn(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(Ne(this.slider.domNode,pt.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=wS(this.domNode.domNode);t=e.pageX-a.left,r=e.pageY-a.top}let n=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let l=this._sliderOrthogonalPointerPosition(a),h=Math.abs(l-r);if(W_&&h>LS){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let d=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(d))},()=>{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()}},Y_=class kh{constructor(t,r,n,a,l,h){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=l,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new kh(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,n,a,l){let h=Math.max(0,n-t),d=Math.max(0,h-2*r),m=a>0&&a>n;if(!m)return{computedAvailableSize:Math.round(h),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(n*d/a))),v=(d-p)/(a-n),y=l*v;return{computedAvailableSize:Math.round(h),computedIsNeeded:m,computedSliderSize:Math.round(p),computedSliderRatio:v,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let t=kh._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let 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)}},TS=class extends q_{constructor(e,t,r){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Y_(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}},BS=class extends q_{constructor(e,t,r){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Y_(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}},AS=500,Op=50,jS=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Eh=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(ou){let r=Ei(t.browserEvent),n=q0(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 jS(t,r,n);this._front===-1&&this._rear===-1?(this._memory[0]=l,this._front=0,this._rear=0):(a=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=l),l.score=this._computeScore(l,a)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),r){let a=Math.abs(t.deltaX),l=Math.abs(t.deltaY),h=Math.abs(r.deltaX),d=Math.abs(r.deltaY),m=Math.max(Math.min(a,h),1),p=Math.max(Math.min(l,d),1),v=Math.max(a,h),y=Math.max(l,d);v%m===0&&y%p===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Eh.INSTANCE=new Eh;var IS=Eh,OS=class extends hu{constructor(e,t,r){super(),this._onScroll=this._register(new le),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new le),this.onWillScroll=this._onWillScroll.event,this._options=FS(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 BS(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new TS(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=kn(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=kn(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=kn(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 lu),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ir(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,Ni&&(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 Pp(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ir(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new Pp(r))};this._mouseWheelToDispose.push(Ne(this._listenOnDomNode,pt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=IS.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+l===0?h=l=0:Math.abs(l)>=Math.abs(h)?h=0:l=0),this._options.flipAxes&&([l,h]=[h,l]);let d=!Ni&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!h&&(h=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let m=this._scrollable.getFutureScrollPosition(),p={};if(l){let v=Op*l,y=m.scrollTop-(v<0?Math.floor(v):Math.ceil(v));this._verticalScrollbar.writeScrollPosition(p,y)}if(h){let v=Op*h,y=m.scrollLeft-(v<0?Math.floor(v):Math.ceil(v));this._horizontalScrollbar.writeScrollPosition(p,y)}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(),AS)}},zS=class extends OS{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 FS(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,Ni&&(t.className+=" mac"),t}var Nh=class extends Me{constructor(e,t,r,n,a,l,h,d){super(),this._bufferService=r,this._optionsService=h,this._renderService=d,this._onRequestScrollLines=this._register(new le),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new NS({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>cu(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(bt.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ve(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ve(()=>this._styleElement.remove())),this._register(bt.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}};Nh=Ze([de(2,Lt),de(3,Hi),de(4,R_),de(5,Ss),de(6,Tt),de(7,Wi)],Nh);var Rh=class extends Me{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(Ve(()=>{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()}};Rh=Ze([de(1,Lt),de(2,Hi),de(3,Mn),de(4,Wi)],Rh);var HS=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)}},Ci={full:0,left:0,center:0,right:0},hr={full:0,left:0,center:0,right:0},un={full:0,left:0,center:0,right:0},ha=class extends Me{constructor(e,t,r,n,a,l,h,d){var p;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=a,this._optionsService=l,this._themeService=h,this._coreBrowserService=d,this._colorZoneStore=new HS,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(Ve(()=>{var v;return(v=this._canvas)==null?void 0:v.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);hr.full=this._canvas.width,hr.left=e,hr.center=t,hr.right=e,this._refreshDrawHeightConstants(),un.full=1,un.left=1,un.center=1+hr.left,un.right=1+hr.left+hr.center}_refreshDrawHeightConstants(){Ci.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);Ci.left=t,Ci.center=t,Ci.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ci.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ci.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ci.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ci.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(un[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ci[e.position||"full"]/2),hr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ci[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}))}};ha=Ze([de(2,Lt),de(3,Mn),de(4,Wi),de(5,Tt),de(6,Ss),de(7,Hi)],ha);var te;(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=""))(te||(te={}));var oa;(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=""))(oa||(oa={}));var X_;(e=>e.ST=`${te.ESC}\\`)(X_||(X_={}));var Dh=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(`${te.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)}}};Dh=Ze([de(2,Lt),de(3,Tt),de(4,zr),de(5,Wi)],Dh);var mt=0,_t=0,gt=0,Je=0,zp={css:"#00000000",rgba:0},nt;(e=>{function t(a,l,h,d){return d!==void 0?`#${Pr(a)}${Pr(l)}${Pr(h)}${Pr(d)}`:`#${Pr(a)}${Pr(l)}${Pr(h)}`}e.toCss=t;function r(a,l,h,d=255){return(a<<24|l<<16|h<<8|d)>>>0}e.toRgba=r;function n(a,l,h,d){return{css:e.toCss(a,l,h,d),rgba:e.toRgba(a,l,h,d)}}e.toColor=n})(nt||(nt={}));var $e;(e=>{function t(m,p){if(Je=(p.rgba&255)/255,Je===1)return{css:p.css,rgba:p.rgba};let v=p.rgba>>24&255,y=p.rgba>>16&255,S=p.rgba>>8&255,g=m.rgba>>24&255,C=m.rgba>>16&255,b=m.rgba>>8&255;mt=g+Math.round((v-g)*Je),_t=C+Math.round((y-C)*Je),gt=b+Math.round((S-b)*Je);let E=nt.toCss(mt,_t,gt),j=nt.toRgba(mt,_t,gt);return{css:E,rgba:j}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function n(m,p,v){let y=aa.ensureContrastRatio(m.rgba,p.rgba,v);if(y)return nt.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=n;function a(m){let p=(m.rgba|255)>>>0;return[mt,_t,gt]=aa.toChannels(p),{css:nt.toCss(mt,_t,gt),rgba:p}}e.opaque=a;function l(m,p){return Je=Math.round(p*255),[mt,_t,gt]=aa.toChannels(m.rgba),{css:nt.toCss(mt,_t,gt,Je),rgba:nt.toRgba(mt,_t,gt,Je)}}e.opacity=l;function h(m,p){return Je=m.rgba&255,l(m,Je*p/255)}e.multiplyOpacity=h;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})($e||($e={}));var Ge;(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 mt=parseInt(a.slice(1,2).repeat(2),16),_t=parseInt(a.slice(2,3).repeat(2),16),gt=parseInt(a.slice(3,4).repeat(2),16),nt.toColor(mt,_t,gt);case 5:return mt=parseInt(a.slice(1,2).repeat(2),16),_t=parseInt(a.slice(2,3).repeat(2),16),gt=parseInt(a.slice(3,4).repeat(2),16),Je=parseInt(a.slice(4,5).repeat(2),16),nt.toColor(mt,_t,gt,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 mt=parseInt(l[1]),_t=parseInt(l[2]),gt=parseInt(l[3]),Je=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),nt.toColor(mt,_t,gt,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),[mt,_t,gt,Je]=t.getImageData(0,0,1,1).data,Je!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:nt.toRgba(mt,_t,gt,Je),css:a}}e.toColor=n})(Ge||(Ge={}));var Pt;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,l){let h=n/255,d=a/255,m=l/255,p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),y=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return p*.2126+v*.7152+y*.0722}e.relativeLuminance2=r})(Pt||(Pt={}));var aa;(e=>{function t(h,d){if(Je=(d&255)/255,Je===1)return d;let m=d>>24&255,p=d>>16&255,v=d>>8&255,y=h>>24&255,S=h>>16&255,g=h>>8&255;return mt=y+Math.round((m-y)*Je),_t=S+Math.round((p-S)*Je),gt=g+Math.round((v-g)*Je),nt.toRgba(mt,_t,gt)}e.blend=t;function r(h,d,m){let p=Pt.relativeLuminance(h>>8),v=Pt.relativeLuminance(d>>8);if(Oi(p,v)<m){if(v<p){let g=n(h,d,m),C=Oi(p,Pt.relativeLuminance(g>>8));if(C<m){let b=a(h,d,m),E=Oi(p,Pt.relativeLuminance(b>>8));return C>E?g:b}return g}let y=a(h,d,m),S=Oi(p,Pt.relativeLuminance(y>>8));if(S<m){let g=n(h,d,m),C=Oi(p,Pt.relativeLuminance(g>>8));return S>C?y:g}return y}}e.ensureContrastRatio=r;function n(h,d,m){let p=h>>24&255,v=h>>16&255,y=h>>8&255,S=d>>24&255,g=d>>16&255,C=d>>8&255,b=Oi(Pt.relativeLuminance2(S,g,C),Pt.relativeLuminance2(p,v,y));for(;b<m&&(S>0||g>0||C>0);)S-=Math.max(0,Math.ceil(S*.1)),g-=Math.max(0,Math.ceil(g*.1)),C-=Math.max(0,Math.ceil(C*.1)),b=Oi(Pt.relativeLuminance2(S,g,C),Pt.relativeLuminance2(p,v,y));return(S<<24|g<<16|C<<8|255)>>>0}e.reduceLuminance=n;function a(h,d,m){let p=h>>24&255,v=h>>16&255,y=h>>8&255,S=d>>24&255,g=d>>16&255,C=d>>8&255,b=Oi(Pt.relativeLuminance2(S,g,C),Pt.relativeLuminance2(p,v,y));for(;b<m&&(S<255||g<255||C<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),b=Oi(Pt.relativeLuminance2(S,g,C),Pt.relativeLuminance2(p,v,y));return(S<<24|g<<16|C<<8|255)>>>0}e.increaseLuminance=a;function l(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=l})(aa||(aa={}));function Pr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Oi(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var WS=class extends Dn{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()]}},ua=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ni}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],n=t.translateToString(!0),a=0,l=0,h=0,d=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!==d||this._workCell.bg!==m){if(p-a>1){let v=this._getJoinedRanges(n,h,l,t,a);for(let y=0;y<v.length;y++)r.push(v[y])}a=p,h=l,d=this._workCell.fg,m=this._workCell.bg}l+=this._workCell.getChars().length||pr.length}if(this._bufferService.cols-a>1){let p=this._getJoinedRanges(n,h,l,t,a);for(let v=0;v<p.length;v++)r.push(p[v])}return r}_getJoinedRanges(e,t,r,n,a){let l=e.substring(t,r),h=[];try{h=this._characterJoiners[0].handler(l)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let m=this._characterJoiners[d].handler(l);for(let p=0;p<m.length;p++)ua._mergeRanges(h,m[p])}catch(m){console.error(m)}return this._stringRangesToCellRanges(h,n,a),h}_stringRangesToCellRanges(e,t,r){let n=0,a=!1,l=0,h=e[n];if(h){for(let d=r;d<this._bufferService.cols;d++){let m=t.getWidth(d),p=t.getString(d).length||pr.length;if(m!==0){if(!a&&h[0]<=l&&(h[0]=d,a=!0),h[1]<=l){if(h[1]=d,h=e[++n],!h)break;h[0]<=l?(h[0]=d,a=!0):a=!1}l+=p}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(r){if(t[1]<=a[0])return e[n-1][1]=t[1],e;if(t[1]<=a[1])return e[n-1][1]=Math.max(t[1],a[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=a[0])return e.splice(n,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};ua=Ze([de(0,Lt)],ua);function $S(e){return 57508<=e&&e<=57558}function US(e){return 9472<=e&&e<=9631}function KS(e){return $S(e)||US(e)}function VS(){return{css:{canvas:Go(),cell:Go()},device:{canvas:Go(),cell:Go(),char:{width:0,height:0,left:0,top:0}}}}function Go(){return{width:0,height:0}}var Mh=class{constructor(e,t,r,n,a,l,h){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=a,this._decorationService=l,this._themeService=h,this._workCell=new ni,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,a,l,h,d,m,p,v){let y=[],S=this._characterJoinerService.getJoinedCharacters(t),g=this._themeService.colors,C=e.getNoBgTrimmedLength();r&&C<l+1&&(C=l+1);let b,E=0,j="",T=0,W=0,M=0,J=0,Y=!1,A=0,P=!1,z=0,O=0,K=[],H=p!==-1&&v!==-1;for(let B=0;B<C;B++){e.loadCell(B,this._workCell);let D=this._workCell.getWidth();if(D===0)continue;let X=!1,ee=B>=O,ie=B,x=this._workCell;if(S.length>0&&B===S[0][0]&&ee){let me=S.shift(),Ue=this._isCellInSelection(me[0],t);for(T=me[0]+1;T<me[1];T++)ee&&(ee=Ue===this._isCellInSelection(T,t));ee&&(ee=!r||l<me[0]||l>=me[1]),ee?(X=!0,x=new WS(this._workCell,e.translateToString(!0,me[0],me[1]),me[1]-me[0]),ie=me[1]-1,D=x.getWidth()):O=me[1]}let Q=this._isCellInSelection(B,t),q=r&&B===l,R=H&&B>=p&&B<=v,$=!1;this._decorationService.forEachDecorationAtCell(B,t,void 0,me=>{$=!0});let ce=x.getChars()||pr;if(ce===" "&&(x.isUnderline()||x.isOverline())&&(ce=" "),z=D*d-m.get(ce,x.isBold(),x.isItalic()),!b)b=this._document.createElement("span");else if(E&&(Q&&P||!Q&&!P&&x.bg===W)&&(Q&&P&&g.selectionForeground||x.fg===M)&&x.extended.ext===J&&R===Y&&z===A&&!q&&!X&&!$&&ee){x.isInvisible()?j+=pr:j+=ce,E++;continue}else E&&(b.textContent=j),b=this._document.createElement("span"),E=0,j="";if(W=x.bg,M=x.fg,J=x.extended.ext,Y=R,A=z,P=Q,X&&l>=B&&l<=ie&&(l=B),!this._coreService.isCursorHidden&&q&&this._coreService.isCursorInitialized){if(K.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&K.push("xterm-cursor-blink"),K.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":K.push("xterm-cursor-outline");break;case"block":K.push("xterm-cursor-block");break;case"bar":K.push("xterm-cursor-bar");break;case"underline":K.push("xterm-cursor-underline");break}}if(x.isBold()&&K.push("xterm-bold"),x.isItalic()&&K.push("xterm-italic"),x.isDim()&&K.push("xterm-dim"),x.isInvisible()?j=pr:j=x.getChars()||pr,x.isUnderline()&&(K.push(`xterm-underline-${x.extended.underlineStyle}`),j===" "&&(j=" "),!x.isUnderlineColorDefault()))if(x.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${Dn.toColorRGB(x.getUnderlineColor()).join(",")})`;else{let me=x.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&x.isBold()&&me<8&&(me+=8),b.style.textDecorationColor=g.ansi[me].css}x.isOverline()&&(K.push("xterm-overline"),j===" "&&(j=" ")),x.isStrikethrough()&&K.push("xterm-strikethrough"),R&&(b.style.textDecoration="underline");let ue=x.getFgColor(),pe=x.getFgColorMode(),ye=x.getBgColor(),Se=x.getBgColorMode(),Ce=!!x.isInverse();if(Ce){let me=ue;ue=ye,ye=me;let Ue=pe;pe=Se,Se=Ue}let ke,Te,U=!1;this._decorationService.forEachDecorationAtCell(B,t,void 0,me=>{me.options.layer!=="top"&&U||(me.backgroundColorRGB&&(Se=50331648,ye=me.backgroundColorRGB.rgba>>8&16777215,ke=me.backgroundColorRGB),me.foregroundColorRGB&&(pe=50331648,ue=me.foregroundColorRGB.rgba>>8&16777215,Te=me.foregroundColorRGB),U=me.options.layer==="top")}),!U&&Q&&(ke=this._coreBrowserService.isFocused?g.selectionBackgroundOpaque:g.selectionInactiveBackgroundOpaque,ye=ke.rgba>>8&16777215,Se=50331648,U=!0,g.selectionForeground&&(pe=50331648,ue=g.selectionForeground.rgba>>8&16777215,Te=g.selectionForeground)),U&&K.push("xterm-decoration-top");let oe;switch(Se){case 16777216:case 33554432:oe=g.ansi[ye],K.push(`xterm-bg-${ye}`);break;case 50331648:oe=nt.toColor(ye>>16,ye>>8&255,ye&255),this._addStyle(b,`background-color:#${Fp((ye>>>0).toString(16),"0",6)}`);break;case 0:default:Ce?(oe=g.foreground,K.push("xterm-bg-257")):oe=g.background}switch(ke||x.isDim()&&(ke=$e.multiplyOpacity(oe,.5)),pe){case 16777216:case 33554432:x.isBold()&&ue<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ue+=8),this._applyMinimumContrast(b,oe,g.ansi[ue],x,ke,void 0)||K.push(`xterm-fg-${ue}`);break;case 50331648:let me=nt.toColor(ue>>16&255,ue>>8&255,ue&255);this._applyMinimumContrast(b,oe,me,x,ke,Te)||this._addStyle(b,`color:#${Fp(ue.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(b,oe,g.foreground,x,ke,Te)||Ce&&K.push("xterm-fg-257")}K.length&&(b.className=K.join(" "),K.length=0),!q&&!X&&!$&&ee?E++:b.textContent=j,z!==this.defaultSpacing&&(b.style.letterSpacing=`${z}px`),y.push(b),B=ie}return b&&E&&(b.textContent=j),y}_applyMinimumContrast(e,t,r,n,a,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||KS(n.getCode()))return!1;let h=this._getContrastCache(n),d;if(!a&&!l&&(d=h.getColor(t.rgba,r.rgba)),d===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);d=$e.ensureContrastRatio(a||t,l||r,m),h.setColor((a||t).rgba,(l||r).rgba,d??null)}return d?(this._addStyle(e,`color:${d.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]}};Mh=Ze([de(1,P_),de(2,Tt),de(3,Hi),de(4,zr),de(5,Mn),de(6,Ss)],Mh);function Fp(e,t,r){for(;e.length<r;)e=t+e;return e}var qS=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[r,n,a,l],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(a),this._container.appendChild(l),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,r,n){e===this._font&&t===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,r){let n=0;if(!t&&!r&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let h=this._measure(e,0);return h>0&&(this._flat[n]=h),h}let a=e;t&&(a+="B"),r&&(a+="I");let l=this._holey.get(a);if(l===void 0){let h=0;t&&(h|=1),r&&(h|=2),l=this._measure(e,h),l>0&&this._holey.set(a,l)}return l}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},YS=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,n=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let a=e.buffers.active.ydisp,l=t[1]-a,h=r[1]-a,d=Math.max(l,0),m=Math.min(h,e.rows-1);if(d>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=l,this.viewportEndRow=h,this.viewportCappedStartRow=d,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 XS(){return new YS}var Nc="xterm-dom-renderer-owner-",ii="xterm-rows",Qo="xterm-fg-",Hp="xterm-bg-",dn="xterm-focus",Jo="xterm-selection",GS=1,Ph=class extends Me{constructor(e,t,r,n,a,l,h,d,m,p,v,y,S,g){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=a,this._helperContainer=l,this._linkifier2=h,this._charSizeService=m,this._optionsService=p,this._bufferService=v,this._coreService=y,this._coreBrowserService=S,this._themeService=g,this._terminalClass=GS++,this._rowElements=[],this._selectionRenderModel=XS(),this.onRequestRedraw=this._register(new le).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ii),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(Jo),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=VS(),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=d.createInstance(Mh,document),this._element.classList.add(Nc+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(Ve(()=>{this._element.classList.remove(Nc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new qS(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} .${ii} 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} .${ii} { 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} .${ii} .xterm-dim { color: ${$e.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} .${ii}.${dn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ii}.${dn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ii}.${dn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Jo} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Jo} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Jo} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,h]of e.ansi.entries())t+=`${this._terminalSelector} .${Qo}${l} { color: ${h.css}; }${this._terminalSelector} .${Qo}${l}.xterm-dim { color: ${$e.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${Hp}${l} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${Qo}257 { color: ${$e.opaque(e.background).css}; }${this._terminalSelector} .${Qo}257.xterm-dim { color: ${$e.multiplyOpacity($e.opaque(e.background),.5).css}; }${this._terminalSelector} .${Hp}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(dn),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(dn),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,h=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(r){let m=e[0]>t[0];d.appendChild(this._createSelectionElement(l,m?t[0]:e[0],m?e[0]:t[0],h-l+1))}else{let m=n===l?e[0]:0,p=l===a?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(l,m,p));let v=h-l-1;if(d.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,v)),l!==h){let y=a===h?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(h,0,y))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,r,n=1){let a=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(r-t);return l+h>this.dimensions.css.canvas.width&&(h=this.dimensions.css.canvas.width-l),a.style.height=`${n*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${l}px`,a.style.width=`${h}px`,a}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,n=r.ybase+r.y,a=Math.min(r.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let p=m+r.ydisp,v=this._rowElements[m],y=r.lines.get(p);if(!v||!y)break;v.replaceChildren(...this._rowFactory.createRow(y,p,p===n,h,d,a,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Nc}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,r,n,a,l){r<0&&(e=0),n<0&&(t=0);let h=this._bufferService.rows-1;r=Math.max(Math.min(r,h),0),n=Math.max(Math.min(n,h),0),a=Math.min(a,this._bufferService.cols);let d=this._bufferService.buffer,m=d.ybase+d.y,p=Math.min(d.x,a-1),v=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let g=r;g<=n;++g){let C=g+d.ydisp,b=this._rowElements[g],E=d.lines.get(C);if(!b||!E)break;b.replaceChildren(...this._rowFactory.createRow(E,C,C===m,y,S,p,v,this.dimensions.css.cell.width,this._widthCache,l?g===r?e:0:-1,l?(g===n?t:a)-1:-1))}}};Ph=Ze([de(7,ru),de(8,ba),de(9,Tt),de(10,Lt),de(11,zr),de(12,Hi),de(13,Ss)],Ph);var Lh=class extends Me{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new le),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new JS(this._optionsService))}catch{this._measureStrategy=this._register(new QS(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())}};Lh=Ze([de(2,Tt)],Lh);var G_=class extends Me{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)}},QS=class extends G_{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}},JS=class extends G_{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}},ZS=class extends Me{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 ew(this._window)),this._onDprChange=this._register(new le),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new le),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(bt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ne(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ne(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}},ew=class extends Me{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new vs),this._onDprChange=this._register(new le),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ve(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ne(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)}},tw=class extends Me{constructor(){super(),this.linkProviders=[],this._register(Ve(()=>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 uu(e,t,r){let n=r.getBoundingClientRect(),a=e.getComputedStyle(r),l=parseInt(a.getPropertyValue("padding-left")),h=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-n.left-l,t.clientY-n.top-h]}function iw(e,t,r,n,a,l,h,d,m){if(!l)return;let p=uu(e,t,r);if(p)return p[0]=Math.ceil((p[0]+(m?h/2:0))/h),p[1]=Math.ceil(p[1]/d),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 Th=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,a){return iw(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=uu(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])}}};Th=Ze([de(0,Wi),de(1,ba)],Th);var rw=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=[]}},Q_={};f0(Q_,{getSafariVersion:()=>nw,isChromeOS:()=>tg,isFirefox:()=>J_,isIpad:()=>ow,isIphone:()=>aw,isLegacyEdge:()=>sw,isLinux:()=>du,isMac:()=>da,isNode:()=>xa,isSafari:()=>Z_,isWindows:()=>eg});var xa=typeof process<"u"&&"title"in process,Pn=xa?"node":navigator.userAgent,Ln=xa?"node":navigator.platform,J_=Pn.includes("Firefox"),sw=Pn.includes("Edge"),Z_=/^((?!chrome|android).)*safari/i.test(Pn);function nw(){if(!Z_)return 0;let e=Pn.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var da=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ln),ow=Ln==="iPad",aw=Ln==="iPhone",eg=["Windows","Win16","Win32","WinCE"].includes(Ln),du=Ln.indexOf("Linux")>=0,tg=/\bCrOS\b/.test(Pn),ig=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()}},lw=class extends ig{_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())}}},cw=class extends ig{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},fa=!xa&&"requestIdleCallback"in window?cw:lw,hw=class{constructor(){this._queue=new fa}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Bh=class extends Me{constructor(e,t,r,n,a,l,h,d,m){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=a,this._coreBrowserService=d,this._renderer=this._register(new vs),this._pausedResizeTask=new hw,this._observerDisposable=this._register(new vs),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new le),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new le),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new le),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new le),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new rw((p,v)=>this._renderRows(p,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new uw(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ve(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>{var p;return(p=this._renderer.value)==null?void 0:p.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(p=>this._registerIntersectionObserver(p,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=Ve(()=>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()}};Bh=Ze([de(2,Tt),de(3,ba),de(4,zr),de(5,Mn),de(6,Lt),de(7,Hi),de(8,Ss)],Bh);var uw=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 dw(e,t,r,n){let a=r.buffer.x,l=r.buffer.y;if(!r.buffer.hasScrollback)return mw(a,l,e,t,r,n)+ka(l,t,r,n)+_w(a,l,e,t,r,n);let h;if(l===t)return h=a>e?"D":"C",Nn(Math.abs(a-e),En(h,n));h=l>t?"D":"C";let d=Math.abs(l-t),m=pw(l>t?e:a,r)+(d-1)*r.cols+1+fw(l>t?a:e);return Nn(m,En(h,n))}function fw(e,t){return e-1}function pw(e,t){return t.cols-e}function mw(e,t,r,n,a,l){return ka(t,n,a,l).length===0?"":Nn(sg(e,t,e,t-Or(t,a),!1,a).length,En("D",l))}function ka(e,t,r,n){let a=e-Or(e,r),l=t-Or(t,r),h=Math.abs(a-l)-gw(e,t,r);return Nn(h,En(rg(e,t),n))}function _w(e,t,r,n,a,l){let h;ka(t,n,a,l).length>0?h=n-Or(n,a):h=t;let d=n,m=vw(e,t,r,n,a,l);return Nn(sg(e,h,r,d,m==="C",a).length,En(m,l))}function gw(e,t,r){var h;let n=0,a=e-Or(e,r),l=t-Or(t,r);for(let d=0;d<Math.abs(a-l);d++){let m=rg(e,t)==="A"?-1:1;(h=r.buffer.lines.get(a+m*d))!=null&&h.isWrapped&&n++}return n}function Or(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 vw(e,t,r,n,a,l){let h;return ka(r,n,a,l).length>0?h=n-Or(n,a):h=t,e<r&&h<=n||e>=r&&h<n?"C":"D"}function rg(e,t){return e>t?"A":"B"}function sg(e,t,r,n,a,l){let h=e,d=t,m="";for(;(h!==r||d!==n)&&d>=0&&d<l.buffer.lines.length;)h+=a?1:-1,a&&h>l.cols-1?(m+=l.buffer.translateBufferLineToString(d,!1,e,h),h=0,e=0,d++):!a&&h<0&&(m+=l.buffer.translateBufferLineToString(d,!1,0,e+1),h=l.cols-1,e=h,d--);return m+l.buffer.translateBufferLineToString(d,!1,e,h)}function En(e,t){let r=t?"O":"[";return te.ESC+r+e}function Nn(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var yw=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 Wp(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 Rc=50,Sw=15,ww=50,Cw=500,bw=" ",xw=new RegExp(bw,"g"),Ah=class extends Me{constructor(e,t,r,n,a,l,h,d,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=a,this._mouseService=l,this._optionsService=h,this._renderService=d,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ni,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new le),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new le),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new le),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new le),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=p=>this._handleMouseMove(p),this._mouseUpListener=p=>this._handleMouseUp(p),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(p=>this._handleTrim(p)),this._register(this._bufferService.buffers.onBufferActivate(p=>this._handleBufferActivate(p))),this.enable(),this._model=new yw(this._bufferService),this._activeSelectionMode=0,this._register(Ve(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(p=>{p.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let h=e[1];h<=t[1];h++){let d=r.translateBufferLineToString(h,!0,a,l);n.push(d)}}else{let a=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],a));for(let l=e[1]+1;l<=t[1]-1;l++){let h=r.lines.get(l),d=r.translateBufferLineToString(l,!0);h!=null&&h.isWrapped?n[n.length-1]+=d:n.push(d)}if(e[1]!==t[1]){let l=r.lines.get(t[1]),h=r.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?n[n.length-1]+=h:n.push(h)}}return n.map(a=>a.replace(xw," ")).join(eg?`\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())),du&&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=Wp(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=uu(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,-Rc),Rc),t/=Rc,t/Math.abs(t)+Math.round(t*(Sw-1)))}shouldForceSelection(e){return da?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(),ww)}_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&&!(da&&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<Cw&&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=dw(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let n=0;t>=n;n++){let a=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:a>1&&t!==n&&(r+=a-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,l=a.lines.get(e[1]);if(!l)return;let h=a.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(l,e[0]),m=d,p=e[0]-d,v=0,y=0,S=0,g=0;if(h.charAt(d)===" "){for(;d>0&&h.charAt(d-1)===" ";)d--;for(;m<h.length&&h.charAt(m+1)===" ";)m++}else{let E=e[0],j=e[0];l.getWidth(E)===0&&(v++,E--),l.getWidth(j)===2&&(y++,j++);let T=l.getString(j).length;for(T>1&&(g+=T-1,m+=T-1);E>0&&d>0&&!this._isCharWordSeparator(l.loadCell(E-1,this._workCell));){l.loadCell(E-1,this._workCell);let W=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,E--):W>1&&(S+=W-1,d-=W-1),d--,E--}for(;j<l.length&&m+1<h.length&&!this._isCharWordSeparator(l.loadCell(j+1,this._workCell));){l.loadCell(j+1,this._workCell);let W=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,j++):W>1&&(g+=W-1,m+=W-1),m++,j++}}m++;let C=d+p-v+S,b=Math.min(this._bufferService.cols,m-d+v+y-S-g);if(!(!t&&h.slice(d,m).trim()==="")){if(r&&C===0&&l.getCodePoint(0)!==32){let E=a.lines.get(e[1]-1);if(E&&l.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let j=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(j){let T=this._bufferService.cols-j.start;C-=T,b+=T}}}if(n&&C+b===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let E=a.lines.get(e[1]+1);if(E!=null&&E.isWrapped&&E.getCodePoint(0)!==32){let j=this._getWordAt([0,e[1]+1],!1,!1,!0);j&&(b+=j.length)}}return{start:C,length:b}}}_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=Wp(r,this._bufferService.cols)}};Ah=Ze([de(3,Lt),de(4,zr),de(5,su),de(6,Tt),de(7,Wi),de(8,Hi)],Ah);var $p=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={}}},Up=class{constructor(){this._color=new $p,this._css=new $p}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()}},lt=Object.freeze((()=>{let e=[Ge.toColor("#2e3436"),Ge.toColor("#cc0000"),Ge.toColor("#4e9a06"),Ge.toColor("#c4a000"),Ge.toColor("#3465a4"),Ge.toColor("#75507b"),Ge.toColor("#06989a"),Ge.toColor("#d3d7cf"),Ge.toColor("#555753"),Ge.toColor("#ef2929"),Ge.toColor("#8ae234"),Ge.toColor("#fce94f"),Ge.toColor("#729fcf"),Ge.toColor("#ad7fa8"),Ge.toColor("#34e2e2"),Ge.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})()),Lr=Ge.toColor("#ffffff"),Sn=Ge.toColor("#000000"),Kp=Ge.toColor("#ffffff"),Vp=Sn,fn={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},kw=Lr,jh=class extends Me{constructor(e){super(),this._optionsService=e,this._contrastCache=new Up,this._halfContrastCache=new Up,this._onChangeColors=this._register(new le),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Lr,background:Sn,cursor:Kp,cursorAccent:Vp,selectionForeground:void 0,selectionBackgroundTransparent:fn,selectionBackgroundOpaque:$e.blend(Sn,fn),selectionInactiveBackgroundTransparent:fn,selectionInactiveBackgroundOpaque:$e.blend(Sn,fn),scrollbarSliderBackground:$e.opacity(Lr,.2),scrollbarSliderHoverBackground:$e.opacity(Lr,.4),scrollbarSliderActiveBackground:$e.opacity(Lr,.5),overviewRulerBorder:Lr,ansi:lt.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,Lr),t.background=ze(e.background,Sn),t.cursor=$e.blend(t.background,ze(e.cursor,Kp)),t.cursorAccent=$e.blend(t.background,ze(e.cursorAccent,Vp)),t.selectionBackgroundTransparent=ze(e.selectionBackground,fn),t.selectionBackgroundOpaque=$e.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ze(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=$e.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ze(e.selectionForeground,zp):void 0,t.selectionForeground===zp&&(t.selectionForeground=void 0),$e.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=$e.opacity(t.selectionBackgroundTransparent,.3)),$e.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=$e.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ze(e.scrollbarSliderBackground,$e.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ze(e.scrollbarSliderHoverBackground,$e.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ze(e.scrollbarSliderActiveBackground,$e.opacity(t.foreground,.5)),t.overviewRulerBorder=ze(e.overviewRulerBorder,kw),t.ansi=lt.slice(),t.ansi[0]=ze(e.black,lt[0]),t.ansi[1]=ze(e.red,lt[1]),t.ansi[2]=ze(e.green,lt[2]),t.ansi[3]=ze(e.yellow,lt[3]),t.ansi[4]=ze(e.blue,lt[4]),t.ansi[5]=ze(e.magenta,lt[5]),t.ansi[6]=ze(e.cyan,lt[6]),t.ansi[7]=ze(e.white,lt[7]),t.ansi[8]=ze(e.brightBlack,lt[8]),t.ansi[9]=ze(e.brightRed,lt[9]),t.ansi[10]=ze(e.brightGreen,lt[10]),t.ansi[11]=ze(e.brightYellow,lt[11]),t.ansi[12]=ze(e.brightBlue,lt[12]),t.ansi[13]=ze(e.brightMagenta,lt[13]),t.ansi[14]=ze(e.brightCyan,lt[14]),t.ansi[15]=ze(e.brightWhite,lt[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],lt[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()}}};jh=Ze([de(0,Tt)],jh);function ze(e,t){if(e!==void 0)try{return Ge.toColor(e)}catch{}return t}var Ew=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)}},Nw=class{constructor(){this._services=new Ew,this._services.set(ru,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=S0(e).sort((l,h)=>l.index-h.index),n=[];for(let l of r){let h=this._services.get(l.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);n.push(h)}let a=r.length>0?r[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},Rw={trace:0,debug:1,info:2,warn:3,error:4,off:5},Dw="xterm.js: ",Ih=class extends Me{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=Rw[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?"":Dw)+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)}};Ih=Ze([de(0,Tt)],Ih);var qp=class extends Me{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new le),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new le),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new le),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<r.length;n++)this._array[this._getCyclicIndex(e+n)]=r[n];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let a=t-1;a>=0;a--)this.set(e+a+r,this.get(e+a));let n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},De=3,st=Object.freeze(new Dn),Zo=0,Dc=2,wn=class ng{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*De);let a=r||ni.fromCharData([0,x_,1,0]);for(let l=0;l<t;++l)this.setCell(l,a);this.length=t}get(t){let r=this._data[t*De+0],n=r&2097151;return[this._data[t*De+1],r&2097152?this._combined[t]:n?fr(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*De+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*De+0]=t|2097152|r[2]<<22):this._data[t*De+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*De+0]>>22}hasWidth(t){return this._data[t*De+0]&12582912}getFg(t){return this._data[t*De+1]}getBg(t){return this._data[t*De+2]}hasContent(t){return this._data[t*De+0]&4194303}getCodePoint(t){let r=this._data[t*De+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*De+0]&2097152}getString(t){let r=this._data[t*De+0];return r&2097152?this._combined[t]:r&2097151?fr(r&2097151):""}isProtected(t){return this._data[t*De+2]&536870912}loadCell(t,r){return Zo=t*De,r.content=this._data[Zo+0],r.fg=this._data[Zo+1],r.bg=this._data[Zo+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*De+0]=r.content,this._data[t*De+1]=r.fg,this._data[t*De+2]=r.bg}setCellFromCodepoint(t,r,n,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*De+0]=r|n<<22,this._data[t*De+1]=a.fg,this._data[t*De+2]=a.bg}addCodepointToCell(t,r,n){let a=this._data[t*De+0];a&2097152?this._combined[t]+=fr(r):a&2097151?(this._combined[t]=fr(a&2097151)+fr(r),a&=-2097152,a|=2097152):a=r|1<<22,n&&(a&=-12582913,a|=n<<22),this._data[t*De+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 ni;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 ni;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*Dc<this._data.buffer.byteLength;let n=t*De;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let a=new Uint32Array(n);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,r)}else{this._data=this._data.subarray(0,n);let a=Object.keys(this._combined);for(let h=0;h<a.length;h++){let d=parseInt(a[h],10);d>=t&&delete this._combined[d]}let l=Object.keys(this._extendedAttrs);for(let h=0;h<l.length;h++){let d=parseInt(l[h],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,n*4*Dc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Dc<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 ng(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*De+0]&4194303)return t+(this._data[t*De+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*De+0]&4194303||this._data[t*De+2]&50331648)return t+(this._data[t*De+0]>>22);return 0}copyCellsFrom(t,r,n,a,l){let h=t._data;if(l)for(let m=a-1;m>=0;m--){for(let p=0;p<De;p++)this._data[(n+m)*De+p]=h[(r+m)*De+p];h[(r+m)*De+2]&268435456&&(this._extendedAttrs[n+m]=t._extendedAttrs[r+m])}else for(let m=0;m<a;m++){for(let p=0;p<De;p++)this._data[(n+m)*De+p]=h[(r+m)*De+p];h[(r+m)*De+2]&268435456&&(this._extendedAttrs[n+m]=t._extendedAttrs[r+m])}let d=Object.keys(t._combined);for(let m=0;m<d.length;m++){let p=parseInt(d[m],10);p>=r&&(this._combined[p-r+n]=t._combined[p])}}translateToString(t,r,n,a){r=r??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),a&&(a.length=0);let l="";for(;r<n;){let h=this._data[r*De+0],d=h&2097151,m=h&2097152?this._combined[r]:d?fr(d):pr;if(l+=m,a)for(let p=0;p<m.length;++p)a.push(r);r+=h>>22||1}return a&&a.push(r),l}};function Mw(e,t,r,n,a,l){let h=[];for(let d=0;d<e.length-1;d++){let m=d,p=e.get(++m);if(!p.isWrapped)continue;let v=[e.get(d)];for(;m<e.length&&p.isWrapped;)v.push(p),p=e.get(++m);if(!l&&n>=d&&n<m){d+=v.length-1;continue}let y=0,S=Rn(v,y,t),g=1,C=0;for(;g<v.length;){let E=Rn(v,g,t),j=E-C,T=r-S,W=Math.min(j,T);v[y].copyCellsFrom(v[g],C,S,W,!1),S+=W,S===r&&(y++,S=0),C+=W,C===E&&(g++,C=0),S===0&&y!==0&&v[y-1].getWidth(r-1)===2&&(v[y].copyCellsFrom(v[y-1],r-1,S++,1,!1),v[y-1].setCell(r-1,a))}v[y].replaceCells(S,r,a);let b=0;for(let E=v.length-1;E>0&&(E>y||v[E].getTrimmedLength()===0);E--)b++;b>0&&(h.push(d+v.length-b),h.push(b)),d+=v.length-1}return h}function Pw(e,t){let r=[],n=0,a=t[n],l=0;for(let h=0;h<e.length;h++)if(a===h){let d=t[++n];e.onDeleteEmitter.fire({index:h-l,amount:d}),h+=d-1,l+=d,a=t[++n]}else r.push(h);return{layout:r,countRemoved:l}}function Lw(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 Tw(e,t,r){let n=[],a=e.map((m,p)=>Rn(e,p,t)).reduce((m,p)=>m+p),l=0,h=0,d=0;for(;d<a;){if(a-d<r){n.push(a-d);break}l+=r;let m=Rn(e,h,t);l>m&&(l-=m,h++);let p=e[h].getWidth(l-1)===2;p&&l--;let v=p?r-1:r;n.push(v),d+=v}return n}function Rn(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 og=class ag{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=ag._nextId++,this._onDispose=this.register(new le),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ir(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};og._nextId=1;var Bw=og,ht={},Tr=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 Yp=4294967295,Xp=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=Tr,this.markers=[],this._nullCell=ni.fromCharData([0,x_,1,0]),this._whitespaceCell=ni.fromCharData([0,pr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new fa,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new qp(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 ca),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 ca),this._whitespaceCell}getBlankLine(e,t){return new wn(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>Yp?Yp: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 qp(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 h=0;h<this.lines.length;h++)n+=+this.lines.get(h).resize(e,r);let l=0;if(this._rows<t)for(let h=this._rows;h<t;h++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new wn(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 wn(e,r)));else for(let h=this._rows;h>t;h--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let h=this.lines.length-a;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),l&&(this.y+=l),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let l=0;l<this.lines.length;l++)n+=+this.lines.get(l).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=Mw(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(st),r);if(n.length>0){let a=Pw(this.lines,n);Lw(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 wn(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 h=this.lines.length-1;h>=0;h--){let d=this.lines.get(h);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let m=[d];for(;d.isWrapped&&h>0;)d=this.lines.get(--h),m.unshift(d);if(!r){let W=this.ybase+this.y;if(W>=h&&W<h+m.length)continue}let p=m[m.length-1].getTrimmedLength(),v=Tw(m,this._cols,e),y=v.length-m.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+y):S=Math.max(0,this.lines.length-this.lines.maxLength+y);let g=[];for(let W=0;W<y;W++){let M=this.getBlankLine(st,!0);g.push(M)}g.length>0&&(a.push({start:h+m.length+l,newLines:g}),l+=g.length),m.push(...g);let C=v.length-1,b=v[C];b===0&&(C--,b=v[C]);let E=m.length-y-1,j=p;for(;E>=0;){let W=Math.min(j,b);if(m[C]===void 0)break;if(m[C].copyCellsFrom(m[E],j-W,b-W,W,!0),b-=W,b===0&&(C--,b=v[C]),j-=W,j===0){E--;let M=Math.max(E,0);j=Rn(m,M,this._cols)}}for(let W=0;W<m.length;W++)v[W]<e&&m[W].setCell(v[W],n);let T=y-S;for(;T-- >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+y,this.ybase+t-1)}if(a.length>0){let h=[],d=[];for(let b=0;b<this.lines.length;b++)d.push(this.lines.get(b));let m=this.lines.length,p=m-1,v=0,y=a[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let S=0;for(let b=Math.min(this.lines.maxLength-1,m+l-1);b>=0;b--)if(y&&y.start>p+S){for(let E=y.newLines.length-1;E>=0;E--)this.lines.set(b--,y.newLines[E]);b++,h.push({index:p+1,amount:y.newLines.length}),S+=y.newLines.length,y=a[++v]}else this.lines.set(b,d[p--]);let g=0;for(let b=h.length-1;b>=0;b--)h[b].index+=g,this.lines.onInsertEmitter.fire(h[b]),g+=h[b].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 Bw(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)}},Aw=class extends Me{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new le),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Xp(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Xp(!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)}},lg=2,cg=1,Oh=class extends Me{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new le),this.onResize=this._onResize.event,this._onScroll=this._register(new le),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,lg),this.rows=Math.max(e.rawOptions.rows||0,cg),this.buffers=this._register(new Aw(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let a=r.ybase+r.scrollTop,l=r.ybase+r.scrollBottom;if(r.scrollTop===0){let h=r.lines.isFull;l===r.lines.length-1?h?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(l+1,0,n.clone()),h?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let h=l-a+1;r.lines.shiftElements(a+1,h-1,-1),r.lines.set(l,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};Oh=Ze([de(0,Tt)],Oh);var ms={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:da,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},jw=["normal","bold","100","200","300","400","500","600","700","800","900"],Iw=class extends Me{constructor(e){super(),this._onOptionChange=this._register(new le),this.onOptionChange=this._onOptionChange.event;let t={...ms};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(Ve(()=>{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 ms))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in ms))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=ms[e]),!Ow(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=ms[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=jw.includes(t)?t:ms[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 Ow(e){return e==="block"||e==="underline"||e==="bar"}function Cn(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]&&Cn(e[n],t-1);return r}var Gp=Object.freeze({insertMode:!1}),Qp=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),zh=class extends Me{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new le),this.onData=this._onData.event,this._onUserInput=this._register(new le),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new le),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new le),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Cn(Gp),this.decPrivateModes=Cn(Qp)}reset(){this.modes=Cn(Gp),this.decPrivateModes=Cn(Qp)}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))}};zh=Ze([de(0,Lt),de(1,D_),de(2,Tt)],zh);var Jp={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 Mc(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 Pc=String.fromCharCode,Zp={DEFAULT:e=>{let t=[Mc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Pc(t[0])}${Pc(t[1])}${Pc(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Mc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Mc(e,!0)};${e.x};${e.y}${t}`}},Fh=class extends Me{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new le),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(Jp))this.addProtocol(n,Jp[n]);for(let n of Object.keys(Zp))this.addEncoding(n,Zp[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)}};Fh=Ze([de(0,Lt),de(1,zr),de(2,Tt)],Fh);var Lc=[[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]],ct;function Fw(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 Hw=class{constructor(){if(this.version="6",!ct){ct=new Uint8Array(65536),ct.fill(1),ct[0]=0,ct.fill(0,1,32),ct.fill(0,127,160),ct.fill(2,4352,4448),ct[9001]=2,ct[9002]=2,ct.fill(2,11904,42192),ct[12351]=1,ct.fill(2,44032,55204),ct.fill(2,63744,64256),ct.fill(2,65040,65050),ct.fill(2,65072,65136),ct.fill(2,65280,65377),ct.fill(2,65504,65511);for(let e=0;e<Lc.length;++e)ct.fill(0,Lc[e][0],Lc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ct[e]:Fw(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=Ar.extractWidth(t);a===0?n=!1:a>r&&(r=a)}return Ar.createPropertyValue(0,r,n)}},Ar=class la{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new le,this.onChange=this._onChange.event;let t=new Hw;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,n=0,a=t.length;for(let l=0;l<a;++l){let h=t.charCodeAt(l);if(55296<=h&&h<=56319){if(++l>=a)return r+this.wcwidth(h);let p=t.charCodeAt(l);56320<=p&&p<=57343?h=(h-55296)*1024+p-56320+65536:r+=this.wcwidth(p)}let d=this.charProperties(h,n),m=la.extractWidth(d);la.extractShouldJoin(d)&&(m-=la.extractWidth(n)),r+=m,n=d}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},Ww=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 em(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 pn=2147483647,$w=256,hg=class Hh{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>$w)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 Hh;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 Hh(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>pn?pn:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>pn?pn:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let 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,pn):t}},mn=[],Uw=class{constructor(){this._state=0,this._active=mn,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let 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=mn}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=mn,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||mn,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",Ca(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=mn,this._id=-1,this._state=0}}},Yt=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+=Ca(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}},_n=[],Kw=class{constructor(){this._handlers=Object.create(null),this._active=_n,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_n}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=_n,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||_n,!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",Ca(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=_n,this._ident=0}},bn=new hg;bn.addParam(0);var tm=class{constructor(e){this._handler=e,this._data="",this._params=bn,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():bn,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Ca(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=bn,this._data="",this._hitLimit=!1,r));return this._params=bn,this._data="",this._hitLimit=!1,t}},Vw=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}},si=160,qw=(function(){let e=new Vw(4095),t=Array.apply(null,Array(256)).map((d,m)=>m),r=(d,m)=>t.slice(d,m),n=r(32,127),a=r(0,24);a.push(25),a.push.apply(a,r(28,32));let l=r(0,14),h;e.setDefault(1,0),e.addMany(n,0,2,0);for(h in l)e.addMany([24,26,153,154],h,3,0),e.addMany(r(128,144),h,3,0),e.addMany(r(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(si,0,2,0),e.add(si,8,5,8),e.add(si,6,0,6),e.add(si,11,0,11),e.add(si,13,13,13),e})(),Yw=class extends Me{constructor(e=qw){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 hg,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(Ve(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Uw),this._dcsParser=this._register(new Kw),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let l=e.intermediates.charCodeAt(a);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=n,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,n,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=a}parse(e,t,r){let n=0,a=0,l=0,h;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(h=d[m](this._params),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(h=d[m](),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(n!==24&&n!==26,r),h)return h;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],h=this._oscParser.end(n!==24&&n!==26,r),h)return h;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=l;d<t;++d){switch(n=e[d],a=this._transitions.table[this.currentState<<8|(n<160?n:si)],a>>4){case 2:for(let S=d+1;;++S){if(S>=t||(n=e[S])<32||n>126&&n<si){this._printHandler(e,d,S),d=S-1;break}if(++S>=t||(n=e[S])<32||n>126&&n<si){this._printHandler(e,d,S),d=S-1;break}if(++S>=t||(n=e[S])<32||n>126&&n<si){this._printHandler(e,d,S),d=S-1;break}if(++S>=t||(n=e[S])<32||n>126&&n<si){this._printHandler(e,d,S),d=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:d,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|n],p=m?m.length-1:-1;for(;p>=0&&(h=m[p](this._params),h!==!0);p--)if(h instanceof Promise)return this._preserveStack(3,m,p,a,d),h;p<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++d<t&&(n=e[d])>47&&n<60);d--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let v=this._escHandlers[this._collect<<8|n],y=v?v.length-1:-1;for(;y>=0&&(h=v[y](),h!==!0);y--)if(h instanceof Promise)return this._preserveStack(4,v,y,a,d),h;y<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=d+1;;++S)if(S>=t||(n=e[S])===24||n===26||n===27||n>127&&n<si){this._dcsParser.put(e,d,S),d=S-1;break}break;case 14:if(h=this._dcsParser.unhook(n!==24&&n!==26),h)return this._preserveStack(6,[],0,a,d),h;n===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let S=d+1;;S++)if(S>=t||(n=e[S])<32||n>127&&n<si){this._oscParser.put(e,d,S),d=S-1;break}break;case 6:if(h=this._oscParser.end(n!==24&&n!==26),h)return this._preserveStack(5,[],0,a,d),h;n===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},Xw=/^([\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})$/,Gw=/^[\da-f]+$/;function im(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=Xw.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),Gw.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 Tc(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 Qw(e,t=16){let[r,n,a]=e;return`rgb:${Tc(r,t)}/${Tc(n,t)}/${Tc(a,t)}`}var Jw={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ur=131072,rm=10;function sm(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 nm=5e3,om=0,Zw=class extends Me{constructor(e,t,r,n,a,l,h,d,m=new Yw){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=a,this._oscLinkService=l,this._coreMouseService=h,this._unicodeService=d,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new v0,this._utf8Decoder=new y0,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=st.clone(),this._eraseAttrDataInternal=st.clone(),this._onRequestBell=this._register(new le),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new le),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new le),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new le),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new le),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new le),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new le),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new le),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new le),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new le),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new le),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new le),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new le),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Wh(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:v.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,v,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:v,data:y})}),this._parser.setDcsHandlerFallback((p,v,y)=>{v==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:v,payload:y})}),this._parser.setPrintHandler((p,v,y)=>this.print(p,v,y)),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(te.BEL,()=>this.bell()),this._parser.setExecuteHandler(te.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(te.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(te.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(te.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(te.BS,()=>this.backspace()),this._parser.setExecuteHandler(te.HT,()=>this.tab()),this._parser.setExecuteHandler(te.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(te.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(oa.IND,()=>this.index()),this._parser.setExecuteHandler(oa.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(oa.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Yt(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new Yt(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new Yt(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new Yt(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new Yt(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new Yt(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new Yt(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new Yt(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new Yt(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new Yt(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new Yt(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new Yt(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 tm((p,v)=>this.requestStatusString(p,v)))}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"),nm))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${nm} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,a=this._activeBuffer.y,l=0,h=this._parseStack.paused;if(h){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ur&&(l=this._parseStack.position+ur)}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<ur&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ur))),h||this._dirtyRowTracker.clearRange(),e.length>ur)for(let p=l;p<e.length;p+=ur){let v=p+ur<e.length?p+ur:e.length,y=typeof e=="string"?this._stringDecoder.decode(e.substring(p,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,v),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,y))return this._preserveStack(n,a,y,p),this._logSlowResolvingAsync(r),r}else if(!h){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,p))return this._preserveStack(n,a,p,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let d=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(d,this._bufferService.rows-1)})}print(e,t,r){let n,a,l=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,v=this._curAttrData,y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&y.getWidth(this._activeBuffer.x-1)===2&&y.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let S=this._parser.precedingJoinState;for(let g=t;g<r;++g){if(n=e[g],n<127&&l){let j=l[String.fromCharCode(n)];j&&(n=j.charCodeAt(0))}let C=this._unicodeService.charProperties(n,S);a=Ar.extractWidth(C);let b=Ar.extractShouldJoin(C),E=b?Ar.extractWidth(S):0;if(S=C,h&&this._onA11yChar.fire(fr(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-E>d){if(m){let j=y,T=this._activeBuffer.x-E;for(this._activeBuffer.x=E,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&y instanceof wn&&y.copyCellsFrom(j,T,0,E,!1);T<d;)j.setCellFromCodepoint(T++,0,1,v)}else if(this._activeBuffer.x=d-1,a===2)continue}if(b&&this._activeBuffer.x){let j=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-j,n,a);for(let T=a-E;--T>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(p&&(y.insertCells(this._activeBuffer.x,a-E,this._activeBuffer.getNullCell(v)),y.getWidth(d-1)===2&&y.setCellFromCodepoint(d-1,0,1,v)),y.setCellFromCodepoint(this._activeBuffer.x++,n,a,v),a>0)for(;--a;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=S,this._activeBuffer.x<d&&r-t>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>sm(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new tm(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Yt(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=Ar.extractWidth(t),a=this._activeBuffer.x-n,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),h=new Uint32Array(l.length*r),d=0;for(let p=0;p<l.length;){let v=l.codePointAt(p)||0;h[d++]=v,p+=v>65535?2:1}let m=d;for(let p=1;p<r;++p)h.copyWithin(m,0,d),m+=d;return this.print(h,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(te.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(te.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(te.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(te.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(te.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,Tr),this._charsetService.setgCharset(1,Tr),this._charsetService.setgCharset(2,Tr),this._charsetService.setgCharset(3,Tr);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){(b=>(b[b.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",b[b.SET=1]="SET",b[b.RESET=2]="RESET",b[b.PERMANENTLY_SET=3]="PERMANENTLY_SET",b[b.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let n=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:l}=this._coreMouseService,h=this._coreService,{buffers:d,cols:m}=this._bufferService,{active:p,alt:v}=d,y=this._optionsService.rawOptions,S=(b,E)=>(h.triggerDataEvent(`${te.ESC}[${t?"":"?"}${b};${E}$y`),!0),g=b=>b?1:2,C=e.params[0];return t?C===2?S(C,4):C===4?S(C,g(h.modes.insertMode)):C===12?S(C,3):C===20?S(C,g(y.convertEol)):S(C,0):C===1?S(C,g(n.applicationCursorKeys)):C===3?S(C,y.windowOptions.setWinLines?m===80?2:m===132?1:0:0):C===6?S(C,g(n.origin)):C===7?S(C,g(n.wraparound)):C===8?S(C,3):C===9?S(C,g(a==="X10")):C===12?S(C,g(y.cursorBlink)):C===25?S(C,g(!h.isCursorHidden)):C===45?S(C,g(n.reverseWraparound)):C===66?S(C,g(n.applicationKeypad)):C===67?S(C,4):C===1e3?S(C,g(a==="VT200")):C===1002?S(C,g(a==="DRAG")):C===1003?S(C,g(a==="ANY")):C===1004?S(C,g(n.sendFocus)):C===1005?S(C,4):C===1006?S(C,g(l==="SGR")):C===1015?S(C,4):C===1016?S(C,g(l==="SGR_PIXELS")):C===1048?S(C,1):C===47||C===1047||C===1049?S(C,g(p===v)):C===2004?S(C,g(n.bracketedPasteMode)):C===2026?S(C,g(n.synchronizedOutput)):S(C,0)}_updateAttrColor(e,t,r,n,a){return t===2?(e|=50331648,e&=-16777216,e|=Dn.fromColorRGB([r,n,a])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let n=[0,0,-1,0,0,0],a=0,l=0;do{if(n[l+a]=e.params[t+l],e.hasSubParams(t+l)){let h=e.getSubParams(t+l),d=0;do n[1]===5&&(a=1),n[l+d+1+a]=h[d];while(++d<h.length&&d+l+1+a<n.length);break}if(n[1]===5&&l+a>=2||n[1]===2&&l+a>=5)break;n[1]&&(a=1)}while(++l+t<e.length&&l+a<n.length);for(let h=2;h<n.length;++h)n[h]===-1&&(n[h]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return l}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=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(`${te.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${te.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(`${te.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(!sm(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(`${te.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>rm&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>rm&&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(am(l))if(a==="?")t.push({type:0,index:l});else{let h=im(a);h&&t.push({type:1,index:l,color:h})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,a=r.findIndex(l=>l.startsWith("id="));return a!==-1&&(n=r[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let n=0;n<r.length&&!(t>=this._specialColors.length);++n,++t)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=im(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]);am(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,Tr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(Jw[e[0]],ht[e[1]]||Tr),!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 ni;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=h=>(this._coreService.triggerDataEvent(`${te.ESC}${h}${te.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)}},Wh=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&&(om=e,e=t,t=om),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Wh=Ze([de(0,Lt)],Wh);function am(e){return 0<=e&&e<256}var e1=5e7,lm=12,t1=50,i1=class extends Me{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new le),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>e1)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],a=this._action(n,t);if(a){let h=d=>performance.now()-r>=lm?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(r,d);a.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(h);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=lm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>t1&&(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()}},$h=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 d=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(m,d)),this._dataByLinkId.set(m.id,m),m.id}let r=e,n=this._getEntryIdKey(r),a=this._entriesWithId.get(n);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let l=t.addMarker(t.ybase+t.y),h={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(h,l)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);r.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(r,n))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};$h=Ze([de(0,Lt)],$h);var cm=!1,r1=class extends Me{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new vs),this._onBinary=this._register(new le),this.onBinary=this._onBinary.event,this._onData=this._register(new le),this.onData=this._onData.event,this._onLineFeed=this._register(new le),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new le),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new le),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new le),this._instantiationService=new Nw,this.optionsService=this._register(new Iw(e)),this._instantiationService.setService(Tt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Oh)),this._instantiationService.setService(Lt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Ih)),this._instantiationService.setService(D_,this._logService),this.coreService=this._register(this._instantiationService.createInstance(zh)),this._instantiationService.setService(zr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Fh)),this._instantiationService.setService(R_,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ar)),this._instantiationService.setService(b0,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Ww),this._instantiationService.setService(C0,this._charsetService),this._oscLinkService=this._instantiationService.createInstance($h),this._instantiationService.setService(M_,this._oscLinkService),this._inputHandler=this._register(new Zw(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(bt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(bt.forward(this._bufferService.onResize,this._onResize)),this._register(bt.forward(this.coreService.onData,this._onData)),this._register(bt.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 i1((t,r)=>this._inputHandler.parse(t,r))),this._register(bt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new le),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!cm&&(this._logService.warn("writeSync is unreliable and will be removed soon."),cm=!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,lg),t=Math.max(t,cg),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(em.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(em(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ve(()=>{for(let t of e)t.dispose()})}}},s1={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 n1(e,t,r,n){var h;let a={type:0,cancel:!1,key:void 0},l=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?a.key=te.ESC+"OA":a.key=te.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=te.ESC+"OD":a.key=te.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=te.ESC+"OC":a.key=te.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=te.ESC+"OB":a.key=te.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":te.DEL,e.altKey&&(a.key=te.ESC+a.key);break;case 9:if(e.shiftKey){a.key=te.ESC+"[Z";break}a.key=te.HT,a.cancel=!0;break;case 13:a.key=e.altKey?te.ESC+te.CR:te.CR,a.cancel=!0;break;case 27:a.key=te.ESC,e.altKey&&(a.key=te.ESC+te.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;l?a.key=te.ESC+"[1;"+(l+1)+"D":t?a.key=te.ESC+"OD":a.key=te.ESC+"[D";break;case 39:if(e.metaKey)break;l?a.key=te.ESC+"[1;"+(l+1)+"C":t?a.key=te.ESC+"OC":a.key=te.ESC+"[C";break;case 38:if(e.metaKey)break;l?a.key=te.ESC+"[1;"+(l+1)+"A":t?a.key=te.ESC+"OA":a.key=te.ESC+"[A";break;case 40:if(e.metaKey)break;l?a.key=te.ESC+"[1;"+(l+1)+"B":t?a.key=te.ESC+"OB":a.key=te.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=te.ESC+"[2~");break;case 46:l?a.key=te.ESC+"[3;"+(l+1)+"~":a.key=te.ESC+"[3~";break;case 36:l?a.key=te.ESC+"[1;"+(l+1)+"H":t?a.key=te.ESC+"OH":a.key=te.ESC+"[H";break;case 35:l?a.key=te.ESC+"[1;"+(l+1)+"F":t?a.key=te.ESC+"OF":a.key=te.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=te.ESC+"[5;"+(l+1)+"~":a.key=te.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=te.ESC+"[6;"+(l+1)+"~":a.key=te.ESC+"[6~";break;case 112:l?a.key=te.ESC+"[1;"+(l+1)+"P":a.key=te.ESC+"OP";break;case 113:l?a.key=te.ESC+"[1;"+(l+1)+"Q":a.key=te.ESC+"OQ";break;case 114:l?a.key=te.ESC+"[1;"+(l+1)+"R":a.key=te.ESC+"OR";break;case 115:l?a.key=te.ESC+"[1;"+(l+1)+"S":a.key=te.ESC+"OS";break;case 116:l?a.key=te.ESC+"[15;"+(l+1)+"~":a.key=te.ESC+"[15~";break;case 117:l?a.key=te.ESC+"[17;"+(l+1)+"~":a.key=te.ESC+"[17~";break;case 118:l?a.key=te.ESC+"[18;"+(l+1)+"~":a.key=te.ESC+"[18~";break;case 119:l?a.key=te.ESC+"[19;"+(l+1)+"~":a.key=te.ESC+"[19~";break;case 120:l?a.key=te.ESC+"[20;"+(l+1)+"~":a.key=te.ESC+"[20~";break;case 121:l?a.key=te.ESC+"[21;"+(l+1)+"~":a.key=te.ESC+"[21~";break;case 122:l?a.key=te.ESC+"[23;"+(l+1)+"~":a.key=te.ESC+"[23~";break;case 123:l?a.key=te.ESC+"[24;"+(l+1)+"~":a.key=te.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=te.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=te.DEL:e.keyCode===219?a.key=te.ESC:e.keyCode===220?a.key=te.FS:e.keyCode===221&&(a.key=te.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let d=(h=s1[e.keyCode])==null?void 0:h[e.shiftKey?1:0];if(d)a.key=te.ESC+d;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=te.ESC+p}else if(e.keyCode===32)a.key=te.ESC+(e.ctrlKey?te.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let m=e.code.slice(3,4);e.shiftKey||(m=m.toLowerCase()),a.key=te.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=te.US),e.key==="@"&&(a.key=te.NUL));break}return a}var it=0,o1=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new fa,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new fa,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}},Bc=0,hm=0,a1=class extends Me{constructor(){super(),this._decorations=new o1(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new le),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new le),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ve(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new l1(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=>{Bc=a.options.x??0,hm=Bc+(a.options.width??1),e>=Bc&&e<hm&&(!r||(a.options.layer??"bottom")===r)&&n(a)})}},l1=class extends mr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new le),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new le),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ge.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ge.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},c1=1e3,h1=class{constructor(e,t=c1){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)}},um=20,pa=class extends Me{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 h1(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(Ne(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ve(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<um+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
65
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===um+1&&(this._liveRegion.textContent+=ch.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,n=r.lines.length.toString();for(let a=e;a<=t;a++){let l=r.lines.get(r.ydisp+a),h=[],d=(l==null?void 0:l.translateToString(!0,void 0,void 0,h))||"",m=(r.ydisp+a+1).toString(),p=this._rowElements[a];p&&(d.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=d,this._rowColumns.set(p,h)),p.setAttribute("aria-posinset",m),p.setAttribute("aria-setsize",n),this._alignRowWidth(p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],a=r.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===l||e.relatedTarget!==n)return;let h,d;if(t===0?(h=r,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(h=this._rowElements.shift(),d=r,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),d.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 d;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:((d=n.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(r.node))return;let a=({node:m,offset:p})=>{let v=m instanceof Text?m.parentNode:m,y=parseInt(v==null?void 0:v.getAttribute("aria-posinset"),10)-1;if(isNaN(y))return console.warn("row is invalid. Race condition?"),null;let S=this._rowColumns.get(v);if(!S)return console.warn("columns is null. Race condition?"),null;let g=p<S.length?S[p]:S.slice(-1)[0]+1;return g>=this._terminal.cols&&(++y,g=0),{row:y,column:g}},l=a(t),h=a(r);if(!(!l||!h)){if(l.row>h.row||l.row===h.row&&l.column>=h.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(h.row-l.row)*this._terminal.cols-l.column+h.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var a,l;e.style.transform="";let t=e.getBoundingClientRect().width,r=(l=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:l[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};pa=Ze([de(1,ru),de(2,Hi),de(3,Wi)],pa);var Uh=class extends Me{constructor(e,t,r,n,a){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=n,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new le),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new le),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ve(()=>{var l;Ir(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(Ne(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ne(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ne(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ne(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let n=0;n<r.length;n++){let a=r[n];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var n,a;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(l=>{l==null||l.forEach(h=>{h.link.dispose&&h.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[l,h]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(l)&&(r=this._checkLinkProviderResult(l,e,r)):h.provideLinks(e.y,d=>{var p,v;if(this._isMouseOut)return;let m=d==null?void 0:d.map(y=>({link:y}));(p=this._activeProviderReplies)==null||p.set(l,m),r=this._checkLinkProviderResult(l,e,r),((v=this._activeProviderReplies)==null?void 0:v.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let n=0;n<t.size;n++){let a=t.get(n);if(a)for(let l=0;l<a.length;l++){let h=a[l],d=h.link.range.start.y<e?0:h.link.range.start.x,m=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let p=d;p<=m;p++){if(r.has(p)){a.splice(l--,1);break}r.add(p)}}}}_checkLinkProviderResult(e,t,r){var l;if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),a=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(a=!0);if(!a&&n){let h=n.find(d=>this._linkAtPosition(d.link,t));h&&(r=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let h=0;h<this._activeProviderReplies.size;h++){let d=(l=this._activeProviderReplies.get(h))==null?void 0:l.find(m=>this._linkAtPosition(m.link,t));if(d){r=!0,this._handleNewLink(d);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&&u1(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,Ir(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}}};Uh=Ze([de(1,su),de(2,Wi),de(3,Lt),de(4,L_)],Uh);function u1(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 d1=class extends r1{constructor(e={}){super(e),this._linkifier=this._register(new vs),this.browser=Q_,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new vs),this._onCursorMove=this._register(new le),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new le),this.onKey=this._onKey.event,this._onRender=this._register(new le),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new le),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new le),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new le),this.onBell=this._onBell.event,this._onFocus=this._register(new le),this._onBlur=this._register(new le),this._onA11yCharEmitter=this._register(new le),this._onA11yTabEmitter=this._register(new le),this._onWillOpen=this._register(new le),this._setup(),this._decorationService=this._instantiationService.createInstance(a1),this._instantiationService.setService(Mn,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(tw),this._instantiationService.setService(L_,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(uh)),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(bt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(bt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(bt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(bt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ve(()=>{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=$e.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${te.ESC}]${n};${Qw(a)}${X_.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(h=>h[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(pa,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(te.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(te.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,a=t.getWidth(r),l=this._renderService.dimensions.css.cell.width*a,h=this.buffer.y*this._renderService.dimensions.css.cell.height,d=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=h+"px",this.textarea.style.width=l+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ne(this.element,"copy",t=>{this.hasSelection()&&_0(t,this._selectionService)}));let e=t=>g0(t,this.textarea,this.coreService,this.optionsService);this._register(Ne(this.textarea,"paste",e)),this._register(Ne(this.element,"paste",e)),J_?this._register(Ne(this.element,"mousedown",t=>{t.button===2&&wp(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ne(this.element,"contextmenu",t=>{wp(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),du&&this._register(Ne(this.element,"auxclick",t=>{t.button===1&&b_(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ne(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ne(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ne(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ne(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ne(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ne(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ne(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(Ne(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",lh.get()),tg||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(ZS,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Hi,this._coreBrowserService),this._register(Ne(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Ne(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Lh,this._document,this._helperContainer),this._instantiationService.setService(ba,this._charSizeService),this._themeService=this._instantiationService.createInstance(jh),this._instantiationService.setService(Ss,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ua),this._instantiationService.setService(P_,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Bh,this.rows,this.screenElement)),this._instantiationService.setService(Wi,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(Dh,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Th),this._instantiationService.setService(su,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(Uh,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(Nh,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(Ah,this.element,this.screenElement,n)),this._instantiationService.setService(k0,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(bt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var l;this._selectionService.refresh(),(l=this._viewport)==null||l.queueSync()})),this._register(this._instantiationService.createInstance(Rh,this.screenElement)),this._register(Ne(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(pa,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ha,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ha,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Ph,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,v,y,S,g;let h=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!h)return!1;let d,m;switch(l.overrideType||l.type){case"mousemove":m=32,l.buttons===void 0?(d=3,l.button!==void 0&&(d=l.button<3?l.button:3)):d=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":m=0,d=l.button<3?l.button:3;break;case"mousedown":m=1,d=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=(y=(v=(p=e._renderService)==null?void 0:p.dimensions)==null?void 0:v.device)==null?void 0:y.cell)==null?void 0:S.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return!1;m=C<0?0:1,d=4;break;default:return!1}return m===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:d,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(Ne(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(Ne(t,"wheel",l=>{var h,d,m,p,v;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=(d=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:d.device)==null?void 0:m.cell)==null?void 0:p.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return this.cancel(l,!0);let y=te.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(y,!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){C_(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=n1(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===te.ETX||r.key===te.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)&&(f1(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(te.ESC+"[I"):this.coreService.triggerDataEvent(te.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(`${te.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(`${te.ESC}[6;${a};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function f1(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var p1=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)}},m1=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 ni)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},dm=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 m1(t)}getNullCell(){return new ni}},_1=class extends Me{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new le),this.onBufferChange=this._onBufferChange.event,this._normal=new dm(this._core.buffers.normal,"normal"),this._alternate=new dm(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)}},g1=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)}},v1=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}},y1=["cols","rows"],bi=0,S1=class extends Me{constructor(e){super(),this._core=this._register(new d1(e)),this._addonManager=this._register(new p1),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(y1.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 g1(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v1(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 _1(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 lh.get()},set promptLabel(e){lh.set(e)},get tooMuchOutput(){return ch.get()},set tooMuchOutput(e){ch.set(e)}}}_verifyIntegers(...e){for(bi of e)if(bi===1/0||isNaN(bi)||bi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(bi of e)if(bi&&(bi===1/0||isNaN(bi)||bi%1!==0||bi<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 w1=2,C1=1,b1=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 y;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:((y=this._terminal.options.overviewRuler)==null?void 0:y.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),a=Math.max(0,parseInt(r.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),h={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},d=h.top+h.bottom,m=h.right+h.left,p=n-d,v=a-m-t;return{cols:Math.max(w1,Math.floor(v/e.css.cell.width)),rows:Math.max(C1,Math.floor(p/e.css.cell.height))}}};function x1(e,t){return e?`/api/route/${String(e).split("/").map(encodeURIComponent).join("/")}/_/ws?token=${encodeURIComponent(t||"")}`:"/ws"}function k1({session:e,node:t,token:r,cols:n,rows:a,readonly:l=!1,takeSize:h,focused:d,onData:m,onExit:p,onFiles:v,retryBaseMs:y=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}${x1(t,r)}`;let b=null,E=!1,j=!1,T=null,W=0,M=d;const J=()=>{if(E||j||T)return;const A=Math.min(5e3,Math.max(0,y)*2**Math.min(W++,5));T=setTimeout(()=>{T=null,Y()},A)},Y=()=>{if(E||j)return;const A=new WebSocket(C);b=A,A.binaryType="arraybuffer",A.onopen=()=>{if(b!==A||E)return;W=0;const P={type:"attach",session:e,token:r,cols:n,rows:a,readonly:l};h!==void 0&&(P.takeSize=h),A.send(JSON.stringify(P)),M!==void 0&&A.send(JSON.stringify({type:"focus",on:!!M}))},A.onmessage=P=>{if(!(b!==A||E))if(typeof P.data=="string"){let z;try{z=JSON.parse(P.data)}catch{return}z.type==="exit"&&(j=!0,p&&p(z.code)),z.type==="files"&&v&&v(z)}else m&&m(new Uint8Array(P.data))},A.onerror=()=>{if(b===A)try{A.close()}catch{}},A.onclose=P=>{b!==A||E||j||[1e3,1002,4401,4404].includes(P==null?void 0:P.code)||J()}};return Y(),{sendInput:A=>{!b||b.readyState!==1||b.send(typeof A=="string"?new TextEncoder().encode(A):A)},resize:(A,P)=>{n=A,a=P,(b==null?void 0:b.readyState)===1&&b.send(JSON.stringify({type:"resize",cols:A,rows:P}))},action:A=>{(b==null?void 0:b.readyState)===1&&b.send(JSON.stringify({type:"action",name:A}))},focus:A=>{M=A,(b==null?void 0:b.readyState)===1&&b.send(JSON.stringify({type:"focus",on:!!A}))},close:()=>{if(E=!0,T&&clearTimeout(T),T=null,b)try{b.close()}catch{}},get raw(){return b}}}async function fm(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 ug({session:e,node:t,token:r,readonly:n,takeSize:a,focused:l,sendRef:h,actionRef:d,ctrlRef:m,setCtrlArmed:p,onFiles:v,fontSize:y=13,selectionMode:S=!1,onSelectionModeChange:g}){const C=I.useRef(null),b=I.useRef(null),E=I.useRef(y);E.current=y;const j=I.useRef(l);j.current=l;const T=I.useRef(S);T.current=S;const[W,M]=I.useState(""),[J,Y]=I.useState(""),A=async()=>{var O,K,H,B;const P=((K=(O=b.current)==null?void 0:O.term)==null?void 0:K.getSelection())||W,z=await fm(P);Y(k(z?"copied":"copy-manual")),z&&((B=(H=b.current)==null?void 0:H.term)==null||B.clearSelection(),g==null||g(!1)),setTimeout(()=>Y(""),1800)};return I.useEffect(()=>{const P=b.current;P&&P.sock&&P.sock.focus&&P.sock.focus(!!l)},[l]),I.useEffect(()=>{const P=b.current;P&&(P.term.options.fontSize=y,P.fit.fit(),P.sock.resize(P.term.cols,P.term.rows))},[y]),I.useEffect(()=>{const P=new S1({cursorBlink:!0,fontSize:E.current,scrollback:1e3,theme:{background:"#0a0e0a"}}),z=new b1;P.loadAddon(z),P.open(C.current),z.fit();const O=new TextDecoder;let K;try{K=k1({session:e,node:t,token:r,readonly:n,takeSize:a,focused:j.current,onFiles:v,cols:P.cols,rows:P.rows,onData:U=>P.write(O.decode(U)),onExit:()=>P.write(`\r
|
|
78
|
+
\x1B[33m[sessione finita]\x1B[0m\r
|
|
79
|
+
`)})}catch(U){return P.write(`\r
|
|
80
|
+
\x1B[31m${U.message}\x1B[0m\r
|
|
81
|
+
`),()=>P.dispose()}b.current={term:P,fit:z,sock:K},h&&(h.current=U=>K.sendInput(U)),d&&(d.current=U=>K.action(U));const H=P.onData(U=>{if(!n){if(m&&m.current&&U.length===1){const oe=U.charCodeAt(0);let me=oe;oe>=97&&oe<=122?me=oe-96:oe>=64&&oe<=95?me=oe-64:oe===32&&(me=0),U=String.fromCharCode(me),m.current=!1,p&&p(!1)}K.sendInput(U)}}),B=P.onSelectionChange(()=>M(P.getSelection()));P.attachCustomKeyEventHandler(U=>(U.ctrlKey||U.metaKey)&&U.key.toLowerCase()==="c"&&P.getSelection()?(U.type==="keydown"&&fm(P.getSelection()),!1):!0);const D=C.current,X=24;let ee=null,ie=null,x=0,Q=null,q=null;const R=U=>{const me=(D.querySelector(".xterm-screen")||D).getBoundingClientRect(),Ue=Math.max(0,Math.min(P.cols-1,Math.floor((U.clientX-me.left)/Math.max(1,me.width)*P.cols))),oi=Math.max(0,Math.min(P.rows-1,Math.floor((U.clientY-me.top)/Math.max(1,me.height)*P.rows)));return{col:Ue,row:P.buffer.active.viewportY+oi}},$=U=>{if(U.touches.length!==1){ee=null;return}if(T.current){U.preventDefault(),U.stopPropagation(),q=R(U.touches[0]),P.clearSelection();return}ee=U.touches[0].clientY,ie=U.touches[0].clientX,x=0,Q=null},ce=U=>{if(T.current&&q&&U.touches.length===1){U.preventDefault(),U.stopPropagation();const me=R(U.touches[0]),Ue=q.row*P.cols+q.col,oi=me.row*P.cols+me.col,_r=Ue<=oi?q:me;P.select(_r.col,_r.row,Math.abs(oi-Ue)+1);return}if(ee===null||U.touches.length!==1)return;U.preventDefault(),U.stopPropagation();const oe=U.touches[0];if(Q===null&&(Math.abs(oe.clientY-ee)>8||Math.abs(oe.clientX-ie)>8)&&(Q=Math.abs(oe.clientY-ee)>Math.abs(oe.clientX-ie)),!!Q){for(x+=oe.clientY-ee,ee=oe.clientY;x>=X;)K.action("scroll-up"),x-=X;for(;x<=-X;)K.action("scroll-down"),x+=X}},ue=()=>{ee=null,q=null};let pe=0;const ye=U=>{for(U.preventDefault(),U.stopPropagation(),pe+=U.deltaY;pe<=-X;)K.action("scroll-up"),pe+=X;for(;pe>=X;)K.action("scroll-down"),pe-=X};D.addEventListener("touchstart",$,{passive:!1}),D.addEventListener("touchmove",ce,{passive:!1,capture:!0}),D.addEventListener("touchend",ue,{passive:!0}),D.addEventListener("wheel",ye,{passive:!1,capture:!0});const Se=()=>{z.fit(),K.resize(P.cols,P.rows)};window.addEventListener("resize",Se);const Ce=window.visualViewport;Ce&&(Ce.addEventListener("resize",Se),Ce.addEventListener("scroll",Se));let ke=null,Te=0;return typeof ResizeObserver<"u"&&(ke=new ResizeObserver(()=>{Te&&cancelAnimationFrame(Te),Te=requestAnimationFrame(Se)}),ke.observe(D)),()=>{b.current=null,H.dispose(),B.dispose(),D.removeEventListener("touchstart",$),D.removeEventListener("touchmove",ce,{capture:!0}),D.removeEventListener("touchend",ue),D.removeEventListener("wheel",ye,{capture:!0}),window.removeEventListener("resize",Se),Ce&&(Ce.removeEventListener("resize",Se),Ce.removeEventListener("scroll",Se)),ke&&ke.disconnect(),Te&&cancelAnimationFrame(Te),K.close(),P.dispose()}},[e,t,r,n,a,h,d,m,p,v]),f.jsxs("div",{className:`nc-terminal${S?" selecting":""}`,children:[f.jsx("div",{className:"nc-terminal-host",ref:C}),(W||S)&&f.jsxs("div",{className:"nc-selection-tools",children:[W?f.jsx("button",{type:"button",onClick:A,children:J||k("copy")}):f.jsx("span",{children:k("select-drag")}),f.jsx("button",{type:"button",onClick:()=>{var P,z;(z=(P=b.current)==null?void 0:P.term)==null||z.clearSelection(),M(""),g==null||g(!1)},children:k("cancel")}),J===k("copy-manual")&&f.jsx("textarea",{readOnly:!0,value:W,onFocus:P=>P.target.select()})]})]})}const pm="",Ht="\x1B",E1=[{label:"↑",seq:Ht+"[A"},{label:"↓",seq:Ht+"[B"},{label:"PGUP",seq:Ht+"[5~"},{label:"PGDN",seq:Ht+"[6~"}];function N1({send:e,action:t,ctrlArmed:r=!1,onCtrl:n,onKeyboard:a,selectionMode:l=!1,onSelectionMode:h}){const[d,m]=I.useState(!1),[p,v]=I.useState(!1),[y,S]=I.useState(!1),g=E=>{y?(e(Ht+E),S(!1)):e(E)},C=(E,j,T)=>f.jsx("button",{onMouseDown:W=>{W.preventDefault(),g(j),T&&T()},children:E},E),b=(E,j)=>f.jsx("button",{onMouseDown:T=>{T.preventDefault(),t(j),v(!1)},children:E},E);return d?f.jsxs("div",{className:"nc-keybar copy",children:[f.jsx("span",{className:"tag",children:"copy-mode"}),E1.map(E=>C(E.label,E.seq)),C("ESCI (q)","q",()=>m(!1))]}):f.jsxs("div",{className:"nc-keybar termux",children:[p&&f.jsxs("div",{className:"nc-keymenu",children:[b("←WIN","prev-window"),b("WIN→","next-window"),b("⬅PANE","pane-left"),b("PANE➡","pane-right"),C("SCROLL",pm+"[",()=>{m(!0),v(!1)}),f.jsx("button",{className:l?"armed":"",onMouseDown:E=>{E.preventDefault(),h==null||h(!l),v(!1)},children:"SELECT"}),C("⌃C","",()=>v(!1)),C("DETACH",pm+"d",()=>v(!1))]}),f.jsxs("div",{className:"row",children:[C("ESC",Ht),f.jsx("button",{className:p?"armed":"",onMouseDown:E=>{E.preventDefault(),v(j=>!j)},children:"☰"},"menu"),C("/","/"),C("—","-"),C("HOME",Ht+"[H"),C("↑",Ht+"[A"),C("END",Ht+"[F"),C("PGUP",Ht+"[5~")]}),f.jsxs("div",{className:"row",children:[C("⇥"," "),f.jsx("button",{onMouseDown:E=>{E.preventDefault(),a&&a()},children:"⌨"},"kbd"),f.jsx("button",{className:r?"armed":"",onMouseDown:E=>{E.preventDefault(),n&&n()},children:"CTRL"},"ctrl"),f.jsx("button",{className:y?"armed":"",onMouseDown:E=>{E.preventDefault(),S(j=>!j)},children:"ALT"},"alt"),C("←",Ht+"[D"),C("↓",Ht+"[B"),C("→",Ht+"[C"),C("PGDN",Ht+"[6~")]})]})}const R1=e=>e>1048576?`${(e/1048576).toFixed(1)}M`:e>1024?`${(e/1024).toFixed(0)}K`:`${e}B`;function dg({session:e,node:t,token:r,filesEvent:n,onClose:a}){Wt();const l=t?`/api/route/${String(t).split("/").map(encodeURIComponent).join("/")}/_`:"/api",h=t?`${t}:${e}`:e,[d,m]=I.useState("outbox"),[p,v]=I.useState({inbox:[],outbox:[]}),[y,S]=I.useState(""),g=I.useRef(null);async function C(){try{const W=await(await vt(`${l}/files?session=${encodeURIComponent(e)}`,r)).json();if(W.error){S(W.error);return}v(W);const M=W.outbox[0]?W.outbox[0].mtime:0;localStorage.setItem(r_(h),String(M))}catch(T){S(String(T))}}I.useEffect(()=>{C()},[e,t]),I.useEffect(()=>{n&&n.session===e&&C()},[n]);async function b(T){for(const W of T){S(`carico ${W.name}…`);const M=new FormData;M.append("session",e),M.append("file",W);try{const Y=await(await vt(`${l}/files/upload`,r,{method:"POST",body:M})).json();S(Y.error?`errore: ${Y.error}`:"")}catch(J){S(String(J))}}C()}async function E(T){const W=await vt(`${l}/files/download?session=${encodeURIComponent(e)}&box=${d}&name=${encodeURIComponent(T)}`,r);if(!W.ok){S("errore download");return}const M=await W.blob(),J=URL.createObjectURL(M),Y=document.createElement("a");Y.href=J,Y.download=T,Y.click(),URL.revokeObjectURL(J)}async function j(T){await vt(`${l}/files?session=${encodeURIComponent(e)}&box=${d}&name=${encodeURIComponent(T)}`,r,{method:"DELETE"}),C()}return f.jsxs("div",{className:"nc-files",children:[f.jsxs("header",{children:[f.jsx("b",{children:t?`${t}:${e}`:e}),f.jsx("button",{onClick:a,title:k("close"),children:f.jsx(Ie,{name:"x",size:20})})]}),f.jsxs("nav",{children:[f.jsx("button",{className:d==="outbox"?"on":"",onClick:()=>m("outbox"),children:"outbox"}),f.jsx("button",{className:d==="inbox"?"on":"",onClick:()=>m("inbox"),children:"inbox"}),f.jsxs("button",{className:"up",onClick:()=>g.current&&g.current.click(),children:[f.jsx(Ie,{name:"upload",size:18})," ",k("upload")]}),f.jsx("input",{type:"file",multiple:!0,ref:g,style:{display:"none"},onChange:T=>{b(Array.from(T.target.files||[])),T.target.value=""}})]}),y&&f.jsx("div",{className:"nc-busy",children:y}),f.jsxs("ul",{children:[p[d].map(T=>f.jsxs("li",{children:[f.jsx("span",{className:"name",onClick:()=>E(T.name),children:T.name}),f.jsx("small",{children:R1(T.size)}),f.jsx("button",{onClick:()=>j(T.name),title:"elimina",children:f.jsx(Ie,{name:"trash",size:18})})]},T.name)),p[d].length===0&&f.jsx("li",{className:"empty",children:k("empty-files")})]})]})}const D1="\r";function M1(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 fg({send:e,token:t,session:r,node:n}){Wt();const a=n?`/api/route/${String(n).split("/").map(encodeURIComponent).join("/")}/_`:"/api",[l,h]=I.useState(""),[d,m]=I.useState(!1),[p,v]=I.useState(""),[y,S]=I.useState(!1),g=I.useRef(null),C=I.useRef(null),[b,E]=I.useState(!1),[j,T]=I.useState({left:0,bottom:0}),[W,M]=I.useState(!1),J=I.useRef(null),Y=I.useRef(null),A=I.useRef(null),P=I.useRef(null),z=I.useRef(null),O=I.useRef(`nc-attach-${Math.random().toString(36).slice(2,8)}`);I.useEffect(()=>{let q=!1;if(n){S(!1);return}return vt(`${a}/voice/status`,t).then(R=>R.json()).then(R=>{q||S(!!R.serverSttConfigured)}).catch(()=>{q||S(!1)}),()=>{q=!0}},[t,a]);const H=!!(typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)||y);function B(){const q=M1(l);q&&(e(q),e(D1),h(""))}function D(){const q=J.current&&J.current.getBoundingClientRect();q&&T({left:Math.max(6,Math.min(q.left,window.innerWidth-186)),bottom:window.innerHeight-q.top+6}),E(!0)}function X(q){E(!1),q&&J.current&&J.current.focus()}I.useEffect(()=>{if(!b)return;const q=$=>{$.key==="Escape"&&X(!0)},R=$=>{const ce=Y.current&&Y.current.contains($.target),ue=J.current&&J.current.contains($.target);!ce&&!ue&&X(!1)};return document.addEventListener("keydown",q),document.addEventListener("pointerdown",R),()=>{document.removeEventListener("keydown",q),document.removeEventListener("pointerdown",R)}},[b]);function ee(q){X(!1),q.current&&q.current.click()}async function ie(q){if(!q.length||!r)return;M(!0),v("");const R=[];for(const $ of q)try{const ce=new FormData;ce.append("session",r),ce.append("paste","false"),ce.append("file",$,$.name);const pe=await(await vt(`${a}/files/upload`,t,{method:"POST",body:ce})).json();if(pe.error){v(pe.error);break}R.push(pe.path)}catch(ce){v(String(ce));break}R.length&&h($=>$+($&&!$.endsWith(" ")?" ":"")+R.join(" ")),M(!1)}function x(){g.current&&g.current.stop(),C.current&&C.current.stop(),m(!1)}async function Q(){v("");const q=window.SpeechRecognition||window.webkitSpeechRecognition;if(q){const R=new q;R.lang="it-IT",R.continuous=!1,R.interimResults=!0;const $=l?`${l} `:"";R.onresult=ce=>{const ue=Array.from(ce.results).map(pe=>pe[0].transcript).join("");h($+ue)},R.onend=()=>m(!1),R.onerror=ce=>{v(`voice: ${ce.error||"errore"}`),m(!1)},g.current=R,R.start(),m(!0);return}try{const R=await navigator.mediaDevices.getUserMedia({audio:!0}),$=new MediaRecorder(R),ce=[];$.ondataavailable=ue=>ce.push(ue.data),$.onstop=async()=>{R.getTracks().forEach(ue=>ue.stop()),m(!1),v("trascrivo…");try{const ue=new Blob(ce,{type:$.mimeType||"audio/webm"}),ye=await(await vt(`${a}/voice/transcribe`,t,{method:"POST",headers:{"content-type":"application/octet-stream"},body:ue})).json();ye.error?v(ye.error):(v(""),h(Se=>Se+(Se?" ":"")+(ye.text||"")))}catch(ue){v(String(ue))}},C.current={stop:()=>$.state!=="inactive"&&$.stop()},$.start(),m(!0)}catch{v("microfono non disponibile"),m(!1)}}return f.jsxs("div",{className:"nc-composer",children:[p&&f.jsx("div",{className:"nc-composer-err",children:p}),f.jsxs("div",{className:"nc-composer-row",children:[r&&f.jsx("button",{ref:J,className:W?"attach busy":"attach",disabled:W,onClick:()=>b?X(!1):D(),title:k(W?"attach-uploading":"attach"),"aria-label":k("attach"),"aria-haspopup":"menu","aria-expanded":b,"aria-controls":O.current,children:f.jsx(Ie,{name:"attach",size:22})}),b&&f.jsxs("div",{ref:Y,id:O.current,role:"menu",className:"nc-attach-menu",style:{left:j.left,bottom:j.bottom},children:[f.jsxs("button",{role:"menuitem",onClick:()=>ee(A),children:[f.jsx(Ie,{name:"file",size:18})," ",k("attach-file")]}),f.jsxs("button",{role:"menuitem",onClick:()=>ee(P),children:[f.jsx(Ie,{name:"camera",size:18})," ",k("attach-camera")]}),f.jsxs("button",{role:"menuitem",onClick:()=>ee(z),children:[f.jsx(Ie,{name:"image",size:18})," ",k("attach-gallery")]})]}),f.jsx("input",{ref:A,type:"file",multiple:!0,hidden:!0,onChange:q=>{ie(Array.from(q.target.files||[])),q.target.value=""}}),f.jsx("input",{ref:P,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:q=>{ie(Array.from(q.target.files||[])),q.target.value=""}}),f.jsx("input",{ref:z,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:q=>{ie(Array.from(q.target.files||[])),q.target.value=""}}),f.jsx("textarea",{rows:2,value:l,placeholder:k("composer-placeholder"),onChange:q=>h(q.target.value)}),H&&f.jsx("button",{className:d?"mic on":"mic",onClick:d?x:Q,title:k("voice"),children:f.jsx(Ie,{name:"mic",size:22})}),f.jsx("button",{className:"go",onClick:B,title:k("send"),children:f.jsx(Ie,{name:"enter",size:22})})]})]})}function ma(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 mm(e){return String(e||"?").replace(/^[^a-zA-Z0-9]+/,"").charAt(0).toUpperCase()||"?"}const P1=180,L1=480;function _m(e){return e.status==="down"?e.downSince?k("tunnel-down-since").replace("{t}",ma(e.downSince)):k("tunnel-down"):e.status==="unreachable"?k("node-unreachable"):e.status==="offline"?e.lastSeen?k("node-offline-seen").replace("{t}",ma(e.lastSeen)):k("node-offline"):e.status==="needs-repair"?k("node-needs-repair"):""}function T1({sessions:e=[],cells:t=[],activeSessions:r=[],nodeGroups:n=[],onPick:a,onAddTile:l,onPower:h,onNodePower:d,onKill:m,onNew:p,onSettings:v,width:y=240,collapsed:S=!1,onResize:g,onToggleCollapse:C}){const[b,E]=Wt(),[j,T]=I.useState(p_),W=x=>T(Q=>m_(Q,x)),M=new Set((t||[]).map(x=>x.tmuxSession)),J=new Map((e||[]).map(x=>[x.name,x])),Y=(x,Q)=>vn(j,x,Q),A=nh,P=[...t||[]].sort((x,Q)=>A(Y(x.tmuxSession,(J.get(x.tmuxSession)||{}).activity),Y(Q.tmuxSession,(J.get(Q.tmuxSession)||{}).activity))),z=(e||[]).filter(x=>!M.has(x.name)).sort((x,Q)=>A(Y(x.name,x.activity),Y(Q.name,Q.activity))||x.name.localeCompare(Q.name)),O=new Set(r||[]),[K,H]=I.useState(null),B=(x,Q)=>{const q=x.currentTarget.getBoundingClientRect();H({text:Q,y:q.top+q.height/2})},D=()=>H(null),X=I.useRef(null);I.useEffect(()=>()=>{X.current&&X.current()},[]);function ee(x){x.preventDefault(),x.stopPropagation();const Q=x.clientX,q=y,R=ce=>{const ue=Math.max(P1,Math.min(L1,q+(ce.clientX-Q)));g&&g(ue)},$=()=>{window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",$),window.removeEventListener("blur",$),X.current=null};window.addEventListener("pointermove",R),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",$),window.addEventListener("blur",$),X.current=$}const ie=S?{width:48,flex:"0 0 48px"}:{width:y,flex:`0 0 ${y}px`};return S?f.jsxs("aside",{className:"nc-sidebar mini",style:ie,children:[f.jsx("div",{className:"nc-side-head mini",children:f.jsx("button",{className:"nc-collapse-btn",onClick:C,title:k("expand"),children:"⟩"})}),f.jsxs("div",{className:"nc-side-group mini",children:[P.map(x=>{const Q=x.degraded?"warn":x.tmux?"on":"",q=!!x.tmux;return f.jsx("button",{type:"button",className:`nc-mini-dot${O.has(x.tmuxSession)?" active":""}`,onMouseEnter:R=>B(R,x.cell),onMouseLeave:D,draggable:q,onDragStart:q?R=>R.dataTransfer.setData("text/nc-session",x.tmuxSession):void 0,onClick:q?()=>l&&l(x.tmuxSession):()=>h&&h(x),onDoubleClick:q?()=>a&&a(x.tmuxSession):void 0,children:f.jsx("span",{className:`nc-dot ${Q}`})},x.cell)}),z.map(x=>f.jsx("button",{type:"button",className:`nc-mini-init${O.has(x.name)?" active":""}`,onMouseEnter:Q=>B(Q,x.name),onMouseLeave:D,draggable:!0,onDragStart:Q=>Q.dataTransfer.setData("text/nc-session",x.name),onClick:()=>l&&l(x.name),onDoubleClick:()=>a&&a(x.name),children:mm(x.name)},x.name)),(n||[]).flatMap(x=>x.status==="up"?x.sessions.map(Q=>f.jsx("button",{type:"button",className:`nc-mini-init${O.has(Q.key)?" active":""}`,onMouseEnter:q=>B(q,Q.key),onMouseLeave:D,draggable:!0,onDragStart:q=>q.dataTransfer.setData("text/nc-session",Q.key),onClick:()=>l&&l(Q.key),onDoubleClick:()=>a&&a({session:Q.name,node:Q.node}),children:mm(Q.name)},Q.key)):[f.jsx("button",{type:"button",className:"nc-mini-dot",onMouseEnter:Q=>B(Q,`${x.label||(x.route||[x.name]).join(" › ")}: ${_m(x)}`),onMouseLeave:D,children:f.jsx("span",{className:"nc-dot warn"})},`nodo-${(x.route||[x.name]).join("/")}`)])]}),f.jsx("button",{className:"nc-side-gear mini",onClick:v,title:k("settings"),onMouseEnter:x=>B(x,k("settings")),onMouseLeave:D,children:f.jsx(Ie,{name:"gear",size:16})}),K&&f.jsx("div",{className:"nc-mini-tip",style:{top:K.y},children:K.text})]}):f.jsxs("aside",{className:"nc-sidebar",style:ie,children:[f.jsxs("div",{className:"nc-side-head",children:[f.jsx("button",{className:"nc-collapse-btn",onClick:C,title:k("collapse"),children:"⟨"}),f.jsx("span",{className:"nc-side-title",children:k("fleet")}),f.jsxs("button",{className:"nc-new-btn",onClick:p,title:k("new-session"),children:["+ ",k("new")]})]}),(t||[]).length>0&&f.jsx("div",{className:"nc-side-group",children:P.map(x=>{const Q=x.degraded?"warn":x.tmux?"on":"",q=x.degraded?k("cell-degraded"):x.tmux?k("cell-on"):k("cell-off"),R=!!x.tmux;return f.jsxs("div",{className:`nc-cell${R?" live":""}${O.has(x.tmuxSession)?" active":""}`,title:q,draggable:R,onDragStart:R?$=>$.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:[f.jsx("span",{className:`nc-dot ${Q}`}),f.jsxs("span",{className:"nc-cell-main",children:[f.jsx("b",{children:x.cell}),f.jsxs("small",{children:[x.engine,x.key?`·${x.key}`:""]})]}),f.jsx("button",{className:`nc-pin${j.includes(x.tmuxSession)?" on":""}`,title:k("pin"),onClick:$=>{$.stopPropagation(),W(x.tmuxSession)},children:j.includes(x.tmuxSession)?"★":"☆"}),f.jsx("button",{className:`nc-power${x.tmux?" on":""}${x.degraded?" warn":""}`,onClick:$=>{$.stopPropagation(),h&&h(x)},title:x.active?k("power-off"):k("power-on"),children:f.jsx(Ie,{name:"power",size:14})})]},x.cell)})}),f.jsxs("button",{className:"nc-side-gear",onClick:v,title:k("settings"),children:[f.jsx(Ie,{name:"gear",size:15})," ",k("settings")]}),f.jsx("div",{className:"nc-side-group-title",children:k("other-sessions")}),f.jsxs("div",{className:"nc-side-group",children:[z.map(x=>f.jsxs("div",{className:`nc-side-card${O.has(x.name)?" active":""}`,draggable:!0,onDragStart:Q=>Q.dataTransfer.setData("text/nc-session",x.name),onClick:()=>l&&l(x.name),onDoubleClick:()=>a&&a(x.name),children:[f.jsx("span",{className:x.attached?"nc-dot on":"nc-dot"}),f.jsxs("span",{className:"nc-card-main",children:[f.jsx("b",{children:x.name}),f.jsxs("small",{children:[x.preview?x.preview:x.cmd?x.cmd:k("windows").replace("{n}",String(x.windows||0)),x.outbox&&x.outbox.count>0?` · 📦${x.outbox.count}`:""]})]}),x.activity?f.jsx("span",{className:"nc-rel",children:ma(x.activity)}):null,f.jsx("button",{className:`nc-pin${j.includes(x.name)?" on":""}`,title:k("pin"),onClick:Q=>{Q.stopPropagation(),W(x.name)},children:j.includes(x.name)?"★":"☆"}),f.jsx("button",{className:"nc-menu",title:k("terminate"),onClick:Q=>{Q.stopPropagation(),window.confirm(k("terminate-confirm").replace("{name}",x.name))&&m&&m(x.name)},children:"⋯"})]},x.name)),z.length===0&&f.jsx("div",{className:"nc-empty",children:k("no-sessions-short")})]}),(n||[]).map(x=>f.jsxs("div",{children:[f.jsxs("div",{className:"nc-side-group-title nc-node-title",children:[f.jsx("span",{className:`nc-dot ${x.status==="up"?"on":"warn"}`}),f.jsx("b",{children:x.label||x.name}),f.jsxs("small",{children:[" · ",x.status==="up"?k("node-sessions").replace("{n}",String(x.sessions.length)):_m(x)]}),x.direct&&f.jsx("button",{type:"button",className:`nc-power${x.tunnelStatus==="up"?" on":""}`,title:x.tunnelStatus==="up"?k("power-off"):k("power-on"),onClick:()=>d&&d(x),children:f.jsx(Ie,{name:"power",size:14})})]}),x.status==="up"&&f.jsxs("div",{className:"nc-side-group",children:[x.sessions.map(Q=>f.jsxs("div",{className:`nc-side-card${O.has(Q.key)?" active":""}`,draggable:!0,onDragStart:q=>q.dataTransfer.setData("text/nc-session",Q.key),onClick:()=>l&&l(Q.key),onDoubleClick:()=>a&&a({session:Q.name,node:Q.node}),children:[f.jsx("span",{className:Q.attached?"nc-dot on":"nc-dot"}),f.jsxs("span",{className:"nc-card-main",children:[f.jsx("b",{children:Q.name}),f.jsx("small",{children:Q.preview?Q.preview:Q.cmd?Q.cmd:k("windows").replace("{n}",String(Q.windows||0))})]}),Q.activity?f.jsx("span",{className:"nc-rel",children:ma(Q.activity)}):null,f.jsx("button",{className:"nc-menu",title:k("terminate"),onClick:q=>{q.stopPropagation(),window.confirm(k("terminate-confirm").replace("{name}",Q.name))&&m&&m(Q.name,x.route)},children:"⋯"})]},Q.key)),x.sessions.length===0&&f.jsx("div",{className:"nc-empty",children:k("no-sessions-short")})]})]},`nodo-${(x.route||[x.name]).join("/")}`)),f.jsx("div",{className:"nc-side-lang",children:v_.map((x,Q)=>f.jsxs("span",{children:[Q>0&&" · ",f.jsx("button",{className:`nc-lang-btn${b===x?" on":""}`,onClick:()=>E(x),title:x,children:x.toUpperCase()})]},x))}),f.jsx("div",{className:"nc-side-resize",onPointerDown:ee,title:""})]})}const fu=9,_a=.2,B1=/^[a-z0-9-]{1,32}(?:\/[a-z0-9-]{1,32}){0,3}$/,Kh=e=>B1.test(e)&&new Set(e.split("/")).size===e.split("/").length;function ga(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!Kh(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"&&Kh(e.node)?{session:e.session,node:e.node}:null:null}function Di(e){const t=ga(e);return t?t.node?`${t.node}:${t.session}`:t.session:""}const pg=9,mg=24,Ea=11,A1=e=>{const t=Number(e);return t>=pg&&t<=mg?t:Ea};function va(){return{columns:[]}}function Fi(e){return e.columns.flatMap(t=>t.tiles.map(r=>Di(r)))}const Tn=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(r=>({...r}))}))});function ya(e,t,r,n){const a=ga(t);if(!a||Fi(e).includes(Di(a))||Fi(e).length>=fu)return e;const l=Tn(e),h={session:a.session,height:1,fontSize:Ea,...n||{}};if(a.node&&(h.node=a.node),r==="end")return l.columns.push({width:1,tiles:[h]}),l;if(r&&typeof r.col=="number"&&typeof r.row=="number"&&l.columns[r.col])return l.columns[r.col].tiles.splice(r.row,0,h),l;if(r&&typeof r.col=="number"){const d=Math.max(0,Math.min(l.columns.length,r.col));return l.columns.splice(d,0,{width:1,tiles:[h]}),l}return l.columns.push({width:1,tiles:[h]}),l}function _g(e,t){const r=Di(t);if(!r||Fi(e).includes(r)||Fi(e).length>=fu)return e;const n=Fi(e).length+1,a=Math.ceil(Math.sqrt(n));if(e.columns.length<a)return ya(e,t,"end");let l=0;for(let h=1;h<e.columns.length;h+=1)e.columns[h].tiles.length<e.columns[l].tiles.length&&(l=h);return ya(e,t,{col:l,row:e.columns[l].tiles.length})}function Sa(e,t){const r=Di(t),n=Tn(e);for(const a of n.columns)a.tiles=a.tiles.filter(l=>Di(l)!==r);return n.columns=n.columns.filter(a=>a.tiles.length>0),n}function j1(e,t,r){const n=Di(t);if(!Fi(e).includes(n))return e;const a=e.columns.flatMap(l=>l.tiles).find(l=>Di(l)===n);return ya(Sa(e,n),n,r,{fontSize:a.fontSize})}function I1(e,t,r){const n=Tn(e);return n.columns[t]&&(n.columns[t].width=Math.max(_a,Number(r)||1)),n}function O1(e,t,r,n){const a=Tn(e),l=a.columns[t]&&a.columns[t].tiles[r];return l&&(l.height=Math.max(_a,Number(n)||1)),a}function z1(e,t,r,n){if(!(e.columns[t]&&e.columns[t].tiles[r]))return e;const l=Tn(e),h=l.columns[t].tiles[r],d=Number(h.fontSize)||Ea;return h.fontSize=Math.max(pg,Math.min(mg,d+(Number(n)||0))),l}function F1(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 gm(e){for(const t of[.25,.5,.75])if(Math.abs(e-t)<=.03)return t;return e}function Br(e){if(!e||!Array.isArray(e.columns))return va();const t=e.columns.map(n=>({width:Math.max(_a,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"&&Kh(a.node)).map(a=>{const l={session:a.session,height:Math.max(_a,Number(a.height)||1),fontSize:A1(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(Di(a))&&r.add(Di(a))&&r.size<=fu);return{columns:t.filter(n=>n.tiles.length>0)}}function H1({session:e,node:t,token:r,readonly:n=!1,focused:a,onFocus:l,onClose:h,onOpenSingle:d,alive:m=!0,fontSize:p=Ea,onZoom:v,decks:y=[],currentDeck:S,onSendToDeck:g}){const C=I.useRef(()=>{}),b=I.useRef(()=>{}),E=I.useRef(!1),[j,T]=I.useState(!1),[W,M]=I.useState(!1),[J,Y]=I.useState(!1),[A,P]=I.useState(null),z=t?`${t}:${e}`:e;return f.jsxs("div",{className:`nc-tile${a?" focused":""}`,onMouseDown:()=>l&&l(z),children:[f.jsxs("div",{className:"nc-tile-head",draggable:!0,onDragStart:O=>{O.dataTransfer.setData("text/nc-session",z),O.dataTransfer.effectAllowed="move"},children:[f.jsxs("button",{className:"nc-tile-name",onClick:()=>l&&l(z),children:[f.jsx("span",{className:m?"nc-dot on":"nc-dot"}),f.jsx("b",{children:e}),t&&f.jsxs("small",{className:"nc-tile-node",children:["@",t]})]}),f.jsxs("span",{className:"nc-tile-actions",children:[v&&f.jsx("button",{onClick:()=>v(-1),title:k("zoom-out"),children:f.jsx(Ie,{name:"zoomOut",size:14})}),v&&f.jsx("button",{onClick:()=>v(1),title:k("zoom-in"),children:f.jsx(Ie,{name:"zoomIn",size:14})}),g&&y.filter(O=>O!==S).length>0&&f.jsxs("select",{className:"nc-tile-deck",title:k("send-to-deck"),value:"",onMouseDown:O=>O.stopPropagation(),onChange:O=>{const K=O.target.value;K&&g(z,K),O.target.value=""},children:[f.jsx("option",{value:"",children:k("send-to-deck")}),y.filter(O=>O!==S).map(O=>f.jsx("option",{value:O,children:O},O))]}),f.jsx("button",{onClick:()=>M(O=>!O),title:"composer",children:"⌨"}),f.jsx("button",{onClick:()=>Y(O=>!O),title:"file",children:"📁"}),d&&f.jsx("button",{onClick:()=>d({session:e,node:t}),title:"vista singola",children:"↗"}),h&&f.jsx("button",{className:"nc-tile-close",onClick:()=>h(z),title:"chiudi",children:"✕"})]})]}),f.jsxs("div",{className:"nc-tile-body",children:[f.jsx(ug,{session:e,node:t,token:r,readonly:n,takeSize:!1,focused:a,sendRef:C,actionRef:b,ctrlRef:E,setCtrlArmed:T,onFiles:P,fontSize:p}),J&&f.jsx("div",{className:"nc-tile-files",onMouseDown:O=>O.stopPropagation(),children:f.jsx(dg,{session:e,node:t,token:r,filesEvent:A,onClose:()=>Y(!1)})})]}),W&&f.jsx("div",{className:"nc-tile-composer",onMouseDown:O=>O.stopPropagation(),children:f.jsx(fg,{send:O=>C.current(O),token:r,session:e,node:t})})]})}const vm=.2,ym=.28;function W1(e,t,r){const n=(e-r.left)/(r.width||1),a=(t-r.top)/(r.height||1);return n<ym?"left":n>1-ym?"right":a<.5?"top":"bottom"}function $1({layout:e,onLayoutChange:t,token:r,readonly:n=!1,sessionsAlive:a,focusSession:l,onFocus:h,onOpenSingle:d,decks:m=[],currentDeck:p,onSendToDeck:v}){Wt();const[y,S]=I.useState(null),g=I.useRef(null),C=I.useRef([]),b=I.useRef(null);function E(z,O){const K=()=>{window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",K),window.removeEventListener("pointercancel",K),window.removeEventListener("blur",K),b.current=null};window.addEventListener("pointermove",z),window.addEventListener("pointerup",K),window.addEventListener("pointercancel",K),window.addEventListener("blur",K),b.current=K}I.useEffect(()=>()=>{b.current&&b.current()},[]),I.useEffect(()=>{const z=()=>S(null);return window.addEventListener("dragend",z),window.addEventListener("drop",z),()=>{window.removeEventListener("dragend",z),window.removeEventListener("drop",z)}},[]);const j=e.columns.length,T=z=>y&&y.col===z&&y.row===void 0,W=!!y&&y.col===j,M=(z,O)=>y&&y.col===z&&y.row===O&&y.quadrant?` drop-${y.quadrant}`:"";function J(z){z.preventDefault();const O=z.dataTransfer.getData("text/nc-session"),K=y;if(S(null),!O||!K)return;let H;if(K.quadrant){if(H=F1(e,K.col,K.row,K.quadrant),!H)return}else H={col:K.col};t(Fi(e).includes(O)?j1(e,O,H):ya(e,O,H))}function Y(z,O){z.preventDefault(),z.stopPropagation();const K=z.clientX,H=e.columns[O].width,B=g.current&&g.current.clientWidth||1,D=e.columns[O+1];E(ee=>{let ie=Math.max(vm,H+(ee.clientX-K)/B);if(D){const x=gm(ie/(ie+D.width));ie=x/(1-x)*D.width}t(I1(e,O,ie))})}function A(z,O,K){z.preventDefault(),z.stopPropagation();const H=z.clientY,B=e.columns[O].tiles[K].height,D=C.current[O],X=D&&D.clientHeight||1,ee=e.columns[O].tiles[K+1];E(x=>{let Q=Math.max(vm,B+(x.clientY-H)/X);if(ee){const q=gm(Q/(Q+ee.height));Q=q/(1-q)*ee.height}t(O1(e,O,K,Q))})}function P(z){t(Sa(e,z))}return f.jsxs("div",{className:"nc-grid",ref:g,onDragOver:z=>{z.preventDefault(),y&&y.col===j||S({col:j})},onDrop:J,onDragLeave:z=>{const O=z.relatedTarget;(!O||!(g.current&&g.current.contains(O)))&&S(null)},children:[e.columns.flatMap((z,O)=>{const K=[];return K.push(f.jsx("div",{className:`nc-col${T(O)?" drop-newcol":""}`,ref:H=>{C.current[O]=H},style:{flexGrow:z.width,flexBasis:0},onDragOver:H=>{H.preventDefault(),H.stopPropagation(),y&&y.col===O&&y.row===void 0||S({col:O})},children:z.tiles.flatMap((H,B)=>{const D=[],X=Di(H);return D.push(f.jsx("div",{className:`nc-tile-slot${M(O,B)}`,style:{flexGrow:H.height,flexBasis:0},onDragOver:ee=>{ee.preventDefault(),ee.stopPropagation();const ie=W1(ee.clientX,ee.clientY,ee.currentTarget.getBoundingClientRect());y&&y.col===O&&y.row===B&&y.quadrant===ie||S({col:O,row:B,quadrant:ie})},children:f.jsx(H1,{session:H.session,node:H.node,token:r,readonly:n,focused:l===X,onFocus:h,onClose:P,onOpenSingle:d,alive:!a||a.has(X),fontSize:H.fontSize,onZoom:ee=>t(z1(e,O,B,ee)),decks:m,currentDeck:p,onSendToDeck:v})},X)),B<z.tiles.length-1&&D.push(f.jsx("div",{className:"nc-divider-h",onPointerDown:ee=>A(ee,O,B)},`h${B}`)),D})},`c${O}`)),O<j-1&&K.push(f.jsx("div",{className:"nc-divider-v",onPointerDown:H=>Y(H,O)},`v${O}`)),K}),W&&f.jsx("div",{className:"nc-drop-line-v nc-drop-line-end"}),j===0&&f.jsx("div",{className:"nc-grid-empty",children:k("grid-empty")})]})}const U1=/^[a-z0-9-]{1,32}$/,Xt="main",gg="nc_decks",K1=24;function V1(e){return typeof e!="string"?"":e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").slice(0,32).replace(/-+$/,"")}function pu(e){return typeof e=="string"&&U1.test(e)}function q1(e){const t=String(e||"").match(/^\/deck\/([^/]+)\/?$/);if(t){let r;try{r=decodeURIComponent(t[1])}catch{r=t[1]}return pu(r)?r:Xt}return Xt}function ea(e,t){const r=e===Xt?"/":`/deck/${encodeURIComponent(e)}`;return t?`${r}#token=${encodeURIComponent(t)}`:r}function vg(e){return e===Xt?"nc_grid_v1":`nc_grid_v1__${e}`}function yg(e){const t=[Xt];if(Array.isArray(e)){for(const r of e)if(pu(r)&&r!==Xt&&!t.includes(r)&&t.push(r),t.length>=K1)break}return t}function Na(){return typeof localStorage<"u"?localStorage:null}function Y1(){const e=Na();if(!e)return[Xt];try{return yg(JSON.parse(e.getItem(gg)||"null"))}catch{return[Xt]}}function X1(e){const t=Na();if(t)try{t.setItem(gg,JSON.stringify(yg(e)))}catch{}}function Vh(e){const t=Na();if(!t)return null;try{return JSON.parse(t.getItem(vg(e))||"null")}catch{return null}}function G1(e,t){const r=Na();if(r)try{r.setItem(vg(e),JSON.stringify(t))}catch{}}function Q1({decks:e=[],currentDeck:t=Xt,onCreate:r,onRename:n,onDelete:a,onOpenWindow:l,onNavigate:h,saveState:d="idle",error:m=""}){Wt();const[p,v]=I.useState(!1),[y,S]=I.useState(""),[g,C]=I.useState(!1),[b,E]=I.useState(""),[j,T]=I.useState(""),W=V1(y),M=pu(W),J=async()=>{if(M){C(!0),E("");try{r&&await r(W),S(""),v(!1)}catch(A){E(String(A.message||A))}C(!1)}},Y=A=>{T(""),l&&l(A)||T(A)};return f.jsxs("div",{className:"nc-deckbar",children:[f.jsx("span",{className:"nc-deckbar-label",children:k("decks")}),f.jsx("div",{className:"nc-deck-chips",children:e.map(A=>f.jsxs("span",{className:`nc-deck-chip${A===t?" current":""}`,children:[f.jsxs("button",{className:"nc-deck-open",title:A===t?k("deck-current"):A,onClick:()=>A!==t&&h&&h(A),children:[A,A===t?" •":""]}),f.jsx("button",{className:"nc-deck-mini",title:k("open-deck-window"),onClick:()=>Y(A),children:"↗"}),A!==Xt&&f.jsxs(f.Fragment,{children:[f.jsx("button",{className:"nc-deck-mini",title:k("rename-deck"),onClick:()=>{const z=((typeof window<"u"?window.prompt(k("rename-deck"),A):"")||"").trim();z&&z!==A&&n&&n(A,z).catch(O=>E(String(O.message||O)))},children:"✎"}),f.jsx("button",{className:"nc-deck-mini nc-deck-del",title:k("delete-deck"),onClick:()=>{(typeof window>"u"||window.confirm(k("delete-deck-confirm").replace("{name}",A)))&&a&&a(A).catch(P=>E(String(P.message||P)))},children:"✕"})]})]},A))}),p?f.jsxs("span",{className:"nc-deck-add",children:[f.jsx("input",{autoFocus:!0,className:M||!y?"":"invalid",placeholder:k("deck-name"),value:y,onChange:A=>S(A.target.value),onKeyDown:A=>{A.key==="Enter"&&J(),A.key==="Escape"&&(S(""),v(!1))}}),y&&M&&W!==y&&f.jsxs("span",{className:"nc-deck-slug",children:["→ ",W]}),f.jsx("button",{className:"nc-deck-ok",disabled:!M||g,onClick:J,children:k("create")}),f.jsx("button",{className:"nc-deck-cancel",onClick:()=>{S(""),v(!1)},children:k("cancel")})]}):f.jsxs("button",{className:"nc-deck-newbtn",title:k("new-deck"),onClick:()=>v(!0),children:["+ ",k("new-deck")]}),f.jsx("span",{className:`nc-deck-state ${d}`,title:k("deck-autosave"),children:k(d==="saving"?"saving":d==="saved"?"saved":"deck-autosave")}),(b||m)&&f.jsx("span",{className:"nc-deck-error",children:b||m}),j&&f.jsx("a",{className:"nc-deck-fallback",href:`/deck/${encodeURIComponent(j)}`,target:"_blank",rel:"noreferrer",children:k("popup-blocked")})]})}var _s={},Ac,Sm;function J1(){return Sm||(Sm=1,Ac=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Ac}var jc={},dr={},wm;function Fr(){if(wm)return dr;wm=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 dr.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},dr.getSymbolTotalCodewords=function(n){return t[n]},dr.getBCHDigit=function(r){let n=0;for(;r!==0;)n++,r>>>=1;return n},dr.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');e=n},dr.isKanjiModeEnabled=function(){return typeof e<"u"},dr.toSJIS=function(n){return e(n)},dr}var Ic={},Cm;function mu(){return Cm||(Cm=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}}})(Ic)),Ic}var Oc,bm;function Z1(){if(bm)return Oc;bm=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++}},Oc=e,Oc}var zc,xm;function eC(){if(xm)return zc;xm=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]},zc=e,zc}var Fc={},km;function tC(){return km||(km=1,(function(e){const t=Fr().getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const a=Math.floor(n/7)+2,l=t(n),h=l===145?26:Math.ceil((l-13)/(2*a-2))*2,d=[l-7];for(let m=1;m<a-1;m++)d[m]=d[m-1]-h;return d.push(6),d.reverse()},e.getPositions=function(n){const a=[],l=e.getRowColCoords(n),h=l.length;for(let d=0;d<h;d++)for(let m=0;m<h;m++)d===0&&m===0||d===0&&m===h-1||d===h-1&&m===0||a.push([l[d],l[m]]);return a}})(Fc)),Fc}var Hc={},Em;function iC(){if(Em)return Hc;Em=1;const e=Fr().getSymbolSize,t=7;return Hc.getPositions=function(n){const a=e(n);return[[0,0],[a-t,0],[0,a-t]]},Hc}var Wc={},Nm;function rC(){return Nm||(Nm=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(a){return a!=null&&a!==""&&!isNaN(a)&&a>=0&&a<=7},e.from=function(a){return e.isValid(a)?parseInt(a,10):void 0},e.getPenaltyN1=function(a){const l=a.size;let h=0,d=0,m=0,p=null,v=null;for(let y=0;y<l;y++){d=m=0,p=v=null;for(let S=0;S<l;S++){let g=a.get(y,S);g===p?d++:(d>=5&&(h+=t.N1+(d-5)),p=g,d=1),g=a.get(S,y),g===v?m++:(m>=5&&(h+=t.N1+(m-5)),v=g,m=1)}d>=5&&(h+=t.N1+(d-5)),m>=5&&(h+=t.N1+(m-5))}return h},e.getPenaltyN2=function(a){const l=a.size;let h=0;for(let d=0;d<l-1;d++)for(let m=0;m<l-1;m++){const p=a.get(d,m)+a.get(d,m+1)+a.get(d+1,m)+a.get(d+1,m+1);(p===4||p===0)&&h++}return h*t.N2},e.getPenaltyN3=function(a){const l=a.size;let h=0,d=0,m=0;for(let p=0;p<l;p++){d=m=0;for(let v=0;v<l;v++)d=d<<1&2047|a.get(p,v),v>=10&&(d===1488||d===93)&&h++,m=m<<1&2047|a.get(v,p),v>=10&&(m===1488||m===93)&&h++}return h*t.N3},e.getPenaltyN4=function(a){let l=0;const h=a.data.length;for(let m=0;m<h;m++)l+=a.data[m];return Math.abs(Math.ceil(l*100/h/5)-10)*t.N4};function r(n,a,l){switch(n){case e.Patterns.PATTERN000:return(a+l)%2===0;case e.Patterns.PATTERN001:return a%2===0;case e.Patterns.PATTERN010:return l%3===0;case e.Patterns.PATTERN011:return(a+l)%3===0;case e.Patterns.PATTERN100:return(Math.floor(a/2)+Math.floor(l/3))%2===0;case e.Patterns.PATTERN101:return a*l%2+a*l%3===0;case e.Patterns.PATTERN110:return(a*l%2+a*l%3)%2===0;case e.Patterns.PATTERN111:return(a*l%3+(a+l)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.applyMask=function(a,l){const h=l.size;for(let d=0;d<h;d++)for(let m=0;m<h;m++)l.isReserved(m,d)||l.xor(m,d,r(a,m,d))},e.getBestMask=function(a,l){const h=Object.keys(e.Patterns).length;let d=0,m=1/0;for(let p=0;p<h;p++){l(p),e.applyMask(p,a);const v=e.getPenaltyN1(a)+e.getPenaltyN2(a)+e.getPenaltyN3(a)+e.getPenaltyN4(a);e.applyMask(p,a),v<m&&(m=v,d=p)}return d}})(Wc)),Wc}var ta={},Rm;function Sg(){if(Rm)return ta;Rm=1;const e=mu(),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 ta.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}},ta.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}},ta}var $c={},gn={},Dm;function sC(){if(Dm)return gn;Dm=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]})(),gn.log=function(n){if(n<1)throw new Error("log("+n+")");return t[n]},gn.exp=function(n){return e[n]},gn.mul=function(n,a){return n===0||a===0?0:e[t[n]+t[a]]},gn}var Mm;function nC(){return Mm||(Mm=1,(function(e){const t=sC();e.mul=function(n,a){const l=new Uint8Array(n.length+a.length-1);for(let h=0;h<n.length;h++)for(let d=0;d<a.length;d++)l[h+d]^=t.mul(n[h],a[d]);return l},e.mod=function(n,a){let l=new Uint8Array(n);for(;l.length-a.length>=0;){const h=l[0];for(let m=0;m<a.length;m++)l[m]^=t.mul(a[m],h);let d=0;for(;d<l.length&&l[d]===0;)d++;l=l.slice(d)}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}})($c)),$c}var Uc,Pm;function oC(){if(Pm)return Uc;Pm=1;const e=nC();function t(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(n){this.degree=n,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const a=new Uint8Array(n.length+this.degree);a.set(n);const l=e.mod(a,this.genPoly),h=this.degree-l.length;if(h>0){const d=new Uint8Array(this.degree);return d.set(l,h),d}return l},Uc=t,Uc}var Kc={},Vc={},qc={},Lm;function wg(){return Lm||(Lm=1,qc.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),qc}var xi={},Tm;function Cg(){if(Tm)return xi;Tm=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
|
+
]))+`;xi.KANJI=new RegExp(r,"g"),xi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),xi.BYTE=new RegExp(n,"g"),xi.NUMERIC=new RegExp(e,"g"),xi.ALPHANUMERIC=new RegExp(t,"g");const a=new RegExp("^"+r+"$"),l=new RegExp("^"+e+"$"),h=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return xi.testKanji=function(m){return a.test(m)},xi.testNumeric=function(m){return l.test(m)},xi.testAlphanumeric=function(m){return h.test(m)},xi}var Bm;function Hr(){return Bm||(Bm=1,(function(e){const t=wg(),r=Cg();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(l,h){if(!l.ccBits)throw new Error("Invalid mode: "+l);if(!t.isValid(h))throw new Error("Invalid version: "+h);return h>=1&&h<10?l.ccBits[0]:h<27?l.ccBits[1]:l.ccBits[2]},e.getBestModeForData=function(l){return r.testNumeric(l)?e.NUMERIC:r.testAlphanumeric(l)?e.ALPHANUMERIC:r.testKanji(l)?e.KANJI:e.BYTE},e.toString=function(l){if(l&&l.id)return l.id;throw new Error("Invalid mode")},e.isValid=function(l){return l&&l.bit&&l.ccBits};function n(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+a)}}e.from=function(l,h){if(e.isValid(l))return l;try{return n(l)}catch{return h}}})(Vc)),Vc}var Am;function aC(){return Am||(Am=1,(function(e){const t=Fr(),r=Sg(),n=mu(),a=Hr(),l=wg(),h=7973,d=t.getBCHDigit(h);function m(S,g,C){for(let b=1;b<=40;b++)if(g<=e.getCapacity(b,C,S))return b}function p(S,g){return a.getCharCountIndicator(S,g)+4}function v(S,g){let C=0;return S.forEach(function(b){const E=p(b.mode,g);C+=E+b.getBitsLength()}),C}function y(S,g){for(let C=1;C<=40;C++)if(v(S,C)<=e.getCapacity(C,g,a.MIXED))return C}e.from=function(g,C){return l.isValid(g)?parseInt(g,10):C},e.getCapacity=function(g,C,b){if(!l.isValid(g))throw new Error("Invalid QR Code version");typeof b>"u"&&(b=a.BYTE);const E=t.getSymbolTotalCodewords(g),j=r.getTotalCodewordsCount(g,C),T=(E-j)*8;if(b===a.MIXED)return T;const W=T-p(b,g);switch(b){case a.NUMERIC:return Math.floor(W/10*3);case a.ALPHANUMERIC:return Math.floor(W/11*2);case a.KANJI:return Math.floor(W/13);case a.BYTE:default:return Math.floor(W/8)}},e.getBestVersionForData=function(g,C){let b;const E=n.from(C,n.M);if(Array.isArray(g)){if(g.length>1)return y(g,E);if(g.length===0)return 1;b=g[0]}else b=g;return m(b.mode,b.getLength(),E)},e.getEncodedBits=function(g){if(!l.isValid(g)||g<7)throw new Error("Invalid QR Code version");let C=g<<12;for(;t.getBCHDigit(C)-d>=0;)C^=h<<t.getBCHDigit(C)-d;return g<<12|C}})(Kc)),Kc}var Yc={},jm;function lC(){if(jm)return Yc;jm=1;const e=Fr(),t=1335,r=21522,n=e.getBCHDigit(t);return Yc.getEncodedBits=function(l,h){const d=l.bit<<3|h;let m=d<<10;for(;e.getBCHDigit(m)-n>=0;)m^=t<<e.getBCHDigit(m)-n;return(d<<10|m)^r},Yc}var Xc={},Gc,Im;function cC(){if(Im)return Gc;Im=1;const e=Hr();function t(r){this.mode=e.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){let a,l,h;for(a=0;a+3<=this.data.length;a+=3)l=this.data.substr(a,3),h=parseInt(l,10),n.put(h,10);const d=this.data.length-a;d>0&&(l=this.data.substr(a),h=parseInt(l,10),n.put(h,d*3+1))},Gc=t,Gc}var Qc,Om;function hC(){if(Om)return Qc;Om=1;const e=Hr(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(n){this.mode=e.ALPHANUMERIC,this.data=n}return r.getBitsLength=function(a){return 11*Math.floor(a/2)+6*(a%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(a){let l;for(l=0;l+2<=this.data.length;l+=2){let h=t.indexOf(this.data[l])*45;h+=t.indexOf(this.data[l+1]),a.put(h,11)}this.data.length%2&&a.put(t.indexOf(this.data[l]),6)},Qc=r,Qc}var Jc,zm;function uC(){if(zm)return Jc;zm=1;const e=Hr();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)},Jc=t,Jc}var Zc,Fm;function dC(){if(Fm)return Zc;Fm=1;const e=Hr(),t=Fr();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)}},Zc=r,Zc}var eh={exports:{}},Hm;function fC(){return Hm||(Hm=1,(function(e){var t={single_source_shortest_paths:function(r,n,a){var l={},h={};h[n]=0;var d=t.PriorityQueue.make();d.push(n,0);for(var m,p,v,y,S,g,C,b,E;!d.empty();){m=d.pop(),p=m.value,y=m.cost,S=r[p]||{};for(v in S)S.hasOwnProperty(v)&&(g=S[v],C=y+g,b=h[v],E=typeof h[v]>"u",(E||b>C)&&(h[v]=C,d.push(v,C),l[v]=p))}if(typeof a<"u"&&typeof h[a]>"u"){var j=["Could not find a path from ",n," to ",a,"."].join("");throw new Error(j)}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})(eh)),eh.exports}var Wm;function pC(){return Wm||(Wm=1,(function(e){const t=Hr(),r=cC(),n=hC(),a=uC(),l=dC(),h=Cg(),d=Fr(),m=fC();function p(j){return unescape(encodeURIComponent(j)).length}function v(j,T,W){const M=[];let J;for(;(J=j.exec(W))!==null;)M.push({data:J[0],index:J.index,mode:T,length:J[0].length});return M}function y(j){const T=v(h.NUMERIC,t.NUMERIC,j),W=v(h.ALPHANUMERIC,t.ALPHANUMERIC,j);let M,J;return d.isKanjiModeEnabled()?(M=v(h.BYTE,t.BYTE,j),J=v(h.KANJI,t.KANJI,j)):(M=v(h.BYTE_KANJI,t.BYTE,j),J=[]),T.concat(W,M,J).sort(function(A,P){return A.index-P.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function S(j,T){switch(T){case t.NUMERIC:return r.getBitsLength(j);case t.ALPHANUMERIC:return n.getBitsLength(j);case t.KANJI:return l.getBitsLength(j);case t.BYTE:return a.getBitsLength(j)}}function g(j){return j.reduce(function(T,W){const M=T.length-1>=0?T[T.length-1]:null;return M&&M.mode===W.mode?(T[T.length-1].data+=W.data,T):(T.push(W),T)},[])}function C(j){const T=[];for(let W=0;W<j.length;W++){const M=j[W];switch(M.mode){case t.NUMERIC:T.push([M,{data:M.data,mode:t.ALPHANUMERIC,length:M.length},{data:M.data,mode:t.BYTE,length:M.length}]);break;case t.ALPHANUMERIC:T.push([M,{data:M.data,mode:t.BYTE,length:M.length}]);break;case t.KANJI:T.push([M,{data:M.data,mode:t.BYTE,length:p(M.data)}]);break;case t.BYTE:T.push([{data:M.data,mode:t.BYTE,length:p(M.data)}])}}return T}function b(j,T){const W={},M={start:{}};let J=["start"];for(let Y=0;Y<j.length;Y++){const A=j[Y],P=[];for(let z=0;z<A.length;z++){const O=A[z],K=""+Y+z;P.push(K),W[K]={node:O,lastCount:0},M[K]={};for(let H=0;H<J.length;H++){const B=J[H];W[B]&&W[B].node.mode===O.mode?(M[B][K]=S(W[B].lastCount+O.length,O.mode)-S(W[B].lastCount,O.mode),W[B].lastCount+=O.length):(W[B]&&(W[B].lastCount=O.length),M[B][K]=S(O.length,O.mode)+4+t.getCharCountIndicator(O.mode,T))}}J=P}for(let Y=0;Y<J.length;Y++)M[J[Y]].end=0;return{map:M,table:W}}function E(j,T){let W;const M=t.getBestModeForData(j);if(W=t.from(T,M),W!==t.BYTE&&W.bit<M.bit)throw new Error('"'+j+'" cannot be encoded with mode '+t.toString(W)+`.
|
|
84
|
+
Suggested mode is: `+t.toString(M));switch(W===t.KANJI&&!d.isKanjiModeEnabled()&&(W=t.BYTE),W){case t.NUMERIC:return new r(j);case t.ALPHANUMERIC:return new n(j);case t.KANJI:return new l(j);case t.BYTE:return new a(j)}}e.fromArray=function(T){return T.reduce(function(W,M){return typeof M=="string"?W.push(E(M,null)):M.data&&W.push(E(M.data,M.mode)),W},[])},e.fromString=function(T,W){const M=y(T,d.isKanjiModeEnabled()),J=C(M),Y=b(J,W),A=m.find_path(Y.map,"start","end"),P=[];for(let z=1;z<A.length-1;z++)P.push(Y.table[A[z]].node);return e.fromArray(g(P))},e.rawSplit=function(T){return e.fromArray(y(T,d.isKanjiModeEnabled()))}})(Xc)),Xc}var $m;function mC(){if($m)return jc;$m=1;const e=Fr(),t=mu(),r=Z1(),n=eC(),a=tC(),l=iC(),h=rC(),d=Sg(),m=oC(),p=aC(),v=lC(),y=Hr(),S=pC();function g(Y,A){const P=Y.size,z=l.getPositions(A);for(let O=0;O<z.length;O++){const K=z[O][0],H=z[O][1];for(let B=-1;B<=7;B++)if(!(K+B<=-1||P<=K+B))for(let D=-1;D<=7;D++)H+D<=-1||P<=H+D||(B>=0&&B<=6&&(D===0||D===6)||D>=0&&D<=6&&(B===0||B===6)||B>=2&&B<=4&&D>=2&&D<=4?Y.set(K+B,H+D,!0,!0):Y.set(K+B,H+D,!1,!0))}}function C(Y){const A=Y.size;for(let P=8;P<A-8;P++){const z=P%2===0;Y.set(P,6,z,!0),Y.set(6,P,z,!0)}}function b(Y,A){const P=a.getPositions(A);for(let z=0;z<P.length;z++){const O=P[z][0],K=P[z][1];for(let H=-2;H<=2;H++)for(let B=-2;B<=2;B++)H===-2||H===2||B===-2||B===2||H===0&&B===0?Y.set(O+H,K+B,!0,!0):Y.set(O+H,K+B,!1,!0)}}function E(Y,A){const P=Y.size,z=p.getEncodedBits(A);let O,K,H;for(let B=0;B<18;B++)O=Math.floor(B/3),K=B%3+P-8-3,H=(z>>B&1)===1,Y.set(O,K,H,!0),Y.set(K,O,H,!0)}function j(Y,A,P){const z=Y.size,O=v.getEncodedBits(A,P);let K,H;for(K=0;K<15;K++)H=(O>>K&1)===1,K<6?Y.set(K,8,H,!0):K<8?Y.set(K+1,8,H,!0):Y.set(z-15+K,8,H,!0),K<8?Y.set(8,z-K-1,H,!0):K<9?Y.set(8,15-K-1+1,H,!0):Y.set(8,15-K-1,H,!0);Y.set(z-8,8,1,!0)}function T(Y,A){const P=Y.size;let z=-1,O=P-1,K=7,H=0;for(let B=P-1;B>0;B-=2)for(B===6&&B--;;){for(let D=0;D<2;D++)if(!Y.isReserved(O,B-D)){let X=!1;H<A.length&&(X=(A[H]>>>K&1)===1),Y.set(O,B-D,X),K--,K===-1&&(H++,K=7)}if(O+=z,O<0||P<=O){O-=z,z=-z;break}}}function W(Y,A,P){const z=new r;P.forEach(function(D){z.put(D.mode.bit,4),z.put(D.getLength(),y.getCharCountIndicator(D.mode,Y)),D.write(z)});const O=e.getSymbolTotalCodewords(Y),K=d.getTotalCodewordsCount(Y,A),H=(O-K)*8;for(z.getLengthInBits()+4<=H&&z.put(0,4);z.getLengthInBits()%8!==0;)z.putBit(0);const B=(H-z.getLengthInBits())/8;for(let D=0;D<B;D++)z.put(D%2?17:236,8);return M(z,Y,A)}function M(Y,A,P){const z=e.getSymbolTotalCodewords(A),O=d.getTotalCodewordsCount(A,P),K=z-O,H=d.getBlocksCount(A,P),B=z%H,D=H-B,X=Math.floor(z/H),ee=Math.floor(K/H),ie=ee+1,x=X-ee,Q=new m(x);let q=0;const R=new Array(H),$=new Array(H);let ce=0;const ue=new Uint8Array(Y.buffer);for(let ke=0;ke<H;ke++){const Te=ke<D?ee:ie;R[ke]=ue.slice(q,q+Te),$[ke]=Q.encode(R[ke]),q+=Te,ce=Math.max(ce,Te)}const pe=new Uint8Array(z);let ye=0,Se,Ce;for(Se=0;Se<ce;Se++)for(Ce=0;Ce<H;Ce++)Se<R[Ce].length&&(pe[ye++]=R[Ce][Se]);for(Se=0;Se<x;Se++)for(Ce=0;Ce<H;Ce++)pe[ye++]=$[Ce][Se];return pe}function J(Y,A,P,z){let O;if(Array.isArray(Y))O=S.fromArray(Y);else if(typeof Y=="string"){let X=A;if(!X){const ee=S.rawSplit(Y);X=p.getBestVersionForData(ee,P)}O=S.fromString(Y,X||40)}else throw new Error("Invalid data");const K=p.getBestVersionForData(O,P);if(!K)throw new Error("The amount of data is too big to be stored in a QR Code");if(!A)A=K;else if(A<K)throw new Error(`
|
|
85
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
86
|
+
Minimum version required to store current data is: `+K+`.
|
|
87
|
+
`);const H=W(A,P,O),B=e.getSymbolSize(A),D=new n(B);return g(D,A),C(D),b(D,A),j(D,P,0),A>=7&&E(D,A),T(D,H),isNaN(z)&&(z=h.getBestMask(D,j.bind(null,D,P))),h.applyMask(z,D),j(D,P,z),{modules:D,version:A,errorCorrectionLevel:P,maskPattern:z,segments:O}}return jc.create=function(A,P){if(typeof A>"u"||A==="")throw new Error("No input text");let z=t.M,O,K;return typeof P<"u"&&(z=t.from(P.errorCorrectionLevel,t.M),O=p.from(P.version),K=h.from(P.maskPattern),P.toSJISFunc&&e.setToSJISFunction(P.toSJISFunc)),J(A,O,z,K)},jc}var th={},ih={},Um;function bg(){return Um||(Um=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(l){return[l,l]}))),n.length===6&&n.push("F","F");const a=parseInt(n.join(""),16);return{r:a>>24&255,g:a>>16&255,b:a>>8&255,a:a&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const a=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,l=n.width&&n.width>=21?n.width:void 0,h=n.scale||4;return{width:l,scale:l?4:h,margin:a,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,a){return a.width&&a.width>=n+a.margin*2?a.width/(n+a.margin*2):a.scale},e.getImageWidth=function(n,a){const l=e.getScale(n,a);return Math.floor((n+a.margin*2)*l)},e.qrToImageData=function(n,a,l){const h=a.modules.size,d=a.modules.data,m=e.getScale(h,l),p=Math.floor((h+l.margin*2)*m),v=l.margin*m,y=[l.color.light,l.color.dark];for(let S=0;S<p;S++)for(let g=0;g<p;g++){let C=(S*p+g)*4,b=l.color.light;if(S>=v&&g>=v&&S<p-v&&g<p-v){const E=Math.floor((S-v)/m),j=Math.floor((g-v)/m);b=y[d[E*h+j]?1:0]}n[C++]=b.r,n[C++]=b.g,n[C++]=b.b,n[C]=b.a}}})(ih)),ih}var Km;function _C(){return Km||(Km=1,(function(e){const t=bg();function r(a,l,h){a.clearRect(0,0,l.width,l.height),l.style||(l.style={}),l.height=h,l.width=h,l.style.height=h+"px",l.style.width=h+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(l,h,d){let m=d,p=h;typeof m>"u"&&(!h||!h.getContext)&&(m=h,h=void 0),h||(p=n()),m=t.getOptions(m);const v=t.getImageWidth(l.modules.size,m),y=p.getContext("2d"),S=y.createImageData(v,v);return t.qrToImageData(S.data,l,m),r(y,p,v),y.putImageData(S,0,0),p},e.renderToDataURL=function(l,h,d){let m=d;typeof m>"u"&&(!h||!h.getContext)&&(m=h,h=void 0),m||(m={});const p=e.render(l,h,m),v=m.type||"image/png",y=m.rendererOpts||{};return p.toDataURL(v,y.quality)}})(th)),th}var rh={},Vm;function gC(){if(Vm)return rh;Vm=1;const e=bg();function t(a,l){const h=a.a/255,d=l+'="'+a.hex+'"';return h<1?d+" "+l+'-opacity="'+h.toFixed(2).slice(1)+'"':d}function r(a,l,h){let d=a+l;return typeof h<"u"&&(d+=" "+h),d}function n(a,l,h){let d="",m=0,p=!1,v=0;for(let y=0;y<a.length;y++){const S=Math.floor(y%l),g=Math.floor(y/l);!S&&!p&&(p=!0),a[y]?(v++,y>0&&S>0&&a[y-1]||(d+=p?r("M",S+h,.5+g+h):r("m",m,0),m=0,p=!1),S+1<l&&a[y+1]||(d+=r("h",v),v=0)):m++}return d}return rh.render=function(l,h,d){const m=e.getOptions(h),p=l.modules.size,v=l.modules.data,y=p+m.margin*2,S=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+y+"v"+y+'H0z"/>':"",g="<path "+t(m.color.dark,"stroke")+' d="'+n(v,p,m.margin)+'"/>',C='viewBox="0 0 '+y+" "+y+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+C+' shape-rendering="crispEdges">'+S+g+`</svg>
|
|
88
|
+
`;return typeof d=="function"&&d(null,E),E},rh}var qm;function vC(){if(qm)return _s;qm=1;const e=J1(),t=mC(),r=_C(),n=gC();function a(l,h,d,m,p){const v=[].slice.call(arguments,1),y=v.length,S=typeof v[y-1]=="function";if(!S&&!e())throw new Error("Callback required as last argument");if(S){if(y<2)throw new Error("Too few arguments provided");y===2?(p=d,d=h,h=m=void 0):y===3&&(h.getContext&&typeof p>"u"?(p=m,m=void 0):(p=m,m=d,d=h,h=void 0))}else{if(y<1)throw new Error("Too few arguments provided");return y===1?(d=h,h=m=void 0):y===2&&!h.getContext&&(m=d,d=h,h=void 0),new Promise(function(g,C){try{const b=t.create(d,m);g(l(b,h,m))}catch(b){C(b)}})}try{const g=t.create(d,m);p(null,l(g,h,m))}catch(g){p(g)}}return _s.create=t.create,_s.toCanvas=a.bind(null,r.render),_s.toDataURL=a.bind(null,r.renderToDataURL),_s.toString=a.bind(null,function(l,h,d){return n.render(l,d)}),_s}var yC=vC();const SC=Jh(yC),wC="modulepreload",CC=function(e){return"/"+e},Ym={},bC=function(t,r,n){let a=Promise.resolve();if(r&&r.length>0){let h=function(p){return Promise.all(p.map(v=>Promise.resolve(v).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=h(r.map(p=>{if(p=CC(p),p in Ym)return;Ym[p]=!0;const v=p.endsWith(".css"),y=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${y}`))return;const S=document.createElement("link");if(S.rel=v?"stylesheet":wC,v||(S.as="script"),S.crossOrigin="",S.href=p,m&&S.setAttribute("nonce",m),document.head.appendChild(S),v)return new Promise((g,C)=>{S.addEventListener("load",g),S.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return a.then(h=>{for(const d of h||[])d.status==="rejected"&&l(d.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 h=!1;if(t.hidden&&(t.hidden=!1,h=!0),document.body.contains(t)||(document.body.appendChild(t),h=!0),n=t.parentElement,r.highlightScanRegion||r.highlightCodeOutline){if(a=!!r.overlay,this.$overlay=r.overlay||document.createElement("div"),l=this.$overlay.style,l.position="absolute",l.display="none",l.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!a&&r.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}n.insertBefore(this.$overlay,this.$video.nextSibling)}r.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let d=window.getComputedStyle(t);d.display==="none"&&(t.style.setProperty("display","block","important"),h=!0),d.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),h=!0),h&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),t.style.opacity="0",t.style.width="0",t.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),t.addEventListener("play",this._onPlay),t.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=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,h=!1){let d,m=!1;r&&("scanRegion"in r||"qrEngine"in r||"canvas"in r||"disallowCanvasResizing"in r||"alsoTryWithoutScanRegion"in r||"returnDetailedScanResult"in r)?(d=r.scanRegion,n=r.qrEngine,a=r.canvas,l=r.disallowCanvasResizing||!1,h=r.alsoTryWithoutScanRegion||!1,m=!0):console.warn(r||n||a||l||h?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),r=!!n;try{let p,v;[n,p]=await Promise.all([n||Le.createQrEngine(),Le._loadImage(t)]),[a,v]=Le._drawToCanvas(p,d,a,l);let y;if(n instanceof Worker){let S=n;r||Le._postWorkerMessageSync(S,"inversionMode","both"),y=await new Promise((g,C)=>{let b,E,j,T=-1;E=M=>{M.data.id===T&&(S.removeEventListener("message",E),S.removeEventListener("error",j),clearTimeout(b),M.data.data!==null?g({data:M.data.data,cornerPoints:Le._convertPoints(M.data.cornerPoints,d)}):C(Le.NO_QR_CODE_FOUND))},j=M=>{S.removeEventListener("message",E),S.removeEventListener("error",j),clearTimeout(b),C("Scanner error: "+(M?M.message||M:"Unknown Error"))},S.addEventListener("message",E),S.addEventListener("error",j),b=setTimeout(()=>j("timeout"),1e4);let W=v.getImageData(0,0,a.width,a.height);T=Le._postWorkerMessageSync(S,"decode",W,[W.data.buffer])})}else y=await Promise.race([new Promise((S,g)=>window.setTimeout(()=>g("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,d)}}catch(g){if(S=g.message||g,/not implemented|service unavailable/.test(S))return Le._disableBarcodeDetector=!0,Le.scanImage(t,{scanRegion:d,canvas:a,disallowCanvasResizing:l,alsoTryWithoutScanRegion:h});throw`Scanner error: ${S}`}})()]);return m?y:y.data}catch(p){if(!d||!h)throw p;let v=await Le.scanImage(t,{qrEngine:n,canvas:a,disallowCanvasResizing:l});return m?v:v.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=()=>bC(()=>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,h=t.offsetLeft,d=t.offsetTop,m=window.getComputedStyle(t),p=m.objectFit,v=r/n,y=a/l;switch(p){case"none":var S=r,g=n;break;case"fill":S=a,g=l;break;default:(p==="cover"?v>y:v<y)?(g=l,S=g*v):(S=a,g=S/v),p==="scale-down"&&(S=Math.min(S,r),g=Math.min(g,n))}var[C,b]=m.objectPosition.split(" ").map((j,T)=>{const W=parseFloat(j);return j.endsWith("%")?(T?l-g:a-S)*W/100:W});m=this._scanRegion.width||r,y=this._scanRegion.height||n,p=this._scanRegion.x||0;var E=this._scanRegion.y||0;v=this.$overlay.style,v.width=`${m/r*S}px`,v.height=`${y/n*g}px`,v.top=`${d+b+E/n*g}px`,n=/scaleX\(-1\)/.test(t.style.transform),v.left=`${h+(n?a-C-S:C)+(n?r-p-m:p)/r*S}px`,v.transform=t.style.transform}})}static _convertPoints(t,r){if(!r)return t;let n=r.x||0,a=r.y||0,l=r.width&&r.downScaledWidth?r.width/r.downScaledWidth:1;r=r.height&&r.downScaledHeight?r.height/r.downScaledHeight:1;for(let h of t)h.x=h.x*l+n,h.y=h.y*r+a;return t}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var t=Date.now()-this._lastScanTimestamp,r=1e3/this._maxScansPerSecond;t<r&&await new Promise(a=>setTimeout(a,r-t)),this._lastScanTimestamp=Date.now();try{var n=await 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}),h=this._getFacingMode(l)||(a.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:l,facingMode:h}}catch{}throw"Camera not found."}async _restartVideoStream(){let t=this._paused;await this.pause(!0)&&!t&&this._active&&await this.start()}static _stopVideoStream(t){for(let r of t.getTracks())r.stop(),t.removeTrack(r)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,r,n,a=!1){n=n||document.createElement("canvas");let l=r&&r.x?r.x:0,h=r&&r.y?r.y:0,d=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:d,r=r&&r.downScaledHeight?r.downScaledHeight:m,n.width!==a&&(n.width=a),n.height!==r&&(n.height=r)),r=n.getContext("2d",{alpha:!1}),r.imageSmoothingEnabled=!1,r.drawImage(t,l,h,d,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;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 kC(e,t){const r=!!(e&&e.status==="up");return{up:r,label:r?"tunnel-up":"tunnel-down",since:r?xC(e.since,t):null}}function _u(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&typeof Notification<"u"}function EC(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 NC(){if(!_u())return"unsupported";if(Notification.permission==="denied")return"denied";try{return await(await navigator.serviceWorker.ready).pushManager.getSubscription()?"subscribed":"idle"}catch{return"idle"}}async function RC(e){if(!_u())throw new Error("push-unsupported");if(await Notification.requestPermission()!=="granted")throw new Error("push-denied");const r=await vt("/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:EC(n)}),h=await vt("/api/push/subscribe",e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({subscription:l.toJSON()})});if(!h.ok){try{await l.unsubscribe()}catch{}const d=await h.json().catch(()=>({}));throw new Error(d.error||`HTTP ${h.status}`)}return!0}async function DC(e){if(!_u())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 vt("/api/push/subscribe",e,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:n})})}catch{}return!0}const MC=()=>({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:[]}),PC=(e="")=>({id:"",cwd:"",engine:e,boot:!1,model:"",prompt:""}),xg=e=>e==="claude"?"unsafe":"standard",qh=(e,t)=>e.find(r=>r.client===t.client&&r.provider===t.provider&&(r.credentialProfile||"")===(t.credentialProfile||"")),LC=(e,t)=>{var r;return((r=qh(e,t))==null?void 0:r.label)||`${t.client} · ${t.provider}`};function TC(e){var t,r,n,a,l,h,d,m,p,v,y,S,g,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)||xg((h=e.managed)==null?void 0:h.client),displayName:((d=e.managed)==null?void 0:d.displayName)||"",protocol:((m=e.managed)==null?void 0:m.protocol)||"",baseUrl:((p=e.managed)==null?void 0:p.baseUrl)||"",envKey:((v=e.managed)==null?void 0:v.envKey)||"",providerId:((y=e.managed)==null?void 0:y.providerId)||"nexuscrew-custom",modelOptions:e.availableModels||((S=e.managedInfo)==null?void 0:S.models)||[],promptMode:e.promptMode||"send-keys",promptFlag:e.promptFlag||"",modelFlag:((g=e.model)==null?void 0:g.flag)||"",modelValue:((C=e.model)==null?void 0:C.value)||"",envRows:(e.envKeys||[]).map(b=>({key:b,value:"",configured:!0,remove:!1}))}}function BC(e,t,r=[]){if(e.kind==="managed"){const a={client:e.client,provider:e.provider,model:e.managedModel||"",permissionPolicy:e.permissionPolicy||xg(e.client)};return e.credentialProfile&&(a.credentialProfile=e.credentialProfile),e.provider==="custom"&&Object.assign(a,{displayName:e.displayName,protocol:e.protocol,baseUrl:e.baseUrl,envKey:e.envKey,providerId:e.providerId}),{...t?{id:e.id}:{},label:e.label||LC(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 AC({token:e,readonly:t,targets:r=[]}){const[n,a]=I.useState({engines:[],cells:[],managedCatalog:[]}),[l,h]=I.useState({available:!1,capabilities:[]}),[d,m]=I.useState(null),[p,v]=I.useState(null),[y,S]=I.useState(!1),[g,C]=I.useState(""),[b,E]=I.useState(""),[j,T]=I.useState(""),[W,M]=I.useState(!1),J=j?j.split("/"):[],Y=I.useCallback(async()=>{try{const D=await wa(e,J);h(D);try{const X=await u_(e,J);M(!!X.readonlyDefault)}catch{M(!1)}if(D.provider==="builtin"&&(D.capabilities||[]).includes("definitions")){const X=await zy(e,J),ee=new Map((D.engines||[]).map(ie=>[ie.id,ie]));X.engines=(X.engines||[]).map(ie=>{var x;return{...ie,availableModels:((x=ee.get(ie.id))==null?void 0:x.models)||[]}}),a(X)}}catch(D){C(String(D.message||D))}},[e,j]);I.useEffect(()=>{Y();const D=setInterval(Y,5e3);return()=>clearInterval(D)},[Y]);const A=new Set((l.cells||[]).filter(D=>D.active).map(D=>D.cell)),P=l.provider==="builtin"&&(l.capabilities||[]).includes("edit"),z=async D=>{S(!0),C(""),E("");try{await D(),await Y()}catch(X){C(String(X.message||X))}S(!1)},O=()=>z(async()=>{const D=d.mode==="new",X=BC(d.form,D,n.managedCatalog||[]);!D&&d.form.kind==="custom"&&!d.form.modelFlag&&(X.model=null),!D&&d.form.kind==="custom"&&d.form.promptMode!=="flag"&&(X.promptFlag=null);let ee;if(D)ee=await Fy(e,X,J);else{const x=d.original,Q=new Set(d.form.envRows.filter($=>!$.remove).map($=>$.key)),q=(x.envKeys||[]).filter($=>!Q.has($)),R=Object.fromEntries(d.form.envRows.filter($=>!$.remove&&$.key&&(!$.configured||$.value!=="")).map($=>[$.key,$.value]));ee=await Hy(e,x.id,X,d.form.kind==="custom"?{set:R,remove:q}:void 0,J)}m(null),E(k("fleet-saved"));const ie=(ee==null?void 0:ee.activeCells)||[];if(ie.length&&window.confirm(k("fleet-restart-confirm").replace("{cells}",ie.join(", "))))for(const x of ie)await fp(e,x,J)}),K=()=>z(async()=>{const D=p.mode==="new",X=p.form,ee={...D?{id:X.id}:{},cwd:X.cwd,engine:X.engine,boot:!!X.boot};D?(X.model&&(ee.model=X.model),X.prompt&&(ee.prompt=X.prompt)):(ee.model=X.model||null,ee.prompt=X.prompt||null);const ie=D?await $y(e,ee,J):await Uy(e,p.original.id,ee,J),x=D?X.id:p.original.id;v(null),E(k("fleet-saved")),!D&&(ie!=null&&ie.active)&&window.confirm(k("fleet-restart-confirm").replace("{cells}",x))&&await fp(e,x,J)}),H=t||W,B=f.jsxs("label",{className:"nc-field",children:[k("location"),f.jsxs("select",{value:j,onChange:D=>{T(D.target.value),m(null),v(null),C(""),E(""),M(!1),h({available:!1,capabilities:[]}),a({engines:[],cells:[],managedCatalog:[]})},children:[f.jsx("option",{value:"",children:k("local")}),r.map(D=>f.jsx("option",{value:D.route.join("/"),children:D.label},D.route.join("/")))]})]});return P?f.jsxs("div",{className:"nc-set-tab nc-fleet-editor",children:[B,f.jsxs("div",{className:"nc-fleet-section-head",children:[f.jsx("b",{children:k("fleet-engines")}),f.jsxs("button",{className:"nc-btn primary",disabled:H||y,onClick:()=>m({mode:"new",form:MC()}),children:["+ ",k("add")]})]}),n.engines.map(D=>{var X,ee;return f.jsxs("div",{className:"nc-fleet-item",children:[f.jsxs("span",{children:[f.jsx("b",{children:D.label}),f.jsx("small",{children:D.managed?`${D.id} · ${D.managed.client} / ${D.managed.provider} · ${(X=D.managedInfo)!=null&&X.configured?k("fleet-ready"):((ee=D.managedInfo)==null?void 0:ee.reason)||k("fleet-not-ready")}`:`${D.id} · ${D.command}`})]}),f.jsxs("span",{children:[f.jsx("button",{className:"nc-btn ghost",disabled:H||y,onClick:()=>m({mode:"edit",original:D,form:TC(D)}),children:k("edit")}),f.jsx("button",{className:"nc-btn danger",disabled:H||y,onClick:()=>z(async()=>{window.confirm(k("fleet-remove-engine").replace("{id}",D.id))&&await Wy(e,D.id,J)}),children:"×"})]})]},D.id)}),d&&f.jsx(jC,{state:d,setState:m,busy:y,onSave:O,catalog:n.managedCatalog||[]}),f.jsxs("div",{className:"nc-fleet-section-head",children:[f.jsx("b",{children:k("fleet-cells")}),f.jsxs("button",{className:"nc-btn primary",disabled:H||y||!n.engines.length,onClick:()=>{var D;return v({mode:"new",form:PC((D=n.engines[0])==null?void 0:D.id)})},children:["+ ",k("add")]})]}),n.cells.map(D=>f.jsxs("div",{className:"nc-fleet-item",children:[f.jsxs("span",{children:[f.jsx("b",{children:D.id}),f.jsxs("small",{children:[D.engine," · ",D.cwd,A.has(D.id)?` · ${k("service-active")}`:""]})]}),f.jsxs("span",{children:[f.jsx("button",{className:"nc-btn ghost",disabled:H||y,onClick:()=>v({mode:"edit",original:D,form:{...D}}),children:k("edit")}),f.jsx("button",{className:"nc-btn danger",disabled:H||y,onClick:()=>z(async()=>{window.confirm(k("fleet-remove-cell").replace("{id}",D.id))&&await Ky(e,D.id,!0,J)}),children:"×"})]})]},D.id)),p&&f.jsx(IC,{token:e,route:J,state:p,setState:v,engines:n.engines,busy:y,onSave:K}),b&&f.jsx("div",{className:"nc-set-note",children:b}),g&&f.jsx("div",{className:"nc-err",children:g})]}):f.jsxs("div",{className:"nc-set-tab",children:[B,f.jsx("div",{className:"nc-set-info",children:k("fleet-editor-unavailable")}),g&&f.jsx("div",{className:"nc-err",children:g})]})}function jC({state:e,setState:t,busy:r,onSave:n,catalog:a}){var S;const l=e.form,h=g=>t({...e,form:{...l,...g}}),d=l.envRows||[],m=[...new Map(a.map(g=>[g.client,g.clientLabel||g.client])).entries()],p=a.filter(g=>g.client===l.client),v=qh(a,l),y=g=>{g&&h({client:g.client,provider:g.provider,credentialProfile:g.credentialProfile||"",managedModel:g.model||"",protocol:g.protocol||"",permissionPolicy:g.permissionPolicyDefault||"standard",rc:!!g.rc,displayName:g.custom?k("fleet-custom-provider-default"):"",baseUrl:g.custom?"":g.endpoint||"",envKey:"",providerId:"nexuscrew-custom",...e.mode==="new"?{id:g.id,label:""}:{}})};return f.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[f.jsx("b",{children:e.mode==="new"?k("fleet-new-engine"):`${k("edit")} ${l.id}`}),f.jsx("input",{value:l.id,disabled:e.mode!=="new",placeholder:"id",onChange:g=>h({id:g.target.value})}),f.jsx("input",{value:l.label,placeholder:k("label"),onChange:g=>h({label:g.target.value})}),f.jsxs("select",{value:l.kind,disabled:e.mode!=="new",onChange:g=>h({kind:g.target.value}),children:[f.jsx("option",{value:"managed",children:k("fleet-managed")}),f.jsx("option",{value:"custom",children:k("fleet-custom")})]}),l.kind==="managed"?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"nc-fleet-pair",children:[f.jsx("select",{value:l.client,disabled:e.mode!=="new",onChange:g=>y(a.find(C=>C.client===g.target.value&&C.default)||a.find(C=>C.client===g.target.value)),children:m.map(([g,C])=>f.jsx("option",{value:g,children:C},g))}),f.jsx("select",{value:((S=qh(a,l))==null?void 0:S.id)||"",disabled:e.mode!=="new",onChange:g=>y(a.find(C=>C.id===g.target.value)),children:p.map(g=>f.jsx("option",{value:g.id,children:g.label},g.id))})]}),f.jsx("input",{value:l.managedModel,list:"nc-managed-models",placeholder:k(v!=null&&v.requiresModel?"fleet-model-required":"fleet-model-default"),onChange:g=>h({managedModel:g.target.value})}),f.jsx("datalist",{id:"nc-managed-models",children:[...(v==null?void 0:v.models)||[],...l.modelOptions||[]].filter((g,C,b)=>g&&b.indexOf(g)===C).map(g=>f.jsx("option",{value:g},g))}),v!=null&&v.supportsUnsafe?f.jsxs("select",{value:l.permissionPolicy,onChange:g=>h({permissionPolicy:g.target.value}),children:[f.jsx("option",{value:"standard",children:k("fleet-standard-permissions")}),f.jsx("option",{value:"unsafe",children:k("fleet-unsafe-permissions")})]}):f.jsx("small",{children:k("fleet-standard-permissions")}),(v==null?void 0:v.supportsUnsafe)&&l.permissionPolicy==="unsafe"&&f.jsx("small",{className:"nc-err",children:k("fleet-unsafe-warning")}),l.provider==="custom"&&f.jsxs(f.Fragment,{children:[f.jsx("input",{value:l.displayName,placeholder:k("fleet-provider-display"),onChange:g=>h({displayName:g.target.value})}),f.jsx("input",{value:l.baseUrl,placeholder:"https://api.example.com/v1",onChange:g=>h({baseUrl:g.target.value})}),((v==null?void 0:v.protocols)||[]).length>1&&f.jsx("select",{value:l.protocol,onChange:g=>h({protocol:g.target.value}),children:v.protocols.map(g=>f.jsx("option",{value:g,children:g},g))}),f.jsxs("div",{className:"nc-fleet-pair",children:[f.jsx("input",{value:l.envKey,placeholder:k("fleet-api-key-env"),onChange:g=>h({envKey:g.target.value})}),f.jsx("input",{value:l.providerId,placeholder:k("fleet-provider-id"),onChange:g=>h({providerId:g.target.value})})]}),f.jsxs("small",{children:[l.protocol," · ",k("fleet-custom-secret-help")]})]}),f.jsx("small",{children:k("fleet-managed-help")})]}):f.jsxs(f.Fragment,{children:[f.jsx("input",{value:l.command,placeholder:k("command-path"),onChange:g=>h({command:g.target.value})}),f.jsx("textarea",{value:l.argsText,placeholder:k("args-lines"),onChange:g=>h({argsText:g.target.value})}),f.jsxs("label",{className:"nc-check",children:[f.jsx("input",{type:"checkbox",checked:l.rc,onChange:g=>h({rc:g.target.checked})})," remote control"]}),f.jsxs("select",{value:l.promptMode,onChange:g=>h({promptMode:g.target.value}),children:[f.jsx("option",{value:"send-keys",children:"send-keys"}),f.jsx("option",{value:"flag",children:"flag"})]}),l.promptMode==="flag"&&f.jsx("input",{value:l.promptFlag,placeholder:"prompt flag",onChange:g=>h({promptFlag:g.target.value})}),f.jsxs("div",{className:"nc-fleet-pair",children:[f.jsx("input",{value:l.modelFlag,placeholder:"model flag",onChange:g=>h({modelFlag:g.target.value})}),f.jsx("input",{value:l.modelValue,placeholder:"model default",onChange:g=>h({modelValue:g.target.value})})]}),f.jsx("small",{children:k("env-write-only")}),d.map((g,C)=>f.jsxs("div",{className:"nc-fleet-env",children:[f.jsx("input",{value:g.key,disabled:g.configured,placeholder:"ENV_KEY",onChange:b=>{const E=d.slice();E[C]={...g,key:b.target.value},h({envRows:E})}}),f.jsx("input",{type:"password",value:g.value,placeholder:g.configured?"•••••• (unchanged)":"value",onChange:b=>{const E=d.slice();E[C]={...g,value:b.target.value},h({envRows:E})}}),f.jsx("button",{className:"nc-btn danger",onClick:()=>h({envRows:d.filter((b,E)=>E!==C)}),children:"×"})]},`${g.key}-${C}`)),f.jsx("button",{className:"nc-btn ghost",onClick:()=>h({envRows:[...d,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:k("cancel")}),f.jsx("button",{className:"nc-btn primary",disabled:r||!l.id||l.kind==="custom"&&!l.command||l.kind==="managed"&&(v==null?void 0:v.requiresModel)&&!l.managedModel||l.kind==="managed"&&l.provider==="custom"&&(!l.displayName||!l.baseUrl||!l.envKey||!l.providerId),onClick:n,children:k("save")})]})]})}function IC({token:e,route:t,state:r,setState:n,engines:a,busy:l,onSave:h}){const[d,m]=I.useState(null),[p,v]=I.useState(""),y=r.form,S=E=>n({...r,form:{...y,...E}}),g=a.find(E=>E.id===y.engine),C=E=>{var T,W,M;const j=a.find(J=>J.id===E);S({engine:E,model:((T=y.models)==null?void 0:T[E])||((W=j==null?void 0:j.managed)==null?void 0:W.model)||((M=j==null?void 0:j.model)==null?void 0:M.value)||""})},b=async E=>{try{const j=await l_(e,E,t);m(j),S({cwd:j.path}),v("")}catch(j){v(String(j.message||j))}};return f.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[f.jsx("b",{children:r.mode==="new"?k("fleet-new-cell"):`${k("edit")} ${y.id}`}),f.jsx("input",{value:y.id,disabled:r.mode!=="new",placeholder:"id",onChange:E=>S({id:E.target.value})}),f.jsxs("div",{className:"nc-fleet-pair",children:[f.jsx("input",{value:y.cwd,placeholder:k("cwd"),onChange:E=>S({cwd:E.target.value})}),f.jsx("button",{className:"nc-btn ghost",onClick:()=>d?m(null):b(y.cwd),children:k("browse")})]}),d&&f.jsxs("div",{className:"nc-fs",children:[f.jsx("div",{className:"nc-fs-path",children:d.path}),f.jsxs("div",{className:"nc-fs-list",children:[d.parent&&f.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>b(d.parent),children:["↑ ",k("fs-parent")]}),(d.dirs||[]).map(E=>f.jsxs("button",{className:"nc-fs-item",onClick:()=>b(`${d.path.replace(/\/$/,"")}/${E}`),children:["📁 ",E]},E))]})]}),p&&f.jsx("div",{className:"nc-err",children:p}),f.jsx("select",{value:y.engine,onChange:E=>C(E.target.value),children:a.map(E=>f.jsx("option",{value:E.id,children:E.label},E.id))}),f.jsxs("label",{className:"nc-check",children:[f.jsx("input",{type:"checkbox",checked:!!y.boot,onChange:E=>S({boot:E.target.checked})})," boot"]}),f.jsx("input",{value:y.model||"",list:"nc-cell-models",placeholder:k("fleet-model-override"),onChange:E=>S({model:E.target.value})}),f.jsx("datalist",{id:"nc-cell-models",children:((g==null?void 0:g.availableModels)||[]).map(E=>f.jsx("option",{value:E},E))}),f.jsx("textarea",{value:y.prompt||"",placeholder:"prompt",onChange:E=>S({prompt:E.target.value})}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{className:"nc-btn ghost",onClick:()=>n(null),children:k("cancel")}),f.jsx("button",{className:"nc-btn primary",disabled:l||!y.id||!y.cwd||!y.engine,onClick:h,children:k("save")})]})]})}function OC({text:e}){const[t,r]=I.useState(!1),n=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return f.jsxs("div",{className:"nc-set-copyline",children:[f.jsx("code",{children:e}),f.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:n,children:[f.jsx(Ie,{name:"copy",size:14})," ",k(t?"copied":"copy")]})]})}function zC({value:e}){const[t,r]=I.useState("");return I.useEffect(()=>{let n=!0;return SC.toDataURL(e,{margin:1,width:220}).then(a=>{n&&r(a)}).catch(()=>{}),()=>{n=!1}},[e]),t?f.jsx("img",{src:t,width:"220",height:"220",alt:"NexusCrew pairing QR"}):null}function FC({token:e,nodes:t,readonly:r,refresh:n}){const[a,l]=I.useState(null),[h,d]=I.useState(null),[m,p]=I.useState({}),[v,y]=I.useState({name:"",ssh:"",pairingUrl:""}),[S,g]=I.useState(null),C=Date.now(),b=async(T,W)=>{l(null),d(`${T}:${W}`);try{const M=await eu(e,T,W);W==="test"&&p(J=>({...J,[T]:M})),await n()}catch(M){l(`${T}: ${String(M.message||M)}`)}d(null)},E=async T=>{if(window.confirm(k("node-remove-confirm").replace("{name}",T))){l(null),d(`${T}:remove`);try{await Qy(e,T),await n()}catch(W){l(`${T}: ${String(W.message||W)}`)}d(null)}},j=async()=>{if(l(null),!v.name||!v.ssh||!v.pairingUrl)return l(k("pairing-required"));d("add");try{await d_(e,v),y({name:"",ssh:"",pairingUrl:""}),await n()}catch(T){l(String(T.message||T))}d(null)};return f.jsxs("div",{className:"nc-set-tab",children:[(t||[]).length===0&&f.jsx("div",{className:"nc-empty",children:k("no-nodes")}),(t||[]).map(T=>{const W=kC(T.tunnel,C),M=m[T.name];return f.jsxs("div",{className:"nc-set-node",children:[f.jsxs("div",{className:"nc-set-node-head",children:[f.jsx("span",{className:`nc-dot ${W.up?"on":""}`}),f.jsx("b",{children:T.name}),f.jsxs("small",{children:[T.ssh,T.sshPort?`:${T.sshPort}`:""," · :",T.localPort,"→:",T.remotePort]}),f.jsxs("span",{className:`nc-set-tunnel${W.up?" up":""}`,children:[k(W.label),W.since?` · ${W.since}`:""]}),f.jsxs("select",{value:T.visibility||"network",disabled:r||!!h,onChange:async J=>{d(`${T.name}:visibility`);try{await pp(e,T.name,J.target.value),await n()}catch(Y){l(String(Y.message||Y))}d(null)},children:[f.jsx("option",{value:"network",children:k("visibility-network")}),f.jsx("option",{value:"relay-only",children:k("visibility-relay")}),f.jsx("option",{value:"selected",children:k("visibility-selected")})]})]}),T.visibility==="selected"&&f.jsx("div",{className:"nc-set-row",children:(t||[]).filter(J=>J.name!==T.name&&J.nodeId).map(J=>{const Y=(T.selected||[]).includes(J.nodeId);return f.jsxs("label",{className:"nc-check",children:[f.jsx("input",{type:"checkbox",checked:Y,disabled:r||!!h,onChange:async A=>{const P=A.target.checked?[...T.selected||[],J.nodeId]:(T.selected||[]).filter(z=>z!==J.nodeId);d(`${T.name}:visibility`);try{await pp(e,T.name,"selected",P),await n()}catch(z){l(String(z.message||z))}d(null)}})," ",J.name]},J.nodeId)})}),f.jsxs("div",{className:"nc-set-node-actions",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!h,onClick:()=>b(T.name,"test"),children:k("node-test")}),W.up?f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!h,onClick:()=>b(T.name,"down"),children:k("tunnel-stop")}):f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!h,onClick:()=>b(T.name,"up"),children:k("tunnel-start")}),f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!h,onClick:()=>b(T.name,"restart"),children:k("tunnel-restart")}),f.jsx("button",{type:"button",className:"nc-btn danger",disabled:r||!!h,title:k(r?"settings-readonly":"terminate"),onClick:()=>E(T.name),children:f.jsx(Ie,{name:"trash",size:14})})]}),M&&f.jsxs("div",{className:`nc-set-test${M.ok?" ok":" ko"}`,children:[M.result,M.detail?` — ${M.detail}`:""]})]},T.name)}),f.jsxs("div",{className:"nc-set-form",children:[f.jsx("div",{className:"nc-sheet-label",children:k("node-add")}),f.jsxs("label",{className:"nc-field",children:[k("node-name-label"),f.jsx("input",{placeholder:k("node-name-ph"),value:v.name,disabled:r,onChange:T=>y({...v,name:T.target.value})})]}),f.jsxs("label",{className:"nc-field",children:[k("node-ssh-label"),f.jsx("input",{placeholder:"my-relay",value:v.ssh,disabled:r,onChange:T=>y({...v,ssh:T.target.value})})]}),f.jsxs("label",{className:"nc-field",children:[k("pairing-link"),f.jsx("input",{placeholder:"http://127.0.0.1:…/#pair=…",value:v.pairingUrl,disabled:r,onChange:T=>y({...v,pairingUrl:T.target.value})}),f.jsx("input",{id:"nc-pair-scan",type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:async T=>{const W=T.target.files&&T.target.files[0];if(W){try{const M=await Le.scanImage(W);y(J=>({...J,pairingUrl:M}))}catch{l(k("pairing-qr-invalid"))}T.target.value=""}}}),f.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{var T;return(T=document.getElementById("nc-pair-scan"))==null?void 0:T.click()},children:k("scan-qr")})]}),f.jsx("div",{className:"nc-sheet-actions",children:f.jsx("button",{type:"button",className:"nc-btn primary",disabled:r||h==="add",title:r?k("settings-readonly"):"",onClick:j,children:k("add")})})]}),f.jsxs("div",{className:"nc-set-form",children:[f.jsx("div",{className:"nc-sheet-label",children:k("invite-node")}),f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||!!h,onClick:async()=>{d("invite");try{g(await Gy(e))}catch(T){l(String(T.message||T))}d(null)},children:k("create-pairing-link")}),S&&f.jsxs(f.Fragment,{children:[f.jsx(zC,{value:S.pairingUrl}),f.jsx(OC,{text:S.pairingUrl})]})]}),a&&f.jsx("div",{className:"nc-err",children:a})]})}function HC({token:e,readonly:t}){const[r,n]=I.useState("idle"),[a,l]=I.useState(!1),[h,d]=I.useState(null);I.useEffect(()=>{let p=!1;return NC().then(v=>{p||n(v)}),()=>{p=!0}},[]);const m=async()=>{d(null),l(!0);try{r==="subscribed"?(await DC(e),n("idle")):(await RC(e),n("subscribed"))}catch(p){const v=String(p.message||p);v==="push-denied"?(n("denied"),d(k("push-denied"))):v==="push-unsupported"?(n("unsupported"),d(k("push-unsupported"))):d(v)}l(!1)};return r==="unsupported"?f.jsx("div",{className:"nc-set-info",children:k("push-unsupported")}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"nc-set-row",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||a||r==="denied",title:t?k("settings-readonly"):"",onClick:m,children:k(r==="subscribed"?"push-disable":"push-enable")}),f.jsx("span",{className:"nc-set-info",children:k(r==="subscribed"?"push-on":r==="denied"?"push-denied":"push-off")})]}),h&&f.jsx("div",{className:"nc-err",children:h})]})}function WC({token:e,settings:t,readonly:r}){const[n,a]=I.useState(null),[l,h]=I.useState(null),[d,m]=I.useState(!1),[p,v]=I.useState(!1),y=async()=>{a(null),h(null),v(!0);try{const C=await Xy(e);h(C.note||"ok"),m(!1)}catch(C){a(String(C.message||C))}v(!1)},S=async()=>{a(null),h(null),v(!0);try{const C=await Jy(e);h(`${C.note||"ok"}${C.target?` (${C.target})`:""}`)}catch(C){a(String(C.message||C))}v(!1)},g=t&&t.service;return f.jsxs("div",{className:"nc-set-tab",children:[t&&f.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,f.jsx("br",{}),g&&g.installed?k("service-installed"):k("service-missing"),g&&g.installed?` · ${g.active?k("service-active"):k("service-inactive")}`:"",g?` · boot ${g.boot?"on":"off"}`:""]}),f.jsxs("div",{className:"nc-set-row",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||p,title:r?k("settings-readonly"):"",onClick:()=>{a(null),h(null),m(!0)},children:k("token-rotate")}),f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||p,title:r?k("settings-readonly"):"",onClick:S,children:k("service-regenerate")})]}),f.jsx(HC,{token:e,readonly:r}),d&&f.jsxs("div",{className:"nc-set-confirm",children:[f.jsx("div",{children:k("token-rotate-explain")}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:p,onClick:()=>m(!1),children:k("cancel")}),f.jsx("button",{type:"button",className:"nc-btn primary",disabled:p,onClick:y,children:k("confirm")})]})]}),l&&f.jsx("div",{className:"nc-set-note",children:l}),n&&f.jsx("div",{className:"nc-err",children:n})]})}function $C({token:e,onClose:t}){Wt();const[r,n]=I.useState("nodes"),[a,l]=I.useState(null),[h,d]=I.useState([]),[m,p]=I.useState(!1),[v,y]=I.useState(null),S=iu(e),g=I.useCallback(async()=>{try{const C=await c_(e);l(C),y(null)}catch(C){y(String(C.message||C))}try{const C=await h_(e);d(C.nodes||[])}catch(C){y(String(C.message||C))}},[e]);return I.useEffect(()=>{g();const C=setInterval(g,5e3);return()=>clearInterval(C)},[g]),I.useEffect(()=>{let C=!1;return vt("/api/config",e).then(b=>b.json()).then(b=>{C||p(!!b.readonlyDefault)}).catch(()=>{}),()=>{C=!0}},[e]),f.jsx("div",{className:"nc-set-overlay",onClick:t,children:f.jsxs("div",{className:"nc-set-panel",onClick:C=>C.stopPropagation(),children:[f.jsxs("div",{className:"nc-set-head",children:[f.jsx(Ie,{name:"gear",size:18}),f.jsx("b",{children:k("settings")}),f.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:k("close"),children:f.jsx(Ie,{name:"x",size:18})})]}),m&&f.jsx("div",{className:"nc-set-readonly",children:k("settings-readonly")}),v&&f.jsx("div",{className:"nc-err",children:v}),f.jsx("div",{className:"nc-set-tabs",children:["nodes","fleet","system"].map(C=>f.jsx("button",{type:"button",className:`nc-set-tabbtn${r===C?" on":""}`,onClick:()=>n(C),children:k(`tab-${C}`)},C))}),f.jsxs("div",{className:"nc-set-body",children:[r==="nodes"&&f.jsx(FC,{token:e,nodes:h,readonly:m,refresh:g}),r==="fleet"&&f.jsx(AC,{token:e,readonly:m,targets:S.filter(C=>C.status==="up").map(C=>({route:C.route,label:C.label||C.name}))}),r==="system"&&f.jsx(WC,{token:e,settings:a,readonly:m})]})]})})}function UC({token:e,onDone:t}){Wt();const[r,n]=I.useState("welcome"),[a,l]=I.useState({name:"",ssh:"",pairingUrl:""}),[h,d]=I.useState(!1),[m,p]=I.useState(null),v=async()=>{d(!0),p(null);try{await Yy(e,{wizardDone:!0}),t()}catch(S){p(String(S.message||S)),d(!1)}},y=async()=>{if(!a.name||!a.ssh||!a.pairingUrl)return p(k("pairing-required"));d(!0),p(null);try{await d_(e,a),n("done")}catch(S){p(String(S.message||S))}d(!1)};return f.jsx("div",{className:"nc-wiz-overlay",children:f.jsxs("div",{className:"nc-wiz",children:[f.jsxs("div",{className:"nc-wiz-head",children:[f.jsx("b",{children:k("wizard-title")}),f.jsx("small",{children:k("hydra-simple")})]}),r==="welcome"&&f.jsxs("div",{className:"nc-wiz-body",children:[f.jsx("div",{className:"nc-wiz-done",children:k("local-ready")}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{className:"nc-btn ghost",disabled:h,onClick:v,children:k("local-only")}),f.jsx("button",{className:"nc-btn primary",disabled:h,onClick:()=>n("pair"),children:k("add-node")})]})]}),r==="pair"&&f.jsxs("div",{className:"nc-wiz-body",children:[f.jsxs("label",{className:"nc-field",children:[k("node-name-label"),f.jsx("input",{value:a.name,onChange:S=>l({...a,name:S.target.value}),placeholder:"relay"})]}),f.jsxs("label",{className:"nc-field",children:[k("node-ssh-label"),f.jsx("input",{value:a.ssh,onChange:S=>l({...a,ssh:S.target.value}),placeholder:"my-relay"})]}),f.jsxs("label",{className:"nc-field",children:[k("pairing-link"),f.jsx("input",{value:a.pairingUrl,onChange:S=>l({...a,pairingUrl:S.target.value}),placeholder:"http://127.0.0.1:…/#pair=…"})]}),f.jsxs("div",{className:"nc-sheet-actions",children:[f.jsx("button",{className:"nc-btn ghost",disabled:h,onClick:()=>n("welcome"),children:k("back")}),f.jsx("button",{className:"nc-btn primary",disabled:h,onClick:y,children:k("connect")})]})]}),r==="done"&&f.jsxs("div",{className:"nc-wiz-body",children:[f.jsx("div",{className:"nc-wiz-done",children:k("node-connected")}),f.jsx("div",{className:"nc-sheet-actions",children:f.jsx("button",{className:"nc-btn primary",disabled:h,onClick:v,children:k("finish")})})]}),m&&f.jsx("div",{className:"nc-err",children:m})]})})}function KC(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 VC=6e3,qC=12e3;function YC({n:e,onClose:t}){return f.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[f.jsxs("div",{className:"nc-ntf-toast-txt",children:[f.jsx("b",{children:e.title}),e.body&&f.jsx("small",{children:e.body}),e.session&&f.jsx("span",{className:"nc-ntf-from",children:e.session})]}),f.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:k("close"),children:f.jsx(Ie,{name:"x",size:14})})]})}function XC({ask:e,token:t,onAnswered:r}){const[n,a]=I.useState(""),[l,h]=I.useState(!1),[d,m]=I.useState(null),p=async v=>{const y=String(v||"").trim();if(!(!y||l)){m(null),h(!0);try{await e0(t,e.id,y),r(e.id)}catch(S){m(String(S.message||S))}h(!1)}};return f.jsxs("div",{className:"nc-ask-card",children:[f.jsxs("div",{className:"nc-ask-head",children:[f.jsx("span",{className:"nc-ntf-from",children:e.session}),f.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),f.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&f.jsx("div",{className:"nc-ask-opts",children:e.options.map(v=>f.jsx("button",{type:"button",className:"nc-btn ghost",disabled:l,onClick:()=>p(v),children:v},v))}),f.jsxs("div",{className:"nc-ask-reply",children:[f.jsx("textarea",{rows:2,placeholder:k("ask-reply-ph"),value:n,disabled:l,onChange:v=>a(v.target.value)}),f.jsx("button",{type:"button",className:"nc-btn primary",disabled:l||!n.trim(),onClick:()=>p(n),children:k("send")})]}),d&&f.jsx("div",{className:"nc-err",children:d})]})}function GC({token:e}){Wt();const[t,r]=I.useState([]),[n,a]=I.useState([]),[l,h]=I.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),d=I.useRef(0),m=I.useCallback(y=>{r(S=>S.filter(g=>g.key!==y))},[]),p=I.useCallback(y=>{const S=`t${d.current+=1}`;r(g=>[...g.slice(-3),{...y,key:S}]),setTimeout(()=>m(S),y.urgency==="high"?qC:VC)},[m]);I.useEffect(()=>{if(!e)return;let y=!1;Zy(e).then(g=>{y||a(g.asks||[])}).catch(()=>{});const S=KC(e,g=>{g.type==="notify"?p(g):g.type==="ask"&&g.ask&&g.ask.id?a(C=>C.some(b=>b.id===g.ask.id)?C:[...C,g.ask]):g.type==="ask-answered"&&g.id&&a(C=>C.filter(b=>b.id!==g.id))});return()=>{y=!0,S()}},[e,p]);const v=y=>a(S=>S.filter(g=>g.id!==y));return f.jsxs(f.Fragment,{children:[t.length>0&&f.jsx("div",{className:"nc-ntf-toasts",children:t.map(y=>f.jsx(YC,{n:y,onClose:()=>m(y.key)},y.key))}),n.length>0&&!l&&f.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>h(!0),title:k("asks-title"),children:["? ",f.jsx("span",{className:"nc-ask-count",children:n.length})]}),n.length>0&&l&&f.jsxs("div",{className:"nc-ask-panel",children:[f.jsxs("div",{className:"nc-ask-panel-head",children:[f.jsx("b",{children:k("asks-title")}),f.jsx("span",{className:"nc-ask-count",children:n.length}),f.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>h(!1),title:k("close"),children:f.jsx(Ie,{name:"x",size:16})})]}),f.jsx("div",{className:"nc-ask-panel-body",children:n.map(y=>f.jsx(XC,{ask:y,token:e,onAnswered:v},y.id))})]})]})}const sh=e=>Fi(Br(e)).length===0;function QC(e,t,r,n){const[a,l]=I.useState([]),[h,d]=I.useState(!1),[m,p]=I.useState("idle"),[v,y]=I.useState(""),S=I.useRef([]),g=I.useRef(r),C=I.useRef(!1),b=I.useRef(!0);g.current=r,S.current=a;const E=I.useCallback((A,P=!0)=>{S.current=A,l(A);const z=A.find(O=>O.name===t);P&&z&&(b.current=!0,n(Br(z.layout)),G1(t,z.layout)),X1(A.map(O=>O.name))},[t,n]),j=I.useCallback(async()=>{let A=await wc(e);const P=A.decks.find(z=>z.name==="main");if(A.decks.length===1&&P&&P.revision===0&&sh(P.layout)){const z=Y1(),O=Br(Vh("main")||va());if(!sh(O)){const K=await Vo(e,"main",O,0);A.decks[0]=K}for(const K of z.filter(H=>H!=="main"))try{let H=await mp(e,K);const B=Br(Vh(K)||va());sh(B)||(H=await Vo(e,K,B,H.revision)),A.decks.push(H)}catch{}A=await wc(e)}E(A.decks,!0),d(!0),y("")},[e,E]);I.useEffect(()=>{e&&j().catch(A=>y(String(A.message||A)))},[j,e]);const T=I.useCallback(async()=>{if(!h)return;const A=S.current.find(P=>P.name===t);if(!A)return y(`deck inesistente: ${t}`);p("saving");try{const P=await Vo(e,t,Br(g.current),A.revision);E(S.current.map(z=>z.name===t?P:z),!1),C.current=!1,p("saved"),y(""),setTimeout(()=>p("idle"),1500)}catch(P){p("error"),y(String(P.message||P)),P.status===409&&P.data&&P.data.current&&E(S.current.map(z=>z.name===t?P.data.current:z),!1)}},[h,t,e,E]);I.useEffect(()=>{if(!h)return;if(b.current){b.current=!1;return}C.current=!0,p("saving");const A=setTimeout(T,650);return()=>clearTimeout(A)},[r,h,T]),I.useEffect(()=>{if(!h)return;const A=setInterval(async()=>{try{const P=await wc(e),z=S.current.find(H=>H.name===t),O=P.decks.find(H=>H.name===t),K=O&&(!z||O.revision>z.revision);E(P.decks,K&&!C.current)}catch{}},5e3);return()=>clearInterval(A)},[h,e,t,E]);const W=async A=>{const P=await mp(e,A);return E([...S.current,P],!1),P},M=async(A,P)=>{const z=S.current.find(K=>K.name===A);if(!z)throw new Error("deck inesistente");const O=await t0(e,A,P,z.revision);return E(S.current.map(K=>K.name===A?O:K),!1),O},J=async A=>{const P=S.current.find(z=>z.name===A);if(!P)throw new Error("deck inesistente");await i0(e,A,P.revision),E(S.current.filter(z=>z.name!==A),!1)},Y=async(A,P)=>{const z=S.current.find(K=>K.name===A);if(!z)throw new Error("deck inesistente");const O=await Vo(e,A,_g(Br(z.layout),P),z.revision);return E(S.current.map(K=>K.name===A?O:K),!1),O};return{decks:a.map(A=>A.name),records:a,ready:h,saveState:m,error:v,setError:y,saveNow:T,add:W,rename:M,remove:J,addTileTo:Y}}const JC="/sw.js",Yh="nc-sw-update";let Xh=null,Gh=!1,Qh=null,kg=Object.freeze({needed:!1,kind:null,version:""}),Eg=!1;function Ng(){typeof window<"u"&&window.dispatchEvent(new Event(Yh))}function Rg(){const e=Qh||(Gh?{kind:"reload",version:""}:null);kg=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function Xm(){return kg}function ZC(e){return typeof window>"u"?()=>{}:(window.addEventListener(Yh,e),()=>window.removeEventListener(Yh,e))}function gu(e){Gh!==e&&(Gh=e,Rg(),Ng())}function eb(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(Qh);Qh=n,Rg(),a||Ng()}function tb(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&gu(!0)})}function ib(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{Eg&&location.reload()}),navigator.serviceWorker.register(JC).then(e=>{Xh=e,e.waiting&&gu(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&tb(t)}),setInterval(()=>{e.update().catch(()=>{})},3600*1e3)}).catch(()=>{}))}function rb(){Eg=!0,gu(!1);const e=Xh&&Xh.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}const Dg=9,Mg=24,Pg="nc_side_w",Gm="nc_side_min",sb=240,Qm="(min-width:1024px) and (pointer:fine)";function nb(){const e=Number(localStorage.getItem(Pg));return e>=180&&e<=480?e:sb}function ob(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=Dg&&e<=Mg?e:13}function ab(){const t=location.hash.replace(/^#/,"").match(/(?:^|&)token=([^&]+)/);if(t){const r=decodeURIComponent(t[1]);try{history.replaceState(null,"",location.pathname+location.search)}catch{}try{localStorage.setItem("nc_token",r)}catch{}return r}return sessionStorage.getItem("nc_token")||localStorage.getItem("nc_token")||""}function lb(e){try{return Br(Vh(e))}catch{return va()}}function Jm(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 cb(){const[e,t]=I.useState(()=>window.matchMedia(Qm).matches);return I.useEffect(()=>{const r=window.matchMedia(Qm),n=a=>t(a.matches);return r.addEventListener("change",n),()=>r.removeEventListener("change",n)},[]),e}function Zm({session:e,node:t,token:r,readonly:n=!1,onBack:a}){Wt();const[l,h]=I.useState(!1),[d,m]=I.useState(()=>window.matchMedia("(pointer: coarse)").matches),[p,v]=I.useState(null),[y,S]=I.useState(ob),[g,C]=I.useState(""),b=P=>S(z=>{const O=Math.max(Dg,Math.min(Mg,z+P));return localStorage.setItem("nc_fontsize",String(O)),O}),E=I.useRef(()=>{}),j=I.useRef(()=>{}),T=I.useRef(!1),[W,M]=I.useState(!1),[J,Y]=I.useState(!1),A=()=>{T.current=!T.current,M(T.current)};return I.useEffect(()=>{let P=!0;const z=t?`/api/route/${t.split("/").map(encodeURIComponent).join("/")}/_`:"/api";async function O(){let H=null,B=null;try{const ee=await(await vt(`${z}/sessions`,r)).json();Array.isArray(ee.sessions)&&(H=ee.sessions.find(ie=>ie.name===e))}catch{}if(!t)try{const X=await wa(r);X.available&&Array.isArray(X.cells)&&(B=X.cells.find(ee=>ee.tmuxSession===e))}catch{}if(!P)return;let D="";B?D=`${B.engine}${B.key?`·${B.key}`:""}`:H&&(D=H.attached?`attached · ${Jm(H.activity)}`:H.activity?Jm(H.activity):""),C(D)}O();const K=setInterval(O,4e3);return()=>{P=!1,clearInterval(K)}},[e,t,r]),f.jsxs("div",{className:"nc-app",children:[f.jsxs("header",{className:"nc-bar nc-bar-single",children:[f.jsxs("button",{onClick:a,title:k("sessions"),children:[f.jsx(Ie,{name:"chevronLeft",size:18}),f.jsx("span",{className:"nc-bar-label",children:k("sessions")})]}),f.jsxs("span",{className:"nc-bar-center",children:[f.jsx("b",{children:t?`${t}:${e}`:e}),g&&f.jsx("small",{className:"nc-bar-sub",children:g})]}),f.jsxs("span",{className:"nc-bar-right",children:[f.jsx("button",{onClick:()=>b(-1),title:k("zoom-out"),children:f.jsx(Ie,{name:"zoomOut",size:18})}),f.jsx("button",{onClick:()=>b(1),title:k("zoom-in"),children:f.jsx(Ie,{name:"zoomIn",size:18})}),f.jsx("button",{onClick:()=>m(P=>!P),title:k("composer"),children:f.jsx(Ie,{name:"keyboard",size:20})}),f.jsx("button",{onClick:()=>h(P=>!P),title:k("files"),children:f.jsx(Ie,{name:"folder",size:20})})]})]}),f.jsx("div",{className:"nc-termwrap",children:f.jsx(ug,{session:e,node:t,token:r,readonly:n,takeSize:!0,sendRef:E,actionRef:j,ctrlRef:T,setCtrlArmed:M,onFiles:v,fontSize:y,selectionMode:J,onSelectionModeChange:Y})}),f.jsx(N1,{onKeyboard:()=>m(P=>!P),send:P=>E.current(P),action:P=>j.current(P),ctrlArmed:W,onCtrl:A,selectionMode:J,onSelectionMode:Y}),d&&f.jsx(fg,{send:P=>E.current(P),token:r,session:e,node:t}),l&&f.jsx(dg,{session:e,node:t,token:r,filesEvent:p,onClose:()=>h(!1)})]})}function hb(){Wt();const[e,t]=I.useState(ab()),[r,n]=I.useState(!1),a=cb(),[l]=I.useState(()=>q1(typeof location<"u"?location.pathname:"/")),h=l===Xt,[d,m]=I.useState(null),p=he=>m(ga(he)),[v,y]=I.useState([]),[S,g]=I.useState([]),[C,b]=I.useState([]),[E,j]=I.useState(()=>lb(l)),T=QC(e,l,E,j),W=T.decks.length?T.decks:[Xt],[M,J]=I.useState(null),[Y,A]=I.useState(null),P=he=>A(ga(he)),z=iu(e,a),[O,K]=I.useState(null),[H,B]=I.useState(!1),[D,X]=I.useState(!1),[ee,ie]=I.useState(["shell","claude","codex-vl","pi"]),[x,Q]=I.useState(nb),[q,R]=I.useState(!h),[$,ce]=I.useState(()=>h?localStorage.getItem(Gm)==="1":!0),[ue,pe]=I.useState(!1),[ye,Se]=I.useState(!1),[Ce,ke]=I.useState(!1);I.useEffect(()=>{try{localStorage.setItem(Pg,String(x))}catch{}},[x]),I.useEffect(()=>{try{localStorage.setItem(Gm,$?"1":"")}catch{}},[$]),I.useEffect(()=>{if(!e)return;let he=!1;return Promise.all([c_(e),vt("/api/config",e).then(Re=>Re.json())]).then(([Re,ai])=>{he||(ke(!!ai.readonlyDefault),Re.firstRun===!0&&!ai.readonlyDefault&&Se(!0))}).catch(()=>{}),()=>{he=!0}},[e]);const Te=I.useCallback(async()=>{try{const Re=await(await vt("/api/sessions",e)).json();Re.error||y(Re.sessions||[])}catch{}try{const he=await wa(e);g(he.available?he.cells||[]:[]),b(he.available?he.engines||[]:[])}catch{g([]),b([])}},[e]);I.useEffect(()=>{if(!a)return;Te();const he=setInterval(Te,4e3);return()=>clearInterval(he)},[a,Te]),I.useEffect(()=>{let he=!1;return vt("/api/config",e).then(Re=>Re.json()).then(Re=>{!he&&Array.isArray(Re.presets)&&Re.presets.length&&ie(Re.presets),he||eb(Re.version,Re.uiVersion,"0.8.3")}).catch(()=>{}),()=>{he=!0}},[e]);const U=new Set([...v.map(he=>he.name),...z.flatMap(he=>he.sessions.map(Re=>Re.key))]),oe=Fi(E),me=he=>j(Re=>_g(Re,he)),Ue=async(he,Re=[])=>{try{await a_(e,he,Re)}catch{return}const ai=Re.length?`${Re.join("/")}:${he}`:he;j(xs=>Sa(xs,ai)),Te()},oi=async he=>{if(!O)return;const{cell:Re}=O;he.action==="up"?await s_(e,{cell:Re,engine:he.engine,model:he.model||"",boot:!!he.boot}):await n_(e,{cell:Re,boot:!!he.boot}),Te()},_r=async(he,Re=[])=>{await o_(e,he,Re),Te()},Cs=async he=>{if(!(!(he!=null&&he.direct)||H)){B(!0);try{await eu(e,he.name,he.tunnelStatus==="up"?"down":"up")}finally{B(!1)}}},Bn=he=>{try{const Re=window.open(ea(he,e),"_blank");return Re&&(Re.opener=null),!!Re}catch{return!1}},Wr=he=>location.assign(ea(he,e)),gr=async he=>{await T.add(he),Wr(he)},$i=async(he,Re)=>{await T.rename(he,Re),he===l&&location.assign(ea(Re,e))},bs=async he=>{await T.remove(he),he===l&&location.assign(ea(Xt,e))},An=async(he,Re)=>{!Re||Re===l||(await T.addTileTo(Re,he),j(ai=>Sa(ai,he)))};if(!e)return f.jsxs("div",{className:"nc-auth",children:[f.jsx("p",{children:k("auth-prompt")}),f.jsx("input",{onChange:he=>t(he.target.value.trim()),placeholder:"token"}),f.jsxs("label",{children:[f.jsx("input",{type:"checkbox",checked:r,onChange:he=>n(he.target.checked)})," ",k("remember-device")]}),f.jsx("button",{onClick:()=>{(r?localStorage:sessionStorage).setItem("nc_token",e)},children:"ok"})]});const $r=f.jsxs(f.Fragment,{children:[ue&&f.jsx($C,{token:e,onClose:()=>pe(!1)}),ye&&f.jsx(UC,{token:e,onDone:()=>Se(!1)}),f.jsx(GC,{token:e})]});if(!a)return d?f.jsxs(f.Fragment,{children:[f.jsx(Zm,{session:d.session,node:d.node,token:e,readonly:Ce,onBack:()=>m(null)}),$r]}):f.jsxs(f.Fragment,{children:[f.jsx(u0,{onPick:p,token:e,onSettings:()=>pe(!0)}),$r]});const jn=h||!q;return f.jsxs("div",{className:"nc-workspace",children:[!h&&f.jsx("button",{className:"nc-side-show",title:k("toggle-sidebar"),onClick:()=>R(he=>!he),children:"☰"}),jn&&f.jsx(T1,{sessions:v,cells:S,activeSessions:oe,nodeGroups:z,onPick:P,onAddTile:me,onPower:K,onNodePower:Cs,onKill:Ue,onNew:()=>X(!0),onSettings:()=>pe(!0),width:x,collapsed:$,onResize:Q,onToggleCollapse:()=>ce(he=>!he)}),f.jsxs("div",{className:"nc-workspace-main",children:[f.jsx(Q1,{decks:W,currentDeck:l,onCreate:gr,onRename:$i,onDelete:bs,onOpenWindow:Bn,onNavigate:Wr,saveState:T.saveState,error:T.error}),f.jsx($1,{layout:E,onLayoutChange:j,token:e,readonly:Ce,sessionsAlive:U,focusSession:M,onFocus:J,onOpenSingle:P,decks:W,currentDeck:l,onSendToDeck:An})]}),Y&&f.jsx("div",{className:"nc-single-overlay",children:f.jsx(Zm,{session:Y.session,node:Y.node,token:e,readonly:Ce,onBack:()=>A(null)})}),O&&f.jsx(y_,{cell:O,engines:C,onConfirm:oi,onClose:()=>K(null)}),D&&f.jsx(S_,{presets:ee,targets:z.filter(he=>he.status==="up").map(he=>({route:he.route,label:he.label||he.name})),token:e,onCreate:_r,onClose:()=>X(!1)}),$r]})}function ub(){Wt();const e=I.useSyncExternalStore(ZC,Xm,Xm);if(!e.needed)return null;const t=e.kind==="install"?k("install-version-mismatch").replace("{v}",e.version):k("update-available").replace("{v}",e.version).replace(" "," ").trim();return f.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[f.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&f.jsx("button",{className:"nc-update-btn",onClick:rb,children:k("reload")})]})}ib();Oy.createRoot(document.getElementById("root")).render(f.jsxs(Py.StrictMode,{children:[f.jsx(hb,{}),f.jsx(ub,{})]}));
|