@adhdev/daemon-standalone 0.5.25 → 0.5.27
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.
|
@@ -6,7 +6,7 @@ var pb=Object.defineProperty;var mb=(e,t,r)=>t in e?pb(e,t,{enumerable:!0,config
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ol=Symbol.for("react.element"),_b=Symbol.for("react.portal"),vb=Symbol.for("react.fragment"),xb=Symbol.for("react.strict_mode"),yb=Symbol.for("react.profiler"),bb=Symbol.for("react.provider"),wb=Symbol.for("react.context"),Sb=Symbol.for("react.forward_ref"),kb=Symbol.for("react.suspense"),Cb=Symbol.for("react.memo"),Eb=Symbol.for("react.lazy"),
|
|
9
|
+
*/var ol=Symbol.for("react.element"),_b=Symbol.for("react.portal"),vb=Symbol.for("react.fragment"),xb=Symbol.for("react.strict_mode"),yb=Symbol.for("react.profiler"),bb=Symbol.for("react.provider"),wb=Symbol.for("react.context"),Sb=Symbol.for("react.forward_ref"),kb=Symbol.for("react.suspense"),Cb=Symbol.for("react.memo"),Eb=Symbol.for("react.lazy"),Pp=Symbol.iterator;function Nb(e){return e===null||typeof e!="object"?null:(e=Pp&&e[Pp]||e["@@iterator"],typeof e=="function"?e:null)}var uv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},hv=Object.assign,dv={};function Ds(e,t,r){this.props=e,this.context=t,this.refs=dv,this.updater=r||uv}Ds.prototype.isReactComponent={};Ds.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ds.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function fv(){}fv.prototype=Ds.prototype;function $d(e,t,r){this.props=e,this.context=t,this.refs=dv,this.updater=r||uv}var Fd=$d.prototype=new fv;Fd.constructor=$d;hv(Fd,Ds.prototype);Fd.isPureReactComponent=!0;var Tp=Array.isArray,pv=Object.prototype.hasOwnProperty,Wd={current:null},mv={key:!0,ref:!0,__self:!0,__source:!0};function gv(e,t,r){var n,i={},s=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)pv.call(t,n)&&!mv.hasOwnProperty(n)&&(i[n]=t[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){for(var a=Array(l),c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}if(e&&e.defaultProps)for(n in l=e.defaultProps,l)i[n]===void 0&&(i[n]=l[n]);return{$$typeof:ol,type:e,key:s,ref:o,props:i,_owner:Wd.current}}function Pb(e,t){return{$$typeof:ol,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Hd(e){return typeof e=="object"&&e!==null&&e.$$typeof===ol}function Tb(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var Lp=/\/+/g;function jc(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Tb(""+e.key):t.toString(36)}function Gl(e,t,r,n,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case ol:case _b:o=!0}}if(o)return o=e,i=i(o),e=n===""?"."+jc(o,0):n,Tp(i)?(r="",e!=null&&(r=e.replace(Lp,"$&/")+"/"),Gl(i,t,r,"",function(c){return c})):i!=null&&(Hd(i)&&(i=Pb(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Lp,"$&/")+"/")+e)),t.push(i)),1;if(o=0,n=n===""?".":n+":",Tp(e))for(var l=0;l<e.length;l++){s=e[l];var a=n+jc(s,l);o+=Gl(s,t,r,a,i)}else if(a=Nb(e),typeof a=="function")for(e=a.call(e),l=0;!(s=e.next()).done;)s=s.value,a=n+jc(s,l++),o+=Gl(s,t,r,a,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function bl(e,t,r){if(e==null)return e;var n=[],i=0;return Gl(e,n,"","",function(s){return t.call(r,s,i++)}),n}function Lb(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ir={current:null},Ql={transition:null},Rb={ReactCurrentDispatcher:ir,ReactCurrentBatchConfig:Ql,ReactCurrentOwner:Wd};function _v(){throw Error("act(...) is not supported in production builds of React.")}Ue.Children={map:bl,forEach:function(e,t,r){bl(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return bl(e,function(){t++}),t},toArray:function(e){return bl(e,function(t){return t})||[]},only:function(e){if(!Hd(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ue.Component=Ds;Ue.Fragment=vb;Ue.Profiler=yb;Ue.PureComponent=$d;Ue.StrictMode=xb;Ue.Suspense=kb;Ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Rb;Ue.act=_v;Ue.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=hv({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Wd.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)pv.call(t,a)&&!mv.hasOwnProperty(a)&&(n[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)n.children=r;else if(1<a){l=Array(a);for(var c=0;c<a;c++)l[c]=arguments[c+2];n.children=l}return{$$typeof:ol,type:e.type,key:i,ref:s,props:n,_owner:o}};Ue.createContext=function(e){return e={$$typeof:wb,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:bb,_context:e},e.Consumer=e};Ue.createElement=gv;Ue.createFactory=function(e){var t=gv.bind(null,e);return t.type=e,t};Ue.createRef=function(){return{current:null}};Ue.forwardRef=function(e){return{$$typeof:Sb,render:e}};Ue.isValidElement=Hd;Ue.lazy=function(e){return{$$typeof:Eb,_payload:{_status:-1,_result:e},_init:Lb}};Ue.memo=function(e,t){return{$$typeof:Cb,type:e,compare:t===void 0?null:t}};Ue.startTransition=function(e){var t=Ql.transition;Ql.transition={};try{e()}finally{Ql.transition=t}};Ue.unstable_act=_v;Ue.useCallback=function(e,t){return ir.current.useCallback(e,t)};Ue.useContext=function(e){return ir.current.useContext(e)};Ue.useDebugValue=function(){};Ue.useDeferredValue=function(e){return ir.current.useDeferredValue(e)};Ue.useEffect=function(e,t){return ir.current.useEffect(e,t)};Ue.useId=function(){return ir.current.useId()};Ue.useImperativeHandle=function(e,t,r){return ir.current.useImperativeHandle(e,t,r)};Ue.useInsertionEffect=function(e,t){return ir.current.useInsertionEffect(e,t)};Ue.useLayoutEffect=function(e,t){return ir.current.useLayoutEffect(e,t)};Ue.useMemo=function(e,t){return ir.current.useMemo(e,t)};Ue.useReducer=function(e,t,r){return ir.current.useReducer(e,t,r)};Ue.useRef=function(e){return ir.current.useRef(e)};Ue.useState=function(e){return ir.current.useState(e)};Ue.useSyncExternalStore=function(e,t,r){return ir.current.useSyncExternalStore(e,t,r)};Ue.useTransition=function(){return ir.current.useTransition()};Ue.version="18.3.1";cv.exports=Ue;var b=cv.exports;const vv=zd(b),Mb=gb({__proto__:null,default:vv},[b]);/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.production.min.js
|
|
12
12
|
*
|
|
@@ -22,7 +22,7 @@ var pb=Object.defineProperty;var mb=(e,t,r)=>t in e?pb(e,t,{enumerable:!0,config
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(I,W){var y=I.length;I.push(W);e:for(;0<y;){var
|
|
25
|
+
*/(function(e){function t(I,W){var y=I.length;I.push(W);e:for(;0<y;){var J=y-1>>>1,ae=I[J];if(0<i(ae,W))I[J]=W,I[y]=ae,y=J;else break e}}function r(I){return I.length===0?null:I[0]}function n(I){if(I.length===0)return null;var W=I[0],y=I.pop();if(y!==W){I[0]=y;e:for(var J=0,ae=I.length,k=ae>>>1;J<k;){var we=2*(J+1)-1,U=I[we],Y=we+1,te=I[Y];if(0>i(U,y))Y<ae&&0>i(te,U)?(I[J]=te,I[Y]=y,J=Y):(I[J]=U,I[we]=y,J=we);else if(Y<ae&&0>i(te,y))I[J]=te,I[Y]=y,J=Y;else break e}}return W}function i(I,W){var y=I.sortIndex-W.sortIndex;return y!==0?y:I.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],c=[],d=1,h=null,f=3,p=!1,m=!1,g=!1,S=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,x=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(I){for(var W=r(c);W!==null;){if(W.callback===null)n(c);else if(W.startTime<=I)n(c),W.sortIndex=W.expirationTime,t(a,W);else break;W=r(c)}}function N(I){if(g=!1,w(I),!m)if(r(a)!==null)m=!0,D(L);else{var W=r(c);W!==null&&H(N,W.startTime-I)}}function L(I,W){m=!1,g&&(g=!1,_(P),P=-1),p=!0;var y=f;try{for(w(W),h=r(a);h!==null&&(!(h.expirationTime>W)||I&&!A());){var J=h.callback;if(typeof J=="function"){h.callback=null,f=h.priorityLevel;var ae=J(h.expirationTime<=W);W=e.unstable_now(),typeof ae=="function"?h.callback=ae:h===r(a)&&n(a),w(W)}else n(a);h=r(a)}if(h!==null)var k=!0;else{var we=r(c);we!==null&&H(N,we.startTime-W),k=!1}return k}finally{h=null,f=y,p=!1}}var C=!1,F=null,P=-1,q=5,E=-1;function A(){return!(e.unstable_now()-E<q)}function R(){if(F!==null){var I=e.unstable_now();E=I;var W=!0;try{W=F(!0,I)}finally{W?T():(C=!1,F=null)}}else C=!1}var T;if(typeof x=="function")T=function(){x(R)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,z=$.port2;$.port1.onmessage=R,T=function(){z.postMessage(null)}}else T=function(){S(R,0)};function D(I){F=I,C||(C=!0,T())}function H(I,W){P=S(function(){I(e.unstable_now())},W)}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(I){I.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,D(L))},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(a)},e.unstable_next=function(I){switch(f){case 1:case 2:case 3:var W=3;break;default:W=f}var y=f;f=W;try{return I()}finally{f=y}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,W){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var y=f;f=I;try{return W()}finally{f=y}},e.unstable_scheduleCallback=function(I,W,y){var J=e.unstable_now();switch(typeof y=="object"&&y!==null?(y=y.delay,y=typeof y=="number"&&0<y?J+y:J):y=J,I){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=y+ae,I={id:d++,callback:W,priorityLevel:I,startTime:y,expirationTime:ae,sortIndex:-1},y>J?(I.sortIndex=y,t(c,I),r(a)===null&&I===r(c)&&(g?(_(P),P=-1):g=!0,H(N,y-J))):(I.sortIndex=ae,t(a,I),m||p||(m=!0,D(L))),I},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(I){var W=f;return function(){var y=f;f=W;try{return I.apply(this,arguments)}finally{f=y}}}})(wv);bv.exports=wv;var zb=bv.exports;/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -30,14 +30,14 @@ var pb=Object.defineProperty;var mb=(e,t,r)=>t in e?pb(e,t,{enumerable:!0,config
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var $b=b,
|
|
33
|
+
*/var $b=b,Tr=zb;function ee(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Sv=new Set,Do={};function qi(e,t){Cs(e,t),Cs(e+"Capture",t)}function Cs(e,t){for(Do[e]=t,e=0;e<t.length;e++)Sv.add(t[e])}var Tn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=Object.prototype.hasOwnProperty,Fb=/^[: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]*$/,Rp={},Mp={};function Wb(e){return Ku.call(Mp,e)?!0:Ku.call(Rp,e)?!1:Fb.test(e)?Mp[e]=!0:(Rp[e]=!0,!1)}function Hb(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Ub(e,t,r,n){if(t===null||typeof t>"u"||Hb(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function sr(e,t,r,n,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Vt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Vt[e]=new sr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Vt[t]=new sr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Vt[e]=new sr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Vt[e]=new sr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Vt[e]=new sr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Vt[e]=new sr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Vt[e]=new sr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Vt[e]=new sr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Vt[e]=new sr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ud=/[\-:]([a-z])/g;function Vd(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ud,Vd);Vt[t]=new sr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ud,Vd);Vt[t]=new sr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ud,Vd);Vt[t]=new sr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Vt[e]=new sr(e,1,!1,e.toLowerCase(),null,!1,!1)});Vt.xlinkHref=new sr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Vt[e]=new sr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Kd(e,t,r,n){var i=Vt.hasOwnProperty(t)?Vt[t]:null;(i!==null?i.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Ub(t,r,i,n)&&(r=null),n||i===null?Wb(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):i.mustUseProperty?e[i.propertyName]=r===null?i.type===3?!1:"":r:(t=i.attributeName,n=i.attributeNamespace,r===null?e.removeAttribute(t):(i=i.type,r=i===3||i===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var Dn=$b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,wl=Symbol.for("react.element"),ss=Symbol.for("react.portal"),os=Symbol.for("react.fragment"),qd=Symbol.for("react.strict_mode"),qu=Symbol.for("react.profiler"),kv=Symbol.for("react.provider"),Cv=Symbol.for("react.context"),Yd=Symbol.for("react.forward_ref"),Yu=Symbol.for("react.suspense"),Xu=Symbol.for("react.suspense_list"),Xd=Symbol.for("react.memo"),Kn=Symbol.for("react.lazy"),Ev=Symbol.for("react.offscreen"),Ip=Symbol.iterator;function Us(e){return e===null||typeof e!="object"?null:(e=Ip&&e[Ip]||e["@@iterator"],typeof e=="function"?e:null)}var dt=Object.assign,Ac;function co(e){if(Ac===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Ac=t&&t[1]||""}return`
|
|
34
34
|
`+Ac+e}var Bc=!1;function Oc(e,t){if(!e||Bc)return"";Bc=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var n=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){n=c}e.call(t.prototype)}else{try{throw Error()}catch(c){n=c}e()}}catch(c){if(c&&n&&typeof c.stack=="string"){for(var i=c.stack.split(`
|
|
35
35
|
`),s=n.stack.split(`
|
|
36
36
|
`),o=i.length-1,l=s.length-1;1<=o&&0<=l&&i[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==s[l]){var a=`
|
|
37
|
-
`+i[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Bc=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?co(e):""}function Vb(e){switch(e.tag){case 5:return co(e.type);case 16:return co("Lazy");case 13:return co("Suspense");case 19:return co("SuspenseList");case 0:case 2:case 15:return e=Oc(e.type,!1),e;case 11:return e=Oc(e.type.render,!1),e;case 1:return e=Oc(e.type,!0),e;default:return""}}function Gu(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case os:return"Fragment";case ss:return"Portal";case qu:return"Profiler";case qd:return"StrictMode";case Yu:return"Suspense";case Xu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Cv:return(e.displayName||"Context")+".Consumer";case kv:return(e._context.displayName||"Context")+".Provider";case Yd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Xd:return t=e.displayName||null,t!==null?t:Gu(e.type)||"Memo";case Kn:t=e._payload,e=e._init;try{return Gu(e(t))}catch{}}return null}function Kb(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Gu(t);case 8:return t===qd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ui(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Nv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function qb(e){var t=Nv(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sl(e){e._valueTracker||(e._valueTracker=qb(e))}function Tv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Nv(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function ba(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Qu(e,t){var r=t.checked;return dt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Dp(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=ui(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Pv(e,t){t=t.checked,t!=null&&Kd(e,"checked",t,!1)}function Ju(e,t){Pv(e,t);var r=ui(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Zu(e,t.type,r):t.hasOwnProperty("defaultValue")&&Zu(e,t.type,ui(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function jp(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Zu(e,t,r){(t!=="number"||ba(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var uo=Array.isArray;function vs(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+ui(r),t=null,i=0;i<e.length;i++){if(e[i].value===r){e[i].selected=!0,n&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function eh(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ee(91));return dt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ap(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(ee(92));if(uo(r)){if(1<r.length)throw Error(ee(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:ui(r)}}function Lv(e,t){var r=ui(t.value),n=ui(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function Bp(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Rv(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function th(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Rv(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var kl,Mv=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,i){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(kl=kl||document.createElement("div"),kl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=kl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function jo(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var xo={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},Yb=["Webkit","ms","Moz","O"];Object.keys(xo).forEach(function(e){Yb.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xo[t]=xo[e]})});function Iv(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||xo.hasOwnProperty(e)&&xo[e]?(""+t).trim():t+"px"}function Dv(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=Iv(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var Xb=dt({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 rh(e,t){if(t){if(Xb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function nh(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ih=null;function Gd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sh=null,xs=null,ys=null;function Op(e){if(e=cl(e)){if(typeof sh!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=cc(t),sh(e.stateNode,e.type,t))}}function jv(e){xs?ys?ys.push(e):ys=[e]:xs=e}function Av(){if(xs){var e=xs,t=ys;if(ys=xs=null,Op(e),t)for(e=0;e<t.length;e++)Op(t[e])}}function Bv(e,t){return e(t)}function Ov(){}var zc=!1;function zv(e,t,r){if(zc)return e(t,r);zc=!0;try{return Bv(e,t,r)}finally{zc=!1,(xs!==null||ys!==null)&&(Ov(),Av())}}function Ao(e,t){var r=e.stateNode;if(r===null)return null;var n=cc(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(ee(231,t,typeof r));return r}var oh=!1;if(Pn)try{var Vs={};Object.defineProperty(Vs,"passive",{get:function(){oh=!0}}),window.addEventListener("test",Vs,Vs),window.removeEventListener("test",Vs,Vs)}catch{oh=!1}function Gb(e,t,r,n,i,s,o,l,a){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(d){this.onError(d)}}var yo=!1,wa=null,Sa=!1,lh=null,Qb={onError:function(e){yo=!0,wa=e}};function Jb(e,t,r,n,i,s,o,l,a){yo=!1,wa=null,Gb.apply(Qb,arguments)}function Zb(e,t,r,n,i,s,o,l,a){if(Jb.apply(this,arguments),yo){if(yo){var c=wa;yo=!1,wa=null}else throw Error(ee(198));Sa||(Sa=!0,lh=c)}}function Yi(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function $v(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function zp(e){if(Yi(e)!==e)throw Error(ee(188))}function ew(e){var t=e.alternate;if(!t){if(t=Yi(e),t===null)throw Error(ee(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(i===null)break;var s=i.alternate;if(s===null){if(n=i.return,n!==null){r=n;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===r)return zp(i),e;if(s===n)return zp(i),t;s=s.sibling}throw Error(ee(188))}if(r.return!==n.return)r=i,n=s;else{for(var o=!1,l=i.child;l;){if(l===r){o=!0,r=i,n=s;break}if(l===n){o=!0,n=i,r=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===r){o=!0,r=s,n=i;break}if(l===n){o=!0,n=s,r=i;break}l=l.sibling}if(!o)throw Error(ee(189))}}if(r.alternate!==n)throw Error(ee(190))}if(r.tag!==3)throw Error(ee(188));return r.stateNode.current===r?e:t}function Fv(e){return e=ew(e),e!==null?Wv(e):null}function Wv(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Wv(e);if(t!==null)return t;e=e.sibling}return null}var Hv=Pr.unstable_scheduleCallback,$p=Pr.unstable_cancelCallback,tw=Pr.unstable_shouldYield,rw=Pr.unstable_requestPaint,xt=Pr.unstable_now,nw=Pr.unstable_getCurrentPriorityLevel,Qd=Pr.unstable_ImmediatePriority,Uv=Pr.unstable_UserBlockingPriority,ka=Pr.unstable_NormalPriority,iw=Pr.unstable_LowPriority,Vv=Pr.unstable_IdlePriority,sc=null,dn=null;function sw(e){if(dn&&typeof dn.onCommitFiberRoot=="function")try{dn.onCommitFiberRoot(sc,e,void 0,(e.current.flags&128)===128)}catch{}}var Jr=Math.clz32?Math.clz32:aw,ow=Math.log,lw=Math.LN2;function aw(e){return e>>>=0,e===0?32:31-(ow(e)/lw|0)|0}var Cl=64,El=4194304;function ho(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ca(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~i;l!==0?n=ho(l):(s&=o,s!==0&&(n=ho(s)))}else o=r&~i,o!==0?n=ho(o):s!==0&&(n=ho(s));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-Jr(t),i=1<<r,n|=e[r],t&=~i;return n}function cw(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function uw(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Jr(s),l=1<<o,a=i[o];a===-1?(!(l&r)||l&n)&&(i[o]=cw(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function ah(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Kv(){var e=Cl;return Cl<<=1,!(Cl&4194240)&&(Cl=64),e}function $c(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function ll(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Jr(t),e[t]=r}function hw(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var i=31-Jr(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}function Jd(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Jr(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var Qe=0;function qv(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Yv,Zd,Xv,Gv,Qv,ch=!1,Nl=[],ti=null,ri=null,ni=null,Bo=new Map,Oo=new Map,Xn=[],dw="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 Fp(e,t){switch(e){case"focusin":case"focusout":ti=null;break;case"dragenter":case"dragleave":ri=null;break;case"mouseover":case"mouseout":ni=null;break;case"pointerover":case"pointerout":Bo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(t.pointerId)}}function Ks(e,t,r,n,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:s,targetContainers:[i]},t!==null&&(t=cl(t),t!==null&&Zd(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function fw(e,t,r,n,i){switch(t){case"focusin":return ti=Ks(ti,e,t,r,n,i),!0;case"dragenter":return ri=Ks(ri,e,t,r,n,i),!0;case"mouseover":return ni=Ks(ni,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return Bo.set(s,Ks(Bo.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,Oo.set(s,Ks(Oo.get(s)||null,e,t,r,n,i)),!0}return!1}function Jv(e){var t=Ri(e.target);if(t!==null){var r=Yi(t);if(r!==null){if(t=r.tag,t===13){if(t=$v(r),t!==null){e.blockedOn=t,Qv(e.priority,function(){Xv(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Jl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=uh(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);ih=n,r.target.dispatchEvent(n),ih=null}else return t=cl(r),t!==null&&Zd(t),e.blockedOn=r,!1;t.shift()}return!0}function Wp(e,t,r){Jl(e)&&r.delete(t)}function pw(){ch=!1,ti!==null&&Jl(ti)&&(ti=null),ri!==null&&Jl(ri)&&(ri=null),ni!==null&&Jl(ni)&&(ni=null),Bo.forEach(Wp),Oo.forEach(Wp)}function qs(e,t){e.blockedOn===t&&(e.blockedOn=null,ch||(ch=!0,Pr.unstable_scheduleCallback(Pr.unstable_NormalPriority,pw)))}function zo(e){function t(i){return qs(i,e)}if(0<Nl.length){qs(Nl[0],e);for(var r=1;r<Nl.length;r++){var n=Nl[r];n.blockedOn===e&&(n.blockedOn=null)}}for(ti!==null&&qs(ti,e),ri!==null&&qs(ri,e),ni!==null&&qs(ni,e),Bo.forEach(t),Oo.forEach(t),r=0;r<Xn.length;r++)n=Xn[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Xn.length&&(r=Xn[0],r.blockedOn===null);)Jv(r),r.blockedOn===null&&Xn.shift()}var bs=Dn.ReactCurrentBatchConfig,Ea=!0;function mw(e,t,r,n){var i=Qe,s=bs.transition;bs.transition=null;try{Qe=1,ef(e,t,r,n)}finally{Qe=i,bs.transition=s}}function gw(e,t,r,n){var i=Qe,s=bs.transition;bs.transition=null;try{Qe=4,ef(e,t,r,n)}finally{Qe=i,bs.transition=s}}function ef(e,t,r,n){if(Ea){var i=uh(e,t,r,n);if(i===null)Gc(e,t,n,Na,r),Fp(e,n);else if(fw(i,e,t,r,n))n.stopPropagation();else if(Fp(e,n),t&4&&-1<dw.indexOf(e)){for(;i!==null;){var s=cl(i);if(s!==null&&Yv(s),s=uh(e,t,r,n),s===null&&Gc(e,t,n,Na,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else Gc(e,t,n,null,r)}}var Na=null;function uh(e,t,r,n){if(Na=null,e=Gd(n),e=Ri(e),e!==null)if(t=Yi(e),t===null)e=null;else if(r=t.tag,r===13){if(e=$v(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Na=e,null}function Zv(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(nw()){case Qd:return 1;case Uv:return 4;case ka:case iw:return 16;case Vv:return 536870912;default:return 16}default:return 16}}var Qn=null,tf=null,Zl=null;function ex(){if(Zl)return Zl;var e,t=tf,r=t.length,n,i="value"in Qn?Qn.value:Qn.textContent,s=i.length;for(e=0;e<r&&t[e]===i[e];e++);var o=r-e;for(n=1;n<=o&&t[r-n]===i[s-n];n++);return Zl=i.slice(e,1<n?1-n:void 0)}function ea(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Tl(){return!0}function Hp(){return!1}function Rr(e){function t(r,n,i,s,o){this._reactName=r,this._targetInst=i,this.type=n,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Tl:Hp,this.isPropagationStopped=Hp,this}return dt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Tl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Tl)},persist:function(){},isPersistent:Tl}),t}var js={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rf=Rr(js),al=dt({},js,{view:0,detail:0}),_w=Rr(al),Fc,Wc,Ys,oc=dt({},al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ys&&(Ys&&e.type==="mousemove"?(Fc=e.screenX-Ys.screenX,Wc=e.screenY-Ys.screenY):Wc=Fc=0,Ys=e),Fc)},movementY:function(e){return"movementY"in e?e.movementY:Wc}}),Up=Rr(oc),vw=dt({},oc,{dataTransfer:0}),xw=Rr(vw),yw=dt({},al,{relatedTarget:0}),Hc=Rr(yw),bw=dt({},js,{animationName:0,elapsedTime:0,pseudoElement:0}),ww=Rr(bw),Sw=dt({},js,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kw=Rr(Sw),Cw=dt({},js,{data:0}),Vp=Rr(Cw),Ew={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nw={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"},Tw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Tw[e])?!!t[e]:!1}function nf(){return Pw}var Lw=dt({},al,{key:function(e){if(e.key){var t=Ew[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ea(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Nw[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nf,charCode:function(e){return e.type==="keypress"?ea(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ea(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Rw=Rr(Lw),Mw=dt({},oc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Kp=Rr(Mw),Iw=dt({},al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nf}),Dw=Rr(Iw),jw=dt({},js,{propertyName:0,elapsedTime:0,pseudoElement:0}),Aw=Rr(jw),Bw=dt({},oc,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ow=Rr(Bw),zw=[9,13,27,32],sf=Pn&&"CompositionEvent"in window,bo=null;Pn&&"documentMode"in document&&(bo=document.documentMode);var $w=Pn&&"TextEvent"in window&&!bo,tx=Pn&&(!sf||bo&&8<bo&&11>=bo),qp=" ",Yp=!1;function rx(e,t){switch(e){case"keyup":return zw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nx(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ls=!1;function Fw(e,t){switch(e){case"compositionend":return nx(t);case"keypress":return t.which!==32?null:(Yp=!0,qp);case"textInput":return e=t.data,e===qp&&Yp?null:e;default:return null}}function Ww(e,t){if(ls)return e==="compositionend"||!sf&&rx(e,t)?(e=ex(),Zl=tf=Qn=null,ls=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return tx&&t.locale!=="ko"?null:t.data;default:return null}}var Hw={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 Xp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Hw[e.type]:t==="textarea"}function ix(e,t,r,n){jv(n),t=Ta(t,"onChange"),0<t.length&&(r=new rf("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var wo=null,$o=null;function Uw(e){mx(e,0)}function lc(e){var t=us(e);if(Tv(t))return e}function Vw(e,t){if(e==="change")return t}var sx=!1;if(Pn){var Uc;if(Pn){var Vc="oninput"in document;if(!Vc){var Gp=document.createElement("div");Gp.setAttribute("oninput","return;"),Vc=typeof Gp.oninput=="function"}Uc=Vc}else Uc=!1;sx=Uc&&(!document.documentMode||9<document.documentMode)}function Qp(){wo&&(wo.detachEvent("onpropertychange",ox),$o=wo=null)}function ox(e){if(e.propertyName==="value"&&lc($o)){var t=[];ix(t,$o,e,Gd(e)),zv(Uw,t)}}function Kw(e,t,r){e==="focusin"?(Qp(),wo=t,$o=r,wo.attachEvent("onpropertychange",ox)):e==="focusout"&&Qp()}function qw(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return lc($o)}function Yw(e,t){if(e==="click")return lc(t)}function Xw(e,t){if(e==="input"||e==="change")return lc(t)}function Gw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rn=typeof Object.is=="function"?Object.is:Gw;function Fo(e,t){if(rn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var i=r[n];if(!Ku.call(t,i)||!rn(e[i],t[i]))return!1}return!0}function Jp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zp(e,t){var r=Jp(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Jp(r)}}function lx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?lx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ax(){for(var e=window,t=ba();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ba(e.document)}return t}function of(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Qw(e){var t=ax(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&lx(r.ownerDocument.documentElement,r)){if(n!==null&&of(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=Zp(r,s);var o=Zp(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Jw=Pn&&"documentMode"in document&&11>=document.documentMode,as=null,hh=null,So=null,dh=!1;function em(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;dh||as==null||as!==ba(n)||(n=as,"selectionStart"in n&&of(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),So&&Fo(So,n)||(So=n,n=Ta(hh,"onSelect"),0<n.length&&(t=new rf("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=as)))}function Pl(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var cs={animationend:Pl("Animation","AnimationEnd"),animationiteration:Pl("Animation","AnimationIteration"),animationstart:Pl("Animation","AnimationStart"),transitionend:Pl("Transition","TransitionEnd")},Kc={},cx={};Pn&&(cx=document.createElement("div").style,"AnimationEvent"in window||(delete cs.animationend.animation,delete cs.animationiteration.animation,delete cs.animationstart.animation),"TransitionEvent"in window||delete cs.transitionend.transition);function ac(e){if(Kc[e])return Kc[e];if(!cs[e])return e;var t=cs[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in cx)return Kc[e]=t[r];return e}var ux=ac("animationend"),hx=ac("animationiteration"),dx=ac("animationstart"),fx=ac("transitionend"),px=new Map,tm="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 di(e,t){px.set(e,t),qi(t,[e])}for(var qc=0;qc<tm.length;qc++){var Yc=tm[qc],Zw=Yc.toLowerCase(),eS=Yc[0].toUpperCase()+Yc.slice(1);di(Zw,"on"+eS)}di(ux,"onAnimationEnd");di(hx,"onAnimationIteration");di(dx,"onAnimationStart");di("dblclick","onDoubleClick");di("focusin","onFocus");di("focusout","onBlur");di(fx,"onTransitionEnd");Cs("onMouseEnter",["mouseout","mouseover"]);Cs("onMouseLeave",["mouseout","mouseover"]);Cs("onPointerEnter",["pointerout","pointerover"]);Cs("onPointerLeave",["pointerout","pointerover"]);qi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));qi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));qi("onBeforeInput",["compositionend","keypress","textInput","paste"]);qi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));qi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));qi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fo="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(" "),tS=new Set("cancel close invalid load scroll toggle".split(" ").concat(fo));function rm(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,Zb(n,t,void 0,e),e.currentTarget=null}function mx(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var s=void 0;if(t)for(var o=n.length-1;0<=o;o--){var l=n[o],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==s&&i.isPropagationStopped())break e;rm(i,l,c),s=a}else for(o=0;o<n.length;o++){if(l=n[o],a=l.instance,c=l.currentTarget,l=l.listener,a!==s&&i.isPropagationStopped())break e;rm(i,l,c),s=a}}}if(Sa)throw e=lh,Sa=!1,lh=null,e}function rt(e,t){var r=t[_h];r===void 0&&(r=t[_h]=new Set);var n=e+"__bubble";r.has(n)||(gx(t,e,2,!1),r.add(n))}function Xc(e,t,r){var n=0;t&&(n|=4),gx(r,e,n,t)}var Ll="_reactListening"+Math.random().toString(36).slice(2);function Wo(e){if(!e[Ll]){e[Ll]=!0,Sv.forEach(function(r){r!=="selectionchange"&&(tS.has(r)||Xc(r,!1,e),Xc(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ll]||(t[Ll]=!0,Xc("selectionchange",!1,t))}}function gx(e,t,r,n){switch(Zv(t)){case 1:var i=mw;break;case 4:i=gw;break;default:i=ef}r=i.bind(null,t,r,e),i=void 0,!oh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),n?i!==void 0?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):i!==void 0?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function Gc(e,t,r,n,i){var s=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=n.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===i||a.nodeType===8&&a.parentNode===i))return;o=o.return}for(;l!==null;){if(o=Ri(l),o===null)return;if(a=o.tag,a===5||a===6){n=s=o;continue e}l=l.parentNode}}n=n.return}zv(function(){var c=s,d=Gd(r),h=[];e:{var f=px.get(e);if(f!==void 0){var p=rf,m=e;switch(e){case"keypress":if(ea(r)===0)break e;case"keydown":case"keyup":p=Rw;break;case"focusin":m="focus",p=Hc;break;case"focusout":m="blur",p=Hc;break;case"beforeblur":case"afterblur":p=Hc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Up;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=xw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Dw;break;case ux:case hx:case dx:p=ww;break;case fx:p=Aw;break;case"scroll":p=_w;break;case"wheel":p=Ow;break;case"copy":case"cut":case"paste":p=kw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Kp}var g=(t&4)!==0,S=!g&&e==="scroll",_=g?f!==null?f+"Capture":null:f;g=[];for(var x=c,w;x!==null;){w=x;var N=w.stateNode;if(w.tag===5&&N!==null&&(w=N,_!==null&&(N=Ao(x,_),N!=null&&g.push(Ho(x,N,w)))),S)break;x=x.return}0<g.length&&(f=new p(f,m,null,r,d),h.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==ih&&(m=r.relatedTarget||r.fromElement)&&(Ri(m)||m[Ln]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=r.relatedTarget||r.toElement,p=c,m=m?Ri(m):null,m!==null&&(S=Yi(m),m!==S||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(g=Up,N="onMouseLeave",_="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(g=Kp,N="onPointerLeave",_="onPointerEnter",x="pointer"),S=p==null?f:us(p),w=m==null?f:us(m),f=new g(N,x+"leave",p,r,d),f.target=S,f.relatedTarget=w,N=null,Ri(d)===c&&(g=new g(_,x+"enter",m,r,d),g.target=w,g.relatedTarget=S,N=g),S=N,p&&m)t:{for(g=p,_=m,x=0,w=g;w;w=Zi(w))x++;for(w=0,N=_;N;N=Zi(N))w++;for(;0<x-w;)g=Zi(g),x--;for(;0<w-x;)_=Zi(_),w--;for(;x--;){if(g===_||_!==null&&g===_.alternate)break t;g=Zi(g),_=Zi(_)}g=null}else g=null;p!==null&&nm(h,f,p,g,!1),m!==null&&S!==null&&nm(h,S,m,g,!0)}}e:{if(f=c?us(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var L=Vw;else if(Xp(f))if(sx)L=Xw;else{L=qw;var C=Kw}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(L=Yw);if(L&&(L=L(e,c))){ix(h,L,r,d);break e}C&&C(e,f,c),e==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&Zu(f,"number",f.value)}switch(C=c?us(c):window,e){case"focusin":(Xp(C)||C.contentEditable==="true")&&(as=C,hh=c,So=null);break;case"focusout":So=hh=as=null;break;case"mousedown":dh=!0;break;case"contextmenu":case"mouseup":case"dragend":dh=!1,em(h,r,d);break;case"selectionchange":if(Jw)break;case"keydown":case"keyup":em(h,r,d)}var F;if(sf)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else ls?rx(e,r)&&(T="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(T="onCompositionStart");T&&(tx&&r.locale!=="ko"&&(ls||T!=="onCompositionStart"?T==="onCompositionEnd"&&ls&&(F=ex()):(Qn=d,tf="value"in Qn?Qn.value:Qn.textContent,ls=!0)),C=Ta(c,T),0<C.length&&(T=new Vp(T,e,null,r,d),h.push({event:T,listeners:C}),F?T.data=F:(F=nx(r),F!==null&&(T.data=F)))),(F=$w?Fw(e,r):Ww(e,r))&&(c=Ta(c,"onBeforeInput"),0<c.length&&(d=new Vp("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:c}),d.data=F))}mx(h,t)})}function Ho(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Ta(e,t){for(var r=t+"Capture",n=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Ao(e,r),s!=null&&n.unshift(Ho(e,s,i)),s=Ao(e,t),s!=null&&n.push(Ho(e,s,i))),e=e.return}return n}function Zi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function nm(e,t,r,n,i){for(var s=t._reactName,o=[];r!==null&&r!==n;){var l=r,a=l.alternate,c=l.stateNode;if(a!==null&&a===n)break;l.tag===5&&c!==null&&(l=c,i?(a=Ao(r,s),a!=null&&o.unshift(Ho(r,a,l))):i||(a=Ao(r,s),a!=null&&o.push(Ho(r,a,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var rS=/\r\n?/g,nS=/\u0000|\uFFFD/g;function im(e){return(typeof e=="string"?e:""+e).replace(rS,`
|
|
38
|
-
`).replace(nS,"")}function Rl(e,t,r){if(t=im(t),im(e)!==t&&r)throw Error(ee(425))}function Pa(){}var fh=null,ph=null;function mh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var gh=typeof setTimeout=="function"?setTimeout:void 0,iS=typeof clearTimeout=="function"?clearTimeout:void 0,sm=typeof Promise=="function"?Promise:void 0,sS=typeof queueMicrotask=="function"?queueMicrotask:typeof sm<"u"?function(e){return sm.resolve(null).then(e).catch(oS)}:gh;function oS(e){setTimeout(function(){throw e})}function Qc(e,t){var r=t,n=0;do{var i=r.nextSibling;if(e.removeChild(r),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(n===0){e.removeChild(i),zo(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);zo(t)}function ii(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function om(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var As=Math.random().toString(36).slice(2),un="__reactFiber$"+As,Uo="__reactProps$"+As,Ln="__reactContainer$"+As,_h="__reactEvents$"+As,lS="__reactListeners$"+As,aS="__reactHandles$"+As;function Ri(e){var t=e[un];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Ln]||r[un]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=om(e);e!==null;){if(r=e[un])return r;e=om(e)}return t}e=r,r=e.parentNode}return null}function cl(e){return e=e[un]||e[Ln],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function us(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ee(33))}function cc(e){return e[Uo]||null}var vh=[],hs=-1;function fi(e){return{current:e}}function it(e){0>hs||(e.current=vh[hs],vh[hs]=null,hs--)}function tt(e,t){hs++,vh[hs]=e.current,e.current=t}var hi={},Qt=fi(hi),mr=fi(!1),zi=hi;function Es(e,t){var r=e.type.contextTypes;if(!r)return hi;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function gr(e){return e=e.childContextTypes,e!=null}function La(){it(mr),it(Qt)}function lm(e,t,r){if(Qt.current!==hi)throw Error(ee(168));tt(Qt,t),tt(mr,r)}function _x(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(ee(108,Kb(e)||"Unknown",i));return dt({},r,n)}function Ra(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hi,zi=Qt.current,tt(Qt,e),tt(mr,mr.current),!0}function am(e,t,r){var n=e.stateNode;if(!n)throw Error(ee(169));r?(e=_x(e,t,zi),n.__reactInternalMemoizedMergedChildContext=e,it(mr),it(Qt),tt(Qt,e)):it(mr),tt(mr,r)}var wn=null,uc=!1,Jc=!1;function vx(e){wn===null?wn=[e]:wn.push(e)}function cS(e){uc=!0,vx(e)}function pi(){if(!Jc&&wn!==null){Jc=!0;var e=0,t=Qe;try{var r=wn;for(Qe=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}wn=null,uc=!1}catch(i){throw wn!==null&&(wn=wn.slice(e+1)),Hv(Qd,pi),i}finally{Qe=t,Jc=!1}}return null}var ds=[],fs=0,Ma=null,Ia=0,Or=[],zr=0,$i=null,Cn=1,En="";function Ei(e,t){ds[fs++]=Ia,ds[fs++]=Ma,Ma=e,Ia=t}function xx(e,t,r){Or[zr++]=Cn,Or[zr++]=En,Or[zr++]=$i,$i=e;var n=Cn;e=En;var i=32-Jr(n)-1;n&=~(1<<i),r+=1;var s=32-Jr(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,Cn=1<<32-Jr(t)+i|r<<i|n,En=s+e}else Cn=1<<s|r<<i|n,En=e}function lf(e){e.return!==null&&(Ei(e,1),xx(e,1,0))}function af(e){for(;e===Ma;)Ma=ds[--fs],ds[fs]=null,Ia=ds[--fs],ds[fs]=null;for(;e===$i;)$i=Or[--zr],Or[zr]=null,En=Or[--zr],Or[zr]=null,Cn=Or[--zr],Or[zr]=null}var Nr=null,Er=null,st=!1,Qr=null;function yx(e,t){var r=Fr(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function cm(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Nr=e,Er=ii(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Nr=e,Er=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=$i!==null?{id:Cn,overflow:En}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Fr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Nr=e,Er=null,!0):!1;default:return!1}}function xh(e){return(e.mode&1)!==0&&(e.flags&128)===0}function yh(e){if(st){var t=Er;if(t){var r=t;if(!cm(e,t)){if(xh(e))throw Error(ee(418));t=ii(r.nextSibling);var n=Nr;t&&cm(e,t)?yx(n,r):(e.flags=e.flags&-4097|2,st=!1,Nr=e)}}else{if(xh(e))throw Error(ee(418));e.flags=e.flags&-4097|2,st=!1,Nr=e}}}function um(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Nr=e}function Ml(e){if(e!==Nr)return!1;if(!st)return um(e),st=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!mh(e.type,e.memoizedProps)),t&&(t=Er)){if(xh(e))throw bx(),Error(ee(418));for(;t;)yx(e,t),t=ii(t.nextSibling)}if(um(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Er=ii(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Er=null}}else Er=Nr?ii(e.stateNode.nextSibling):null;return!0}function bx(){for(var e=Er;e;)e=ii(e.nextSibling)}function Ns(){Er=Nr=null,st=!1}function cf(e){Qr===null?Qr=[e]:Qr.push(e)}var uS=Dn.ReactCurrentBatchConfig;function Xs(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(ee(309));var n=r.stateNode}if(!n)throw Error(ee(147,e));var i=n,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(ee(284));if(!r._owner)throw Error(ee(290,e))}return e}function Il(e,t){throw e=Object.prototype.toString.call(t),Error(ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function hm(e){var t=e._init;return t(e._payload)}function wx(e){function t(_,x){if(e){var w=_.deletions;w===null?(_.deletions=[x],_.flags|=16):w.push(x)}}function r(_,x){if(!e)return null;for(;x!==null;)t(_,x),x=x.sibling;return null}function n(_,x){for(_=new Map;x!==null;)x.key!==null?_.set(x.key,x):_.set(x.index,x),x=x.sibling;return _}function i(_,x){return _=ai(_,x),_.index=0,_.sibling=null,_}function s(_,x,w){return _.index=w,e?(w=_.alternate,w!==null?(w=w.index,w<x?(_.flags|=2,x):w):(_.flags|=2,x)):(_.flags|=1048576,x)}function o(_){return e&&_.alternate===null&&(_.flags|=2),_}function l(_,x,w,N){return x===null||x.tag!==6?(x=su(w,_.mode,N),x.return=_,x):(x=i(x,w),x.return=_,x)}function a(_,x,w,N){var L=w.type;return L===os?d(_,x,w.props.children,N,w.key):x!==null&&(x.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===Kn&&hm(L)===x.type)?(N=i(x,w.props),N.ref=Xs(_,x,w),N.return=_,N):(N=la(w.type,w.key,w.props,null,_.mode,N),N.ref=Xs(_,x,w),N.return=_,N)}function c(_,x,w,N){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=ou(w,_.mode,N),x.return=_,x):(x=i(x,w.children||[]),x.return=_,x)}function d(_,x,w,N,L){return x===null||x.tag!==7?(x=Ai(w,_.mode,N,L),x.return=_,x):(x=i(x,w),x.return=_,x)}function h(_,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=su(""+x,_.mode,w),x.return=_,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case wl:return w=la(x.type,x.key,x.props,null,_.mode,w),w.ref=Xs(_,null,x),w.return=_,w;case ss:return x=ou(x,_.mode,w),x.return=_,x;case Kn:var N=x._init;return h(_,N(x._payload),w)}if(uo(x)||Us(x))return x=Ai(x,_.mode,w,null),x.return=_,x;Il(_,x)}return null}function f(_,x,w,N){var L=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return L!==null?null:l(_,x,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case wl:return w.key===L?a(_,x,w,N):null;case ss:return w.key===L?c(_,x,w,N):null;case Kn:return L=w._init,f(_,x,L(w._payload),N)}if(uo(w)||Us(w))return L!==null?null:d(_,x,w,N,null);Il(_,w)}return null}function p(_,x,w,N,L){if(typeof N=="string"&&N!==""||typeof N=="number")return _=_.get(w)||null,l(x,_,""+N,L);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case wl:return _=_.get(N.key===null?w:N.key)||null,a(x,_,N,L);case ss:return _=_.get(N.key===null?w:N.key)||null,c(x,_,N,L);case Kn:var C=N._init;return p(_,x,w,C(N._payload),L)}if(uo(N)||Us(N))return _=_.get(w)||null,d(x,_,N,L,null);Il(x,N)}return null}function m(_,x,w,N){for(var L=null,C=null,F=x,T=x=0,q=null;F!==null&&T<w.length;T++){F.index>T?(q=F,F=null):q=F.sibling;var E=f(_,F,w[T],N);if(E===null){F===null&&(F=q);break}e&&F&&E.alternate===null&&t(_,F),x=s(E,x,T),C===null?L=E:C.sibling=E,C=E,F=q}if(T===w.length)return r(_,F),st&&Ei(_,T),L;if(F===null){for(;T<w.length;T++)F=h(_,w[T],N),F!==null&&(x=s(F,x,T),C===null?L=F:C.sibling=F,C=F);return st&&Ei(_,T),L}for(F=n(_,F);T<w.length;T++)q=p(F,_,T,w[T],N),q!==null&&(e&&q.alternate!==null&&F.delete(q.key===null?T:q.key),x=s(q,x,T),C===null?L=q:C.sibling=q,C=q);return e&&F.forEach(function(A){return t(_,A)}),st&&Ei(_,T),L}function g(_,x,w,N){var L=Us(w);if(typeof L!="function")throw Error(ee(150));if(w=L.call(w),w==null)throw Error(ee(151));for(var C=L=null,F=x,T=x=0,q=null,E=w.next();F!==null&&!E.done;T++,E=w.next()){F.index>T?(q=F,F=null):q=F.sibling;var A=f(_,F,E.value,N);if(A===null){F===null&&(F=q);break}e&&F&&A.alternate===null&&t(_,F),x=s(A,x,T),C===null?L=A:C.sibling=A,C=A,F=q}if(E.done)return r(_,F),st&&Ei(_,T),L;if(F===null){for(;!E.done;T++,E=w.next())E=h(_,E.value,N),E!==null&&(x=s(E,x,T),C===null?L=E:C.sibling=E,C=E);return st&&Ei(_,T),L}for(F=n(_,F);!E.done;T++,E=w.next())E=p(F,_,T,E.value,N),E!==null&&(e&&E.alternate!==null&&F.delete(E.key===null?T:E.key),x=s(E,x,T),C===null?L=E:C.sibling=E,C=E);return e&&F.forEach(function(R){return t(_,R)}),st&&Ei(_,T),L}function S(_,x,w,N){if(typeof w=="object"&&w!==null&&w.type===os&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case wl:e:{for(var L=w.key,C=x;C!==null;){if(C.key===L){if(L=w.type,L===os){if(C.tag===7){r(_,C.sibling),x=i(C,w.props.children),x.return=_,_=x;break e}}else if(C.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===Kn&&hm(L)===C.type){r(_,C.sibling),x=i(C,w.props),x.ref=Xs(_,C,w),x.return=_,_=x;break e}r(_,C);break}else t(_,C);C=C.sibling}w.type===os?(x=Ai(w.props.children,_.mode,N,w.key),x.return=_,_=x):(N=la(w.type,w.key,w.props,null,_.mode,N),N.ref=Xs(_,x,w),N.return=_,_=N)}return o(_);case ss:e:{for(C=w.key;x!==null;){if(x.key===C)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){r(_,x.sibling),x=i(x,w.children||[]),x.return=_,_=x;break e}else{r(_,x);break}else t(_,x);x=x.sibling}x=ou(w,_.mode,N),x.return=_,_=x}return o(_);case Kn:return C=w._init,S(_,x,C(w._payload),N)}if(uo(w))return m(_,x,w,N);if(Us(w))return g(_,x,w,N);Il(_,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(r(_,x.sibling),x=i(x,w),x.return=_,_=x):(r(_,x),x=su(w,_.mode,N),x.return=_,_=x),o(_)):r(_,x)}return S}var Ts=wx(!0),Sx=wx(!1),Da=fi(null),ja=null,ps=null,uf=null;function hf(){uf=ps=ja=null}function df(e){var t=Da.current;it(Da),e._currentValue=t}function bh(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function ws(e,t){ja=e,uf=ps=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(pr=!0),e.firstContext=null)}function Ur(e){var t=e._currentValue;if(uf!==e)if(e={context:e,memoizedValue:t,next:null},ps===null){if(ja===null)throw Error(ee(308));ps=e,ja.dependencies={lanes:0,firstContext:e}}else ps=ps.next=e;return t}var Mi=null;function ff(e){Mi===null?Mi=[e]:Mi.push(e)}function kx(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,ff(t)):(r.next=i.next,i.next=r),t.interleaved=r,Rn(e,n)}function Rn(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var qn=!1;function pf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cx(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Tn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function si(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Xe&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,Rn(e,r)}return i=n.interleaved,i===null?(t.next=t,ff(n)):(t.next=i.next,i.next=t),n.interleaved=t,Rn(e,r)}function ta(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Jd(e,r)}}function dm(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=t:s=s.next=t}else i=s=t;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Aa(e,t,r,n){var i=e.updateQueue;qn=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var a=l,c=a.next;a.next=null,o===null?s=c:o.next=c,o=a;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=c:l.next=c,d.lastBaseUpdate=a))}if(s!==null){var h=i.baseState;o=0,d=c=a=null,l=s;do{var f=l.lane,p=l.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,g=l;switch(f=t,p=r,g.tag){case 1:if(m=g.payload,typeof m=="function"){h=m.call(p,h,f);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m=="function"?m.call(p,h,f):m,f==null)break e;h=dt({},h,f);break e;case 2:qn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(c=d=p,a=h):d=d.next=p,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;f=l,l=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(d===null&&(a=h),i.baseState=a,i.firstBaseUpdate=c,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Wi|=o,e.lanes=o,e.memoizedState=h}}function fm(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(i!==null){if(n.callback=null,n=r,typeof i!="function")throw Error(ee(191,i));i.call(n)}}}var ul={},fn=fi(ul),Vo=fi(ul),Ko=fi(ul);function Ii(e){if(e===ul)throw Error(ee(174));return e}function mf(e,t){switch(tt(Ko,t),tt(Vo,e),tt(fn,ul),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:th(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=th(t,e)}it(fn),tt(fn,t)}function Ps(){it(fn),it(Vo),it(Ko)}function Ex(e){Ii(Ko.current);var t=Ii(fn.current),r=th(t,e.type);t!==r&&(tt(Vo,e),tt(fn,r))}function gf(e){Vo.current===e&&(it(fn),it(Vo))}var ut=fi(0);function Ba(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Zc=[];function _f(){for(var e=0;e<Zc.length;e++)Zc[e]._workInProgressVersionPrimary=null;Zc.length=0}var ra=Dn.ReactCurrentDispatcher,eu=Dn.ReactCurrentBatchConfig,Fi=0,ht=null,Pt=null,jt=null,Oa=!1,ko=!1,qo=0,hS=0;function Kt(){throw Error(ee(321))}function vf(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!rn(e[r],t[r]))return!1;return!0}function xf(e,t,r,n,i,s){if(Fi=s,ht=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ra.current=e===null||e.memoizedState===null?mS:gS,e=r(n,i),ko){s=0;do{if(ko=!1,qo=0,25<=s)throw Error(ee(301));s+=1,jt=Pt=null,t.updateQueue=null,ra.current=_S,e=r(n,i)}while(ko)}if(ra.current=za,t=Pt!==null&&Pt.next!==null,Fi=0,jt=Pt=ht=null,Oa=!1,t)throw Error(ee(300));return e}function yf(){var e=qo!==0;return qo=0,e}function an(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jt===null?ht.memoizedState=jt=e:jt=jt.next=e,jt}function Vr(){if(Pt===null){var e=ht.alternate;e=e!==null?e.memoizedState:null}else e=Pt.next;var t=jt===null?ht.memoizedState:jt.next;if(t!==null)jt=t,Pt=e;else{if(e===null)throw Error(ee(310));Pt=e,e={memoizedState:Pt.memoizedState,baseState:Pt.baseState,baseQueue:Pt.baseQueue,queue:Pt.queue,next:null},jt===null?ht.memoizedState=jt=e:jt=jt.next=e}return jt}function Yo(e,t){return typeof t=="function"?t(e):t}function tu(e){var t=Vr(),r=t.queue;if(r===null)throw Error(ee(311));r.lastRenderedReducer=e;var n=Pt,i=n.baseQueue,s=r.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}n.baseQueue=i=s,r.pending=null}if(i!==null){s=i.next,n=n.baseState;var l=o=null,a=null,c=s;do{var d=c.lane;if((Fi&d)===d)a!==null&&(a=a.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),n=c.hasEagerState?c.eagerState:e(n,c.action);else{var h={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=h,o=n):a=a.next=h,ht.lanes|=d,Wi|=d}c=c.next}while(c!==null&&c!==s);a===null?o=n:a.next=l,rn(n,t.memoizedState)||(pr=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=a,r.lastRenderedState=n}if(e=r.interleaved,e!==null){i=e;do s=i.lane,ht.lanes|=s,Wi|=s,i=i.next;while(i!==e)}else i===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function ru(e){var t=Vr(),r=t.queue;if(r===null)throw Error(ee(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,s=t.memoizedState;if(i!==null){r.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);rn(s,t.memoizedState)||(pr=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function Nx(){}function Tx(e,t){var r=ht,n=Vr(),i=t(),s=!rn(n.memoizedState,i);if(s&&(n.memoizedState=i,pr=!0),n=n.queue,bf(Rx.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||jt!==null&&jt.memoizedState.tag&1){if(r.flags|=2048,Xo(9,Lx.bind(null,r,n,i,t),void 0,null),zt===null)throw Error(ee(349));Fi&30||Px(r,t,i)}return i}function Px(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ht.updateQueue,t===null?(t={lastEffect:null,stores:null},ht.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Lx(e,t,r,n){t.value=r,t.getSnapshot=n,Mx(t)&&Ix(e)}function Rx(e,t,r){return r(function(){Mx(t)&&Ix(e)})}function Mx(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!rn(e,r)}catch{return!0}}function Ix(e){var t=Rn(e,1);t!==null&&Zr(t,e,1,-1)}function pm(e){var t=an();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:e},t.queue=e,e=e.dispatch=pS.bind(null,ht,e),[t.memoizedState,e]}function Xo(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ht.updateQueue,t===null?(t={lastEffect:null,stores:null},ht.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function Dx(){return Vr().memoizedState}function na(e,t,r,n){var i=an();ht.flags|=e,i.memoizedState=Xo(1|t,r,void 0,n===void 0?null:n)}function hc(e,t,r,n){var i=Vr();n=n===void 0?null:n;var s=void 0;if(Pt!==null){var o=Pt.memoizedState;if(s=o.destroy,n!==null&&vf(n,o.deps)){i.memoizedState=Xo(t,r,s,n);return}}ht.flags|=e,i.memoizedState=Xo(1|t,r,s,n)}function mm(e,t){return na(8390656,8,e,t)}function bf(e,t){return hc(2048,8,e,t)}function jx(e,t){return hc(4,2,e,t)}function Ax(e,t){return hc(4,4,e,t)}function Bx(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ox(e,t,r){return r=r!=null?r.concat([e]):null,hc(4,4,Bx.bind(null,t,e),r)}function wf(){}function zx(e,t){var r=Vr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&vf(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function $x(e,t){var r=Vr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&vf(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Fx(e,t,r){return Fi&21?(rn(r,t)||(r=Kv(),ht.lanes|=r,Wi|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,pr=!0),e.memoizedState=r)}function dS(e,t){var r=Qe;Qe=r!==0&&4>r?r:4,e(!0);var n=eu.transition;eu.transition={};try{e(!1),t()}finally{Qe=r,eu.transition=n}}function Wx(){return Vr().memoizedState}function fS(e,t,r){var n=li(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Hx(e))Ux(t,r);else if(r=kx(e,t,r,n),r!==null){var i=nr();Zr(r,e,n,i),Vx(r,t,n)}}function pS(e,t,r){var n=li(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Hx(e))Ux(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,r);if(i.hasEagerState=!0,i.eagerState=l,rn(l,o)){var a=t.interleaved;a===null?(i.next=i,ff(t)):(i.next=a.next,a.next=i),t.interleaved=i;return}}catch{}finally{}r=kx(e,t,i,n),r!==null&&(i=nr(),Zr(r,e,n,i),Vx(r,t,n))}}function Hx(e){var t=e.alternate;return e===ht||t!==null&&t===ht}function Ux(e,t){ko=Oa=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Vx(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Jd(e,r)}}var za={readContext:Ur,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},mS={readContext:Ur,useCallback:function(e,t){return an().memoizedState=[e,t===void 0?null:t],e},useContext:Ur,useEffect:mm,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,na(4194308,4,Bx.bind(null,t,e),r)},useLayoutEffect:function(e,t){return na(4194308,4,e,t)},useInsertionEffect:function(e,t){return na(4,2,e,t)},useMemo:function(e,t){var r=an();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=an();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=fS.bind(null,ht,e),[n.memoizedState,e]},useRef:function(e){var t=an();return e={current:e},t.memoizedState=e},useState:pm,useDebugValue:wf,useDeferredValue:function(e){return an().memoizedState=e},useTransition:function(){var e=pm(!1),t=e[0];return e=dS.bind(null,e[1]),an().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ht,i=an();if(st){if(r===void 0)throw Error(ee(407));r=r()}else{if(r=t(),zt===null)throw Error(ee(349));Fi&30||Px(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,mm(Rx.bind(null,n,s,e),[e]),n.flags|=2048,Xo(9,Lx.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=an(),t=zt.identifierPrefix;if(st){var r=En,n=Cn;r=(n&~(1<<32-Jr(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=qo++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=hS++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},gS={readContext:Ur,useCallback:zx,useContext:Ur,useEffect:bf,useImperativeHandle:Ox,useInsertionEffect:jx,useLayoutEffect:Ax,useMemo:$x,useReducer:tu,useRef:Dx,useState:function(){return tu(Yo)},useDebugValue:wf,useDeferredValue:function(e){var t=Vr();return Fx(t,Pt.memoizedState,e)},useTransition:function(){var e=tu(Yo)[0],t=Vr().memoizedState;return[e,t]},useMutableSource:Nx,useSyncExternalStore:Tx,useId:Wx,unstable_isNewReconciler:!1},_S={readContext:Ur,useCallback:zx,useContext:Ur,useEffect:bf,useImperativeHandle:Ox,useInsertionEffect:jx,useLayoutEffect:Ax,useMemo:$x,useReducer:ru,useRef:Dx,useState:function(){return ru(Yo)},useDebugValue:wf,useDeferredValue:function(e){var t=Vr();return Pt===null?t.memoizedState=e:Fx(t,Pt.memoizedState,e)},useTransition:function(){var e=ru(Yo)[0],t=Vr().memoizedState;return[e,t]},useMutableSource:Nx,useSyncExternalStore:Tx,useId:Wx,unstable_isNewReconciler:!1};function Xr(e,t){if(e&&e.defaultProps){t=dt({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function wh(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:dt({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var dc={isMounted:function(e){return(e=e._reactInternals)?Yi(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=nr(),i=li(e),s=Tn(n,i);s.payload=t,r!=null&&(s.callback=r),t=si(e,s,i),t!==null&&(Zr(t,e,i,n),ta(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=nr(),i=li(e),s=Tn(n,i);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=si(e,s,i),t!==null&&(Zr(t,e,i,n),ta(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=nr(),n=li(e),i=Tn(r,n);i.tag=2,t!=null&&(i.callback=t),t=si(e,i,n),t!==null&&(Zr(t,e,n,r),ta(t,e,n))}};function gm(e,t,r,n,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,s,o):t.prototype&&t.prototype.isPureReactComponent?!Fo(r,n)||!Fo(i,s):!0}function Kx(e,t,r){var n=!1,i=hi,s=t.contextType;return typeof s=="object"&&s!==null?s=Ur(s):(i=gr(t)?zi:Qt.current,n=t.contextTypes,s=(n=n!=null)?Es(e,i):hi),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=dc,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function _m(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&dc.enqueueReplaceState(t,t.state,null)}function Sh(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs={},pf(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Ur(s):(s=gr(t)?zi:Qt.current,i.context=Es(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(wh(e,t,s,r),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&dc.enqueueReplaceState(i,i.state,null),Aa(e,r,i,n),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Ls(e,t){try{var r="",n=t;do r+=Vb(n),n=n.return;while(n);var i=r}catch(s){i=`
|
|
37
|
+
`+i[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Bc=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?co(e):""}function Vb(e){switch(e.tag){case 5:return co(e.type);case 16:return co("Lazy");case 13:return co("Suspense");case 19:return co("SuspenseList");case 0:case 2:case 15:return e=Oc(e.type,!1),e;case 11:return e=Oc(e.type.render,!1),e;case 1:return e=Oc(e.type,!0),e;default:return""}}function Gu(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case os:return"Fragment";case ss:return"Portal";case qu:return"Profiler";case qd:return"StrictMode";case Yu:return"Suspense";case Xu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Cv:return(e.displayName||"Context")+".Consumer";case kv:return(e._context.displayName||"Context")+".Provider";case Yd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Xd:return t=e.displayName||null,t!==null?t:Gu(e.type)||"Memo";case Kn:t=e._payload,e=e._init;try{return Gu(e(t))}catch{}}return null}function Kb(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Gu(t);case 8:return t===qd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ui(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Nv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function qb(e){var t=Nv(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sl(e){e._valueTracker||(e._valueTracker=qb(e))}function Pv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Nv(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function ba(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Qu(e,t){var r=t.checked;return dt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Dp(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=ui(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Tv(e,t){t=t.checked,t!=null&&Kd(e,"checked",t,!1)}function Ju(e,t){Tv(e,t);var r=ui(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Zu(e,t.type,r):t.hasOwnProperty("defaultValue")&&Zu(e,t.type,ui(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function jp(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Zu(e,t,r){(t!=="number"||ba(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var uo=Array.isArray;function vs(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+ui(r),t=null,i=0;i<e.length;i++){if(e[i].value===r){e[i].selected=!0,n&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function eh(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ee(91));return dt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ap(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(ee(92));if(uo(r)){if(1<r.length)throw Error(ee(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:ui(r)}}function Lv(e,t){var r=ui(t.value),n=ui(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function Bp(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Rv(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function th(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Rv(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var kl,Mv=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,i){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(kl=kl||document.createElement("div"),kl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=kl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function jo(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var xo={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},Yb=["Webkit","ms","Moz","O"];Object.keys(xo).forEach(function(e){Yb.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xo[t]=xo[e]})});function Iv(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||xo.hasOwnProperty(e)&&xo[e]?(""+t).trim():t+"px"}function Dv(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=Iv(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var Xb=dt({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 rh(e,t){if(t){if(Xb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function nh(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ih=null;function Gd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sh=null,xs=null,ys=null;function Op(e){if(e=cl(e)){if(typeof sh!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=cc(t),sh(e.stateNode,e.type,t))}}function jv(e){xs?ys?ys.push(e):ys=[e]:xs=e}function Av(){if(xs){var e=xs,t=ys;if(ys=xs=null,Op(e),t)for(e=0;e<t.length;e++)Op(t[e])}}function Bv(e,t){return e(t)}function Ov(){}var zc=!1;function zv(e,t,r){if(zc)return e(t,r);zc=!0;try{return Bv(e,t,r)}finally{zc=!1,(xs!==null||ys!==null)&&(Ov(),Av())}}function Ao(e,t){var r=e.stateNode;if(r===null)return null;var n=cc(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(ee(231,t,typeof r));return r}var oh=!1;if(Tn)try{var Vs={};Object.defineProperty(Vs,"passive",{get:function(){oh=!0}}),window.addEventListener("test",Vs,Vs),window.removeEventListener("test",Vs,Vs)}catch{oh=!1}function Gb(e,t,r,n,i,s,o,l,a){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(d){this.onError(d)}}var yo=!1,wa=null,Sa=!1,lh=null,Qb={onError:function(e){yo=!0,wa=e}};function Jb(e,t,r,n,i,s,o,l,a){yo=!1,wa=null,Gb.apply(Qb,arguments)}function Zb(e,t,r,n,i,s,o,l,a){if(Jb.apply(this,arguments),yo){if(yo){var c=wa;yo=!1,wa=null}else throw Error(ee(198));Sa||(Sa=!0,lh=c)}}function Yi(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function $v(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function zp(e){if(Yi(e)!==e)throw Error(ee(188))}function ew(e){var t=e.alternate;if(!t){if(t=Yi(e),t===null)throw Error(ee(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(i===null)break;var s=i.alternate;if(s===null){if(n=i.return,n!==null){r=n;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===r)return zp(i),e;if(s===n)return zp(i),t;s=s.sibling}throw Error(ee(188))}if(r.return!==n.return)r=i,n=s;else{for(var o=!1,l=i.child;l;){if(l===r){o=!0,r=i,n=s;break}if(l===n){o=!0,n=i,r=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===r){o=!0,r=s,n=i;break}if(l===n){o=!0,n=s,r=i;break}l=l.sibling}if(!o)throw Error(ee(189))}}if(r.alternate!==n)throw Error(ee(190))}if(r.tag!==3)throw Error(ee(188));return r.stateNode.current===r?e:t}function Fv(e){return e=ew(e),e!==null?Wv(e):null}function Wv(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Wv(e);if(t!==null)return t;e=e.sibling}return null}var Hv=Tr.unstable_scheduleCallback,$p=Tr.unstable_cancelCallback,tw=Tr.unstable_shouldYield,rw=Tr.unstable_requestPaint,xt=Tr.unstable_now,nw=Tr.unstable_getCurrentPriorityLevel,Qd=Tr.unstable_ImmediatePriority,Uv=Tr.unstable_UserBlockingPriority,ka=Tr.unstable_NormalPriority,iw=Tr.unstable_LowPriority,Vv=Tr.unstable_IdlePriority,sc=null,dn=null;function sw(e){if(dn&&typeof dn.onCommitFiberRoot=="function")try{dn.onCommitFiberRoot(sc,e,void 0,(e.current.flags&128)===128)}catch{}}var Jr=Math.clz32?Math.clz32:aw,ow=Math.log,lw=Math.LN2;function aw(e){return e>>>=0,e===0?32:31-(ow(e)/lw|0)|0}var Cl=64,El=4194304;function ho(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ca(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~i;l!==0?n=ho(l):(s&=o,s!==0&&(n=ho(s)))}else o=r&~i,o!==0?n=ho(o):s!==0&&(n=ho(s));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-Jr(t),i=1<<r,n|=e[r],t&=~i;return n}function cw(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function uw(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Jr(s),l=1<<o,a=i[o];a===-1?(!(l&r)||l&n)&&(i[o]=cw(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function ah(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Kv(){var e=Cl;return Cl<<=1,!(Cl&4194240)&&(Cl=64),e}function $c(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function ll(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Jr(t),e[t]=r}function hw(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var i=31-Jr(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}function Jd(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Jr(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var Qe=0;function qv(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Yv,Zd,Xv,Gv,Qv,ch=!1,Nl=[],ti=null,ri=null,ni=null,Bo=new Map,Oo=new Map,Xn=[],dw="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 Fp(e,t){switch(e){case"focusin":case"focusout":ti=null;break;case"dragenter":case"dragleave":ri=null;break;case"mouseover":case"mouseout":ni=null;break;case"pointerover":case"pointerout":Bo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(t.pointerId)}}function Ks(e,t,r,n,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:s,targetContainers:[i]},t!==null&&(t=cl(t),t!==null&&Zd(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function fw(e,t,r,n,i){switch(t){case"focusin":return ti=Ks(ti,e,t,r,n,i),!0;case"dragenter":return ri=Ks(ri,e,t,r,n,i),!0;case"mouseover":return ni=Ks(ni,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return Bo.set(s,Ks(Bo.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,Oo.set(s,Ks(Oo.get(s)||null,e,t,r,n,i)),!0}return!1}function Jv(e){var t=Ri(e.target);if(t!==null){var r=Yi(t);if(r!==null){if(t=r.tag,t===13){if(t=$v(r),t!==null){e.blockedOn=t,Qv(e.priority,function(){Xv(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Jl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=uh(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);ih=n,r.target.dispatchEvent(n),ih=null}else return t=cl(r),t!==null&&Zd(t),e.blockedOn=r,!1;t.shift()}return!0}function Wp(e,t,r){Jl(e)&&r.delete(t)}function pw(){ch=!1,ti!==null&&Jl(ti)&&(ti=null),ri!==null&&Jl(ri)&&(ri=null),ni!==null&&Jl(ni)&&(ni=null),Bo.forEach(Wp),Oo.forEach(Wp)}function qs(e,t){e.blockedOn===t&&(e.blockedOn=null,ch||(ch=!0,Tr.unstable_scheduleCallback(Tr.unstable_NormalPriority,pw)))}function zo(e){function t(i){return qs(i,e)}if(0<Nl.length){qs(Nl[0],e);for(var r=1;r<Nl.length;r++){var n=Nl[r];n.blockedOn===e&&(n.blockedOn=null)}}for(ti!==null&&qs(ti,e),ri!==null&&qs(ri,e),ni!==null&&qs(ni,e),Bo.forEach(t),Oo.forEach(t),r=0;r<Xn.length;r++)n=Xn[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Xn.length&&(r=Xn[0],r.blockedOn===null);)Jv(r),r.blockedOn===null&&Xn.shift()}var bs=Dn.ReactCurrentBatchConfig,Ea=!0;function mw(e,t,r,n){var i=Qe,s=bs.transition;bs.transition=null;try{Qe=1,ef(e,t,r,n)}finally{Qe=i,bs.transition=s}}function gw(e,t,r,n){var i=Qe,s=bs.transition;bs.transition=null;try{Qe=4,ef(e,t,r,n)}finally{Qe=i,bs.transition=s}}function ef(e,t,r,n){if(Ea){var i=uh(e,t,r,n);if(i===null)Gc(e,t,n,Na,r),Fp(e,n);else if(fw(i,e,t,r,n))n.stopPropagation();else if(Fp(e,n),t&4&&-1<dw.indexOf(e)){for(;i!==null;){var s=cl(i);if(s!==null&&Yv(s),s=uh(e,t,r,n),s===null&&Gc(e,t,n,Na,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else Gc(e,t,n,null,r)}}var Na=null;function uh(e,t,r,n){if(Na=null,e=Gd(n),e=Ri(e),e!==null)if(t=Yi(e),t===null)e=null;else if(r=t.tag,r===13){if(e=$v(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Na=e,null}function Zv(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(nw()){case Qd:return 1;case Uv:return 4;case ka:case iw:return 16;case Vv:return 536870912;default:return 16}default:return 16}}var Qn=null,tf=null,Zl=null;function ex(){if(Zl)return Zl;var e,t=tf,r=t.length,n,i="value"in Qn?Qn.value:Qn.textContent,s=i.length;for(e=0;e<r&&t[e]===i[e];e++);var o=r-e;for(n=1;n<=o&&t[r-n]===i[s-n];n++);return Zl=i.slice(e,1<n?1-n:void 0)}function ea(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Pl(){return!0}function Hp(){return!1}function Rr(e){function t(r,n,i,s,o){this._reactName=r,this._targetInst=i,this.type=n,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Pl:Hp,this.isPropagationStopped=Hp,this}return dt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Pl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Pl)},persist:function(){},isPersistent:Pl}),t}var js={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rf=Rr(js),al=dt({},js,{view:0,detail:0}),_w=Rr(al),Fc,Wc,Ys,oc=dt({},al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ys&&(Ys&&e.type==="mousemove"?(Fc=e.screenX-Ys.screenX,Wc=e.screenY-Ys.screenY):Wc=Fc=0,Ys=e),Fc)},movementY:function(e){return"movementY"in e?e.movementY:Wc}}),Up=Rr(oc),vw=dt({},oc,{dataTransfer:0}),xw=Rr(vw),yw=dt({},al,{relatedTarget:0}),Hc=Rr(yw),bw=dt({},js,{animationName:0,elapsedTime:0,pseudoElement:0}),ww=Rr(bw),Sw=dt({},js,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kw=Rr(Sw),Cw=dt({},js,{data:0}),Vp=Rr(Cw),Ew={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nw={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"},Pw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Tw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Pw[e])?!!t[e]:!1}function nf(){return Tw}var Lw=dt({},al,{key:function(e){if(e.key){var t=Ew[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ea(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Nw[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nf,charCode:function(e){return e.type==="keypress"?ea(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ea(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Rw=Rr(Lw),Mw=dt({},oc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Kp=Rr(Mw),Iw=dt({},al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nf}),Dw=Rr(Iw),jw=dt({},js,{propertyName:0,elapsedTime:0,pseudoElement:0}),Aw=Rr(jw),Bw=dt({},oc,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Ow=Rr(Bw),zw=[9,13,27,32],sf=Tn&&"CompositionEvent"in window,bo=null;Tn&&"documentMode"in document&&(bo=document.documentMode);var $w=Tn&&"TextEvent"in window&&!bo,tx=Tn&&(!sf||bo&&8<bo&&11>=bo),qp=" ",Yp=!1;function rx(e,t){switch(e){case"keyup":return zw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nx(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ls=!1;function Fw(e,t){switch(e){case"compositionend":return nx(t);case"keypress":return t.which!==32?null:(Yp=!0,qp);case"textInput":return e=t.data,e===qp&&Yp?null:e;default:return null}}function Ww(e,t){if(ls)return e==="compositionend"||!sf&&rx(e,t)?(e=ex(),Zl=tf=Qn=null,ls=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return tx&&t.locale!=="ko"?null:t.data;default:return null}}var Hw={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 Xp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Hw[e.type]:t==="textarea"}function ix(e,t,r,n){jv(n),t=Pa(t,"onChange"),0<t.length&&(r=new rf("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var wo=null,$o=null;function Uw(e){mx(e,0)}function lc(e){var t=us(e);if(Pv(t))return e}function Vw(e,t){if(e==="change")return t}var sx=!1;if(Tn){var Uc;if(Tn){var Vc="oninput"in document;if(!Vc){var Gp=document.createElement("div");Gp.setAttribute("oninput","return;"),Vc=typeof Gp.oninput=="function"}Uc=Vc}else Uc=!1;sx=Uc&&(!document.documentMode||9<document.documentMode)}function Qp(){wo&&(wo.detachEvent("onpropertychange",ox),$o=wo=null)}function ox(e){if(e.propertyName==="value"&&lc($o)){var t=[];ix(t,$o,e,Gd(e)),zv(Uw,t)}}function Kw(e,t,r){e==="focusin"?(Qp(),wo=t,$o=r,wo.attachEvent("onpropertychange",ox)):e==="focusout"&&Qp()}function qw(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return lc($o)}function Yw(e,t){if(e==="click")return lc(t)}function Xw(e,t){if(e==="input"||e==="change")return lc(t)}function Gw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rn=typeof Object.is=="function"?Object.is:Gw;function Fo(e,t){if(rn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var i=r[n];if(!Ku.call(t,i)||!rn(e[i],t[i]))return!1}return!0}function Jp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zp(e,t){var r=Jp(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Jp(r)}}function lx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?lx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ax(){for(var e=window,t=ba();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=ba(e.document)}return t}function of(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Qw(e){var t=ax(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&lx(r.ownerDocument.documentElement,r)){if(n!==null&&of(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=Zp(r,s);var o=Zp(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Jw=Tn&&"documentMode"in document&&11>=document.documentMode,as=null,hh=null,So=null,dh=!1;function em(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;dh||as==null||as!==ba(n)||(n=as,"selectionStart"in n&&of(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),So&&Fo(So,n)||(So=n,n=Pa(hh,"onSelect"),0<n.length&&(t=new rf("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=as)))}function Tl(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var cs={animationend:Tl("Animation","AnimationEnd"),animationiteration:Tl("Animation","AnimationIteration"),animationstart:Tl("Animation","AnimationStart"),transitionend:Tl("Transition","TransitionEnd")},Kc={},cx={};Tn&&(cx=document.createElement("div").style,"AnimationEvent"in window||(delete cs.animationend.animation,delete cs.animationiteration.animation,delete cs.animationstart.animation),"TransitionEvent"in window||delete cs.transitionend.transition);function ac(e){if(Kc[e])return Kc[e];if(!cs[e])return e;var t=cs[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in cx)return Kc[e]=t[r];return e}var ux=ac("animationend"),hx=ac("animationiteration"),dx=ac("animationstart"),fx=ac("transitionend"),px=new Map,tm="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 di(e,t){px.set(e,t),qi(t,[e])}for(var qc=0;qc<tm.length;qc++){var Yc=tm[qc],Zw=Yc.toLowerCase(),eS=Yc[0].toUpperCase()+Yc.slice(1);di(Zw,"on"+eS)}di(ux,"onAnimationEnd");di(hx,"onAnimationIteration");di(dx,"onAnimationStart");di("dblclick","onDoubleClick");di("focusin","onFocus");di("focusout","onBlur");di(fx,"onTransitionEnd");Cs("onMouseEnter",["mouseout","mouseover"]);Cs("onMouseLeave",["mouseout","mouseover"]);Cs("onPointerEnter",["pointerout","pointerover"]);Cs("onPointerLeave",["pointerout","pointerover"]);qi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));qi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));qi("onBeforeInput",["compositionend","keypress","textInput","paste"]);qi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));qi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));qi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fo="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(" "),tS=new Set("cancel close invalid load scroll toggle".split(" ").concat(fo));function rm(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,Zb(n,t,void 0,e),e.currentTarget=null}function mx(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var s=void 0;if(t)for(var o=n.length-1;0<=o;o--){var l=n[o],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==s&&i.isPropagationStopped())break e;rm(i,l,c),s=a}else for(o=0;o<n.length;o++){if(l=n[o],a=l.instance,c=l.currentTarget,l=l.listener,a!==s&&i.isPropagationStopped())break e;rm(i,l,c),s=a}}}if(Sa)throw e=lh,Sa=!1,lh=null,e}function rt(e,t){var r=t[_h];r===void 0&&(r=t[_h]=new Set);var n=e+"__bubble";r.has(n)||(gx(t,e,2,!1),r.add(n))}function Xc(e,t,r){var n=0;t&&(n|=4),gx(r,e,n,t)}var Ll="_reactListening"+Math.random().toString(36).slice(2);function Wo(e){if(!e[Ll]){e[Ll]=!0,Sv.forEach(function(r){r!=="selectionchange"&&(tS.has(r)||Xc(r,!1,e),Xc(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ll]||(t[Ll]=!0,Xc("selectionchange",!1,t))}}function gx(e,t,r,n){switch(Zv(t)){case 1:var i=mw;break;case 4:i=gw;break;default:i=ef}r=i.bind(null,t,r,e),i=void 0,!oh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),n?i!==void 0?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):i!==void 0?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function Gc(e,t,r,n,i){var s=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=n.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===i||a.nodeType===8&&a.parentNode===i))return;o=o.return}for(;l!==null;){if(o=Ri(l),o===null)return;if(a=o.tag,a===5||a===6){n=s=o;continue e}l=l.parentNode}}n=n.return}zv(function(){var c=s,d=Gd(r),h=[];e:{var f=px.get(e);if(f!==void 0){var p=rf,m=e;switch(e){case"keypress":if(ea(r)===0)break e;case"keydown":case"keyup":p=Rw;break;case"focusin":m="focus",p=Hc;break;case"focusout":m="blur",p=Hc;break;case"beforeblur":case"afterblur":p=Hc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Up;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=xw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Dw;break;case ux:case hx:case dx:p=ww;break;case fx:p=Aw;break;case"scroll":p=_w;break;case"wheel":p=Ow;break;case"copy":case"cut":case"paste":p=kw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Kp}var g=(t&4)!==0,S=!g&&e==="scroll",_=g?f!==null?f+"Capture":null:f;g=[];for(var x=c,w;x!==null;){w=x;var N=w.stateNode;if(w.tag===5&&N!==null&&(w=N,_!==null&&(N=Ao(x,_),N!=null&&g.push(Ho(x,N,w)))),S)break;x=x.return}0<g.length&&(f=new p(f,m,null,r,d),h.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==ih&&(m=r.relatedTarget||r.fromElement)&&(Ri(m)||m[Ln]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=r.relatedTarget||r.toElement,p=c,m=m?Ri(m):null,m!==null&&(S=Yi(m),m!==S||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(g=Up,N="onMouseLeave",_="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(g=Kp,N="onPointerLeave",_="onPointerEnter",x="pointer"),S=p==null?f:us(p),w=m==null?f:us(m),f=new g(N,x+"leave",p,r,d),f.target=S,f.relatedTarget=w,N=null,Ri(d)===c&&(g=new g(_,x+"enter",m,r,d),g.target=w,g.relatedTarget=S,N=g),S=N,p&&m)t:{for(g=p,_=m,x=0,w=g;w;w=Zi(w))x++;for(w=0,N=_;N;N=Zi(N))w++;for(;0<x-w;)g=Zi(g),x--;for(;0<w-x;)_=Zi(_),w--;for(;x--;){if(g===_||_!==null&&g===_.alternate)break t;g=Zi(g),_=Zi(_)}g=null}else g=null;p!==null&&nm(h,f,p,g,!1),m!==null&&S!==null&&nm(h,S,m,g,!0)}}e:{if(f=c?us(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var L=Vw;else if(Xp(f))if(sx)L=Xw;else{L=qw;var C=Kw}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(L=Yw);if(L&&(L=L(e,c))){ix(h,L,r,d);break e}C&&C(e,f,c),e==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&Zu(f,"number",f.value)}switch(C=c?us(c):window,e){case"focusin":(Xp(C)||C.contentEditable==="true")&&(as=C,hh=c,So=null);break;case"focusout":So=hh=as=null;break;case"mousedown":dh=!0;break;case"contextmenu":case"mouseup":case"dragend":dh=!1,em(h,r,d);break;case"selectionchange":if(Jw)break;case"keydown":case"keyup":em(h,r,d)}var F;if(sf)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else ls?rx(e,r)&&(P="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(P="onCompositionStart");P&&(tx&&r.locale!=="ko"&&(ls||P!=="onCompositionStart"?P==="onCompositionEnd"&&ls&&(F=ex()):(Qn=d,tf="value"in Qn?Qn.value:Qn.textContent,ls=!0)),C=Pa(c,P),0<C.length&&(P=new Vp(P,e,null,r,d),h.push({event:P,listeners:C}),F?P.data=F:(F=nx(r),F!==null&&(P.data=F)))),(F=$w?Fw(e,r):Ww(e,r))&&(c=Pa(c,"onBeforeInput"),0<c.length&&(d=new Vp("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:c}),d.data=F))}mx(h,t)})}function Ho(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Pa(e,t){for(var r=t+"Capture",n=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Ao(e,r),s!=null&&n.unshift(Ho(e,s,i)),s=Ao(e,t),s!=null&&n.push(Ho(e,s,i))),e=e.return}return n}function Zi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function nm(e,t,r,n,i){for(var s=t._reactName,o=[];r!==null&&r!==n;){var l=r,a=l.alternate,c=l.stateNode;if(a!==null&&a===n)break;l.tag===5&&c!==null&&(l=c,i?(a=Ao(r,s),a!=null&&o.unshift(Ho(r,a,l))):i||(a=Ao(r,s),a!=null&&o.push(Ho(r,a,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var rS=/\r\n?/g,nS=/\u0000|\uFFFD/g;function im(e){return(typeof e=="string"?e:""+e).replace(rS,`
|
|
38
|
+
`).replace(nS,"")}function Rl(e,t,r){if(t=im(t),im(e)!==t&&r)throw Error(ee(425))}function Ta(){}var fh=null,ph=null;function mh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var gh=typeof setTimeout=="function"?setTimeout:void 0,iS=typeof clearTimeout=="function"?clearTimeout:void 0,sm=typeof Promise=="function"?Promise:void 0,sS=typeof queueMicrotask=="function"?queueMicrotask:typeof sm<"u"?function(e){return sm.resolve(null).then(e).catch(oS)}:gh;function oS(e){setTimeout(function(){throw e})}function Qc(e,t){var r=t,n=0;do{var i=r.nextSibling;if(e.removeChild(r),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(n===0){e.removeChild(i),zo(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);zo(t)}function ii(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function om(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var As=Math.random().toString(36).slice(2),un="__reactFiber$"+As,Uo="__reactProps$"+As,Ln="__reactContainer$"+As,_h="__reactEvents$"+As,lS="__reactListeners$"+As,aS="__reactHandles$"+As;function Ri(e){var t=e[un];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Ln]||r[un]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=om(e);e!==null;){if(r=e[un])return r;e=om(e)}return t}e=r,r=e.parentNode}return null}function cl(e){return e=e[un]||e[Ln],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function us(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ee(33))}function cc(e){return e[Uo]||null}var vh=[],hs=-1;function fi(e){return{current:e}}function it(e){0>hs||(e.current=vh[hs],vh[hs]=null,hs--)}function tt(e,t){hs++,vh[hs]=e.current,e.current=t}var hi={},Qt=fi(hi),mr=fi(!1),zi=hi;function Es(e,t){var r=e.type.contextTypes;if(!r)return hi;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function gr(e){return e=e.childContextTypes,e!=null}function La(){it(mr),it(Qt)}function lm(e,t,r){if(Qt.current!==hi)throw Error(ee(168));tt(Qt,t),tt(mr,r)}function _x(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(ee(108,Kb(e)||"Unknown",i));return dt({},r,n)}function Ra(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hi,zi=Qt.current,tt(Qt,e),tt(mr,mr.current),!0}function am(e,t,r){var n=e.stateNode;if(!n)throw Error(ee(169));r?(e=_x(e,t,zi),n.__reactInternalMemoizedMergedChildContext=e,it(mr),it(Qt),tt(Qt,e)):it(mr),tt(mr,r)}var wn=null,uc=!1,Jc=!1;function vx(e){wn===null?wn=[e]:wn.push(e)}function cS(e){uc=!0,vx(e)}function pi(){if(!Jc&&wn!==null){Jc=!0;var e=0,t=Qe;try{var r=wn;for(Qe=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}wn=null,uc=!1}catch(i){throw wn!==null&&(wn=wn.slice(e+1)),Hv(Qd,pi),i}finally{Qe=t,Jc=!1}}return null}var ds=[],fs=0,Ma=null,Ia=0,Or=[],zr=0,$i=null,Cn=1,En="";function Ei(e,t){ds[fs++]=Ia,ds[fs++]=Ma,Ma=e,Ia=t}function xx(e,t,r){Or[zr++]=Cn,Or[zr++]=En,Or[zr++]=$i,$i=e;var n=Cn;e=En;var i=32-Jr(n)-1;n&=~(1<<i),r+=1;var s=32-Jr(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,Cn=1<<32-Jr(t)+i|r<<i|n,En=s+e}else Cn=1<<s|r<<i|n,En=e}function lf(e){e.return!==null&&(Ei(e,1),xx(e,1,0))}function af(e){for(;e===Ma;)Ma=ds[--fs],ds[fs]=null,Ia=ds[--fs],ds[fs]=null;for(;e===$i;)$i=Or[--zr],Or[zr]=null,En=Or[--zr],Or[zr]=null,Cn=Or[--zr],Or[zr]=null}var Nr=null,Er=null,st=!1,Qr=null;function yx(e,t){var r=Fr(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function cm(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Nr=e,Er=ii(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Nr=e,Er=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=$i!==null?{id:Cn,overflow:En}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Fr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Nr=e,Er=null,!0):!1;default:return!1}}function xh(e){return(e.mode&1)!==0&&(e.flags&128)===0}function yh(e){if(st){var t=Er;if(t){var r=t;if(!cm(e,t)){if(xh(e))throw Error(ee(418));t=ii(r.nextSibling);var n=Nr;t&&cm(e,t)?yx(n,r):(e.flags=e.flags&-4097|2,st=!1,Nr=e)}}else{if(xh(e))throw Error(ee(418));e.flags=e.flags&-4097|2,st=!1,Nr=e}}}function um(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Nr=e}function Ml(e){if(e!==Nr)return!1;if(!st)return um(e),st=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!mh(e.type,e.memoizedProps)),t&&(t=Er)){if(xh(e))throw bx(),Error(ee(418));for(;t;)yx(e,t),t=ii(t.nextSibling)}if(um(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Er=ii(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Er=null}}else Er=Nr?ii(e.stateNode.nextSibling):null;return!0}function bx(){for(var e=Er;e;)e=ii(e.nextSibling)}function Ns(){Er=Nr=null,st=!1}function cf(e){Qr===null?Qr=[e]:Qr.push(e)}var uS=Dn.ReactCurrentBatchConfig;function Xs(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(ee(309));var n=r.stateNode}if(!n)throw Error(ee(147,e));var i=n,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(ee(284));if(!r._owner)throw Error(ee(290,e))}return e}function Il(e,t){throw e=Object.prototype.toString.call(t),Error(ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function hm(e){var t=e._init;return t(e._payload)}function wx(e){function t(_,x){if(e){var w=_.deletions;w===null?(_.deletions=[x],_.flags|=16):w.push(x)}}function r(_,x){if(!e)return null;for(;x!==null;)t(_,x),x=x.sibling;return null}function n(_,x){for(_=new Map;x!==null;)x.key!==null?_.set(x.key,x):_.set(x.index,x),x=x.sibling;return _}function i(_,x){return _=ai(_,x),_.index=0,_.sibling=null,_}function s(_,x,w){return _.index=w,e?(w=_.alternate,w!==null?(w=w.index,w<x?(_.flags|=2,x):w):(_.flags|=2,x)):(_.flags|=1048576,x)}function o(_){return e&&_.alternate===null&&(_.flags|=2),_}function l(_,x,w,N){return x===null||x.tag!==6?(x=su(w,_.mode,N),x.return=_,x):(x=i(x,w),x.return=_,x)}function a(_,x,w,N){var L=w.type;return L===os?d(_,x,w.props.children,N,w.key):x!==null&&(x.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===Kn&&hm(L)===x.type)?(N=i(x,w.props),N.ref=Xs(_,x,w),N.return=_,N):(N=la(w.type,w.key,w.props,null,_.mode,N),N.ref=Xs(_,x,w),N.return=_,N)}function c(_,x,w,N){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=ou(w,_.mode,N),x.return=_,x):(x=i(x,w.children||[]),x.return=_,x)}function d(_,x,w,N,L){return x===null||x.tag!==7?(x=Ai(w,_.mode,N,L),x.return=_,x):(x=i(x,w),x.return=_,x)}function h(_,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=su(""+x,_.mode,w),x.return=_,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case wl:return w=la(x.type,x.key,x.props,null,_.mode,w),w.ref=Xs(_,null,x),w.return=_,w;case ss:return x=ou(x,_.mode,w),x.return=_,x;case Kn:var N=x._init;return h(_,N(x._payload),w)}if(uo(x)||Us(x))return x=Ai(x,_.mode,w,null),x.return=_,x;Il(_,x)}return null}function f(_,x,w,N){var L=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return L!==null?null:l(_,x,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case wl:return w.key===L?a(_,x,w,N):null;case ss:return w.key===L?c(_,x,w,N):null;case Kn:return L=w._init,f(_,x,L(w._payload),N)}if(uo(w)||Us(w))return L!==null?null:d(_,x,w,N,null);Il(_,w)}return null}function p(_,x,w,N,L){if(typeof N=="string"&&N!==""||typeof N=="number")return _=_.get(w)||null,l(x,_,""+N,L);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case wl:return _=_.get(N.key===null?w:N.key)||null,a(x,_,N,L);case ss:return _=_.get(N.key===null?w:N.key)||null,c(x,_,N,L);case Kn:var C=N._init;return p(_,x,w,C(N._payload),L)}if(uo(N)||Us(N))return _=_.get(w)||null,d(x,_,N,L,null);Il(x,N)}return null}function m(_,x,w,N){for(var L=null,C=null,F=x,P=x=0,q=null;F!==null&&P<w.length;P++){F.index>P?(q=F,F=null):q=F.sibling;var E=f(_,F,w[P],N);if(E===null){F===null&&(F=q);break}e&&F&&E.alternate===null&&t(_,F),x=s(E,x,P),C===null?L=E:C.sibling=E,C=E,F=q}if(P===w.length)return r(_,F),st&&Ei(_,P),L;if(F===null){for(;P<w.length;P++)F=h(_,w[P],N),F!==null&&(x=s(F,x,P),C===null?L=F:C.sibling=F,C=F);return st&&Ei(_,P),L}for(F=n(_,F);P<w.length;P++)q=p(F,_,P,w[P],N),q!==null&&(e&&q.alternate!==null&&F.delete(q.key===null?P:q.key),x=s(q,x,P),C===null?L=q:C.sibling=q,C=q);return e&&F.forEach(function(A){return t(_,A)}),st&&Ei(_,P),L}function g(_,x,w,N){var L=Us(w);if(typeof L!="function")throw Error(ee(150));if(w=L.call(w),w==null)throw Error(ee(151));for(var C=L=null,F=x,P=x=0,q=null,E=w.next();F!==null&&!E.done;P++,E=w.next()){F.index>P?(q=F,F=null):q=F.sibling;var A=f(_,F,E.value,N);if(A===null){F===null&&(F=q);break}e&&F&&A.alternate===null&&t(_,F),x=s(A,x,P),C===null?L=A:C.sibling=A,C=A,F=q}if(E.done)return r(_,F),st&&Ei(_,P),L;if(F===null){for(;!E.done;P++,E=w.next())E=h(_,E.value,N),E!==null&&(x=s(E,x,P),C===null?L=E:C.sibling=E,C=E);return st&&Ei(_,P),L}for(F=n(_,F);!E.done;P++,E=w.next())E=p(F,_,P,E.value,N),E!==null&&(e&&E.alternate!==null&&F.delete(E.key===null?P:E.key),x=s(E,x,P),C===null?L=E:C.sibling=E,C=E);return e&&F.forEach(function(R){return t(_,R)}),st&&Ei(_,P),L}function S(_,x,w,N){if(typeof w=="object"&&w!==null&&w.type===os&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case wl:e:{for(var L=w.key,C=x;C!==null;){if(C.key===L){if(L=w.type,L===os){if(C.tag===7){r(_,C.sibling),x=i(C,w.props.children),x.return=_,_=x;break e}}else if(C.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===Kn&&hm(L)===C.type){r(_,C.sibling),x=i(C,w.props),x.ref=Xs(_,C,w),x.return=_,_=x;break e}r(_,C);break}else t(_,C);C=C.sibling}w.type===os?(x=Ai(w.props.children,_.mode,N,w.key),x.return=_,_=x):(N=la(w.type,w.key,w.props,null,_.mode,N),N.ref=Xs(_,x,w),N.return=_,_=N)}return o(_);case ss:e:{for(C=w.key;x!==null;){if(x.key===C)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){r(_,x.sibling),x=i(x,w.children||[]),x.return=_,_=x;break e}else{r(_,x);break}else t(_,x);x=x.sibling}x=ou(w,_.mode,N),x.return=_,_=x}return o(_);case Kn:return C=w._init,S(_,x,C(w._payload),N)}if(uo(w))return m(_,x,w,N);if(Us(w))return g(_,x,w,N);Il(_,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(r(_,x.sibling),x=i(x,w),x.return=_,_=x):(r(_,x),x=su(w,_.mode,N),x.return=_,_=x),o(_)):r(_,x)}return S}var Ps=wx(!0),Sx=wx(!1),Da=fi(null),ja=null,ps=null,uf=null;function hf(){uf=ps=ja=null}function df(e){var t=Da.current;it(Da),e._currentValue=t}function bh(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function ws(e,t){ja=e,uf=ps=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(pr=!0),e.firstContext=null)}function Ur(e){var t=e._currentValue;if(uf!==e)if(e={context:e,memoizedValue:t,next:null},ps===null){if(ja===null)throw Error(ee(308));ps=e,ja.dependencies={lanes:0,firstContext:e}}else ps=ps.next=e;return t}var Mi=null;function ff(e){Mi===null?Mi=[e]:Mi.push(e)}function kx(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,ff(t)):(r.next=i.next,i.next=r),t.interleaved=r,Rn(e,n)}function Rn(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var qn=!1;function pf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cx(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Pn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function si(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Xe&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,Rn(e,r)}return i=n.interleaved,i===null?(t.next=t,ff(n)):(t.next=i.next,i.next=t),n.interleaved=t,Rn(e,r)}function ta(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Jd(e,r)}}function dm(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=t:s=s.next=t}else i=s=t;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Aa(e,t,r,n){var i=e.updateQueue;qn=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var a=l,c=a.next;a.next=null,o===null?s=c:o.next=c,o=a;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=c:l.next=c,d.lastBaseUpdate=a))}if(s!==null){var h=i.baseState;o=0,d=c=a=null,l=s;do{var f=l.lane,p=l.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,g=l;switch(f=t,p=r,g.tag){case 1:if(m=g.payload,typeof m=="function"){h=m.call(p,h,f);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m=="function"?m.call(p,h,f):m,f==null)break e;h=dt({},h,f);break e;case 2:qn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(c=d=p,a=h):d=d.next=p,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;f=l,l=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(d===null&&(a=h),i.baseState=a,i.firstBaseUpdate=c,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Wi|=o,e.lanes=o,e.memoizedState=h}}function fm(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(i!==null){if(n.callback=null,n=r,typeof i!="function")throw Error(ee(191,i));i.call(n)}}}var ul={},fn=fi(ul),Vo=fi(ul),Ko=fi(ul);function Ii(e){if(e===ul)throw Error(ee(174));return e}function mf(e,t){switch(tt(Ko,t),tt(Vo,e),tt(fn,ul),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:th(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=th(t,e)}it(fn),tt(fn,t)}function Ts(){it(fn),it(Vo),it(Ko)}function Ex(e){Ii(Ko.current);var t=Ii(fn.current),r=th(t,e.type);t!==r&&(tt(Vo,e),tt(fn,r))}function gf(e){Vo.current===e&&(it(fn),it(Vo))}var ut=fi(0);function Ba(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Zc=[];function _f(){for(var e=0;e<Zc.length;e++)Zc[e]._workInProgressVersionPrimary=null;Zc.length=0}var ra=Dn.ReactCurrentDispatcher,eu=Dn.ReactCurrentBatchConfig,Fi=0,ht=null,Tt=null,jt=null,Oa=!1,ko=!1,qo=0,hS=0;function Kt(){throw Error(ee(321))}function vf(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!rn(e[r],t[r]))return!1;return!0}function xf(e,t,r,n,i,s){if(Fi=s,ht=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ra.current=e===null||e.memoizedState===null?mS:gS,e=r(n,i),ko){s=0;do{if(ko=!1,qo=0,25<=s)throw Error(ee(301));s+=1,jt=Tt=null,t.updateQueue=null,ra.current=_S,e=r(n,i)}while(ko)}if(ra.current=za,t=Tt!==null&&Tt.next!==null,Fi=0,jt=Tt=ht=null,Oa=!1,t)throw Error(ee(300));return e}function yf(){var e=qo!==0;return qo=0,e}function an(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jt===null?ht.memoizedState=jt=e:jt=jt.next=e,jt}function Vr(){if(Tt===null){var e=ht.alternate;e=e!==null?e.memoizedState:null}else e=Tt.next;var t=jt===null?ht.memoizedState:jt.next;if(t!==null)jt=t,Tt=e;else{if(e===null)throw Error(ee(310));Tt=e,e={memoizedState:Tt.memoizedState,baseState:Tt.baseState,baseQueue:Tt.baseQueue,queue:Tt.queue,next:null},jt===null?ht.memoizedState=jt=e:jt=jt.next=e}return jt}function Yo(e,t){return typeof t=="function"?t(e):t}function tu(e){var t=Vr(),r=t.queue;if(r===null)throw Error(ee(311));r.lastRenderedReducer=e;var n=Tt,i=n.baseQueue,s=r.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}n.baseQueue=i=s,r.pending=null}if(i!==null){s=i.next,n=n.baseState;var l=o=null,a=null,c=s;do{var d=c.lane;if((Fi&d)===d)a!==null&&(a=a.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),n=c.hasEagerState?c.eagerState:e(n,c.action);else{var h={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=h,o=n):a=a.next=h,ht.lanes|=d,Wi|=d}c=c.next}while(c!==null&&c!==s);a===null?o=n:a.next=l,rn(n,t.memoizedState)||(pr=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=a,r.lastRenderedState=n}if(e=r.interleaved,e!==null){i=e;do s=i.lane,ht.lanes|=s,Wi|=s,i=i.next;while(i!==e)}else i===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function ru(e){var t=Vr(),r=t.queue;if(r===null)throw Error(ee(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,s=t.memoizedState;if(i!==null){r.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);rn(s,t.memoizedState)||(pr=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function Nx(){}function Px(e,t){var r=ht,n=Vr(),i=t(),s=!rn(n.memoizedState,i);if(s&&(n.memoizedState=i,pr=!0),n=n.queue,bf(Rx.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||jt!==null&&jt.memoizedState.tag&1){if(r.flags|=2048,Xo(9,Lx.bind(null,r,n,i,t),void 0,null),zt===null)throw Error(ee(349));Fi&30||Tx(r,t,i)}return i}function Tx(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ht.updateQueue,t===null?(t={lastEffect:null,stores:null},ht.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Lx(e,t,r,n){t.value=r,t.getSnapshot=n,Mx(t)&&Ix(e)}function Rx(e,t,r){return r(function(){Mx(t)&&Ix(e)})}function Mx(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!rn(e,r)}catch{return!0}}function Ix(e){var t=Rn(e,1);t!==null&&Zr(t,e,1,-1)}function pm(e){var t=an();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:e},t.queue=e,e=e.dispatch=pS.bind(null,ht,e),[t.memoizedState,e]}function Xo(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ht.updateQueue,t===null?(t={lastEffect:null,stores:null},ht.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function Dx(){return Vr().memoizedState}function na(e,t,r,n){var i=an();ht.flags|=e,i.memoizedState=Xo(1|t,r,void 0,n===void 0?null:n)}function hc(e,t,r,n){var i=Vr();n=n===void 0?null:n;var s=void 0;if(Tt!==null){var o=Tt.memoizedState;if(s=o.destroy,n!==null&&vf(n,o.deps)){i.memoizedState=Xo(t,r,s,n);return}}ht.flags|=e,i.memoizedState=Xo(1|t,r,s,n)}function mm(e,t){return na(8390656,8,e,t)}function bf(e,t){return hc(2048,8,e,t)}function jx(e,t){return hc(4,2,e,t)}function Ax(e,t){return hc(4,4,e,t)}function Bx(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ox(e,t,r){return r=r!=null?r.concat([e]):null,hc(4,4,Bx.bind(null,t,e),r)}function wf(){}function zx(e,t){var r=Vr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&vf(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function $x(e,t){var r=Vr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&vf(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Fx(e,t,r){return Fi&21?(rn(r,t)||(r=Kv(),ht.lanes|=r,Wi|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,pr=!0),e.memoizedState=r)}function dS(e,t){var r=Qe;Qe=r!==0&&4>r?r:4,e(!0);var n=eu.transition;eu.transition={};try{e(!1),t()}finally{Qe=r,eu.transition=n}}function Wx(){return Vr().memoizedState}function fS(e,t,r){var n=li(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Hx(e))Ux(t,r);else if(r=kx(e,t,r,n),r!==null){var i=nr();Zr(r,e,n,i),Vx(r,t,n)}}function pS(e,t,r){var n=li(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Hx(e))Ux(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,r);if(i.hasEagerState=!0,i.eagerState=l,rn(l,o)){var a=t.interleaved;a===null?(i.next=i,ff(t)):(i.next=a.next,a.next=i),t.interleaved=i;return}}catch{}finally{}r=kx(e,t,i,n),r!==null&&(i=nr(),Zr(r,e,n,i),Vx(r,t,n))}}function Hx(e){var t=e.alternate;return e===ht||t!==null&&t===ht}function Ux(e,t){ko=Oa=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Vx(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Jd(e,r)}}var za={readContext:Ur,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},mS={readContext:Ur,useCallback:function(e,t){return an().memoizedState=[e,t===void 0?null:t],e},useContext:Ur,useEffect:mm,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,na(4194308,4,Bx.bind(null,t,e),r)},useLayoutEffect:function(e,t){return na(4194308,4,e,t)},useInsertionEffect:function(e,t){return na(4,2,e,t)},useMemo:function(e,t){var r=an();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=an();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=fS.bind(null,ht,e),[n.memoizedState,e]},useRef:function(e){var t=an();return e={current:e},t.memoizedState=e},useState:pm,useDebugValue:wf,useDeferredValue:function(e){return an().memoizedState=e},useTransition:function(){var e=pm(!1),t=e[0];return e=dS.bind(null,e[1]),an().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ht,i=an();if(st){if(r===void 0)throw Error(ee(407));r=r()}else{if(r=t(),zt===null)throw Error(ee(349));Fi&30||Tx(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,mm(Rx.bind(null,n,s,e),[e]),n.flags|=2048,Xo(9,Lx.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=an(),t=zt.identifierPrefix;if(st){var r=En,n=Cn;r=(n&~(1<<32-Jr(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=qo++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=hS++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},gS={readContext:Ur,useCallback:zx,useContext:Ur,useEffect:bf,useImperativeHandle:Ox,useInsertionEffect:jx,useLayoutEffect:Ax,useMemo:$x,useReducer:tu,useRef:Dx,useState:function(){return tu(Yo)},useDebugValue:wf,useDeferredValue:function(e){var t=Vr();return Fx(t,Tt.memoizedState,e)},useTransition:function(){var e=tu(Yo)[0],t=Vr().memoizedState;return[e,t]},useMutableSource:Nx,useSyncExternalStore:Px,useId:Wx,unstable_isNewReconciler:!1},_S={readContext:Ur,useCallback:zx,useContext:Ur,useEffect:bf,useImperativeHandle:Ox,useInsertionEffect:jx,useLayoutEffect:Ax,useMemo:$x,useReducer:ru,useRef:Dx,useState:function(){return ru(Yo)},useDebugValue:wf,useDeferredValue:function(e){var t=Vr();return Tt===null?t.memoizedState=e:Fx(t,Tt.memoizedState,e)},useTransition:function(){var e=ru(Yo)[0],t=Vr().memoizedState;return[e,t]},useMutableSource:Nx,useSyncExternalStore:Px,useId:Wx,unstable_isNewReconciler:!1};function Xr(e,t){if(e&&e.defaultProps){t=dt({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function wh(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:dt({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var dc={isMounted:function(e){return(e=e._reactInternals)?Yi(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=nr(),i=li(e),s=Pn(n,i);s.payload=t,r!=null&&(s.callback=r),t=si(e,s,i),t!==null&&(Zr(t,e,i,n),ta(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=nr(),i=li(e),s=Pn(n,i);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=si(e,s,i),t!==null&&(Zr(t,e,i,n),ta(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=nr(),n=li(e),i=Pn(r,n);i.tag=2,t!=null&&(i.callback=t),t=si(e,i,n),t!==null&&(Zr(t,e,n,r),ta(t,e,n))}};function gm(e,t,r,n,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,s,o):t.prototype&&t.prototype.isPureReactComponent?!Fo(r,n)||!Fo(i,s):!0}function Kx(e,t,r){var n=!1,i=hi,s=t.contextType;return typeof s=="object"&&s!==null?s=Ur(s):(i=gr(t)?zi:Qt.current,n=t.contextTypes,s=(n=n!=null)?Es(e,i):hi),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=dc,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function _m(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&dc.enqueueReplaceState(t,t.state,null)}function Sh(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs={},pf(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Ur(s):(s=gr(t)?zi:Qt.current,i.context=Es(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(wh(e,t,s,r),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&dc.enqueueReplaceState(i,i.state,null),Aa(e,r,i,n),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Ls(e,t){try{var r="",n=t;do r+=Vb(n),n=n.return;while(n);var i=r}catch(s){i=`
|
|
39
39
|
Error generating stack: `+s.message+`
|
|
40
|
-
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function nu(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function kh(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var vS=typeof WeakMap=="function"?WeakMap:Map;function qx(e,t,r){r=Tn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Fa||(Fa=!0,Dh=n),kh(e,t)},r}function Yx(e,t,r){r=Tn(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){kh(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){kh(e,t),typeof n!="function"&&(oi===null?oi=new Set([this]):oi.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function vm(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new vS;var i=new Set;n.set(t,i)}else i=n.get(t),i===void 0&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=MS.bind(null,e,t,r),t.then(e,e))}function xm(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ym(e,t,r,n,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Tn(-1,1),t.tag=2,si(r,t,1))),r.lanes|=1),e)}var xS=Dn.ReactCurrentOwner,pr=!1;function tr(e,t,r,n){t.child=e===null?Sx(t,null,r,n):Ts(t,e.child,r,n)}function bm(e,t,r,n,i){r=r.render;var s=t.ref;return ws(t,i),n=xf(e,t,r,n,s,i),r=yf(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Mn(e,t,i)):(st&&r&&lf(t),t.flags|=1,tr(e,t,n,i),t.child)}function wm(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!Lf(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,Xx(e,t,s,n,i)):(e=la(r.type,null,n,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:Fo,r(o,n)&&e.ref===t.ref)return Mn(e,t,i)}return t.flags|=1,e=ai(s,n),e.ref=t.ref,e.return=t,t.child=e}function Xx(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(Fo(s,n)&&e.ref===t.ref)if(pr=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&(pr=!0);else return t.lanes=e.lanes,Mn(e,t,i)}return Ch(e,t,r,n,i)}function Gx(e,t,r){var n=t.pendingProps,i=n.children,s=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(gs,Cr),Cr|=r;else{if(!(r&1073741824))return e=s!==null?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,tt(gs,Cr),Cr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,tt(gs,Cr),Cr|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,tt(gs,Cr),Cr|=n;return tr(e,t,i,r),t.child}function Qx(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ch(e,t,r,n,i){var s=gr(r)?zi:Qt.current;return s=Es(t,s),ws(t,i),r=xf(e,t,r,n,s,i),n=yf(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Mn(e,t,i)):(st&&n&&lf(t),t.flags|=1,tr(e,t,r,i),t.child)}function Sm(e,t,r,n,i){if(gr(r)){var s=!0;Ra(t)}else s=!1;if(ws(t,i),t.stateNode===null)ia(e,t),Kx(t,r,n),Sh(t,r,n,i),n=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var a=o.context,c=r.contextType;typeof c=="object"&&c!==null?c=Ur(c):(c=gr(r)?zi:Qt.current,c=Es(t,c));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||a!==c)&&_m(t,o,n,c),qn=!1;var f=t.memoizedState;o.state=f,Aa(t,n,o,i),a=t.memoizedState,l!==n||f!==a||mr.current||qn?(typeof d=="function"&&(wh(t,r,d,n),a=t.memoizedState),(l=qn||gm(t,r,l,n,f,a,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=a),o.props=n,o.state=a,o.context=c,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,Cx(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Xr(t.type,l),o.props=c,h=t.pendingProps,f=o.context,a=r.contextType,typeof a=="object"&&a!==null?a=Ur(a):(a=gr(r)?zi:Qt.current,a=Es(t,a));var p=r.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||f!==a)&&_m(t,o,n,a),qn=!1,f=t.memoizedState,o.state=f,Aa(t,n,o,i);var m=t.memoizedState;l!==h||f!==m||mr.current||qn?(typeof p=="function"&&(wh(t,r,p,n),m=t.memoizedState),(c=qn||gm(t,r,c,n,f,m,a)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=a,n=c):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return Eh(e,t,r,n,s,i)}function Eh(e,t,r,n,i,s){Qx(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&am(t,r,!1),Mn(e,t,s);n=t.stateNode,xS.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=Ts(t,e.child,null,s),t.child=Ts(t,null,l,s)):tr(e,t,l,s),t.memoizedState=n.state,i&&am(t,r,!0),t.child}function Jx(e){var t=e.stateNode;t.pendingContext?lm(e,t.pendingContext,t.pendingContext!==t.context):t.context&&lm(e,t.context,!1),mf(e,t.containerInfo)}function km(e,t,r,n,i){return Ns(),cf(i),t.flags|=256,tr(e,t,r,n),t.child}var Nh={dehydrated:null,treeContext:null,retryLane:0};function Th(e){return{baseLanes:e,cachePool:null,transitions:null}}function Zx(e,t,r){var n=t.pendingProps,i=ut.current,s=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),tt(ut,i&1),e===null)return yh(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=n.children,e=n.fallback,s?(n=t.mode,s=t.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=mc(o,n,0,null),e=Ai(e,n,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Th(r),t.memoizedState=Nh,e):Sf(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return yS(e,t,o,n,l,i,r);if(s){s=n.fallback,o=t.mode,i=e.child,l=i.sibling;var a={mode:"hidden",children:n.children};return!(o&1)&&t.child!==i?(n=t.child,n.childLanes=0,n.pendingProps=a,t.deletions=null):(n=ai(i,a),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=ai(l,s):(s=Ai(s,o,r,null),s.flags|=2),s.return=t,n.return=t,n.sibling=s,t.child=n,n=s,s=t.child,o=e.child.memoizedState,o=o===null?Th(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=Nh,n}return s=e.child,e=s.sibling,n=ai(s,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function Sf(e,t){return t=mc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Dl(e,t,r,n){return n!==null&&cf(n),Ts(t,e.child,null,r),e=Sf(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yS(e,t,r,n,i,s,o){if(r)return t.flags&256?(t.flags&=-257,n=nu(Error(ee(422))),Dl(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=mc({mode:"visible",children:n.children},i,0,null),s=Ai(s,i,o,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,t.mode&1&&Ts(t,e.child,null,o),t.child.memoizedState=Th(o),t.memoizedState=Nh,s);if(!(t.mode&1))return Dl(e,t,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,s=Error(ee(419)),n=nu(s,n,void 0),Dl(e,t,o,n)}if(l=(o&e.childLanes)!==0,pr||l){if(n=zt,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Rn(e,i),Zr(n,e,i,-1))}return Pf(),n=nu(Error(ee(421))),Dl(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=IS.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,Er=ii(i.nextSibling),Nr=t,st=!0,Qr=null,e!==null&&(Or[zr++]=Cn,Or[zr++]=En,Or[zr++]=$i,Cn=e.id,En=e.overflow,$i=t),t=Sf(t,n.children),t.flags|=4096,t)}function Cm(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),bh(e.return,t,r)}function iu(e,t,r,n,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function e0(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(tr(e,t,n.children,r),n=ut.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cm(e,r,t);else if(e.tag===19)Cm(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(tt(ut,n),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;r!==null;)e=r.alternate,e!==null&&Ba(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),iu(t,!1,i,r,s);break;case"backwards":for(r=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ba(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}iu(t,!0,r,null,s);break;case"together":iu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ia(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Mn(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Wi|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ee(153));if(t.child!==null){for(e=t.child,r=ai(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=ai(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function bS(e,t,r){switch(t.tag){case 3:Jx(t),Ns();break;case 5:Ex(t);break;case 1:gr(t.type)&&Ra(t);break;case 4:mf(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;tt(Da,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(tt(ut,ut.current&1),t.flags|=128,null):r&t.child.childLanes?Zx(e,t,r):(tt(ut,ut.current&1),e=Mn(e,t,r),e!==null?e.sibling:null);tt(ut,ut.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return e0(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),tt(ut,ut.current),n)break;return null;case 22:case 23:return t.lanes=0,Gx(e,t,r)}return Mn(e,t,r)}var t0,Ph,r0,n0;t0=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Ph=function(){};r0=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,Ii(fn.current);var s=null;switch(r){case"input":i=Qu(e,i),n=Qu(e,n),s=[];break;case"select":i=dt({},i,{value:void 0}),n=dt({},n,{value:void 0}),s=[];break;case"textarea":i=eh(e,i),n=eh(e,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Pa)}rh(r,n);var o;r=null;for(c in i)if(!n.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var l=i[c];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Do.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in n){var a=n[c];if(l=i!=null?i[c]:void 0,n.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(r||(r={}),r[o]=a[o])}else r||(s||(s=[]),s.push(c,r)),r=a;else c==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(s=s||[]).push(c,a)):c==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(c,""+a):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Do.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&rt("scroll",e),s||l===a||(s=[])):(s=s||[]).push(c,a))}r&&(s=s||[]).push("style",r);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};n0=function(e,t,r,n){r!==n&&(t.flags|=4)};function Gs(e,t){if(!st)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function qt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function wS(e,t,r){var n=t.pendingProps;switch(af(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(t),null;case 1:return gr(t.type)&&La(),qt(t),null;case 3:return n=t.stateNode,Ps(),it(mr),it(Qt),_f(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ml(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Qr!==null&&(Bh(Qr),Qr=null))),Ph(e,t),qt(t),null;case 5:gf(t);var i=Ii(Ko.current);if(r=t.type,e!==null&&t.stateNode!=null)r0(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(ee(166));return qt(t),null}if(e=Ii(fn.current),Ml(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[un]=t,n[Uo]=s,e=(t.mode&1)!==0,r){case"dialog":rt("cancel",n),rt("close",n);break;case"iframe":case"object":case"embed":rt("load",n);break;case"video":case"audio":for(i=0;i<fo.length;i++)rt(fo[i],n);break;case"source":rt("error",n);break;case"img":case"image":case"link":rt("error",n),rt("load",n);break;case"details":rt("toggle",n);break;case"input":Dp(n,s),rt("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},rt("invalid",n);break;case"textarea":Ap(n,s),rt("invalid",n)}rh(r,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?n.textContent!==l&&(s.suppressHydrationWarning!==!0&&Rl(n.textContent,l,e),i=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Rl(n.textContent,l,e),i=["children",""+l]):Do.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&rt("scroll",n)}switch(r){case"input":Sl(n),jp(n,s,!0);break;case"textarea":Sl(n),Bp(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=Pa)}n=i,t.updateQueue=n,n!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Rv(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[un]=t,e[Uo]=n,t0(e,t,!1,!1),t.stateNode=e;e:{switch(o=nh(r,n),r){case"dialog":rt("cancel",e),rt("close",e),i=n;break;case"iframe":case"object":case"embed":rt("load",e),i=n;break;case"video":case"audio":for(i=0;i<fo.length;i++)rt(fo[i],e);i=n;break;case"source":rt("error",e),i=n;break;case"img":case"image":case"link":rt("error",e),rt("load",e),i=n;break;case"details":rt("toggle",e),i=n;break;case"input":Dp(e,n),i=Qu(e,n),rt("invalid",e);break;case"option":i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=dt({},n,{value:void 0}),rt("invalid",e);break;case"textarea":Ap(e,n),i=eh(e,n),rt("invalid",e);break;default:i=n}rh(r,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?Dv(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&Mv(e,a)):s==="children"?typeof a=="string"?(r!=="textarea"||a!=="")&&jo(e,a):typeof a=="number"&&jo(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Do.hasOwnProperty(s)?a!=null&&s==="onScroll"&&rt("scroll",e):a!=null&&Kd(e,s,a,o))}switch(r){case"input":Sl(e),jp(e,n,!1);break;case"textarea":Sl(e),Bp(e);break;case"option":n.value!=null&&e.setAttribute("value",""+ui(n.value));break;case"select":e.multiple=!!n.multiple,s=n.value,s!=null?vs(e,!!n.multiple,s,!1):n.defaultValue!=null&&vs(e,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Pa)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return qt(t),null;case 6:if(e&&t.stateNode!=null)n0(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(ee(166));if(r=Ii(Ko.current),Ii(fn.current),Ml(t)){if(n=t.stateNode,r=t.memoizedProps,n[un]=t,(s=n.nodeValue!==r)&&(e=Nr,e!==null))switch(e.tag){case 3:Rl(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Rl(n.nodeValue,r,(e.mode&1)!==0)}s&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[un]=t,t.stateNode=n}return qt(t),null;case 13:if(it(ut),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(st&&Er!==null&&t.mode&1&&!(t.flags&128))bx(),Ns(),t.flags|=98560,s=!1;else if(s=Ml(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(ee(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ee(317));s[un]=t}else Ns(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;qt(t),s=!1}else Qr!==null&&(Bh(Qr),Qr=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||ut.current&1?Lt===0&&(Lt=3):Pf())),t.updateQueue!==null&&(t.flags|=4),qt(t),null);case 4:return Ps(),Ph(e,t),e===null&&Wo(t.stateNode.containerInfo),qt(t),null;case 10:return df(t.type._context),qt(t),null;case 17:return gr(t.type)&&La(),qt(t),null;case 19:if(it(ut),s=t.memoizedState,s===null)return qt(t),null;if(n=(t.flags&128)!==0,o=s.rendering,o===null)if(n)Gs(s,!1);else{if(Lt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Ba(e),o!==null){for(t.flags|=128,Gs(s,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)s=r,e=n,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return tt(ut,ut.current&1|2),t.child}e=e.sibling}s.tail!==null&&xt()>Rs&&(t.flags|=128,n=!0,Gs(s,!1),t.lanes=4194304)}else{if(!n)if(e=Ba(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Gs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!st)return qt(t),null}else 2*xt()-s.renderingStartTime>Rs&&r!==1073741824&&(t.flags|=128,n=!0,Gs(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=xt(),t.sibling=null,r=ut.current,tt(ut,n?r&1|2:r&1),t):(qt(t),null);case 22:case 23:return Tf(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Cr&1073741824&&(qt(t),t.subtreeFlags&6&&(t.flags|=8192)):qt(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function SS(e,t){switch(af(t),t.tag){case 1:return gr(t.type)&&La(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ps(),it(mr),it(Qt),_f(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return gf(t),null;case 13:if(it(ut),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));Ns()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return it(ut),null;case 4:return Ps(),null;case 10:return df(t.type._context),null;case 22:case 23:return Tf(),null;case 24:return null;default:return null}}var jl=!1,Xt=!1,kS=typeof WeakSet=="function"?WeakSet:Set,xe=null;function ms(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){gt(e,t,n)}else r.current=null}function Lh(e,t,r){try{r()}catch(n){gt(e,t,n)}}var Em=!1;function CS(e,t){if(fh=Ea,e=ax(),of(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,l=-1,a=-1,c=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==r||i!==0&&h.nodeType!==3||(l=o+i),h!==s||n!==0&&h.nodeType!==3||(a=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===e)break t;if(f===r&&++c===i&&(l=o),f===s&&++d===n&&(a=o),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(ph={focusedElem:e,selectionRange:r},Ea=!1,xe=t;xe!==null;)if(t=xe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xe=e;else for(;xe!==null;){t=xe;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,S=m.memoizedState,_=t.stateNode,x=_.getSnapshotBeforeUpdate(t.elementType===t.type?g:Xr(t.type,g),S);_.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(N){gt(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,xe=e;break}xe=t.return}return m=Em,Em=!1,m}function Co(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Lh(t,r,s)}i=i.next}while(i!==n)}}function fc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Rh(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function i0(e){var t=e.alternate;t!==null&&(e.alternate=null,i0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[un],delete t[Uo],delete t[_h],delete t[lS],delete t[aS])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function s0(e){return e.tag===5||e.tag===3||e.tag===4}function Nm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||s0(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Mh(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Pa));else if(n!==4&&(e=e.child,e!==null))for(Mh(e,t,r),e=e.sibling;e!==null;)Mh(e,t,r),e=e.sibling}function Ih(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Ih(e,t,r),e=e.sibling;e!==null;)Ih(e,t,r),e=e.sibling}var Ft=null,Gr=!1;function zn(e,t,r){for(r=r.child;r!==null;)o0(e,t,r),r=r.sibling}function o0(e,t,r){if(dn&&typeof dn.onCommitFiberUnmount=="function")try{dn.onCommitFiberUnmount(sc,r)}catch{}switch(r.tag){case 5:Xt||ms(r,t);case 6:var n=Ft,i=Gr;Ft=null,zn(e,t,r),Ft=n,Gr=i,Ft!==null&&(Gr?(e=Ft,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ft.removeChild(r.stateNode));break;case 18:Ft!==null&&(Gr?(e=Ft,r=r.stateNode,e.nodeType===8?Qc(e.parentNode,r):e.nodeType===1&&Qc(e,r),zo(e)):Qc(Ft,r.stateNode));break;case 4:n=Ft,i=Gr,Ft=r.stateNode.containerInfo,Gr=!0,zn(e,t,r),Ft=n,Gr=i;break;case 0:case 11:case 14:case 15:if(!Xt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Lh(r,t,o),i=i.next}while(i!==n)}zn(e,t,r);break;case 1:if(!Xt&&(ms(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){gt(r,t,l)}zn(e,t,r);break;case 21:zn(e,t,r);break;case 22:r.mode&1?(Xt=(n=Xt)||r.memoizedState!==null,zn(e,t,r),Xt=n):zn(e,t,r);break;default:zn(e,t,r)}}function Tm(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new kS),t.forEach(function(n){var i=DS.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function qr(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var i=r[n];try{var s=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ft=l.stateNode,Gr=!1;break e;case 3:Ft=l.stateNode.containerInfo,Gr=!0;break e;case 4:Ft=l.stateNode.containerInfo,Gr=!0;break e}l=l.return}if(Ft===null)throw Error(ee(160));o0(s,o,i),Ft=null,Gr=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(c){gt(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)l0(t,e),t=t.sibling}function l0(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(qr(t,e),nn(e),n&4){try{Co(3,e,e.return),fc(3,e)}catch(g){gt(e,e.return,g)}try{Co(5,e,e.return)}catch(g){gt(e,e.return,g)}}break;case 1:qr(t,e),nn(e),n&512&&r!==null&&ms(r,r.return);break;case 5:if(qr(t,e),nn(e),n&512&&r!==null&&ms(r,r.return),e.flags&32){var i=e.stateNode;try{jo(i,"")}catch(g){gt(e,e.return,g)}}if(n&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=r!==null?r.memoizedProps:s,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&Pv(i,s),nh(l,o);var c=nh(l,s);for(o=0;o<a.length;o+=2){var d=a[o],h=a[o+1];d==="style"?Dv(i,h):d==="dangerouslySetInnerHTML"?Mv(i,h):d==="children"?jo(i,h):Kd(i,d,h,c)}switch(l){case"input":Ju(i,s);break;case"textarea":Lv(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?vs(i,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?vs(i,!!s.multiple,s.defaultValue,!0):vs(i,!!s.multiple,s.multiple?[]:"",!1))}i[Uo]=s}catch(g){gt(e,e.return,g)}}break;case 6:if(qr(t,e),nn(e),n&4){if(e.stateNode===null)throw Error(ee(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(g){gt(e,e.return,g)}}break;case 3:if(qr(t,e),nn(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{zo(t.containerInfo)}catch(g){gt(e,e.return,g)}break;case 4:qr(t,e),nn(e);break;case 13:qr(t,e),nn(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Ef=xt())),n&4&&Tm(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(Xt=(c=Xt)||d,qr(t,e),Xt=c):qr(t,e),nn(e),n&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!d&&e.mode&1)for(xe=e,d=e.child;d!==null;){for(h=xe=d;xe!==null;){switch(f=xe,p=f.child,f.tag){case 0:case 11:case 14:case 15:Co(4,f,f.return);break;case 1:ms(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){gt(n,r,g)}}break;case 5:ms(f,f.return);break;case 22:if(f.memoizedState!==null){Lm(h);continue}}p!==null?(p.return=f,xe=p):Lm(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{i=h.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=h.stateNode,a=h.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=Iv("display",o))}catch(g){gt(e,e.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(g){gt(e,e.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:qr(t,e),nn(e),n&4&&Tm(e);break;case 21:break;default:qr(t,e),nn(e)}}function nn(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(s0(r)){var n=r;break e}r=r.return}throw Error(ee(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(jo(i,""),n.flags&=-33);var s=Nm(e);Ih(e,s,i);break;case 3:case 4:var o=n.stateNode.containerInfo,l=Nm(e);Mh(e,l,o);break;default:throw Error(ee(161))}}catch(a){gt(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ES(e,t,r){xe=e,a0(e)}function a0(e,t,r){for(var n=(e.mode&1)!==0;xe!==null;){var i=xe,s=i.child;if(i.tag===22&&n){var o=i.memoizedState!==null||jl;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||Xt;l=jl;var c=Xt;if(jl=o,(Xt=a)&&!c)for(xe=i;xe!==null;)o=xe,a=o.child,o.tag===22&&o.memoizedState!==null?Rm(i):a!==null?(a.return=o,xe=a):Rm(i);for(;s!==null;)xe=s,a0(s),s=s.sibling;xe=i,jl=l,Xt=c}Pm(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,xe=s):Pm(e)}}function Pm(e){for(;xe!==null;){var t=xe;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Xt||fc(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Xt)if(r===null)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:Xr(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&fm(t,s,n);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}fm(t,o,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break;case"img":a.src&&(r.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&zo(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ee(163))}Xt||t.flags&512&&Rh(t)}catch(f){gt(t,t.return,f)}}if(t===e){xe=null;break}if(r=t.sibling,r!==null){r.return=t.return,xe=r;break}xe=t.return}}function Lm(e){for(;xe!==null;){var t=xe;if(t===e){xe=null;break}var r=t.sibling;if(r!==null){r.return=t.return,xe=r;break}xe=t.return}}function Rm(e){for(;xe!==null;){var t=xe;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{fc(4,t)}catch(a){gt(t,r,a)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var i=t.return;try{n.componentDidMount()}catch(a){gt(t,i,a)}}var s=t.return;try{Rh(t)}catch(a){gt(t,s,a)}break;case 5:var o=t.return;try{Rh(t)}catch(a){gt(t,o,a)}}}catch(a){gt(t,t.return,a)}if(t===e){xe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,xe=l;break}xe=t.return}}var NS=Math.ceil,$a=Dn.ReactCurrentDispatcher,kf=Dn.ReactCurrentOwner,Wr=Dn.ReactCurrentBatchConfig,Xe=0,zt=null,St=null,Ut=0,Cr=0,gs=fi(0),Lt=0,Go=null,Wi=0,pc=0,Cf=0,Eo=null,fr=null,Ef=0,Rs=1/0,bn=null,Fa=!1,Dh=null,oi=null,Al=!1,Jn=null,Wa=0,No=0,jh=null,sa=-1,oa=0;function nr(){return Xe&6?xt():sa!==-1?sa:sa=xt()}function li(e){return e.mode&1?Xe&2&&Ut!==0?Ut&-Ut:uS.transition!==null?(oa===0&&(oa=Kv()),oa):(e=Qe,e!==0||(e=window.event,e=e===void 0?16:Zv(e.type)),e):1}function Zr(e,t,r,n){if(50<No)throw No=0,jh=null,Error(ee(185));ll(e,r,n),(!(Xe&2)||e!==zt)&&(e===zt&&(!(Xe&2)&&(pc|=r),Lt===4&&Gn(e,Ut)),_r(e,n),r===1&&Xe===0&&!(t.mode&1)&&(Rs=xt()+500,uc&&pi()))}function _r(e,t){var r=e.callbackNode;uw(e,t);var n=Ca(e,e===zt?Ut:0);if(n===0)r!==null&&$p(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&$p(r),t===1)e.tag===0?cS(Mm.bind(null,e)):vx(Mm.bind(null,e)),sS(function(){!(Xe&6)&&pi()}),r=null;else{switch(qv(n)){case 1:r=Qd;break;case 4:r=Uv;break;case 16:r=ka;break;case 536870912:r=Vv;break;default:r=ka}r=g0(r,c0.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function c0(e,t){if(sa=-1,oa=0,Xe&6)throw Error(ee(327));var r=e.callbackNode;if(Ss()&&e.callbackNode!==r)return null;var n=Ca(e,e===zt?Ut:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Ha(e,n);else{t=n;var i=Xe;Xe|=2;var s=h0();(zt!==e||Ut!==t)&&(bn=null,Rs=xt()+500,ji(e,t));do try{LS();break}catch(l){u0(e,l)}while(!0);hf(),$a.current=s,Xe=i,St!==null?t=0:(zt=null,Ut=0,t=Lt)}if(t!==0){if(t===2&&(i=ah(e),i!==0&&(n=i,t=Ah(e,i))),t===1)throw r=Go,ji(e,0),Gn(e,n),_r(e,xt()),r;if(t===6)Gn(e,n);else{if(i=e.current.alternate,!(n&30)&&!TS(i)&&(t=Ha(e,n),t===2&&(s=ah(e),s!==0&&(n=s,t=Ah(e,s))),t===1))throw r=Go,ji(e,0),Gn(e,n),_r(e,xt()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(ee(345));case 2:Ni(e,fr,bn);break;case 3:if(Gn(e,n),(n&130023424)===n&&(t=Ef+500-xt(),10<t)){if(Ca(e,0)!==0)break;if(i=e.suspendedLanes,(i&n)!==n){nr(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=gh(Ni.bind(null,e,fr,bn),t);break}Ni(e,fr,bn);break;case 4:if(Gn(e,n),(n&4194240)===n)break;for(t=e.eventTimes,i=-1;0<n;){var o=31-Jr(n);s=1<<o,o=t[o],o>i&&(i=o),n&=~s}if(n=i,n=xt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*NS(n/1960))-n,10<n){e.timeoutHandle=gh(Ni.bind(null,e,fr,bn),n);break}Ni(e,fr,bn);break;case 5:Ni(e,fr,bn);break;default:throw Error(ee(329))}}}return _r(e,xt()),e.callbackNode===r?c0.bind(null,e):null}function Ah(e,t){var r=Eo;return e.current.memoizedState.isDehydrated&&(ji(e,t).flags|=256),e=Ha(e,t),e!==2&&(t=fr,fr=r,t!==null&&Bh(t)),e}function Bh(e){fr===null?fr=e:fr.push.apply(fr,e)}function TS(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var i=r[n],s=i.getSnapshot;i=i.value;try{if(!rn(s(),i))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gn(e,t){for(t&=~Cf,t&=~pc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Jr(t),n=1<<r;e[r]=-1,t&=~n}}function Mm(e){if(Xe&6)throw Error(ee(327));Ss();var t=Ca(e,0);if(!(t&1))return _r(e,xt()),null;var r=Ha(e,t);if(e.tag!==0&&r===2){var n=ah(e);n!==0&&(t=n,r=Ah(e,n))}if(r===1)throw r=Go,ji(e,0),Gn(e,t),_r(e,xt()),r;if(r===6)throw Error(ee(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ni(e,fr,bn),_r(e,xt()),null}function Nf(e,t){var r=Xe;Xe|=1;try{return e(t)}finally{Xe=r,Xe===0&&(Rs=xt()+500,uc&&pi())}}function Hi(e){Jn!==null&&Jn.tag===0&&!(Xe&6)&&Ss();var t=Xe;Xe|=1;var r=Wr.transition,n=Qe;try{if(Wr.transition=null,Qe=1,e)return e()}finally{Qe=n,Wr.transition=r,Xe=t,!(Xe&6)&&pi()}}function Tf(){Cr=gs.current,it(gs)}function ji(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,iS(r)),St!==null)for(r=St.return;r!==null;){var n=r;switch(af(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&La();break;case 3:Ps(),it(mr),it(Qt),_f();break;case 5:gf(n);break;case 4:Ps();break;case 13:it(ut);break;case 19:it(ut);break;case 10:df(n.type._context);break;case 22:case 23:Tf()}r=r.return}if(zt=e,St=e=ai(e.current,null),Ut=Cr=t,Lt=0,Go=null,Cf=pc=Wi=0,fr=Eo=null,Mi!==null){for(t=0;t<Mi.length;t++)if(r=Mi[t],n=r.interleaved,n!==null){r.interleaved=null;var i=n.next,s=r.pending;if(s!==null){var o=s.next;s.next=i,n.next=o}r.pending=n}Mi=null}return e}function u0(e,t){do{var r=St;try{if(hf(),ra.current=za,Oa){for(var n=ht.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}Oa=!1}if(Fi=0,jt=Pt=ht=null,ko=!1,qo=0,kf.current=null,r===null||r.return===null){Lt=1,Go=t,St=null;break}e:{var s=e,o=r.return,l=r,a=t;if(t=Ut,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var c=a,d=l,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=xm(o);if(p!==null){p.flags&=-257,ym(p,o,l,s,t),p.mode&1&&vm(s,c,t),t=p,a=c;var m=t.updateQueue;if(m===null){var g=new Set;g.add(a),t.updateQueue=g}else m.add(a);break e}else{if(!(t&1)){vm(s,c,t),Pf();break e}a=Error(ee(426))}}else if(st&&l.mode&1){var S=xm(o);if(S!==null){!(S.flags&65536)&&(S.flags|=256),ym(S,o,l,s,t),cf(Ls(a,l));break e}}s=a=Ls(a,l),Lt!==4&&(Lt=2),Eo===null?Eo=[s]:Eo.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var _=qx(s,a,t);dm(s,_);break e;case 1:l=a;var x=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(oi===null||!oi.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var N=Yx(s,l,t);dm(s,N);break e}}s=s.return}while(s!==null)}f0(r)}catch(L){t=L,St===r&&r!==null&&(St=r=r.return);continue}break}while(!0)}function h0(){var e=$a.current;return $a.current=za,e===null?za:e}function Pf(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),zt===null||!(Wi&268435455)&&!(pc&268435455)||Gn(zt,Ut)}function Ha(e,t){var r=Xe;Xe|=2;var n=h0();(zt!==e||Ut!==t)&&(bn=null,ji(e,t));do try{PS();break}catch(i){u0(e,i)}while(!0);if(hf(),Xe=r,$a.current=n,St!==null)throw Error(ee(261));return zt=null,Ut=0,Lt}function PS(){for(;St!==null;)d0(St)}function LS(){for(;St!==null&&!tw();)d0(St)}function d0(e){var t=m0(e.alternate,e,Cr);e.memoizedProps=e.pendingProps,t===null?f0(e):St=t,kf.current=null}function f0(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=SS(r,t),r!==null){r.flags&=32767,St=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Lt=6,St=null;return}}else if(r=wS(r,t,Cr),r!==null){St=r;return}if(t=t.sibling,t!==null){St=t;return}St=t=e}while(t!==null);Lt===0&&(Lt=5)}function Ni(e,t,r){var n=Qe,i=Wr.transition;try{Wr.transition=null,Qe=1,RS(e,t,r,n)}finally{Wr.transition=i,Qe=n}return null}function RS(e,t,r,n){do Ss();while(Jn!==null);if(Xe&6)throw Error(ee(327));r=e.finishedWork;var i=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(ee(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(hw(e,s),e===zt&&(St=zt=null,Ut=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Al||(Al=!0,g0(ka,function(){return Ss(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=Wr.transition,Wr.transition=null;var o=Qe;Qe=1;var l=Xe;Xe|=4,kf.current=null,CS(e,r),l0(r,e),Qw(ph),Ea=!!fh,ph=fh=null,e.current=r,ES(r),rw(),Xe=l,Qe=o,Wr.transition=s}else e.current=r;if(Al&&(Al=!1,Jn=e,Wa=i),s=e.pendingLanes,s===0&&(oi=null),sw(r.stateNode),_r(e,xt()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)i=t[r],n(i.value,{componentStack:i.stack,digest:i.digest});if(Fa)throw Fa=!1,e=Dh,Dh=null,e;return Wa&1&&e.tag!==0&&Ss(),s=e.pendingLanes,s&1?e===jh?No++:(No=0,jh=e):No=0,pi(),null}function Ss(){if(Jn!==null){var e=qv(Wa),t=Wr.transition,r=Qe;try{if(Wr.transition=null,Qe=16>e?16:e,Jn===null)var n=!1;else{if(e=Jn,Jn=null,Wa=0,Xe&6)throw Error(ee(331));var i=Xe;for(Xe|=4,xe=e.current;xe!==null;){var s=xe,o=s.child;if(xe.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(xe=c;xe!==null;){var d=xe;switch(d.tag){case 0:case 11:case 15:Co(8,d,s)}var h=d.child;if(h!==null)h.return=d,xe=h;else for(;xe!==null;){d=xe;var f=d.sibling,p=d.return;if(i0(d),d===c){xe=null;break}if(f!==null){f.return=p,xe=f;break}xe=p}}}var m=s.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var S=g.sibling;g.sibling=null,g=S}while(g!==null)}}xe=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,xe=o;else e:for(;xe!==null;){if(s=xe,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Co(9,s,s.return)}var _=s.sibling;if(_!==null){_.return=s.return,xe=_;break e}xe=s.return}}var x=e.current;for(xe=x;xe!==null;){o=xe;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,xe=w;else e:for(o=x;xe!==null;){if(l=xe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:fc(9,l)}}catch(L){gt(l,l.return,L)}if(l===o){xe=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,xe=N;break e}xe=l.return}}if(Xe=i,pi(),dn&&typeof dn.onPostCommitFiberRoot=="function")try{dn.onPostCommitFiberRoot(sc,e)}catch{}n=!0}return n}finally{Qe=r,Wr.transition=t}}return!1}function Im(e,t,r){t=Ls(r,t),t=qx(e,t,1),e=si(e,t,1),t=nr(),e!==null&&(ll(e,1,t),_r(e,t))}function gt(e,t,r){if(e.tag===3)Im(e,e,r);else for(;t!==null;){if(t.tag===3){Im(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(oi===null||!oi.has(n))){e=Ls(r,e),e=Yx(t,e,1),t=si(t,e,1),e=nr(),t!==null&&(ll(t,1,e),_r(t,e));break}}t=t.return}}function MS(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=nr(),e.pingedLanes|=e.suspendedLanes&r,zt===e&&(Ut&r)===r&&(Lt===4||Lt===3&&(Ut&130023424)===Ut&&500>xt()-Ef?ji(e,0):Cf|=r),_r(e,t)}function p0(e,t){t===0&&(e.mode&1?(t=El,El<<=1,!(El&130023424)&&(El=4194304)):t=1);var r=nr();e=Rn(e,t),e!==null&&(ll(e,t,r),_r(e,r))}function IS(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),p0(e,r)}function DS(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(ee(314))}n!==null&&n.delete(t),p0(e,r)}var m0;m0=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||mr.current)pr=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return pr=!1,bS(e,t,r);pr=!!(e.flags&131072)}else pr=!1,st&&t.flags&1048576&&xx(t,Ia,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;ia(e,t),e=t.pendingProps;var i=Es(t,Qt.current);ws(t,r),i=xf(null,t,n,e,i,r);var s=yf();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,gr(n)?(s=!0,Ra(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,pf(t),i.updater=dc,t.stateNode=i,i._reactInternals=t,Sh(t,n,e,r),t=Eh(null,t,n,!0,s,r)):(t.tag=0,st&&s&&lf(t),tr(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(ia(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=AS(n),e=Xr(n,e),i){case 0:t=Ch(null,t,n,e,r);break e;case 1:t=Sm(null,t,n,e,r);break e;case 11:t=bm(null,t,n,e,r);break e;case 14:t=wm(null,t,n,Xr(n.type,e),r);break e}throw Error(ee(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Xr(n,i),Ch(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Xr(n,i),Sm(e,t,n,i,r);case 3:e:{if(Jx(t),e===null)throw Error(ee(387));n=t.pendingProps,s=t.memoizedState,i=s.element,Cx(e,t),Aa(t,n,null,r);var o=t.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=Ls(Error(ee(423)),t),t=km(e,t,n,r,i);break e}else if(n!==i){i=Ls(Error(ee(424)),t),t=km(e,t,n,r,i);break e}else for(Er=ii(t.stateNode.containerInfo.firstChild),Nr=t,st=!0,Qr=null,r=Sx(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Ns(),n===i){t=Mn(e,t,r);break e}tr(e,t,n,r)}t=t.child}return t;case 5:return Ex(t),e===null&&yh(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,mh(n,i)?o=null:s!==null&&mh(n,s)&&(t.flags|=32),Qx(e,t),tr(e,t,o,r),t.child;case 6:return e===null&&yh(t),null;case 13:return Zx(e,t,r);case 4:return mf(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ts(t,null,n,r):tr(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Xr(n,i),bm(e,t,n,i,r);case 7:return tr(e,t,t.pendingProps,r),t.child;case 8:return tr(e,t,t.pendingProps.children,r),t.child;case 12:return tr(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,tt(Da,n._currentValue),n._currentValue=o,s!==null)if(rn(s.value,o)){if(s.children===i.children&&!mr.current){t=Mn(e,t,r);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(s.tag===1){a=Tn(-1,r&-r),a.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?a.next=a:(a.next=d.next,d.next=a),c.pending=a}}s.lanes|=r,a=s.alternate,a!==null&&(a.lanes|=r),bh(s.return,r,t),l.lanes|=r;break}a=a.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),bh(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}tr(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,ws(t,r),i=Ur(i),n=n(i),t.flags|=1,tr(e,t,n,r),t.child;case 14:return n=t.type,i=Xr(n,t.pendingProps),i=Xr(n.type,i),wm(e,t,n,i,r);case 15:return Xx(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Xr(n,i),ia(e,t),t.tag=1,gr(n)?(e=!0,Ra(t)):e=!1,ws(t,r),Kx(t,n,i),Sh(t,n,i,r),Eh(null,t,n,!0,e,r);case 19:return e0(e,t,r);case 22:return Gx(e,t,r)}throw Error(ee(156,t.tag))};function g0(e,t){return Hv(e,t)}function jS(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fr(e,t,r,n){return new jS(e,t,r,n)}function Lf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function AS(e){if(typeof e=="function")return Lf(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Yd)return 11;if(e===Xd)return 14}return 2}function ai(e,t){var r=e.alternate;return r===null?(r=Fr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function la(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")Lf(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case os:return Ai(r.children,i,s,t);case qd:o=8,i|=8;break;case qu:return e=Fr(12,r,t,i|2),e.elementType=qu,e.lanes=s,e;case Yu:return e=Fr(13,r,t,i),e.elementType=Yu,e.lanes=s,e;case Xu:return e=Fr(19,r,t,i),e.elementType=Xu,e.lanes=s,e;case Ev:return mc(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case kv:o=10;break e;case Cv:o=9;break e;case Yd:o=11;break e;case Xd:o=14;break e;case Kn:o=16,n=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=Fr(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function Ai(e,t,r,n){return e=Fr(7,e,n,t),e.lanes=r,e}function mc(e,t,r,n){return e=Fr(22,e,n,t),e.elementType=Ev,e.lanes=r,e.stateNode={isHidden:!1},e}function su(e,t,r){return e=Fr(6,e,null,t),e.lanes=r,e}function ou(e,t,r){return t=Fr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function BS(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$c(0),this.expirationTimes=$c(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$c(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Rf(e,t,r,n,i,s,o,l,a){return e=new BS(e,t,r,l,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Fr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},pf(s),e}function OS(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ss,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function _0(e){if(!e)return hi;e=e._reactInternals;e:{if(Yi(e)!==e||e.tag!==1)throw Error(ee(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(gr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ee(171))}if(e.tag===1){var r=e.type;if(gr(r))return _x(e,r,t)}return t}function v0(e,t,r,n,i,s,o,l,a){return e=Rf(r,n,!0,e,i,s,o,l,a),e.context=_0(null),r=e.current,n=nr(),i=li(r),s=Tn(n,i),s.callback=t??null,si(r,s,i),e.current.lanes=i,ll(e,i,n),_r(e,n),e}function gc(e,t,r,n){var i=t.current,s=nr(),o=li(i);return r=_0(r),t.context===null?t.context=r:t.pendingContext=r,t=Tn(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=si(i,t,o),e!==null&&(Zr(e,i,o,s),ta(e,i,o)),o}function Ua(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Dm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Mf(e,t){Dm(e,t),(e=e.alternate)&&Dm(e,t)}function zS(){return null}var x0=typeof reportError=="function"?reportError:function(e){console.error(e)};function If(e){this._internalRoot=e}_c.prototype.render=If.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ee(409));gc(e,t,null,null)};_c.prototype.unmount=If.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Hi(function(){gc(null,e,null,null)}),t[Ln]=null}};function _c(e){this._internalRoot=e}_c.prototype.unstable_scheduleHydration=function(e){if(e){var t=Gv();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Xn.length&&t!==0&&t<Xn[r].priority;r++);Xn.splice(r,0,e),r===0&&Jv(e)}};function Df(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function vc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function jm(){}function $S(e,t,r,n,i){if(i){if(typeof n=="function"){var s=n;n=function(){var c=Ua(o);s.call(c)}}var o=v0(t,n,e,0,null,!1,!1,"",jm);return e._reactRootContainer=o,e[Ln]=o.current,Wo(e.nodeType===8?e.parentNode:e),Hi(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof n=="function"){var l=n;n=function(){var c=Ua(a);l.call(c)}}var a=Rf(e,0,!1,null,null,!1,!1,"",jm);return e._reactRootContainer=a,e[Ln]=a.current,Wo(e.nodeType===8?e.parentNode:e),Hi(function(){gc(t,a,r,n)}),a}function xc(e,t,r,n,i){var s=r._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var a=Ua(o);l.call(a)}}gc(t,o,e,i)}else o=$S(r,t,e,i,n);return Ua(o)}Yv=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=ho(t.pendingLanes);r!==0&&(Jd(t,r|1),_r(t,xt()),!(Xe&6)&&(Rs=xt()+500,pi()))}break;case 13:Hi(function(){var n=Rn(e,1);if(n!==null){var i=nr();Zr(n,e,1,i)}}),Mf(e,1)}};Zd=function(e){if(e.tag===13){var t=Rn(e,134217728);if(t!==null){var r=nr();Zr(t,e,134217728,r)}Mf(e,134217728)}};Xv=function(e){if(e.tag===13){var t=li(e),r=Rn(e,t);if(r!==null){var n=nr();Zr(r,e,t,n)}Mf(e,t)}};Gv=function(){return Qe};Qv=function(e,t){var r=Qe;try{return Qe=e,t()}finally{Qe=r}};sh=function(e,t,r){switch(t){case"input":if(Ju(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=cc(n);if(!i)throw Error(ee(90));Tv(n),Ju(n,i)}}}break;case"textarea":Lv(e,r);break;case"select":t=r.value,t!=null&&vs(e,!!r.multiple,t,!1)}};Bv=Nf;Ov=Hi;var FS={usingClientEntryPoint:!1,Events:[cl,us,cc,jv,Av,Nf]},Qs={findFiberByHostInstance:Ri,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},WS={bundleType:Qs.bundleType,version:Qs.version,rendererPackageName:Qs.rendererPackageName,rendererConfig:Qs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Dn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Fv(e),e===null?null:e.stateNode},findFiberByHostInstance:Qs.findFiberByHostInstance||zS,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 Bl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bl.isDisabled&&Bl.supportsFiber)try{sc=Bl.inject(WS),dn=Bl}catch{}}Lr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=FS;Lr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Df(t))throw Error(ee(200));return OS(e,t,null,r)};Lr.createRoot=function(e,t){if(!Df(e))throw Error(ee(299));var r=!1,n="",i=x0;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Rf(e,1,!1,null,null,r,!1,n,i),e[Ln]=t.current,Wo(e.nodeType===8?e.parentNode:e),new If(t)};Lr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ee(188)):(e=Object.keys(e).join(","),Error(ee(268,e)));return e=Fv(t),e=e===null?null:e.stateNode,e};Lr.flushSync=function(e){return Hi(e)};Lr.hydrate=function(e,t,r){if(!vc(t))throw Error(ee(200));return xc(null,e,t,!0,r)};Lr.hydrateRoot=function(e,t,r){if(!Df(e))throw Error(ee(405));var n=r!=null&&r.hydratedSources||null,i=!1,s="",o=x0;if(r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=v0(t,null,e,1,r??null,i,!1,s,o),e[Ln]=t.current,Wo(e),n)for(e=0;e<n.length;e++)r=n[e],i=r._getVersion,i=i(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,i]:t.mutableSourceEagerHydrationData.push(r,i);return new _c(t)};Lr.render=function(e,t,r){if(!vc(t))throw Error(ee(200));return xc(null,e,t,!1,r)};Lr.unmountComponentAtNode=function(e){if(!vc(e))throw Error(ee(40));return e._reactRootContainer?(Hi(function(){xc(null,null,e,!1,function(){e._reactRootContainer=null,e[Ln]=null})}),!0):!1};Lr.unstable_batchedUpdates=Nf;Lr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!vc(r))throw Error(ee(200));if(e==null||e._reactInternals===void 0)throw Error(ee(38));return xc(e,t,r,!1,n)};Lr.version="18.3.1-next-f1338f8080-20240426";function y0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(y0)}catch(e){console.error(e)}}y0(),yv.exports=Lr;var b0=yv.exports,w0,Am=b0;w0=Am.createRoot,Am.hydrateRoot;/**
|
|
40
|
+
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function nu(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function kh(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var vS=typeof WeakMap=="function"?WeakMap:Map;function qx(e,t,r){r=Pn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Fa||(Fa=!0,Dh=n),kh(e,t)},r}function Yx(e,t,r){r=Pn(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){kh(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){kh(e,t),typeof n!="function"&&(oi===null?oi=new Set([this]):oi.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function vm(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new vS;var i=new Set;n.set(t,i)}else i=n.get(t),i===void 0&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=MS.bind(null,e,t,r),t.then(e,e))}function xm(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ym(e,t,r,n,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Pn(-1,1),t.tag=2,si(r,t,1))),r.lanes|=1),e)}var xS=Dn.ReactCurrentOwner,pr=!1;function tr(e,t,r,n){t.child=e===null?Sx(t,null,r,n):Ps(t,e.child,r,n)}function bm(e,t,r,n,i){r=r.render;var s=t.ref;return ws(t,i),n=xf(e,t,r,n,s,i),r=yf(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Mn(e,t,i)):(st&&r&&lf(t),t.flags|=1,tr(e,t,n,i),t.child)}function wm(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!Lf(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,Xx(e,t,s,n,i)):(e=la(r.type,null,n,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:Fo,r(o,n)&&e.ref===t.ref)return Mn(e,t,i)}return t.flags|=1,e=ai(s,n),e.ref=t.ref,e.return=t,t.child=e}function Xx(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(Fo(s,n)&&e.ref===t.ref)if(pr=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&(pr=!0);else return t.lanes=e.lanes,Mn(e,t,i)}return Ch(e,t,r,n,i)}function Gx(e,t,r){var n=t.pendingProps,i=n.children,s=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(gs,Cr),Cr|=r;else{if(!(r&1073741824))return e=s!==null?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,tt(gs,Cr),Cr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,tt(gs,Cr),Cr|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,tt(gs,Cr),Cr|=n;return tr(e,t,i,r),t.child}function Qx(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ch(e,t,r,n,i){var s=gr(r)?zi:Qt.current;return s=Es(t,s),ws(t,i),r=xf(e,t,r,n,s,i),n=yf(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Mn(e,t,i)):(st&&n&&lf(t),t.flags|=1,tr(e,t,r,i),t.child)}function Sm(e,t,r,n,i){if(gr(r)){var s=!0;Ra(t)}else s=!1;if(ws(t,i),t.stateNode===null)ia(e,t),Kx(t,r,n),Sh(t,r,n,i),n=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var a=o.context,c=r.contextType;typeof c=="object"&&c!==null?c=Ur(c):(c=gr(r)?zi:Qt.current,c=Es(t,c));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||a!==c)&&_m(t,o,n,c),qn=!1;var f=t.memoizedState;o.state=f,Aa(t,n,o,i),a=t.memoizedState,l!==n||f!==a||mr.current||qn?(typeof d=="function"&&(wh(t,r,d,n),a=t.memoizedState),(l=qn||gm(t,r,l,n,f,a,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=a),o.props=n,o.state=a,o.context=c,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,Cx(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Xr(t.type,l),o.props=c,h=t.pendingProps,f=o.context,a=r.contextType,typeof a=="object"&&a!==null?a=Ur(a):(a=gr(r)?zi:Qt.current,a=Es(t,a));var p=r.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||f!==a)&&_m(t,o,n,a),qn=!1,f=t.memoizedState,o.state=f,Aa(t,n,o,i);var m=t.memoizedState;l!==h||f!==m||mr.current||qn?(typeof p=="function"&&(wh(t,r,p,n),m=t.memoizedState),(c=qn||gm(t,r,c,n,f,m,a)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=a,n=c):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return Eh(e,t,r,n,s,i)}function Eh(e,t,r,n,i,s){Qx(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&am(t,r,!1),Mn(e,t,s);n=t.stateNode,xS.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=Ps(t,e.child,null,s),t.child=Ps(t,null,l,s)):tr(e,t,l,s),t.memoizedState=n.state,i&&am(t,r,!0),t.child}function Jx(e){var t=e.stateNode;t.pendingContext?lm(e,t.pendingContext,t.pendingContext!==t.context):t.context&&lm(e,t.context,!1),mf(e,t.containerInfo)}function km(e,t,r,n,i){return Ns(),cf(i),t.flags|=256,tr(e,t,r,n),t.child}var Nh={dehydrated:null,treeContext:null,retryLane:0};function Ph(e){return{baseLanes:e,cachePool:null,transitions:null}}function Zx(e,t,r){var n=t.pendingProps,i=ut.current,s=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),tt(ut,i&1),e===null)return yh(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=n.children,e=n.fallback,s?(n=t.mode,s=t.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=mc(o,n,0,null),e=Ai(e,n,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Ph(r),t.memoizedState=Nh,e):Sf(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return yS(e,t,o,n,l,i,r);if(s){s=n.fallback,o=t.mode,i=e.child,l=i.sibling;var a={mode:"hidden",children:n.children};return!(o&1)&&t.child!==i?(n=t.child,n.childLanes=0,n.pendingProps=a,t.deletions=null):(n=ai(i,a),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=ai(l,s):(s=Ai(s,o,r,null),s.flags|=2),s.return=t,n.return=t,n.sibling=s,t.child=n,n=s,s=t.child,o=e.child.memoizedState,o=o===null?Ph(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=Nh,n}return s=e.child,e=s.sibling,n=ai(s,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function Sf(e,t){return t=mc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Dl(e,t,r,n){return n!==null&&cf(n),Ps(t,e.child,null,r),e=Sf(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yS(e,t,r,n,i,s,o){if(r)return t.flags&256?(t.flags&=-257,n=nu(Error(ee(422))),Dl(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=mc({mode:"visible",children:n.children},i,0,null),s=Ai(s,i,o,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,t.mode&1&&Ps(t,e.child,null,o),t.child.memoizedState=Ph(o),t.memoizedState=Nh,s);if(!(t.mode&1))return Dl(e,t,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,s=Error(ee(419)),n=nu(s,n,void 0),Dl(e,t,o,n)}if(l=(o&e.childLanes)!==0,pr||l){if(n=zt,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Rn(e,i),Zr(n,e,i,-1))}return Tf(),n=nu(Error(ee(421))),Dl(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=IS.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,Er=ii(i.nextSibling),Nr=t,st=!0,Qr=null,e!==null&&(Or[zr++]=Cn,Or[zr++]=En,Or[zr++]=$i,Cn=e.id,En=e.overflow,$i=t),t=Sf(t,n.children),t.flags|=4096,t)}function Cm(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),bh(e.return,t,r)}function iu(e,t,r,n,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function e0(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(tr(e,t,n.children,r),n=ut.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cm(e,r,t);else if(e.tag===19)Cm(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(tt(ut,n),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;r!==null;)e=r.alternate,e!==null&&Ba(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),iu(t,!1,i,r,s);break;case"backwards":for(r=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ba(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}iu(t,!0,r,null,s);break;case"together":iu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ia(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Mn(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Wi|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ee(153));if(t.child!==null){for(e=t.child,r=ai(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=ai(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function bS(e,t,r){switch(t.tag){case 3:Jx(t),Ns();break;case 5:Ex(t);break;case 1:gr(t.type)&&Ra(t);break;case 4:mf(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;tt(Da,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(tt(ut,ut.current&1),t.flags|=128,null):r&t.child.childLanes?Zx(e,t,r):(tt(ut,ut.current&1),e=Mn(e,t,r),e!==null?e.sibling:null);tt(ut,ut.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return e0(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),tt(ut,ut.current),n)break;return null;case 22:case 23:return t.lanes=0,Gx(e,t,r)}return Mn(e,t,r)}var t0,Th,r0,n0;t0=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Th=function(){};r0=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,Ii(fn.current);var s=null;switch(r){case"input":i=Qu(e,i),n=Qu(e,n),s=[];break;case"select":i=dt({},i,{value:void 0}),n=dt({},n,{value:void 0}),s=[];break;case"textarea":i=eh(e,i),n=eh(e,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Ta)}rh(r,n);var o;r=null;for(c in i)if(!n.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var l=i[c];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Do.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in n){var a=n[c];if(l=i!=null?i[c]:void 0,n.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(r||(r={}),r[o]=a[o])}else r||(s||(s=[]),s.push(c,r)),r=a;else c==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(s=s||[]).push(c,a)):c==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(c,""+a):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Do.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&rt("scroll",e),s||l===a||(s=[])):(s=s||[]).push(c,a))}r&&(s=s||[]).push("style",r);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};n0=function(e,t,r,n){r!==n&&(t.flags|=4)};function Gs(e,t){if(!st)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function qt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function wS(e,t,r){var n=t.pendingProps;switch(af(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(t),null;case 1:return gr(t.type)&&La(),qt(t),null;case 3:return n=t.stateNode,Ts(),it(mr),it(Qt),_f(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ml(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Qr!==null&&(Bh(Qr),Qr=null))),Th(e,t),qt(t),null;case 5:gf(t);var i=Ii(Ko.current);if(r=t.type,e!==null&&t.stateNode!=null)r0(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(ee(166));return qt(t),null}if(e=Ii(fn.current),Ml(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[un]=t,n[Uo]=s,e=(t.mode&1)!==0,r){case"dialog":rt("cancel",n),rt("close",n);break;case"iframe":case"object":case"embed":rt("load",n);break;case"video":case"audio":for(i=0;i<fo.length;i++)rt(fo[i],n);break;case"source":rt("error",n);break;case"img":case"image":case"link":rt("error",n),rt("load",n);break;case"details":rt("toggle",n);break;case"input":Dp(n,s),rt("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},rt("invalid",n);break;case"textarea":Ap(n,s),rt("invalid",n)}rh(r,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?n.textContent!==l&&(s.suppressHydrationWarning!==!0&&Rl(n.textContent,l,e),i=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Rl(n.textContent,l,e),i=["children",""+l]):Do.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&rt("scroll",n)}switch(r){case"input":Sl(n),jp(n,s,!0);break;case"textarea":Sl(n),Bp(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=Ta)}n=i,t.updateQueue=n,n!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Rv(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[un]=t,e[Uo]=n,t0(e,t,!1,!1),t.stateNode=e;e:{switch(o=nh(r,n),r){case"dialog":rt("cancel",e),rt("close",e),i=n;break;case"iframe":case"object":case"embed":rt("load",e),i=n;break;case"video":case"audio":for(i=0;i<fo.length;i++)rt(fo[i],e);i=n;break;case"source":rt("error",e),i=n;break;case"img":case"image":case"link":rt("error",e),rt("load",e),i=n;break;case"details":rt("toggle",e),i=n;break;case"input":Dp(e,n),i=Qu(e,n),rt("invalid",e);break;case"option":i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=dt({},n,{value:void 0}),rt("invalid",e);break;case"textarea":Ap(e,n),i=eh(e,n),rt("invalid",e);break;default:i=n}rh(r,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?Dv(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&Mv(e,a)):s==="children"?typeof a=="string"?(r!=="textarea"||a!=="")&&jo(e,a):typeof a=="number"&&jo(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Do.hasOwnProperty(s)?a!=null&&s==="onScroll"&&rt("scroll",e):a!=null&&Kd(e,s,a,o))}switch(r){case"input":Sl(e),jp(e,n,!1);break;case"textarea":Sl(e),Bp(e);break;case"option":n.value!=null&&e.setAttribute("value",""+ui(n.value));break;case"select":e.multiple=!!n.multiple,s=n.value,s!=null?vs(e,!!n.multiple,s,!1):n.defaultValue!=null&&vs(e,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Ta)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return qt(t),null;case 6:if(e&&t.stateNode!=null)n0(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(ee(166));if(r=Ii(Ko.current),Ii(fn.current),Ml(t)){if(n=t.stateNode,r=t.memoizedProps,n[un]=t,(s=n.nodeValue!==r)&&(e=Nr,e!==null))switch(e.tag){case 3:Rl(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Rl(n.nodeValue,r,(e.mode&1)!==0)}s&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[un]=t,t.stateNode=n}return qt(t),null;case 13:if(it(ut),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(st&&Er!==null&&t.mode&1&&!(t.flags&128))bx(),Ns(),t.flags|=98560,s=!1;else if(s=Ml(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(ee(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ee(317));s[un]=t}else Ns(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;qt(t),s=!1}else Qr!==null&&(Bh(Qr),Qr=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||ut.current&1?Lt===0&&(Lt=3):Tf())),t.updateQueue!==null&&(t.flags|=4),qt(t),null);case 4:return Ts(),Th(e,t),e===null&&Wo(t.stateNode.containerInfo),qt(t),null;case 10:return df(t.type._context),qt(t),null;case 17:return gr(t.type)&&La(),qt(t),null;case 19:if(it(ut),s=t.memoizedState,s===null)return qt(t),null;if(n=(t.flags&128)!==0,o=s.rendering,o===null)if(n)Gs(s,!1);else{if(Lt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Ba(e),o!==null){for(t.flags|=128,Gs(s,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)s=r,e=n,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return tt(ut,ut.current&1|2),t.child}e=e.sibling}s.tail!==null&&xt()>Rs&&(t.flags|=128,n=!0,Gs(s,!1),t.lanes=4194304)}else{if(!n)if(e=Ba(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Gs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!st)return qt(t),null}else 2*xt()-s.renderingStartTime>Rs&&r!==1073741824&&(t.flags|=128,n=!0,Gs(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=xt(),t.sibling=null,r=ut.current,tt(ut,n?r&1|2:r&1),t):(qt(t),null);case 22:case 23:return Pf(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Cr&1073741824&&(qt(t),t.subtreeFlags&6&&(t.flags|=8192)):qt(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function SS(e,t){switch(af(t),t.tag){case 1:return gr(t.type)&&La(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ts(),it(mr),it(Qt),_f(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return gf(t),null;case 13:if(it(ut),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));Ns()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return it(ut),null;case 4:return Ts(),null;case 10:return df(t.type._context),null;case 22:case 23:return Pf(),null;case 24:return null;default:return null}}var jl=!1,Xt=!1,kS=typeof WeakSet=="function"?WeakSet:Set,xe=null;function ms(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){gt(e,t,n)}else r.current=null}function Lh(e,t,r){try{r()}catch(n){gt(e,t,n)}}var Em=!1;function CS(e,t){if(fh=Ea,e=ax(),of(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,l=-1,a=-1,c=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==r||i!==0&&h.nodeType!==3||(l=o+i),h!==s||n!==0&&h.nodeType!==3||(a=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===e)break t;if(f===r&&++c===i&&(l=o),f===s&&++d===n&&(a=o),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(ph={focusedElem:e,selectionRange:r},Ea=!1,xe=t;xe!==null;)if(t=xe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xe=e;else for(;xe!==null;){t=xe;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,S=m.memoizedState,_=t.stateNode,x=_.getSnapshotBeforeUpdate(t.elementType===t.type?g:Xr(t.type,g),S);_.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(N){gt(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,xe=e;break}xe=t.return}return m=Em,Em=!1,m}function Co(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Lh(t,r,s)}i=i.next}while(i!==n)}}function fc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Rh(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function i0(e){var t=e.alternate;t!==null&&(e.alternate=null,i0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[un],delete t[Uo],delete t[_h],delete t[lS],delete t[aS])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function s0(e){return e.tag===5||e.tag===3||e.tag===4}function Nm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||s0(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Mh(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Ta));else if(n!==4&&(e=e.child,e!==null))for(Mh(e,t,r),e=e.sibling;e!==null;)Mh(e,t,r),e=e.sibling}function Ih(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Ih(e,t,r),e=e.sibling;e!==null;)Ih(e,t,r),e=e.sibling}var Ft=null,Gr=!1;function zn(e,t,r){for(r=r.child;r!==null;)o0(e,t,r),r=r.sibling}function o0(e,t,r){if(dn&&typeof dn.onCommitFiberUnmount=="function")try{dn.onCommitFiberUnmount(sc,r)}catch{}switch(r.tag){case 5:Xt||ms(r,t);case 6:var n=Ft,i=Gr;Ft=null,zn(e,t,r),Ft=n,Gr=i,Ft!==null&&(Gr?(e=Ft,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ft.removeChild(r.stateNode));break;case 18:Ft!==null&&(Gr?(e=Ft,r=r.stateNode,e.nodeType===8?Qc(e.parentNode,r):e.nodeType===1&&Qc(e,r),zo(e)):Qc(Ft,r.stateNode));break;case 4:n=Ft,i=Gr,Ft=r.stateNode.containerInfo,Gr=!0,zn(e,t,r),Ft=n,Gr=i;break;case 0:case 11:case 14:case 15:if(!Xt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Lh(r,t,o),i=i.next}while(i!==n)}zn(e,t,r);break;case 1:if(!Xt&&(ms(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){gt(r,t,l)}zn(e,t,r);break;case 21:zn(e,t,r);break;case 22:r.mode&1?(Xt=(n=Xt)||r.memoizedState!==null,zn(e,t,r),Xt=n):zn(e,t,r);break;default:zn(e,t,r)}}function Pm(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new kS),t.forEach(function(n){var i=DS.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function qr(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var i=r[n];try{var s=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Ft=l.stateNode,Gr=!1;break e;case 3:Ft=l.stateNode.containerInfo,Gr=!0;break e;case 4:Ft=l.stateNode.containerInfo,Gr=!0;break e}l=l.return}if(Ft===null)throw Error(ee(160));o0(s,o,i),Ft=null,Gr=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(c){gt(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)l0(t,e),t=t.sibling}function l0(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(qr(t,e),nn(e),n&4){try{Co(3,e,e.return),fc(3,e)}catch(g){gt(e,e.return,g)}try{Co(5,e,e.return)}catch(g){gt(e,e.return,g)}}break;case 1:qr(t,e),nn(e),n&512&&r!==null&&ms(r,r.return);break;case 5:if(qr(t,e),nn(e),n&512&&r!==null&&ms(r,r.return),e.flags&32){var i=e.stateNode;try{jo(i,"")}catch(g){gt(e,e.return,g)}}if(n&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=r!==null?r.memoizedProps:s,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&Tv(i,s),nh(l,o);var c=nh(l,s);for(o=0;o<a.length;o+=2){var d=a[o],h=a[o+1];d==="style"?Dv(i,h):d==="dangerouslySetInnerHTML"?Mv(i,h):d==="children"?jo(i,h):Kd(i,d,h,c)}switch(l){case"input":Ju(i,s);break;case"textarea":Lv(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?vs(i,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?vs(i,!!s.multiple,s.defaultValue,!0):vs(i,!!s.multiple,s.multiple?[]:"",!1))}i[Uo]=s}catch(g){gt(e,e.return,g)}}break;case 6:if(qr(t,e),nn(e),n&4){if(e.stateNode===null)throw Error(ee(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(g){gt(e,e.return,g)}}break;case 3:if(qr(t,e),nn(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{zo(t.containerInfo)}catch(g){gt(e,e.return,g)}break;case 4:qr(t,e),nn(e);break;case 13:qr(t,e),nn(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Ef=xt())),n&4&&Pm(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(Xt=(c=Xt)||d,qr(t,e),Xt=c):qr(t,e),nn(e),n&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!d&&e.mode&1)for(xe=e,d=e.child;d!==null;){for(h=xe=d;xe!==null;){switch(f=xe,p=f.child,f.tag){case 0:case 11:case 14:case 15:Co(4,f,f.return);break;case 1:ms(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){gt(n,r,g)}}break;case 5:ms(f,f.return);break;case 22:if(f.memoizedState!==null){Lm(h);continue}}p!==null?(p.return=f,xe=p):Lm(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{i=h.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=h.stateNode,a=h.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=Iv("display",o))}catch(g){gt(e,e.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(g){gt(e,e.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:qr(t,e),nn(e),n&4&&Pm(e);break;case 21:break;default:qr(t,e),nn(e)}}function nn(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(s0(r)){var n=r;break e}r=r.return}throw Error(ee(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(jo(i,""),n.flags&=-33);var s=Nm(e);Ih(e,s,i);break;case 3:case 4:var o=n.stateNode.containerInfo,l=Nm(e);Mh(e,l,o);break;default:throw Error(ee(161))}}catch(a){gt(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ES(e,t,r){xe=e,a0(e)}function a0(e,t,r){for(var n=(e.mode&1)!==0;xe!==null;){var i=xe,s=i.child;if(i.tag===22&&n){var o=i.memoizedState!==null||jl;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||Xt;l=jl;var c=Xt;if(jl=o,(Xt=a)&&!c)for(xe=i;xe!==null;)o=xe,a=o.child,o.tag===22&&o.memoizedState!==null?Rm(i):a!==null?(a.return=o,xe=a):Rm(i);for(;s!==null;)xe=s,a0(s),s=s.sibling;xe=i,jl=l,Xt=c}Tm(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,xe=s):Tm(e)}}function Tm(e){for(;xe!==null;){var t=xe;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Xt||fc(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Xt)if(r===null)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:Xr(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&fm(t,s,n);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}fm(t,o,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break;case"img":a.src&&(r.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&zo(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ee(163))}Xt||t.flags&512&&Rh(t)}catch(f){gt(t,t.return,f)}}if(t===e){xe=null;break}if(r=t.sibling,r!==null){r.return=t.return,xe=r;break}xe=t.return}}function Lm(e){for(;xe!==null;){var t=xe;if(t===e){xe=null;break}var r=t.sibling;if(r!==null){r.return=t.return,xe=r;break}xe=t.return}}function Rm(e){for(;xe!==null;){var t=xe;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{fc(4,t)}catch(a){gt(t,r,a)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var i=t.return;try{n.componentDidMount()}catch(a){gt(t,i,a)}}var s=t.return;try{Rh(t)}catch(a){gt(t,s,a)}break;case 5:var o=t.return;try{Rh(t)}catch(a){gt(t,o,a)}}}catch(a){gt(t,t.return,a)}if(t===e){xe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,xe=l;break}xe=t.return}}var NS=Math.ceil,$a=Dn.ReactCurrentDispatcher,kf=Dn.ReactCurrentOwner,Wr=Dn.ReactCurrentBatchConfig,Xe=0,zt=null,St=null,Ut=0,Cr=0,gs=fi(0),Lt=0,Go=null,Wi=0,pc=0,Cf=0,Eo=null,fr=null,Ef=0,Rs=1/0,bn=null,Fa=!1,Dh=null,oi=null,Al=!1,Jn=null,Wa=0,No=0,jh=null,sa=-1,oa=0;function nr(){return Xe&6?xt():sa!==-1?sa:sa=xt()}function li(e){return e.mode&1?Xe&2&&Ut!==0?Ut&-Ut:uS.transition!==null?(oa===0&&(oa=Kv()),oa):(e=Qe,e!==0||(e=window.event,e=e===void 0?16:Zv(e.type)),e):1}function Zr(e,t,r,n){if(50<No)throw No=0,jh=null,Error(ee(185));ll(e,r,n),(!(Xe&2)||e!==zt)&&(e===zt&&(!(Xe&2)&&(pc|=r),Lt===4&&Gn(e,Ut)),_r(e,n),r===1&&Xe===0&&!(t.mode&1)&&(Rs=xt()+500,uc&&pi()))}function _r(e,t){var r=e.callbackNode;uw(e,t);var n=Ca(e,e===zt?Ut:0);if(n===0)r!==null&&$p(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&$p(r),t===1)e.tag===0?cS(Mm.bind(null,e)):vx(Mm.bind(null,e)),sS(function(){!(Xe&6)&&pi()}),r=null;else{switch(qv(n)){case 1:r=Qd;break;case 4:r=Uv;break;case 16:r=ka;break;case 536870912:r=Vv;break;default:r=ka}r=g0(r,c0.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function c0(e,t){if(sa=-1,oa=0,Xe&6)throw Error(ee(327));var r=e.callbackNode;if(Ss()&&e.callbackNode!==r)return null;var n=Ca(e,e===zt?Ut:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Ha(e,n);else{t=n;var i=Xe;Xe|=2;var s=h0();(zt!==e||Ut!==t)&&(bn=null,Rs=xt()+500,ji(e,t));do try{LS();break}catch(l){u0(e,l)}while(!0);hf(),$a.current=s,Xe=i,St!==null?t=0:(zt=null,Ut=0,t=Lt)}if(t!==0){if(t===2&&(i=ah(e),i!==0&&(n=i,t=Ah(e,i))),t===1)throw r=Go,ji(e,0),Gn(e,n),_r(e,xt()),r;if(t===6)Gn(e,n);else{if(i=e.current.alternate,!(n&30)&&!PS(i)&&(t=Ha(e,n),t===2&&(s=ah(e),s!==0&&(n=s,t=Ah(e,s))),t===1))throw r=Go,ji(e,0),Gn(e,n),_r(e,xt()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(ee(345));case 2:Ni(e,fr,bn);break;case 3:if(Gn(e,n),(n&130023424)===n&&(t=Ef+500-xt(),10<t)){if(Ca(e,0)!==0)break;if(i=e.suspendedLanes,(i&n)!==n){nr(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=gh(Ni.bind(null,e,fr,bn),t);break}Ni(e,fr,bn);break;case 4:if(Gn(e,n),(n&4194240)===n)break;for(t=e.eventTimes,i=-1;0<n;){var o=31-Jr(n);s=1<<o,o=t[o],o>i&&(i=o),n&=~s}if(n=i,n=xt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*NS(n/1960))-n,10<n){e.timeoutHandle=gh(Ni.bind(null,e,fr,bn),n);break}Ni(e,fr,bn);break;case 5:Ni(e,fr,bn);break;default:throw Error(ee(329))}}}return _r(e,xt()),e.callbackNode===r?c0.bind(null,e):null}function Ah(e,t){var r=Eo;return e.current.memoizedState.isDehydrated&&(ji(e,t).flags|=256),e=Ha(e,t),e!==2&&(t=fr,fr=r,t!==null&&Bh(t)),e}function Bh(e){fr===null?fr=e:fr.push.apply(fr,e)}function PS(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var i=r[n],s=i.getSnapshot;i=i.value;try{if(!rn(s(),i))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gn(e,t){for(t&=~Cf,t&=~pc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Jr(t),n=1<<r;e[r]=-1,t&=~n}}function Mm(e){if(Xe&6)throw Error(ee(327));Ss();var t=Ca(e,0);if(!(t&1))return _r(e,xt()),null;var r=Ha(e,t);if(e.tag!==0&&r===2){var n=ah(e);n!==0&&(t=n,r=Ah(e,n))}if(r===1)throw r=Go,ji(e,0),Gn(e,t),_r(e,xt()),r;if(r===6)throw Error(ee(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ni(e,fr,bn),_r(e,xt()),null}function Nf(e,t){var r=Xe;Xe|=1;try{return e(t)}finally{Xe=r,Xe===0&&(Rs=xt()+500,uc&&pi())}}function Hi(e){Jn!==null&&Jn.tag===0&&!(Xe&6)&&Ss();var t=Xe;Xe|=1;var r=Wr.transition,n=Qe;try{if(Wr.transition=null,Qe=1,e)return e()}finally{Qe=n,Wr.transition=r,Xe=t,!(Xe&6)&&pi()}}function Pf(){Cr=gs.current,it(gs)}function ji(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,iS(r)),St!==null)for(r=St.return;r!==null;){var n=r;switch(af(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&La();break;case 3:Ts(),it(mr),it(Qt),_f();break;case 5:gf(n);break;case 4:Ts();break;case 13:it(ut);break;case 19:it(ut);break;case 10:df(n.type._context);break;case 22:case 23:Pf()}r=r.return}if(zt=e,St=e=ai(e.current,null),Ut=Cr=t,Lt=0,Go=null,Cf=pc=Wi=0,fr=Eo=null,Mi!==null){for(t=0;t<Mi.length;t++)if(r=Mi[t],n=r.interleaved,n!==null){r.interleaved=null;var i=n.next,s=r.pending;if(s!==null){var o=s.next;s.next=i,n.next=o}r.pending=n}Mi=null}return e}function u0(e,t){do{var r=St;try{if(hf(),ra.current=za,Oa){for(var n=ht.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}Oa=!1}if(Fi=0,jt=Tt=ht=null,ko=!1,qo=0,kf.current=null,r===null||r.return===null){Lt=1,Go=t,St=null;break}e:{var s=e,o=r.return,l=r,a=t;if(t=Ut,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var c=a,d=l,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=xm(o);if(p!==null){p.flags&=-257,ym(p,o,l,s,t),p.mode&1&&vm(s,c,t),t=p,a=c;var m=t.updateQueue;if(m===null){var g=new Set;g.add(a),t.updateQueue=g}else m.add(a);break e}else{if(!(t&1)){vm(s,c,t),Tf();break e}a=Error(ee(426))}}else if(st&&l.mode&1){var S=xm(o);if(S!==null){!(S.flags&65536)&&(S.flags|=256),ym(S,o,l,s,t),cf(Ls(a,l));break e}}s=a=Ls(a,l),Lt!==4&&(Lt=2),Eo===null?Eo=[s]:Eo.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var _=qx(s,a,t);dm(s,_);break e;case 1:l=a;var x=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(oi===null||!oi.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var N=Yx(s,l,t);dm(s,N);break e}}s=s.return}while(s!==null)}f0(r)}catch(L){t=L,St===r&&r!==null&&(St=r=r.return);continue}break}while(!0)}function h0(){var e=$a.current;return $a.current=za,e===null?za:e}function Tf(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),zt===null||!(Wi&268435455)&&!(pc&268435455)||Gn(zt,Ut)}function Ha(e,t){var r=Xe;Xe|=2;var n=h0();(zt!==e||Ut!==t)&&(bn=null,ji(e,t));do try{TS();break}catch(i){u0(e,i)}while(!0);if(hf(),Xe=r,$a.current=n,St!==null)throw Error(ee(261));return zt=null,Ut=0,Lt}function TS(){for(;St!==null;)d0(St)}function LS(){for(;St!==null&&!tw();)d0(St)}function d0(e){var t=m0(e.alternate,e,Cr);e.memoizedProps=e.pendingProps,t===null?f0(e):St=t,kf.current=null}function f0(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=SS(r,t),r!==null){r.flags&=32767,St=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Lt=6,St=null;return}}else if(r=wS(r,t,Cr),r!==null){St=r;return}if(t=t.sibling,t!==null){St=t;return}St=t=e}while(t!==null);Lt===0&&(Lt=5)}function Ni(e,t,r){var n=Qe,i=Wr.transition;try{Wr.transition=null,Qe=1,RS(e,t,r,n)}finally{Wr.transition=i,Qe=n}return null}function RS(e,t,r,n){do Ss();while(Jn!==null);if(Xe&6)throw Error(ee(327));r=e.finishedWork;var i=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(ee(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(hw(e,s),e===zt&&(St=zt=null,Ut=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Al||(Al=!0,g0(ka,function(){return Ss(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=Wr.transition,Wr.transition=null;var o=Qe;Qe=1;var l=Xe;Xe|=4,kf.current=null,CS(e,r),l0(r,e),Qw(ph),Ea=!!fh,ph=fh=null,e.current=r,ES(r),rw(),Xe=l,Qe=o,Wr.transition=s}else e.current=r;if(Al&&(Al=!1,Jn=e,Wa=i),s=e.pendingLanes,s===0&&(oi=null),sw(r.stateNode),_r(e,xt()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)i=t[r],n(i.value,{componentStack:i.stack,digest:i.digest});if(Fa)throw Fa=!1,e=Dh,Dh=null,e;return Wa&1&&e.tag!==0&&Ss(),s=e.pendingLanes,s&1?e===jh?No++:(No=0,jh=e):No=0,pi(),null}function Ss(){if(Jn!==null){var e=qv(Wa),t=Wr.transition,r=Qe;try{if(Wr.transition=null,Qe=16>e?16:e,Jn===null)var n=!1;else{if(e=Jn,Jn=null,Wa=0,Xe&6)throw Error(ee(331));var i=Xe;for(Xe|=4,xe=e.current;xe!==null;){var s=xe,o=s.child;if(xe.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(xe=c;xe!==null;){var d=xe;switch(d.tag){case 0:case 11:case 15:Co(8,d,s)}var h=d.child;if(h!==null)h.return=d,xe=h;else for(;xe!==null;){d=xe;var f=d.sibling,p=d.return;if(i0(d),d===c){xe=null;break}if(f!==null){f.return=p,xe=f;break}xe=p}}}var m=s.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var S=g.sibling;g.sibling=null,g=S}while(g!==null)}}xe=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,xe=o;else e:for(;xe!==null;){if(s=xe,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Co(9,s,s.return)}var _=s.sibling;if(_!==null){_.return=s.return,xe=_;break e}xe=s.return}}var x=e.current;for(xe=x;xe!==null;){o=xe;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,xe=w;else e:for(o=x;xe!==null;){if(l=xe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:fc(9,l)}}catch(L){gt(l,l.return,L)}if(l===o){xe=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,xe=N;break e}xe=l.return}}if(Xe=i,pi(),dn&&typeof dn.onPostCommitFiberRoot=="function")try{dn.onPostCommitFiberRoot(sc,e)}catch{}n=!0}return n}finally{Qe=r,Wr.transition=t}}return!1}function Im(e,t,r){t=Ls(r,t),t=qx(e,t,1),e=si(e,t,1),t=nr(),e!==null&&(ll(e,1,t),_r(e,t))}function gt(e,t,r){if(e.tag===3)Im(e,e,r);else for(;t!==null;){if(t.tag===3){Im(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(oi===null||!oi.has(n))){e=Ls(r,e),e=Yx(t,e,1),t=si(t,e,1),e=nr(),t!==null&&(ll(t,1,e),_r(t,e));break}}t=t.return}}function MS(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=nr(),e.pingedLanes|=e.suspendedLanes&r,zt===e&&(Ut&r)===r&&(Lt===4||Lt===3&&(Ut&130023424)===Ut&&500>xt()-Ef?ji(e,0):Cf|=r),_r(e,t)}function p0(e,t){t===0&&(e.mode&1?(t=El,El<<=1,!(El&130023424)&&(El=4194304)):t=1);var r=nr();e=Rn(e,t),e!==null&&(ll(e,t,r),_r(e,r))}function IS(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),p0(e,r)}function DS(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(ee(314))}n!==null&&n.delete(t),p0(e,r)}var m0;m0=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||mr.current)pr=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return pr=!1,bS(e,t,r);pr=!!(e.flags&131072)}else pr=!1,st&&t.flags&1048576&&xx(t,Ia,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;ia(e,t),e=t.pendingProps;var i=Es(t,Qt.current);ws(t,r),i=xf(null,t,n,e,i,r);var s=yf();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,gr(n)?(s=!0,Ra(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,pf(t),i.updater=dc,t.stateNode=i,i._reactInternals=t,Sh(t,n,e,r),t=Eh(null,t,n,!0,s,r)):(t.tag=0,st&&s&&lf(t),tr(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(ia(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=AS(n),e=Xr(n,e),i){case 0:t=Ch(null,t,n,e,r);break e;case 1:t=Sm(null,t,n,e,r);break e;case 11:t=bm(null,t,n,e,r);break e;case 14:t=wm(null,t,n,Xr(n.type,e),r);break e}throw Error(ee(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Xr(n,i),Ch(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Xr(n,i),Sm(e,t,n,i,r);case 3:e:{if(Jx(t),e===null)throw Error(ee(387));n=t.pendingProps,s=t.memoizedState,i=s.element,Cx(e,t),Aa(t,n,null,r);var o=t.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=Ls(Error(ee(423)),t),t=km(e,t,n,r,i);break e}else if(n!==i){i=Ls(Error(ee(424)),t),t=km(e,t,n,r,i);break e}else for(Er=ii(t.stateNode.containerInfo.firstChild),Nr=t,st=!0,Qr=null,r=Sx(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Ns(),n===i){t=Mn(e,t,r);break e}tr(e,t,n,r)}t=t.child}return t;case 5:return Ex(t),e===null&&yh(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,mh(n,i)?o=null:s!==null&&mh(n,s)&&(t.flags|=32),Qx(e,t),tr(e,t,o,r),t.child;case 6:return e===null&&yh(t),null;case 13:return Zx(e,t,r);case 4:return mf(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ps(t,null,n,r):tr(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Xr(n,i),bm(e,t,n,i,r);case 7:return tr(e,t,t.pendingProps,r),t.child;case 8:return tr(e,t,t.pendingProps.children,r),t.child;case 12:return tr(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,tt(Da,n._currentValue),n._currentValue=o,s!==null)if(rn(s.value,o)){if(s.children===i.children&&!mr.current){t=Mn(e,t,r);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(s.tag===1){a=Pn(-1,r&-r),a.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?a.next=a:(a.next=d.next,d.next=a),c.pending=a}}s.lanes|=r,a=s.alternate,a!==null&&(a.lanes|=r),bh(s.return,r,t),l.lanes|=r;break}a=a.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),bh(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}tr(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,ws(t,r),i=Ur(i),n=n(i),t.flags|=1,tr(e,t,n,r),t.child;case 14:return n=t.type,i=Xr(n,t.pendingProps),i=Xr(n.type,i),wm(e,t,n,i,r);case 15:return Xx(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Xr(n,i),ia(e,t),t.tag=1,gr(n)?(e=!0,Ra(t)):e=!1,ws(t,r),Kx(t,n,i),Sh(t,n,i,r),Eh(null,t,n,!0,e,r);case 19:return e0(e,t,r);case 22:return Gx(e,t,r)}throw Error(ee(156,t.tag))};function g0(e,t){return Hv(e,t)}function jS(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fr(e,t,r,n){return new jS(e,t,r,n)}function Lf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function AS(e){if(typeof e=="function")return Lf(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Yd)return 11;if(e===Xd)return 14}return 2}function ai(e,t){var r=e.alternate;return r===null?(r=Fr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function la(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")Lf(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case os:return Ai(r.children,i,s,t);case qd:o=8,i|=8;break;case qu:return e=Fr(12,r,t,i|2),e.elementType=qu,e.lanes=s,e;case Yu:return e=Fr(13,r,t,i),e.elementType=Yu,e.lanes=s,e;case Xu:return e=Fr(19,r,t,i),e.elementType=Xu,e.lanes=s,e;case Ev:return mc(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case kv:o=10;break e;case Cv:o=9;break e;case Yd:o=11;break e;case Xd:o=14;break e;case Kn:o=16,n=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=Fr(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function Ai(e,t,r,n){return e=Fr(7,e,n,t),e.lanes=r,e}function mc(e,t,r,n){return e=Fr(22,e,n,t),e.elementType=Ev,e.lanes=r,e.stateNode={isHidden:!1},e}function su(e,t,r){return e=Fr(6,e,null,t),e.lanes=r,e}function ou(e,t,r){return t=Fr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function BS(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$c(0),this.expirationTimes=$c(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$c(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Rf(e,t,r,n,i,s,o,l,a){return e=new BS(e,t,r,l,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Fr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},pf(s),e}function OS(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ss,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function _0(e){if(!e)return hi;e=e._reactInternals;e:{if(Yi(e)!==e||e.tag!==1)throw Error(ee(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(gr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ee(171))}if(e.tag===1){var r=e.type;if(gr(r))return _x(e,r,t)}return t}function v0(e,t,r,n,i,s,o,l,a){return e=Rf(r,n,!0,e,i,s,o,l,a),e.context=_0(null),r=e.current,n=nr(),i=li(r),s=Pn(n,i),s.callback=t??null,si(r,s,i),e.current.lanes=i,ll(e,i,n),_r(e,n),e}function gc(e,t,r,n){var i=t.current,s=nr(),o=li(i);return r=_0(r),t.context===null?t.context=r:t.pendingContext=r,t=Pn(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=si(i,t,o),e!==null&&(Zr(e,i,o,s),ta(e,i,o)),o}function Ua(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Dm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Mf(e,t){Dm(e,t),(e=e.alternate)&&Dm(e,t)}function zS(){return null}var x0=typeof reportError=="function"?reportError:function(e){console.error(e)};function If(e){this._internalRoot=e}_c.prototype.render=If.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ee(409));gc(e,t,null,null)};_c.prototype.unmount=If.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Hi(function(){gc(null,e,null,null)}),t[Ln]=null}};function _c(e){this._internalRoot=e}_c.prototype.unstable_scheduleHydration=function(e){if(e){var t=Gv();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Xn.length&&t!==0&&t<Xn[r].priority;r++);Xn.splice(r,0,e),r===0&&Jv(e)}};function Df(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function vc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function jm(){}function $S(e,t,r,n,i){if(i){if(typeof n=="function"){var s=n;n=function(){var c=Ua(o);s.call(c)}}var o=v0(t,n,e,0,null,!1,!1,"",jm);return e._reactRootContainer=o,e[Ln]=o.current,Wo(e.nodeType===8?e.parentNode:e),Hi(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof n=="function"){var l=n;n=function(){var c=Ua(a);l.call(c)}}var a=Rf(e,0,!1,null,null,!1,!1,"",jm);return e._reactRootContainer=a,e[Ln]=a.current,Wo(e.nodeType===8?e.parentNode:e),Hi(function(){gc(t,a,r,n)}),a}function xc(e,t,r,n,i){var s=r._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var a=Ua(o);l.call(a)}}gc(t,o,e,i)}else o=$S(r,t,e,i,n);return Ua(o)}Yv=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=ho(t.pendingLanes);r!==0&&(Jd(t,r|1),_r(t,xt()),!(Xe&6)&&(Rs=xt()+500,pi()))}break;case 13:Hi(function(){var n=Rn(e,1);if(n!==null){var i=nr();Zr(n,e,1,i)}}),Mf(e,1)}};Zd=function(e){if(e.tag===13){var t=Rn(e,134217728);if(t!==null){var r=nr();Zr(t,e,134217728,r)}Mf(e,134217728)}};Xv=function(e){if(e.tag===13){var t=li(e),r=Rn(e,t);if(r!==null){var n=nr();Zr(r,e,t,n)}Mf(e,t)}};Gv=function(){return Qe};Qv=function(e,t){var r=Qe;try{return Qe=e,t()}finally{Qe=r}};sh=function(e,t,r){switch(t){case"input":if(Ju(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=cc(n);if(!i)throw Error(ee(90));Pv(n),Ju(n,i)}}}break;case"textarea":Lv(e,r);break;case"select":t=r.value,t!=null&&vs(e,!!r.multiple,t,!1)}};Bv=Nf;Ov=Hi;var FS={usingClientEntryPoint:!1,Events:[cl,us,cc,jv,Av,Nf]},Qs={findFiberByHostInstance:Ri,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},WS={bundleType:Qs.bundleType,version:Qs.version,rendererPackageName:Qs.rendererPackageName,rendererConfig:Qs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Dn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Fv(e),e===null?null:e.stateNode},findFiberByHostInstance:Qs.findFiberByHostInstance||zS,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 Bl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bl.isDisabled&&Bl.supportsFiber)try{sc=Bl.inject(WS),dn=Bl}catch{}}Lr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=FS;Lr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Df(t))throw Error(ee(200));return OS(e,t,null,r)};Lr.createRoot=function(e,t){if(!Df(e))throw Error(ee(299));var r=!1,n="",i=x0;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Rf(e,1,!1,null,null,r,!1,n,i),e[Ln]=t.current,Wo(e.nodeType===8?e.parentNode:e),new If(t)};Lr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ee(188)):(e=Object.keys(e).join(","),Error(ee(268,e)));return e=Fv(t),e=e===null?null:e.stateNode,e};Lr.flushSync=function(e){return Hi(e)};Lr.hydrate=function(e,t,r){if(!vc(t))throw Error(ee(200));return xc(null,e,t,!0,r)};Lr.hydrateRoot=function(e,t,r){if(!Df(e))throw Error(ee(405));var n=r!=null&&r.hydratedSources||null,i=!1,s="",o=x0;if(r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=v0(t,null,e,1,r??null,i,!1,s,o),e[Ln]=t.current,Wo(e),n)for(e=0;e<n.length;e++)r=n[e],i=r._getVersion,i=i(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,i]:t.mutableSourceEagerHydrationData.push(r,i);return new _c(t)};Lr.render=function(e,t,r){if(!vc(t))throw Error(ee(200));return xc(null,e,t,!1,r)};Lr.unmountComponentAtNode=function(e){if(!vc(e))throw Error(ee(40));return e._reactRootContainer?(Hi(function(){xc(null,null,e,!1,function(){e._reactRootContainer=null,e[Ln]=null})}),!0):!1};Lr.unstable_batchedUpdates=Nf;Lr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!vc(r))throw Error(ee(200));if(e==null||e._reactInternals===void 0)throw Error(ee(38));return xc(e,t,r,!1,n)};Lr.version="18.3.1-next-f1338f8080-20240426";function y0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(y0)}catch(e){console.error(e)}}y0(),yv.exports=Lr;var b0=yv.exports,w0,Am=b0;w0=Am.createRoot,Am.hydrateRoot;/**
|
|
41
41
|
* @remix-run/router v1.23.2
|
|
42
42
|
*
|
|
43
43
|
* Copyright (c) Remix Software Inc.
|
|
@@ -46,7 +46,7 @@ Error generating stack: `+s.message+`
|
|
|
46
46
|
* LICENSE.md file in the root directory of this source tree.
|
|
47
47
|
*
|
|
48
48
|
* @license MIT
|
|
49
|
-
*/function Qo(){return Qo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qo.apply(this,arguments)}var Zn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Zn||(Zn={}));const Bm="popstate";function HS(e){e===void 0&&(e={});function t(n,i){let{pathname:s,search:o,hash:l}=n.location;return Oh("",{pathname:s,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(n,i){return typeof i=="string"?i:S0(i)}return VS(t,r,null,e)}function kt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function jf(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function US(){return Math.random().toString(36).substr(2,8)}function Om(e,t){return{usr:e.state,key:e.key,idx:t}}function Oh(e,t,r,n){return r===void 0&&(r=null),Qo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Bs(t):t,{state:r,key:t&&t.key||n||US()})}function S0(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Bs(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function VS(e,t,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,l=Zn.Pop,a=null,c=d();c==null&&(c=0,o.replaceState(Qo({},o.state,{idx:c}),""));function d(){return(o.state||{idx:null}).idx}function h(){l=Zn.Pop;let S=d(),_=S==null?null:S-c;c=S,a&&a({action:l,location:g.location,delta:_})}function f(S,_){l=Zn.Push;let x=Oh(g.location,S,_);c=d()+1;let w=Om(x,c),N=g.createHref(x);try{o.pushState(w,"",N)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;i.location.assign(N)}s&&a&&a({action:l,location:g.location,delta:1})}function p(S,_){l=Zn.Replace;let x=Oh(g.location,S,_);c=d();let w=Om(x,c),N=g.createHref(x);o.replaceState(w,"",N),s&&a&&a({action:l,location:g.location,delta:0})}function m(S){let _=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof S=="string"?S:S0(S);return x=x.replace(/ $/,"%20"),kt(_,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,_)}let g={get action(){return l},get location(){return e(i,o)},listen(S){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Bm,h),a=S,()=>{i.removeEventListener(Bm,h),a=null}},createHref(S){return t(i,S)},createURL:m,encodeLocation(S){let _=m(S);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:f,replace:p,go(S){return o.go(S)}};return g}var zm;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(zm||(zm={}));function KS(e,t,r){return r===void 0&&(r="/"),qS(e,t,r)}function qS(e,t,r,n){let i=typeof t=="string"?Bs(t):t,s=E0(i.pathname||"/",r);if(s==null)return null;let o=k0(e);YS(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let c=ok(s);l=nk(o[a],c)}return l}function k0(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let i=(s,o,l)=>{let a={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};a.relativePath.startsWith("/")&&(kt(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let c=Bi([n,a.relativePath]),d=r.concat(a);s.children&&s.children.length>0&&(kt(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),k0(s.children,t,d,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:tk(c,s.index),routesMeta:d})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let a of C0(s.path))i(s,o,a)}),t}function C0(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=C0(n.join("/")),l=[];return l.push(...o.map(a=>a===""?s:[s,a].join("/"))),i&&l.push(...o),l.map(a=>e.startsWith("/")&&a===""?"/":a)}function YS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:rk(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const XS=/^:[\w-]+$/,GS=3,QS=2,JS=1,ZS=10,ek=-2,$m=e=>e==="*";function tk(e,t){let r=e.split("/"),n=r.length;return r.some($m)&&(n+=ek),t&&(n+=QS),r.filter(i=>!$m(i)).reduce((i,s)=>i+(XS.test(s)?GS:s===""?JS:ZS),n)}function rk(e,t){return e.length===t.length&&e.slice(0,-1).every((n,i)=>n===t[i])?e[e.length-1]-t[t.length-1]:0}function nk(e,t,r){let{routesMeta:n}=e,i={},s="/",o=[];for(let l=0;l<n.length;++l){let a=n[l],c=l===n.length-1,d=s==="/"?t:t.slice(s.length)||"/",h=ik({path:a.relativePath,caseSensitive:a.caseSensitive,end:c},d),f=a.route;if(!h)return null;Object.assign(i,h.params),o.push({params:i,pathname:Bi([s,h.pathname]),pathnameBase:hk(Bi([s,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(s=Bi([s,h.pathnameBase]))}return o}function ik(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=sk(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:n.reduce((c,d,h)=>{let{paramName:f,isOptional:p}=d;if(f==="*"){let g=l[h]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const m=l[h];return p&&!m?c[f]=void 0:c[f]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function sk(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),jf(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),n]}function ok(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return jf(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function E0(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const lk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ak=e=>lk.test(e);function ck(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?Bs(e):e,s;if(r)if(ak(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),jf(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=Fm(r.substring(1),"/"):s=Fm(r,t)}else s=t;return{pathname:s,search:dk(n),hash:fk(i)}}function Fm(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function lu(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function uk(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function N0(e,t){let r=uk(e);return t?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function
|
|
49
|
+
*/function Qo(){return Qo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qo.apply(this,arguments)}var Zn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Zn||(Zn={}));const Bm="popstate";function HS(e){e===void 0&&(e={});function t(n,i){let{pathname:s,search:o,hash:l}=n.location;return Oh("",{pathname:s,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(n,i){return typeof i=="string"?i:S0(i)}return VS(t,r,null,e)}function kt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function jf(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function US(){return Math.random().toString(36).substr(2,8)}function Om(e,t){return{usr:e.state,key:e.key,idx:t}}function Oh(e,t,r,n){return r===void 0&&(r=null),Qo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Bs(t):t,{state:r,key:t&&t.key||n||US()})}function S0(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Bs(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function VS(e,t,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,l=Zn.Pop,a=null,c=d();c==null&&(c=0,o.replaceState(Qo({},o.state,{idx:c}),""));function d(){return(o.state||{idx:null}).idx}function h(){l=Zn.Pop;let S=d(),_=S==null?null:S-c;c=S,a&&a({action:l,location:g.location,delta:_})}function f(S,_){l=Zn.Push;let x=Oh(g.location,S,_);c=d()+1;let w=Om(x,c),N=g.createHref(x);try{o.pushState(w,"",N)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;i.location.assign(N)}s&&a&&a({action:l,location:g.location,delta:1})}function p(S,_){l=Zn.Replace;let x=Oh(g.location,S,_);c=d();let w=Om(x,c),N=g.createHref(x);o.replaceState(w,"",N),s&&a&&a({action:l,location:g.location,delta:0})}function m(S){let _=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof S=="string"?S:S0(S);return x=x.replace(/ $/,"%20"),kt(_,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,_)}let g={get action(){return l},get location(){return e(i,o)},listen(S){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Bm,h),a=S,()=>{i.removeEventListener(Bm,h),a=null}},createHref(S){return t(i,S)},createURL:m,encodeLocation(S){let _=m(S);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:f,replace:p,go(S){return o.go(S)}};return g}var zm;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(zm||(zm={}));function KS(e,t,r){return r===void 0&&(r="/"),qS(e,t,r)}function qS(e,t,r,n){let i=typeof t=="string"?Bs(t):t,s=E0(i.pathname||"/",r);if(s==null)return null;let o=k0(e);YS(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let c=ok(s);l=nk(o[a],c)}return l}function k0(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let i=(s,o,l)=>{let a={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};a.relativePath.startsWith("/")&&(kt(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let c=Bi([n,a.relativePath]),d=r.concat(a);s.children&&s.children.length>0&&(kt(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),k0(s.children,t,d,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:tk(c,s.index),routesMeta:d})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let a of C0(s.path))i(s,o,a)}),t}function C0(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=C0(n.join("/")),l=[];return l.push(...o.map(a=>a===""?s:[s,a].join("/"))),i&&l.push(...o),l.map(a=>e.startsWith("/")&&a===""?"/":a)}function YS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:rk(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const XS=/^:[\w-]+$/,GS=3,QS=2,JS=1,ZS=10,ek=-2,$m=e=>e==="*";function tk(e,t){let r=e.split("/"),n=r.length;return r.some($m)&&(n+=ek),t&&(n+=QS),r.filter(i=>!$m(i)).reduce((i,s)=>i+(XS.test(s)?GS:s===""?JS:ZS),n)}function rk(e,t){return e.length===t.length&&e.slice(0,-1).every((n,i)=>n===t[i])?e[e.length-1]-t[t.length-1]:0}function nk(e,t,r){let{routesMeta:n}=e,i={},s="/",o=[];for(let l=0;l<n.length;++l){let a=n[l],c=l===n.length-1,d=s==="/"?t:t.slice(s.length)||"/",h=ik({path:a.relativePath,caseSensitive:a.caseSensitive,end:c},d),f=a.route;if(!h)return null;Object.assign(i,h.params),o.push({params:i,pathname:Bi([s,h.pathname]),pathnameBase:hk(Bi([s,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(s=Bi([s,h.pathnameBase]))}return o}function ik(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=sk(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:n.reduce((c,d,h)=>{let{paramName:f,isOptional:p}=d;if(f==="*"){let g=l[h]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const m=l[h];return p&&!m?c[f]=void 0:c[f]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function sk(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),jf(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),n]}function ok(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return jf(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function E0(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const lk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ak=e=>lk.test(e);function ck(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?Bs(e):e,s;if(r)if(ak(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),jf(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=Fm(r.substring(1),"/"):s=Fm(r,t)}else s=t;return{pathname:s,search:dk(n),hash:fk(i)}}function Fm(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function lu(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function uk(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function N0(e,t){let r=uk(e);return t?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function P0(e,t,r,n){n===void 0&&(n=!1);let i;typeof e=="string"?i=Bs(e):(i=Qo({},e),kt(!i.pathname||!i.pathname.includes("?"),lu("?","pathname","search",i)),kt(!i.pathname||!i.pathname.includes("#"),lu("#","pathname","hash",i)),kt(!i.search||!i.search.includes("#"),lu("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=r;else{let h=t.length-1;if(!n&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;i.pathname=f.join("/")}l=h>=0?t[h]:"/"}let a=ck(i,l),c=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(c||d)&&(a.pathname+="/"),a}const Bi=e=>e.join("/").replace(/\/\/+/g,"/"),hk=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),dk=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,fk=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function pk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const T0=["post","put","patch","delete"];new Set(T0);const mk=["get",...T0];new Set(mk);/**
|
|
50
50
|
* React Router v6.30.3
|
|
51
51
|
*
|
|
52
52
|
* Copyright (c) Remix Software Inc.
|
|
@@ -55,7 +55,7 @@ Error generating stack: `+s.message+`
|
|
|
55
55
|
* LICENSE.md file in the root directory of this source tree.
|
|
56
56
|
*
|
|
57
57
|
* @license MIT
|
|
58
|
-
*/function Jo(){return Jo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Jo.apply(this,arguments)}const Af=b.createContext(null),gk=b.createContext(null),hl=b.createContext(null),yc=b.createContext(null),mi=b.createContext({outlet:null,matches:[],isDataRoute:!1}),L0=b.createContext(null);function dl(){return b.useContext(yc)!=null}function fl(){return dl()||kt(!1),b.useContext(yc).location}function R0(e){b.useContext(hl).static||b.useLayoutEffect(e)}function Os(){let{isDataRoute:e}=b.useContext(mi);return e?
|
|
58
|
+
*/function Jo(){return Jo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Jo.apply(this,arguments)}const Af=b.createContext(null),gk=b.createContext(null),hl=b.createContext(null),yc=b.createContext(null),mi=b.createContext({outlet:null,matches:[],isDataRoute:!1}),L0=b.createContext(null);function dl(){return b.useContext(yc)!=null}function fl(){return dl()||kt(!1),b.useContext(yc).location}function R0(e){b.useContext(hl).static||b.useLayoutEffect(e)}function Os(){let{isDataRoute:e}=b.useContext(mi);return e?Tk():_k()}function _k(){dl()||kt(!1);let e=b.useContext(Af),{basename:t,future:r,navigator:n}=b.useContext(hl),{matches:i}=b.useContext(mi),{pathname:s}=fl(),o=JSON.stringify(N0(i,r.v7_relativeSplatPath)),l=b.useRef(!1);return R0(()=>{l.current=!0}),b.useCallback(function(c,d){if(d===void 0&&(d={}),!l.current)return;if(typeof c=="number"){n.go(c);return}let h=P0(c,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Bi([t,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[t,n,o,s,e])}function M0(){let{matches:e}=b.useContext(mi),t=e[e.length-1];return t?t.params:{}}function vk(e,t){return xk(e,t)}function xk(e,t,r,n){dl()||kt(!1);let{navigator:i}=b.useContext(hl),{matches:s}=b.useContext(mi),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let c=fl(),d;if(t){var h;let S=typeof t=="string"?Bs(t):t;a==="/"||(h=S.pathname)!=null&&h.startsWith(a)||kt(!1),d=S}else d=c;let f=d.pathname||"/",p=f;if(a!=="/"){let S=a.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(S.length).join("/")}let m=KS(e,{pathname:p}),g=kk(m&&m.map(S=>Object.assign({},S,{params:Object.assign({},l,S.params),pathname:Bi([a,i.encodeLocation?i.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?a:Bi([a,i.encodeLocation?i.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),s,r,n);return t&&g?b.createElement(yc.Provider,{value:{location:Jo({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Zn.Pop}},g):g}function yk(){let e=Pk(),t=pk(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),r?b.createElement("pre",{style:i},r):null,null)}const bk=b.createElement(yk,null);class wk extends b.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?b.createElement(mi.Provider,{value:this.props.routeContext},b.createElement(L0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Sk(e){let{routeContext:t,match:r,children:n}=e,i=b.useContext(Af);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),b.createElement(mi.Provider,{value:t},n)}function kk(e,t,r,n){var i;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var s;if(!r)return null;if(r.errors)e=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(i=r)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);d>=0||kt(!1),o=o.slice(0,Math.min(o.length,d+1))}let a=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<o.length;d++){let h=o[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(c=d),h.route.id){let{loaderData:f,errors:p}=r,m=h.route.loader&&f[h.route.id]===void 0&&(!p||p[h.route.id]===void 0);if(h.route.lazy||m){a=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((d,h,f)=>{let p,m=!1,g=null,S=null;r&&(p=l&&h.route.id?l[h.route.id]:void 0,g=h.route.errorElement||bk,a&&(c<0&&f===0?(Lk("route-fallback"),m=!0,S=null):c===f&&(m=!0,S=h.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,f+1)),x=()=>{let w;return p?w=g:m?w=S:h.route.Component?w=b.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=d,b.createElement(Sk,{match:h,routeContext:{outlet:d,matches:_,isDataRoute:r!=null},children:w})};return r&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?b.createElement(wk,{location:r.location,revalidation:r.revalidation,component:g,error:p,children:x(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):x()},null)}var I0=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(I0||{}),D0=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(D0||{});function Ck(e){let t=b.useContext(Af);return t||kt(!1),t}function Ek(e){let t=b.useContext(gk);return t||kt(!1),t}function Nk(e){let t=b.useContext(mi);return t||kt(!1),t}function j0(e){let t=Nk(),r=t.matches[t.matches.length-1];return r.route.id||kt(!1),r.route.id}function Pk(){var e;let t=b.useContext(L0),r=Ek(),n=j0();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function Tk(){let{router:e}=Ck(I0.UseNavigateStable),t=j0(D0.UseNavigateStable),r=b.useRef(!1);return R0(()=>{r.current=!0}),b.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Jo({fromRouteId:t},s)))},[e,t])}const Wm={};function Lk(e,t,r){Wm[e]||(Wm[e]=!0)}function Rk(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function aa(e){let{to:t,replace:r,state:n,relative:i}=e;dl()||kt(!1);let{future:s,static:o}=b.useContext(hl),{matches:l}=b.useContext(mi),{pathname:a}=fl(),c=Os(),d=P0(t,N0(l,s.v7_relativeSplatPath),a,i==="path"),h=JSON.stringify(d);return b.useEffect(()=>c(JSON.parse(h),{replace:r,state:n,relative:i}),[c,h,i,r,n]),null}function yn(e){kt(!1)}function Mk(e){let{basename:t="/",children:r=null,location:n,navigationType:i=Zn.Pop,navigator:s,static:o=!1,future:l}=e;dl()&&kt(!1);let a=t.replace(/^\/*/,"/"),c=b.useMemo(()=>({basename:a,navigator:s,static:o,future:Jo({v7_relativeSplatPath:!1},l)}),[a,l,s,o]);typeof n=="string"&&(n=Bs(n));let{pathname:d="/",search:h="",hash:f="",state:p=null,key:m="default"}=n,g=b.useMemo(()=>{let S=E0(d,a);return S==null?null:{location:{pathname:S,search:h,hash:f,state:p,key:m},navigationType:i}},[a,d,h,f,p,m,i]);return g==null?null:b.createElement(hl.Provider,{value:c},b.createElement(yc.Provider,{children:r,value:g}))}function Ik(e){let{children:t,location:r}=e;return vk(zh(t),r)}new Promise(()=>{});function zh(e,t){t===void 0&&(t=[]);let r=[];return b.Children.forEach(e,(n,i)=>{if(!b.isValidElement(n))return;let s=[...t,i];if(n.type===b.Fragment){r.push.apply(r,zh(n.props.children,s));return}n.type!==yn&&kt(!1),!n.props.index||!n.props.children||kt(!1);let o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=zh(n.props.children,s)),r.push(o)}),r}/**
|
|
59
59
|
* React Router DOM v6.30.3
|
|
60
60
|
*
|
|
61
61
|
* Copyright (c) Remix Software Inc.
|
|
@@ -65,44 +65,44 @@ Error generating stack: `+s.message+`
|
|
|
65
65
|
*
|
|
66
66
|
* @license MIT
|
|
67
67
|
*/function $h(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(i=>[r,i]):[[r,n]])},[]))}function Dk(e,t){let r=$h(e);return t&&t.forEach((n,i)=>{r.has(i)||t.getAll(i).forEach(s=>{r.append(i,s)})}),r}const jk="6";try{window.__reactRouterVersion=jk}catch{}const Ak="startTransition",Hm=Mb[Ak];function Bk(e){let{basename:t,children:r,future:n,window:i}=e,s=b.useRef();s.current==null&&(s.current=HS({window:i,v5Compat:!0}));let o=s.current,[l,a]=b.useState({action:o.action,location:o.location}),{v7_startTransition:c}=n||{},d=b.useCallback(h=>{c&&Hm?Hm(()=>a(h)):a(h)},[a,c]);return b.useLayoutEffect(()=>o.listen(d),[o,d]),b.useEffect(()=>Rk(n),[n]),b.createElement(Mk,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}var Um;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Um||(Um={}));var Vm;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Vm||(Vm={}));function A0(e){let t=b.useRef($h(e)),r=b.useRef(!1),n=fl(),i=b.useMemo(()=>Dk(n.search,r.current?null:t.current),[n.search]),s=Os(),o=b.useCallback((l,a)=>{const c=$h(typeof l=="function"?l(i):l);r.current=!0,s("?"+c,a)},[s,i]);return[i,o]}const B0=b.createContext({ides:[],updateIdeChats:()=>{},screenshotMap:{},setScreenshotMap:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{},wsStatus:"connected",isConnected:!0,connectionStates:{},connectionTransports:{},showReconnected:!1,userName:void 0,setUserName:()=>{},isP2PActive:!1,p2pStates:{},userRole:void 0}),O0=b.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function Ok(e,t){var o,l,a,c;const r=Date.now();if(t.length===0)return e.map(d=>({...d,_lastUpdate:r}));const n=new Map;for(const d of t)n.set(d.id,d);for(const d of e){const h=n.get(d.id);if(!h){n.set(d.id,{...d,_lastUpdate:r});continue}const f=d.timestamp||r,p=h._lastUpdate||h.timestamp||0;if(f>=p){const m=(o=d.chats)!=null&&o.length?d.chats:h.chats;n.set(d.id,{...h,...d,chats:m,_lastUpdate:r})}else(l=d.chats)!=null&&l.length&&!((a=h.chats)!=null&&a.length)&&n.set(d.id,{...h,chats:d.chats})}const i=new Set(e.map(d=>d.id)),s=new Set;for(const d of e){const h=d.daemonId||((c=d.id)==null?void 0:c.split(":")[0]);h&&s.add(h)}for(const[d,h]of n){const f=h.daemonId||d.split(":")[0];if(!s.has(f))continue;const p=r-(h._lastUpdate||h.timestamp||0);(d.includes(":cli:")&&!i.has(d)&&p>1e4||d.includes(":acp:")&&!i.has(d)&&p>1e4||d.includes(":ide:")&&!i.has(d)&&p>3e4)&&n.delete(d)}for(const[d,h]of n)r-(h._lastUpdate||h.timestamp||0)>3e5&&h.status!=="online"&&n.delete(d);return Array.from(n.values())}function zk({children:e,connectionOverrides:t}){const[r,n]=b.useState([]),[i,s]=b.useState({}),[o,l]=b.useState(!1),[a,c]=b.useState([]),[d,h]=b.useState(void 0),f=b.useCallback((g,S)=>{n(_=>_.map(x=>x.id===g?{...x,chats:S}:x))},[]),p={injectEntries:g=>{n(S=>S.length===0?g:Ok(g,S))},markLoaded:()=>l(!0),getIdes:()=>r},m=t;return u.jsx(O0.Provider,{value:p,children:u.jsx(B0.Provider,{value:{ides:r,updateIdeChats:f,screenshotMap:i,setScreenshotMap:s,initialLoaded:o,toasts:a,setToasts:c,wsStatus:(m==null?void 0:m.wsStatus)??"connected",isConnected:(m==null?void 0:m.isConnected)??!0,connectionStates:(m==null?void 0:m.connectionStates)??{},connectionTransports:(m==null?void 0:m.connectionTransports)??{},showReconnected:(m==null?void 0:m.showReconnected)??!1,retryConnection:m==null?void 0:m.retryConnection,isP2PActive:(m==null?void 0:m.isP2PActive)??!1,p2pStates:(m==null?void 0:m.p2pStates)??{},userRole:m==null?void 0:m.userRole,userName:d,setUserName:h},children:e})})}function Zo(){return b.useContext(B0)}function Km(){return b.useContext(O0)}function $k(e){const{baseUrl:t,getToken:r,onUnauthorized:n}=e;async function i(s,o={}){const l={"Content-Type":"application/json",...o.headers||{}},a=r==null?void 0:r();a&&(l.Authorization=`Bearer ${a}`);const c=s.startsWith("http")?s:`${t}${s.startsWith("/")?"":"/"}${s}`,d=await fetch(c,{...o,headers:l});if(d.status===401)throw n==null||n(),new Error("Unauthorized");if(!d.ok){const h=await d.json().catch(()=>({error:d.statusText}));throw new Error(h.error||`API Error: ${d.status}`)}return d.json()}return{getDaemons:()=>i("/api/v1/daemons"),getDaemonStatus:s=>i(`/api/v1/daemons/${s}/status`),sendCommand:(s,o,l={})=>i(`/api/v1/daemons/${s}/command`,{method:"POST",body:JSON.stringify({type:o,payload:l})}),execTerminal:(s,o,l)=>i(`/api/v1/daemons/${s}/terminal`,{method:"POST",body:JSON.stringify({command:o,name:l})}),sendAgentMessage:(s,o,l)=>i(`/api/v1/agents/${s}/send`,{method:"POST",body:JSON.stringify({agentType:o,message:l})}),getAgentStatus:s=>i(`/api/v1/agents/${s}/status`),approveAgent:(s,o,l)=>i(`/api/v1/agents/${s}/approve`,{method:"POST",body:JSON.stringify({agentType:o,approve:l})}),request:i}}const Fk=$k({baseUrl:"http://localhost:3847"});b.createContext(Fk);const Wk={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},z0=b.createContext(Wk);function Hk({value:e,children:t}){return u.jsx(z0.Provider,{value:e,children:t})}function gi(){return b.useContext(z0)}function Uk(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Vk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Kk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qk={};function qm(e,t){return(qk.jsx?Kk:Vk).test(e)}const Yk=/[ \t\n\f\r]/g;function Xk(e){return typeof e=="object"?e.type==="text"?Ym(e.value):!1:Ym(e)}function Ym(e){return e.replace(Yk,"")===""}class pl{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}pl.prototype.normal={};pl.prototype.property={};pl.prototype.space=void 0;function $0(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new pl(r,n,t)}function Fh(e){return e.toLowerCase()}class vr{constructor(t,r){this.attribute=r,this.property=t}}vr.prototype.attribute="";vr.prototype.booleanish=!1;vr.prototype.boolean=!1;vr.prototype.commaOrSpaceSeparated=!1;vr.prototype.commaSeparated=!1;vr.prototype.defined=!1;vr.prototype.mustUseProperty=!1;vr.prototype.number=!1;vr.prototype.overloadedBoolean=!1;vr.prototype.property="";vr.prototype.spaceSeparated=!1;vr.prototype.space=void 0;let Gk=0;const De=Xi(),yt=Xi(),Wh=Xi(),re=Xi(),et=Xi(),ks=Xi(),kr=Xi();function Xi(){return 2**++Gk}const Hh=Object.freeze(Object.defineProperty({__proto__:null,boolean:De,booleanish:yt,commaOrSpaceSeparated:kr,commaSeparated:ks,number:re,overloadedBoolean:Wh,spaceSeparated:et},Symbol.toStringTag,{value:"Module"})),au=Object.keys(Hh);class Bf extends vr{constructor(t,r,n,i){let s=-1;if(super(t,r),Xm(this,"space",i),typeof n=="number")for(;++s<au.length;){const o=au[s];Xm(this,au[s],(n&Hh[o])===Hh[o])}}}Bf.prototype.defined=!0;function Xm(e,t,r){r&&(e[t]=r)}function zs(e){const t={},r={};for(const[n,i]of Object.entries(e.properties)){const s=new Bf(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),t[n]=s,r[Fh(n)]=n,r[Fh(s.attribute)]=n}return new pl(t,r,e.space)}const F0=zs({properties:{ariaActiveDescendant:null,ariaAtomic:yt,ariaAutoComplete:null,ariaBusy:yt,ariaChecked:yt,ariaColCount:re,ariaColIndex:re,ariaColSpan:re,ariaControls:et,ariaCurrent:null,ariaDescribedBy:et,ariaDetails:null,ariaDisabled:yt,ariaDropEffect:et,ariaErrorMessage:null,ariaExpanded:yt,ariaFlowTo:et,ariaGrabbed:yt,ariaHasPopup:null,ariaHidden:yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:et,ariaLevel:re,ariaLive:null,ariaModal:yt,ariaMultiLine:yt,ariaMultiSelectable:yt,ariaOrientation:null,ariaOwns:et,ariaPlaceholder:null,ariaPosInSet:re,ariaPressed:yt,ariaReadOnly:yt,ariaRelevant:null,ariaRequired:yt,ariaRoleDescription:et,ariaRowCount:re,ariaRowIndex:re,ariaRowSpan:re,ariaSelected:yt,ariaSetSize:re,ariaSort:null,ariaValueMax:re,ariaValueMin:re,ariaValueNow:re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function W0(e,t){return t in e?e[t]:t}function H0(e,t){return W0(e,t.toLowerCase())}const Qk=zs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ks,acceptCharset:et,accessKey:et,action:null,allow:null,allowFullScreen:De,allowPaymentRequest:De,allowUserMedia:De,alt:null,as:null,async:De,autoCapitalize:null,autoComplete:et,autoFocus:De,autoPlay:De,blocking:et,capture:null,charSet:null,checked:De,cite:null,className:et,cols:re,colSpan:null,content:null,contentEditable:yt,controls:De,controlsList:et,coords:re|ks,crossOrigin:null,data:null,dateTime:null,decoding:null,default:De,defer:De,dir:null,dirName:null,disabled:De,download:Wh,draggable:yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:De,formTarget:null,headers:et,height:re,hidden:Wh,high:re,href:null,hrefLang:null,htmlFor:et,httpEquiv:et,id:null,imageSizes:null,imageSrcSet:null,inert:De,inputMode:null,integrity:null,is:null,isMap:De,itemId:null,itemProp:et,itemRef:et,itemScope:De,itemType:et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:De,low:re,manifest:null,max:null,maxLength:re,media:null,method:null,min:null,minLength:re,multiple:De,muted:De,name:null,nonce:null,noModule:De,noValidate:De,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:De,optimum:re,pattern:null,ping:et,placeholder:null,playsInline:De,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:De,referrerPolicy:null,rel:et,required:De,reversed:De,rows:re,rowSpan:re,sandbox:et,scope:null,scoped:De,seamless:De,selected:De,shadowRootClonable:De,shadowRootDelegatesFocus:De,shadowRootMode:null,shape:null,size:re,sizes:null,slot:null,span:re,spellCheck:yt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:re,step:null,style:null,tabIndex:re,target:null,title:null,translate:null,type:null,typeMustMatch:De,useMap:null,value:yt,width:re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:et,axis:null,background:null,bgColor:null,border:re,borderColor:null,bottomMargin:re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:De,declare:De,event:null,face:null,frame:null,frameBorder:null,hSpace:re,leftMargin:re,link:null,longDesc:null,lowSrc:null,marginHeight:re,marginWidth:re,noResize:De,noHref:De,noShade:De,noWrap:De,object:null,profile:null,prompt:null,rev:null,rightMargin:re,rules:null,scheme:null,scrolling:yt,standby:null,summary:null,text:null,topMargin:re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:De,disableRemotePlayback:De,prefix:null,property:null,results:re,security:null,unselectable:null},space:"html",transform:H0}),Jk=zs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:kr,accentHeight:re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:re,amplitude:re,arabicForm:null,ascent:re,attributeName:null,attributeType:null,azimuth:re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:re,by:null,calcMode:null,capHeight:re,className:et,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:re,diffuseConstant:re,direction:null,display:null,dur:null,divisor:re,dominantBaseline:null,download:De,dx:null,dy:null,edgeMode:null,editable:null,elevation:re,enableBackground:null,end:null,event:null,exponent:re,externalResourcesRequired:null,fill:null,fillOpacity:re,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ks,g2:ks,glyphName:ks,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:re,horizOriginX:re,horizOriginY:re,id:null,ideographic:re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:re,k:re,k1:re,k2:re,k3:re,k4:re,kernelMatrix:kr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:re,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:re,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:re,overlineThickness:re,paintOrder:null,panose1:null,path:null,pathLength:re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:re,pointsAtY:re,pointsAtZ:re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kr,rev:kr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kr,requiredFeatures:kr,requiredFonts:kr,requiredFormats:kr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:re,specularExponent:re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:re,strikethroughThickness:re,string:null,stroke:null,strokeDashArray:kr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:re,strokeOpacity:re,strokeWidth:null,style:null,surfaceScale:re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kr,tabIndex:re,tableValues:null,target:null,targetX:re,targetY:re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:re,underlineThickness:re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:re,values:null,vAlphabetic:re,vMathematical:re,vectorEffect:null,vHanging:re,vIdeographic:re,version:null,vertAdvY:re,vertOriginX:re,vertOriginY:re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:W0}),U0=zs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),V0=zs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:H0}),K0=zs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Zk={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},eC=/[A-Z]/g,Gm=/-[a-z]/g,tC=/^data[-\w.:]+$/i;function rC(e,t){const r=Fh(t);let n=t,i=vr;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&tC.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Gm,iC);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Gm.test(s)){let o=s.replace(eC,nC);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Bf}return new i(n,t)}function nC(e){return"-"+e.toLowerCase()}function iC(e){return e.charAt(1).toUpperCase()}const sC=$0([F0,Qk,U0,V0,K0],"html"),Of=$0([F0,Jk,U0,V0,K0],"svg");function oC(e){return e.join(" ").trim()}var zf={},Qm=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,lC=/\n/g,aC=/^\s*/,cC=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,uC=/^:\s*/,hC=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,dC=/^[;\s]*/,fC=/^\s+|\s+$/g,pC=`
|
|
68
|
-
`,Jm="/",Zm="*",Li="",mC="comment",gC="declaration";function _C(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function i(m){var g=m.match(lC);g&&(r+=g.length);var S=m.lastIndexOf(pC);n=~S?m.length-S:n+m.length}function s(){var m={line:r,column:n};return function(g){return g.position=new o(m),c(),g}}function o(m){this.start=m,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(m){var g=new Error(t.source+":"+r+":"+n+": "+m);if(g.reason=m,g.filename=t.source,g.line=r,g.column=n,g.source=e,!t.silent)throw g}function a(m){var g=m.exec(e);if(g){var S=g[0];return i(S),e=e.slice(S.length),g}}function c(){a(aC)}function d(m){var g;for(m=m||[];g=h();)g!==!1&&m.push(g);return m}function h(){var m=s();if(!(Jm!=e.charAt(0)||Zm!=e.charAt(1))){for(var g=2;Li!=e.charAt(g)&&(Zm!=e.charAt(g)||Jm!=e.charAt(g+1));)++g;if(g+=2,Li===e.charAt(g-1))return l("End of comment missing");var S=e.slice(2,g-2);return n+=2,i(S),e=e.slice(g),n+=2,m({type:mC,comment:S})}}function f(){var m=s(),g=a(cC);if(g){if(h(),!a(uC))return l("property missing ':'");var S=a(hC),_=m({type:gC,property:eg(g[0].replace(Qm,Li)),value:S?eg(S[0].replace(Qm,Li)):Li});return a(dC),_}}function p(){var m=[];d(m);for(var g;g=f();)g!==!1&&(m.push(g),d(m));return m}return c(),p()}function eg(e){return e?e.replace(fC,Li):Li}var vC=_C,xC=ya&&ya.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zf,"__esModule",{value:!0});zf.default=bC;const yC=xC(vC);function bC(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,yC.default)(e),i=typeof t=="function";return n.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(r=r||{},r[o]=l)}),r}var bc={};Object.defineProperty(bc,"__esModule",{value:!0});bc.camelCase=void 0;var wC=/^--[a-zA-Z0-9_-]+$/,SC=/-([a-z])/g,kC=/^[^-]+$/,CC=/^-(webkit|moz|ms|o|khtml)-/,EC=/^-(ms)-/,NC=function(e){return!e||kC.test(e)||wC.test(e)},TC=function(e,t){return t.toUpperCase()},tg=function(e,t){return"".concat(t,"-")},PC=function(e,t){return t===void 0&&(t={}),NC(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(EC,tg):e=e.replace(CC,tg),e.replace(SC,TC))};bc.camelCase=PC;var LC=ya&&ya.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},RC=LC(zf),MC=bc;function Uh(e,t){var r={};return!e||typeof e!="string"||(0,RC.default)(e,function(n,i){n&&i&&(r[(0,MC.camelCase)(n,t)]=i)}),r}Uh.default=Uh;var IC=Uh;const DC=zd(IC),q0=Y0("end"),$f=Y0("start");function Y0(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function jC(e){const t=$f(e),r=q0(e);if(t&&r)return{start:t,end:r}}function To(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?rg(e.position):"start"in e||"end"in e?rg(e):"line"in e||"column"in e?Vh(e):""}function Vh(e){return ng(e&&e.line)+":"+ng(e&&e.column)}function rg(e){return Vh(e&&e.start)+"-"+Vh(e&&e.end)}function ng(e){return e&&typeof e=="number"?e:1}class Jt extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof n=="string"){const a=n.indexOf(":");a===-1?s.ruleId=n:(s.source=n.slice(0,a),s.ruleId=n.slice(a+1))}if(!s.place&&s.ancestors&&s.ancestors){const a=s.ancestors[s.ancestors.length-1];a&&(s.place=a.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=To(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Jt.prototype.file="";Jt.prototype.name="";Jt.prototype.reason="";Jt.prototype.message="";Jt.prototype.stack="";Jt.prototype.column=void 0;Jt.prototype.line=void 0;Jt.prototype.ancestors=void 0;Jt.prototype.cause=void 0;Jt.prototype.fatal=void 0;Jt.prototype.place=void 0;Jt.prototype.ruleId=void 0;Jt.prototype.source=void 0;const Ff={}.hasOwnProperty,AC=new Map,BC=/[A-Z]/g,OC=new Set(["table","tbody","thead","tfoot","tr"]),zC=new Set(["td","th"]),X0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function $C(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=YC(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=qC(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Of:sC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=G0(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function G0(e,t,r){if(t.type==="element")return FC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return WC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return UC(e,t,r);if(t.type==="mdxjsEsm")return HC(e,t);if(t.type==="root")return VC(e,t,r);if(t.type==="text")return KC(e,t)}function FC(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Of,e.schema=i),e.ancestors.push(t);const s=J0(e,t.tagName,!1),o=XC(e,t);let l=Hf(e,t);return OC.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!Xk(a):!0})),Q0(e,o,s,t),Wf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function WC(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}el(e,t.position)}function HC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);el(e,t.position)}function UC(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=Of,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:J0(e,t.name,!0),o=GC(e,t),l=Hf(e,t);return Q0(e,o,s,t),Wf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function VC(e,t,r){const n={};return Wf(n,Hf(e,t)),e.create(t,e.Fragment,n,r)}function KC(e,t){return t.value}function Q0(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function Wf(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function qC(e,t,r){return n;function n(i,s,o,l){const c=Array.isArray(o.children)?r:t;return l?c(s,o,l):c(s,o)}}function YC(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),a=$f(n);return t(i,s,o,l,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function XC(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&Ff.call(t.properties,i)){const s=QC(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&zC.has(t.tagName)?n=l:r[o]=l}}if(n){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function GC(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else el(e,t.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const l=n.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else el(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function Hf(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:AC;for(;++n<t.children.length;){const s=t.children[n];let o;if(e.passKeys){const a=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(a){const c=i.get(a)||0;o=a+"-"+c,i.set(a,c+1)}}const l=G0(e,s,o);l!==void 0&&r.push(l)}return r}function QC(e,t,r){const n=rC(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?Uk(r):oC(r)),n.property==="style"){let i=typeof r=="object"?r:JC(e,String(r));return e.stylePropertyNameCase==="css"&&(i=ZC(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?Zk[n.property]||n.property:n.attribute,r]}}function JC(e,t){try{return DC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,i=new Jt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=X0+"#cannot-parse-style-attribute",i}}function J0(e,t,r){let n;if(!r)n={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=qm(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}n=o}else n=qm(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return Ff.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);el(e)}function el(e,t){const r=new Jt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=X0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function ZC(e){const t={};let r;for(r in e)Ff.call(e,r)&&(t[e2(r)]=e[r]);return t}function e2(e){let t=e.replace(BC,t2);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function t2(e){return"-"+e.toLowerCase()}const cu={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},r2={};function Uf(e,t){const r=r2,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Z0(e,n,i)}function Z0(e,t,r){if(n2(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ig(e.children,t,r)}return Array.isArray(e)?ig(e,t,r):""}function ig(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=Z0(e[i],t,r);return n.join("")}function n2(e){return!!(e&&typeof e=="object")}const sg=document.createElement("i");function Vf(e){const t="&"+e+";";sg.innerHTML=t;const r=sg.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Tr(e,t,r,n){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function $r(e,t){return e.length>0?(Tr(e,e.length,0,t),e):t}const og={}.hasOwnProperty;function ey(e){const t={};let r=-1;for(;++r<e.length;)i2(t,e[r]);return t}function i2(e,t){let r;for(r in t){const i=(og.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){og.call(i,o)||(i[o]=[]);const l=s[o];s2(i[o],Array.isArray(l)?l:l?[l]:[])}}}function s2(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);Tr(e,0,0,n)}function ty(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function en(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rr=_i(/[A-Za-z]/),Gt=_i(/[\dA-Za-z]/),o2=_i(/[#-'*+\--9=?A-Z^-~]/);function Va(e){return e!==null&&(e<32||e===127)}const Kh=_i(/\d/),l2=_i(/[\dA-Fa-f]/),a2=_i(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function Ze(e){return e!==null&&(e<0||e===32)}function He(e){return e===-2||e===-1||e===32}const wc=_i(new RegExp("\\p{P}|\\p{S}","u")),Ui=_i(/\s/);function _i(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function $s(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&Gt(e.charCodeAt(r+1))&&Gt(e.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(r+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function Ke(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return He(a)?(e.enter(r),l(a)):t(a)}function l(a){return He(a)&&s++<i?(e.consume(a),l):(e.exit(r),t(a))}}const c2={tokenize:u2};function u2(e){const t=e.attempt(this.parser.constructs.contentInitial,n,i);let r;return t;function n(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ke(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const a=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=a),r=a,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ce(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const h2={tokenize:d2},lg={tokenize:f2};function d2(e){const t=this,r=[];let n=0,i,s,o;return l;function l(w){if(n<r.length){const N=r[n];return t.containerState=N[1],e.attempt(N[0].continuation,a,c)(w)}return c(w)}function a(w){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&x();const N=t.events.length;let L=N,C;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){C=t.events[L][1].end;break}_(n);let F=N;for(;F<t.events.length;)t.events[F][1].end={...C},F++;return Tr(t.events,L+1,0,t.events.slice(N)),t.events.length=F,c(w)}return l(w)}function c(w){if(n===r.length){if(!i)return f(w);if(i.currentConstruct&&i.currentConstruct.concrete)return m(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(lg,d,h)(w)}function d(w){return i&&x(),_(n),f(w)}function h(w){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,m(w)}function f(w){return t.containerState={},e.attempt(lg,p,m)(w)}function p(w){return n++,r.push([t.currentConstruct,t.containerState]),f(w)}function m(w){if(w===null){i&&x(),_(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(w)}function g(w){if(w===null){S(e.exit("chunkFlow"),!0),_(0),e.consume(w);return}return Ce(w)?(e.consume(w),S(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(w),g)}function S(w,N){const L=t.sliceStream(w);if(N&&L.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(L),t.parser.lazy[w.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;const F=t.events.length;let T=F,q,E;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(q){E=t.events[T][1].end;break}q=!0}for(_(n),C=F;C<t.events.length;)t.events[C][1].end={...E},C++;Tr(t.events,T+1,0,t.events.slice(F)),t.events.length=C}}function _(w){let N=r.length;for(;N-- >w;){const L=r[N];t.containerState=L[1],L[0].exit.call(t,e)}r.length=w}function x(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function f2(e,t,r){return Ke(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ms(e){if(e===null||Ze(e)||Ui(e))return 1;if(wc(e))return 2}function Sc(e,t,r){const n=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!n.includes(s)&&(t=s(t,r),n.push(s))}return t}const qh={name:"attention",resolveAll:p2,tokenize:m2};function p2(e,t){let r=-1,n,i,s,o,l,a,c,d;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const h={...e[n][1].end},f={...e[r][1].start};ag(h,-a),ag(f,a),o={type:a>1?"strongSequence":"emphasisSequence",start:h,end:{...e[n][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:f},s={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:a>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[n][1].end={...o.start},e[r][1].start={...l.end},c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=$r(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=$r(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=$r(c,Sc(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=$r(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(d=2,c=$r(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):d=0,Tr(e,n-1,r-n+3,c),r=n+c.length-d-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function m2(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Ms(n);let s;return o;function o(a){return s=a,e.enter("attentionSequence"),l(a)}function l(a){if(a===s)return e.consume(a),l;const c=e.exit("attentionSequence"),d=Ms(a),h=!d||d===2&&i||r.includes(a),f=!i||i===2&&d||r.includes(n);return c._open=!!(s===42?h:h&&(i||!f)),c._close=!!(s===42?f:f&&(d||!h)),t(a)}}function ag(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const g2={name:"autolink",tokenize:_2};function _2(e,t,r){let n=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return rr(p)?(e.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||Gt(p)?(n=1,l(p)):c(p)}function l(p){return p===58?(e.consume(p),n=0,a):(p===43||p===45||p===46||Gt(p))&&n++<32?(e.consume(p),l):(n=0,c(p))}function a(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Va(p)?r(p):(e.consume(p),a)}function c(p){return p===64?(e.consume(p),d):o2(p)?(e.consume(p),c):r(p)}function d(p){return Gt(p)?h(p):r(p)}function h(p){return p===46?(e.consume(p),n=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||Gt(p))&&n++<63){const m=p===45?f:h;return e.consume(p),m}return r(p)}}const ml={partial:!0,tokenize:v2};function v2(e,t,r){return n;function n(s){return He(s)?Ke(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ce(s)?t(s):r(s)}}const ry={continuation:{tokenize:y2},exit:b2,name:"blockQuote",tokenize:x2};function x2(e,t,r){const n=this;return i;function i(o){if(o===62){const l=n.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return r(o)}function s(o){return He(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function y2(e,t,r){const n=this;return i;function i(o){return He(o)?Ke(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(ry,t,r)(o)}}function b2(e){e.exit("blockQuote")}const ny={name:"characterEscape",tokenize:w2};function w2(e,t,r){return n;function n(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return a2(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const iy={name:"characterReference",tokenize:S2};function S2(e,t,r){const n=this;let i=0,s,o;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),a}function a(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=Gt,d(h))}function c(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=l2,d):(e.enter("characterReferenceValue"),s=7,o=Kh,d(h))}function d(h){if(h===59&&i){const f=e.exit("characterReferenceValue");return o===Gt&&!Vf(n.sliceSerialize(f))?r(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&i++<s?(e.consume(h),d):r(h)}}const cg={partial:!0,tokenize:C2},ug={concrete:!0,name:"codeFenced",tokenize:k2};function k2(e,t,r){const n=this,i={partial:!0,tokenize:L};let s=0,o=0,l;return a;function a(C){return c(C)}function c(C){const F=n.events[n.events.length-1];return s=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,l=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===l?(o++,e.consume(C),d):o<3?r(C):(e.exit("codeFencedFenceSequence"),He(C)?Ke(e,h,"whitespace")(C):h(C))}function h(C){return C===null||Ce(C)?(e.exit("codeFencedFence"),n.interrupt?t(C):e.check(cg,g,N)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||Ce(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(C)):He(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ke(e,p,"whitespace")(C)):C===96&&C===l?r(C):(e.consume(C),f)}function p(C){return C===null||Ce(C)?h(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||Ce(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===l?r(C):(e.consume(C),m)}function g(C){return e.attempt(i,N,S)(C)}function S(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),_}function _(C){return s>0&&He(C)?Ke(e,x,"linePrefix",s+1)(C):x(C)}function x(C){return C===null||Ce(C)?e.check(cg,g,N)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||Ce(C)?(e.exit("codeFlowValue"),x(C)):(e.consume(C),w)}function N(C){return e.exit("codeFenced"),t(C)}function L(C,F,T){let q=0;return E;function E(z){return C.enter("lineEnding"),C.consume(z),C.exit("lineEnding"),A}function A(z){return C.enter("codeFencedFence"),He(z)?Ke(C,R,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):R(z)}function R(z){return z===l?(C.enter("codeFencedFenceSequence"),P(z)):T(z)}function P(z){return z===l?(q++,C.consume(z),P):q>=o?(C.exit("codeFencedFenceSequence"),He(z)?Ke(C,$,"whitespace")(z):$(z)):T(z)}function $(z){return z===null||Ce(z)?(C.exit("codeFencedFence"),F(z)):T(z)}}}function C2(e,t,r){const n=this;return i;function i(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}const uu={name:"codeIndented",tokenize:N2},E2={partial:!0,tokenize:T2};function N2(e,t,r){const n=this;return i;function i(c){return e.enter("codeIndented"),Ke(e,s,"linePrefix",5)(c)}function s(c){const d=n.events[n.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?a(c):Ce(c)?e.attempt(E2,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||Ce(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function T2(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ke(e,s,"linePrefix",5)(o)}function s(o){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Ce(o)?i(o):r(o)}}const P2={name:"codeText",previous:R2,resolve:L2,tokenize:M2};function L2(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)i===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(i=n):(n===t||e[n][1].type==="lineEnding")&&(e[i][1].type="codeTextData",n!==i+2&&(e[i][1].end=e[n-1][1].end,e.splice(i+2,n-i-2),t-=n-i-2,n=i+2),i=void 0);return e}function R2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function M2(e,t,r){let n=0,i,s;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),n++,l):(e.exit("codeTextSequence"),a(h))}function a(h){return h===null?r(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),a):h===96?(s=e.enter("codeTextSequence"),i=0,d(h)):Ce(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),a):(e.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||Ce(h)?(e.exit("codeTextData"),a(h)):(e.consume(h),c)}function d(h){return h===96?(e.consume(h),i++,d):i===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(s.type="codeTextData",c(h))}}class I2{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Js(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Js(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Js(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);Js(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Js(this.left,r.reverse())}}}function Js(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function sy(e){const t={};let r=-1,n,i,s,o,l,a,c;const d=new I2(e);for(;++r<d.length;){for(;r in t;)r=t[r];if(n=d.get(r),r&&n[1].type==="chunkFlow"&&d.get(r-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,s=0,s<a.length&&a[s][1].type==="lineEndingBlank"&&(s+=2),s<a.length&&a[s][1].type==="content"))for(;++s<a.length&&a[s][1].type!=="content";)a[s][1].type==="chunkText"&&(a[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,D2(d,r)),r=t[r],c=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...d.get(i)[1].start},l=d.slice(i,r),l.unshift(n),d.splice(i,r-i+1,l))}}return Tr(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function D2(e,t){const r=e.get(t)[1],n=e.get(t)[2];let i=t-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,a=[],c={};let d,h,f=-1,p=r,m=0,g=0;const S=[g];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(d=n.sliceStream(p),p.next||d.push(null),h&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=r;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(g=f+1,S.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):S.pop(),f=S.length;f--;){const _=l.slice(S[f],S[f+1]),x=s.pop();a.push([x,x+_.length-1]),e.splice(x,2,_)}for(a.reverse(),f=-1;++f<a.length;)c[m+a[f][0]]=m+a[f][1],m+=a[f][1]-a[f][0]-1;return c}const j2={resolve:B2,tokenize:O2},A2={partial:!0,tokenize:z2};function B2(e){return sy(e),e}function O2(e,t){let r;return n;function n(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):Ce(l)?e.check(A2,o,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function z2(e,t,r){const n=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ke(e,s,"linePrefix")}function s(o){if(o===null||Ce(o))return r(o);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(n.parser.constructs.flow,r,t)(o)}}function oy(e,t,r,n,i,s,o,l,a){const c=a||Number.POSITIVE_INFINITY;let d=0;return h;function h(_){return _===60?(e.enter(n),e.enter(i),e.enter(s),e.consume(_),e.exit(s),f):_===null||_===32||_===41||Va(_)?r(_):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(_))}function f(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===62?(e.exit("chunkString"),e.exit(l),f(_)):_===null||_===60||Ce(_)?r(_):(e.consume(_),_===92?m:p)}function m(_){return _===60||_===62||_===92?(e.consume(_),p):p(_)}function g(_){return!d&&(_===null||_===41||Ze(_))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(_)):d<c&&_===40?(e.consume(_),d++,g):_===41?(e.consume(_),d--,g):_===null||_===32||_===40||Va(_)?r(_):(e.consume(_),_===92?S:g)}function S(_){return _===40||_===41||_===92?(e.consume(_),g):g(_)}}function ly(e,t,r,n,i,s){const o=this;let l=0,a;return c;function c(p){return e.enter(n),e.enter(i),e.consume(p),e.exit(i),e.enter(s),d}function d(p){return l>999||p===null||p===91||p===93&&!a||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(n),t):Ce(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||Ce(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),a||(a=!He(p)),p===92?f:h)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,h):h(p)}}function ay(e,t,r,n,i,s){let o;return l;function l(f){return f===34||f===39||f===40?(e.enter(n),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,a):r(f)}function a(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(n),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),a(o)):f===null?r(f):Ce(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ke(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||Ce(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(e.consume(f),d):d(f)}}function Po(e,t){let r;return n;function n(i){return Ce(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):He(i)?Ke(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const $2={name:"definition",tokenize:W2},F2={partial:!0,tokenize:H2};function W2(e,t,r){const n=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return ly.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=en(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),a):r(p)}function a(p){return Ze(p)?Po(e,c)(p):c(p)}function c(p){return oy(e,d,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(F2,h,h)(p)}function h(p){return He(p)?Ke(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Ce(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function H2(e,t,r){return n;function n(l){return Ze(l)?Po(e,i)(l):r(l)}function i(l){return ay(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return He(l)?Ke(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Ce(l)?t(l):r(l)}}const U2={name:"hardBreakEscape",tokenize:V2};function V2(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ce(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const K2={name:"headingAtx",resolve:q2,tokenize:Y2};function q2(e,t){let r=e.length-2,n=3,i,s;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},s={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Tr(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Y2(e,t,r){let n=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&n++<6?(e.consume(d),o):d===null||Ze(d)?(e.exit("atxHeadingSequence"),l(d)):r(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),a(d)):d===null||Ce(d)?(e.exit("atxHeading"),t(d)):He(d)?Ke(e,l,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function a(d){return d===35?(e.consume(d),a):(e.exit("atxHeadingSequence"),l(d))}function c(d){return d===null||d===35||Ze(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const X2=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],hg=["pre","script","style","textarea"],G2={concrete:!0,name:"htmlFlow",resolveTo:Z2,tokenize:eE},Q2={partial:!0,tokenize:rE},J2={partial:!0,tokenize:tE};function Z2(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function eE(e,t,r){const n=this;let i,s,o,l,a;return c;function c(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),h}function h(k){return k===33?(e.consume(k),f):k===47?(e.consume(k),s=!0,g):k===63?(e.consume(k),i=3,n.interrupt?t:y):rr(k)?(e.consume(k),o=String.fromCharCode(k),S):r(k)}function f(k){return k===45?(e.consume(k),i=2,p):k===91?(e.consume(k),i=5,l=0,m):rr(k)?(e.consume(k),i=4,n.interrupt?t:y):r(k)}function p(k){return k===45?(e.consume(k),n.interrupt?t:y):r(k)}function m(k){const we="CDATA[";return k===we.charCodeAt(l++)?(e.consume(k),l===we.length?n.interrupt?t:R:m):r(k)}function g(k){return rr(k)?(e.consume(k),o=String.fromCharCode(k),S):r(k)}function S(k){if(k===null||k===47||k===62||Ze(k)){const we=k===47,U=o.toLowerCase();return!we&&!s&&hg.includes(U)?(i=1,n.interrupt?t(k):R(k)):X2.includes(o.toLowerCase())?(i=6,we?(e.consume(k),_):n.interrupt?t(k):R(k)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(k):s?x(k):w(k))}return k===45||Gt(k)?(e.consume(k),o+=String.fromCharCode(k),S):r(k)}function _(k){return k===62?(e.consume(k),n.interrupt?t:R):r(k)}function x(k){return He(k)?(e.consume(k),x):E(k)}function w(k){return k===47?(e.consume(k),E):k===58||k===95||rr(k)?(e.consume(k),N):He(k)?(e.consume(k),w):E(k)}function N(k){return k===45||k===46||k===58||k===95||Gt(k)?(e.consume(k),N):L(k)}function L(k){return k===61?(e.consume(k),C):He(k)?(e.consume(k),L):w(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(e.consume(k),a=k,F):He(k)?(e.consume(k),C):T(k)}function F(k){return k===a?(e.consume(k),a=null,q):k===null||Ce(k)?r(k):(e.consume(k),F)}function T(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Ze(k)?L(k):(e.consume(k),T)}function q(k){return k===47||k===62||He(k)?w(k):r(k)}function E(k){return k===62?(e.consume(k),A):r(k)}function A(k){return k===null||Ce(k)?R(k):He(k)?(e.consume(k),A):r(k)}function R(k){return k===45&&i===2?(e.consume(k),D):k===60&&i===1?(e.consume(k),H):k===62&&i===4?(e.consume(k),Q):k===63&&i===3?(e.consume(k),y):k===93&&i===5?(e.consume(k),W):Ce(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Q2,ae,P)(k)):k===null||Ce(k)?(e.exit("htmlFlowData"),P(k)):(e.consume(k),R)}function P(k){return e.check(J2,$,ae)(k)}function $(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),z}function z(k){return k===null||Ce(k)?P(k):(e.enter("htmlFlowData"),R(k))}function D(k){return k===45?(e.consume(k),y):R(k)}function H(k){return k===47?(e.consume(k),o="",I):R(k)}function I(k){if(k===62){const we=o.toLowerCase();return hg.includes(we)?(e.consume(k),Q):R(k)}return rr(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),I):R(k)}function W(k){return k===93?(e.consume(k),y):R(k)}function y(k){return k===62?(e.consume(k),Q):k===45&&i===2?(e.consume(k),y):R(k)}function Q(k){return k===null||Ce(k)?(e.exit("htmlFlowData"),ae(k)):(e.consume(k),Q)}function ae(k){return e.exit("htmlFlow"),t(k)}}function tE(e,t,r){const n=this;return i;function i(o){return Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}function rE(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(ml,t,r)}}const nE={name:"htmlText",tokenize:iE};function iE(e,t,r){const n=this;let i,s,o;return l;function l(y){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(y),a}function a(y){return y===33?(e.consume(y),c):y===47?(e.consume(y),L):y===63?(e.consume(y),w):rr(y)?(e.consume(y),T):r(y)}function c(y){return y===45?(e.consume(y),d):y===91?(e.consume(y),s=0,m):rr(y)?(e.consume(y),x):r(y)}function d(y){return y===45?(e.consume(y),p):r(y)}function h(y){return y===null?r(y):y===45?(e.consume(y),f):Ce(y)?(o=h,H(y)):(e.consume(y),h)}function f(y){return y===45?(e.consume(y),p):h(y)}function p(y){return y===62?D(y):y===45?f(y):h(y)}function m(y){const Q="CDATA[";return y===Q.charCodeAt(s++)?(e.consume(y),s===Q.length?g:m):r(y)}function g(y){return y===null?r(y):y===93?(e.consume(y),S):Ce(y)?(o=g,H(y)):(e.consume(y),g)}function S(y){return y===93?(e.consume(y),_):g(y)}function _(y){return y===62?D(y):y===93?(e.consume(y),_):g(y)}function x(y){return y===null||y===62?D(y):Ce(y)?(o=x,H(y)):(e.consume(y),x)}function w(y){return y===null?r(y):y===63?(e.consume(y),N):Ce(y)?(o=w,H(y)):(e.consume(y),w)}function N(y){return y===62?D(y):w(y)}function L(y){return rr(y)?(e.consume(y),C):r(y)}function C(y){return y===45||Gt(y)?(e.consume(y),C):F(y)}function F(y){return Ce(y)?(o=F,H(y)):He(y)?(e.consume(y),F):D(y)}function T(y){return y===45||Gt(y)?(e.consume(y),T):y===47||y===62||Ze(y)?q(y):r(y)}function q(y){return y===47?(e.consume(y),D):y===58||y===95||rr(y)?(e.consume(y),E):Ce(y)?(o=q,H(y)):He(y)?(e.consume(y),q):D(y)}function E(y){return y===45||y===46||y===58||y===95||Gt(y)?(e.consume(y),E):A(y)}function A(y){return y===61?(e.consume(y),R):Ce(y)?(o=A,H(y)):He(y)?(e.consume(y),A):q(y)}function R(y){return y===null||y===60||y===61||y===62||y===96?r(y):y===34||y===39?(e.consume(y),i=y,P):Ce(y)?(o=R,H(y)):He(y)?(e.consume(y),R):(e.consume(y),$)}function P(y){return y===i?(e.consume(y),i=void 0,z):y===null?r(y):Ce(y)?(o=P,H(y)):(e.consume(y),P)}function $(y){return y===null||y===34||y===39||y===60||y===61||y===96?r(y):y===47||y===62||Ze(y)?q(y):(e.consume(y),$)}function z(y){return y===47||y===62||Ze(y)?q(y):r(y)}function D(y){return y===62?(e.consume(y),e.exit("htmlTextData"),e.exit("htmlText"),t):r(y)}function H(y){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),I}function I(y){return He(y)?Ke(e,W,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):W(y)}function W(y){return e.enter("htmlTextData"),o(y)}}const Kf={name:"labelEnd",resolveAll:aE,resolveTo:cE,tokenize:uE},sE={tokenize:hE},oE={tokenize:dE},lE={tokenize:fE};function aE(e){let t=-1;const r=[];for(;++t<e.length;){const n=e[t][1];if(r.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",t+=i}}return e.length!==r.length&&Tr(e,0,e.length,r),e}function cE(e,t){let r=e.length,n=0,i,s,o,l;for(;r--;)if(i=e[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const a={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[s+n+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",a,t],["enter",c,t]],l=$r(l,e.slice(s+1,s+n+3)),l=$r(l,[["enter",d,t]]),l=$r(l,Sc(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=$r(l,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),l=$r(l,e.slice(o+1)),l=$r(l,[["exit",a,t]]),Tr(e,s,e.length,l),e}function uE(e,t,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return l;function l(f){return s?s._inactive?h(f):(o=n.parser.defined.includes(en(n.sliceSerialize({start:s.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),a):r(f)}function a(f){return f===40?e.attempt(sE,d,o?d:h)(f):f===91?e.attempt(oE,d,o?c:h)(f):o?d(f):h(f)}function c(f){return e.attempt(lE,d,h)(f)}function d(f){return t(f)}function h(f){return s._balanced=!0,r(f)}}function hE(e,t,r){return n;function n(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return Ze(h)?Po(e,s)(h):s(h)}function s(h){return h===41?d(h):oy(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Ze(h)?Po(e,a)(h):d(h)}function l(h){return r(h)}function a(h){return h===34||h===39||h===40?ay(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return Ze(h)?Po(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):r(h)}}function dE(e,t,r){const n=this;return i;function i(l){return ly.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes(en(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function fE(e,t,r){return n;function n(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):r(s)}}const pE={name:"labelStartImage",resolveAll:Kf.resolveAll,tokenize:mE};function mE(e,t,r){const n=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):t(l)}}const gE={name:"labelStartLink",resolveAll:Kf.resolveAll,tokenize:_E};function _E(e,t,r){const n=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):t(o)}}const hu={name:"lineEnding",tokenize:vE};function vE(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Ke(e,t,"linePrefix")}}const ca={name:"thematicBreak",tokenize:xE};function xE(e,t,r){let n=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,l(c)}function l(c){return c===i?(e.enter("thematicBreakSequence"),a(c)):n>=3&&(c===null||Ce(c))?(e.exit("thematicBreak"),t(c)):r(c)}function a(c){return c===i?(e.consume(c),n++,a):(e.exit("thematicBreakSequence"),He(c)?Ke(e,l,"whitespace")(c):l(c))}}const hr={continuation:{tokenize:SE},exit:CE,name:"list",tokenize:wE},yE={partial:!0,tokenize:EE},bE={partial:!0,tokenize:kE};function wE(e,t,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(p){const m=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Kh(p)){if(n.containerState.type||(n.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ca,r,c)(p):c(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(p)}return r(p)}function a(p){return Kh(p)&&++o<10?(e.consume(p),a):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):r(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(ml,n.interrupt?r:d,e.attempt(yE,f,h))}function d(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function h(p){return He(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):r(p)}function f(p){return n.containerState.size=s+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function SE(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(ml,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Ke(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!He(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(bE,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Ke(e,e.attempt(hr,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function kE(e,t,r){const n=this;return Ke(e,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(s):r(s)}}function CE(e){e.exit(this.containerState.type)}function EE(e,t,r){const n=this;return Ke(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!He(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const dg={name:"setextUnderline",resolveTo:NE,tokenize:TE};function NE(e,t){let r=e.length,n,i,s;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!s&&e[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[n][1],t]),e[n][1].end={...e[s][1].end}):e[n][1]=o,e.push(["exit",o,t]),e}function TE(e,t,r){const n=this;let i;return s;function s(c){let d=n.events.length,h;for(;d--;)if(n.events[d][1].type!=="lineEnding"&&n.events[d][1].type!=="linePrefix"&&n.events[d][1].type!=="content"){h=n.events[d][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(e.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),He(c)?Ke(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||Ce(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const PE={tokenize:LE};function LE(e){const t=this,r=e.attempt(ml,n,e.attempt(this.parser.constructs.flowInitial,i,Ke(e,e.attempt(this.parser.constructs.flow,i,e.attempt(j2,i)),"linePrefix")));return r;function n(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const RE={resolveAll:uy()},ME=cy("string"),IE=cy("text");function cy(e){return{resolveAll:uy(e==="text"?DE:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],s=r.attempt(i,o,l);return o;function o(d){return c(d)?s(d):l(d)}function l(d){if(d===null){r.consume(d);return}return r.enter("data"),r.consume(d),a}function a(d){return c(d)?(r.exit("data"),s(d)):(r.consume(d),a)}function c(d){if(d===null)return!0;const h=i[d];let f=-1;if(h)for(;++f<h.length;){const p=h[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function uy(e){return t;function t(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(r,n):r}}function DE(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const n=e[r-1][1],i=t.sliceStream(n);let s=i.length,o=-1,l=0,a;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(c===-2)a=!0,l++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){const c={type:r===e.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(e.splice(r,0,["enter",c,t],["exit",c,t]),r+=2)}r++}return e}const jE={42:hr,43:hr,45:hr,48:hr,49:hr,50:hr,51:hr,52:hr,53:hr,54:hr,55:hr,56:hr,57:hr,62:ry},AE={91:$2},BE={[-2]:uu,[-1]:uu,32:uu},OE={35:K2,42:ca,45:[dg,ca],60:G2,61:dg,95:ca,96:ug,126:ug},zE={38:iy,92:ny},$E={[-5]:hu,[-4]:hu,[-3]:hu,33:pE,38:iy,42:qh,60:[g2,nE],91:gE,92:[U2,ny],93:Kf,95:qh,96:P2},FE={null:[qh,RE]},WE={null:[42,95]},HE={null:[]},UE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:WE,contentInitial:AE,disable:HE,document:jE,flow:OE,flowInitial:BE,insideSpan:FE,string:zE,text:$E},Symbol.toStringTag,{value:"Module"}));function VE(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],l=[];const a={attempt:F(L),check:F(C),consume:x,enter:w,exit:N,interrupt:F(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:h};let d=t.tokenize.call(c,a);return t.resolveAll&&s.push(t),c;function h(A){return o=$r(o,A),S(),o[o.length-1]!==null?[]:(T(t,0),c.events=Sc(s,c.events,c),c.events)}function f(A,R){return qE(p(A),R)}function p(A){return KE(o,A)}function m(){const{_bufferIndex:A,_index:R,line:P,column:$,offset:z}=n;return{_bufferIndex:A,_index:R,line:P,column:$,offset:z}}function g(A){i[A.line]=A.column,E()}function S(){let A;for(;n._index<o.length;){const R=o[n._index];if(typeof R=="string")for(A=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===A&&n._bufferIndex<R.length;)_(R.charCodeAt(n._bufferIndex));else _(R)}}function _(A){d=d(A)}function x(A){Ce(A)?(n.line++,n.column=1,n.offset+=A===-3?2:1,E()):A!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=A}function w(A,R){const P=R||{};return P.type=A,P.start=m(),c.events.push(["enter",P,c]),l.push(P),P}function N(A){const R=l.pop();return R.end=m(),c.events.push(["exit",R,c]),R}function L(A,R){T(A,R.from)}function C(A,R){R.restore()}function F(A,R){return P;function P($,z,D){let H,I,W,y;return Array.isArray($)?ae($):"tokenize"in $?ae([$]):Q($);function Q(Y){return te;function te(fe){const de=fe!==null&&Y[fe],Oe=fe!==null&&Y.null,Ve=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(Oe)?Oe:Oe?[Oe]:[]];return ae(Ve)(fe)}}function ae(Y){return H=Y,I=0,Y.length===0?D:k(Y[I])}function k(Y){return te;function te(fe){return y=q(),W=Y,Y.partial||(c.currentConstruct=Y),Y.name&&c.parser.constructs.disable.null.includes(Y.name)?U():Y.tokenize.call(R?Object.assign(Object.create(c),R):c,a,we,U)(fe)}}function we(Y){return A(W,y),z}function U(Y){return y.restore(),++I<H.length?k(H[I]):D}}}function T(A,R){A.resolveAll&&!s.includes(A)&&s.push(A),A.resolve&&Tr(c.events,R,c.events.length-R,A.resolve(c.events.slice(R),c)),A.resolveTo&&(c.events=A.resolveTo(c.events,c))}function q(){const A=m(),R=c.previous,P=c.currentConstruct,$=c.events.length,z=Array.from(l);return{from:$,restore:D};function D(){n=A,c.previous=R,c.currentConstruct=P,c.events.length=$,l=z,E()}}function E(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function KE(e,t){const r=t.start._index,n=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(r===i)o=[e[r].slice(n,s)];else{if(o=e.slice(r,i),n>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(n):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function qE(e,t){let r=-1;const n=[];let i;for(;++r<e.length;){const s=e[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
68
|
+
`,Jm="/",Zm="*",Li="",mC="comment",gC="declaration";function _C(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function i(m){var g=m.match(lC);g&&(r+=g.length);var S=m.lastIndexOf(pC);n=~S?m.length-S:n+m.length}function s(){var m={line:r,column:n};return function(g){return g.position=new o(m),c(),g}}function o(m){this.start=m,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(m){var g=new Error(t.source+":"+r+":"+n+": "+m);if(g.reason=m,g.filename=t.source,g.line=r,g.column=n,g.source=e,!t.silent)throw g}function a(m){var g=m.exec(e);if(g){var S=g[0];return i(S),e=e.slice(S.length),g}}function c(){a(aC)}function d(m){var g;for(m=m||[];g=h();)g!==!1&&m.push(g);return m}function h(){var m=s();if(!(Jm!=e.charAt(0)||Zm!=e.charAt(1))){for(var g=2;Li!=e.charAt(g)&&(Zm!=e.charAt(g)||Jm!=e.charAt(g+1));)++g;if(g+=2,Li===e.charAt(g-1))return l("End of comment missing");var S=e.slice(2,g-2);return n+=2,i(S),e=e.slice(g),n+=2,m({type:mC,comment:S})}}function f(){var m=s(),g=a(cC);if(g){if(h(),!a(uC))return l("property missing ':'");var S=a(hC),_=m({type:gC,property:eg(g[0].replace(Qm,Li)),value:S?eg(S[0].replace(Qm,Li)):Li});return a(dC),_}}function p(){var m=[];d(m);for(var g;g=f();)g!==!1&&(m.push(g),d(m));return m}return c(),p()}function eg(e){return e?e.replace(fC,Li):Li}var vC=_C,xC=ya&&ya.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zf,"__esModule",{value:!0});zf.default=bC;const yC=xC(vC);function bC(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,yC.default)(e),i=typeof t=="function";return n.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(r=r||{},r[o]=l)}),r}var bc={};Object.defineProperty(bc,"__esModule",{value:!0});bc.camelCase=void 0;var wC=/^--[a-zA-Z0-9_-]+$/,SC=/-([a-z])/g,kC=/^[^-]+$/,CC=/^-(webkit|moz|ms|o|khtml)-/,EC=/^-(ms)-/,NC=function(e){return!e||kC.test(e)||wC.test(e)},PC=function(e,t){return t.toUpperCase()},tg=function(e,t){return"".concat(t,"-")},TC=function(e,t){return t===void 0&&(t={}),NC(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(EC,tg):e=e.replace(CC,tg),e.replace(SC,PC))};bc.camelCase=TC;var LC=ya&&ya.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},RC=LC(zf),MC=bc;function Uh(e,t){var r={};return!e||typeof e!="string"||(0,RC.default)(e,function(n,i){n&&i&&(r[(0,MC.camelCase)(n,t)]=i)}),r}Uh.default=Uh;var IC=Uh;const DC=zd(IC),q0=Y0("end"),$f=Y0("start");function Y0(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function jC(e){const t=$f(e),r=q0(e);if(t&&r)return{start:t,end:r}}function Po(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?rg(e.position):"start"in e||"end"in e?rg(e):"line"in e||"column"in e?Vh(e):""}function Vh(e){return ng(e&&e.line)+":"+ng(e&&e.column)}function rg(e){return Vh(e&&e.start)+"-"+Vh(e&&e.end)}function ng(e){return e&&typeof e=="number"?e:1}class Jt extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof n=="string"){const a=n.indexOf(":");a===-1?s.ruleId=n:(s.source=n.slice(0,a),s.ruleId=n.slice(a+1))}if(!s.place&&s.ancestors&&s.ancestors){const a=s.ancestors[s.ancestors.length-1];a&&(s.place=a.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=Po(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Jt.prototype.file="";Jt.prototype.name="";Jt.prototype.reason="";Jt.prototype.message="";Jt.prototype.stack="";Jt.prototype.column=void 0;Jt.prototype.line=void 0;Jt.prototype.ancestors=void 0;Jt.prototype.cause=void 0;Jt.prototype.fatal=void 0;Jt.prototype.place=void 0;Jt.prototype.ruleId=void 0;Jt.prototype.source=void 0;const Ff={}.hasOwnProperty,AC=new Map,BC=/[A-Z]/g,OC=new Set(["table","tbody","thead","tfoot","tr"]),zC=new Set(["td","th"]),X0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function $C(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=YC(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=qC(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Of:sC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=G0(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function G0(e,t,r){if(t.type==="element")return FC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return WC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return UC(e,t,r);if(t.type==="mdxjsEsm")return HC(e,t);if(t.type==="root")return VC(e,t,r);if(t.type==="text")return KC(e,t)}function FC(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Of,e.schema=i),e.ancestors.push(t);const s=J0(e,t.tagName,!1),o=XC(e,t);let l=Hf(e,t);return OC.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!Xk(a):!0})),Q0(e,o,s,t),Wf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function WC(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}el(e,t.position)}function HC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);el(e,t.position)}function UC(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=Of,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:J0(e,t.name,!0),o=GC(e,t),l=Hf(e,t);return Q0(e,o,s,t),Wf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function VC(e,t,r){const n={};return Wf(n,Hf(e,t)),e.create(t,e.Fragment,n,r)}function KC(e,t){return t.value}function Q0(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function Wf(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function qC(e,t,r){return n;function n(i,s,o,l){const c=Array.isArray(o.children)?r:t;return l?c(s,o,l):c(s,o)}}function YC(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),a=$f(n);return t(i,s,o,l,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function XC(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&Ff.call(t.properties,i)){const s=QC(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&zC.has(t.tagName)?n=l:r[o]=l}}if(n){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function GC(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else el(e,t.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const l=n.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else el(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function Hf(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:AC;for(;++n<t.children.length;){const s=t.children[n];let o;if(e.passKeys){const a=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(a){const c=i.get(a)||0;o=a+"-"+c,i.set(a,c+1)}}const l=G0(e,s,o);l!==void 0&&r.push(l)}return r}function QC(e,t,r){const n=rC(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?Uk(r):oC(r)),n.property==="style"){let i=typeof r=="object"?r:JC(e,String(r));return e.stylePropertyNameCase==="css"&&(i=ZC(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?Zk[n.property]||n.property:n.attribute,r]}}function JC(e,t){try{return DC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,i=new Jt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=X0+"#cannot-parse-style-attribute",i}}function J0(e,t,r){let n;if(!r)n={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=qm(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}n=o}else n=qm(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return Ff.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);el(e)}function el(e,t){const r=new Jt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=X0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function ZC(e){const t={};let r;for(r in e)Ff.call(e,r)&&(t[e2(r)]=e[r]);return t}function e2(e){let t=e.replace(BC,t2);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function t2(e){return"-"+e.toLowerCase()}const cu={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},r2={};function Uf(e,t){const r=r2,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Z0(e,n,i)}function Z0(e,t,r){if(n2(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ig(e.children,t,r)}return Array.isArray(e)?ig(e,t,r):""}function ig(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=Z0(e[i],t,r);return n.join("")}function n2(e){return!!(e&&typeof e=="object")}const sg=document.createElement("i");function Vf(e){const t="&"+e+";";sg.innerHTML=t;const r=sg.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Pr(e,t,r,n){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function $r(e,t){return e.length>0?(Pr(e,e.length,0,t),e):t}const og={}.hasOwnProperty;function ey(e){const t={};let r=-1;for(;++r<e.length;)i2(t,e[r]);return t}function i2(e,t){let r;for(r in t){const i=(og.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){og.call(i,o)||(i[o]=[]);const l=s[o];s2(i[o],Array.isArray(l)?l:l?[l]:[])}}}function s2(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);Pr(e,0,0,n)}function ty(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function en(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rr=_i(/[A-Za-z]/),Gt=_i(/[\dA-Za-z]/),o2=_i(/[#-'*+\--9=?A-Z^-~]/);function Va(e){return e!==null&&(e<32||e===127)}const Kh=_i(/\d/),l2=_i(/[\dA-Fa-f]/),a2=_i(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function Ze(e){return e!==null&&(e<0||e===32)}function He(e){return e===-2||e===-1||e===32}const wc=_i(new RegExp("\\p{P}|\\p{S}","u")),Ui=_i(/\s/);function _i(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function $s(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&Gt(e.charCodeAt(r+1))&&Gt(e.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(r+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function Ke(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return He(a)?(e.enter(r),l(a)):t(a)}function l(a){return He(a)&&s++<i?(e.consume(a),l):(e.exit(r),t(a))}}const c2={tokenize:u2};function u2(e){const t=e.attempt(this.parser.constructs.contentInitial,n,i);let r;return t;function n(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ke(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const a=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=a),r=a,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ce(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const h2={tokenize:d2},lg={tokenize:f2};function d2(e){const t=this,r=[];let n=0,i,s,o;return l;function l(w){if(n<r.length){const N=r[n];return t.containerState=N[1],e.attempt(N[0].continuation,a,c)(w)}return c(w)}function a(w){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&x();const N=t.events.length;let L=N,C;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){C=t.events[L][1].end;break}_(n);let F=N;for(;F<t.events.length;)t.events[F][1].end={...C},F++;return Pr(t.events,L+1,0,t.events.slice(N)),t.events.length=F,c(w)}return l(w)}function c(w){if(n===r.length){if(!i)return f(w);if(i.currentConstruct&&i.currentConstruct.concrete)return m(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(lg,d,h)(w)}function d(w){return i&&x(),_(n),f(w)}function h(w){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,m(w)}function f(w){return t.containerState={},e.attempt(lg,p,m)(w)}function p(w){return n++,r.push([t.currentConstruct,t.containerState]),f(w)}function m(w){if(w===null){i&&x(),_(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(w)}function g(w){if(w===null){S(e.exit("chunkFlow"),!0),_(0),e.consume(w);return}return Ce(w)?(e.consume(w),S(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(w),g)}function S(w,N){const L=t.sliceStream(w);if(N&&L.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(L),t.parser.lazy[w.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<o&&(!i.events[C][1].end||i.events[C][1].end.offset>o))return;const F=t.events.length;let P=F,q,E;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(q){E=t.events[P][1].end;break}q=!0}for(_(n),C=F;C<t.events.length;)t.events[C][1].end={...E},C++;Pr(t.events,P+1,0,t.events.slice(F)),t.events.length=C}}function _(w){let N=r.length;for(;N-- >w;){const L=r[N];t.containerState=L[1],L[0].exit.call(t,e)}r.length=w}function x(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function f2(e,t,r){return Ke(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ms(e){if(e===null||Ze(e)||Ui(e))return 1;if(wc(e))return 2}function Sc(e,t,r){const n=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!n.includes(s)&&(t=s(t,r),n.push(s))}return t}const qh={name:"attention",resolveAll:p2,tokenize:m2};function p2(e,t){let r=-1,n,i,s,o,l,a,c,d;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const h={...e[n][1].end},f={...e[r][1].start};ag(h,-a),ag(f,a),o={type:a>1?"strongSequence":"emphasisSequence",start:h,end:{...e[n][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:f},s={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:a>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[n][1].end={...o.start},e[r][1].start={...l.end},c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=$r(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=$r(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=$r(c,Sc(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=$r(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(d=2,c=$r(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):d=0,Pr(e,n-1,r-n+3,c),r=n+c.length-d-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function m2(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Ms(n);let s;return o;function o(a){return s=a,e.enter("attentionSequence"),l(a)}function l(a){if(a===s)return e.consume(a),l;const c=e.exit("attentionSequence"),d=Ms(a),h=!d||d===2&&i||r.includes(a),f=!i||i===2&&d||r.includes(n);return c._open=!!(s===42?h:h&&(i||!f)),c._close=!!(s===42?f:f&&(d||!h)),t(a)}}function ag(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const g2={name:"autolink",tokenize:_2};function _2(e,t,r){let n=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return rr(p)?(e.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||Gt(p)?(n=1,l(p)):c(p)}function l(p){return p===58?(e.consume(p),n=0,a):(p===43||p===45||p===46||Gt(p))&&n++<32?(e.consume(p),l):(n=0,c(p))}function a(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Va(p)?r(p):(e.consume(p),a)}function c(p){return p===64?(e.consume(p),d):o2(p)?(e.consume(p),c):r(p)}function d(p){return Gt(p)?h(p):r(p)}function h(p){return p===46?(e.consume(p),n=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||Gt(p))&&n++<63){const m=p===45?f:h;return e.consume(p),m}return r(p)}}const ml={partial:!0,tokenize:v2};function v2(e,t,r){return n;function n(s){return He(s)?Ke(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ce(s)?t(s):r(s)}}const ry={continuation:{tokenize:y2},exit:b2,name:"blockQuote",tokenize:x2};function x2(e,t,r){const n=this;return i;function i(o){if(o===62){const l=n.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return r(o)}function s(o){return He(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function y2(e,t,r){const n=this;return i;function i(o){return He(o)?Ke(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(ry,t,r)(o)}}function b2(e){e.exit("blockQuote")}const ny={name:"characterEscape",tokenize:w2};function w2(e,t,r){return n;function n(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return a2(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const iy={name:"characterReference",tokenize:S2};function S2(e,t,r){const n=this;let i=0,s,o;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),a}function a(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=Gt,d(h))}function c(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=l2,d):(e.enter("characterReferenceValue"),s=7,o=Kh,d(h))}function d(h){if(h===59&&i){const f=e.exit("characterReferenceValue");return o===Gt&&!Vf(n.sliceSerialize(f))?r(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&i++<s?(e.consume(h),d):r(h)}}const cg={partial:!0,tokenize:C2},ug={concrete:!0,name:"codeFenced",tokenize:k2};function k2(e,t,r){const n=this,i={partial:!0,tokenize:L};let s=0,o=0,l;return a;function a(C){return c(C)}function c(C){const F=n.events[n.events.length-1];return s=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,l=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===l?(o++,e.consume(C),d):o<3?r(C):(e.exit("codeFencedFenceSequence"),He(C)?Ke(e,h,"whitespace")(C):h(C))}function h(C){return C===null||Ce(C)?(e.exit("codeFencedFence"),n.interrupt?t(C):e.check(cg,g,N)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||Ce(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(C)):He(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ke(e,p,"whitespace")(C)):C===96&&C===l?r(C):(e.consume(C),f)}function p(C){return C===null||Ce(C)?h(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||Ce(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===l?r(C):(e.consume(C),m)}function g(C){return e.attempt(i,N,S)(C)}function S(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),_}function _(C){return s>0&&He(C)?Ke(e,x,"linePrefix",s+1)(C):x(C)}function x(C){return C===null||Ce(C)?e.check(cg,g,N)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||Ce(C)?(e.exit("codeFlowValue"),x(C)):(e.consume(C),w)}function N(C){return e.exit("codeFenced"),t(C)}function L(C,F,P){let q=0;return E;function E(z){return C.enter("lineEnding"),C.consume(z),C.exit("lineEnding"),A}function A(z){return C.enter("codeFencedFence"),He(z)?Ke(C,R,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):R(z)}function R(z){return z===l?(C.enter("codeFencedFenceSequence"),T(z)):P(z)}function T(z){return z===l?(q++,C.consume(z),T):q>=o?(C.exit("codeFencedFenceSequence"),He(z)?Ke(C,$,"whitespace")(z):$(z)):P(z)}function $(z){return z===null||Ce(z)?(C.exit("codeFencedFence"),F(z)):P(z)}}}function C2(e,t,r){const n=this;return i;function i(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}const uu={name:"codeIndented",tokenize:N2},E2={partial:!0,tokenize:P2};function N2(e,t,r){const n=this;return i;function i(c){return e.enter("codeIndented"),Ke(e,s,"linePrefix",5)(c)}function s(c){const d=n.events[n.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?a(c):Ce(c)?e.attempt(E2,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||Ce(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function P2(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ke(e,s,"linePrefix",5)(o)}function s(o){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Ce(o)?i(o):r(o)}}const T2={name:"codeText",previous:R2,resolve:L2,tokenize:M2};function L2(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)i===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(i=n):(n===t||e[n][1].type==="lineEnding")&&(e[i][1].type="codeTextData",n!==i+2&&(e[i][1].end=e[n-1][1].end,e.splice(i+2,n-i-2),t-=n-i-2,n=i+2),i=void 0);return e}function R2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function M2(e,t,r){let n=0,i,s;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),n++,l):(e.exit("codeTextSequence"),a(h))}function a(h){return h===null?r(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),a):h===96?(s=e.enter("codeTextSequence"),i=0,d(h)):Ce(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),a):(e.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||Ce(h)?(e.exit("codeTextData"),a(h)):(e.consume(h),c)}function d(h){return h===96?(e.consume(h),i++,d):i===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(s.type="codeTextData",c(h))}}class I2{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Js(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Js(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Js(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);Js(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Js(this.left,r.reverse())}}}function Js(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function sy(e){const t={};let r=-1,n,i,s,o,l,a,c;const d=new I2(e);for(;++r<d.length;){for(;r in t;)r=t[r];if(n=d.get(r),r&&n[1].type==="chunkFlow"&&d.get(r-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,s=0,s<a.length&&a[s][1].type==="lineEndingBlank"&&(s+=2),s<a.length&&a[s][1].type==="content"))for(;++s<a.length&&a[s][1].type!=="content";)a[s][1].type==="chunkText"&&(a[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,D2(d,r)),r=t[r],c=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...d.get(i)[1].start},l=d.slice(i,r),l.unshift(n),d.splice(i,r-i+1,l))}}return Pr(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function D2(e,t){const r=e.get(t)[1],n=e.get(t)[2];let i=t-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,a=[],c={};let d,h,f=-1,p=r,m=0,g=0;const S=[g];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(d=n.sliceStream(p),p.next||d.push(null),h&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=r;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(g=f+1,S.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):S.pop(),f=S.length;f--;){const _=l.slice(S[f],S[f+1]),x=s.pop();a.push([x,x+_.length-1]),e.splice(x,2,_)}for(a.reverse(),f=-1;++f<a.length;)c[m+a[f][0]]=m+a[f][1],m+=a[f][1]-a[f][0]-1;return c}const j2={resolve:B2,tokenize:O2},A2={partial:!0,tokenize:z2};function B2(e){return sy(e),e}function O2(e,t){let r;return n;function n(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):Ce(l)?e.check(A2,o,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function z2(e,t,r){const n=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ke(e,s,"linePrefix")}function s(o){if(o===null||Ce(o))return r(o);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(n.parser.constructs.flow,r,t)(o)}}function oy(e,t,r,n,i,s,o,l,a){const c=a||Number.POSITIVE_INFINITY;let d=0;return h;function h(_){return _===60?(e.enter(n),e.enter(i),e.enter(s),e.consume(_),e.exit(s),f):_===null||_===32||_===41||Va(_)?r(_):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(_))}function f(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(_))}function p(_){return _===62?(e.exit("chunkString"),e.exit(l),f(_)):_===null||_===60||Ce(_)?r(_):(e.consume(_),_===92?m:p)}function m(_){return _===60||_===62||_===92?(e.consume(_),p):p(_)}function g(_){return!d&&(_===null||_===41||Ze(_))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(_)):d<c&&_===40?(e.consume(_),d++,g):_===41?(e.consume(_),d--,g):_===null||_===32||_===40||Va(_)?r(_):(e.consume(_),_===92?S:g)}function S(_){return _===40||_===41||_===92?(e.consume(_),g):g(_)}}function ly(e,t,r,n,i,s){const o=this;let l=0,a;return c;function c(p){return e.enter(n),e.enter(i),e.consume(p),e.exit(i),e.enter(s),d}function d(p){return l>999||p===null||p===91||p===93&&!a||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(n),t):Ce(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||Ce(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),a||(a=!He(p)),p===92?f:h)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,h):h(p)}}function ay(e,t,r,n,i,s){let o;return l;function l(f){return f===34||f===39||f===40?(e.enter(n),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,a):r(f)}function a(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(n),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),a(o)):f===null?r(f):Ce(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ke(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||Ce(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(e.consume(f),d):d(f)}}function To(e,t){let r;return n;function n(i){return Ce(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):He(i)?Ke(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const $2={name:"definition",tokenize:W2},F2={partial:!0,tokenize:H2};function W2(e,t,r){const n=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return ly.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=en(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),a):r(p)}function a(p){return Ze(p)?To(e,c)(p):c(p)}function c(p){return oy(e,d,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(F2,h,h)(p)}function h(p){return He(p)?Ke(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Ce(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function H2(e,t,r){return n;function n(l){return Ze(l)?To(e,i)(l):r(l)}function i(l){return ay(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return He(l)?Ke(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Ce(l)?t(l):r(l)}}const U2={name:"hardBreakEscape",tokenize:V2};function V2(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ce(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const K2={name:"headingAtx",resolve:q2,tokenize:Y2};function q2(e,t){let r=e.length-2,n=3,i,s;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},s={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Pr(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Y2(e,t,r){let n=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&n++<6?(e.consume(d),o):d===null||Ze(d)?(e.exit("atxHeadingSequence"),l(d)):r(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),a(d)):d===null||Ce(d)?(e.exit("atxHeading"),t(d)):He(d)?Ke(e,l,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function a(d){return d===35?(e.consume(d),a):(e.exit("atxHeadingSequence"),l(d))}function c(d){return d===null||d===35||Ze(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const X2=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],hg=["pre","script","style","textarea"],G2={concrete:!0,name:"htmlFlow",resolveTo:Z2,tokenize:eE},Q2={partial:!0,tokenize:rE},J2={partial:!0,tokenize:tE};function Z2(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function eE(e,t,r){const n=this;let i,s,o,l,a;return c;function c(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),h}function h(k){return k===33?(e.consume(k),f):k===47?(e.consume(k),s=!0,g):k===63?(e.consume(k),i=3,n.interrupt?t:y):rr(k)?(e.consume(k),o=String.fromCharCode(k),S):r(k)}function f(k){return k===45?(e.consume(k),i=2,p):k===91?(e.consume(k),i=5,l=0,m):rr(k)?(e.consume(k),i=4,n.interrupt?t:y):r(k)}function p(k){return k===45?(e.consume(k),n.interrupt?t:y):r(k)}function m(k){const we="CDATA[";return k===we.charCodeAt(l++)?(e.consume(k),l===we.length?n.interrupt?t:R:m):r(k)}function g(k){return rr(k)?(e.consume(k),o=String.fromCharCode(k),S):r(k)}function S(k){if(k===null||k===47||k===62||Ze(k)){const we=k===47,U=o.toLowerCase();return!we&&!s&&hg.includes(U)?(i=1,n.interrupt?t(k):R(k)):X2.includes(o.toLowerCase())?(i=6,we?(e.consume(k),_):n.interrupt?t(k):R(k)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(k):s?x(k):w(k))}return k===45||Gt(k)?(e.consume(k),o+=String.fromCharCode(k),S):r(k)}function _(k){return k===62?(e.consume(k),n.interrupt?t:R):r(k)}function x(k){return He(k)?(e.consume(k),x):E(k)}function w(k){return k===47?(e.consume(k),E):k===58||k===95||rr(k)?(e.consume(k),N):He(k)?(e.consume(k),w):E(k)}function N(k){return k===45||k===46||k===58||k===95||Gt(k)?(e.consume(k),N):L(k)}function L(k){return k===61?(e.consume(k),C):He(k)?(e.consume(k),L):w(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(e.consume(k),a=k,F):He(k)?(e.consume(k),C):P(k)}function F(k){return k===a?(e.consume(k),a=null,q):k===null||Ce(k)?r(k):(e.consume(k),F)}function P(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Ze(k)?L(k):(e.consume(k),P)}function q(k){return k===47||k===62||He(k)?w(k):r(k)}function E(k){return k===62?(e.consume(k),A):r(k)}function A(k){return k===null||Ce(k)?R(k):He(k)?(e.consume(k),A):r(k)}function R(k){return k===45&&i===2?(e.consume(k),D):k===60&&i===1?(e.consume(k),H):k===62&&i===4?(e.consume(k),J):k===63&&i===3?(e.consume(k),y):k===93&&i===5?(e.consume(k),W):Ce(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Q2,ae,T)(k)):k===null||Ce(k)?(e.exit("htmlFlowData"),T(k)):(e.consume(k),R)}function T(k){return e.check(J2,$,ae)(k)}function $(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),z}function z(k){return k===null||Ce(k)?T(k):(e.enter("htmlFlowData"),R(k))}function D(k){return k===45?(e.consume(k),y):R(k)}function H(k){return k===47?(e.consume(k),o="",I):R(k)}function I(k){if(k===62){const we=o.toLowerCase();return hg.includes(we)?(e.consume(k),J):R(k)}return rr(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),I):R(k)}function W(k){return k===93?(e.consume(k),y):R(k)}function y(k){return k===62?(e.consume(k),J):k===45&&i===2?(e.consume(k),y):R(k)}function J(k){return k===null||Ce(k)?(e.exit("htmlFlowData"),ae(k)):(e.consume(k),J)}function ae(k){return e.exit("htmlFlow"),t(k)}}function tE(e,t,r){const n=this;return i;function i(o){return Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}function rE(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(ml,t,r)}}const nE={name:"htmlText",tokenize:iE};function iE(e,t,r){const n=this;let i,s,o;return l;function l(y){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(y),a}function a(y){return y===33?(e.consume(y),c):y===47?(e.consume(y),L):y===63?(e.consume(y),w):rr(y)?(e.consume(y),P):r(y)}function c(y){return y===45?(e.consume(y),d):y===91?(e.consume(y),s=0,m):rr(y)?(e.consume(y),x):r(y)}function d(y){return y===45?(e.consume(y),p):r(y)}function h(y){return y===null?r(y):y===45?(e.consume(y),f):Ce(y)?(o=h,H(y)):(e.consume(y),h)}function f(y){return y===45?(e.consume(y),p):h(y)}function p(y){return y===62?D(y):y===45?f(y):h(y)}function m(y){const J="CDATA[";return y===J.charCodeAt(s++)?(e.consume(y),s===J.length?g:m):r(y)}function g(y){return y===null?r(y):y===93?(e.consume(y),S):Ce(y)?(o=g,H(y)):(e.consume(y),g)}function S(y){return y===93?(e.consume(y),_):g(y)}function _(y){return y===62?D(y):y===93?(e.consume(y),_):g(y)}function x(y){return y===null||y===62?D(y):Ce(y)?(o=x,H(y)):(e.consume(y),x)}function w(y){return y===null?r(y):y===63?(e.consume(y),N):Ce(y)?(o=w,H(y)):(e.consume(y),w)}function N(y){return y===62?D(y):w(y)}function L(y){return rr(y)?(e.consume(y),C):r(y)}function C(y){return y===45||Gt(y)?(e.consume(y),C):F(y)}function F(y){return Ce(y)?(o=F,H(y)):He(y)?(e.consume(y),F):D(y)}function P(y){return y===45||Gt(y)?(e.consume(y),P):y===47||y===62||Ze(y)?q(y):r(y)}function q(y){return y===47?(e.consume(y),D):y===58||y===95||rr(y)?(e.consume(y),E):Ce(y)?(o=q,H(y)):He(y)?(e.consume(y),q):D(y)}function E(y){return y===45||y===46||y===58||y===95||Gt(y)?(e.consume(y),E):A(y)}function A(y){return y===61?(e.consume(y),R):Ce(y)?(o=A,H(y)):He(y)?(e.consume(y),A):q(y)}function R(y){return y===null||y===60||y===61||y===62||y===96?r(y):y===34||y===39?(e.consume(y),i=y,T):Ce(y)?(o=R,H(y)):He(y)?(e.consume(y),R):(e.consume(y),$)}function T(y){return y===i?(e.consume(y),i=void 0,z):y===null?r(y):Ce(y)?(o=T,H(y)):(e.consume(y),T)}function $(y){return y===null||y===34||y===39||y===60||y===61||y===96?r(y):y===47||y===62||Ze(y)?q(y):(e.consume(y),$)}function z(y){return y===47||y===62||Ze(y)?q(y):r(y)}function D(y){return y===62?(e.consume(y),e.exit("htmlTextData"),e.exit("htmlText"),t):r(y)}function H(y){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),I}function I(y){return He(y)?Ke(e,W,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):W(y)}function W(y){return e.enter("htmlTextData"),o(y)}}const Kf={name:"labelEnd",resolveAll:aE,resolveTo:cE,tokenize:uE},sE={tokenize:hE},oE={tokenize:dE},lE={tokenize:fE};function aE(e){let t=-1;const r=[];for(;++t<e.length;){const n=e[t][1];if(r.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",t+=i}}return e.length!==r.length&&Pr(e,0,e.length,r),e}function cE(e,t){let r=e.length,n=0,i,s,o,l;for(;r--;)if(i=e[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const a={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[s+n+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",a,t],["enter",c,t]],l=$r(l,e.slice(s+1,s+n+3)),l=$r(l,[["enter",d,t]]),l=$r(l,Sc(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=$r(l,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),l=$r(l,e.slice(o+1)),l=$r(l,[["exit",a,t]]),Pr(e,s,e.length,l),e}function uE(e,t,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return l;function l(f){return s?s._inactive?h(f):(o=n.parser.defined.includes(en(n.sliceSerialize({start:s.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),a):r(f)}function a(f){return f===40?e.attempt(sE,d,o?d:h)(f):f===91?e.attempt(oE,d,o?c:h)(f):o?d(f):h(f)}function c(f){return e.attempt(lE,d,h)(f)}function d(f){return t(f)}function h(f){return s._balanced=!0,r(f)}}function hE(e,t,r){return n;function n(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return Ze(h)?To(e,s)(h):s(h)}function s(h){return h===41?d(h):oy(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Ze(h)?To(e,a)(h):d(h)}function l(h){return r(h)}function a(h){return h===34||h===39||h===40?ay(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return Ze(h)?To(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):r(h)}}function dE(e,t,r){const n=this;return i;function i(l){return ly.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes(en(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function fE(e,t,r){return n;function n(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):r(s)}}const pE={name:"labelStartImage",resolveAll:Kf.resolveAll,tokenize:mE};function mE(e,t,r){const n=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):t(l)}}const gE={name:"labelStartLink",resolveAll:Kf.resolveAll,tokenize:_E};function _E(e,t,r){const n=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):t(o)}}const hu={name:"lineEnding",tokenize:vE};function vE(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Ke(e,t,"linePrefix")}}const ca={name:"thematicBreak",tokenize:xE};function xE(e,t,r){let n=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,l(c)}function l(c){return c===i?(e.enter("thematicBreakSequence"),a(c)):n>=3&&(c===null||Ce(c))?(e.exit("thematicBreak"),t(c)):r(c)}function a(c){return c===i?(e.consume(c),n++,a):(e.exit("thematicBreakSequence"),He(c)?Ke(e,l,"whitespace")(c):l(c))}}const hr={continuation:{tokenize:SE},exit:CE,name:"list",tokenize:wE},yE={partial:!0,tokenize:EE},bE={partial:!0,tokenize:kE};function wE(e,t,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(p){const m=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Kh(p)){if(n.containerState.type||(n.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ca,r,c)(p):c(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(p)}return r(p)}function a(p){return Kh(p)&&++o<10?(e.consume(p),a):(!n.interrupt||o<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):r(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(ml,n.interrupt?r:d,e.attempt(yE,f,h))}function d(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function h(p){return He(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):r(p)}function f(p){return n.containerState.size=s+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function SE(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(ml,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Ke(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!He(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(bE,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Ke(e,e.attempt(hr,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function kE(e,t,r){const n=this;return Ke(e,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(s):r(s)}}function CE(e){e.exit(this.containerState.type)}function EE(e,t,r){const n=this;return Ke(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!He(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const dg={name:"setextUnderline",resolveTo:NE,tokenize:PE};function NE(e,t){let r=e.length,n,i,s;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!s&&e[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[n][1],t]),e[n][1].end={...e[s][1].end}):e[n][1]=o,e.push(["exit",o,t]),e}function PE(e,t,r){const n=this;let i;return s;function s(c){let d=n.events.length,h;for(;d--;)if(n.events[d][1].type!=="lineEnding"&&n.events[d][1].type!=="linePrefix"&&n.events[d][1].type!=="content"){h=n.events[d][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(e.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),He(c)?Ke(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||Ce(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const TE={tokenize:LE};function LE(e){const t=this,r=e.attempt(ml,n,e.attempt(this.parser.constructs.flowInitial,i,Ke(e,e.attempt(this.parser.constructs.flow,i,e.attempt(j2,i)),"linePrefix")));return r;function n(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const RE={resolveAll:uy()},ME=cy("string"),IE=cy("text");function cy(e){return{resolveAll:uy(e==="text"?DE:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],s=r.attempt(i,o,l);return o;function o(d){return c(d)?s(d):l(d)}function l(d){if(d===null){r.consume(d);return}return r.enter("data"),r.consume(d),a}function a(d){return c(d)?(r.exit("data"),s(d)):(r.consume(d),a)}function c(d){if(d===null)return!0;const h=i[d];let f=-1;if(h)for(;++f<h.length;){const p=h[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function uy(e){return t;function t(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(r,n):r}}function DE(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const n=e[r-1][1],i=t.sliceStream(n);let s=i.length,o=-1,l=0,a;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(c===-2)a=!0,l++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){const c={type:r===e.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(e.splice(r,0,["enter",c,t],["exit",c,t]),r+=2)}r++}return e}const jE={42:hr,43:hr,45:hr,48:hr,49:hr,50:hr,51:hr,52:hr,53:hr,54:hr,55:hr,56:hr,57:hr,62:ry},AE={91:$2},BE={[-2]:uu,[-1]:uu,32:uu},OE={35:K2,42:ca,45:[dg,ca],60:G2,61:dg,95:ca,96:ug,126:ug},zE={38:iy,92:ny},$E={[-5]:hu,[-4]:hu,[-3]:hu,33:pE,38:iy,42:qh,60:[g2,nE],91:gE,92:[U2,ny],93:Kf,95:qh,96:T2},FE={null:[qh,RE]},WE={null:[42,95]},HE={null:[]},UE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:WE,contentInitial:AE,disable:HE,document:jE,flow:OE,flowInitial:BE,insideSpan:FE,string:zE,text:$E},Symbol.toStringTag,{value:"Module"}));function VE(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],l=[];const a={attempt:F(L),check:F(C),consume:x,enter:w,exit:N,interrupt:F(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:h};let d=t.tokenize.call(c,a);return t.resolveAll&&s.push(t),c;function h(A){return o=$r(o,A),S(),o[o.length-1]!==null?[]:(P(t,0),c.events=Sc(s,c.events,c),c.events)}function f(A,R){return qE(p(A),R)}function p(A){return KE(o,A)}function m(){const{_bufferIndex:A,_index:R,line:T,column:$,offset:z}=n;return{_bufferIndex:A,_index:R,line:T,column:$,offset:z}}function g(A){i[A.line]=A.column,E()}function S(){let A;for(;n._index<o.length;){const R=o[n._index];if(typeof R=="string")for(A=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===A&&n._bufferIndex<R.length;)_(R.charCodeAt(n._bufferIndex));else _(R)}}function _(A){d=d(A)}function x(A){Ce(A)?(n.line++,n.column=1,n.offset+=A===-3?2:1,E()):A!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=A}function w(A,R){const T=R||{};return T.type=A,T.start=m(),c.events.push(["enter",T,c]),l.push(T),T}function N(A){const R=l.pop();return R.end=m(),c.events.push(["exit",R,c]),R}function L(A,R){P(A,R.from)}function C(A,R){R.restore()}function F(A,R){return T;function T($,z,D){let H,I,W,y;return Array.isArray($)?ae($):"tokenize"in $?ae([$]):J($);function J(Y){return te;function te(fe){const de=fe!==null&&Y[fe],Oe=fe!==null&&Y.null,Ve=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(Oe)?Oe:Oe?[Oe]:[]];return ae(Ve)(fe)}}function ae(Y){return H=Y,I=0,Y.length===0?D:k(Y[I])}function k(Y){return te;function te(fe){return y=q(),W=Y,Y.partial||(c.currentConstruct=Y),Y.name&&c.parser.constructs.disable.null.includes(Y.name)?U():Y.tokenize.call(R?Object.assign(Object.create(c),R):c,a,we,U)(fe)}}function we(Y){return A(W,y),z}function U(Y){return y.restore(),++I<H.length?k(H[I]):D}}}function P(A,R){A.resolveAll&&!s.includes(A)&&s.push(A),A.resolve&&Pr(c.events,R,c.events.length-R,A.resolve(c.events.slice(R),c)),A.resolveTo&&(c.events=A.resolveTo(c.events,c))}function q(){const A=m(),R=c.previous,T=c.currentConstruct,$=c.events.length,z=Array.from(l);return{from:$,restore:D};function D(){n=A,c.previous=R,c.currentConstruct=T,c.events.length=$,l=z,E()}}function E(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function KE(e,t){const r=t.start._index,n=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(r===i)o=[e[r].slice(n,s)];else{if(o=e.slice(r,i),n>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(n):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function qE(e,t){let r=-1;const n=[];let i;for(;++r<e.length;){const s=e[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
69
69
|
`;break}case-3:{o=`\r
|
|
70
|
-
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function YE(e){const n={constructs:ey([UE,...(e||{}).extensions||[]]),content:i(c2),defined:[],document:i(h2),flow:i(PE),lazy:{},string:i(ME),text:i(IE)};return n;function i(s){return o;function o(l){return VE(n,s,l)}}}function XE(e){for(;!sy(e););return e}const fg=/[\0\t\n\r]/g;function GE(){let e=1,t="",r=!0,n;return i;function i(s,o,l){const a=[];let c,d,h,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),h=0,t="",r&&(s.charCodeAt(0)===65279&&h++,r=void 0);h<s.length;){if(fg.lastIndex=h,c=fg.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(h);break}if(p===10&&h===f&&n)a.push(-3),n=void 0;else switch(n&&(a.push(-5),n=void 0),h<f&&(a.push(s.slice(h,f)),e+=f-h),p){case 0:{a.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,a.push(-2);e++<d;)a.push(-1);break}case 10:{a.push(-4),e=1;break}default:n=!0,e=1}h=f+1}return l&&(n&&a.push(-5),t&&a.push(t),a.push(null)),a}}const QE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JE(e){return e.replace(QE,ZE)}function ZE(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return ty(r.slice(s?2:1),s?16:10)}return Vf(r)||e}const hy={}.hasOwnProperty;function e5(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),t5(r)(XE(YE(r).document().write(GE()(e,t,!0))))}function t5(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(We),autolinkProtocol:q,autolinkEmail:q,atxHeading:s(Re),blockQuote:s(Oe),characterEscape:q,characterReference:q,codeFenced:s(Ve),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Ve,o),codeText:s(Ie,o),codeTextData:q,data:q,codeFlowValue:q,definition:s(G),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(me),hardBreakEscape:s(J),hardBreakTrailing:s(J),htmlFlow:s(oe,o),htmlFlowData:q,htmlText:s(oe,o),htmlTextData:q,image:s(Fe),label:o,link:s(We),listItem:s(ze),listItemValue:f,listOrdered:s(Ne,h),listUnordered:s(Ne),paragraph:s(Pe),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Re),strong:s(qe),thematicBreak:s(Mr)},exit:{atxHeading:a(),atxHeadingSequence:L,autolink:a(),autolinkEmail:de,autolinkProtocol:fe,blockQuote:a(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:Y,characterReference:te,codeFenced:a(S),codeFencedFence:g,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:a(_),codeText:a(z),codeTextData:E,data:E,definition:a(),definitionDestinationString:N,definitionLabelString:x,definitionTitleString:w,emphasis:a(),hardBreakEscape:a(R),hardBreakTrailing:a(R),htmlFlow:a(P),htmlFlowData:E,htmlText:a($),htmlTextData:E,image:a(H),label:W,labelText:I,lineEnding:A,link:a(D),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:we,resourceDestinationString:y,resourceTitleString:Q,resource:ae,setextHeading:a(T),setextHeadingLineSequence:F,setextHeadingText:C,strong:a(),thematicBreak:a()}};dy(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(K){let ne={type:"root",children:[]};const Se={stack:[ne],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:d,data:r},Me=[];let $e=-1;for(;++$e<K.length;)if(K[$e][1].type==="listOrdered"||K[$e][1].type==="listUnordered")if(K[$e][0]==="enter")Me.push($e);else{const ft=Me.pop();$e=i(K,ft,$e)}for($e=-1;++$e<K.length;){const ft=t[K[$e][0]];hy.call(ft,K[$e][1].type)&&ft[K[$e][1].type].call(Object.assign({sliceSerialize:K[$e][2].sliceSerialize},Se),K[$e][1])}if(Se.tokenStack.length>0){const ft=Se.tokenStack[Se.tokenStack.length-1];(ft[1]||pg).call(Se,void 0,ft[0])}for(ne.position={start:$n(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:$n(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e<t.transforms.length;)ne=t.transforms[$e](ne)||ne;return ne}function i(K,ne,Se){let Me=ne-1,$e=-1,ft=!1,It,Ee,O,ue;for(;++Me<=Se;){const M=K[Me];switch(M[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{M[0]==="enter"?$e++:$e--,ue=void 0;break}case"lineEndingBlank":{M[0]==="enter"&&(It&&!ue&&!$e&&!O&&(O=Me),ue=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ue=void 0}if(!$e&&M[0]==="enter"&&M[1].type==="listItemPrefix"||$e===-1&&M[0]==="exit"&&(M[1].type==="listUnordered"||M[1].type==="listOrdered")){if(It){let j=Me;for(Ee=void 0;j--;){const V=K[j];if(V[1].type==="lineEnding"||V[1].type==="lineEndingBlank"){if(V[0]==="exit")continue;Ee&&(K[Ee][1].type="lineEndingBlank",ft=!0),V[1].type="lineEnding",Ee=j}else if(!(V[1].type==="linePrefix"||V[1].type==="blockQuotePrefix"||V[1].type==="blockQuotePrefixWhitespace"||V[1].type==="blockQuoteMarker"||V[1].type==="listItemIndent"))break}O&&(!Ee||O<Ee)&&(It._spread=!0),It.end=Object.assign({},Ee?K[Ee][1].start:M[1].end),K.splice(Ee||Me,0,["exit",It,M[2]]),Me++,Se++}if(M[1].type==="listItemPrefix"){const j={type:"listItem",_spread:!1,start:Object.assign({},M[1].start),end:void 0};It=j,K.splice(Me,0,["enter",j,M[2]]),Me++,Se++,O=void 0,ue=!0}}}return K[ne][1]._spread=ft,Se}function s(K,ne){return Se;function Se(Me){l.call(this,K(Me),Me),ne&&ne.call(this,Me)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(K,ne,Se){this.stack[this.stack.length-1].children.push(K),this.stack.push(K),this.tokenStack.push([ne,Se||void 0]),K.position={start:$n(ne.start),end:void 0}}function a(K){return ne;function ne(Se){K&&K.call(this,Se),c.call(this,Se)}}function c(K,ne){const Se=this.stack.pop(),Me=this.tokenStack.pop();if(Me)Me[0].type!==K.type&&(ne?ne.call(this,K,Me[0]):(Me[1]||pg).call(this,K,Me[0]));else throw new Error("Cannot close `"+K.type+"` ("+To({start:K.start,end:K.end})+"): it’s not open");Se.position.end=$n(K.end)}function d(){return Uf(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(K){if(this.data.expectingFirstListItemValue){const ne=this.stack[this.stack.length-2];ne.start=Number.parseInt(this.sliceSerialize(K),10),this.data.expectingFirstListItemValue=void 0}}function p(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.lang=K}function m(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.meta=K}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.value=K.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.value=K.replace(/(\r?\n|\r)$/g,"")}function x(K){const ne=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ne,Se.identifier=en(this.sliceSerialize(K)).toLowerCase()}function w(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.title=K}function N(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.url=K}function L(K){const ne=this.stack[this.stack.length-1];if(!ne.depth){const Se=this.sliceSerialize(K).length;ne.depth=Se}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function F(K){const ne=this.stack[this.stack.length-1];ne.depth=this.sliceSerialize(K).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function q(K){const Se=this.stack[this.stack.length-1].children;let Me=Se[Se.length-1];(!Me||Me.type!=="text")&&(Me=Mt(),Me.position={start:$n(K.start),end:void 0},Se.push(Me)),this.stack.push(Me)}function E(K){const ne=this.stack.pop();ne.value+=this.sliceSerialize(K),ne.position.end=$n(K.end)}function A(K){const ne=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=ne.children[ne.children.length-1];Se.position.end=$n(K.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ne.type)&&(q.call(this,K),E.call(this,K))}function R(){this.data.atHardBreak=!0}function P(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.value=K}function $(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.value=K}function z(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.value=K}function D(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const ne=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=ne,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function H(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const ne=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=ne,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function I(K){const ne=this.sliceSerialize(K),Se=this.stack[this.stack.length-2];Se.label=JE(ne),Se.identifier=en(ne).toLowerCase()}function W(){const K=this.stack[this.stack.length-1],ne=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const Me=K.children;Se.children=Me}else Se.alt=ne}function y(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.url=K}function Q(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.title=K}function ae(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function we(K){const ne=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ne,Se.identifier=en(this.sliceSerialize(K)).toLowerCase(),this.data.referenceType="full"}function U(K){this.data.characterReferenceType=K.type}function Y(K){const ne=this.sliceSerialize(K),Se=this.data.characterReferenceType;let Me;Se?(Me=ty(ne,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Me=Vf(ne);const $e=this.stack[this.stack.length-1];$e.value+=Me}function te(K){const ne=this.stack.pop();ne.position.end=$n(K.end)}function fe(K){E.call(this,K);const ne=this.stack[this.stack.length-1];ne.url=this.sliceSerialize(K)}function de(K){E.call(this,K);const ne=this.stack[this.stack.length-1];ne.url="mailto:"+this.sliceSerialize(K)}function Oe(){return{type:"blockquote",children:[]}}function Ve(){return{type:"code",lang:null,meta:null,value:""}}function Ie(){return{type:"inlineCode",value:""}}function G(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function me(){return{type:"emphasis",children:[]}}function Re(){return{type:"heading",depth:0,children:[]}}function J(){return{type:"break"}}function oe(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function We(){return{type:"link",title:null,url:"",children:[]}}function Ne(K){return{type:"list",ordered:K.type==="listOrdered",start:null,spread:K._spread,children:[]}}function ze(K){return{type:"listItem",spread:K._spread,checked:null,children:[]}}function Pe(){return{type:"paragraph",children:[]}}function qe(){return{type:"strong",children:[]}}function Mt(){return{type:"text",value:""}}function Mr(){return{type:"thematicBreak"}}}function $n(e){return{line:e.line,column:e.column,offset:e.offset}}function dy(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?dy(e,n):r5(e,n)}}function r5(e,t){let r;for(r in t)if(hy.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function pg(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+To({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+To({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+To({start:t.start,end:t.end})+") is still open")}function n5(e){const t=this;t.parser=r;function r(n){return e5(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function i5(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function s5(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
70
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function YE(e){const n={constructs:ey([UE,...(e||{}).extensions||[]]),content:i(c2),defined:[],document:i(h2),flow:i(TE),lazy:{},string:i(ME),text:i(IE)};return n;function i(s){return o;function o(l){return VE(n,s,l)}}}function XE(e){for(;!sy(e););return e}const fg=/[\0\t\n\r]/g;function GE(){let e=1,t="",r=!0,n;return i;function i(s,o,l){const a=[];let c,d,h,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),h=0,t="",r&&(s.charCodeAt(0)===65279&&h++,r=void 0);h<s.length;){if(fg.lastIndex=h,c=fg.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(h);break}if(p===10&&h===f&&n)a.push(-3),n=void 0;else switch(n&&(a.push(-5),n=void 0),h<f&&(a.push(s.slice(h,f)),e+=f-h),p){case 0:{a.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,a.push(-2);e++<d;)a.push(-1);break}case 10:{a.push(-4),e=1;break}default:n=!0,e=1}h=f+1}return l&&(n&&a.push(-5),t&&a.push(t),a.push(null)),a}}const QE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JE(e){return e.replace(QE,ZE)}function ZE(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return ty(r.slice(s?2:1),s?16:10)}return Vf(r)||e}const hy={}.hasOwnProperty;function e5(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),t5(r)(XE(YE(r).document().write(GE()(e,t,!0))))}function t5(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(We),autolinkProtocol:q,autolinkEmail:q,atxHeading:s(Re),blockQuote:s(Oe),characterEscape:q,characterReference:q,codeFenced:s(Ve),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Ve,o),codeText:s(Ie,o),codeTextData:q,data:q,codeFlowValue:q,definition:s(G),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(me),hardBreakEscape:s(Q),hardBreakTrailing:s(Q),htmlFlow:s(oe,o),htmlFlowData:q,htmlText:s(oe,o),htmlTextData:q,image:s(Fe),label:o,link:s(We),listItem:s(ze),listItemValue:f,listOrdered:s(Ne,h),listUnordered:s(Ne),paragraph:s(Te),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Re),strong:s(qe),thematicBreak:s(Mr)},exit:{atxHeading:a(),atxHeadingSequence:L,autolink:a(),autolinkEmail:de,autolinkProtocol:fe,blockQuote:a(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:Y,characterReference:te,codeFenced:a(S),codeFencedFence:g,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:a(_),codeText:a(z),codeTextData:E,data:E,definition:a(),definitionDestinationString:N,definitionLabelString:x,definitionTitleString:w,emphasis:a(),hardBreakEscape:a(R),hardBreakTrailing:a(R),htmlFlow:a(T),htmlFlowData:E,htmlText:a($),htmlTextData:E,image:a(H),label:W,labelText:I,lineEnding:A,link:a(D),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:we,resourceDestinationString:y,resourceTitleString:J,resource:ae,setextHeading:a(P),setextHeadingLineSequence:F,setextHeadingText:C,strong:a(),thematicBreak:a()}};dy(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(K){let ne={type:"root",children:[]};const Se={stack:[ne],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:d,data:r},Me=[];let $e=-1;for(;++$e<K.length;)if(K[$e][1].type==="listOrdered"||K[$e][1].type==="listUnordered")if(K[$e][0]==="enter")Me.push($e);else{const ft=Me.pop();$e=i(K,ft,$e)}for($e=-1;++$e<K.length;){const ft=t[K[$e][0]];hy.call(ft,K[$e][1].type)&&ft[K[$e][1].type].call(Object.assign({sliceSerialize:K[$e][2].sliceSerialize},Se),K[$e][1])}if(Se.tokenStack.length>0){const ft=Se.tokenStack[Se.tokenStack.length-1];(ft[1]||pg).call(Se,void 0,ft[0])}for(ne.position={start:$n(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:$n(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e<t.transforms.length;)ne=t.transforms[$e](ne)||ne;return ne}function i(K,ne,Se){let Me=ne-1,$e=-1,ft=!1,It,Ee,O,ue;for(;++Me<=Se;){const M=K[Me];switch(M[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{M[0]==="enter"?$e++:$e--,ue=void 0;break}case"lineEndingBlank":{M[0]==="enter"&&(It&&!ue&&!$e&&!O&&(O=Me),ue=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ue=void 0}if(!$e&&M[0]==="enter"&&M[1].type==="listItemPrefix"||$e===-1&&M[0]==="exit"&&(M[1].type==="listUnordered"||M[1].type==="listOrdered")){if(It){let j=Me;for(Ee=void 0;j--;){const V=K[j];if(V[1].type==="lineEnding"||V[1].type==="lineEndingBlank"){if(V[0]==="exit")continue;Ee&&(K[Ee][1].type="lineEndingBlank",ft=!0),V[1].type="lineEnding",Ee=j}else if(!(V[1].type==="linePrefix"||V[1].type==="blockQuotePrefix"||V[1].type==="blockQuotePrefixWhitespace"||V[1].type==="blockQuoteMarker"||V[1].type==="listItemIndent"))break}O&&(!Ee||O<Ee)&&(It._spread=!0),It.end=Object.assign({},Ee?K[Ee][1].start:M[1].end),K.splice(Ee||Me,0,["exit",It,M[2]]),Me++,Se++}if(M[1].type==="listItemPrefix"){const j={type:"listItem",_spread:!1,start:Object.assign({},M[1].start),end:void 0};It=j,K.splice(Me,0,["enter",j,M[2]]),Me++,Se++,O=void 0,ue=!0}}}return K[ne][1]._spread=ft,Se}function s(K,ne){return Se;function Se(Me){l.call(this,K(Me),Me),ne&&ne.call(this,Me)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(K,ne,Se){this.stack[this.stack.length-1].children.push(K),this.stack.push(K),this.tokenStack.push([ne,Se||void 0]),K.position={start:$n(ne.start),end:void 0}}function a(K){return ne;function ne(Se){K&&K.call(this,Se),c.call(this,Se)}}function c(K,ne){const Se=this.stack.pop(),Me=this.tokenStack.pop();if(Me)Me[0].type!==K.type&&(ne?ne.call(this,K,Me[0]):(Me[1]||pg).call(this,K,Me[0]));else throw new Error("Cannot close `"+K.type+"` ("+Po({start:K.start,end:K.end})+"): it’s not open");Se.position.end=$n(K.end)}function d(){return Uf(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(K){if(this.data.expectingFirstListItemValue){const ne=this.stack[this.stack.length-2];ne.start=Number.parseInt(this.sliceSerialize(K),10),this.data.expectingFirstListItemValue=void 0}}function p(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.lang=K}function m(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.meta=K}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.value=K.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.value=K.replace(/(\r?\n|\r)$/g,"")}function x(K){const ne=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ne,Se.identifier=en(this.sliceSerialize(K)).toLowerCase()}function w(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.title=K}function N(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.url=K}function L(K){const ne=this.stack[this.stack.length-1];if(!ne.depth){const Se=this.sliceSerialize(K).length;ne.depth=Se}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function F(K){const ne=this.stack[this.stack.length-1];ne.depth=this.sliceSerialize(K).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function q(K){const Se=this.stack[this.stack.length-1].children;let Me=Se[Se.length-1];(!Me||Me.type!=="text")&&(Me=Mt(),Me.position={start:$n(K.start),end:void 0},Se.push(Me)),this.stack.push(Me)}function E(K){const ne=this.stack.pop();ne.value+=this.sliceSerialize(K),ne.position.end=$n(K.end)}function A(K){const ne=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=ne.children[ne.children.length-1];Se.position.end=$n(K.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ne.type)&&(q.call(this,K),E.call(this,K))}function R(){this.data.atHardBreak=!0}function T(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.value=K}function $(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.value=K}function z(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.value=K}function D(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const ne=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=ne,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function H(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const ne=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=ne,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function I(K){const ne=this.sliceSerialize(K),Se=this.stack[this.stack.length-2];Se.label=JE(ne),Se.identifier=en(ne).toLowerCase()}function W(){const K=this.stack[this.stack.length-1],ne=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const Me=K.children;Se.children=Me}else Se.alt=ne}function y(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.url=K}function J(){const K=this.resume(),ne=this.stack[this.stack.length-1];ne.title=K}function ae(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function we(K){const ne=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ne,Se.identifier=en(this.sliceSerialize(K)).toLowerCase(),this.data.referenceType="full"}function U(K){this.data.characterReferenceType=K.type}function Y(K){const ne=this.sliceSerialize(K),Se=this.data.characterReferenceType;let Me;Se?(Me=ty(ne,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Me=Vf(ne);const $e=this.stack[this.stack.length-1];$e.value+=Me}function te(K){const ne=this.stack.pop();ne.position.end=$n(K.end)}function fe(K){E.call(this,K);const ne=this.stack[this.stack.length-1];ne.url=this.sliceSerialize(K)}function de(K){E.call(this,K);const ne=this.stack[this.stack.length-1];ne.url="mailto:"+this.sliceSerialize(K)}function Oe(){return{type:"blockquote",children:[]}}function Ve(){return{type:"code",lang:null,meta:null,value:""}}function Ie(){return{type:"inlineCode",value:""}}function G(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function me(){return{type:"emphasis",children:[]}}function Re(){return{type:"heading",depth:0,children:[]}}function Q(){return{type:"break"}}function oe(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function We(){return{type:"link",title:null,url:"",children:[]}}function Ne(K){return{type:"list",ordered:K.type==="listOrdered",start:null,spread:K._spread,children:[]}}function ze(K){return{type:"listItem",spread:K._spread,checked:null,children:[]}}function Te(){return{type:"paragraph",children:[]}}function qe(){return{type:"strong",children:[]}}function Mt(){return{type:"text",value:""}}function Mr(){return{type:"thematicBreak"}}}function $n(e){return{line:e.line,column:e.column,offset:e.offset}}function dy(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?dy(e,n):r5(e,n)}}function r5(e,t){let r;for(r in t)if(hy.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function pg(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Po({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Po({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Po({start:t.start,end:t.end})+") is still open")}function n5(e){const t=this;t.parser=r;function r(n){return e5(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function i5(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function s5(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
71
71
|
`}]}function o5(e,t){const r=t.value?t.value+`
|
|
72
72
|
`:"",n={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function l5(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function a5(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function c5(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),i=$s(n.toLowerCase()),s=e.footnoteOrder.indexOf(n);let o,l=e.footnoteCounts.get(n);l===void 0?(l=0,e.footnoteOrder.push(n),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(n,l);const a={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,a);const c={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,c),e.applyData(t,c)}function u5(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function h5(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function fy(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function d5(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return fy(e,t);const i={src:$s(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function f5(e,t){const r={src:$s(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function p5(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function m5(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return fy(e,t);const i={href:$s(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function g5(e,t){const r={href:$s(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _5(e,t,r){const n=e.all(t),i=r?v5(r):py(t),s={},o=[];if(typeof t.checked=="boolean"){const d=n[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},n.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const d=n[l];(i||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
|
|
73
73
|
`}),d.type==="element"&&d.tagName==="p"&&!i?o.push(...d.children):o.push(d)}const a=n[n.length-1];a&&(i||a.type!=="element"||a.tagName!=="p")&&o.push({type:"text",value:`
|
|
74
|
-
`});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function v5(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let n=-1;for(;!t&&++n<r.length;)t=py(r[n])}return t}function py(e){const t=e.spread;return t??e.children.length>1}function x5(e,t){const r={},n=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,s),e.applyData(t,s)}function y5(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function b5(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function w5(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function S5(e,t){const r=e.all(t),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=$f(t.children[1]),a=q0(t.children[t.children.length-1]);l&&a&&(o.position={start:l,end:a}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function k5(e,t,r){const n=r?r.children:void 0,s=(n?n.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:t.children.length;let a=-1;const c=[];for(;++a<l;){const h=t.children[a],f={},p=o?o[a]:void 0;p&&(f.align=p);let m={type:"element",tagName:s,properties:f,children:[]};h&&(m.children=e.all(h),e.patch(h,m),m=e.applyData(h,m)),c.push(m)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function C5(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const mg=9,gg=32;function E5(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),i=0;const s=[];for(;n;)s.push(_g(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return s.push(_g(t.slice(i),i>0,!1)),s.join("")}function _g(e,t,r){let n=0,i=e.length;if(t){let s=e.codePointAt(n);for(;s===mg||s===gg;)n++,s=e.codePointAt(n)}if(r){let s=e.codePointAt(i-1);for(;s===mg||s===gg;)i--,s=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}function N5(e,t){const r={type:"text",value:E5(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function
|
|
74
|
+
`});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function v5(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let n=-1;for(;!t&&++n<r.length;)t=py(r[n])}return t}function py(e){const t=e.spread;return t??e.children.length>1}function x5(e,t){const r={},n=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,s),e.applyData(t,s)}function y5(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function b5(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function w5(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function S5(e,t){const r=e.all(t),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=$f(t.children[1]),a=q0(t.children[t.children.length-1]);l&&a&&(o.position={start:l,end:a}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function k5(e,t,r){const n=r?r.children:void 0,s=(n?n.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:t.children.length;let a=-1;const c=[];for(;++a<l;){const h=t.children[a],f={},p=o?o[a]:void 0;p&&(f.align=p);let m={type:"element",tagName:s,properties:f,children:[]};h&&(m.children=e.all(h),e.patch(h,m),m=e.applyData(h,m)),c.push(m)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function C5(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const mg=9,gg=32;function E5(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),i=0;const s=[];for(;n;)s.push(_g(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return s.push(_g(t.slice(i),i>0,!1)),s.join("")}function _g(e,t,r){let n=0,i=e.length;if(t){let s=e.codePointAt(n);for(;s===mg||s===gg;)n++,s=e.codePointAt(n)}if(r){let s=e.codePointAt(i-1);for(;s===mg||s===gg;)i--,s=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}function N5(e,t){const r={type:"text",value:E5(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function P5(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const T5={blockquote:i5,break:s5,code:o5,delete:l5,emphasis:a5,footnoteReference:c5,heading:u5,html:h5,imageReference:d5,image:f5,inlineCode:p5,linkReference:m5,link:g5,listItem:_5,list:x5,paragraph:y5,root:b5,strong:w5,table:S5,tableCell:C5,tableRow:k5,text:N5,thematicBreak:P5,toml:Ol,yaml:Ol,definition:Ol,footnoteDefinition:Ol};function Ol(){}const my=-1,kc=0,Lo=1,Ka=2,qf=3,Yf=4,Xf=5,Gf=6,gy=7,_y=8,vg=typeof self=="object"?self:globalThis,L5=(e,t)=>{const r=(i,s)=>(e.set(s,i),i),n=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case kc:case my:return r(o,i);case Lo:{const l=r([],i);for(const a of o)l.push(n(a));return l}case Ka:{const l=r({},i);for(const[a,c]of o)l[n(a)]=n(c);return l}case qf:return r(new Date(o),i);case Yf:{const{source:l,flags:a}=o;return r(new RegExp(l,a),i)}case Xf:{const l=r(new Map,i);for(const[a,c]of o)l.set(n(a),n(c));return l}case Gf:{const l=r(new Set,i);for(const a of o)l.add(n(a));return l}case gy:{const{name:l,message:a}=o;return r(new vg[l](a),i)}case _y:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new vg[s](o),i)};return n},xg=e=>L5(new Map,e)(0),es="",{toString:R5}={},{keys:M5}=Object,Zs=e=>{const t=typeof e;if(t!=="object"||!e)return[kc,t];const r=R5.call(e).slice(8,-1);switch(r){case"Array":return[Lo,es];case"Object":return[Ka,es];case"Date":return[qf,es];case"RegExp":return[Yf,es];case"Map":return[Xf,es];case"Set":return[Gf,es];case"DataView":return[Lo,r]}return r.includes("Array")?[Lo,r]:r.includes("Error")?[gy,r]:[Ka,r]},zl=([e,t])=>e===kc&&(t==="function"||t==="symbol"),I5=(e,t,r,n)=>{const i=(o,l)=>{const a=n.push(o)-1;return r.set(l,a),a},s=o=>{if(r.has(o))return r.get(o);let[l,a]=Zs(o);switch(l){case kc:{let d=o;switch(a){case"bigint":l=_y,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);d=null;break;case"undefined":return i([my],o)}return i([l,d],o)}case Lo:{if(a){let f=o;return a==="DataView"?f=new Uint8Array(o.buffer):a==="ArrayBuffer"&&(f=new Uint8Array(o)),i([a,[...f]],o)}const d=[],h=i([l,d],o);for(const f of o)d.push(s(f));return h}case Ka:{if(a)switch(a){case"BigInt":return i([a,o.toString()],o);case"Boolean":case"Number":case"String":return i([a,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],h=i([l,d],o);for(const f of M5(o))(e||!zl(Zs(o[f])))&&d.push([s(f),s(o[f])]);return h}case qf:return i([l,o.toISOString()],o);case Yf:{const{source:d,flags:h}=o;return i([l,{source:d,flags:h}],o)}case Xf:{const d=[],h=i([l,d],o);for(const[f,p]of o)(e||!(zl(Zs(f))||zl(Zs(p))))&&d.push([s(f),s(p)]);return h}case Gf:{const d=[],h=i([l,d],o);for(const f of o)(e||!zl(Zs(f)))&&d.push(s(f));return h}}const{message:c}=o;return i([l,{name:a,message:c}],o)};return s},yg=(e,{json:t,lossy:r}={})=>{const n=[];return I5(!(t||r),!!t,new Map,n)(e),n},qa=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?xg(yg(e,t)):structuredClone(e):(e,t)=>xg(yg(e,t));function D5(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function j5(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function A5(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||D5,n=e.options.footnoteBackLabel||j5,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let a=-1;for(;++a<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[a]);if(!c)continue;const d=e.all(c),h=String(c.identifier).toUpperCase(),f=$s(h.toLowerCase());let p=0;const m=[],g=e.footnoteCounts.get(h);for(;g!==void 0&&++p<=g;){m.length>0&&m.push({type:"text",value:" "});let x=typeof r=="string"?r:r(a,p);typeof x=="string"&&(x={type:"text",value:x}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(a,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const S=d[d.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const x=S.children[S.children.length-1];x&&x.type==="text"?x.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...m)}else d.push(...m);const _={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(c,_),l.push(_)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...qa(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
75
75
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
76
|
-
`}]}}const Cc=function(e){if(e==null)return $5;if(typeof e=="function")return Ec(e);if(typeof e=="object")return Array.isArray(e)?B5(e):O5(e);if(typeof e=="string")return z5(e);throw new Error("Expected function, string, or object as test")};function B5(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Cc(e[r]);return Ec(n);function n(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function O5(e){const t=e;return Ec(r);function r(n){const i=n;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function z5(e){return Ec(t);function t(r){return r&&r.type===e}}function Ec(e){return t;function t(r,n,i){return!!(F5(r)&&e.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function $5(){return!0}function F5(e){return e!==null&&typeof e=="object"&&"type"in e}const vy=[],W5=!0,Yh=!1,H5="skip";function xy(e,t,r,n){let i;typeof t=="function"&&typeof r!="function"?(n=r,r=t):i=t;const s=Cc(i),o=n?-1:1;l(e,void 0,[])();function l(a,c,d){const h=a&&typeof a=="object"?a:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(a.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=vy,m,g,S;if((!t||s(a,c,d[d.length-1]||void 0))&&(p=U5(r(a,d)),p[0]===Yh))return p;if("children"in a&&a.children){const _=a;if(_.children&&p[0]!==H5)for(g=(n?_.children.length:-1)+o,S=d.concat(_);g>-1&&g<_.children.length;){const x=_.children[g];if(m=l(x,g,S)(),m[0]===Yh)return m;g=typeof m[1]=="number"?m[1]:g+o}}return p}}}function U5(e){return Array.isArray(e)?e:typeof e=="number"?[W5,e]:e==null?vy:[e]}function Nc(e,t,r,n){let i,s,o;typeof t=="function"&&typeof r!="function"?(s=void 0,o=t,i=r):(s=t,o=r,i=n),xy(e,s,l,i);function l(a,c){const d=c[c.length-1],h=d?d.children.indexOf(a):void 0;return o(a,h,d)}}const Xh={}.hasOwnProperty,V5={};function K5(e,t){const r=t||V5,n=new Map,i=new Map,s=new Map,o={...
|
|
76
|
+
`}]}}const Cc=function(e){if(e==null)return $5;if(typeof e=="function")return Ec(e);if(typeof e=="object")return Array.isArray(e)?B5(e):O5(e);if(typeof e=="string")return z5(e);throw new Error("Expected function, string, or object as test")};function B5(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Cc(e[r]);return Ec(n);function n(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function O5(e){const t=e;return Ec(r);function r(n){const i=n;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function z5(e){return Ec(t);function t(r){return r&&r.type===e}}function Ec(e){return t;function t(r,n,i){return!!(F5(r)&&e.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function $5(){return!0}function F5(e){return e!==null&&typeof e=="object"&&"type"in e}const vy=[],W5=!0,Yh=!1,H5="skip";function xy(e,t,r,n){let i;typeof t=="function"&&typeof r!="function"?(n=r,r=t):i=t;const s=Cc(i),o=n?-1:1;l(e,void 0,[])();function l(a,c,d){const h=a&&typeof a=="object"?a:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(a.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=vy,m,g,S;if((!t||s(a,c,d[d.length-1]||void 0))&&(p=U5(r(a,d)),p[0]===Yh))return p;if("children"in a&&a.children){const _=a;if(_.children&&p[0]!==H5)for(g=(n?_.children.length:-1)+o,S=d.concat(_);g>-1&&g<_.children.length;){const x=_.children[g];if(m=l(x,g,S)(),m[0]===Yh)return m;g=typeof m[1]=="number"?m[1]:g+o}}return p}}}function U5(e){return Array.isArray(e)?e:typeof e=="number"?[W5,e]:e==null?vy:[e]}function Nc(e,t,r,n){let i,s,o;typeof t=="function"&&typeof r!="function"?(s=void 0,o=t,i=r):(s=t,o=r,i=n),xy(e,s,l,i);function l(a,c){const d=c[c.length-1],h=d?d.children.indexOf(a):void 0;return o(a,h,d)}}const Xh={}.hasOwnProperty,V5={};function K5(e,t){const r=t||V5,n=new Map,i=new Map,s=new Map,o={...T5,...r.handlers},l={all:c,applyData:Y5,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:a,options:r,patch:q5,wrap:G5};return Nc(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?n:i,f=String(d.identifier).toUpperCase();h.has(f)||h.set(f,d)}}),l;function a(d,h){const f=d.type,p=l.handlers[f];if(Xh.call(l.handlers,f)&&p)return p(l,d,h);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in d){const{children:g,...S}=d,_=qa(S);return _.children=l.all(d),_}return qa(d)}return(l.options.unknownHandler||X5)(l,d,h)}function c(d){const h=[];if("children"in d){const f=d.children;let p=-1;for(;++p<f.length;){const m=l.one(f[p],d);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=bg(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=bg(g.value))}Array.isArray(m)?h.push(...m):h.push(m)}}}return h}}function q5(e,t){e.position&&(t.position=jC(e))}function Y5(e,t){let r=t;if(e&&e.data){const n=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,qa(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function X5(e,t){const r=t.data||{},n="value"in t&&!(Xh.call(r,"hProperties")||Xh.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function G5(e,t){const r=[];let n=-1;for(t&&r.push({type:"text",value:`
|
|
77
77
|
`});++n<e.length;)n&&r.push({type:"text",value:`
|
|
78
78
|
`}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
79
79
|
`}),r}function bg(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function wg(e,t){const r=K5(e,t),n=r.one(e,void 0),i=A5(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
80
|
-
`},i),s}function Q5(e,t){return e&&"run"in e?async function(r,n){const i=wg(r,{file:n,...t});await e.run(i,n)}:function(r,n){return wg(r,{file:n,...e||t})}}function Sg(e){if(e)throw e}var ua=Object.prototype.hasOwnProperty,yy=Object.prototype.toString,kg=Object.defineProperty,Cg=Object.getOwnPropertyDescriptor,Eg=function(t){return typeof Array.isArray=="function"?Array.isArray(t):yy.call(t)==="[object Array]"},Ng=function(t){if(!t||yy.call(t)!=="[object Object]")return!1;var r=ua.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&ua.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var i;for(i in t);return typeof i>"u"||ua.call(t,i)},Tg=function(t,r){kg&&r.name==="__proto__"?kg(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},Pg=function(t,r){if(r==="__proto__")if(ua.call(t,r)){if(Cg)return Cg(t,r).value}else return;return t[r]},J5=function e(){var t,r,n,i,s,o,l=arguments[0],a=1,c=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},a=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});a<c;++a)if(t=arguments[a],t!=null)for(r in t)n=Pg(l,r),i=Pg(t,r),l!==i&&(d&&i&&(Ng(i)||(s=Eg(i)))?(s?(s=!1,o=n&&Eg(n)?n:[]):o=n&&Ng(n)?n:{},Tg(l,{name:r,newValue:e(d,o,i)})):typeof i<"u"&&Tg(l,{name:r,newValue:i}));return l};const du=zd(J5);function Gh(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Z5(){const e=[],t={run:r,use:n};return t;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(a,...c){const d=e[++s];let h=-1;if(a){o(a);return}for(;++h<i.length;)(c[h]===null||c[h]===void 0)&&(c[h]=i[h]);i=c,d?eN(d,l)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function eN(e,t){let r;return n;function n(...o){const l=e.length>o.length;let a;l&&o.push(i);try{a=e.apply(this,o)}catch(c){const d=c;if(l&&r)throw d;return i(d)}l||(a&&a.then&&typeof a.then=="function"?a.then(s,i):a instanceof Error?i(a):s(a))}function i(o,...l){r||(r=!0,t(o,...l))}function s(o){i(null,o)}}const cn={basename:tN,dirname:rN,extname:nN,join:iN,sep:"/"};function tN(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');gl(e);let r=0,n=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(n=i):(l=-1,n=o));return r===n?n=o:n<0&&(n=e.length),e.slice(r,n)}function rN(e){if(gl(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function nN(e){gl(e);let t=e.length,r=-1,n=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){n=t+1;break}continue}r<0&&(o=!0,r=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function iN(...e){let t=-1,r;for(;++t<e.length;)gl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":sN(r)}function sN(e){gl(e);const t=e.codePointAt(0)===47;let r=oN(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function oN(e,t){let r="",n=0,i=-1,s=0,o=-1,l,a;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(a=r.lastIndexOf("/"),a!==r.length-1){a<0?(r="",n=0):(r=r.slice(0,a),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,o):r=e.slice(i+1,o),n=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return r}function gl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const lN={cwd:aN};function aN(){return"/"}function Qh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function cN(e){if(typeof e=="string")e=new URL(e);else if(!Qh(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return uN(e)}function uN(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const fu=["history","path","basename","stem","extname","dirname"];class by{constructor(t){let r;t?Qh(t)?r={path:t}:typeof t=="string"||hN(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":lN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<fu.length;){const s=fu[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)fu.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?cn.basename(this.path):void 0}set basename(t){mu(t,"basename"),pu(t,"basename"),this.path=cn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?cn.dirname(this.path):void 0}set dirname(t){Lg(this.basename,"dirname"),this.path=cn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?cn.extname(this.path):void 0}set extname(t){if(pu(t,"extname"),Lg(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=cn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Qh(t)&&(t=cN(t)),mu(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?cn.basename(this.path,this.extname):void 0}set stem(t){mu(t,"stem"),pu(t,"stem"),this.path=cn.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){const i=this.message(t,r,n);throw i.fatal=!0,i}info(t,r,n){const i=this.message(t,r,n);return i.fatal=void 0,i}message(t,r,n){const i=new Jt(t,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function pu(e,t){if(e&&e.includes(cn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+cn.sep+"`")}function mu(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Lg(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function hN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dN=function(e){const n=this.constructor.prototype,i=n[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s},fN={}.hasOwnProperty;class Qf extends dN{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Z5()}copy(){const t=new Qf;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(du(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(vu("data",this.frozen),this.namespace[t]=r,this):fN.call(this.namespace,t)&&this.namespace[t]||void 0:t?(vu("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(t,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=$l(t),n=this.parser||this.Parser;return gu("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),gu("process",this.parser||this.Parser),_u("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const l=$l(t),a=n.parse(l);n.run(a,l,function(d,h,f){if(d||!h||!f)return c(d);const p=h,m=n.stringify(p,f);gN(m)?f.value=m:f.result=m,c(d,f)});function c(d,h){d||!h?o(d):s?s(h):r(void 0,h)}}}processSync(t){let r=!1,n;return this.freeze(),gu("processSync",this.parser||this.Parser),_u("processSync",this.compiler||this.Compiler),this.process(t,i),Mg("processSync","process",r),n;function i(s,o){r=!0,Sg(s),n=o}}run(t,r,n){Rg(t),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,l){const a=$l(r);i.run(t,a,c);function c(d,h,f){const p=h||t;d?l(d):o?o(p):n(void 0,p,f)}}}runSync(t,r){let n=!1,i;return this.run(t,r,s),Mg("runSync","run",n),i;function s(o,l){Sg(o),i=l,n=!0}}stringify(t,r){this.freeze();const n=$l(r),i=this.compiler||this.Compiler;return _u("stringify",i),Rg(t),i(t,n)}use(t,...r){const n=this.attachers,i=this.namespace;if(vu("use",this.frozen),t!=null)if(typeof t=="function")a(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")a(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...h]=c;a(d,h)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(c.plugins),c.settings&&(i.settings=du(!0,i.settings,c.settings))}function l(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const h=c[d];s(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function a(c,d){let h=-1,f=-1;for(;++h<n.length;)if(n[h][0]===c){f=h;break}if(f===-1)n.push([c,...d]);else if(d.length>0){let[p,...m]=d;const g=n[f][1];Gh(g)&&Gh(p)&&(p=du(!0,g,p)),n[f]=[c,p,...m]}}}}const pN=new Qf().freeze();function gu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function _u(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function vu(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Rg(e){if(!Gh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Mg(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function $l(e){return mN(e)?e:new by(e)}function mN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function gN(e){return typeof e=="string"||_N(e)}function _N(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const vN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ig=[],Dg={allowDangerousHtml:!0},xN=/^(https?|ircs?|mailto|xmpp)$/i,yN=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function jg(e){const t=bN(e),r=wN(e);return SN(t.runSync(t.parse(r),r),e)}function bN(e){const t=e.rehypePlugins||Ig,r=e.remarkPlugins||Ig,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Dg}:Dg;return pN().use(n5).use(r).use(Q5,n).use(t)}function wN(e){const t=e.children||"",r=new by;return typeof t=="string"&&(r.value=t),r}function SN(e,t){const r=t.allowedElements,n=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||kN;for(const d of yN)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+vN+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Nc(e,c),$C(e,{Fragment:u.Fragment,components:i,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function c(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in cu)if(Object.hasOwn(cu,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],g=cu[p];(g===null||g.includes(d.tagName))&&(d.properties[p]=a(String(m||""),p,d))}}if(d.type==="element"){let p=r?!r.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&n&&typeof h=="number"&&(p=!n(d,h,f)),p&&f&&typeof h=="number")return l&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function kN(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||n!==-1&&t>n||xN.test(e.slice(0,t))?e:""}function Ag(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}function CN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function wy(e,t,r){const i=Cc((r||{}).ignore||[]),s=EN(t);let o=-1;for(;++o<s.length;)xy(e,"text",l);function l(c,d){let h=-1,f;for(;++h<d.length;){const p=d[h],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return a(c,d)}function a(c,d){const h=d[d.length-1],f=s[o][0],p=s[o][1];let m=0;const S=h.children.indexOf(c);let _=!1,x=[];f.lastIndex=0;let w=f.exec(c.value);for(;w;){const N=w.index,L={index:w.index,input:w.input,stack:[...d,c]};let C=p(...w,L);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?f.lastIndex=N+1:(m!==N&&x.push({type:"text",value:c.value.slice(m,N)}),Array.isArray(C)?x.push(...C):C&&x.push(C),m=N+w[0].length,_=!0),!f.global)break;w=f.exec(c.value)}return _?(m<c.value.length&&x.push({type:"text",value:c.value.slice(m)}),h.children.splice(S,1,...x)):x=[c],S+x.length}}function EN(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let n=-1;for(;++n<r.length;){const i=r[n];t.push([NN(i[0]),TN(i[1])])}return t}function NN(e){return typeof e=="string"?new RegExp(CN(e),"g"):e}function TN(e){return typeof e=="function"?e:function(){return e}}const xu="phrasing",yu=["autolink","link","image","label"];function PN(){return{transforms:[AN],enter:{literalAutolink:RN,literalAutolinkEmail:bu,literalAutolinkHttp:bu,literalAutolinkWww:bu},exit:{literalAutolink:jN,literalAutolinkEmail:DN,literalAutolinkHttp:MN,literalAutolinkWww:IN}}}function LN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:xu,notInConstruct:yu},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:xu,notInConstruct:yu},{character:":",before:"[ps]",after:"\\/",inConstruct:xu,notInConstruct:yu}]}}function RN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bu(e){this.config.enter.autolinkProtocol.call(this,e)}function MN(e){this.config.exit.autolinkProtocol.call(this,e)}function IN(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function DN(e){this.config.exit.autolinkEmail.call(this,e)}function jN(e){this.exit(e)}function AN(e){wy(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,BN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),ON]],{ignore:["link","linkReference"]})}function BN(e,t,r,n,i){let s="";if(!Sy(i)||(/^w/i.test(t)&&(r=t+r,t="",s="http://"),!zN(r)))return!1;const o=$N(r+n);if(!o[0])return!1;const l={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function ON(e,t,r,n){return!Sy(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function zN(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function $N(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")");const i=Ag(e,"(");let s=Ag(e,")");for(;n!==-1&&i>s;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),s++;return[e,r]}function Sy(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Ui(r)||wc(r))&&(!t||r!==47)}ky.peek=XN;function FN(){this.buffer()}function WN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function HN(){this.buffer()}function UN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function VN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=en(this.sliceSerialize(e)).toLowerCase(),r.label=t}function KN(e){this.exit(e)}function qN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=en(this.sliceSerialize(e)).toLowerCase(),r.label=t}function YN(e){this.exit(e)}function XN(){return"["}function ky(e,t,r,n){const i=r.createTracker(n);let s=i.move("[^");const o=r.enter("footnoteReference"),l=r.enter("reference");return s+=i.move(r.safe(r.associationId(e),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function GN(){return{enter:{gfmFootnoteCallString:FN,gfmFootnoteCall:WN,gfmFootnoteDefinitionLabelString:HN,gfmFootnoteDefinition:UN},exit:{gfmFootnoteCallString:VN,gfmFootnoteCall:KN,gfmFootnoteDefinitionLabelString:qN,gfmFootnoteDefinition:YN}}}function QN(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:ky},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const l=s.createTracker(o);let a=l.move("[^");const c=s.enter("footnoteDefinition"),d=s.enter("label");return a+=l.move(s.safe(s.associationId(n),{before:a,after:"]"})),d(),a+=l.move("]:"),n.children&&n.children.length>0&&(l.shift(4),a+=l.move((t?`
|
|
81
|
-
`:" ")+s.indentLines(s.containerFlow(n,l.current()),t?Cy:JN))),c(),a}}function JN(e,t,r){return t===0?e:Cy(e,t,r)}function Cy(e,t,r){return(r?"":" ")+e}const ZN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ey.peek=
|
|
82
|
-
`)}function
|
|
83
|
-
`&&
|
|
84
|
-
`}function
|
|
80
|
+
`},i),s}function Q5(e,t){return e&&"run"in e?async function(r,n){const i=wg(r,{file:n,...t});await e.run(i,n)}:function(r,n){return wg(r,{file:n,...e||t})}}function Sg(e){if(e)throw e}var ua=Object.prototype.hasOwnProperty,yy=Object.prototype.toString,kg=Object.defineProperty,Cg=Object.getOwnPropertyDescriptor,Eg=function(t){return typeof Array.isArray=="function"?Array.isArray(t):yy.call(t)==="[object Array]"},Ng=function(t){if(!t||yy.call(t)!=="[object Object]")return!1;var r=ua.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&ua.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var i;for(i in t);return typeof i>"u"||ua.call(t,i)},Pg=function(t,r){kg&&r.name==="__proto__"?kg(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},Tg=function(t,r){if(r==="__proto__")if(ua.call(t,r)){if(Cg)return Cg(t,r).value}else return;return t[r]},J5=function e(){var t,r,n,i,s,o,l=arguments[0],a=1,c=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},a=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});a<c;++a)if(t=arguments[a],t!=null)for(r in t)n=Tg(l,r),i=Tg(t,r),l!==i&&(d&&i&&(Ng(i)||(s=Eg(i)))?(s?(s=!1,o=n&&Eg(n)?n:[]):o=n&&Ng(n)?n:{},Pg(l,{name:r,newValue:e(d,o,i)})):typeof i<"u"&&Pg(l,{name:r,newValue:i}));return l};const du=zd(J5);function Gh(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Z5(){const e=[],t={run:r,use:n};return t;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(a,...c){const d=e[++s];let h=-1;if(a){o(a);return}for(;++h<i.length;)(c[h]===null||c[h]===void 0)&&(c[h]=i[h]);i=c,d?eN(d,l)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function eN(e,t){let r;return n;function n(...o){const l=e.length>o.length;let a;l&&o.push(i);try{a=e.apply(this,o)}catch(c){const d=c;if(l&&r)throw d;return i(d)}l||(a&&a.then&&typeof a.then=="function"?a.then(s,i):a instanceof Error?i(a):s(a))}function i(o,...l){r||(r=!0,t(o,...l))}function s(o){i(null,o)}}const cn={basename:tN,dirname:rN,extname:nN,join:iN,sep:"/"};function tN(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');gl(e);let r=0,n=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(n=i):(l=-1,n=o));return r===n?n=o:n<0&&(n=e.length),e.slice(r,n)}function rN(e){if(gl(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function nN(e){gl(e);let t=e.length,r=-1,n=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){n=t+1;break}continue}r<0&&(o=!0,r=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function iN(...e){let t=-1,r;for(;++t<e.length;)gl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":sN(r)}function sN(e){gl(e);const t=e.codePointAt(0)===47;let r=oN(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function oN(e,t){let r="",n=0,i=-1,s=0,o=-1,l,a;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(a=r.lastIndexOf("/"),a!==r.length-1){a<0?(r="",n=0):(r=r.slice(0,a),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,o):r=e.slice(i+1,o),n=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return r}function gl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const lN={cwd:aN};function aN(){return"/"}function Qh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function cN(e){if(typeof e=="string")e=new URL(e);else if(!Qh(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return uN(e)}function uN(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const fu=["history","path","basename","stem","extname","dirname"];class by{constructor(t){let r;t?Qh(t)?r={path:t}:typeof t=="string"||hN(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":lN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<fu.length;){const s=fu[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)fu.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?cn.basename(this.path):void 0}set basename(t){mu(t,"basename"),pu(t,"basename"),this.path=cn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?cn.dirname(this.path):void 0}set dirname(t){Lg(this.basename,"dirname"),this.path=cn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?cn.extname(this.path):void 0}set extname(t){if(pu(t,"extname"),Lg(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=cn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Qh(t)&&(t=cN(t)),mu(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?cn.basename(this.path,this.extname):void 0}set stem(t){mu(t,"stem"),pu(t,"stem"),this.path=cn.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){const i=this.message(t,r,n);throw i.fatal=!0,i}info(t,r,n){const i=this.message(t,r,n);return i.fatal=void 0,i}message(t,r,n){const i=new Jt(t,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function pu(e,t){if(e&&e.includes(cn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+cn.sep+"`")}function mu(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Lg(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function hN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dN=function(e){const n=this.constructor.prototype,i=n[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s},fN={}.hasOwnProperty;class Qf extends dN{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Z5()}copy(){const t=new Qf;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(du(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(vu("data",this.frozen),this.namespace[t]=r,this):fN.call(this.namespace,t)&&this.namespace[t]||void 0:t?(vu("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(t,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=$l(t),n=this.parser||this.Parser;return gu("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),gu("process",this.parser||this.Parser),_u("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const l=$l(t),a=n.parse(l);n.run(a,l,function(d,h,f){if(d||!h||!f)return c(d);const p=h,m=n.stringify(p,f);gN(m)?f.value=m:f.result=m,c(d,f)});function c(d,h){d||!h?o(d):s?s(h):r(void 0,h)}}}processSync(t){let r=!1,n;return this.freeze(),gu("processSync",this.parser||this.Parser),_u("processSync",this.compiler||this.Compiler),this.process(t,i),Mg("processSync","process",r),n;function i(s,o){r=!0,Sg(s),n=o}}run(t,r,n){Rg(t),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,l){const a=$l(r);i.run(t,a,c);function c(d,h,f){const p=h||t;d?l(d):o?o(p):n(void 0,p,f)}}}runSync(t,r){let n=!1,i;return this.run(t,r,s),Mg("runSync","run",n),i;function s(o,l){Sg(o),i=l,n=!0}}stringify(t,r){this.freeze();const n=$l(r),i=this.compiler||this.Compiler;return _u("stringify",i),Rg(t),i(t,n)}use(t,...r){const n=this.attachers,i=this.namespace;if(vu("use",this.frozen),t!=null)if(typeof t=="function")a(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")a(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...h]=c;a(d,h)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(c.plugins),c.settings&&(i.settings=du(!0,i.settings,c.settings))}function l(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const h=c[d];s(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function a(c,d){let h=-1,f=-1;for(;++h<n.length;)if(n[h][0]===c){f=h;break}if(f===-1)n.push([c,...d]);else if(d.length>0){let[p,...m]=d;const g=n[f][1];Gh(g)&&Gh(p)&&(p=du(!0,g,p)),n[f]=[c,p,...m]}}}}const pN=new Qf().freeze();function gu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function _u(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function vu(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Rg(e){if(!Gh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Mg(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function $l(e){return mN(e)?e:new by(e)}function mN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function gN(e){return typeof e=="string"||_N(e)}function _N(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const vN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ig=[],Dg={allowDangerousHtml:!0},xN=/^(https?|ircs?|mailto|xmpp)$/i,yN=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function jg(e){const t=bN(e),r=wN(e);return SN(t.runSync(t.parse(r),r),e)}function bN(e){const t=e.rehypePlugins||Ig,r=e.remarkPlugins||Ig,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Dg}:Dg;return pN().use(n5).use(r).use(Q5,n).use(t)}function wN(e){const t=e.children||"",r=new by;return typeof t=="string"&&(r.value=t),r}function SN(e,t){const r=t.allowedElements,n=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||kN;for(const d of yN)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+vN+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Nc(e,c),$C(e,{Fragment:u.Fragment,components:i,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function c(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in cu)if(Object.hasOwn(cu,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],g=cu[p];(g===null||g.includes(d.tagName))&&(d.properties[p]=a(String(m||""),p,d))}}if(d.type==="element"){let p=r?!r.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&n&&typeof h=="number"&&(p=!n(d,h,f)),p&&f&&typeof h=="number")return l&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function kN(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||n!==-1&&t>n||xN.test(e.slice(0,t))?e:""}function Ag(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}function CN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function wy(e,t,r){const i=Cc((r||{}).ignore||[]),s=EN(t);let o=-1;for(;++o<s.length;)xy(e,"text",l);function l(c,d){let h=-1,f;for(;++h<d.length;){const p=d[h],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return a(c,d)}function a(c,d){const h=d[d.length-1],f=s[o][0],p=s[o][1];let m=0;const S=h.children.indexOf(c);let _=!1,x=[];f.lastIndex=0;let w=f.exec(c.value);for(;w;){const N=w.index,L={index:w.index,input:w.input,stack:[...d,c]};let C=p(...w,L);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?f.lastIndex=N+1:(m!==N&&x.push({type:"text",value:c.value.slice(m,N)}),Array.isArray(C)?x.push(...C):C&&x.push(C),m=N+w[0].length,_=!0),!f.global)break;w=f.exec(c.value)}return _?(m<c.value.length&&x.push({type:"text",value:c.value.slice(m)}),h.children.splice(S,1,...x)):x=[c],S+x.length}}function EN(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let n=-1;for(;++n<r.length;){const i=r[n];t.push([NN(i[0]),PN(i[1])])}return t}function NN(e){return typeof e=="string"?new RegExp(CN(e),"g"):e}function PN(e){return typeof e=="function"?e:function(){return e}}const xu="phrasing",yu=["autolink","link","image","label"];function TN(){return{transforms:[AN],enter:{literalAutolink:RN,literalAutolinkEmail:bu,literalAutolinkHttp:bu,literalAutolinkWww:bu},exit:{literalAutolink:jN,literalAutolinkEmail:DN,literalAutolinkHttp:MN,literalAutolinkWww:IN}}}function LN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:xu,notInConstruct:yu},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:xu,notInConstruct:yu},{character:":",before:"[ps]",after:"\\/",inConstruct:xu,notInConstruct:yu}]}}function RN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bu(e){this.config.enter.autolinkProtocol.call(this,e)}function MN(e){this.config.exit.autolinkProtocol.call(this,e)}function IN(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function DN(e){this.config.exit.autolinkEmail.call(this,e)}function jN(e){this.exit(e)}function AN(e){wy(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,BN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),ON]],{ignore:["link","linkReference"]})}function BN(e,t,r,n,i){let s="";if(!Sy(i)||(/^w/i.test(t)&&(r=t+r,t="",s="http://"),!zN(r)))return!1;const o=$N(r+n);if(!o[0])return!1;const l={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function ON(e,t,r,n){return!Sy(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function zN(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function $N(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")");const i=Ag(e,"(");let s=Ag(e,")");for(;n!==-1&&i>s;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),s++;return[e,r]}function Sy(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Ui(r)||wc(r))&&(!t||r!==47)}ky.peek=XN;function FN(){this.buffer()}function WN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function HN(){this.buffer()}function UN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function VN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=en(this.sliceSerialize(e)).toLowerCase(),r.label=t}function KN(e){this.exit(e)}function qN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=en(this.sliceSerialize(e)).toLowerCase(),r.label=t}function YN(e){this.exit(e)}function XN(){return"["}function ky(e,t,r,n){const i=r.createTracker(n);let s=i.move("[^");const o=r.enter("footnoteReference"),l=r.enter("reference");return s+=i.move(r.safe(r.associationId(e),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function GN(){return{enter:{gfmFootnoteCallString:FN,gfmFootnoteCall:WN,gfmFootnoteDefinitionLabelString:HN,gfmFootnoteDefinition:UN},exit:{gfmFootnoteCallString:VN,gfmFootnoteCall:KN,gfmFootnoteDefinitionLabelString:qN,gfmFootnoteDefinition:YN}}}function QN(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:ky},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const l=s.createTracker(o);let a=l.move("[^");const c=s.enter("footnoteDefinition"),d=s.enter("label");return a+=l.move(s.safe(s.associationId(n),{before:a,after:"]"})),d(),a+=l.move("]:"),n.children&&n.children.length>0&&(l.shift(4),a+=l.move((t?`
|
|
81
|
+
`:" ")+s.indentLines(s.containerFlow(n,l.current()),t?Cy:JN))),c(),a}}function JN(e,t,r){return t===0?e:Cy(e,t,r)}function Cy(e,t,r){return(r?"":" ")+e}const ZN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ey.peek=i3;function e3(){return{canContainEols:["delete"],enter:{strikethrough:r3},exit:{strikethrough:n3}}}function t3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ZN}],handlers:{delete:Ey}}}function r3(e){this.enter({type:"delete",children:[]},e)}function n3(e){this.exit(e)}function Ey(e,t,r,n){const i=r.createTracker(n),s=r.enter("strikethrough");let o=i.move("~~");return o+=r.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function i3(){return"~"}function s3(e){return e.length}function o3(e,t){const r=t||{},n=(r.align||[]).concat(),i=r.stringLength||s3,s=[],o=[],l=[],a=[];let c=0,d=-1;for(;++d<e.length;){const g=[],S=[];let _=-1;for(e[d].length>c&&(c=e[d].length);++_<e[d].length;){const x=l3(e[d][_]);if(r.alignDelimiters!==!1){const w=i(x);S[_]=w,(a[_]===void 0||w>a[_])&&(a[_]=w)}g.push(x)}o[d]=g,l[d]=S}let h=-1;if(typeof n=="object"&&"length"in n)for(;++h<c;)s[h]=Bg(n[h]);else{const g=Bg(n);for(;++h<c;)s[h]=g}h=-1;const f=[],p=[];for(;++h<c;){const g=s[h];let S="",_="";g===99?(S=":",_=":"):g===108?S=":":g===114&&(_=":");let x=r.alignDelimiters===!1?1:Math.max(1,a[h]-S.length-_.length);const w=S+"-".repeat(x)+_;r.alignDelimiters!==!1&&(x=S.length+x+_.length,x>a[h]&&(a[h]=x),p[h]=x),f[h]=w}o.splice(1,0,f),l.splice(1,0,p),d=-1;const m=[];for(;++d<o.length;){const g=o[d],S=l[d];h=-1;const _=[];for(;++h<c;){const x=g[h]||"";let w="",N="";if(r.alignDelimiters!==!1){const L=a[h]-(S[h]||0),C=s[h];C===114?w=" ".repeat(L):C===99?L%2?(w=" ".repeat(L/2+.5),N=" ".repeat(L/2-.5)):(w=" ".repeat(L/2),N=w):N=" ".repeat(L)}r.delimiterStart!==!1&&!h&&_.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&x==="")&&(r.delimiterStart!==!1||h)&&_.push(" "),r.alignDelimiters!==!1&&_.push(w),_.push(x),r.alignDelimiters!==!1&&_.push(N),r.padding!==!1&&_.push(" "),(r.delimiterEnd!==!1||h!==c-1)&&_.push("|")}m.push(r.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return m.join(`
|
|
82
|
+
`)}function l3(e){return e==null?"":String(e)}function Bg(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function a3(e,t,r,n){const i=r.enter("blockquote"),s=r.createTracker(n);s.move("> "),s.shift(2);const o=r.indentLines(r.containerFlow(e,s.current()),c3);return i(),o}function c3(e,t,r){return">"+(r?"":" ")+e}function u3(e,t){return Og(e,t.inConstruct,!0)&&!Og(e,t.notInConstruct,!1)}function Og(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let n=-1;for(;++n<t.length;)if(e.includes(t[n]))return!0;return!1}function zg(e,t,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
|
|
83
|
+
`&&u3(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
|
|
84
|
+
`}function h3(e,t){const r=String(e);let n=r.indexOf(t),i=n,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++s>o&&(o=s):s=1,i=n+t.length,n=r.indexOf(t,i);return o}function d3(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function f3(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function p3(e,t,r,n){const i=f3(r),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(d3(e,r)){const h=r.enter("codeIndented"),f=r.indentLines(s,m3);return h(),f}const l=r.createTracker(n),a=i.repeat(Math.max(h3(s,i)+1,3)),c=r.enter("codeFenced");let d=l.move(a);if(e.lang){const h=r.enter(`codeFencedLang${o}`);d+=l.move(r.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),h()}if(e.lang&&e.meta){const h=r.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(r.safe(e.meta,{before:d,after:`
|
|
85
85
|
`,encode:["`"],...l.current()})),h()}return d+=l.move(`
|
|
86
86
|
`),s&&(d+=l.move(s+`
|
|
87
|
-
`)),d+=l.move(a),c(),d}function
|
|
88
|
-
`,...a.current()}))),l(),e.title&&(l=r.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(r.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),o(),c}function
|
|
87
|
+
`)),d+=l.move(a),c(),d}function m3(e,t,r){return(r?"":" ")+e}function Jf(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function g3(e,t,r,n){const i=Jf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let l=r.enter("label");const a=r.createTracker(n);let c=a.move("[");return c+=a.move(r.safe(r.associationId(e),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(r.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=r.enter("destinationRaw"),c+=a.move(r.safe(e.url,{before:c,after:e.title?" ":`
|
|
88
|
+
`,...a.current()}))),l(),e.title&&(l=r.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(r.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),o(),c}function _3(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function tl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ya(e,t,r){const n=Ms(e),i=Ms(t);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ny.peek=v3;function Ny(e,t,r,n){const i=_3(r),s=r.enter("emphasis"),o=r.createTracker(n),l=o.move(i);let a=o.move(r.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),d=Ya(n.before.charCodeAt(n.before.length-1),c,i);d.inside&&(a=tl(c)+a.slice(1));const h=a.charCodeAt(a.length-1),f=Ya(n.after.charCodeAt(0),h,i);f.inside&&(a=a.slice(0,-1)+tl(h));const p=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},l+a+p}function v3(e,t,r){return r.options.emphasis||"*"}function x3(e,t){let r=!1;return Nc(e,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,Yh}),!!((!e.depth||e.depth<3)&&Uf(e)&&(t.options.setext||r))}function y3(e,t,r,n){const i=Math.max(Math.min(6,e.depth||1),1),s=r.createTracker(n);if(x3(e,r)){const d=r.enter("headingSetext"),h=r.enter("phrasing"),f=r.containerPhrasing(e,{...s.current(),before:`
|
|
89
89
|
`,after:`
|
|
90
90
|
`});return h(),d(),f+`
|
|
91
91
|
`+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
92
92
|
`))+1))}const o="#".repeat(i),l=r.enter("headingAtx"),a=r.enter("phrasing");s.move(o+" ");let c=r.containerPhrasing(e,{before:"# ",after:`
|
|
93
|
-
`,...s.current()});return/^[\t ]/.test(c)&&(c=tl(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),a(),l(),c}
|
|
93
|
+
`,...s.current()});return/^[\t ]/.test(c)&&(c=tl(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),a(),l(),c}Py.peek=b3;function Py(e){return e.value||""}function b3(){return"<"}Ty.peek=w3;function Ty(e,t,r,n){const i=Jf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let l=r.enter("label");const a=r.createTracker(n);let c=a.move("![");return c+=a.move(r.safe(e.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(r.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=r.enter("destinationRaw"),c+=a.move(r.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=r.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(r.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),o(),c}function w3(){return"!"}Ly.peek=S3;function Ly(e,t,r,n){const i=e.referenceType,s=r.enter("imageReference");let o=r.enter("label");const l=r.createTracker(n);let a=l.move("![");const c=r.safe(e.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const d=r.stack;r.stack=[],o=r.enter("reference");const h=r.safe(r.associationId(e),{before:a,after:"]",...l.current()});return o(),r.stack=d,s(),i==="full"||!c||c!==h?a+=l.move(h+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function S3(){return"!"}Ry.peek=k3;function Ry(e,t,r){let n=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s<r.unsafe.length;){const o=r.unsafe[s],l=r.compilePattern(o);let a;if(o.atBreak)for(;a=l.exec(n);){let c=a.index;n.charCodeAt(c)===10&&n.charCodeAt(c-1)===13&&c--,n=n.slice(0,c)+" "+n.slice(a.index+1)}}return i+n+i}function k3(){return"`"}function My(e,t){const r=Uf(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Iy.peek=C3;function Iy(e,t,r,n){const i=Jf(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let l,a;if(My(e,r)){const d=r.stack;r.stack=[],l=r.enter("autolink");let h=o.move("<");return h+=o.move(r.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),l(),r.stack=d,h}l=r.enter("link"),a=r.enter("label");let c=o.move("[");return c+=o.move(r.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=r.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(r.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(a=r.enter("destinationRaw"),c+=o.move(r.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),a(),e.title&&(a=r.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(r.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),a()),c+=o.move(")"),l(),c}function C3(e,t,r){return My(e,r)?"<":"["}Dy.peek=E3;function Dy(e,t,r,n){const i=e.referenceType,s=r.enter("linkReference");let o=r.enter("label");const l=r.createTracker(n);let a=l.move("[");const c=r.containerPhrasing(e,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const d=r.stack;r.stack=[],o=r.enter("reference");const h=r.safe(r.associationId(e),{before:a,after:"]",...l.current()});return o(),r.stack=d,s(),i==="full"||!c||c!==h?a+=l.move(h+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function E3(){return"["}function Zf(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function N3(e){const t=Zf(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function P3(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function jy(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function T3(e,t,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=e.ordered?P3(r):Zf(r);const l=e.ordered?o==="."?")":".":N3(r);let a=t&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(a=!0),jy(r)===o&&d){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(o=l),r.bulletCurrent=o;const c=r.containerFlow(e,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),c}function L3(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function R3(e,t,r,n){const i=L3(r);let s=r.bulletCurrent||Zf(r);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=r.createTracker(n);l.move(s+" ".repeat(o-s.length)),l.shift(o);const a=r.enter("listItem"),c=r.indentLines(r.containerFlow(e,l.current()),d);return a(),c;function d(h,f,p){return f?(p?"":" ".repeat(o))+h:(p?s:s+" ".repeat(o-s.length))+h}}function M3(e,t,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(e,n);return s(),i(),o}const I3=Cc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function D3(e,t,r,n){return(e.children.some(function(o){return I3(o)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function j3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ay.peek=A3;function Ay(e,t,r,n){const i=j3(r),s=r.enter("strong"),o=r.createTracker(n),l=o.move(i+i);let a=o.move(r.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),d=Ya(n.before.charCodeAt(n.before.length-1),c,i);d.inside&&(a=tl(c)+a.slice(1));const h=a.charCodeAt(a.length-1),f=Ya(n.after.charCodeAt(0),h,i);f.inside&&(a=a.slice(0,-1)+tl(h));const p=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},l+a+p}function A3(e,t,r){return r.options.strong||"*"}function B3(e,t,r,n){return r.safe(e.value,n)}function O3(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function z3(e,t,r){const n=(jy(r)+(r.options.ruleSpaces?" ":"")).repeat(O3(r));return r.options.ruleSpaces?n.slice(0,-1):n}const By={blockquote:a3,break:zg,code:p3,definition:g3,emphasis:Ny,hardBreak:zg,heading:y3,html:Py,image:Ty,imageReference:Ly,inlineCode:Ry,link:Iy,linkReference:Dy,list:T3,listItem:R3,paragraph:M3,root:D3,strong:Ay,text:B3,thematicBreak:z3};function $3(){return{enter:{table:F3,tableData:$g,tableHeader:$g,tableRow:H3},exit:{codeText:U3,table:W3,tableData:wu,tableHeader:wu,tableRow:wu}}}function F3(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function W3(e){this.exit(e),this.data.inTable=void 0}function H3(e){this.enter({type:"tableRow",children:[]},e)}function wu(e){this.exit(e)}function $g(e){this.enter({type:"tableCell",children:[]},e)}function U3(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,V3));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function V3(e,t){return t==="|"?t:e}function K3(e){const t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
94
94
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:a,tableRow:l}};function o(p,m,g,S){return c(d(p,g,S),p.align)}function l(p,m,g,S){const _=h(p,g,S),x=c([_]);return x.slice(0,x.indexOf(`
|
|
95
|
-
`))}function a(p,m,g,S){const _=g.enter("tableCell"),x=g.enter("phrasing"),w=g.containerPhrasing(p,{...S,before:s,after:s});return x(),_(),w}function c(p,m){return oT(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function d(p,m,g){const S=p.children;let _=-1;const x=[],w=m.enter("table");for(;++_<S.length;)x[_]=h(S[_],m,g);return w(),x}function h(p,m,g){const S=p.children;let _=-1;const x=[],w=m.enter("tableRow");for(;++_<S.length;)x[_]=a(S[_],p,m,g);return w(),x}function f(p,m,g){let S=By.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function qT(){return{exit:{taskListCheckValueChecked:Fg,taskListCheckValueUnchecked:Fg,paragraph:XT}}}function YT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:GT}}}function Fg(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function XT(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const l=i[s];if(l.type==="paragraph"){o=l;break}}o===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function GT(e,t,r,n){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=r.createTracker(n);s&&l.move(o);let a=By.listItem(e,t,r,{...n,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(d){return d+o}}function QT(){return[PN(),GN(),eT(),$T(),qT()]}function JT(e){return{extensions:[LN(),QN(e),tT(),KT(e),YT()]}}const ZT={tokenize:s3,partial:!0},Oy={tokenize:o3,partial:!0},zy={tokenize:l3,partial:!0},$y={tokenize:a3,partial:!0},e3={tokenize:c3,partial:!0},Fy={name:"wwwAutolink",tokenize:n3,previous:Hy},Wy={name:"protocolAutolink",tokenize:i3,previous:Uy},jn={name:"emailAutolink",tokenize:r3,previous:Vy},gn={};function t3(){return{text:gn}}let yi=48;for(;yi<123;)gn[yi]=jn,yi++,yi===58?yi=65:yi===91&&(yi=97);gn[43]=jn;gn[45]=jn;gn[46]=jn;gn[95]=jn;gn[72]=[jn,Wy];gn[104]=[jn,Wy];gn[87]=[jn,Fy];gn[119]=[jn,Fy];function r3(e,t,r){const n=this;let i,s;return o;function o(h){return!Jh(h)||!Vy.call(n,n.previous)||ep(n.events)?r(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(h))}function l(h){return Jh(h)?(e.consume(h),l):h===64?(e.consume(h),a):r(h)}function a(h){return h===46?e.check(e3,d,c)(h):h===45||h===95||Gt(h)?(s=!0,e.consume(h),a):d(h)}function c(h){return e.consume(h),i=!0,a}function d(h){return s&&i&&rr(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):r(h)}}function n3(e,t,r){const n=this;return i;function i(o){return o!==87&&o!==119||!Hy.call(n,n.previous)||ep(n.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(ZT,e.attempt(Oy,e.attempt(zy,s),r),r)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function i3(e,t,r){const n=this;let i="",s=!1;return o;function o(h){return(h===72||h===104)&&Uy.call(n,n.previous)&&!ep(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),l):r(h)}function l(h){if(rr(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),l;if(h===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(h),a}return r(h)}function a(h){return h===47?(e.consume(h),s?c:(s=!0,a)):r(h)}function c(h){return h===null||Va(h)||Ze(h)||Ui(h)||wc(h)?r(h):e.attempt(Oy,e.attempt(zy,d),r)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function s3(e,t,r){let n=0;return i;function i(o){return(o===87||o===119)&&n<3?(n++,e.consume(o),i):o===46&&n===3?(e.consume(o),s):r(o)}function s(o){return o===null?r(o):t(o)}}function o3(e,t,r){let n,i,s;return o;function o(c){return c===46||c===95?e.check($y,a,l)(c):c===null||Ze(c)||Ui(c)||c!==45&&wc(c)?a(c):(s=!0,e.consume(c),o)}function l(c){return c===95?n=!0:(i=n,n=void 0),e.consume(c),o}function a(c){return i||n||!s?r(c):t(c)}}function l3(e,t){let r=0,n=0;return i;function i(o){return o===40?(r++,e.consume(o),i):o===41&&n<r?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check($y,t,s)(o):o===null||Ze(o)||Ui(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&n++,e.consume(o),i}}function a3(e,t,r){return n;function n(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),n):l===38?(e.consume(l),s):l===93?(e.consume(l),i):l===60||l===null||Ze(l)||Ui(l)?t(l):r(l)}function i(l){return l===null||l===40||l===91||Ze(l)||Ui(l)?t(l):n(l)}function s(l){return rr(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),n):rr(l)?(e.consume(l),o):r(l)}}function c3(e,t,r){return n;function n(s){return e.consume(s),i}function i(s){return Gt(s)?r(s):t(s)}}function Hy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ze(e)}function Uy(e){return!rr(e)}function Vy(e){return!(e===47||Jh(e))}function Jh(e){return e===43||e===45||e===46||e===95||Gt(e)}function ep(e){let t=e.length,r=!1;for(;t--;){const n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const u3={tokenize:v3,partial:!0};function h3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:m3,continuation:{tokenize:g3},exit:_3}},text:{91:{name:"gfmFootnoteCall",tokenize:p3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:d3,resolveTo:f3}}}}function d3(e,t,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const a=n.events[i][1];if(a.type==="labelImage"){o=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return l;function l(a){if(!o||!o._balanced)return r(a);const c=en(n.sliceSerialize({start:o.end,end:n.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?r(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function f3(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...l),e}function p3(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return l;function l(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),a}function a(h){return h!==94?r(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(h){if(s>999||h===93&&!o||h===null||h===91||Ze(h))return r(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(en(n.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(h)}return Ze(h)||(o=!0),s++,e.consume(h),h===92?d:c}function d(h){return h===91||h===92||h===93?(e.consume(h),s++,c):c(h)}}function m3(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,l;return a;function a(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):r(m)}function d(m){if(o>999||m===93&&!l||m===null||m===91||Ze(m))return r(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=en(n.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ze(m)||(l=!0),o++,e.consume(m),m===92?h:d}function h(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),Ke(e,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return t(m)}}function g3(e,t,r){return e.check(ml,t,e.attempt(u3,t,r))}function _3(e){e.exit("gfmFootnoteDefinition")}function v3(e,t,r){const n=this;return Ke(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):r(s)}}function x3(e){let r=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(o,l){let a=-1;for(;++a<o.length;)if(o[a][0]==="enter"&&o[a][1].type==="strikethroughSequenceTemporary"&&o[a][1]._close){let c=a;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[a][1].end.offset-o[a][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[a][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[a][1].end)},h={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[a][1].start)},f=[["enter",d,l],["enter",o[c][1],l],["exit",o[c][1],l],["enter",h,l]],p=l.parser.constructs.insideSpan.null;p&&Tr(f,f.length,0,Sc(p,o.slice(c+1,a),l)),Tr(f,f.length,0,[["exit",h,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",d,l]]),Tr(o,c-1,a-c+3,f),a=c+f.length-2;break}}for(a=-1;++a<o.length;)o[a][1].type==="strikethroughSequenceTemporary"&&(o[a][1].type="data");return o}function s(o,l,a){const c=this.previous,d=this.events;let h=0;return f;function f(m){return c===126&&d[d.length-1][1].type!=="characterEscape"?a(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const g=Ms(c);if(m===126)return h>1?a(m):(o.consume(m),h++,p);if(h<2&&!r)return a(m);const S=o.exit("strikethroughSequenceTemporary"),_=Ms(m);return S._open=!_||_===2&&!!g,S._close=!g||g===2&&!!_,l(m)}}}class y3{constructor(){this.map=[]}add(t,r,n){b3(this,t,r,n)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];n.push(t.slice()),t.length=0;let i=n.pop();for(;i;){for(const s of i)t.push(s);i=n.pop()}this.map.length=0}}function b3(e,t,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=r,e.map[i][2].push(...n);return}i+=1}e.map.push([t,r,n])}}function w3(e,t){let r=!1;const n=[];for(;t<e.length;){const i=e[t];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=n.length-1;n[s]=n[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return n}function S3(){return{flow:{null:{name:"table",tokenize:k3,resolveAll:C3}}}}function k3(e,t,r){const n=this;let i=0,s=0,o;return l;function l(E){let A=n.events.length-1;for(;A>-1;){const $=n.events[A][1].type;if($==="lineEnding"||$==="linePrefix")A--;else break}const R=A>-1?n.events[A][1].type:null,P=R==="tableHead"||R==="tableRow"?C:a;return P===C&&n.parser.lazy[n.now().line]?r(E):P(E)}function a(E){return e.enter("tableHead"),e.enter("tableRow"),c(E)}function c(E){return E===124||(o=!0,s+=1),d(E)}function d(E){return E===null?r(E):Ce(E)?s>1?(s=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):r(E):He(E)?Ke(e,d,"whitespace")(E):(s+=1,o&&(o=!1,i+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(E)))}function h(E){return E===null||E===124||Ze(E)?(e.exit("data"),d(E)):(e.consume(E),E===92?f:h)}function f(E){return E===92||E===124?(e.consume(E),h):h(E)}function p(E){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(E):(e.enter("tableDelimiterRow"),o=!1,He(E)?Ke(e,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):m(E))}function m(E){return E===45||E===58?S(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),g):L(E)}function g(E){return He(E)?Ke(e,S,"whitespace")(E):S(E)}function S(E){return E===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),_):E===45?(s+=1,_(E)):E===null||Ce(E)?N(E):L(E)}function _(E){return E===45?(e.enter("tableDelimiterFiller"),x(E)):L(E)}function x(E){return E===45?(e.consume(E),x):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(E))}function w(E){return He(E)?Ke(e,N,"whitespace")(E):N(E)}function N(E){return E===124?m(E):E===null||Ce(E)?!o||i!==s?L(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):L(E)}function L(E){return r(E)}function C(E){return e.enter("tableRow"),F(E)}function F(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),F):E===null||Ce(E)?(e.exit("tableRow"),t(E)):He(E)?Ke(e,F,"whitespace")(E):(e.enter("data"),T(E))}function T(E){return E===null||E===124||Ze(E)?(e.exit("data"),F(E)):(e.consume(E),E===92?q:T)}function q(E){return E===92||E===124?(e.consume(E),T):T(E)}}function C3(e,t){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,a=0,c,d,h;const f=new y3;for(;++r<e.length;){const p=e[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(l=!1,a!==0&&(Wg(f,t,a,c,d),d=void 0,a=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(r,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,h=void 0,s=[0,0,0,0],o=[0,r+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(r,0,[["enter",d,t]])),i=m.type==="tableDelimiterRow"?2:d?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],h=Fl(f,t,s,i,void 0,h),s=[0,0,0,0]),o[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],h=Fl(f,t,s,i,void 0,h)),s=o,o=[s[1],r,0,0])):m.type==="tableHead"?(l=!0,a=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(a=r,s[1]!==0?(o[0]=o[1],h=Fl(f,t,s,i,r,h)):o[1]!==0&&(h=Fl(f,t,o,i,r,h)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(a!==0&&Wg(f,t,a,c,d),f.consume(t.events),r=-1;++r<t.events.length;){const p=t.events[r];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=w3(t.events,r))}return e}function Fl(e,t,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(s.end=Object.assign({},ns(t.events,r[0])),e.add(r[0],0,[["exit",s,t]]));const a=ns(t.events,r[1]);if(s={type:o,start:Object.assign({},a),end:Object.assign({},a)},e.add(r[1],0,[["enter",s,t]]),r[2]!==0){const c=ns(t.events,r[2]),d=ns(t.events,r[3]),h={type:l,start:Object.assign({},c),end:Object.assign({},d)};if(e.add(r[2],0,[["enter",h,t]]),n!==2){const f=t.events[r[2]],p=t.events[r[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",r[3]>r[2]+1){const m=r[2]+1,g=r[3]-r[2]-1;e.add(m,g,[])}}e.add(r[3]+1,0,[["exit",h,t]])}return i!==void 0&&(s.end=Object.assign({},ns(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Wg(e,t,r,n,i){const s=[],o=ns(t.events,r);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),n.end=Object.assign({},o),s.push(["exit",n,t]),e.add(r+1,0,s)}function ns(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const E3={name:"tasklistCheck",tokenize:T3};function N3(){return{text:{91:E3}}}function T3(e,t,r){const n=this;return i;function i(a){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),s)}function s(a){return Ze(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),o):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),o):r(a)}function o(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):r(a)}function l(a){return Ce(a)?t(a):He(a)?e.check({tokenize:P3},t,r)(a):r(a)}}function P3(e,t,r){return Ke(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function L3(e){return ey([t3(),h3(),x3(e),S3(),N3()])}const R3={};function Hg(e){const t=this,r=e||R3,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(L3(r)),s.push(QT()),o.push(JT(r))}const M3=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,I3=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,D3=({legacyTitle:e=!1,tagName:t="div"}={})=>r=>{Nc(r,"blockquote",(n,i,s)=>{let o="",l="",a=!0,c=n.children.map(d=>{if(a&&d.type==="paragraph"){const h=d.children[0],f=h.type==="text"?h.value:"",p=e?I3:M3,m=f.match(p);if(m&&(a=!1,o=m[1].toLocaleLowerCase(),l=e&&m[2]||o.toLocaleUpperCase(),f.includes(`
|
|
95
|
+
`))}function a(p,m,g,S){const _=g.enter("tableCell"),x=g.enter("phrasing"),w=g.containerPhrasing(p,{...S,before:s,after:s});return x(),_(),w}function c(p,m){return o3(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function d(p,m,g){const S=p.children;let _=-1;const x=[],w=m.enter("table");for(;++_<S.length;)x[_]=h(S[_],m,g);return w(),x}function h(p,m,g){const S=p.children;let _=-1;const x=[],w=m.enter("tableRow");for(;++_<S.length;)x[_]=a(S[_],p,m,g);return w(),x}function f(p,m,g){let S=By.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function q3(){return{exit:{taskListCheckValueChecked:Fg,taskListCheckValueUnchecked:Fg,paragraph:X3}}}function Y3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:G3}}}function Fg(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function X3(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const l=i[s];if(l.type==="paragraph"){o=l;break}}o===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function G3(e,t,r,n){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=r.createTracker(n);s&&l.move(o);let a=By.listItem(e,t,r,{...n,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(d){return d+o}}function Q3(){return[TN(),GN(),e3(),$3(),q3()]}function J3(e){return{extensions:[LN(),QN(e),t3(),K3(e),Y3()]}}const Z3={tokenize:sP,partial:!0},Oy={tokenize:oP,partial:!0},zy={tokenize:lP,partial:!0},$y={tokenize:aP,partial:!0},eP={tokenize:cP,partial:!0},Fy={name:"wwwAutolink",tokenize:nP,previous:Hy},Wy={name:"protocolAutolink",tokenize:iP,previous:Uy},jn={name:"emailAutolink",tokenize:rP,previous:Vy},gn={};function tP(){return{text:gn}}let yi=48;for(;yi<123;)gn[yi]=jn,yi++,yi===58?yi=65:yi===91&&(yi=97);gn[43]=jn;gn[45]=jn;gn[46]=jn;gn[95]=jn;gn[72]=[jn,Wy];gn[104]=[jn,Wy];gn[87]=[jn,Fy];gn[119]=[jn,Fy];function rP(e,t,r){const n=this;let i,s;return o;function o(h){return!Jh(h)||!Vy.call(n,n.previous)||ep(n.events)?r(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(h))}function l(h){return Jh(h)?(e.consume(h),l):h===64?(e.consume(h),a):r(h)}function a(h){return h===46?e.check(eP,d,c)(h):h===45||h===95||Gt(h)?(s=!0,e.consume(h),a):d(h)}function c(h){return e.consume(h),i=!0,a}function d(h){return s&&i&&rr(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):r(h)}}function nP(e,t,r){const n=this;return i;function i(o){return o!==87&&o!==119||!Hy.call(n,n.previous)||ep(n.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Z3,e.attempt(Oy,e.attempt(zy,s),r),r)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function iP(e,t,r){const n=this;let i="",s=!1;return o;function o(h){return(h===72||h===104)&&Uy.call(n,n.previous)&&!ep(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),l):r(h)}function l(h){if(rr(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),l;if(h===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(h),a}return r(h)}function a(h){return h===47?(e.consume(h),s?c:(s=!0,a)):r(h)}function c(h){return h===null||Va(h)||Ze(h)||Ui(h)||wc(h)?r(h):e.attempt(Oy,e.attempt(zy,d),r)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function sP(e,t,r){let n=0;return i;function i(o){return(o===87||o===119)&&n<3?(n++,e.consume(o),i):o===46&&n===3?(e.consume(o),s):r(o)}function s(o){return o===null?r(o):t(o)}}function oP(e,t,r){let n,i,s;return o;function o(c){return c===46||c===95?e.check($y,a,l)(c):c===null||Ze(c)||Ui(c)||c!==45&&wc(c)?a(c):(s=!0,e.consume(c),o)}function l(c){return c===95?n=!0:(i=n,n=void 0),e.consume(c),o}function a(c){return i||n||!s?r(c):t(c)}}function lP(e,t){let r=0,n=0;return i;function i(o){return o===40?(r++,e.consume(o),i):o===41&&n<r?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check($y,t,s)(o):o===null||Ze(o)||Ui(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&n++,e.consume(o),i}}function aP(e,t,r){return n;function n(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),n):l===38?(e.consume(l),s):l===93?(e.consume(l),i):l===60||l===null||Ze(l)||Ui(l)?t(l):r(l)}function i(l){return l===null||l===40||l===91||Ze(l)||Ui(l)?t(l):n(l)}function s(l){return rr(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),n):rr(l)?(e.consume(l),o):r(l)}}function cP(e,t,r){return n;function n(s){return e.consume(s),i}function i(s){return Gt(s)?r(s):t(s)}}function Hy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ze(e)}function Uy(e){return!rr(e)}function Vy(e){return!(e===47||Jh(e))}function Jh(e){return e===43||e===45||e===46||e===95||Gt(e)}function ep(e){let t=e.length,r=!1;for(;t--;){const n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const uP={tokenize:vP,partial:!0};function hP(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:mP,continuation:{tokenize:gP},exit:_P}},text:{91:{name:"gfmFootnoteCall",tokenize:pP},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:dP,resolveTo:fP}}}}function dP(e,t,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const a=n.events[i][1];if(a.type==="labelImage"){o=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return l;function l(a){if(!o||!o._balanced)return r(a);const c=en(n.sliceSerialize({start:o.end,end:n.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?r(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function fP(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...l),e}function pP(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return l;function l(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),a}function a(h){return h!==94?r(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(h){if(s>999||h===93&&!o||h===null||h===91||Ze(h))return r(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(en(n.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(h)}return Ze(h)||(o=!0),s++,e.consume(h),h===92?d:c}function d(h){return h===91||h===92||h===93?(e.consume(h),s++,c):c(h)}}function mP(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,l;return a;function a(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):r(m)}function d(m){if(o>999||m===93&&!l||m===null||m===91||Ze(m))return r(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=en(n.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ze(m)||(l=!0),o++,e.consume(m),m===92?h:d}function h(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),Ke(e,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return t(m)}}function gP(e,t,r){return e.check(ml,t,e.attempt(uP,t,r))}function _P(e){e.exit("gfmFootnoteDefinition")}function vP(e,t,r){const n=this;return Ke(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):r(s)}}function xP(e){let r=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(o,l){let a=-1;for(;++a<o.length;)if(o[a][0]==="enter"&&o[a][1].type==="strikethroughSequenceTemporary"&&o[a][1]._close){let c=a;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[a][1].end.offset-o[a][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[a][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[a][1].end)},h={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[a][1].start)},f=[["enter",d,l],["enter",o[c][1],l],["exit",o[c][1],l],["enter",h,l]],p=l.parser.constructs.insideSpan.null;p&&Pr(f,f.length,0,Sc(p,o.slice(c+1,a),l)),Pr(f,f.length,0,[["exit",h,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",d,l]]),Pr(o,c-1,a-c+3,f),a=c+f.length-2;break}}for(a=-1;++a<o.length;)o[a][1].type==="strikethroughSequenceTemporary"&&(o[a][1].type="data");return o}function s(o,l,a){const c=this.previous,d=this.events;let h=0;return f;function f(m){return c===126&&d[d.length-1][1].type!=="characterEscape"?a(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const g=Ms(c);if(m===126)return h>1?a(m):(o.consume(m),h++,p);if(h<2&&!r)return a(m);const S=o.exit("strikethroughSequenceTemporary"),_=Ms(m);return S._open=!_||_===2&&!!g,S._close=!g||g===2&&!!_,l(m)}}}class yP{constructor(){this.map=[]}add(t,r,n){bP(this,t,r,n)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];n.push(t.slice()),t.length=0;let i=n.pop();for(;i;){for(const s of i)t.push(s);i=n.pop()}this.map.length=0}}function bP(e,t,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=r,e.map[i][2].push(...n);return}i+=1}e.map.push([t,r,n])}}function wP(e,t){let r=!1;const n=[];for(;t<e.length;){const i=e[t];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=n.length-1;n[s]=n[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return n}function SP(){return{flow:{null:{name:"table",tokenize:kP,resolveAll:CP}}}}function kP(e,t,r){const n=this;let i=0,s=0,o;return l;function l(E){let A=n.events.length-1;for(;A>-1;){const $=n.events[A][1].type;if($==="lineEnding"||$==="linePrefix")A--;else break}const R=A>-1?n.events[A][1].type:null,T=R==="tableHead"||R==="tableRow"?C:a;return T===C&&n.parser.lazy[n.now().line]?r(E):T(E)}function a(E){return e.enter("tableHead"),e.enter("tableRow"),c(E)}function c(E){return E===124||(o=!0,s+=1),d(E)}function d(E){return E===null?r(E):Ce(E)?s>1?(s=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):r(E):He(E)?Ke(e,d,"whitespace")(E):(s+=1,o&&(o=!1,i+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(E)))}function h(E){return E===null||E===124||Ze(E)?(e.exit("data"),d(E)):(e.consume(E),E===92?f:h)}function f(E){return E===92||E===124?(e.consume(E),h):h(E)}function p(E){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(E):(e.enter("tableDelimiterRow"),o=!1,He(E)?Ke(e,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):m(E))}function m(E){return E===45||E===58?S(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),g):L(E)}function g(E){return He(E)?Ke(e,S,"whitespace")(E):S(E)}function S(E){return E===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),_):E===45?(s+=1,_(E)):E===null||Ce(E)?N(E):L(E)}function _(E){return E===45?(e.enter("tableDelimiterFiller"),x(E)):L(E)}function x(E){return E===45?(e.consume(E),x):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(E))}function w(E){return He(E)?Ke(e,N,"whitespace")(E):N(E)}function N(E){return E===124?m(E):E===null||Ce(E)?!o||i!==s?L(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):L(E)}function L(E){return r(E)}function C(E){return e.enter("tableRow"),F(E)}function F(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),F):E===null||Ce(E)?(e.exit("tableRow"),t(E)):He(E)?Ke(e,F,"whitespace")(E):(e.enter("data"),P(E))}function P(E){return E===null||E===124||Ze(E)?(e.exit("data"),F(E)):(e.consume(E),E===92?q:P)}function q(E){return E===92||E===124?(e.consume(E),P):P(E)}}function CP(e,t){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,a=0,c,d,h;const f=new yP;for(;++r<e.length;){const p=e[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(l=!1,a!==0&&(Wg(f,t,a,c,d),d=void 0,a=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(r,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,h=void 0,s=[0,0,0,0],o=[0,r+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(r,0,[["enter",d,t]])),i=m.type==="tableDelimiterRow"?2:d?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],h=Fl(f,t,s,i,void 0,h),s=[0,0,0,0]),o[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],h=Fl(f,t,s,i,void 0,h)),s=o,o=[s[1],r,0,0])):m.type==="tableHead"?(l=!0,a=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(a=r,s[1]!==0?(o[0]=o[1],h=Fl(f,t,s,i,r,h)):o[1]!==0&&(h=Fl(f,t,o,i,r,h)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(a!==0&&Wg(f,t,a,c,d),f.consume(t.events),r=-1;++r<t.events.length;){const p=t.events[r];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=wP(t.events,r))}return e}function Fl(e,t,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(s.end=Object.assign({},ns(t.events,r[0])),e.add(r[0],0,[["exit",s,t]]));const a=ns(t.events,r[1]);if(s={type:o,start:Object.assign({},a),end:Object.assign({},a)},e.add(r[1],0,[["enter",s,t]]),r[2]!==0){const c=ns(t.events,r[2]),d=ns(t.events,r[3]),h={type:l,start:Object.assign({},c),end:Object.assign({},d)};if(e.add(r[2],0,[["enter",h,t]]),n!==2){const f=t.events[r[2]],p=t.events[r[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",r[3]>r[2]+1){const m=r[2]+1,g=r[3]-r[2]-1;e.add(m,g,[])}}e.add(r[3]+1,0,[["exit",h,t]])}return i!==void 0&&(s.end=Object.assign({},ns(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Wg(e,t,r,n,i){const s=[],o=ns(t.events,r);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),n.end=Object.assign({},o),s.push(["exit",n,t]),e.add(r+1,0,s)}function ns(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const EP={name:"tasklistCheck",tokenize:PP};function NP(){return{text:{91:EP}}}function PP(e,t,r){const n=this;return i;function i(a){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),s)}function s(a){return Ze(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),o):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),o):r(a)}function o(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):r(a)}function l(a){return Ce(a)?t(a):He(a)?e.check({tokenize:TP},t,r)(a):r(a)}}function TP(e,t,r){return Ke(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function LP(e){return ey([tP(),hP(),xP(e),SP(),NP()])}const RP={};function Hg(e){const t=this,r=e||RP,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(LP(r)),s.push(Q3()),o.push(J3(r))}const MP=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,IP=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,DP=({legacyTitle:e=!1,tagName:t="div"}={})=>r=>{Nc(r,"blockquote",(n,i,s)=>{let o="",l="",a=!0,c=n.children.map(d=>{if(a&&d.type==="paragraph"){const h=d.children[0],f=h.type==="text"?h.value:"",p=e?IP:MP,m=f.match(p);if(m&&(a=!1,o=m[1].toLocaleLowerCase(),l=e&&m[2]||o.toLocaleUpperCase(),f.includes(`
|
|
96
96
|
`)&&(d.children[0]={type:"text",value:f.replace(p,"").replace(/^\n+/,"")}),!f.includes(`
|
|
97
|
-
`))){const g=[];d.children.forEach((S,_)=>{_!=0&&(_==1&&S.type==="break"||g.push(S))}),d.children=[...g]}}return d});o&&(n.data={hName:t,hProperties:{className:["markdown-alert",`markdown-alert-${o}`],dir:"auto"}},c.unshift({type:"paragraph",children:[j3(o),{type:"text",value:l.replace(/^\//,"")}],data:{hProperties:{className:"markdown-alert-title",dir:"auto"}}})),n.children=[...c]})};function j3(e){let t=A3[e]??"";return{type:"emphasis",data:{hName:"svg",hProperties:{className:["octicon"],viewBox:"0 0 16 16",width:"16",height:"16",ariaHidden:"true"}},children:[{type:"emphasis",data:{hName:"path",hProperties:{d:t}},children:[]}]}}const A3={note:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z",tip:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z",important:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",warning:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",caution:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"};function B3(e){wy(e,[/\r?\n|\r/g,O3])}function O3(){return{type:"break"}}function z3(){return function(e){B3(e)}}const lt={size:18};function $3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}function F3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2"}),u.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2"}),u.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor",stroke:"none"}),u.jsx("line",{x1:"10",y1:"6",x2:"18",y2:"6"}),u.jsx("line",{x1:"10",y1:"18",x2:"18",y2:"18"})]})}function W3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),u.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}),u.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),u.jsx("line",{x1:"8",y1:"14",x2:"14",y2:"14"}),u.jsx("line",{x1:"8",y1:"18",x2:"12",y2:"18"})]})}function Ky({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.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-4 0v-.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-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.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 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.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 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function H3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),u.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}function Xa({size:e=lt.size,className:t}){return u.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:u.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function Ro({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),u.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),u.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function U3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("polyline",{points:"14 2 14 8 20 8"}),u.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),u.jsx("line",{x1:"8",y1:"17",x2:"13",y2:"17"})]})}function V3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("circle",{cx:"11",cy:"11",r:"8"}),u.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function Mo({size:e=lt.size,className:t}){return u.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:u.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function K3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("polyline",{points:"23 4 23 10 17 10"}),u.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})}function qy({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),u.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),u.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function Yy({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M12 22v-5"}),u.jsx("path",{d:"M9 8V2"}),u.jsx("path",{d:"M15 8V2"}),u.jsx("path",{d:"M18 8v5a6 6 0 0 1-12 0V8z"})]})}function q3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),u.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Ug({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function Y3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),u.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),u.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})}function X3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("polyline",{points:"4 17 10 11 4 5"}),u.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function G3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),u.jsx("path",{d:"M12 15l-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),u.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),u.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]})}function Q3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"3",y:"8",width:"18",height:"12",rx:"2"}),u.jsx("path",{d:"M12 2v6"}),u.jsx("circle",{cx:"8.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"15.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"})]})}function J3({size:e=lt.size,className:t}){return u.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:u.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"})})}function Z3({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"9",y:"10",width:"6",height:"12",rx:"1"}),u.jsx("path",{d:"M12 2c-1.5 2-3 3.5-3 5a3 3 0 0 0 6 0c0-1.5-1.5-3-3-5z"})]})}function eP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("circle",{cx:"12",cy:"12",r:"5"}),u.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),u.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),u.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),u.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),u.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),u.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),u.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),u.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})}function tP({size:e=lt.size,className:t}){return u.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:u.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function rP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),u.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),u.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function nP(e){const r=e.split(`
|
|
97
|
+
`))){const g=[];d.children.forEach((S,_)=>{_!=0&&(_==1&&S.type==="break"||g.push(S))}),d.children=[...g]}}return d});o&&(n.data={hName:t,hProperties:{className:["markdown-alert",`markdown-alert-${o}`],dir:"auto"}},c.unshift({type:"paragraph",children:[jP(o),{type:"text",value:l.replace(/^\//,"")}],data:{hProperties:{className:"markdown-alert-title",dir:"auto"}}})),n.children=[...c]})};function jP(e){let t=AP[e]??"";return{type:"emphasis",data:{hName:"svg",hProperties:{className:["octicon"],viewBox:"0 0 16 16",width:"16",height:"16",ariaHidden:"true"}},children:[{type:"emphasis",data:{hName:"path",hProperties:{d:t}},children:[]}]}}const AP={note:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z",tip:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z",important:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",warning:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",caution:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"};function BP(e){wy(e,[/\r?\n|\r/g,OP])}function OP(){return{type:"break"}}function zP(){return function(e){BP(e)}}const lt={size:18};function $P({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}function FP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2"}),u.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2"}),u.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor",stroke:"none"}),u.jsx("line",{x1:"10",y1:"6",x2:"18",y2:"6"}),u.jsx("line",{x1:"10",y1:"18",x2:"18",y2:"18"})]})}function WP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),u.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}),u.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),u.jsx("line",{x1:"8",y1:"14",x2:"14",y2:"14"}),u.jsx("line",{x1:"8",y1:"18",x2:"12",y2:"18"})]})}function Ky({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.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-4 0v-.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-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.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 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.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 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function HP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),u.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}function Xa({size:e=lt.size,className:t}){return u.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:u.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function Ro({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),u.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),u.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function UP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("polyline",{points:"14 2 14 8 20 8"}),u.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),u.jsx("line",{x1:"8",y1:"17",x2:"13",y2:"17"})]})}function VP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("circle",{cx:"11",cy:"11",r:"8"}),u.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function Mo({size:e=lt.size,className:t}){return u.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:u.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function KP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("polyline",{points:"23 4 23 10 17 10"}),u.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})}function qy({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),u.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),u.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function Yy({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M12 22v-5"}),u.jsx("path",{d:"M9 8V2"}),u.jsx("path",{d:"M15 8V2"}),u.jsx("path",{d:"M18 8v5a6 6 0 0 1-12 0V8z"})]})}function qP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),u.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Ug({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("circle",{cx:"12",cy:"12",r:"10"}),u.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function YP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),u.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),u.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})}function XP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("polyline",{points:"4 17 10 11 4 5"}),u.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function GP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),u.jsx("path",{d:"M12 15l-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),u.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),u.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]})}function QP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"3",y:"8",width:"18",height:"12",rx:"2"}),u.jsx("path",{d:"M12 2v6"}),u.jsx("circle",{cx:"8.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"15.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"})]})}function JP({size:e=lt.size,className:t}){return u.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:u.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"})})}function ZP({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"9",y:"10",width:"6",height:"12",rx:"1"}),u.jsx("path",{d:"M12 2c-1.5 2-3 3.5-3 5a3 3 0 0 0 6 0c0-1.5-1.5-3-3-5z"})]})}function eT({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("circle",{cx:"12",cy:"12",r:"5"}),u.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),u.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),u.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),u.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),u.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),u.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),u.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),u.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})}function tT({size:e=lt.size,className:t}){return u.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:u.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function rT({size:e=lt.size,className:t}){return u.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[u.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),u.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),u.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function nT(e){const r=e.split(`
|
|
98
98
|
`).map(l=>{if(!l.includes("\r"))return l;const a=l.split("\r").map(h=>h.trim()).filter(Boolean);if(a.length===0)return"";const c=a.filter(h=>h.startsWith("⏺"));if(c.length>0)return c[c.length-1];const d=a.filter(h=>!(/^[❯›>]\s*$/.test(h)||/^[^a-zA-Z0-9\s]\s*\S+[…\.]{1,3}\s*$/.test(h)&&h.length<40||/^[╭╰│├╮╯─═]+$/.test(h)));return d.length>0?d[d.length-1]:a[a.length-1]}).join(`
|
|
99
99
|
`).split(`
|
|
100
100
|
`),n={},i=[];let s=!1;for(const l of r){const a=l.trim();if(a===""){s=!1,i.push("");continue}if(/^❯\s*$/.test(a)||/^>\s*$/.test(a)||/^[✡-✩✪-✿⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◆◇◐◑◒◓]\s*\S+[…\.]{1,3}\s*$/.test(a)||/^◐\s/.test(a)||/\/effort/.test(a)||/^⎿\s+(Tip|Note|Hint):/.test(a)||/^\?\s*(for\s*shortcuts|shortcuts)/.test(a)||/esc\s+to\s+interrupt|shift\+tab\s+to\s+cycle|accept\s+edits\s+on/i.test(a)||/Brewing[…\.]{0,3}\s*\d*$/i.test(a)||/^[✢✳✶✻⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◆◇✦\s]+$/.test(a)||/^Auto-updating/i.test(a))continue;if(/^[⏺●·⏵]/.test(l)){const d=l.match(/^[⏺●·]\s*([A-Za-z][A-Za-z0-9_]*)\s*[\(\[]/);if(d)n[d[1]]=(n[d[1]]||0)+1;else{const h=l.replace(/^[⏺●·⏵]\s*/,"").trim().slice(0,40);h&&(n[h]=(n[h]||0)+1)}s=!0;continue}if(/^[\s]*[╭╰│├╮╯]/.test(l)||/^[╭╰│├╮╯─]+/.test(a)||/^\s+[⊙✓✗○◎▸►✦]/.test(l)||s&&/^\s{2,}/.test(l))continue;s=!1;const c=l.replace(/^❯\s+/,"");i.push(c)}const o=i.join(`
|
|
101
101
|
`).replace(/\n{3,}/g,`
|
|
102
102
|
|
|
103
|
-
`).trim();return{toolCounts:n,textContent:o,hasTools:Object.keys(n).length>0}}function Su(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const Xy=b.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",userName:i,isCliMode:s=!1,isWorking:o=!1,contextKey:l="",receivedAtMap:a={},emptyState:c,onLoadMore:d,isLoadingMore:h,hasMoreHistory:f},p){var z;const m=b.useRef(null),g=b.useRef(null),S=b.useRef(0),_=b.useRef(""),x=b.useRef(!1),[w,N]=b.useState(new Set),[L,C]=b.useState(new Set),F=b.useRef(!1),
|
|
104
|
-
`);if(
|
|
105
|
-
`)[0].slice(0,80)})]},`msg-${I}`);if(
|
|
103
|
+
`).trim();return{toolCounts:n,textContent:o,hasTools:Object.keys(n).length>0}}function Su(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const Xy=b.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",userName:i,isCliMode:s=!1,isWorking:o=!1,contextKey:l="",receivedAtMap:a={},emptyState:c,onLoadMore:d,isLoadingMore:h,hasMoreHistory:f},p){var z;const m=b.useRef(null),g=b.useRef(null),S=b.useRef(0),_=b.useRef(""),x=b.useRef(!1),[w,N]=b.useState(new Set),[L,C]=b.useState(new Set),F=b.useRef(!1),P=()=>{const D=m.current;return D?D.scrollHeight-D.scrollTop-D.clientHeight<200:!0},q=t.length>0?`${t.length}:${(((z=t[t.length-1])==null?void 0:z.content)||"").length}`:"0:0";b.useEffect(()=>{var W,y;const D=!x.current,H=_.current!==l;if(_.current=l,D||H){x.current=!0,F.current=!1;const J=()=>{var ae;(ae=g.current)==null||ae.scrollIntoView({behavior:"instant"})};requestAnimationFrame(()=>requestAnimationFrame(J)),setTimeout(J,100),setTimeout(J,300),S.current=t.length;return}t.length>S.current?F.current||(W=g.current)==null||W.scrollIntoView({behavior:"instant"}):P()&&!F.current&&((y=g.current)==null||y.scrollIntoView({behavior:"instant"})),S.current=t.length},[q,l,o]),b.useImperativeHandle(p,()=>({scrollToBottom:(D="smooth")=>{var H;(H=g.current)==null||H.scrollIntoView({behavior:D})}})),b.useEffect(()=>{const D=m.current;if(!D)return;let H;const I=()=>{clearTimeout(H),H=setTimeout(()=>{F.current=!P()},50)};return D.addEventListener("scroll",I,{passive:!0}),()=>{D.removeEventListener("scroll",I),clearTimeout(H)}},[]);const E=b.useRef(!1),A=b.useRef(0),R=b.useRef(!1);b.useEffect(()=>{const D=m.current;if(!D||!R.current||A.current===0)return;const I=D.scrollHeight-A.current;I>0&&(D.scrollTop=I),A.current=0,R.current=!1},[t.length]),b.useEffect(()=>{const D=m.current;if(!D||!d)return;const H=()=>{D.scrollTop<60&&f&&!h&&!E.current&&(E.current=!0,A.current=D.scrollHeight,d(),setTimeout(()=>{E.current=!1},1500))};return D.addEventListener("scroll",H,{passive:!0}),()=>D.removeEventListener("scroll",H)},[d,f,h]);const T=(()=>{const D=t.map((y,J)=>({type:"message",data:y,index:J,ts:y.receivedAt||a[y.id??`i-${J}`]||0}));if(!r||r.length===0)return D;const H=[...r].sort((y,J)=>y.timestamp-J.timestamp).map((y,J)=>({type:"action",data:y,index:J,ts:y.timestamp})),I=[];let W=0;for(const y of D){for(;W<H.length&&y.ts>0&&H[W].ts<y.ts;)I.push(H[W++]);I.push(y)}for(;W<H.length;)I.push(H[W++]);return I})(),$=700;return u.jsxs("div",{ref:m,"data-chat-scroll":!0,className:"flex-1 min-h-0 overflow-y-auto px-5 py-6 flex flex-col gap-4 bg-bg-primary",children:[h&&u.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60",children:"⏳ Loading older messages..."}),f&&!h&&u.jsx("div",{className:"text-center py-2",children:u.jsx("button",{onClick:d,className:"bg-transparent border border-border-subtle text-text-muted text-[11px] rounded-xl px-4 py-1 cursor-pointer opacity-70",children:"↑ Load older messages"})}),T.length===0&&!f&&(c||u.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),T.map(D=>{var Ie;if(D.type==="action"){const G=D.data;return u.jsxs("div",{className:"self-center max-w-[80%] bg-indigo-500/[0.08] text-accent px-3.5 py-1.5 rounded-[20px] text-xs text-center border border-indigo-500/15 opacity-85",children:[u.jsx(jg,{remarkPlugins:[Hg],children:G.text}),u.jsx("span",{className:"text-[10px] opacity-50 ml-2",children:Su(G.timestamp)})]},`action-${D.index}`)}const H=D.data,I=D.index,W=(H.role||"").toLowerCase(),y=W==="user"||W==="human",J=H.kind||(W==="tool"?"tool":"standard"),ae=H.receivedAt||a[H.id??`i-${I}`],k=`${l}-${I}`,we=w.has(k),U=L.has(k),Y=typeof H.content=="string"?H.content:(H.content||[]).map(G=>G.text||"").join(`
|
|
104
|
+
`);if(J==="thought"){const G=((Ie=H.meta)==null?void 0:Ie.label)||"Thought";return u.jsxs("div",{className:"self-start max-w-[88%] min-w-0 rounded-lg flex-shrink-0 bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-border-subtle",children:[u.jsx("span",{className:"text-[11px] text-indigo-400",children:u.jsx(JP,{size:13})}),u.jsx("span",{className:"text-[11px] text-indigo-400 font-medium",children:G})]}),u.jsx("div",{className:"px-3 py-2 text-xs text-text-muted italic leading-relaxed opacity-75",style:{maxHeight:200,overflowY:"auto",whiteSpace:"pre-wrap"},children:Y})]},`msg-${I}`)}if(J==="tool")return u.jsxs("div",{className:"self-start max-w-[88%] min-w-0 flex items-center gap-1.5 text-[11px] text-text-muted py-0.5 px-2.5 pl-2 bg-bg-secondary border border-border-subtle rounded-md font-mono flex-shrink-0",children:[u.jsx("span",{className:"text-emerald-500 text-[10px]",children:"⏺"}),u.jsx("span",{className:"text-emerald-500 opacity-80",children:Y.split(`
|
|
105
|
+
`)[0].slice(0,80)})]},`msg-${I}`);if(J==="terminal"){const G=H.meta||{},me=G.isRunning?"⏳":"✅",Re=G.label||"Ran command";return u.jsxs("div",{className:"self-start max-w-[88%] min-w-0 rounded-lg flex-shrink-0 bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-border-subtle",children:[u.jsx("span",{className:"text-[11px]",children:me}),u.jsx("span",{className:"text-[11px] text-emerald-500 font-medium",children:Re})]}),u.jsx("pre",{className:"px-3 py-2 text-[11px] text-text-muted font-mono leading-relaxed m-0",style:{maxHeight:250,overflowY:"auto",overflowX:"hidden",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"anywhere",background:"transparent"},children:Y})]},`msg-${I}`)}if(J==="system")return u.jsx("div",{className:"self-center text-[11px] text-text-muted opacity-60 px-3 py-0.5 rounded-[20px] border border-border-subtle",children:Y.slice(0,100)},`msg-${I}`);const te=!y&&s?nT(Y):null,fe=te?te.textContent:Y,de=te?Object.entries(te.toolCounts):[],Oe=s&&!y&&!we&&fe.length>$,Ve=we?Y:Oe&&!U?fe.slice(0,$):fe;return u.jsxs("div",{className:`max-w-[88%] min-w-0 flex flex-col gap-1 ${y?"self-end":"self-start"}`,children:[de.length>0&&u.jsxs("div",{className:"flex flex-wrap gap-1 items-center mb-0.5",children:[de.map(([G,me])=>u.jsxs("span",{className:"text-[10px] font-mono text-emerald-500 bg-bg-secondary border border-border-subtle rounded px-[7px] py-0.5",children:["⏺ ",G,me>1?` ×${me}`:""]},G)),(te==null?void 0:te.hasTools)&&u.jsx("button",{onClick:()=>N(G=>{const me=new Set(G);return we?me.delete(k):me.add(k),me}),className:"text-[10px] text-text-muted bg-transparent border-none cursor-pointer px-1 py-px opacity-50",children:we?"Collapse":"Original"}),!fe&&ae!=null&&u.jsx("span",{className:"text-[10px] opacity-35 ml-0.5",children:Su(ae)})]}),(fe||y)&&u.jsxs("div",{className:y?"chat-bubble-user":"",style:{background:y?"linear-gradient(135deg, var(--accent-primary), #4f46e5)":"var(--bg-secondary)",color:y?"#fff":"var(--text-primary)",padding:"12px 16px",borderRadius:y?"16px 16px 4px 16px":"16px 16px 16px 4px",fontSize:13,lineHeight:1.65,border:y?"none":"1px solid var(--border-subtle)"},children:[u.jsxs("div",{className:`flex justify-between items-baseline gap-2 ${fe?"mb-1.5":"mb-0"}`,children:[u.jsx("span",{className:"text-[10px] font-bold opacity-60 tracking-wide uppercase",children:y?i||"You":n}),ae!=null&&u.jsx("span",{className:"text-[10px] opacity-45",children:Su(ae)})]}),fe&&u.jsx("div",{className:"chat-markdown",children:u.jsx(jg,{remarkPlugins:[Hg,DP,zP],children:Ve})}),Oe&&u.jsx("button",{onClick:()=>C(G=>{const me=new Set(G);return U?me.delete(k):me.add(k),me}),className:"mt-1.5 text-[11px] font-semibold text-[var(--accent-primary)] bg-transparent border-none cursor-pointer p-0 opacity-80",children:U?"Collapse ↑":`Show more (${Math.round(fe.length/100)*100} chars) ↓`})]})]},`msg-${I}`)}),o&&u.jsx("div",{className:"self-start max-w-[90%] bg-bg-secondary rounded-[16px_16px_16px_4px] border border-border-subtle",children:u.jsxs("div",{className:"typing-indicator",children:[u.jsx("div",{className:"dot"}),u.jsx("div",{className:"dot"}),u.jsx("div",{className:"dot"}),u.jsx("span",{className:"text-[11px] text-text-muted ml-1",children:"Agent working..."})]})}),u.jsx("div",{className:"min-h-10",ref:g})]})}),eo={idle:{bg:"rgba(100,116,139,0.15)",text:"#94a3b8",dot:"#64748b",label:"Idle"},streaming:{bg:"rgba(59,130,246,0.15)",text:"#60a5fa",dot:"#3b82f6",label:"Streaming"},waiting_approval:{bg:"rgba(245,158,11,0.15)",text:"#fbbf24",dot:"#f59e0b",label:"Waiting Approval"},error:{bg:"rgba(239,68,68,0.15)",text:"#f87171",dot:"#ef4444",label:"Error"},disconnected:{bg:"rgba(75,85,99,0.15)",text:"#6b7280",dot:"#4b5563",label:"Disconnected"}},ku={cline:"#22d3ee","roo-code":"#a78bfa",continue:"#34d399",copilot:"#60a5fa"};function iT({agentStreams:e,sendCommand:t}){var f,p,m;const[r,n]=b.useState(null),[i,s]=b.useState(""),[o,l]=b.useState(!1);b.useEffect(()=>{!r&&e.length>0&&n(e[0].agentType)},[e,r]);const a=e.find(g=>g.agentType===r),c=b.useCallback(async()=>{if(!(!i.trim()||!r||o)){l(!0);try{await t("agent_stream_send",{agentType:r,text:i.trim()}),s("")}catch(g){console.error("Failed to send agent message",g)}finally{l(!1)}}},[i,r,o,t]),d=b.useCallback(async g=>{if(r)try{await t("agent_stream_resolve",{agentType:r,action:g})}catch(S){console.error("Failed to resolve agent action",S)}},[r,t]),h=b.useCallback(async()=>{if(r)try{await t("agent_stream_new_session",{agentType:r})}catch(g){console.error("Failed to start new session",g)}},[r,t]);return e.length===0?null:u.jsxs("div",{className:"flex flex-col h-full bg-[#0c0e14] rounded-xl overflow-hidden border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-0.5 px-3 pt-2 border-b border-border-subtle bg-white/[0.02] overflow-x-auto",children:[e.map(g=>{const S=g.agentType===r,_=ku[g.agentType]||"#94a3b8",x=eo[g.status]||eo.idle;return u.jsxs("button",{onClick:()=>n(g.agentType),className:`flex items-center gap-2 px-4 py-2 border-none rounded-t-lg text-[13px] whitespace-nowrap cursor-pointer transition-all duration-150 ${S?"bg-white/[0.05] text-text-primary font-semibold":"bg-transparent text-text-muted font-normal"}`,style:{borderBottom:S?`2px solid ${_}`:"2px solid transparent"},children:[u.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:x.dot,boxShadow:g.status==="streaming"?`0 0 6px ${x.dot}`:"none",animation:g.status==="streaming"?"pulse 1.5s infinite":"none"}}),g.agentName,g.status==="waiting_approval"&&u.jsx("span",{className:"text-[10px] px-1.5 py-px rounded bg-yellow-500/20 text-yellow-300 font-semibold",children:"APPROVE"})]},g.agentType)}),u.jsx("div",{className:"flex-1"}),u.jsx("button",{onClick:h,title:"New Chat Session",className:"px-2 py-1 mb-1 border-none bg-white/[0.06] text-text-secondary rounded-md cursor-pointer text-[13px]",children:"+ New"})]}),a?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-1.5 text-[11px] text-text-muted border-b border-border-subtle",children:[u.jsx("span",{className:"px-2 py-0.5 rounded font-semibold text-[10px] tracking-wide uppercase",style:{background:(f=eo[a.status])==null?void 0:f.bg,color:(p=eo[a.status])==null?void 0:p.text},children:((m=eo[a.status])==null?void 0:m.label)||a.status}),a.model&&u.jsxs("span",{className:"text-text-muted",children:["Model: ",u.jsx("span",{className:"text-text-secondary",children:a.model})]}),u.jsx("span",{className:"text-text-muted",children:"|"}),u.jsxs("span",{children:[a.messages.length," messages"]})]}),a.activeModal&&u.jsxs("div",{className:"px-3.5 py-2.5 bg-gradient-to-br from-yellow-500/10 to-orange-600/[0.08] border-b border-yellow-500/20 flex items-center gap-2.5",children:[u.jsx("span",{className:"text-base",children:"⚠️"}),u.jsx("span",{className:"flex-1 text-[13px] text-yellow-300 leading-snug",children:a.activeModal.message||"Action requires approval"}),u.jsx("button",{onClick:()=>d("approve"),className:"px-3.5 py-1 border-none rounded-md bg-green-500 text-white text-xs font-semibold cursor-pointer",children:"Approve"}),u.jsx("button",{onClick:()=>d("reject"),className:"px-3.5 py-1 border-none rounded-md bg-red-500/20 text-red-400 text-xs font-semibold cursor-pointer",children:"Reject"})]}),u.jsx(Xy,{messages:a.messages.map((g,S)=>({role:g.role,content:g.content,kind:g.kind,id:`${a.agentType}-${S}`,receivedAt:g.timestamp})),agentName:a.agentName,isWorking:a.status==="streaming",contextKey:`agent-${a.agentType}`,emptyState:u.jsxs("div",{className:"flex items-center justify-center h-full text-text-muted text-[13px]",children:["No messages yet. Start a conversation with ",a.agentName,"."]})}),u.jsxs("div",{className:"px-3.5 py-2.5 border-t border-border-subtle flex gap-2",children:[u.jsx("input",{type:"text",value:i,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),c())},placeholder:`Message ${a.agentName}...`,disabled:o,className:"flex-1 bg-bg-glass border border-border-default rounded-lg px-3.5 py-2 text-text-primary text-[13px] outline-none"}),u.jsx("button",{onClick:c,disabled:o||!i.trim(),className:"px-4.5 py-2 border-none rounded-lg text-[13px] font-semibold transition-all duration-150",style:{background:i.trim()?`linear-gradient(135deg, ${ku[a.agentType]||"#3b82f6"}, ${ku[a.agentType]||"#3b82f6"}cc)`:"rgba(255,255,255,0.04)",color:i.trim()?"#fff":"#475569",cursor:i.trim()?"pointer":"default"},children:o?"…":"Send"})]})]}):u.jsx("div",{className:"flex-1 flex items-center justify-center text-text-muted text-[13px]",children:"Select an agent tab to view its chat stream."}),u.jsx("style",{children:`
|
|
106
106
|
@keyframes pulse {
|
|
107
107
|
0%, 100% { opacity: 1; }
|
|
108
108
|
50% { opacity: 0.4; }
|
|
@@ -118,21 +118,21 @@ Error generating stack: `+s.message+`
|
|
|
118
118
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
119
119
|
* http://bellard.org/jslinux/
|
|
120
120
|
* Copyright (c) 2011 Fabrice Bellard
|
|
121
|
-
*/var Gy=Object.defineProperty,
|
|
121
|
+
*/var Gy=Object.defineProperty,sT=Object.getOwnPropertyDescriptor,oT=(e,t)=>{for(var r in t)Gy(e,r,{get:t[r],enumerable:!0})},_t=(e,t,r,n)=>{for(var i=n>1?void 0:n?sT(t,r):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Gy(t,r,i),i},ge=(e,t)=>(r,n)=>t(r,n,e),Vg="Terminal input",Zh={get:()=>Vg,set:e=>Vg=e},Kg="Too much output to announce, navigate to rows manually to read",ed={get:()=>Kg,set:e=>Kg=e};function lT(e){return e.replace(/\r?\n/g,"\r")}function aT(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function cT(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function uT(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");Qy(i,t,r,n)}}function Qy(e,t,r,n){e=lT(e),e=aT(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function Jy(e,t,r){let n=r.getBoundingClientRect(),i=e.clientX-n.left-10,s=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function qg(e,t,r,n,i){Jy(e,t,r),i&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function Yn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Pc(e,t=0,r=e.length){let n="";for(let i=t;i<r;++i){let s=e[i];s>65535?(s-=65536,n+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):n+=String.fromCharCode(s)}return n}var hT=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let n=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[n++]=(this._interim-55296)*1024+s-56320+65536:(t[n++]=this._interim,t[n++]=s),this._interim=0}for(let s=i;s<r;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=r)return this._interim=o,n;let l=e.charCodeAt(s);56320<=l&&l<=57343?t[n++]=(o-55296)*1024+l-56320+65536:(t[n++]=o,t[n++]=l);continue}o!==65279&&(t[n++]=o)}return n}},dT=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,i,s,o,l,a=0,c=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)p<<=6,p|=g;let S=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,_=S-m;for(;c<_;){if(c>=r)return 0;if(g=e[c++],(g&192)!==128){c--,f=!0;break}else this.interim[m++]=g,p<<=6,p|=g&63}f||(S===2?p<128?c--:t[n++]=p:S===3?p<2048||p>=55296&&p<=57343||p===65279||(t[n++]=p):p<65536||p>1114111||(t[n++]=p)),this.interim.fill(0)}let d=r-4,h=c;for(;h<r;){for(;h<d&&!((i=e[h])&128)&&!((s=e[h+1])&128)&&!((o=e[h+2])&128)&&!((l=e[h+3])&128);)t[n++]=i,t[n++]=s,t[n++]=o,t[n++]=l,h+=4;if(i=e[h++],i<128)t[n++]=i;else if((i&224)===192){if(h>=r)return this.interim[0]=i,n;if(s=e[h++],(s&192)!==128){h--;continue}if(a=(i&31)<<6|s&63,a<128){h--;continue}t[n++]=a}else if((i&240)===224){if(h>=r)return this.interim[0]=i,n;if(s=e[h++],(s&192)!==128){h--;continue}if(h>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[h++],(o&192)!==128){h--;continue}if(a=(i&15)<<12|(s&63)<<6|o&63,a<2048||a>=55296&&a<=57343||a===65279)continue;t[n++]=a}else if((i&248)===240){if(h>=r)return this.interim[0]=i,n;if(s=e[h++],(s&192)!==128){h--;continue}if(h>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[h++],(o&192)!==128){h--;continue}if(h>=r)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,n;if(l=e[h++],(l&192)!==128){h--;continue}if(a=(i&7)<<18|(s&63)<<12|(o&63)<<6|l&63,a<65536||a>1114111)continue;t[n++]=a}}return n}},Zy="",ei=" ",_l=class e1{constructor(){this.fg=0,this.bg=0,this.extended=new Ga}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new e1;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ga=class t1{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 t1(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Hr=class r1 extends _l{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ga,this.combinedData=""}static fromCharData(t){let r=new r1;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?Yn(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 i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-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()]}},Yg="di$target",td="di$dependencies",Cu=new Map;function fT(e){return e[td]||[]}function $t(e){if(Cu.has(e))return Cu.get(e);let t=function(r,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");pT(t,r,i)};return t._id=e,Cu.set(e,t),t}function pT(e,t,r){t[Yg]===t?t[td].push({id:e,index:r}):(t[td]=[{id:e,index:r}],t[Yg]=t)}var or=$t("BufferService"),n1=$t("CoreMouseService"),Gi=$t("CoreService"),mT=$t("CharsetService"),tp=$t("InstantiationService"),i1=$t("LogService"),lr=$t("OptionsService"),s1=$t("OscLinkService"),gT=$t("UnicodeService"),vl=$t("DecorationService"),rd=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var d;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,s=new Hr,o=r.getTrimmedLength(),l=-1,a=-1,c=!1;for(let h=0;h<o;h++)if(!(a===-1&&!r.hasContent(h))){if(r.loadCell(h,s),s.hasExtendedAttrs()&&s.extended.urlId)if(a===-1){a=h,l=s.extended.urlId;continue}else c=s.extended.urlId!==l;else a!==-1&&(c=!0);if(c||a!==-1&&h===o-1){let f=(d=this._oscLinkService.getLinkData(l))==null?void 0:d.uri;if(f){let p={start:{x:a+1,y:e},end:{x:h+(!c&&h===o-1?1:0),y:e}},m=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let g=new URL(f);["http:","https:"].includes(g.protocol)||(m=!0)}catch{m=!0}m||n.push({text:f,range:p,activate:(g,S)=>i?i.activate(g,S,p):_T(g,S),hover:(g,S)=>{var _;return(_=i==null?void 0:i.hover)==null?void 0:_.call(i,g,S,p)},leave:(g,S)=>{var _;return(_=i==null?void 0:i.leave)==null?void 0:_.call(i,g,S,p)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(a=h,l=s.extended.urlId):(a=-1,l=-1)}}t(n)}};rd=_t([ge(0,or),ge(1,lr),ge(2,s1)],rd);function _T(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
122
122
|
|
|
123
|
-
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
|
|
123
|
+
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 Tc=$t("CharSizeService"),An=$t("CoreBrowserService"),rp=$t("MouseService"),Bn=$t("RenderService"),vT=$t("SelectionService"),o1=$t("CharacterJoinerService"),Fs=$t("ThemeService"),l1=$t("LinkProviderService"),xT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Xg.isErrorNoTelemetry(e)?new Xg(e.message+`
|
|
124
124
|
|
|
125
125
|
`+e.stack):new Error(e.message+`
|
|
126
126
|
|
|
127
|
-
`+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)}},yP=new xP;function ha(e){bP(e)||yP.onUnexpectedError(e)}var nd="Canceled";function bP(e){return e instanceof wP?!0:e instanceof Error&&e.name===nd&&e.message===nd}var wP=class extends Error{constructor(){super(nd),this.name=this.message}};function SP(e){return new Error(`Illegal argument: ${e}`)}var Xg=class id extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof id)return t;let r=new id;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},sd=class a1 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,a1.prototype)}};function wr(e,t=0){return e[e.length-(1+t)]}var kP;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function n(s){return s>0}e.isGreaterThan=n;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(kP||(kP={}));function CP(e,t){let r=this,n=!1,i;return function(){return n||(n=!0,t||(i=e.apply(r,arguments))),i}}var c1;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*i(N){yield N}e.single=i;function s(N){return t(N)?N:i(N)}e.wrap=s;function o(N){return N||r}e.from=o;function*l(N){for(let L=N.length-1;L>=0;L--)yield N[L]}e.reverse=l;function a(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=a;function c(N){return N[Symbol.iterator]().next().value}e.first=c;function d(N,L){let C=0;for(let F of N)if(L(F,C++))return!0;return!1}e.some=d;function h(N,L){for(let C of N)if(L(C))return C}e.find=h;function*f(N,L){for(let C of N)L(C)&&(yield C)}e.filter=f;function*p(N,L){let C=0;for(let F of N)yield L(F,C++)}e.map=p;function*m(N,L){let C=0;for(let F of N)yield*L(F,C++)}e.flatMap=m;function*g(...N){for(let L of N)yield*L}e.concat=g;function S(N,L,C){let F=C;for(let T of N)F=L(F,T);return F}e.reduce=S;function*_(N,L,C=N.length){for(L<0&&(L+=N.length),C<0?C+=N.length:C>N.length&&(C=N.length);L<C;L++)yield N[L]}e.slice=_;function x(N,L=Number.POSITIVE_INFINITY){let C=[];if(L===0)return[C,N];let F=N[Symbol.iterator]();for(let T=0;T<L;T++){let q=F.next();if(q.done)return[C,e.empty()];C.push(q.value)}return[C,{[Symbol.iterator](){return F}}]}e.consume=x;async function w(N){let L=[];for await(let C of N)L.push(C);return Promise.resolve(L)}e.asyncToArray=w})(c1||(c1={}));function Vi(e){if(c1.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 EP(...e){return ot(()=>Vi(e))}function ot(e){return{dispose:CP(()=>{e()})}}var u1=class h1{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{Vi(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?h1.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)}};u1.DISABLE_DISPOSED_WARNING=!1;var ci=u1,Be=class{constructor(){this._store=new ci,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)}};Be.None=Object.freeze({dispose(){}});var Is=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}},Nn=typeof window=="object"?window:globalThis,od=class ld{constructor(t){this.element=t,this.next=ld.Undefined,this.prev=ld.Undefined}};od.Undefined=new od(void 0);var at=od,Gg=class{constructor(){this._first=at.Undefined,this._last=at.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===at.Undefined}clear(){let e=this._first;for(;e!==at.Undefined;){let t=e.next;e.prev=at.Undefined,e.next=at.Undefined,e=t}this._first=at.Undefined,this._last=at.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new at(e);if(this._first===at.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==at.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==at.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==at.Undefined&&e.next!==at.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===at.Undefined&&e.next===at.Undefined?(this._first=at.Undefined,this._last=at.Undefined):e.next===at.Undefined?(this._last=this._last.prev,this._last.next=at.Undefined):e.prev===at.Undefined&&(this._first=this._first.next,this._first.prev=at.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==at.Undefined;)yield e.element,e=e.next}},NP=globalThis.performance&&typeof globalThis.performance.now=="function",TP=class d1{static create(t){return new d1(t)}constructor(t){this._now=NP&&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}},Ht;(e=>{e.None=()=>Be.None;function t(R,P){return h(R,()=>{},0,void 0,!0,void 0,P)}e.defer=t;function r(R){return(P,$=null,z)=>{let D=!1,H;return H=R(I=>{if(!D)return H?H.dispose():D=!0,P.call($,I)},null,z),D&&H.dispose(),H}}e.once=r;function n(R,P,$){return c((z,D=null,H)=>R(I=>z.call(D,P(I)),null,H),$)}e.map=n;function i(R,P,$){return c((z,D=null,H)=>R(I=>{P(I),z.call(D,I)},null,H),$)}e.forEach=i;function s(R,P,$){return c((z,D=null,H)=>R(I=>P(I)&&z.call(D,I),null,H),$)}e.filter=s;function o(R){return R}e.signal=o;function l(...R){return(P,$=null,z)=>{let D=EP(...R.map(H=>H(I=>P.call($,I))));return d(D,z)}}e.any=l;function a(R,P,$,z){let D=$;return n(R,H=>(D=P(D,H),D),z)}e.reduce=a;function c(R,P){let $,z={onWillAddFirstListener(){$=R(D.fire,D)},onDidRemoveLastListener(){$==null||$.dispose()}},D=new se(z);return P==null||P.add(D),D.event}function d(R,P){return P instanceof Array?P.push(R):P&&P.add(R),R}function h(R,P,$=100,z=!1,D=!1,H,I){let W,y,Q,ae=0,k,we={leakWarningThreshold:H,onWillAddFirstListener(){W=R(Y=>{ae++,y=P(y,Y),z&&!Q&&(U.fire(y),y=void 0),k=()=>{let te=y;y=void 0,Q=void 0,(!z||ae>1)&&U.fire(te),ae=0},typeof $=="number"?(clearTimeout(Q),Q=setTimeout(k,$)):Q===void 0&&(Q=0,queueMicrotask(k))})},onWillRemoveListener(){D&&ae>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,W.dispose()}},U=new se(we);return I==null||I.add(U),U.event}e.debounce=h;function f(R,P=0,$){return e.debounce(R,(z,D)=>z?(z.push(D),z):[D],P,void 0,!0,void 0,$)}e.accumulate=f;function p(R,P=(z,D)=>z===D,$){let z=!0,D;return s(R,H=>{let I=z||!P(H,D);return z=!1,D=H,I},$)}e.latch=p;function m(R,P,$){return[e.filter(R,P,$),e.filter(R,z=>!P(z),$)]}e.split=m;function g(R,P=!1,$=[],z){let D=$.slice(),H=R(y=>{D?D.push(y):W.fire(y)});z&&z.add(H);let I=()=>{D==null||D.forEach(y=>W.fire(y)),D=null},W=new se({onWillAddFirstListener(){H||(H=R(y=>W.fire(y)),z&&z.add(H))},onDidAddFirstListener(){D&&(P?setTimeout(I):I())},onDidRemoveLastListener(){H&&H.dispose(),H=null}});return z&&z.add(W),W.event}e.buffer=g;function S(R,P){return($,z,D)=>{let H=P(new x);return R(function(I){let W=H.evaluate(I);W!==_&&$.call(z,W)},void 0,D)}}e.chain=S;let _=Symbol("HaltChainable");class x{constructor(){this.steps=[]}map(P){return this.steps.push(P),this}forEach(P){return this.steps.push($=>(P($),$)),this}filter(P){return this.steps.push($=>P($)?$:_),this}reduce(P,$){let z=$;return this.steps.push(D=>(z=P(z,D),z)),this}latch(P=($,z)=>$===z){let $=!0,z;return this.steps.push(D=>{let H=$||!P(D,z);return $=!1,z=D,H?D:_}),this}evaluate(P){for(let $ of this.steps)if(P=$(P),P===_)break;return P}}function w(R,P,$=z=>z){let z=(...W)=>I.fire($(...W)),D=()=>R.on(P,z),H=()=>R.removeListener(P,z),I=new se({onWillAddFirstListener:D,onDidRemoveLastListener:H});return I.event}e.fromNodeEventEmitter=w;function N(R,P,$=z=>z){let z=(...W)=>I.fire($(...W)),D=()=>R.addEventListener(P,z),H=()=>R.removeEventListener(P,z),I=new se({onWillAddFirstListener:D,onDidRemoveLastListener:H});return I.event}e.fromDOMEventEmitter=N;function L(R){return new Promise(P=>r(R)(P))}e.toPromise=L;function C(R){let P=new se;return R.then($=>{P.fire($)},()=>{P.fire(void 0)}).finally(()=>{P.dispose()}),P.event}e.fromPromise=C;function F(R,P){return R($=>P.fire($))}e.forward=F;function T(R,P,$){return P($),R(z=>P(z))}e.runAndSubscribe=T;class q{constructor(P,$){this._observable=P,this._counter=0,this._hasChanged=!1;let z={onWillAddFirstListener:()=>{P.addObserver(this)},onDidRemoveLastListener:()=>{P.removeObserver(this)}};this.emitter=new se(z),$&&$.add(this.emitter)}beginUpdate(P){this._counter++}handlePossibleChange(P){}handleChange(P,$){this._hasChanged=!0}endUpdate(P){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(R,P){return new q(R,P).emitter.event}e.fromObservable=E;function A(R){return(P,$,z)=>{let D=0,H=!1,I={beginUpdate(){D++},endUpdate(){D--,D===0&&(R.reportChanges(),H&&(H=!1,P.call($)))},handlePossibleChange(){},handleChange(){H=!0}};R.addObserver(I),R.reportChanges();let W={dispose(){R.removeObserver(I)}};return z instanceof ci?z.add(W):Array.isArray(z)&&z.push(W),W}}e.fromObservableLight=A})(Ht||(Ht={}));var ad=class cd{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${cd._idPool++}`,cd.all.add(this)}start(t){this._stopWatch=new TP,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}}};ad.all=new Set,ad._idPool=0;var PP=ad,LP=-1,f1=class p1{constructor(t,r,n=(p1._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 i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(s);let a=new IP(l,s);this._errorHandler(a)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,i]of this._stacks)(!t||r<i)&&(t=[n,i],r=i);return t}};f1._idPool=1;var RP=f1,MP=class m1{constructor(t){this.value=t}static create(){let t=new Error;return new m1(t.stack??"")}print(){console.warn(this.value.split(`
|
|
127
|
+
`+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)}},yT=new xT;function ha(e){bT(e)||yT.onUnexpectedError(e)}var nd="Canceled";function bT(e){return e instanceof wT?!0:e instanceof Error&&e.name===nd&&e.message===nd}var wT=class extends Error{constructor(){super(nd),this.name=this.message}};function ST(e){return new Error(`Illegal argument: ${e}`)}var Xg=class id extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof id)return t;let r=new id;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},sd=class a1 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,a1.prototype)}};function wr(e,t=0){return e[e.length-(1+t)]}var kT;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function n(s){return s>0}e.isGreaterThan=n;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(kT||(kT={}));function CT(e,t){let r=this,n=!1,i;return function(){return n||(n=!0,t||(i=e.apply(r,arguments))),i}}var c1;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*i(N){yield N}e.single=i;function s(N){return t(N)?N:i(N)}e.wrap=s;function o(N){return N||r}e.from=o;function*l(N){for(let L=N.length-1;L>=0;L--)yield N[L]}e.reverse=l;function a(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=a;function c(N){return N[Symbol.iterator]().next().value}e.first=c;function d(N,L){let C=0;for(let F of N)if(L(F,C++))return!0;return!1}e.some=d;function h(N,L){for(let C of N)if(L(C))return C}e.find=h;function*f(N,L){for(let C of N)L(C)&&(yield C)}e.filter=f;function*p(N,L){let C=0;for(let F of N)yield L(F,C++)}e.map=p;function*m(N,L){let C=0;for(let F of N)yield*L(F,C++)}e.flatMap=m;function*g(...N){for(let L of N)yield*L}e.concat=g;function S(N,L,C){let F=C;for(let P of N)F=L(F,P);return F}e.reduce=S;function*_(N,L,C=N.length){for(L<0&&(L+=N.length),C<0?C+=N.length:C>N.length&&(C=N.length);L<C;L++)yield N[L]}e.slice=_;function x(N,L=Number.POSITIVE_INFINITY){let C=[];if(L===0)return[C,N];let F=N[Symbol.iterator]();for(let P=0;P<L;P++){let q=F.next();if(q.done)return[C,e.empty()];C.push(q.value)}return[C,{[Symbol.iterator](){return F}}]}e.consume=x;async function w(N){let L=[];for await(let C of N)L.push(C);return Promise.resolve(L)}e.asyncToArray=w})(c1||(c1={}));function Vi(e){if(c1.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 ET(...e){return ot(()=>Vi(e))}function ot(e){return{dispose:CT(()=>{e()})}}var u1=class h1{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{Vi(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?h1.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)}};u1.DISABLE_DISPOSED_WARNING=!1;var ci=u1,Be=class{constructor(){this._store=new ci,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)}};Be.None=Object.freeze({dispose(){}});var Is=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}},Nn=typeof window=="object"?window:globalThis,od=class ld{constructor(t){this.element=t,this.next=ld.Undefined,this.prev=ld.Undefined}};od.Undefined=new od(void 0);var at=od,Gg=class{constructor(){this._first=at.Undefined,this._last=at.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===at.Undefined}clear(){let e=this._first;for(;e!==at.Undefined;){let t=e.next;e.prev=at.Undefined,e.next=at.Undefined,e=t}this._first=at.Undefined,this._last=at.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new at(e);if(this._first===at.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==at.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==at.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==at.Undefined&&e.next!==at.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===at.Undefined&&e.next===at.Undefined?(this._first=at.Undefined,this._last=at.Undefined):e.next===at.Undefined?(this._last=this._last.prev,this._last.next=at.Undefined):e.prev===at.Undefined&&(this._first=this._first.next,this._first.prev=at.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==at.Undefined;)yield e.element,e=e.next}},NT=globalThis.performance&&typeof globalThis.performance.now=="function",PT=class d1{static create(t){return new d1(t)}constructor(t){this._now=NT&&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}},Ht;(e=>{e.None=()=>Be.None;function t(R,T){return h(R,()=>{},0,void 0,!0,void 0,T)}e.defer=t;function r(R){return(T,$=null,z)=>{let D=!1,H;return H=R(I=>{if(!D)return H?H.dispose():D=!0,T.call($,I)},null,z),D&&H.dispose(),H}}e.once=r;function n(R,T,$){return c((z,D=null,H)=>R(I=>z.call(D,T(I)),null,H),$)}e.map=n;function i(R,T,$){return c((z,D=null,H)=>R(I=>{T(I),z.call(D,I)},null,H),$)}e.forEach=i;function s(R,T,$){return c((z,D=null,H)=>R(I=>T(I)&&z.call(D,I),null,H),$)}e.filter=s;function o(R){return R}e.signal=o;function l(...R){return(T,$=null,z)=>{let D=ET(...R.map(H=>H(I=>T.call($,I))));return d(D,z)}}e.any=l;function a(R,T,$,z){let D=$;return n(R,H=>(D=T(D,H),D),z)}e.reduce=a;function c(R,T){let $,z={onWillAddFirstListener(){$=R(D.fire,D)},onDidRemoveLastListener(){$==null||$.dispose()}},D=new se(z);return T==null||T.add(D),D.event}function d(R,T){return T instanceof Array?T.push(R):T&&T.add(R),R}function h(R,T,$=100,z=!1,D=!1,H,I){let W,y,J,ae=0,k,we={leakWarningThreshold:H,onWillAddFirstListener(){W=R(Y=>{ae++,y=T(y,Y),z&&!J&&(U.fire(y),y=void 0),k=()=>{let te=y;y=void 0,J=void 0,(!z||ae>1)&&U.fire(te),ae=0},typeof $=="number"?(clearTimeout(J),J=setTimeout(k,$)):J===void 0&&(J=0,queueMicrotask(k))})},onWillRemoveListener(){D&&ae>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,W.dispose()}},U=new se(we);return I==null||I.add(U),U.event}e.debounce=h;function f(R,T=0,$){return e.debounce(R,(z,D)=>z?(z.push(D),z):[D],T,void 0,!0,void 0,$)}e.accumulate=f;function p(R,T=(z,D)=>z===D,$){let z=!0,D;return s(R,H=>{let I=z||!T(H,D);return z=!1,D=H,I},$)}e.latch=p;function m(R,T,$){return[e.filter(R,T,$),e.filter(R,z=>!T(z),$)]}e.split=m;function g(R,T=!1,$=[],z){let D=$.slice(),H=R(y=>{D?D.push(y):W.fire(y)});z&&z.add(H);let I=()=>{D==null||D.forEach(y=>W.fire(y)),D=null},W=new se({onWillAddFirstListener(){H||(H=R(y=>W.fire(y)),z&&z.add(H))},onDidAddFirstListener(){D&&(T?setTimeout(I):I())},onDidRemoveLastListener(){H&&H.dispose(),H=null}});return z&&z.add(W),W.event}e.buffer=g;function S(R,T){return($,z,D)=>{let H=T(new x);return R(function(I){let W=H.evaluate(I);W!==_&&$.call(z,W)},void 0,D)}}e.chain=S;let _=Symbol("HaltChainable");class x{constructor(){this.steps=[]}map(T){return this.steps.push(T),this}forEach(T){return this.steps.push($=>(T($),$)),this}filter(T){return this.steps.push($=>T($)?$:_),this}reduce(T,$){let z=$;return this.steps.push(D=>(z=T(z,D),z)),this}latch(T=($,z)=>$===z){let $=!0,z;return this.steps.push(D=>{let H=$||!T(D,z);return $=!1,z=D,H?D:_}),this}evaluate(T){for(let $ of this.steps)if(T=$(T),T===_)break;return T}}function w(R,T,$=z=>z){let z=(...W)=>I.fire($(...W)),D=()=>R.on(T,z),H=()=>R.removeListener(T,z),I=new se({onWillAddFirstListener:D,onDidRemoveLastListener:H});return I.event}e.fromNodeEventEmitter=w;function N(R,T,$=z=>z){let z=(...W)=>I.fire($(...W)),D=()=>R.addEventListener(T,z),H=()=>R.removeEventListener(T,z),I=new se({onWillAddFirstListener:D,onDidRemoveLastListener:H});return I.event}e.fromDOMEventEmitter=N;function L(R){return new Promise(T=>r(R)(T))}e.toPromise=L;function C(R){let T=new se;return R.then($=>{T.fire($)},()=>{T.fire(void 0)}).finally(()=>{T.dispose()}),T.event}e.fromPromise=C;function F(R,T){return R($=>T.fire($))}e.forward=F;function P(R,T,$){return T($),R(z=>T(z))}e.runAndSubscribe=P;class q{constructor(T,$){this._observable=T,this._counter=0,this._hasChanged=!1;let z={onWillAddFirstListener:()=>{T.addObserver(this)},onDidRemoveLastListener:()=>{T.removeObserver(this)}};this.emitter=new se(z),$&&$.add(this.emitter)}beginUpdate(T){this._counter++}handlePossibleChange(T){}handleChange(T,$){this._hasChanged=!0}endUpdate(T){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(R,T){return new q(R,T).emitter.event}e.fromObservable=E;function A(R){return(T,$,z)=>{let D=0,H=!1,I={beginUpdate(){D++},endUpdate(){D--,D===0&&(R.reportChanges(),H&&(H=!1,T.call($)))},handlePossibleChange(){},handleChange(){H=!0}};R.addObserver(I),R.reportChanges();let W={dispose(){R.removeObserver(I)}};return z instanceof ci?z.add(W):Array.isArray(z)&&z.push(W),W}}e.fromObservableLight=A})(Ht||(Ht={}));var ad=class cd{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${cd._idPool++}`,cd.all.add(this)}start(t){this._stopWatch=new PT,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}}};ad.all=new Set,ad._idPool=0;var TT=ad,LT=-1,f1=class p1{constructor(t,r,n=(p1._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 i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(s);let a=new IT(l,s);this._errorHandler(a)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,i]of this._stacks)(!t||r<i)&&(t=[n,i],r=i);return t}};f1._idPool=1;var RT=f1,MT=class m1{constructor(t){this.value=t}static create(){let t=new Error;return new m1(t.stack??"")}print(){console.warn(this.value.split(`
|
|
128
128
|
`).slice(2).join(`
|
|
129
|
-
`))}},IP=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},DP=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},jP=0,Eu=class{constructor(e){this.value=e,this.id=jP++}},AP=2,BP,se=class{constructor(t){var r,n,i,s;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new RP((t==null?void 0:t.onListenerError)??ha,((n=this._options)==null?void 0:n.leakWarningThreshold)??LP):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new PP(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,r,n,i;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||n.call(r),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(t,r,n)=>{var l,a,c,d,h;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let f=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(f);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new DP(`${f}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((l=this._options)==null?void 0:l.onListenerError)||ha)(m),Be.None}if(this._disposed)return Be.None;r&&(t=t.bind(r));let i=new Eu(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=MP.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Eu?(this._deliveryQueue??(this._deliveryQueue=new OP),this._listeners=[this._listeners,i]):this._listeners.push(i):((c=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||c.call(a,this),this._listeners=i,(h=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||h.call(d,this)),this._size++;let o=ot(()=>{s==null||s(),this._removeListener(i)});return n instanceof ci?n.add(o):Array.isArray(n)&&n.push(o),o}),this._event}_removeListener(t){var s,o,l,a;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||a.call(l,this),this._size=0;return}let r=this._listeners,n=r.indexOf(t);if(n===-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--,r[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*AP<=r.length){let c=0;for(let d=0;d<r.length;d++)r[d]?r[c++]=r[d]:i&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=c}}_deliver(t,r){var i;if(!t)return;let n=((i=this._options)==null?void 0:i.onListenerError)||ha;if(!n){t.value(r);return}try{t.value(r)}catch(s){n(s)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,n,i,s;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof Eu)this._deliver(this._listeners,t);else{let o=this._deliveryQueue;o.enqueue(this,t,this._listeners.length),this._deliverQueue(o)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},OP=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}},ud=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new se,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new se,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}};ud.INSTANCE=new ud;var np=ud;function zP(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}np.INSTANCE.onDidChangeZoomLevel;function $P(e){return np.INSTANCE.getZoomFactor(e)}np.INSTANCE.onDidChangeFullscreen;var Ws=typeof navigator=="object"?navigator.userAgent:"",hd=Ws.indexOf("Firefox")>=0,FP=Ws.indexOf("AppleWebKit")>=0,ip=Ws.indexOf("Chrome")>=0,WP=!ip&&Ws.indexOf("Safari")>=0;Ws.indexOf("Electron/")>=0;Ws.indexOf("Android")>=0;var Nu=!1;if(typeof Nn.matchMedia=="function"){let e=Nn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Nn.matchMedia("(display-mode: fullscreen)");Nu=e.matches,zP(Nn,e,({matches:r})=>{Nu&&t.matches||(Nu=r)})}var _s="en",dd=!1,fd=!1,da=!1,g1=!1,Wl,fa=_s,Qg=_s,HP,Yr,Oi=globalThis,Wt,sv;typeof Oi.vscode<"u"&&typeof Oi.vscode.process<"u"?Wt=Oi.vscode.process:typeof process<"u"&&typeof((sv=process==null?void 0:process.versions)==null?void 0:sv.node)=="string"&&(Wt=process);var ov,UP=typeof((ov=Wt==null?void 0:Wt.versions)==null?void 0:ov.electron)=="string",VP=UP&&(Wt==null?void 0:Wt.type)==="renderer",lv;if(typeof Wt=="object"){dd=Wt.platform==="win32",fd=Wt.platform==="darwin",da=Wt.platform==="linux",da&&Wt.env.SNAP&&Wt.env.SNAP_REVISION,Wt.env.CI||Wt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Wl=_s,fa=_s;let e=Wt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Wl=t.userLocale,Qg=t.osLocale,fa=t.resolvedLanguage||_s,HP=(lv=t.languagePack)==null?void 0:lv.translationsConfigFile}catch{}g1=!0}else typeof navigator=="object"&&!VP?(Yr=navigator.userAgent,dd=Yr.indexOf("Windows")>=0,fd=Yr.indexOf("Macintosh")>=0,(Yr.indexOf("Macintosh")>=0||Yr.indexOf("iPad")>=0||Yr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,da=Yr.indexOf("Linux")>=0,(Yr==null?void 0:Yr.indexOf("Mobi"))>=0,fa=globalThis._VSCODE_NLS_LANGUAGE||_s,Wl=navigator.language.toLowerCase(),Qg=Wl):console.error("Unable to resolve platform.");var _1=dd,pn=fd,KP=da,Jg=g1,mn=Yr,Fn=fa,qP;(e=>{function t(){return Fn}e.value=t;function r(){return Fn.length===2?Fn==="en":Fn.length>=3?Fn[0]==="e"&&Fn[1]==="n"&&Fn[2]==="-":!1}e.isDefaultVariant=r;function n(){return Fn==="en"}e.isDefault=n})(qP||(qP={}));var YP=typeof Oi.postMessage=="function"&&!Oi.importScripts;(()=>{if(YP){let e=[];Oi.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,i=e.length;n<i;n++){let s=e[n];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(n,1),s.callback();return}}});let t=0;return r=>{let n=++t;e.push({id:n,callback:r}),Oi.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var XP=!!(mn&&mn.indexOf("Chrome")>=0);mn&&mn.indexOf("Firefox")>=0;!XP&&mn&&mn.indexOf("Safari")>=0;mn&&mn.indexOf("Edg/")>=0;mn&&mn.indexOf("Android")>=0;var ts=typeof navigator=="object"?navigator:{};Jg||document.queryCommandSupported&&document.queryCommandSupported("copy")||ts&&ts.clipboard&&ts.clipboard.writeText,Jg||ts&&ts.clipboard&&ts.clipboard.readText;var sp=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}},Tu=new sp,Zg=new sp,e_=new sp,GP=new Array(230),v1;(e=>{function t(l){return Tu.keyCodeToStr(l)}e.toString=t;function r(l){return Tu.strToKeyCode(l)}e.fromString=r;function n(l){return Zg.keyCodeToStr(l)}e.toUserSettingsUS=n;function i(l){return e_.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return Zg.strToKeyCode(l)||e_.strToKeyCode(l)}e.fromUserSettings=s;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Tu.keyCodeToStr(l)}e.toElectronAccelerator=o})(v1||(v1={}));var QP=class x1{constructor(t,r,n,i,s){this.ctrlKey=t,this.shiftKey=r,this.altKey=n,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof x1&&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",i=this.metaKey?"1":"0";return`K${t}${r}${n}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new JP([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},JP=class{constructor(e){if(e.length===0)throw SP("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 ZP(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return v1.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(hd)switch(t){case 59:return 85;case 60:if(KP)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(pn)return 57;break}else if(FP&&(pn&&t===93||!pn&&t===92))return 57;return GP[t]||0}var e4=pn?256:2048,t4=512,r4=1024,n4=pn?2048:256,t_=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=ZP(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|=e4),this.altKey&&(t|=t4),this.shiftKey&&(t|=r4),this.metaKey&&(t|=n4),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new QP(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},r_=new WeakMap;function i4(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 s4=class{static getSameOriginWindowChain(e){let t=r_.get(e);if(!t){t=[],r_.set(e,t);let r=e,n;do n=i4(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,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(r+=(o==null?void 0:o.scrollY)??0,n+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let l=s.iframeElement.getBoundingClientRect();r+=l.top,n+=l.left}return{top:r,left:n}}},Hl=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=s4.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},n_=class{constructor(e,t=0,r=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let n=!1;if(ip){let s=navigator.userAgent.match(/Chrome\/(\d+)/);n=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,l=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")n?this.deltaY=s.wheelDeltaY/(120*l):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?hd&&!pn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")WP&&_1?this.deltaX=-(s.wheelDeltaX/120):n?this.deltaX=s.wheelDeltaX/(120*l):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?hd&&!pn?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*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},y1=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),o4;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof l4?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ht.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:y1})})(o4||(o4={}));var l4=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?y1:(this._emitter||(this._emitter=new se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},op=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 sd("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new sd("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},a4=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 sd("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=ot(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},c4;(e=>{async function t(n){let i,s=await Promise.all(n.map(o=>o.then(l=>l,l=>{i||(i=l)})));if(typeof i<"u")throw i;return s}e.settled=t;function r(n){return new Promise(async(i,s)=>{try{await n(i,s)}catch(o){s(o)}})}e.withAsyncBody=r})(c4||(c4={}));var i_=class jr{static fromArray(t){return new jr(r=>{r.emitMany(t)})}static fromPromise(t){return new jr(async r=>{r.emitMany(await t)})}static fromPromises(t){return new jr(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new jr(async r=>{await Promise.all(t.map(async n=>{for await(let i of n)r.emitOne(i)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new se,queueMicrotask(async()=>{let n={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(n)),this.resolve()}catch(i){this.reject(i)}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 Ht.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 jr(async n=>{for await(let i of t)n.emitOne(r(i))})}map(t){return jr.map(this,t)}static filter(t,r){return new jr(async n=>{for await(let i of t)r(i)&&n.emitOne(i)})}filter(t){return jr.filter(this,t)}static coalesce(t){return jr.filter(t,r=>!!r)}coalesce(){return jr.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return jr.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())}};i_.EMPTY=i_.fromArray([]);var{getWindow:hn,getWindowId:u4,onDidRegisterWindow:h4}=function(){let e=new Map,t={window:Nn,disposables:new ci};e.set(Nn.vscodeWindowId,t);let r=new se,n=new se,i=new se;function s(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:n.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Be.None;let l=new ci,a={window:o,disposables:l.add(new ci)};return e.set(o.vscodeWindowId,a),l.add(ot(()=>{e.delete(o.vscodeWindowId),n.fire(o)})),l.add(Le(o,Dt.BEFORE_UNLOAD,()=>{i.fire(o)})),r.fire(a),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let l=o;if((c=l==null?void 0:l.ownerDocument)!=null&&c.defaultView)return l.ownerDocument.defaultView.window;let a=o;return a!=null&&a.view?a.view.window:Nn},getDocument(o){return hn(o).document}}}(),d4=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 Le(e,t,r,n){return new d4(e,t,r,n)}var s_=function(e,t,r,n){return Le(e,t,r,n)},lp,f4=class extends a4{constructor(e){super(),this.defaultTarget=e&&hn(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},o_=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){ha(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,n=new Map,i=s=>{r.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),n.set(s,!0);o.length>0;)o.sort(o_.sort),o.shift().execute();n.set(s,!1)};lp=(s,o,l=0)=>{let a=u4(s),c=new o_(o,l),d=e.get(a);return d||(d=[],e.set(a,d)),d.push(c),r.get(a)||(r.set(a,!0),s.requestAnimationFrame(()=>i(a))),c}})();function p4(e){let t=e.getBoundingClientRect(),r=hn(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var Dt={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"},m4=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=ur(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ur(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ur(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ur(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ur(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ur(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ur(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ur(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ur(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ur(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ur(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=ur(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=ur(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ur(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function ur(e){return typeof e=="number"?`${e}px`:e}function Io(e){return new m4(e)}var b1=class{constructor(){this._hooks=new ci,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,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(ot(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=hn(e)}this._hooks.add(Le(s,Dt.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Le(s,Dt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function g4(e,t,r){let n=null,i=null;if(typeof r.value=="function"?(n="value",i=r.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",i=r.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;r[n]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var ln;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ln||(ln={}));var po=class Yt extends Be{constructor(){super(),this.dispatched=!1,this.targets=new Gg,this.ignoreTargets=new Gg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ht.runAndSubscribe(h4,({window:t,disposables:r})=>{r.add(Le(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(Le(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(Le(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Nn,disposables:this._store}))}static addTarget(t){if(!Yt.isTouchDevice())return Be.None;Yt.INSTANCE||(Yt.INSTANCE=new Yt);let r=Yt.INSTANCE.targets.push(t);return ot(r)}static ignoreTarget(t){if(!Yt.isTouchDevice())return Be.None;Yt.INSTANCE||(Yt.INSTANCE=new Yt);let r=Yt.INSTANCE.ignoreTargets.push(t);return ot(r)}static isTouchDevice(){return"ontouchstart"in Nn||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,i=t.targetTouches.length;n<i;n++){let s=t.targetTouches.item(n);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:r,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[r],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(ln.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let n=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=r.changedTouches.length;s<o;s++){let l=r.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let a=this.activeTouches[l.identifier],c=Date.now()-a.initialTimeStamp;if(c<Yt.HOLD_DELAY&&Math.abs(a.initialPageX-wr(a.rollingPageX))<30&&Math.abs(a.initialPageY-wr(a.rollingPageY))<30){let d=this.newGestureEvent(ln.Tap,a.initialTarget);d.pageX=wr(a.rollingPageX),d.pageY=wr(a.rollingPageY),this.dispatchEvent(d)}else if(c>=Yt.HOLD_DELAY&&Math.abs(a.initialPageX-wr(a.rollingPageX))<30&&Math.abs(a.initialPageY-wr(a.rollingPageY))<30){let d=this.newGestureEvent(ln.Contextmenu,a.initialTarget);d.pageX=wr(a.rollingPageX),d.pageY=wr(a.rollingPageY),this.dispatchEvent(d)}else if(i===1){let d=wr(a.rollingPageX),h=wr(a.rollingPageY),f=wr(a.rollingTimestamps)-a.rollingTimestamps[0],p=d-a.rollingPageX[0],m=h-a.rollingPageY[0],g=[...this.targets].filter(S=>a.initialTarget instanceof Node&&S.contains(a.initialTarget));this.inertia(t,g,n,Math.abs(p)/f,p>0?1:-1,d,Math.abs(m)/f,m>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(ln.End,a.initialTarget)),delete this.activeTouches[l.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===ln.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Yt.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===ln.Change||t.type===ln.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 i=0,s=t.initialTarget;for(;s&&s!==n;)i++,s=s.parentElement;r.push([i,n])}r.sort((n,i)=>n[0]-i[0]);for(let[n,i]of r)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,n,i,s,o,l,a,c){this.handle=lp(t,()=>{let d=Date.now(),h=d-n,f=0,p=0,m=!0;i+=Yt.SCROLL_FRICTION*h,l+=Yt.SCROLL_FRICTION*h,i>0&&(m=!1,f=s*i*h),l>0&&(m=!1,p=a*l*h);let g=this.newGestureEvent(ln.Change);g.translationX=f,g.translationY=p,r.forEach(S=>S.dispatchEvent(g)),m||this.inertia(t,r,d,i,s,o+f,l,a,c+p)})}onTouchMove(t){let r=Date.now();for(let n=0,i=t.changedTouches.length;n<i;n++){let s=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],l=this.newGestureEvent(ln.Change,o.initialTarget);l.translationX=s.pageX-wr(o.rollingPageX),l.translationY=s.pageY-wr(o.rollingPageY),l.pageX=s.pageX,l.pageY=s.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};po.SCROLL_FRICTION=-.005,po.HOLD_DELAY=700,po.CLEAR_TAP_COUNT_TIME=400,_t([g4],po,"isTouchDevice",1);var _4=po,ap=class extends Be{onclick(e,t){this._register(Le(e,Dt.CLICK,r=>t(new Hl(hn(e),r))))}onmousedown(e,t){this._register(Le(e,Dt.MOUSE_DOWN,r=>t(new Hl(hn(e),r))))}onmouseover(e,t){this._register(Le(e,Dt.MOUSE_OVER,r=>t(new Hl(hn(e),r))))}onmouseleave(e,t){this._register(Le(e,Dt.MOUSE_LEAVE,r=>t(new Hl(hn(e),r))))}onkeydown(e,t){this._register(Le(e,Dt.KEY_DOWN,r=>t(new t_(r))))}onkeyup(e,t){this._register(Le(e,Dt.KEY_UP,r=>t(new t_(r))))}oninput(e,t){this._register(Le(e,Dt.INPUT,t))}onblur(e,t){this._register(Le(e,Dt.BLUR,t))}onfocus(e,t){this._register(Le(e,Dt.FOCUS,t))}onchange(e,t){this._register(Le(e,Dt.CHANGE,t))}ignoreGesture(e){return _4.ignoreTarget(e)}},l_=11,v4=class extends ap{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=l_+"px",this.domNode.style.height=l_+"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 b1),this._register(s_(this.bgDomNode,Dt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(s_(this.domNode,Dt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new f4),this._pointerdownScheduleRepeatTimer=this._register(new op)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,hn(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()}},x4=class pd{constructor(t,r,n,i,s,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,i=i|0,s=s|0,o=o|0,l=l|0),this.rawScrollLeft=i,this.rawScrollTop=l,r<0&&(r=0),i+r>n&&(i=n-r),i<0&&(i=0),s<0&&(s=0),l+s>o&&(l=o-s),l<0&&(l=0),this.width=r,this.scrollWidth=n,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new pd(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 pd(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,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,a=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:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},y4=class extends Be{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new x4(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 c_(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=c_.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)))}},a_=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function Pu(e,t){let r=t-e;return function(n){return e+r*S4(n)}}function b4(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var c_=class md{constructor(t,r,n,i){this.from=t,this.to=r,this.duration=i,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 i,s;return t<r?(i=t+.75*n,s=r-.75*n):(i=t-.75*n,s=r+.75*n),b4(Pu(t,i),Pu(s,r),.33)}return Pu(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),i=this.scrollTop(r);return new a_(n,i,!1)}return new a_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return md.start(t,r,n)}static start(t,r,n){n=n+10;let i=Date.now()-10;return new md(t,r,i,n)}};function w4(e){return Math.pow(e,3)}function S4(e){return 1-w4(1-e)}var k4=class extends Be{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 op)}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":"")))}},C4=140,w1=class extends ap{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 k4(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new b1),this._shouldRender=!0,this.domNode=Io(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(Le(this.domNode.domNode,Dt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new v4(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=Io(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(Le(this.slider.domNode,Dt.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.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(),i=this._sliderPointerPosition(e);r<=i&&i<=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 i=p4(this.domNode.domNode);t=e.pageX-i.left,r=e.pageY-i.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,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-r);if(_1&&o>C4){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let l=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},S1=class gd{constructor(t,r,n,i,s,o){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new gd(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,i,s){let o=Math.max(0,n-t),l=Math.max(0,o-2*r),a=i>0&&i>n;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*l/i))),d=(l-c)/(i-n),h=s*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(c),computedSliderRatio:d,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=gd._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)}},E4=class extends w1{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new S1(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,i.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}},N4=class extends w1{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new S1(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,i.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}},T4=500,u_=50,P4=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},_d=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,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-n);if(t-=s,r+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,n++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(ip){let r=hn(t.browserEvent),n=$P(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 i=null,s=new P4(t,r,n);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=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]=s),s.score=this._computeScore(s,i)}_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 i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(r.deltaX),l=Math.abs(r.deltaY),a=Math.max(Math.min(i,o),1),c=Math.max(Math.min(s,l),1),d=Math.max(i,o),h=Math.max(s,l);d%a===0&&h%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};_d.INSTANCE=new _d;var L4=_d,R4=class extends ap{constructor(e,t,r){super(),this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new se),this.onWillScroll=this._onWillScroll.event,this._options=I4(t),this._scrollable=r,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let n={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new N4(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new E4(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=Io(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Io(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Io(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,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new op),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Vi(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,pn&&(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 n_(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Vi(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new n_(r))};this._mouseWheelToDispose.push(Le(this._listenOnDomNode,Dt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=L4.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let l=!pn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),c={};if(s){let d=u_*s,h=a.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(c,h)}if(o){let d=u_*o,h=a.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(c,h)}c=this._scrollable.validateScrollPosition(c),(a.scrollLeft!==c.scrollLeft||a.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),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":"",i=t?" top":"",s=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${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(),T4)}},M4=class extends R4{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 I4(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,pn&&(t.className+=" mac"),t}var vd=class extends Be{constructor(e,t,r,n,i,s,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new y4({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>lp(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new M4(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},a)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ht.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ot(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ot(()=>this._styleElement.remove())),this._register(Ht.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
129
|
+
`))}},IT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},DT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},jT=0,Eu=class{constructor(e){this.value=e,this.id=jT++}},AT=2,BT,se=class{constructor(t){var r,n,i,s;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new RT((t==null?void 0:t.onListenerError)??ha,((n=this._options)==null?void 0:n.leakWarningThreshold)??LT):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new TT(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,r,n,i;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||n.call(r),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(t,r,n)=>{var l,a,c,d,h;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let f=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(f);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new DT(`${f}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((l=this._options)==null?void 0:l.onListenerError)||ha)(m),Be.None}if(this._disposed)return Be.None;r&&(t=t.bind(r));let i=new Eu(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=MT.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Eu?(this._deliveryQueue??(this._deliveryQueue=new OT),this._listeners=[this._listeners,i]):this._listeners.push(i):((c=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||c.call(a,this),this._listeners=i,(h=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||h.call(d,this)),this._size++;let o=ot(()=>{s==null||s(),this._removeListener(i)});return n instanceof ci?n.add(o):Array.isArray(n)&&n.push(o),o}),this._event}_removeListener(t){var s,o,l,a;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||a.call(l,this),this._size=0;return}let r=this._listeners,n=r.indexOf(t);if(n===-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--,r[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*AT<=r.length){let c=0;for(let d=0;d<r.length;d++)r[d]?r[c++]=r[d]:i&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=c}}_deliver(t,r){var i;if(!t)return;let n=((i=this._options)==null?void 0:i.onListenerError)||ha;if(!n){t.value(r);return}try{t.value(r)}catch(s){n(s)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,n,i,s;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof Eu)this._deliver(this._listeners,t);else{let o=this._deliveryQueue;o.enqueue(this,t,this._listeners.length),this._deliverQueue(o)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},OT=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}},ud=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new se,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new se,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}};ud.INSTANCE=new ud;var np=ud;function zT(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}np.INSTANCE.onDidChangeZoomLevel;function $T(e){return np.INSTANCE.getZoomFactor(e)}np.INSTANCE.onDidChangeFullscreen;var Ws=typeof navigator=="object"?navigator.userAgent:"",hd=Ws.indexOf("Firefox")>=0,FT=Ws.indexOf("AppleWebKit")>=0,ip=Ws.indexOf("Chrome")>=0,WT=!ip&&Ws.indexOf("Safari")>=0;Ws.indexOf("Electron/")>=0;Ws.indexOf("Android")>=0;var Nu=!1;if(typeof Nn.matchMedia=="function"){let e=Nn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Nn.matchMedia("(display-mode: fullscreen)");Nu=e.matches,zT(Nn,e,({matches:r})=>{Nu&&t.matches||(Nu=r)})}var _s="en",dd=!1,fd=!1,da=!1,g1=!1,Wl,fa=_s,Qg=_s,HT,Yr,Oi=globalThis,Wt,sv;typeof Oi.vscode<"u"&&typeof Oi.vscode.process<"u"?Wt=Oi.vscode.process:typeof process<"u"&&typeof((sv=process==null?void 0:process.versions)==null?void 0:sv.node)=="string"&&(Wt=process);var ov,UT=typeof((ov=Wt==null?void 0:Wt.versions)==null?void 0:ov.electron)=="string",VT=UT&&(Wt==null?void 0:Wt.type)==="renderer",lv;if(typeof Wt=="object"){dd=Wt.platform==="win32",fd=Wt.platform==="darwin",da=Wt.platform==="linux",da&&Wt.env.SNAP&&Wt.env.SNAP_REVISION,Wt.env.CI||Wt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Wl=_s,fa=_s;let e=Wt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Wl=t.userLocale,Qg=t.osLocale,fa=t.resolvedLanguage||_s,HT=(lv=t.languagePack)==null?void 0:lv.translationsConfigFile}catch{}g1=!0}else typeof navigator=="object"&&!VT?(Yr=navigator.userAgent,dd=Yr.indexOf("Windows")>=0,fd=Yr.indexOf("Macintosh")>=0,(Yr.indexOf("Macintosh")>=0||Yr.indexOf("iPad")>=0||Yr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,da=Yr.indexOf("Linux")>=0,(Yr==null?void 0:Yr.indexOf("Mobi"))>=0,fa=globalThis._VSCODE_NLS_LANGUAGE||_s,Wl=navigator.language.toLowerCase(),Qg=Wl):console.error("Unable to resolve platform.");var _1=dd,pn=fd,KT=da,Jg=g1,mn=Yr,Fn=fa,qT;(e=>{function t(){return Fn}e.value=t;function r(){return Fn.length===2?Fn==="en":Fn.length>=3?Fn[0]==="e"&&Fn[1]==="n"&&Fn[2]==="-":!1}e.isDefaultVariant=r;function n(){return Fn==="en"}e.isDefault=n})(qT||(qT={}));var YT=typeof Oi.postMessage=="function"&&!Oi.importScripts;(()=>{if(YT){let e=[];Oi.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,i=e.length;n<i;n++){let s=e[n];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(n,1),s.callback();return}}});let t=0;return r=>{let n=++t;e.push({id:n,callback:r}),Oi.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var XT=!!(mn&&mn.indexOf("Chrome")>=0);mn&&mn.indexOf("Firefox")>=0;!XT&&mn&&mn.indexOf("Safari")>=0;mn&&mn.indexOf("Edg/")>=0;mn&&mn.indexOf("Android")>=0;var ts=typeof navigator=="object"?navigator:{};Jg||document.queryCommandSupported&&document.queryCommandSupported("copy")||ts&&ts.clipboard&&ts.clipboard.writeText,Jg||ts&&ts.clipboard&&ts.clipboard.readText;var sp=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}},Pu=new sp,Zg=new sp,e_=new sp,GT=new Array(230),v1;(e=>{function t(l){return Pu.keyCodeToStr(l)}e.toString=t;function r(l){return Pu.strToKeyCode(l)}e.fromString=r;function n(l){return Zg.keyCodeToStr(l)}e.toUserSettingsUS=n;function i(l){return e_.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return Zg.strToKeyCode(l)||e_.strToKeyCode(l)}e.fromUserSettings=s;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Pu.keyCodeToStr(l)}e.toElectronAccelerator=o})(v1||(v1={}));var QT=class x1{constructor(t,r,n,i,s){this.ctrlKey=t,this.shiftKey=r,this.altKey=n,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof x1&&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",i=this.metaKey?"1":"0";return`K${t}${r}${n}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new JT([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},JT=class{constructor(e){if(e.length===0)throw ST("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 ZT(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return v1.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(hd)switch(t){case 59:return 85;case 60:if(KT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(pn)return 57;break}else if(FT&&(pn&&t===93||!pn&&t===92))return 57;return GT[t]||0}var e4=pn?256:2048,t4=512,r4=1024,n4=pn?2048:256,t_=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=ZT(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|=e4),this.altKey&&(t|=t4),this.shiftKey&&(t|=r4),this.metaKey&&(t|=n4),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new QT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},r_=new WeakMap;function i4(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 s4=class{static getSameOriginWindowChain(e){let t=r_.get(e);if(!t){t=[],r_.set(e,t);let r=e,n;do n=i4(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,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(r+=(o==null?void 0:o.scrollY)??0,n+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let l=s.iframeElement.getBoundingClientRect();r+=l.top,n+=l.left}return{top:r,left:n}}},Hl=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=s4.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},n_=class{constructor(e,t=0,r=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let n=!1;if(ip){let s=navigator.userAgent.match(/Chrome\/(\d+)/);n=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,l=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")n?this.deltaY=s.wheelDeltaY/(120*l):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?hd&&!pn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")WT&&_1?this.deltaX=-(s.wheelDeltaX/120):n?this.deltaX=s.wheelDeltaX/(120*l):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?hd&&!pn?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*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},y1=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),o4;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof l4?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ht.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:y1})})(o4||(o4={}));var l4=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?y1:(this._emitter||(this._emitter=new se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},op=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 sd("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new sd("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},a4=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 sd("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=ot(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},c4;(e=>{async function t(n){let i,s=await Promise.all(n.map(o=>o.then(l=>l,l=>{i||(i=l)})));if(typeof i<"u")throw i;return s}e.settled=t;function r(n){return new Promise(async(i,s)=>{try{await n(i,s)}catch(o){s(o)}})}e.withAsyncBody=r})(c4||(c4={}));var i_=class jr{static fromArray(t){return new jr(r=>{r.emitMany(t)})}static fromPromise(t){return new jr(async r=>{r.emitMany(await t)})}static fromPromises(t){return new jr(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new jr(async r=>{await Promise.all(t.map(async n=>{for await(let i of n)r.emitOne(i)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new se,queueMicrotask(async()=>{let n={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(n)),this.resolve()}catch(i){this.reject(i)}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 Ht.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 jr(async n=>{for await(let i of t)n.emitOne(r(i))})}map(t){return jr.map(this,t)}static filter(t,r){return new jr(async n=>{for await(let i of t)r(i)&&n.emitOne(i)})}filter(t){return jr.filter(this,t)}static coalesce(t){return jr.filter(t,r=>!!r)}coalesce(){return jr.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return jr.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())}};i_.EMPTY=i_.fromArray([]);var{getWindow:hn,getWindowId:u4,onDidRegisterWindow:h4}=function(){let e=new Map,t={window:Nn,disposables:new ci};e.set(Nn.vscodeWindowId,t);let r=new se,n=new se,i=new se;function s(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:n.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Be.None;let l=new ci,a={window:o,disposables:l.add(new ci)};return e.set(o.vscodeWindowId,a),l.add(ot(()=>{e.delete(o.vscodeWindowId),n.fire(o)})),l.add(Le(o,Dt.BEFORE_UNLOAD,()=>{i.fire(o)})),r.fire(a),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let l=o;if((c=l==null?void 0:l.ownerDocument)!=null&&c.defaultView)return l.ownerDocument.defaultView.window;let a=o;return a!=null&&a.view?a.view.window:Nn},getDocument(o){return hn(o).document}}}(),d4=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 Le(e,t,r,n){return new d4(e,t,r,n)}var s_=function(e,t,r,n){return Le(e,t,r,n)},lp,f4=class extends a4{constructor(e){super(),this.defaultTarget=e&&hn(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},o_=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){ha(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,n=new Map,i=s=>{r.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),n.set(s,!0);o.length>0;)o.sort(o_.sort),o.shift().execute();n.set(s,!1)};lp=(s,o,l=0)=>{let a=u4(s),c=new o_(o,l),d=e.get(a);return d||(d=[],e.set(a,d)),d.push(c),r.get(a)||(r.set(a,!0),s.requestAnimationFrame(()=>i(a))),c}})();function p4(e){let t=e.getBoundingClientRect(),r=hn(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var Dt={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"},m4=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=ur(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ur(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ur(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ur(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ur(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ur(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ur(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ur(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ur(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ur(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ur(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=ur(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=ur(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ur(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function ur(e){return typeof e=="number"?`${e}px`:e}function Io(e){return new m4(e)}var b1=class{constructor(){this._hooks=new ci,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,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(ot(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=hn(e)}this._hooks.add(Le(s,Dt.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Le(s,Dt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function g4(e,t,r){let n=null,i=null;if(typeof r.value=="function"?(n="value",i=r.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",i=r.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;r[n]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var ln;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ln||(ln={}));var po=class Yt extends Be{constructor(){super(),this.dispatched=!1,this.targets=new Gg,this.ignoreTargets=new Gg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ht.runAndSubscribe(h4,({window:t,disposables:r})=>{r.add(Le(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(Le(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(Le(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Nn,disposables:this._store}))}static addTarget(t){if(!Yt.isTouchDevice())return Be.None;Yt.INSTANCE||(Yt.INSTANCE=new Yt);let r=Yt.INSTANCE.targets.push(t);return ot(r)}static ignoreTarget(t){if(!Yt.isTouchDevice())return Be.None;Yt.INSTANCE||(Yt.INSTANCE=new Yt);let r=Yt.INSTANCE.ignoreTargets.push(t);return ot(r)}static isTouchDevice(){return"ontouchstart"in Nn||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,i=t.targetTouches.length;n<i;n++){let s=t.targetTouches.item(n);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:r,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[r],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(ln.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let n=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=r.changedTouches.length;s<o;s++){let l=r.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let a=this.activeTouches[l.identifier],c=Date.now()-a.initialTimeStamp;if(c<Yt.HOLD_DELAY&&Math.abs(a.initialPageX-wr(a.rollingPageX))<30&&Math.abs(a.initialPageY-wr(a.rollingPageY))<30){let d=this.newGestureEvent(ln.Tap,a.initialTarget);d.pageX=wr(a.rollingPageX),d.pageY=wr(a.rollingPageY),this.dispatchEvent(d)}else if(c>=Yt.HOLD_DELAY&&Math.abs(a.initialPageX-wr(a.rollingPageX))<30&&Math.abs(a.initialPageY-wr(a.rollingPageY))<30){let d=this.newGestureEvent(ln.Contextmenu,a.initialTarget);d.pageX=wr(a.rollingPageX),d.pageY=wr(a.rollingPageY),this.dispatchEvent(d)}else if(i===1){let d=wr(a.rollingPageX),h=wr(a.rollingPageY),f=wr(a.rollingTimestamps)-a.rollingTimestamps[0],p=d-a.rollingPageX[0],m=h-a.rollingPageY[0],g=[...this.targets].filter(S=>a.initialTarget instanceof Node&&S.contains(a.initialTarget));this.inertia(t,g,n,Math.abs(p)/f,p>0?1:-1,d,Math.abs(m)/f,m>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(ln.End,a.initialTarget)),delete this.activeTouches[l.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===ln.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Yt.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===ln.Change||t.type===ln.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 i=0,s=t.initialTarget;for(;s&&s!==n;)i++,s=s.parentElement;r.push([i,n])}r.sort((n,i)=>n[0]-i[0]);for(let[n,i]of r)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,n,i,s,o,l,a,c){this.handle=lp(t,()=>{let d=Date.now(),h=d-n,f=0,p=0,m=!0;i+=Yt.SCROLL_FRICTION*h,l+=Yt.SCROLL_FRICTION*h,i>0&&(m=!1,f=s*i*h),l>0&&(m=!1,p=a*l*h);let g=this.newGestureEvent(ln.Change);g.translationX=f,g.translationY=p,r.forEach(S=>S.dispatchEvent(g)),m||this.inertia(t,r,d,i,s,o+f,l,a,c+p)})}onTouchMove(t){let r=Date.now();for(let n=0,i=t.changedTouches.length;n<i;n++){let s=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],l=this.newGestureEvent(ln.Change,o.initialTarget);l.translationX=s.pageX-wr(o.rollingPageX),l.translationY=s.pageY-wr(o.rollingPageY),l.pageX=s.pageX,l.pageY=s.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};po.SCROLL_FRICTION=-.005,po.HOLD_DELAY=700,po.CLEAR_TAP_COUNT_TIME=400,_t([g4],po,"isTouchDevice",1);var _4=po,ap=class extends Be{onclick(e,t){this._register(Le(e,Dt.CLICK,r=>t(new Hl(hn(e),r))))}onmousedown(e,t){this._register(Le(e,Dt.MOUSE_DOWN,r=>t(new Hl(hn(e),r))))}onmouseover(e,t){this._register(Le(e,Dt.MOUSE_OVER,r=>t(new Hl(hn(e),r))))}onmouseleave(e,t){this._register(Le(e,Dt.MOUSE_LEAVE,r=>t(new Hl(hn(e),r))))}onkeydown(e,t){this._register(Le(e,Dt.KEY_DOWN,r=>t(new t_(r))))}onkeyup(e,t){this._register(Le(e,Dt.KEY_UP,r=>t(new t_(r))))}oninput(e,t){this._register(Le(e,Dt.INPUT,t))}onblur(e,t){this._register(Le(e,Dt.BLUR,t))}onfocus(e,t){this._register(Le(e,Dt.FOCUS,t))}onchange(e,t){this._register(Le(e,Dt.CHANGE,t))}ignoreGesture(e){return _4.ignoreTarget(e)}},l_=11,v4=class extends ap{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=l_+"px",this.domNode.style.height=l_+"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 b1),this._register(s_(this.bgDomNode,Dt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(s_(this.domNode,Dt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new f4),this._pointerdownScheduleRepeatTimer=this._register(new op)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,hn(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()}},x4=class pd{constructor(t,r,n,i,s,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,i=i|0,s=s|0,o=o|0,l=l|0),this.rawScrollLeft=i,this.rawScrollTop=l,r<0&&(r=0),i+r>n&&(i=n-r),i<0&&(i=0),s<0&&(s=0),l+s>o&&(l=o-s),l<0&&(l=0),this.width=r,this.scrollWidth=n,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new pd(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 pd(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,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,a=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:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},y4=class extends Be{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new x4(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 c_(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=c_.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)))}},a_=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function Tu(e,t){let r=t-e;return function(n){return e+r*S4(n)}}function b4(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var c_=class md{constructor(t,r,n,i){this.from=t,this.to=r,this.duration=i,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 i,s;return t<r?(i=t+.75*n,s=r-.75*n):(i=t-.75*n,s=r+.75*n),b4(Tu(t,i),Tu(s,r),.33)}return Tu(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),i=this.scrollTop(r);return new a_(n,i,!1)}return new a_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return md.start(t,r,n)}static start(t,r,n){n=n+10;let i=Date.now()-10;return new md(t,r,i,n)}};function w4(e){return Math.pow(e,3)}function S4(e){return 1-w4(1-e)}var k4=class extends Be{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 op)}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":"")))}},C4=140,w1=class extends ap{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 k4(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new b1),this._shouldRender=!0,this.domNode=Io(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(Le(this.domNode.domNode,Dt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new v4(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=Io(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(Le(this.slider.domNode,Dt.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.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(),i=this._sliderPointerPosition(e);r<=i&&i<=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 i=p4(this.domNode.domNode);t=e.pageX-i.left,r=e.pageY-i.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,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-r);if(_1&&o>C4){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let l=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},S1=class gd{constructor(t,r,n,i,s,o){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new gd(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,i,s){let o=Math.max(0,n-t),l=Math.max(0,o-2*r),a=i>0&&i>n;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*l/i))),d=(l-c)/(i-n),h=s*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(c),computedSliderRatio:d,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=gd._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)}},E4=class extends w1{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new S1(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,i.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}},N4=class extends w1{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new S1(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,i.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}},P4=500,u_=50,T4=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},_d=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,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-n);if(t-=s,r+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,n++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(ip){let r=hn(t.browserEvent),n=$T(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 i=null,s=new T4(t,r,n);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=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]=s),s.score=this._computeScore(s,i)}_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 i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(r.deltaX),l=Math.abs(r.deltaY),a=Math.max(Math.min(i,o),1),c=Math.max(Math.min(s,l),1),d=Math.max(i,o),h=Math.max(s,l);d%a===0&&h%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};_d.INSTANCE=new _d;var L4=_d,R4=class extends ap{constructor(e,t,r){super(),this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new se),this.onWillScroll=this._onWillScroll.event,this._options=I4(t),this._scrollable=r,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let n={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new N4(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new E4(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=Io(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Io(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Io(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,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new op),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Vi(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,pn&&(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 n_(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Vi(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new n_(r))};this._mouseWheelToDispose.push(Le(this._listenOnDomNode,Dt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=L4.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let l=!pn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),c={};if(s){let d=u_*s,h=a.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(c,h)}if(o){let d=u_*o,h=a.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(c,h)}c=this._scrollable.validateScrollPosition(c),(a.scrollLeft!==c.scrollLeft||a.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),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":"",i=t?" top":"",s=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${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(),P4)}},M4=class extends R4{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 I4(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,pn&&(t.className+=" mac"),t}var vd=class extends Be{constructor(e,t,r,n,i,s,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new y4({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>lp(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new M4(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},a)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ht.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ot(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ot(()=>this._styleElement.remove())),this._register(Ht.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
130
130
|
`)})),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(c=>this._handleScroll(c)))}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}};vd=_t([ge(2,or),ge(3,An),ge(4,n1),ge(5,Fs),ge(6,lr),ge(7,Bn)],vd);var xd=class extends Be{constructor(e,t,r,n,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=n,this._renderService=i,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(s=>this._removeDecoration(s))),this._register(ot(()=>{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()}};xd=_t([ge(1,or),ge(2,An),ge(3,vl),ge(4,Bn)],xd);var D4=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)}},sn={full:0,left:0,center:0,right:0},Wn={full:0,left:0,center:0,right:0},to={full:0,left:0,center:0,right:0},Qa=class extends Be{constructor(e,t,r,n,i,s,o,l){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new D4,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(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(ot(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let a=this._canvas.getContext("2d");if(a)this._ctx=a;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Wn.full=this._canvas.width,Wn.left=e,Wn.center=t,Wn.right=e,this._refreshDrawHeightConstants(),to.full=1,to.left=1,to.center=1+Wn.left,to.right=1+Wn.left+Wn.center}_refreshDrawHeightConstants(){sn.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);sn.left=t,sn.center=t,sn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*sn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*sn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*sn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*sn.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(to[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-sn[e.position||"full"]/2),Wn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+sn[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}))}};Qa=_t([ge(2,or),ge(3,vl),ge(4,Bn),ge(5,lr),ge(6,Fs),ge(7,An)],Qa);var Z;(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=`
|
|
131
|
-
`,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=""))(Z||(Z={}));var pa;(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=""))(pa||(pa={}));var k1;(e=>e.ST=`${Z.ESC}\\`)(k1||(k1={}));var yd=class{constructor(e,t,r,n,i,s){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=i,this._renderService=s,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(`${Z.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,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"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 s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};yd=_t([ge(2,or),ge(3,lr),ge(4,Gi),ge(5,Bn)],yd);var At=0,Bt=0,Ot=0,mt=0,h_={css:"#00000000",rgba:0},wt;(e=>{function t(i,s,o,l){return l!==void 0?`#${bi(i)}${bi(s)}${bi(o)}${bi(l)}`:`#${bi(i)}${bi(s)}${bi(o)}`}e.toCss=t;function r(i,s,o,l=255){return(i<<24|s<<16|o<<8|l)>>>0}e.toRgba=r;function n(i,s,o,l){return{css:e.toCss(i,s,o,l),rgba:e.toRgba(i,s,o,l)}}e.toColor=n})(wt||(wt={}));var nt;(e=>{function t(a,c){if(mt=(c.rgba&255)/255,mt===1)return{css:c.css,rgba:c.rgba};let d=c.rgba>>24&255,h=c.rgba>>16&255,f=c.rgba>>8&255,p=a.rgba>>24&255,m=a.rgba>>16&255,g=a.rgba>>8&255;At=p+Math.round((d-p)*mt),Bt=m+Math.round((h-m)*mt),Ot=g+Math.round((f-g)*mt);let S=wt.toCss(At,Bt,Ot),_=wt.toRgba(At,Bt,Ot);return{css:S,rgba:_}}e.blend=t;function r(a){return(a.rgba&255)===255}e.isOpaque=r;function n(a,c,d){let h=ma.ensureContrastRatio(a.rgba,c.rgba,d);if(h)return wt.toColor(h>>24&255,h>>16&255,h>>8&255)}e.ensureContrastRatio=n;function i(a){let c=(a.rgba|255)>>>0;return[At,Bt,Ot]=ma.toChannels(c),{css:wt.toCss(At,Bt,Ot),rgba:c}}e.opaque=i;function s(a,c){return mt=Math.round(c*255),[At,Bt,Ot]=ma.toChannels(a.rgba),{css:wt.toCss(At,Bt,Ot,mt),rgba:wt.toRgba(At,Bt,Ot,mt)}}e.opacity=s;function o(a,c){return mt=a.rgba&255,s(a,mt*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})(nt||(nt={}));var ct;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return At=parseInt(i.slice(1,2).repeat(2),16),Bt=parseInt(i.slice(2,3).repeat(2),16),Ot=parseInt(i.slice(3,4).repeat(2),16),wt.toColor(At,Bt,Ot);case 5:return At=parseInt(i.slice(1,2).repeat(2),16),Bt=parseInt(i.slice(2,3).repeat(2),16),Ot=parseInt(i.slice(3,4).repeat(2),16),mt=parseInt(i.slice(4,5).repeat(2),16),wt.toColor(At,Bt,Ot,mt);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return At=parseInt(s[1]),Bt=parseInt(s[2]),Ot=parseInt(s[3]),mt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),wt.toColor(At,Bt,Ot,mt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[At,Bt,Ot,mt]=t.getImageData(0,0,1,1).data,mt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:wt.toRgba(At,Bt,Ot,mt),css:i}}e.toColor=n})(ct||(ct={}));var er;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,s){let o=n/255,l=i/255,a=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return c*.2126+d*.7152+h*.0722}e.relativeLuminance2=r})(er||(er={}));var ma;(e=>{function t(o,l){if(mt=(l&255)/255,mt===1)return l;let a=l>>24&255,c=l>>16&255,d=l>>8&255,h=o>>24&255,f=o>>16&255,p=o>>8&255;return At=h+Math.round((a-h)*mt),Bt=f+Math.round((c-f)*mt),Ot=p+Math.round((d-p)*mt),wt.toRgba(At,Bt,Ot)}e.blend=t;function r(o,l,a){let c=er.relativeLuminance(o>>8),d=er.relativeLuminance(l>>8);if(vn(c,d)<a){if(d<c){let p=n(o,l,a),m=vn(c,er.relativeLuminance(p>>8));if(m<a){let g=i(o,l,a),S=vn(c,er.relativeLuminance(g>>8));return m>S?p:g}return p}let h=i(o,l,a),f=vn(c,er.relativeLuminance(h>>8));if(f<a){let p=n(o,l,a),m=vn(c,er.relativeLuminance(p>>8));return f>m?h:p}return h}}e.ensureContrastRatio=r;function n(o,l,a){let c=o>>24&255,d=o>>16&255,h=o>>8&255,f=l>>24&255,p=l>>16&255,m=l>>8&255,g=vn(er.relativeLuminance2(f,p,m),er.relativeLuminance2(c,d,h));for(;g<a&&(f>0||p>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m-=Math.max(0,Math.ceil(m*.1)),g=vn(er.relativeLuminance2(f,p,m),er.relativeLuminance2(c,d,h));return(f<<24|p<<16|m<<8|255)>>>0}e.reduceLuminance=n;function i(o,l,a){let c=o>>24&255,d=o>>16&255,h=o>>8&255,f=l>>24&255,p=l>>16&255,m=l>>8&255,g=vn(er.relativeLuminance2(f,p,m),er.relativeLuminance2(c,d,h));for(;g<a&&(f<255||p<255||m<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),g=vn(er.relativeLuminance2(f,p,m),er.relativeLuminance2(c,d,h));return(f<<24|p<<16|m<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(ma||(ma={}));function bi(e){let t=e.toString(16);return t.length<2?"0"+t:t}function vn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var j4=class extends _l{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()]}},Ja=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Hr}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),i=0,s=0,o=0,l=t.getFg(0),a=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==a){if(c-i>1){let d=this._getJoinedRanges(n,o,s,t,i);for(let h=0;h<d.length;h++)r.push(d[h])}i=c,o=s,l=this._workCell.fg,a=this._workCell.bg}s+=this._workCell.getChars().length||ei.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(n,o,s,t,i);for(let d=0;d<c.length;d++)r.push(c[d])}return r}_getJoinedRanges(e,t,r,n,i){let s=e.substring(t,r),o=[];try{o=this._characterJoiners[0].handler(s)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let a=this._characterJoiners[l].handler(s);for(let c=0;c<a.length;c++)Ja._mergeRanges(o,a[c])}catch(a){console.error(a)}return this._stringRangesToCellRanges(o,n,i),o}_stringRangesToCellRanges(e,t,r){let n=0,i=!1,s=0,o=e[n];if(o){for(let l=r;l<this._bufferService.cols;l++){let a=t.getWidth(l),c=t.getString(l).length||ei.length;if(a!==0){if(!i&&o[0]<=s&&(o[0]=l,i=!0),o[1]<=s){if(o[1]=l,o=e[++n],!o)break;o[0]<=s?(o[0]=l,i=!0):i=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(r){if(t[1]<=i[0])return e[n-1][1]=t[1],e;if(t[1]<=i[1])return e[n-1][1]=Math.max(t[1],i[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=i[0])return e.splice(n,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Ja=_t([ge(0,or)],Ja);function A4(e){return 57508<=e&&e<=57558}function B4(e){return 9472<=e&&e<=9631}function O4(e){return A4(e)||B4(e)}function z4(){return{css:{canvas:Ul(),cell:Ul()},device:{canvas:Ul(),cell:Ul(),char:{width:0,height:0,left:0,top:0}}}}function Ul(){return{width:0,height:0}}var bd=class{constructor(e,t,r,n,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new Hr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,i,s,o,l,a,c,d){let h=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();r&&m<s+1&&(m=s+1);let g,S=0,_="",x=0,w=0,N=0,L=0,C=!1,F=0,T=!1,q=0,E=0,A=[],R=c!==-1&&d!==-1;for(let P=0;P<m;P++){e.loadCell(P,this._workCell);let $=this._workCell.getWidth();if($===0)continue;let z=!1,D=P>=E,H=P,I=this._workCell;if(f.length>0&&P===f[0][0]&&D){let G=f.shift(),me=this._isCellInSelection(G[0],t);for(x=G[0]+1;x<G[1];x++)D&&(D=me===this._isCellInSelection(x,t));D&&(D=!r||s<G[0]||s>=G[1]),D?(z=!0,I=new j4(this._workCell,e.translateToString(!0,G[0],G[1]),G[1]-G[0]),H=G[1]-1,$=I.getWidth()):E=G[1]}let W=this._isCellInSelection(P,t),y=r&&P===s,Q=R&&P>=c&&P<=d,ae=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,G=>{ae=!0});let k=I.getChars()||ei;if(k===" "&&(I.isUnderline()||I.isOverline())&&(k=" "),q=$*l-a.get(k,I.isBold(),I.isItalic()),!g)g=this._document.createElement("span");else if(S&&(W&&T||!W&&!T&&I.bg===w)&&(W&&T&&p.selectionForeground||I.fg===N)&&I.extended.ext===L&&Q===C&&q===F&&!y&&!z&&!ae&&D){I.isInvisible()?_+=ei:_+=k,S++;continue}else S&&(g.textContent=_),g=this._document.createElement("span"),S=0,_="";if(w=I.bg,N=I.fg,L=I.extended.ext,C=Q,F=q,T=W,z&&s>=P&&s<=H&&(s=P),!this._coreService.isCursorHidden&&y&&this._coreService.isCursorInitialized){if(A.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&A.push("xterm-cursor-blink"),A.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":A.push("xterm-cursor-outline");break;case"block":A.push("xterm-cursor-block");break;case"bar":A.push("xterm-cursor-bar");break;case"underline":A.push("xterm-cursor-underline");break}}if(I.isBold()&&A.push("xterm-bold"),I.isItalic()&&A.push("xterm-italic"),I.isDim()&&A.push("xterm-dim"),I.isInvisible()?_=ei:_=I.getChars()||ei,I.isUnderline()&&(A.push(`xterm-underline-${I.extended.underlineStyle}`),_===" "&&(_=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${_l.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let G=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&G<8&&(G+=8),g.style.textDecorationColor=p.ansi[G].css}I.isOverline()&&(A.push("xterm-overline"),_===" "&&(_=" ")),I.isStrikethrough()&&A.push("xterm-strikethrough"),Q&&(g.style.textDecoration="underline");let we=I.getFgColor(),U=I.getFgColorMode(),Y=I.getBgColor(),te=I.getBgColorMode(),fe=!!I.isInverse();if(fe){let G=we;we=Y,Y=G;let me=U;U=te,te=me}let de,Oe,Ve=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,G=>{G.options.layer!=="top"&&Ve||(G.backgroundColorRGB&&(te=50331648,Y=G.backgroundColorRGB.rgba>>8&16777215,de=G.backgroundColorRGB),G.foregroundColorRGB&&(U=50331648,we=G.foregroundColorRGB.rgba>>8&16777215,Oe=G.foregroundColorRGB),Ve=G.options.layer==="top")}),!Ve&&W&&(de=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Y=de.rgba>>8&16777215,te=50331648,Ve=!0,p.selectionForeground&&(U=50331648,we=p.selectionForeground.rgba>>8&16777215,Oe=p.selectionForeground)),Ve&&A.push("xterm-decoration-top");let Ie;switch(te){case 16777216:case 33554432:Ie=p.ansi[Y],A.push(`xterm-bg-${Y}`);break;case 50331648:Ie=wt.toColor(Y>>16,Y>>8&255,Y&255),this._addStyle(g,`background-color:#${d_((Y>>>0).toString(16),"0",6)}`);break;case 0:default:fe?(Ie=p.foreground,A.push("xterm-bg-257")):Ie=p.background}switch(de||I.isDim()&&(de=nt.multiplyOpacity(Ie,.5)),U){case 16777216:case 33554432:I.isBold()&&we<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(we+=8),this._applyMinimumContrast(g,Ie,p.ansi[we],I,de,void 0)||A.push(`xterm-fg-${we}`);break;case 50331648:let G=wt.toColor(we>>16&255,we>>8&255,we&255);this._applyMinimumContrast(g,Ie,G,I,de,Oe)||this._addStyle(g,`color:#${d_(we.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,Ie,p.foreground,I,de,Oe)||fe&&A.push("xterm-fg-257")}A.length&&(g.className=A.join(" "),A.length=0),!y&&!z&&!ae&&D?S++:g.textContent=_,q!==this.defaultSpacing&&(g.style.letterSpacing=`${q}px`),h.push(g),P=H}return g&&S&&(g.textContent=_),h}_applyMinimumContrast(e,t,r,n,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||O4(n.getCode()))return!1;let o=this._getContrastCache(n),l;if(!i&&!s&&(l=o.getColor(t.rgba,r.rgba)),l===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);l=nt.ensureContrastRatio(i||t,s||r,a),o.setColor((i||t).rgba,(s||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let 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]}};bd=_t([ge(1,o1),ge(2,lr),ge(3,An),ge(4,Gi),ge(5,vl),ge(6,Fs)],bd);function d_(e,t,r){for(;e.length<r;)e=t+e;return e}var $4=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[r,n,i,s],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(s),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 o=this._measure(e,0);return o>0&&(this._flat[n]=o),o}let i=e;t&&(i+="B"),r&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),r&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},F4=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 i=e.buffers.active.ydisp,s=t[1]-i,o=r[1]-i,l=Math.max(s,0),a=Math.min(o,e.rows-1);if(l>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=a,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 W4(){return new F4}var Lu="xterm-dom-renderer-owner-",Ir="xterm-rows",Vl="xterm-fg-",f_="xterm-bg-",ro="xterm-focus",Kl="xterm-selection",H4=1,wd=class extends Be{constructor(e,t,r,n,i,s,o,l,a,c,d,h,f,p){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=a,this._optionsService=c,this._bufferService=d,this._coreService=h,this._coreBrowserService=f,this._themeService=p,this._terminalClass=H4++,this._rowElements=[],this._selectionRenderModel=W4(),this.onRequestRedraw=this._register(new se).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ir),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(Kl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=z4(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(bd,document),this._element.classList.add(Lu+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(ot(()=>{this._element.classList.remove(Lu+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new $4(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} .${Ir} 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} .${Ir} { 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} .${Ir} .xterm-dim { color: ${nt.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}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Ir}.${ro} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Ir}.${ro} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Ir}.${ro} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Ir} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Ir} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Ir} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Ir} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Ir} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Kl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Kl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Kl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${Vl}${s} { color: ${o.css}; }${this._terminalSelector} .${Vl}${s}.xterm-dim { color: ${nt.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${f_}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${Vl}257 { color: ${nt.opaque(e.background).css}; }${this._terminalSelector} .${Vl}257.xterm-dim { color: ${nt.multiplyOpacity(nt.opaque(e.background),.5).css}; }${this._terminalSelector} .${f_}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(ro),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ro),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,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let a=e[0]>t[0];l.appendChild(this._createSelectionElement(s,a?t[0]:e[0],a?e[0]:t[0],o-s+1))}else{let a=n===s?e[0]:0,c=s===i?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(s,a,c));let d=o-s-1;if(l.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,d)),s!==o){let h=i===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,r,n=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(r-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${n*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}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,i=Math.min(r.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=t;a++){let c=a+r.ydisp,d=this._rowElements[a],h=r.lines.get(c);if(!d||!h)break;d.replaceChildren(...this._rowFactory.createRow(h,c,c===n,o,l,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Lu}${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,i,s){r<0&&(e=0),n<0&&(t=0);let o=this._bufferService.rows-1;r=Math.max(Math.min(r,o),0),n=Math.max(Math.min(n,o),0),i=Math.min(i,this._bufferService.cols);let l=this._bufferService.buffer,a=l.ybase+l.y,c=Math.min(l.x,i-1),d=this._optionsService.rawOptions.cursorBlink,h=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=r;p<=n;++p){let m=p+l.ydisp,g=this._rowElements[p],S=l.lines.get(m);if(!g||!S)break;g.replaceChildren(...this._rowFactory.createRow(S,m,m===a,h,f,c,d,this.dimensions.css.cell.width,this._widthCache,s?p===r?e:0:-1,s?(p===n?t:i)-1:-1))}}};wd=_t([ge(7,tp),ge(8,Pc),ge(9,lr),ge(10,or),ge(11,Gi),ge(12,An),ge(13,Fs)],wd);var Sd=class extends Be{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new se),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new V4(this._optionsService))}catch{this._measureStrategy=this._register(new U4(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())}};Sd=_t([ge(2,lr)],Sd);var C1=class extends Be{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)}},U4=class extends C1{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}},V4=class extends C1{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}},K4=class extends Be{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 q4(this._window)),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new se),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Ht.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Le(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Le(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}},q4=class extends Be{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Is),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ot(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Le(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)}},Y4=class extends Be{constructor(){super(),this.linkProviders=[],this._register(ot(()=>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 cp(e,t,r){let n=r.getBoundingClientRect(),i=e.getComputedStyle(r),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-n.left-s,t.clientY-n.top-o]}function X4(e,t,r,n,i,s,o,l,a){if(!s)return;let c=cp(e,t,r);if(c)return c[0]=Math.ceil((c[0]+(a?o/2:0))/o),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),n+(a?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var kd=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return X4(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let r=cp(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])}}};kd=_t([ge(0,Bn),ge(1,Pc)],kd);var G4=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=[]}},E1={};oP(E1,{getSafariVersion:()=>J4,isChromeOS:()=>L1,isFirefox:()=>N1,isIpad:()=>Z4,isIphone:()=>eL,isLegacyEdge:()=>Q4,isLinux:()=>up,isMac:()=>Za,isNode:()=>Lc,isSafari:()=>T1,isWindows:()=>P1});var Lc=typeof process<"u"&&"title"in process,xl=Lc?"node":navigator.userAgent,yl=Lc?"node":navigator.platform,N1=xl.includes("Firefox"),Q4=xl.includes("Edge"),T1=/^((?!chrome|android).)*safari/i.test(xl);function J4(){if(!T1)return 0;let e=xl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Za=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(yl),Z4=yl==="iPad",eL=yl==="iPhone",P1=["Windows","Win16","Win32","WinCE"].includes(yl),up=yl.indexOf("Linux")>=0,L1=/\bCrOS\b/.test(xl),R1=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(),i=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),i=e.timeRemaining(),r*1.5>i){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=i}this.clear()}},tL=class extends R1{_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())}}},rL=class extends R1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ec=!Lc&&"requestIdleCallback"in window?rL:tL,nL=class{constructor(){this._queue=new ec}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Cd=class extends Be{constructor(e,t,r,n,i,s,o,l,a){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=i,this._coreBrowserService=l,this._renderer=this._register(new Is),this._pausedResizeTask=new nL,this._observerDisposable=this._register(new Is),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 se),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new se),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new se),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new G4((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new iL(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ot(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,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=ot(()=>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()}};Cd=_t([ge(2,lr),ge(3,Pc),ge(4,Gi),ge(5,vl),ge(6,or),ge(7,An),ge(8,Fs)],Cd);var iL=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 sL(e,t,r,n){let i=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return aL(i,s,e,t,r,n)+Rc(s,t,r,n)+cL(i,s,e,t,r,n);let o;if(s===t)return o=i>e?"D":"C",nl(Math.abs(i-e),rl(o,n));o=s>t?"D":"C";let l=Math.abs(s-t),a=lL(s>t?e:i,r)+(l-1)*r.cols+1+oL(s>t?i:e);return nl(a,rl(o,n))}function oL(e,t){return e-1}function lL(e,t){return t.cols-e}function aL(e,t,r,n,i,s){return Rc(t,n,i,s).length===0?"":nl(I1(e,t,e,t-Ki(t,i),!1,i).length,rl("D",s))}function Rc(e,t,r,n){let i=e-Ki(e,r),s=t-Ki(t,r),o=Math.abs(i-s)-uL(e,t,r);return nl(o,rl(M1(e,t),n))}function cL(e,t,r,n,i,s){let o;Rc(t,n,i,s).length>0?o=n-Ki(n,i):o=t;let l=n,a=hL(e,t,r,n,i,s);return nl(I1(e,o,r,l,a==="C",i).length,rl(a,s))}function uL(e,t,r){var o;let n=0,i=e-Ki(e,r),s=t-Ki(t,r);for(let l=0;l<Math.abs(i-s);l++){let a=M1(e,t)==="A"?-1:1;(o=r.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&n++}return n}function Ki(e,t){let r=0,n=t.buffer.lines.get(e),i=n==null?void 0:n.isWrapped;for(;i&&e>=0&&e<t.rows;)r++,n=t.buffer.lines.get(--e),i=n==null?void 0:n.isWrapped;return r}function hL(e,t,r,n,i,s){let o;return Rc(r,n,i,s).length>0?o=n-Ki(n,i):o=t,e<r&&o<=n||e>=r&&o<n?"C":"D"}function M1(e,t){return e>t?"A":"B"}function I1(e,t,r,n,i,s){let o=e,l=t,a="";for(;(o!==r||l!==n)&&l>=0&&l<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(a+=s.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!i&&o<0&&(a+=s.buffer.translateBufferLineToString(l,!1,0,e+1),o=s.cols-1,e=o,l--);return a+s.buffer.translateBufferLineToString(l,!1,e,o)}function rl(e,t){let r=t?"O":"[";return Z.ESC+r+e}function nl(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var dL=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 p_(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 Ru=50,fL=15,pL=50,mL=500,gL=" ",_L=new RegExp(gL,"g"),Ed=class extends Be{constructor(e,t,r,n,i,s,o,l,a){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=l,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Hr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new se),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new se),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new dL(this._bufferService),this._activeSelectionMode=0,this._register(ot(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.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 i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=r.translateBufferLineToString(o,!0,i,s);n.push(l)}}else{let i=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=r.lines.get(s),l=r.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?n[n.length-1]+=l:n.push(l)}if(e[1]!==t[1]){let s=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?n[n.length-1]+=o:n.push(o)}}return n.map(i=>i.replace(_L," ")).join(P1?`\r
|
|
131
|
+
`,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=""))(Z||(Z={}));var pa;(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=""))(pa||(pa={}));var k1;(e=>e.ST=`${Z.ESC}\\`)(k1||(k1={}));var yd=class{constructor(e,t,r,n,i,s){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=i,this._renderService=s,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(`${Z.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,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"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 s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};yd=_t([ge(2,or),ge(3,lr),ge(4,Gi),ge(5,Bn)],yd);var At=0,Bt=0,Ot=0,mt=0,h_={css:"#00000000",rgba:0},wt;(e=>{function t(i,s,o,l){return l!==void 0?`#${bi(i)}${bi(s)}${bi(o)}${bi(l)}`:`#${bi(i)}${bi(s)}${bi(o)}`}e.toCss=t;function r(i,s,o,l=255){return(i<<24|s<<16|o<<8|l)>>>0}e.toRgba=r;function n(i,s,o,l){return{css:e.toCss(i,s,o,l),rgba:e.toRgba(i,s,o,l)}}e.toColor=n})(wt||(wt={}));var nt;(e=>{function t(a,c){if(mt=(c.rgba&255)/255,mt===1)return{css:c.css,rgba:c.rgba};let d=c.rgba>>24&255,h=c.rgba>>16&255,f=c.rgba>>8&255,p=a.rgba>>24&255,m=a.rgba>>16&255,g=a.rgba>>8&255;At=p+Math.round((d-p)*mt),Bt=m+Math.round((h-m)*mt),Ot=g+Math.round((f-g)*mt);let S=wt.toCss(At,Bt,Ot),_=wt.toRgba(At,Bt,Ot);return{css:S,rgba:_}}e.blend=t;function r(a){return(a.rgba&255)===255}e.isOpaque=r;function n(a,c,d){let h=ma.ensureContrastRatio(a.rgba,c.rgba,d);if(h)return wt.toColor(h>>24&255,h>>16&255,h>>8&255)}e.ensureContrastRatio=n;function i(a){let c=(a.rgba|255)>>>0;return[At,Bt,Ot]=ma.toChannels(c),{css:wt.toCss(At,Bt,Ot),rgba:c}}e.opaque=i;function s(a,c){return mt=Math.round(c*255),[At,Bt,Ot]=ma.toChannels(a.rgba),{css:wt.toCss(At,Bt,Ot,mt),rgba:wt.toRgba(At,Bt,Ot,mt)}}e.opacity=s;function o(a,c){return mt=a.rgba&255,s(a,mt*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})(nt||(nt={}));var ct;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return At=parseInt(i.slice(1,2).repeat(2),16),Bt=parseInt(i.slice(2,3).repeat(2),16),Ot=parseInt(i.slice(3,4).repeat(2),16),wt.toColor(At,Bt,Ot);case 5:return At=parseInt(i.slice(1,2).repeat(2),16),Bt=parseInt(i.slice(2,3).repeat(2),16),Ot=parseInt(i.slice(3,4).repeat(2),16),mt=parseInt(i.slice(4,5).repeat(2),16),wt.toColor(At,Bt,Ot,mt);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return At=parseInt(s[1]),Bt=parseInt(s[2]),Ot=parseInt(s[3]),mt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),wt.toColor(At,Bt,Ot,mt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[At,Bt,Ot,mt]=t.getImageData(0,0,1,1).data,mt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:wt.toRgba(At,Bt,Ot,mt),css:i}}e.toColor=n})(ct||(ct={}));var er;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,s){let o=n/255,l=i/255,a=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return c*.2126+d*.7152+h*.0722}e.relativeLuminance2=r})(er||(er={}));var ma;(e=>{function t(o,l){if(mt=(l&255)/255,mt===1)return l;let a=l>>24&255,c=l>>16&255,d=l>>8&255,h=o>>24&255,f=o>>16&255,p=o>>8&255;return At=h+Math.round((a-h)*mt),Bt=f+Math.round((c-f)*mt),Ot=p+Math.round((d-p)*mt),wt.toRgba(At,Bt,Ot)}e.blend=t;function r(o,l,a){let c=er.relativeLuminance(o>>8),d=er.relativeLuminance(l>>8);if(vn(c,d)<a){if(d<c){let p=n(o,l,a),m=vn(c,er.relativeLuminance(p>>8));if(m<a){let g=i(o,l,a),S=vn(c,er.relativeLuminance(g>>8));return m>S?p:g}return p}let h=i(o,l,a),f=vn(c,er.relativeLuminance(h>>8));if(f<a){let p=n(o,l,a),m=vn(c,er.relativeLuminance(p>>8));return f>m?h:p}return h}}e.ensureContrastRatio=r;function n(o,l,a){let c=o>>24&255,d=o>>16&255,h=o>>8&255,f=l>>24&255,p=l>>16&255,m=l>>8&255,g=vn(er.relativeLuminance2(f,p,m),er.relativeLuminance2(c,d,h));for(;g<a&&(f>0||p>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m-=Math.max(0,Math.ceil(m*.1)),g=vn(er.relativeLuminance2(f,p,m),er.relativeLuminance2(c,d,h));return(f<<24|p<<16|m<<8|255)>>>0}e.reduceLuminance=n;function i(o,l,a){let c=o>>24&255,d=o>>16&255,h=o>>8&255,f=l>>24&255,p=l>>16&255,m=l>>8&255,g=vn(er.relativeLuminance2(f,p,m),er.relativeLuminance2(c,d,h));for(;g<a&&(f<255||p<255||m<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),g=vn(er.relativeLuminance2(f,p,m),er.relativeLuminance2(c,d,h));return(f<<24|p<<16|m<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(ma||(ma={}));function bi(e){let t=e.toString(16);return t.length<2?"0"+t:t}function vn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var j4=class extends _l{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()]}},Ja=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Hr}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),i=0,s=0,o=0,l=t.getFg(0),a=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==a){if(c-i>1){let d=this._getJoinedRanges(n,o,s,t,i);for(let h=0;h<d.length;h++)r.push(d[h])}i=c,o=s,l=this._workCell.fg,a=this._workCell.bg}s+=this._workCell.getChars().length||ei.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(n,o,s,t,i);for(let d=0;d<c.length;d++)r.push(c[d])}return r}_getJoinedRanges(e,t,r,n,i){let s=e.substring(t,r),o=[];try{o=this._characterJoiners[0].handler(s)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let a=this._characterJoiners[l].handler(s);for(let c=0;c<a.length;c++)Ja._mergeRanges(o,a[c])}catch(a){console.error(a)}return this._stringRangesToCellRanges(o,n,i),o}_stringRangesToCellRanges(e,t,r){let n=0,i=!1,s=0,o=e[n];if(o){for(let l=r;l<this._bufferService.cols;l++){let a=t.getWidth(l),c=t.getString(l).length||ei.length;if(a!==0){if(!i&&o[0]<=s&&(o[0]=l,i=!0),o[1]<=s){if(o[1]=l,o=e[++n],!o)break;o[0]<=s?(o[0]=l,i=!0):i=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(r){if(t[1]<=i[0])return e[n-1][1]=t[1],e;if(t[1]<=i[1])return e[n-1][1]=Math.max(t[1],i[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=i[0])return e.splice(n,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Ja=_t([ge(0,or)],Ja);function A4(e){return 57508<=e&&e<=57558}function B4(e){return 9472<=e&&e<=9631}function O4(e){return A4(e)||B4(e)}function z4(){return{css:{canvas:Ul(),cell:Ul()},device:{canvas:Ul(),cell:Ul(),char:{width:0,height:0,left:0,top:0}}}}function Ul(){return{width:0,height:0}}var bd=class{constructor(e,t,r,n,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new Hr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,i,s,o,l,a,c,d){let h=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();r&&m<s+1&&(m=s+1);let g,S=0,_="",x=0,w=0,N=0,L=0,C=!1,F=0,P=!1,q=0,E=0,A=[],R=c!==-1&&d!==-1;for(let T=0;T<m;T++){e.loadCell(T,this._workCell);let $=this._workCell.getWidth();if($===0)continue;let z=!1,D=T>=E,H=T,I=this._workCell;if(f.length>0&&T===f[0][0]&&D){let G=f.shift(),me=this._isCellInSelection(G[0],t);for(x=G[0]+1;x<G[1];x++)D&&(D=me===this._isCellInSelection(x,t));D&&(D=!r||s<G[0]||s>=G[1]),D?(z=!0,I=new j4(this._workCell,e.translateToString(!0,G[0],G[1]),G[1]-G[0]),H=G[1]-1,$=I.getWidth()):E=G[1]}let W=this._isCellInSelection(T,t),y=r&&T===s,J=R&&T>=c&&T<=d,ae=!1;this._decorationService.forEachDecorationAtCell(T,t,void 0,G=>{ae=!0});let k=I.getChars()||ei;if(k===" "&&(I.isUnderline()||I.isOverline())&&(k=" "),q=$*l-a.get(k,I.isBold(),I.isItalic()),!g)g=this._document.createElement("span");else if(S&&(W&&P||!W&&!P&&I.bg===w)&&(W&&P&&p.selectionForeground||I.fg===N)&&I.extended.ext===L&&J===C&&q===F&&!y&&!z&&!ae&&D){I.isInvisible()?_+=ei:_+=k,S++;continue}else S&&(g.textContent=_),g=this._document.createElement("span"),S=0,_="";if(w=I.bg,N=I.fg,L=I.extended.ext,C=J,F=q,P=W,z&&s>=T&&s<=H&&(s=T),!this._coreService.isCursorHidden&&y&&this._coreService.isCursorInitialized){if(A.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&A.push("xterm-cursor-blink"),A.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":A.push("xterm-cursor-outline");break;case"block":A.push("xterm-cursor-block");break;case"bar":A.push("xterm-cursor-bar");break;case"underline":A.push("xterm-cursor-underline");break}}if(I.isBold()&&A.push("xterm-bold"),I.isItalic()&&A.push("xterm-italic"),I.isDim()&&A.push("xterm-dim"),I.isInvisible()?_=ei:_=I.getChars()||ei,I.isUnderline()&&(A.push(`xterm-underline-${I.extended.underlineStyle}`),_===" "&&(_=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${_l.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let G=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&G<8&&(G+=8),g.style.textDecorationColor=p.ansi[G].css}I.isOverline()&&(A.push("xterm-overline"),_===" "&&(_=" ")),I.isStrikethrough()&&A.push("xterm-strikethrough"),J&&(g.style.textDecoration="underline");let we=I.getFgColor(),U=I.getFgColorMode(),Y=I.getBgColor(),te=I.getBgColorMode(),fe=!!I.isInverse();if(fe){let G=we;we=Y,Y=G;let me=U;U=te,te=me}let de,Oe,Ve=!1;this._decorationService.forEachDecorationAtCell(T,t,void 0,G=>{G.options.layer!=="top"&&Ve||(G.backgroundColorRGB&&(te=50331648,Y=G.backgroundColorRGB.rgba>>8&16777215,de=G.backgroundColorRGB),G.foregroundColorRGB&&(U=50331648,we=G.foregroundColorRGB.rgba>>8&16777215,Oe=G.foregroundColorRGB),Ve=G.options.layer==="top")}),!Ve&&W&&(de=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Y=de.rgba>>8&16777215,te=50331648,Ve=!0,p.selectionForeground&&(U=50331648,we=p.selectionForeground.rgba>>8&16777215,Oe=p.selectionForeground)),Ve&&A.push("xterm-decoration-top");let Ie;switch(te){case 16777216:case 33554432:Ie=p.ansi[Y],A.push(`xterm-bg-${Y}`);break;case 50331648:Ie=wt.toColor(Y>>16,Y>>8&255,Y&255),this._addStyle(g,`background-color:#${d_((Y>>>0).toString(16),"0",6)}`);break;case 0:default:fe?(Ie=p.foreground,A.push("xterm-bg-257")):Ie=p.background}switch(de||I.isDim()&&(de=nt.multiplyOpacity(Ie,.5)),U){case 16777216:case 33554432:I.isBold()&&we<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(we+=8),this._applyMinimumContrast(g,Ie,p.ansi[we],I,de,void 0)||A.push(`xterm-fg-${we}`);break;case 50331648:let G=wt.toColor(we>>16&255,we>>8&255,we&255);this._applyMinimumContrast(g,Ie,G,I,de,Oe)||this._addStyle(g,`color:#${d_(we.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,Ie,p.foreground,I,de,Oe)||fe&&A.push("xterm-fg-257")}A.length&&(g.className=A.join(" "),A.length=0),!y&&!z&&!ae&&D?S++:g.textContent=_,q!==this.defaultSpacing&&(g.style.letterSpacing=`${q}px`),h.push(g),T=H}return g&&S&&(g.textContent=_),h}_applyMinimumContrast(e,t,r,n,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||O4(n.getCode()))return!1;let o=this._getContrastCache(n),l;if(!i&&!s&&(l=o.getColor(t.rgba,r.rgba)),l===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);l=nt.ensureContrastRatio(i||t,s||r,a),o.setColor((i||t).rgba,(s||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let 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]}};bd=_t([ge(1,o1),ge(2,lr),ge(3,An),ge(4,Gi),ge(5,vl),ge(6,Fs)],bd);function d_(e,t,r){for(;e.length<r;)e=t+e;return e}var $4=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[r,n,i,s],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(s),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 o=this._measure(e,0);return o>0&&(this._flat[n]=o),o}let i=e;t&&(i+="B"),r&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),r&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},F4=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 i=e.buffers.active.ydisp,s=t[1]-i,o=r[1]-i,l=Math.max(s,0),a=Math.min(o,e.rows-1);if(l>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=a,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 W4(){return new F4}var Lu="xterm-dom-renderer-owner-",Ir="xterm-rows",Vl="xterm-fg-",f_="xterm-bg-",ro="xterm-focus",Kl="xterm-selection",H4=1,wd=class extends Be{constructor(e,t,r,n,i,s,o,l,a,c,d,h,f,p){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=a,this._optionsService=c,this._bufferService=d,this._coreService=h,this._coreBrowserService=f,this._themeService=p,this._terminalClass=H4++,this._rowElements=[],this._selectionRenderModel=W4(),this.onRequestRedraw=this._register(new se).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ir),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(Kl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=z4(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(bd,document),this._element.classList.add(Lu+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(ot(()=>{this._element.classList.remove(Lu+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new $4(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} .${Ir} 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} .${Ir} { 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} .${Ir} .xterm-dim { color: ${nt.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}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Ir}.${ro} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Ir}.${ro} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Ir}.${ro} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Ir} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Ir} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Ir} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Ir} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Ir} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Kl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Kl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Kl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${Vl}${s} { color: ${o.css}; }${this._terminalSelector} .${Vl}${s}.xterm-dim { color: ${nt.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${f_}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${Vl}257 { color: ${nt.opaque(e.background).css}; }${this._terminalSelector} .${Vl}257.xterm-dim { color: ${nt.multiplyOpacity(nt.opaque(e.background),.5).css}; }${this._terminalSelector} .${f_}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(ro),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ro),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,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let a=e[0]>t[0];l.appendChild(this._createSelectionElement(s,a?t[0]:e[0],a?e[0]:t[0],o-s+1))}else{let a=n===s?e[0]:0,c=s===i?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(s,a,c));let d=o-s-1;if(l.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,d)),s!==o){let h=i===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,r,n=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(r-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${n*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}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,i=Math.min(r.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=t;a++){let c=a+r.ydisp,d=this._rowElements[a],h=r.lines.get(c);if(!d||!h)break;d.replaceChildren(...this._rowFactory.createRow(h,c,c===n,o,l,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Lu}${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,i,s){r<0&&(e=0),n<0&&(t=0);let o=this._bufferService.rows-1;r=Math.max(Math.min(r,o),0),n=Math.max(Math.min(n,o),0),i=Math.min(i,this._bufferService.cols);let l=this._bufferService.buffer,a=l.ybase+l.y,c=Math.min(l.x,i-1),d=this._optionsService.rawOptions.cursorBlink,h=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=r;p<=n;++p){let m=p+l.ydisp,g=this._rowElements[p],S=l.lines.get(m);if(!g||!S)break;g.replaceChildren(...this._rowFactory.createRow(S,m,m===a,h,f,c,d,this.dimensions.css.cell.width,this._widthCache,s?p===r?e:0:-1,s?(p===n?t:i)-1:-1))}}};wd=_t([ge(7,tp),ge(8,Tc),ge(9,lr),ge(10,or),ge(11,Gi),ge(12,An),ge(13,Fs)],wd);var Sd=class extends Be{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new se),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new V4(this._optionsService))}catch{this._measureStrategy=this._register(new U4(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())}};Sd=_t([ge(2,lr)],Sd);var C1=class extends Be{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)}},U4=class extends C1{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}},V4=class extends C1{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}},K4=class extends Be{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 q4(this._window)),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new se),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Ht.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Le(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Le(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}},q4=class extends Be{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Is),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ot(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Le(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)}},Y4=class extends Be{constructor(){super(),this.linkProviders=[],this._register(ot(()=>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 cp(e,t,r){let n=r.getBoundingClientRect(),i=e.getComputedStyle(r),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-n.left-s,t.clientY-n.top-o]}function X4(e,t,r,n,i,s,o,l,a){if(!s)return;let c=cp(e,t,r);if(c)return c[0]=Math.ceil((c[0]+(a?o/2:0))/o),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),n+(a?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var kd=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return X4(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let r=cp(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])}}};kd=_t([ge(0,Bn),ge(1,Tc)],kd);var G4=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=[]}},E1={};oT(E1,{getSafariVersion:()=>J4,isChromeOS:()=>L1,isFirefox:()=>N1,isIpad:()=>Z4,isIphone:()=>eL,isLegacyEdge:()=>Q4,isLinux:()=>up,isMac:()=>Za,isNode:()=>Lc,isSafari:()=>P1,isWindows:()=>T1});var Lc=typeof process<"u"&&"title"in process,xl=Lc?"node":navigator.userAgent,yl=Lc?"node":navigator.platform,N1=xl.includes("Firefox"),Q4=xl.includes("Edge"),P1=/^((?!chrome|android).)*safari/i.test(xl);function J4(){if(!P1)return 0;let e=xl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Za=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(yl),Z4=yl==="iPad",eL=yl==="iPhone",T1=["Windows","Win16","Win32","WinCE"].includes(yl),up=yl.indexOf("Linux")>=0,L1=/\bCrOS\b/.test(xl),R1=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(),i=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),i=e.timeRemaining(),r*1.5>i){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=i}this.clear()}},tL=class extends R1{_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())}}},rL=class extends R1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ec=!Lc&&"requestIdleCallback"in window?rL:tL,nL=class{constructor(){this._queue=new ec}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Cd=class extends Be{constructor(e,t,r,n,i,s,o,l,a){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=i,this._coreBrowserService=l,this._renderer=this._register(new Is),this._pausedResizeTask=new nL,this._observerDisposable=this._register(new Is),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 se),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new se),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new se),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new G4((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new iL(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ot(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,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=ot(()=>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()}};Cd=_t([ge(2,lr),ge(3,Tc),ge(4,Gi),ge(5,vl),ge(6,or),ge(7,An),ge(8,Fs)],Cd);var iL=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 sL(e,t,r,n){let i=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return aL(i,s,e,t,r,n)+Rc(s,t,r,n)+cL(i,s,e,t,r,n);let o;if(s===t)return o=i>e?"D":"C",nl(Math.abs(i-e),rl(o,n));o=s>t?"D":"C";let l=Math.abs(s-t),a=lL(s>t?e:i,r)+(l-1)*r.cols+1+oL(s>t?i:e);return nl(a,rl(o,n))}function oL(e,t){return e-1}function lL(e,t){return t.cols-e}function aL(e,t,r,n,i,s){return Rc(t,n,i,s).length===0?"":nl(I1(e,t,e,t-Ki(t,i),!1,i).length,rl("D",s))}function Rc(e,t,r,n){let i=e-Ki(e,r),s=t-Ki(t,r),o=Math.abs(i-s)-uL(e,t,r);return nl(o,rl(M1(e,t),n))}function cL(e,t,r,n,i,s){let o;Rc(t,n,i,s).length>0?o=n-Ki(n,i):o=t;let l=n,a=hL(e,t,r,n,i,s);return nl(I1(e,o,r,l,a==="C",i).length,rl(a,s))}function uL(e,t,r){var o;let n=0,i=e-Ki(e,r),s=t-Ki(t,r);for(let l=0;l<Math.abs(i-s);l++){let a=M1(e,t)==="A"?-1:1;(o=r.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&n++}return n}function Ki(e,t){let r=0,n=t.buffer.lines.get(e),i=n==null?void 0:n.isWrapped;for(;i&&e>=0&&e<t.rows;)r++,n=t.buffer.lines.get(--e),i=n==null?void 0:n.isWrapped;return r}function hL(e,t,r,n,i,s){let o;return Rc(r,n,i,s).length>0?o=n-Ki(n,i):o=t,e<r&&o<=n||e>=r&&o<n?"C":"D"}function M1(e,t){return e>t?"A":"B"}function I1(e,t,r,n,i,s){let o=e,l=t,a="";for(;(o!==r||l!==n)&&l>=0&&l<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(a+=s.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!i&&o<0&&(a+=s.buffer.translateBufferLineToString(l,!1,0,e+1),o=s.cols-1,e=o,l--);return a+s.buffer.translateBufferLineToString(l,!1,e,o)}function rl(e,t){let r=t?"O":"[";return Z.ESC+r+e}function nl(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var dL=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 p_(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 Ru=50,fL=15,pL=50,mL=500,gL=" ",_L=new RegExp(gL,"g"),Ed=class extends Be{constructor(e,t,r,n,i,s,o,l,a){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=l,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Hr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new se),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new se),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new dL(this._bufferService),this._activeSelectionMode=0,this._register(ot(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.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 i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=r.translateBufferLineToString(o,!0,i,s);n.push(l)}}else{let i=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=r.lines.get(s),l=r.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?n[n.length-1]+=l:n.push(l)}if(e[1]!==t[1]){let s=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?n[n.length-1]+=o:n.push(o)}}return n.map(i=>i.replace(_L," ")).join(T1?`\r
|
|
132
132
|
`:`
|
|
133
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),up&&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 i,s;let r=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=p_(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=cp(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,-Ru),Ru),t/=Ru,t/Math.abs(t)+Math.round(t*(fL-1)))}shouldForceSelection(e){return Za?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(),pL)}_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&&!(Za&&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<mL&&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=sL(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 i=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:i>1&&t!==n&&(r+=i-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 i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(s,e[0]),a=l,c=e[0]-l,d=0,h=0,f=0,p=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;a<o.length&&o.charAt(a+1)===" ";)a++}else{let S=e[0],_=e[0];s.getWidth(S)===0&&(d++,S--),s.getWidth(_)===2&&(h++,_++);let x=s.getString(_).length;for(x>1&&(p+=x-1,a+=x-1);S>0&&l>0&&!this._isCharWordSeparator(s.loadCell(S-1,this._workCell));){s.loadCell(S-1,this._workCell);let w=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,S--):w>1&&(f+=w-1,l-=w-1),l--,S--}for(;_<s.length&&a+1<o.length&&!this._isCharWordSeparator(s.loadCell(_+1,this._workCell));){s.loadCell(_+1,this._workCell);let w=this._workCell.getChars().length;this._workCell.getWidth()===2?(h++,_++):w>1&&(p+=w-1,a+=w-1),a++,_++}}a++;let m=l+c-d+f,g=Math.min(this._bufferService.cols,a-l+d+h-f-p);if(!(!t&&o.slice(l,a).trim()==="")){if(r&&m===0&&s.getCodePoint(0)!==32){let S=i.lines.get(e[1]-1);if(S&&s.isWrapped&&S.getCodePoint(this._bufferService.cols-1)!==32){let _=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(_){let x=this._bufferService.cols-_.start;m-=x,g+=x}}}if(n&&m+g===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let S=i.lines.get(e[1]+1);if(S!=null&&S.isWrapped&&S.getCodePoint(0)!==32){let _=this._getWordAt([0,e[1]+1],!1,!1,!0);_&&(g+=_.length)}}return{start:m,length:g}}}_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=p_(r,this._bufferService.cols)}};Ed=_t([ge(3,or),ge(4,Gi),ge(5,rp),ge(6,lr),ge(7,Bn),ge(8,An)],Ed);var m_=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={}}},g_=class{constructor(){this._color=new m_,this._css=new m_}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()}},Et=Object.freeze((()=>{let e=[ct.toColor("#2e3436"),ct.toColor("#cc0000"),ct.toColor("#4e9a06"),ct.toColor("#c4a000"),ct.toColor("#3465a4"),ct.toColor("#75507b"),ct.toColor("#06989a"),ct.toColor("#d3d7cf"),ct.toColor("#555753"),ct.toColor("#ef2929"),ct.toColor("#8ae234"),ct.toColor("#fce94f"),ct.toColor("#729fcf"),ct.toColor("#ad7fa8"),ct.toColor("#34e2e2"),ct.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],i=t[r/6%6|0],s=t[r%6];e.push({css:wt.toCss(n,i,s),rgba:wt.toRgba(n,i,s)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:wt.toCss(n,n,n),rgba:wt.toRgba(n,n,n)})}return e})()),Ti=ct.toColor("#ffffff"),mo=ct.toColor("#000000"),__=ct.toColor("#ffffff"),v_=mo,no={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},vL=Ti,Nd=class extends Be{constructor(e){super(),this._optionsService=e,this._contrastCache=new g_,this._halfContrastCache=new g_,this._onChangeColors=this._register(new se),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ti,background:mo,cursor:__,cursorAccent:v_,selectionForeground:void 0,selectionBackgroundTransparent:no,selectionBackgroundOpaque:nt.blend(mo,no),selectionInactiveBackgroundTransparent:no,selectionInactiveBackgroundOpaque:nt.blend(mo,no),scrollbarSliderBackground:nt.opacity(Ti,.2),scrollbarSliderHoverBackground:nt.opacity(Ti,.4),scrollbarSliderActiveBackground:nt.opacity(Ti,.5),overviewRulerBorder:Ti,ansi:Et.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=Je(e.foreground,Ti),t.background=Je(e.background,mo),t.cursor=nt.blend(t.background,Je(e.cursor,__)),t.cursorAccent=nt.blend(t.background,Je(e.cursorAccent,v_)),t.selectionBackgroundTransparent=Je(e.selectionBackground,no),t.selectionBackgroundOpaque=nt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Je(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=nt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Je(e.selectionForeground,h_):void 0,t.selectionForeground===h_&&(t.selectionForeground=void 0),nt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=nt.opacity(t.selectionBackgroundTransparent,.3)),nt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=nt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Je(e.scrollbarSliderBackground,nt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Je(e.scrollbarSliderHoverBackground,nt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Je(e.scrollbarSliderActiveBackground,nt.opacity(t.foreground,.5)),t.overviewRulerBorder=Je(e.overviewRulerBorder,vL),t.ansi=Et.slice(),t.ansi[0]=Je(e.black,Et[0]),t.ansi[1]=Je(e.red,Et[1]),t.ansi[2]=Je(e.green,Et[2]),t.ansi[3]=Je(e.yellow,Et[3]),t.ansi[4]=Je(e.blue,Et[4]),t.ansi[5]=Je(e.magenta,Et[5]),t.ansi[6]=Je(e.cyan,Et[6]),t.ansi[7]=Je(e.white,Et[7]),t.ansi[8]=Je(e.brightBlack,Et[8]),t.ansi[9]=Je(e.brightRed,Et[9]),t.ansi[10]=Je(e.brightGreen,Et[10]),t.ansi[11]=Je(e.brightYellow,Et[11]),t.ansi[12]=Je(e.brightBlue,Et[12]),t.ansi[13]=Je(e.brightMagenta,Et[13]),t.ansi[14]=Je(e.brightCyan,Et[14]),t.ansi[15]=Je(e.brightWhite,Et[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]=Je(e.extendedAnsi[n],Et[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()}}};Nd=_t([ge(0,lr)],Nd);function Je(e,t){if(e!==void 0)try{return ct.toColor(e)}catch{}return t}var xL=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)}},yL=class{constructor(){this._services=new xL,this._services.set(tp,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=fP(e).sort((s,o)=>s.index-o.index),n=[];for(let s of r){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);n.push(o)}let i=r.length>0?r[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},bL={trace:0,debug:1,info:2,warn:3,error:4,off:5},wL="xterm.js: ",Td=class extends Be{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=bL[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?"":wL)+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)}};Td=_t([ge(0,lr)],Td);var x_=class extends Be{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new se),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new se),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new se),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 i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));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}},je=3,bt=Object.freeze(new _l),ql=0,Mu=2,go=class D1{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*je);let i=r||Hr.fromCharData([0,Zy,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let r=this._data[t*je+0],n=r&2097151;return[this._data[t*je+1],r&2097152?this._combined[t]:n?Yn(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*je+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*je+0]=t|2097152|r[2]<<22):this._data[t*je+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*je+0]>>22}hasWidth(t){return this._data[t*je+0]&12582912}getFg(t){return this._data[t*je+1]}getBg(t){return this._data[t*je+2]}hasContent(t){return this._data[t*je+0]&4194303}getCodePoint(t){let r=this._data[t*je+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*je+0]&2097152}getString(t){let r=this._data[t*je+0];return r&2097152?this._combined[t]:r&2097151?Yn(r&2097151):""}isProtected(t){return this._data[t*je+2]&536870912}loadCell(t,r){return ql=t*je,r.content=this._data[ql+0],r.fg=this._data[ql+1],r.bg=this._data[ql+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*je+0]=r.content,this._data[t*je+1]=r.fg,this._data[t*je+2]=r.bg}setCellFromCodepoint(t,r,n,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*je+0]=r|n<<22,this._data[t*je+1]=i.fg,this._data[t*je+2]=i.bg}addCodepointToCell(t,r,n){let i=this._data[t*je+0];i&2097152?this._combined[t]+=Yn(r):i&2097151?(this._combined[t]=Yn(i&2097151)+Yn(r),i&=-2097152,i|=2097152):i=r|1<<22,n&&(i&=-12582913,i|=n<<22),this._data[t*je+0]=i}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 i=new Hr;for(let s=this.length-t-r-1;s>=0;--s)this.setCell(t+r+s,this.loadCell(t+s,i));for(let s=0;s<r;++s)this.setCell(t+s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,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 i=new Hr;for(let s=0;s<this.length-t-r;++s)this.setCell(t+s,this.loadCell(t+r+s,i));for(let s=this.length-r;s<this.length;++s)this.setCell(s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,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,i=!1){if(i){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*Mu<this._data.buffer.byteLength;let n=t*je;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let i=new Uint32Array(n);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,r)}else{this._data=this._data.subarray(0,n);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let l=parseInt(i[o],10);l>=t&&delete this._combined[l]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,n*4*Mu<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Mu<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 D1(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*je+0]&4194303)return t+(this._data[t*je+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*je+0]&4194303||this._data[t*je+2]&50331648)return t+(this._data[t*je+0]>>22);return 0}copyCellsFrom(t,r,n,i,s){let o=t._data;if(s)for(let a=i-1;a>=0;a--){for(let c=0;c<je;c++)this._data[(n+a)*je+c]=o[(r+a)*je+c];o[(r+a)*je+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}else for(let a=0;a<i;a++){for(let c=0;c<je;c++)this._data[(n+a)*je+c]=o[(r+a)*je+c];o[(r+a)*je+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}let l=Object.keys(t._combined);for(let a=0;a<l.length;a++){let c=parseInt(l[a],10);c>=r&&(this._combined[c-r+n]=t._combined[c])}}translateToString(t,r,n,i){r=r??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;r<n;){let o=this._data[r*je+0],l=o&2097151,a=o&2097152?this._combined[r]:l?Yn(l):ei;if(s+=a,i)for(let c=0;c<a.length;++c)i.push(r);r+=o>>22||1}return i&&i.push(r),s}};function SL(e,t,r,n,i,s){let o=[];for(let l=0;l<e.length-1;l++){let a=l,c=e.get(++a);if(!c.isWrapped)continue;let d=[e.get(l)];for(;a<e.length&&c.isWrapped;)d.push(c),c=e.get(++a);if(!s&&n>=l&&n<a){l+=d.length-1;continue}let h=0,f=il(d,h,t),p=1,m=0;for(;p<d.length;){let S=il(d,p,t),_=S-m,x=r-f,w=Math.min(_,x);d[h].copyCellsFrom(d[p],m,f,w,!1),f+=w,f===r&&(h++,f=0),m+=w,m===S&&(p++,m=0),f===0&&h!==0&&d[h-1].getWidth(r-1)===2&&(d[h].copyCellsFrom(d[h-1],r-1,f++,1,!1),d[h-1].setCell(r-1,i))}d[h].replaceCells(f,r,i);let g=0;for(let S=d.length-1;S>0&&(S>h||d[S].getTrimmedLength()===0);S--)g++;g>0&&(o.push(l+d.length-g),o.push(g)),l+=d.length-1}return o}function kL(e,t){let r=[],n=0,i=t[n],s=0;for(let o=0;o<e.length;o++)if(i===o){let l=t[++n];e.onDeleteEmitter.fire({index:o-s,amount:l}),o+=l-1,s+=l,i=t[++n]}else r.push(o);return{layout:r,countRemoved:s}}function CL(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 EL(e,t,r){let n=[],i=e.map((a,c)=>il(e,c,t)).reduce((a,c)=>a+c),s=0,o=0,l=0;for(;l<i;){if(i-l<r){n.push(i-l);break}s+=r;let a=il(e,o,t);s>a&&(s-=a,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let d=c?r-1:r;n.push(d),l+=d}return n}function il(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,i=e[t+1].getWidth(0)===2;return n&&i?r-1:r}var j1=class A1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=A1._nextId++,this._onDispose=this.register(new se),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Vi(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};j1._nextId=1;var NL=j1,Rt={},Pi=Rt.B;Rt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Rt.A={"#":"£"};Rt.B=void 0;Rt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Rt.C=Rt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Rt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Rt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Rt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Rt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Rt.E=Rt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Rt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Rt.H=Rt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Rt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var y_=4294967295,b_=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=bt.clone(),this.savedCharset=Pi,this.markers=[],this._nullCell=Hr.fromCharData([0,Zy,1,0]),this._whitespaceCell=Hr.fromCharData([0,ei,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ec,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new x_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Ga),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Ga),this._whitespaceCell}getBlankLine(e,t){return new go(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>y_?y_:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=bt);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 x_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(bt),n=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)n+=+this.lines.get(o).resize(e,r);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new go(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new go(e,r)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let o=this.lines.length-i;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),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 s=0;s<this.lines.length;s++)n+=+this.lines.get(s).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=SL(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(bt),r);if(n.length>0){let i=kL(this.lines,n);CL(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(bt),i=r;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new go(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(bt),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let a=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),a.unshift(l);if(!r){let w=this.ybase+this.y;if(w>=o&&w<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),d=EL(a,this._cols,e),h=d.length-a.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+h):f=Math.max(0,this.lines.length-this.lines.maxLength+h);let p=[];for(let w=0;w<h;w++){let N=this.getBlankLine(bt,!0);p.push(N)}p.length>0&&(i.push({start:o+a.length+s,newLines:p}),s+=p.length),a.push(...p);let m=d.length-1,g=d[m];g===0&&(m--,g=d[m]);let S=a.length-h-1,_=c;for(;S>=0;){let w=Math.min(_,g);if(a[m]===void 0)break;if(a[m].copyCellsFrom(a[S],_-w,g-w,w,!0),g-=w,g===0&&(m--,g=d[m]),_-=w,_===0){S--;let N=Math.max(S,0);_=il(a,N,this._cols)}}for(let w=0;w<a.length;w++)d[w]<e&&a[w].setCell(d[w],n);let x=h-f;for(;x-- >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+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+h,this.ybase+t-1)}if(i.length>0){let o=[],l=[];for(let g=0;g<this.lines.length;g++)l.push(this.lines.get(g));let a=this.lines.length,c=a-1,d=0,h=i[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let f=0;for(let g=Math.min(this.lines.maxLength-1,a+s-1);g>=0;g--)if(h&&h.start>c+f){for(let S=h.newLines.length-1;S>=0;S--)this.lines.set(g--,h.newLines[S]);g++,o.push({index:c+1,amount:h.newLines.length}),f+=h.newLines.length,h=i[++d]}else this.lines.set(g,l[c--]);let p=0;for(let g=o.length-1;g>=0;g--)o[g].index+=p,this.lines.onInsertEmitter.fire(o[g]),p+=o[g].amount;let m=Math.max(0,a+s-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,r=0,n){let i=this.lines.get(e);return i?i.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 NL(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)}},TL=class extends Be{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new se),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 b_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new b_(!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)}},B1=2,O1=1,Pd=class extends Be{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,B1),this.rows=Math.max(e.rawOptions.rows||0,O1),this.buffers=this._register(new TL(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 i=r.ybase+r.scrollTop,s=r.ybase+r.scrollBottom;if(r.scrollTop===0){let o=r.lines.isFull;s===r.lines.length-1?o?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(s+1,0,n.clone()),o?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let o=s-i+1;r.lines.shiftElements(i+1,o-1,-1),r.lines.set(s,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))}};Pd=_t([ge(0,lr)],Pd);var rs={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:Za,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},PL=["normal","bold","100","200","300","400","500","600","700","800","900"],LL=class extends Be{constructor(e){super(),this._onOptionChange=this._register(new se),this.onOptionChange=this._onOptionChange.event;let t={...rs};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(ot(()=>{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 rs))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in rs))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=rs[e]),!RL(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=rs[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=PL.includes(t)?t:rs[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 RL(e){return e==="block"||e==="underline"||e==="bar"}function _o(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]&&_o(e[n],t-1);return r}var w_=Object.freeze({insertMode:!1}),S_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Ld=class extends Be{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 se),this.onData=this._onData.event,this._onUserInput=this._register(new se),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new se),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=_o(w_),this.decPrivateModes=_o(S_)}reset(){this.modes=_o(w_),this.decPrivateModes=_o(S_)}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))}};Ld=_t([ge(0,or),ge(1,i1),ge(2,lr)],Ld);var k_={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 Iu(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 Du=String.fromCharCode,C_={DEFAULT:e=>{let t=[Iu(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Du(t[0])}${Du(t[1])}${Du(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Iu(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Iu(e,!0)};${e.x};${e.y}${t}`}},Rd=class extends Be{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 se),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(k_))this.addProtocol(n,k_[n]);for(let n of Object.keys(C_))this.addEncoding(n,C_[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,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=n+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_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)}};Rd=_t([ge(0,or),ge(1,Gi),ge(2,lr)],Rd);var ju=[[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]],ML=[[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]],Nt;function IL(e,t){let r=0,n=t.length-1,i;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(i=r+n>>1,e>t[i][1])r=i+1;else if(e<t[i][0])n=i-1;else return!0;return!1}var DL=class{constructor(){if(this.version="6",!Nt){Nt=new Uint8Array(65536),Nt.fill(1),Nt[0]=0,Nt.fill(0,1,32),Nt.fill(0,127,160),Nt.fill(2,4352,4448),Nt[9001]=2,Nt[9002]=2,Nt.fill(2,11904,42192),Nt[12351]=1,Nt.fill(2,44032,55204),Nt.fill(2,63744,64256),Nt.fill(2,65040,65050),Nt.fill(2,65072,65136),Nt.fill(2,65280,65377),Nt.fill(2,65504,65511);for(let e=0;e<ju.length;++e)Nt.fill(0,ju[e][0],ju[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Nt[e]:IL(e,ML)?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 i=Di.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return Di.createPropertyValue(0,r,n)}},Di=class ga{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new se,this.onChange=this._onChange.event;let t=new DL;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,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return r+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:r+=this.wcwidth(c)}let l=this.charProperties(o,n),a=ga.extractWidth(l);ga.extractShouldJoin(l)&&(a-=ga.extractWidth(n)),r+=a,n=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},jL=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 E_(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 io=2147483647,AL=256,z1=class Md{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>AL)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 Md;if(!t.length)return r;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let i=t[n];if(Array.isArray(i))for(let s=0;s<i.length;++s)r.addSubParam(i[s]);else r.addParam(i)}return r}clone(){let t=new Md(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,i=this._subParamsIdx[r]&255;i-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,i))}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>io?io: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>io?io: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,i=this._subParamsIdx[r]&255;i-n>0&&(t[r]=this._subParams.slice(n,i))}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,i=n[r-1];n[r-1]=~i?Math.min(i*10+t,io):t}},so=[],BL=class{constructor(){this._state=0,this._active=so,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=so}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=so,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||so,!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",Tc(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,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&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=so,this._id=-1,this._state=0}}},Sr=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+=Tc(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}},oo=[],OL=class{constructor(){this._handlers=Object.create(null),this._active=oo,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=oo}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=oo,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||oo,!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",Tc(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,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&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=oo,this._ident=0}},vo=new z1;vo.addParam(0);var N_=class{constructor(e){this._handler=e,this._data="",this._params=vo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():vo,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Tc(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=vo,this._data="",this._hitLimit=!1,r));return this._params=vo,this._data="",this._hitLimit=!1,t}},zL=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 i=0;i<e.length;i++)this.table[t<<8|e[i]]=r<<4|n}},Br=160,$L=function(){let e=new zL(4095),t=Array.apply(null,Array(256)).map((l,a)=>a),r=(l,a)=>t.slice(l,a),n=r(32,127),i=r(0,24);i.push(25),i.push.apply(i,r(28,32));let s=r(0,14),o;e.setDefault(1,0),e.addMany(n,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,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(i,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(i,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(i,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(i,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(i,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(i,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(Br,0,2,0),e.add(Br,8,5,8),e.add(Br,6,0,6),e.add(Br,11,0,11),e.add(Br,13,13,13),e}(),FL=class extends Be{constructor(e=$L){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 z1,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(ot(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new BL),this._dcsParser=this._register(new OL),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 i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=s}}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 i=n.indexOf(t);i!==-1&&n.splice(i,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 i=n.indexOf(t);i!==-1&&n.splice(i,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,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=i}parse(e,t,r){let n=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=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 l=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](this._params),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 4:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(n!==24&&n!==26,r),o)return o;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],o=this._oscParser.end(n!==24&&n!==26,r),o)return o;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=s;l<t;++l){switch(n=e[l],i=this._transitions.table[this.currentState<<8|(n<160?n:Br)],i>>4){case 2:for(let f=l+1;;++f){if(f>=t||(n=e[f])<32||n>126&&n<Br){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Br){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Br){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Br){this._printHandler(e,l,f),l=f-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:l,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|n],c=a?a.length-1:-1;for(;c>=0&&(o=a[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,a,c,i,l),o;c<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(++l<t&&(n=e[l])>47&&n<60);l--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let d=this._escHandlers[this._collect<<8|n],h=d?d.length-1:-1;for(;h>=0&&(o=d[h](),o!==!0);h--)if(o instanceof Promise)return this._preserveStack(4,d,h,i,l),o;h<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 f=l+1;;++f)if(f>=t||(n=e[f])===24||n===26||n===27||n>127&&n<Br){this._dcsParser.put(e,l,f),l=f-1;break}break;case 14:if(o=this._dcsParser.unhook(n!==24&&n!==26),o)return this._preserveStack(6,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=l+1;;f++)if(f>=t||(n=e[f])<32||n>127&&n<Br){this._oscParser.put(e,l,f),l=f-1;break}break;case 6:if(o=this._oscParser.end(n!==24&&n!==26),o)return this._preserveStack(5,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},WL=/^([\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})$/,HL=/^[\da-f]+$/;function T_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=WL.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),HL.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,n=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(r*i,r*i+r),16);n[i]=r===1?s<<4:r===2?s:r===3?s>>4:s>>8}return n}}function Au(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 UL(e,t=16){let[r,n,i]=e;return`rgb:${Au(r,t)}/${Au(n,t)}/${Au(i,t)}`}var VL={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Hn=131072,P_=10;function L_(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 R_=5e3,M_=0,KL=class extends Be{constructor(e,t,r,n,i,s,o,l,a=new FL){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=l,this._parser=a,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new hP,this._utf8Decoder=new dP,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=bt.clone(),this._eraseAttrDataInternal=bt.clone(),this._onRequestBell=this._register(new se),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new se),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new se),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new se),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new se),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new se),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new se),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new se),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new se),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 Id(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:d.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,d,h)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:d,data:h})}),this._parser.setDcsHandlerFallback((c,d,h)=>{d==="HOOK"&&(h=h.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:d,payload:h})}),this._parser.setPrintHandler((c,d,h)=>this.print(c,d,h)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(Z.BEL,()=>this.bell()),this._parser.setExecuteHandler(Z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Z.BS,()=>this.backspace()),this._parser.setExecuteHandler(Z.HT,()=>this.tab()),this._parser.setExecuteHandler(Z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(pa.IND,()=>this.index()),this._parser.setExecuteHandler(pa.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(pa.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Sr(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new Sr(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new Sr(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new Sr(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new Sr(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new Sr(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new Sr(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new Sr(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new Sr(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new Sr(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new Sr(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new Sr(c=>this.restoreCursorColor(c))),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 c in Rt)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new N_((c,d)=>this.requestStatusString(c,d)))}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"),R_))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${R_} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Hn&&(s=this._parseStack.position+Hn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Hn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Hn))),o||this._dirtyRowTracker.clearRange(),e.length>Hn)for(let c=s;c<e.length;c+=Hn){let d=c+Hn<e.length?c+Hn:e.length,h=typeof e=="string"?this._stringDecoder.decode(e.substring(c,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,d),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,h))return this._preserveStack(n,i,h,c),this._logSlowResolvingAsync(r),r}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,c))return this._preserveStack(n,i,c,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),a=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);a<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(a,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,r){let n,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,a=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,d=this._curAttrData,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&h.getWidth(this._activeBuffer.x-1)===2&&h.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let f=this._parser.precedingJoinState;for(let p=t;p<r;++p){if(n=e[p],n<127&&s){let _=s[String.fromCharCode(n)];_&&(n=_.charCodeAt(0))}let m=this._unicodeService.charProperties(n,f);i=Di.extractWidth(m);let g=Di.extractShouldJoin(m),S=g?Di.extractWidth(f):0;if(f=m,o&&this._onA11yChar.fire(Yn(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-S>l){if(a){let _=h,x=this._activeBuffer.x-S;for(this._activeBuffer.x=S,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),h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),S>0&&h instanceof go&&h.copyCellsFrom(_,x,0,S,!1);x<l;)_.setCellFromCodepoint(x++,0,1,d)}else if(this._activeBuffer.x=l-1,i===2)continue}if(g&&this._activeBuffer.x){let _=h.getWidth(this._activeBuffer.x-1)?1:2;h.addCodepointToCell(this._activeBuffer.x-_,n,i);for(let x=i-S;--x>=0;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(c&&(h.insertCells(this._activeBuffer.x,i-S,this._activeBuffer.getNullCell(d)),h.getWidth(l-1)===2&&h.setCellFromCodepoint(l-1,0,1,d)),h.setCellFromCodepoint(this._activeBuffer.x++,n,i,d),i>0)for(;--i;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&r-t>0&&h.getWidth(this._activeBuffer.x)===0&&!h.hasContent(this._activeBuffer.x)&&h.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>L_(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new N_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Sr(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,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),i),n&&(s.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 i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,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,i=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(i-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(bt));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=Di.extractWidth(t),i=this._activeBuffer.x-n,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*r),l=0;for(let c=0;c<s.length;){let d=s.codePointAt(c)||0;o[l++]=d,c+=d>65535?2:1}let a=l;for(let c=1;c<r;++c)o.copyWithin(a,0,l),a+=l;return this.print(o,0,a),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Z.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Z.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Z.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Z.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Z.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,Pi),this._charsetService.setgCharset(1,Pi),this._charsetService.setgCharset(2,Pi),this._charsetService.setgCharset(3,Pi);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){(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let n=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:l,cols:a}=this._bufferService,{active:c,alt:d}=l,h=this._optionsService.rawOptions,f=(g,S)=>(o.triggerDataEvent(`${Z.ESC}[${t?"":"?"}${g};${S}$y`),!0),p=g=>g?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(h.convertEol)):f(m,0):m===1?f(m,p(n.applicationCursorKeys)):m===3?f(m,h.windowOptions.setWinLines?a===80?2:a===132?1:0:0):m===6?f(m,p(n.origin)):m===7?f(m,p(n.wraparound)):m===8?f(m,3):m===9?f(m,p(i==="X10")):m===12?f(m,p(h.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(n.reverseWraparound)):m===66?f(m,p(n.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i==="VT200")):m===1002?f(m,p(i==="DRAG")):m===1003?f(m,p(i==="ANY")):m===1004?f(m,p(n.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(s==="SGR")):m===1015?f(m,4):m===1016?f(m,p(s==="SGR_PIXELS")):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(c===d)):m===2004?f(m,p(n.bracketedPasteMode)):m===2026?f(m,p(n.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,r,n,i){return t===2?(e|=50331648,e&=-16777216,e|=_l.fromColorRGB([r,n,i])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let n=[0,0,-1,0,0,0],i=0,s=0;do{if(n[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),l=0;do n[1]===5&&(i=1),n[s+l+1+i]=o[l];while(++l<o.length&&l+s+1+i<n.length);break}if(n[1]===5&&s+i>=2||n[1]===2&&s+i>=5)break;n[1]&&(i=1)}while(++s+t<e.length&&s+i<n.length);for(let o=2;o<n.length;++o)n[o]===-1&&(n[o]=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 s}_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=bt.fg,e.bg=bt.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 i=0;i<t;i++)r=e.params[i],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(i)?e.getSubParams(i)[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|=bt.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=bt.bg&16777215):r===38||r===48||r===58?i+=this._extractColor(e,i,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|=bt.fg&16777215,n.bg&=-67108864,n.bg|=bt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Z.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.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(`${Z.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=bt.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(!L_(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(`${Z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>P_&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>P_&&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(),i=r.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(I_(s))if(i==="?")t.push({type:0,index:s});else{let o=T_(i);o&&t.push({type:1,index:s,color:o})}}}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,i=r.findIndex(s=>s.startsWith("id="));return i!==-1&&(n=r[i].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 i=T_(r[n]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}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 i=parseInt(r[n]);I_(i)&&t.push({type:2,index:i})}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,Pi),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(VL[e[0]],Rt[e[1]]||Pi),!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=bt.clone(),this._eraseAttrDataInternal=bt.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 Hr;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=o=>(this._coreService.triggerDataEvent(`${Z.ESC}${o}${Z.ESC}\\`),!0),n=this._bufferService.buffer,i=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}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Id=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&&(M_=e,e=t,t=M_),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Id=_t([ge(0,or)],Id);function I_(e){return 0<=e&&e<256}var qL=5e7,D_=12,YL=50,XL=class extends Be{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 se),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>qL)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],i=this._action(n,t);if(i){let o=l=>performance.now()-r>=D_?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);i.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=D_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>YL&&(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()}},Dd=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let l=t.addMarker(t.ybase+t.y),a={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(a,l)),this._dataByLinkId.set(a.id,a),a.id}let r=e,n=this._getEntryIdKey(r),i=this._entriesWithId.get(n);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.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)))}};Dd=_t([ge(0,or)],Dd);var j_=!1,GL=class extends Be{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Is),this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onData=this._register(new se),this.onData=this._onData.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new se),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new se),this._instantiationService=new yL,this.optionsService=this._register(new LL(e)),this._instantiationService.setService(lr,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Pd)),this._instantiationService.setService(or,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Td)),this._instantiationService.setService(i1,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Ld)),this._instantiationService.setService(Gi,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Rd)),this._instantiationService.setService(n1,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Di)),this._instantiationService.setService(gP,this.unicodeService),this._charsetService=this._instantiationService.createInstance(jL),this._instantiationService.setService(mP,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Dd),this._instantiationService.setService(s1,this._oscLinkService),this._inputHandler=this._register(new KL(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ht.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ht.forward(this._bufferService.onResize,this._onResize)),this._register(Ht.forward(this.coreService.onData,this._onData)),this._register(Ht.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 XL((t,r)=>this._inputHandler.parse(t,r))),this._register(Ht.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new se),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&&!j_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),j_=!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,B1),t=Math.max(t,O1),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(E_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(E_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ot(()=>{for(let t of e)t.dispose()})}}},QL={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 JL(e,t,r,n){var o;let i={type:0,cancel:!1,key:void 0},s=(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?i.key=Z.ESC+"OA":i.key=Z.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=Z.ESC+"OD":i.key=Z.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=Z.ESC+"OC":i.key=Z.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=Z.ESC+"OB":i.key=Z.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":Z.DEL,e.altKey&&(i.key=Z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Z.ESC+"[Z";break}i.key=Z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Z.ESC+Z.CR:Z.CR,i.cancel=!0;break;case 27:i.key=Z.ESC,e.altKey&&(i.key=Z.ESC+Z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=Z.ESC+"[1;"+(s+1)+"D":t?i.key=Z.ESC+"OD":i.key=Z.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=Z.ESC+"[1;"+(s+1)+"C":t?i.key=Z.ESC+"OC":i.key=Z.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=Z.ESC+"[1;"+(s+1)+"A":t?i.key=Z.ESC+"OA":i.key=Z.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=Z.ESC+"[1;"+(s+1)+"B":t?i.key=Z.ESC+"OB":i.key=Z.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Z.ESC+"[2~");break;case 46:s?i.key=Z.ESC+"[3;"+(s+1)+"~":i.key=Z.ESC+"[3~";break;case 36:s?i.key=Z.ESC+"[1;"+(s+1)+"H":t?i.key=Z.ESC+"OH":i.key=Z.ESC+"[H";break;case 35:s?i.key=Z.ESC+"[1;"+(s+1)+"F":t?i.key=Z.ESC+"OF":i.key=Z.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=Z.ESC+"[5;"+(s+1)+"~":i.key=Z.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=Z.ESC+"[6;"+(s+1)+"~":i.key=Z.ESC+"[6~";break;case 112:s?i.key=Z.ESC+"[1;"+(s+1)+"P":i.key=Z.ESC+"OP";break;case 113:s?i.key=Z.ESC+"[1;"+(s+1)+"Q":i.key=Z.ESC+"OQ";break;case 114:s?i.key=Z.ESC+"[1;"+(s+1)+"R":i.key=Z.ESC+"OR";break;case 115:s?i.key=Z.ESC+"[1;"+(s+1)+"S":i.key=Z.ESC+"OS";break;case 116:s?i.key=Z.ESC+"[15;"+(s+1)+"~":i.key=Z.ESC+"[15~";break;case 117:s?i.key=Z.ESC+"[17;"+(s+1)+"~":i.key=Z.ESC+"[17~";break;case 118:s?i.key=Z.ESC+"[18;"+(s+1)+"~":i.key=Z.ESC+"[18~";break;case 119:s?i.key=Z.ESC+"[19;"+(s+1)+"~":i.key=Z.ESC+"[19~";break;case 120:s?i.key=Z.ESC+"[20;"+(s+1)+"~":i.key=Z.ESC+"[20~";break;case 121:s?i.key=Z.ESC+"[21;"+(s+1)+"~":i.key=Z.ESC+"[21~";break;case 122:s?i.key=Z.ESC+"[23;"+(s+1)+"~":i.key=Z.ESC+"[23~";break;case 123:s?i.key=Z.ESC+"[24;"+(s+1)+"~":i.key=Z.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Z.DEL:e.keyCode===219?i.key=Z.ESC:e.keyCode===220?i.key=Z.FS:e.keyCode===221&&(i.key=Z.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let l=(o=QL[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)i.key=Z.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let a=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(a);e.shiftKey&&(c=c.toUpperCase()),i.key=Z.ESC+c}else if(e.keyCode===32)i.key=Z.ESC+(e.ctrlKey?Z.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),i.key=Z.ESC+a,i.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=Z.US),e.key==="@"&&(i.key=Z.NUL));break}return i}var vt=0,ZL=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ec,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ec,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((i,s)=>this._getKey(i)-this._getKey(s)),t=0,r=0,n=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<n.length;i++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(n[i]=e[t],t++):n[i]=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||(vt=this._search(t),vt===-1)||this._getKey(this._array[vt])!==t)return!1;do if(this._array[vt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(vt),!0;while(++vt<this._array.length&&this._getKey(this._array[vt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,r=new Array(this._array.length-e.length),n=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:r[n++]=this._array[i];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&&(vt=this._search(e),!(vt<0||vt>=this._array.length)&&this._getKey(this._array[vt])===e))do yield this._array[vt];while(++vt<this._array.length&&this._getKey(this._array[vt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(vt=this._search(e),!(vt<0||vt>=this._array.length)&&this._getKey(this._array[vt])===e))do t(this._array[vt]);while(++vt<this._array.length&&this._getKey(this._array[vt])===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,i=this._getKey(this._array[n]);if(i>e)r=n-1;else if(i<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},Bu=0,A_=0,eR=class extends Be{constructor(){super(),this._decorations=new ZL(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new se),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new se),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ot(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new tR(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,i=0;for(let s of this._decorations.getKeyIterator(t))n=s.options.x??0,i=n+(s.options.width??1),e>=n&&e<i&&(!r||(s.options.layer??"bottom")===r)&&(yield s)}forEachDecorationAtCell(e,t,r,n){this._decorations.forEachByKey(t,i=>{Bu=i.options.x??0,A_=Bu+(i.options.width??1),e>=Bu&&e<A_&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},tR=class extends ci{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new se),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new se),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=ct.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ct.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},rR=1e3,nR=class{constructor(e,t=rR){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 i=n-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_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)}},B_=20,tc=class extends Be{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 i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,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=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new nR(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(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
133
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),up&&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 i,s;let r=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=p_(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=cp(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,-Ru),Ru),t/=Ru,t/Math.abs(t)+Math.round(t*(fL-1)))}shouldForceSelection(e){return Za?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(),pL)}_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&&!(Za&&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<mL&&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=sL(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 i=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:i>1&&t!==n&&(r+=i-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 i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(s,e[0]),a=l,c=e[0]-l,d=0,h=0,f=0,p=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;a<o.length&&o.charAt(a+1)===" ";)a++}else{let S=e[0],_=e[0];s.getWidth(S)===0&&(d++,S--),s.getWidth(_)===2&&(h++,_++);let x=s.getString(_).length;for(x>1&&(p+=x-1,a+=x-1);S>0&&l>0&&!this._isCharWordSeparator(s.loadCell(S-1,this._workCell));){s.loadCell(S-1,this._workCell);let w=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,S--):w>1&&(f+=w-1,l-=w-1),l--,S--}for(;_<s.length&&a+1<o.length&&!this._isCharWordSeparator(s.loadCell(_+1,this._workCell));){s.loadCell(_+1,this._workCell);let w=this._workCell.getChars().length;this._workCell.getWidth()===2?(h++,_++):w>1&&(p+=w-1,a+=w-1),a++,_++}}a++;let m=l+c-d+f,g=Math.min(this._bufferService.cols,a-l+d+h-f-p);if(!(!t&&o.slice(l,a).trim()==="")){if(r&&m===0&&s.getCodePoint(0)!==32){let S=i.lines.get(e[1]-1);if(S&&s.isWrapped&&S.getCodePoint(this._bufferService.cols-1)!==32){let _=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(_){let x=this._bufferService.cols-_.start;m-=x,g+=x}}}if(n&&m+g===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let S=i.lines.get(e[1]+1);if(S!=null&&S.isWrapped&&S.getCodePoint(0)!==32){let _=this._getWordAt([0,e[1]+1],!1,!1,!0);_&&(g+=_.length)}}return{start:m,length:g}}}_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=p_(r,this._bufferService.cols)}};Ed=_t([ge(3,or),ge(4,Gi),ge(5,rp),ge(6,lr),ge(7,Bn),ge(8,An)],Ed);var m_=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={}}},g_=class{constructor(){this._color=new m_,this._css=new m_}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()}},Et=Object.freeze((()=>{let e=[ct.toColor("#2e3436"),ct.toColor("#cc0000"),ct.toColor("#4e9a06"),ct.toColor("#c4a000"),ct.toColor("#3465a4"),ct.toColor("#75507b"),ct.toColor("#06989a"),ct.toColor("#d3d7cf"),ct.toColor("#555753"),ct.toColor("#ef2929"),ct.toColor("#8ae234"),ct.toColor("#fce94f"),ct.toColor("#729fcf"),ct.toColor("#ad7fa8"),ct.toColor("#34e2e2"),ct.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],i=t[r/6%6|0],s=t[r%6];e.push({css:wt.toCss(n,i,s),rgba:wt.toRgba(n,i,s)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:wt.toCss(n,n,n),rgba:wt.toRgba(n,n,n)})}return e})()),Pi=ct.toColor("#ffffff"),mo=ct.toColor("#000000"),__=ct.toColor("#ffffff"),v_=mo,no={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},vL=Pi,Nd=class extends Be{constructor(e){super(),this._optionsService=e,this._contrastCache=new g_,this._halfContrastCache=new g_,this._onChangeColors=this._register(new se),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Pi,background:mo,cursor:__,cursorAccent:v_,selectionForeground:void 0,selectionBackgroundTransparent:no,selectionBackgroundOpaque:nt.blend(mo,no),selectionInactiveBackgroundTransparent:no,selectionInactiveBackgroundOpaque:nt.blend(mo,no),scrollbarSliderBackground:nt.opacity(Pi,.2),scrollbarSliderHoverBackground:nt.opacity(Pi,.4),scrollbarSliderActiveBackground:nt.opacity(Pi,.5),overviewRulerBorder:Pi,ansi:Et.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=Je(e.foreground,Pi),t.background=Je(e.background,mo),t.cursor=nt.blend(t.background,Je(e.cursor,__)),t.cursorAccent=nt.blend(t.background,Je(e.cursorAccent,v_)),t.selectionBackgroundTransparent=Je(e.selectionBackground,no),t.selectionBackgroundOpaque=nt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Je(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=nt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Je(e.selectionForeground,h_):void 0,t.selectionForeground===h_&&(t.selectionForeground=void 0),nt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=nt.opacity(t.selectionBackgroundTransparent,.3)),nt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=nt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Je(e.scrollbarSliderBackground,nt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Je(e.scrollbarSliderHoverBackground,nt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Je(e.scrollbarSliderActiveBackground,nt.opacity(t.foreground,.5)),t.overviewRulerBorder=Je(e.overviewRulerBorder,vL),t.ansi=Et.slice(),t.ansi[0]=Je(e.black,Et[0]),t.ansi[1]=Je(e.red,Et[1]),t.ansi[2]=Je(e.green,Et[2]),t.ansi[3]=Je(e.yellow,Et[3]),t.ansi[4]=Je(e.blue,Et[4]),t.ansi[5]=Je(e.magenta,Et[5]),t.ansi[6]=Je(e.cyan,Et[6]),t.ansi[7]=Je(e.white,Et[7]),t.ansi[8]=Je(e.brightBlack,Et[8]),t.ansi[9]=Je(e.brightRed,Et[9]),t.ansi[10]=Je(e.brightGreen,Et[10]),t.ansi[11]=Je(e.brightYellow,Et[11]),t.ansi[12]=Je(e.brightBlue,Et[12]),t.ansi[13]=Je(e.brightMagenta,Et[13]),t.ansi[14]=Je(e.brightCyan,Et[14]),t.ansi[15]=Je(e.brightWhite,Et[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]=Je(e.extendedAnsi[n],Et[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()}}};Nd=_t([ge(0,lr)],Nd);function Je(e,t){if(e!==void 0)try{return ct.toColor(e)}catch{}return t}var xL=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)}},yL=class{constructor(){this._services=new xL,this._services.set(tp,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=fT(e).sort((s,o)=>s.index-o.index),n=[];for(let s of r){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);n.push(o)}let i=r.length>0?r[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},bL={trace:0,debug:1,info:2,warn:3,error:4,off:5},wL="xterm.js: ",Pd=class extends Be{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=bL[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?"":wL)+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)}};Pd=_t([ge(0,lr)],Pd);var x_=class extends Be{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new se),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new se),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new se),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 i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));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}},je=3,bt=Object.freeze(new _l),ql=0,Mu=2,go=class D1{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*je);let i=r||Hr.fromCharData([0,Zy,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let r=this._data[t*je+0],n=r&2097151;return[this._data[t*je+1],r&2097152?this._combined[t]:n?Yn(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*je+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*je+0]=t|2097152|r[2]<<22):this._data[t*je+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*je+0]>>22}hasWidth(t){return this._data[t*je+0]&12582912}getFg(t){return this._data[t*je+1]}getBg(t){return this._data[t*je+2]}hasContent(t){return this._data[t*je+0]&4194303}getCodePoint(t){let r=this._data[t*je+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*je+0]&2097152}getString(t){let r=this._data[t*je+0];return r&2097152?this._combined[t]:r&2097151?Yn(r&2097151):""}isProtected(t){return this._data[t*je+2]&536870912}loadCell(t,r){return ql=t*je,r.content=this._data[ql+0],r.fg=this._data[ql+1],r.bg=this._data[ql+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*je+0]=r.content,this._data[t*je+1]=r.fg,this._data[t*je+2]=r.bg}setCellFromCodepoint(t,r,n,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*je+0]=r|n<<22,this._data[t*je+1]=i.fg,this._data[t*je+2]=i.bg}addCodepointToCell(t,r,n){let i=this._data[t*je+0];i&2097152?this._combined[t]+=Yn(r):i&2097151?(this._combined[t]=Yn(i&2097151)+Yn(r),i&=-2097152,i|=2097152):i=r|1<<22,n&&(i&=-12582913,i|=n<<22),this._data[t*je+0]=i}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 i=new Hr;for(let s=this.length-t-r-1;s>=0;--s)this.setCell(t+r+s,this.loadCell(t+s,i));for(let s=0;s<r;++s)this.setCell(t+s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,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 i=new Hr;for(let s=0;s<this.length-t-r;++s)this.setCell(t+s,this.loadCell(t+r+s,i));for(let s=this.length-r;s<this.length;++s)this.setCell(s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,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,i=!1){if(i){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*Mu<this._data.buffer.byteLength;let n=t*je;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let i=new Uint32Array(n);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,r)}else{this._data=this._data.subarray(0,n);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let l=parseInt(i[o],10);l>=t&&delete this._combined[l]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,n*4*Mu<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Mu<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 D1(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*je+0]&4194303)return t+(this._data[t*je+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*je+0]&4194303||this._data[t*je+2]&50331648)return t+(this._data[t*je+0]>>22);return 0}copyCellsFrom(t,r,n,i,s){let o=t._data;if(s)for(let a=i-1;a>=0;a--){for(let c=0;c<je;c++)this._data[(n+a)*je+c]=o[(r+a)*je+c];o[(r+a)*je+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}else for(let a=0;a<i;a++){for(let c=0;c<je;c++)this._data[(n+a)*je+c]=o[(r+a)*je+c];o[(r+a)*je+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}let l=Object.keys(t._combined);for(let a=0;a<l.length;a++){let c=parseInt(l[a],10);c>=r&&(this._combined[c-r+n]=t._combined[c])}}translateToString(t,r,n,i){r=r??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;r<n;){let o=this._data[r*je+0],l=o&2097151,a=o&2097152?this._combined[r]:l?Yn(l):ei;if(s+=a,i)for(let c=0;c<a.length;++c)i.push(r);r+=o>>22||1}return i&&i.push(r),s}};function SL(e,t,r,n,i,s){let o=[];for(let l=0;l<e.length-1;l++){let a=l,c=e.get(++a);if(!c.isWrapped)continue;let d=[e.get(l)];for(;a<e.length&&c.isWrapped;)d.push(c),c=e.get(++a);if(!s&&n>=l&&n<a){l+=d.length-1;continue}let h=0,f=il(d,h,t),p=1,m=0;for(;p<d.length;){let S=il(d,p,t),_=S-m,x=r-f,w=Math.min(_,x);d[h].copyCellsFrom(d[p],m,f,w,!1),f+=w,f===r&&(h++,f=0),m+=w,m===S&&(p++,m=0),f===0&&h!==0&&d[h-1].getWidth(r-1)===2&&(d[h].copyCellsFrom(d[h-1],r-1,f++,1,!1),d[h-1].setCell(r-1,i))}d[h].replaceCells(f,r,i);let g=0;for(let S=d.length-1;S>0&&(S>h||d[S].getTrimmedLength()===0);S--)g++;g>0&&(o.push(l+d.length-g),o.push(g)),l+=d.length-1}return o}function kL(e,t){let r=[],n=0,i=t[n],s=0;for(let o=0;o<e.length;o++)if(i===o){let l=t[++n];e.onDeleteEmitter.fire({index:o-s,amount:l}),o+=l-1,s+=l,i=t[++n]}else r.push(o);return{layout:r,countRemoved:s}}function CL(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 EL(e,t,r){let n=[],i=e.map((a,c)=>il(e,c,t)).reduce((a,c)=>a+c),s=0,o=0,l=0;for(;l<i;){if(i-l<r){n.push(i-l);break}s+=r;let a=il(e,o,t);s>a&&(s-=a,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let d=c?r-1:r;n.push(d),l+=d}return n}function il(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,i=e[t+1].getWidth(0)===2;return n&&i?r-1:r}var j1=class A1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=A1._nextId++,this._onDispose=this.register(new se),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Vi(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};j1._nextId=1;var NL=j1,Rt={},Ti=Rt.B;Rt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Rt.A={"#":"£"};Rt.B=void 0;Rt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Rt.C=Rt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Rt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Rt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Rt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Rt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Rt.E=Rt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Rt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Rt.H=Rt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Rt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var y_=4294967295,b_=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=bt.clone(),this.savedCharset=Ti,this.markers=[],this._nullCell=Hr.fromCharData([0,Zy,1,0]),this._whitespaceCell=Hr.fromCharData([0,ei,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ec,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new x_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Ga),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Ga),this._whitespaceCell}getBlankLine(e,t){return new go(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>y_?y_:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=bt);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 x_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(bt),n=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)n+=+this.lines.get(o).resize(e,r);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new go(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new go(e,r)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let o=this.lines.length-i;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),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 s=0;s<this.lines.length;s++)n+=+this.lines.get(s).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=SL(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(bt),r);if(n.length>0){let i=kL(this.lines,n);CL(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(bt),i=r;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new go(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(bt),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let a=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),a.unshift(l);if(!r){let w=this.ybase+this.y;if(w>=o&&w<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),d=EL(a,this._cols,e),h=d.length-a.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+h):f=Math.max(0,this.lines.length-this.lines.maxLength+h);let p=[];for(let w=0;w<h;w++){let N=this.getBlankLine(bt,!0);p.push(N)}p.length>0&&(i.push({start:o+a.length+s,newLines:p}),s+=p.length),a.push(...p);let m=d.length-1,g=d[m];g===0&&(m--,g=d[m]);let S=a.length-h-1,_=c;for(;S>=0;){let w=Math.min(_,g);if(a[m]===void 0)break;if(a[m].copyCellsFrom(a[S],_-w,g-w,w,!0),g-=w,g===0&&(m--,g=d[m]),_-=w,_===0){S--;let N=Math.max(S,0);_=il(a,N,this._cols)}}for(let w=0;w<a.length;w++)d[w]<e&&a[w].setCell(d[w],n);let x=h-f;for(;x-- >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+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+h,this.ybase+t-1)}if(i.length>0){let o=[],l=[];for(let g=0;g<this.lines.length;g++)l.push(this.lines.get(g));let a=this.lines.length,c=a-1,d=0,h=i[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let f=0;for(let g=Math.min(this.lines.maxLength-1,a+s-1);g>=0;g--)if(h&&h.start>c+f){for(let S=h.newLines.length-1;S>=0;S--)this.lines.set(g--,h.newLines[S]);g++,o.push({index:c+1,amount:h.newLines.length}),f+=h.newLines.length,h=i[++d]}else this.lines.set(g,l[c--]);let p=0;for(let g=o.length-1;g>=0;g--)o[g].index+=p,this.lines.onInsertEmitter.fire(o[g]),p+=o[g].amount;let m=Math.max(0,a+s-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,r=0,n){let i=this.lines.get(e);return i?i.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 NL(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)}},PL=class extends Be{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new se),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 b_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new b_(!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)}},B1=2,O1=1,Td=class extends Be{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,B1),this.rows=Math.max(e.rawOptions.rows||0,O1),this.buffers=this._register(new PL(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 i=r.ybase+r.scrollTop,s=r.ybase+r.scrollBottom;if(r.scrollTop===0){let o=r.lines.isFull;s===r.lines.length-1?o?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(s+1,0,n.clone()),o?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let o=s-i+1;r.lines.shiftElements(i+1,o-1,-1),r.lines.set(s,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))}};Td=_t([ge(0,lr)],Td);var rs={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:Za,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},TL=["normal","bold","100","200","300","400","500","600","700","800","900"],LL=class extends Be{constructor(e){super(),this._onOptionChange=this._register(new se),this.onOptionChange=this._onOptionChange.event;let t={...rs};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(ot(()=>{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 rs))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in rs))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=rs[e]),!RL(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=rs[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=TL.includes(t)?t:rs[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 RL(e){return e==="block"||e==="underline"||e==="bar"}function _o(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]&&_o(e[n],t-1);return r}var w_=Object.freeze({insertMode:!1}),S_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Ld=class extends Be{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 se),this.onData=this._onData.event,this._onUserInput=this._register(new se),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new se),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=_o(w_),this.decPrivateModes=_o(S_)}reset(){this.modes=_o(w_),this.decPrivateModes=_o(S_)}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))}};Ld=_t([ge(0,or),ge(1,i1),ge(2,lr)],Ld);var k_={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 Iu(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 Du=String.fromCharCode,C_={DEFAULT:e=>{let t=[Iu(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Du(t[0])}${Du(t[1])}${Du(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Iu(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Iu(e,!0)};${e.x};${e.y}${t}`}},Rd=class extends Be{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 se),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(k_))this.addProtocol(n,k_[n]);for(let n of Object.keys(C_))this.addEncoding(n,C_[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,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=n+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_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)}};Rd=_t([ge(0,or),ge(1,Gi),ge(2,lr)],Rd);var ju=[[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]],ML=[[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]],Nt;function IL(e,t){let r=0,n=t.length-1,i;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(i=r+n>>1,e>t[i][1])r=i+1;else if(e<t[i][0])n=i-1;else return!0;return!1}var DL=class{constructor(){if(this.version="6",!Nt){Nt=new Uint8Array(65536),Nt.fill(1),Nt[0]=0,Nt.fill(0,1,32),Nt.fill(0,127,160),Nt.fill(2,4352,4448),Nt[9001]=2,Nt[9002]=2,Nt.fill(2,11904,42192),Nt[12351]=1,Nt.fill(2,44032,55204),Nt.fill(2,63744,64256),Nt.fill(2,65040,65050),Nt.fill(2,65072,65136),Nt.fill(2,65280,65377),Nt.fill(2,65504,65511);for(let e=0;e<ju.length;++e)Nt.fill(0,ju[e][0],ju[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Nt[e]:IL(e,ML)?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 i=Di.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return Di.createPropertyValue(0,r,n)}},Di=class ga{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new se,this.onChange=this._onChange.event;let t=new DL;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,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return r+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:r+=this.wcwidth(c)}let l=this.charProperties(o,n),a=ga.extractWidth(l);ga.extractShouldJoin(l)&&(a-=ga.extractWidth(n)),r+=a,n=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},jL=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 E_(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 io=2147483647,AL=256,z1=class Md{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>AL)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 Md;if(!t.length)return r;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let i=t[n];if(Array.isArray(i))for(let s=0;s<i.length;++s)r.addSubParam(i[s]);else r.addParam(i)}return r}clone(){let t=new Md(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,i=this._subParamsIdx[r]&255;i-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,i))}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>io?io: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>io?io: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,i=this._subParamsIdx[r]&255;i-n>0&&(t[r]=this._subParams.slice(n,i))}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,i=n[r-1];n[r-1]=~i?Math.min(i*10+t,io):t}},so=[],BL=class{constructor(){this._state=0,this._active=so,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=so}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=so,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||so,!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",Pc(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,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&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=so,this._id=-1,this._state=0}}},Sr=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+=Pc(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}},oo=[],OL=class{constructor(){this._handlers=Object.create(null),this._active=oo,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=oo}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=oo,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||oo,!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",Pc(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,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&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=oo,this._ident=0}},vo=new z1;vo.addParam(0);var N_=class{constructor(e){this._handler=e,this._data="",this._params=vo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():vo,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Pc(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=vo,this._data="",this._hitLimit=!1,r));return this._params=vo,this._data="",this._hitLimit=!1,t}},zL=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 i=0;i<e.length;i++)this.table[t<<8|e[i]]=r<<4|n}},Br=160,$L=function(){let e=new zL(4095),t=Array.apply(null,Array(256)).map((l,a)=>a),r=(l,a)=>t.slice(l,a),n=r(32,127),i=r(0,24);i.push(25),i.push.apply(i,r(28,32));let s=r(0,14),o;e.setDefault(1,0),e.addMany(n,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,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(i,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(i,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(i,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(i,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(i,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(i,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(Br,0,2,0),e.add(Br,8,5,8),e.add(Br,6,0,6),e.add(Br,11,0,11),e.add(Br,13,13,13),e}(),FL=class extends Be{constructor(e=$L){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 z1,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(ot(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new BL),this._dcsParser=this._register(new OL),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 i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=s}}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 i=n.indexOf(t);i!==-1&&n.splice(i,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 i=n.indexOf(t);i!==-1&&n.splice(i,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,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=i}parse(e,t,r){let n=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=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 l=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](this._params),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 4:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(n!==24&&n!==26,r),o)return o;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],o=this._oscParser.end(n!==24&&n!==26,r),o)return o;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=s;l<t;++l){switch(n=e[l],i=this._transitions.table[this.currentState<<8|(n<160?n:Br)],i>>4){case 2:for(let f=l+1;;++f){if(f>=t||(n=e[f])<32||n>126&&n<Br){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Br){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Br){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<Br){this._printHandler(e,l,f),l=f-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:l,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|n],c=a?a.length-1:-1;for(;c>=0&&(o=a[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,a,c,i,l),o;c<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(++l<t&&(n=e[l])>47&&n<60);l--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let d=this._escHandlers[this._collect<<8|n],h=d?d.length-1:-1;for(;h>=0&&(o=d[h](),o!==!0);h--)if(o instanceof Promise)return this._preserveStack(4,d,h,i,l),o;h<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 f=l+1;;++f)if(f>=t||(n=e[f])===24||n===26||n===27||n>127&&n<Br){this._dcsParser.put(e,l,f),l=f-1;break}break;case 14:if(o=this._dcsParser.unhook(n!==24&&n!==26),o)return this._preserveStack(6,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=l+1;;f++)if(f>=t||(n=e[f])<32||n>127&&n<Br){this._oscParser.put(e,l,f),l=f-1;break}break;case 6:if(o=this._oscParser.end(n!==24&&n!==26),o)return this._preserveStack(5,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},WL=/^([\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})$/,HL=/^[\da-f]+$/;function P_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=WL.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),HL.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,n=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(r*i,r*i+r),16);n[i]=r===1?s<<4:r===2?s:r===3?s>>4:s>>8}return n}}function Au(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 UL(e,t=16){let[r,n,i]=e;return`rgb:${Au(r,t)}/${Au(n,t)}/${Au(i,t)}`}var VL={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Hn=131072,T_=10;function L_(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 R_=5e3,M_=0,KL=class extends Be{constructor(e,t,r,n,i,s,o,l,a=new FL){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=l,this._parser=a,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new hT,this._utf8Decoder=new dT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=bt.clone(),this._eraseAttrDataInternal=bt.clone(),this._onRequestBell=this._register(new se),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new se),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new se),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new se),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new se),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new se),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new se),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new se),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new se),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 Id(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:d.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,d,h)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:d,data:h})}),this._parser.setDcsHandlerFallback((c,d,h)=>{d==="HOOK"&&(h=h.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:d,payload:h})}),this._parser.setPrintHandler((c,d,h)=>this.print(c,d,h)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(Z.BEL,()=>this.bell()),this._parser.setExecuteHandler(Z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Z.BS,()=>this.backspace()),this._parser.setExecuteHandler(Z.HT,()=>this.tab()),this._parser.setExecuteHandler(Z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(pa.IND,()=>this.index()),this._parser.setExecuteHandler(pa.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(pa.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Sr(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new Sr(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new Sr(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new Sr(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new Sr(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new Sr(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new Sr(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new Sr(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new Sr(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new Sr(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new Sr(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new Sr(c=>this.restoreCursorColor(c))),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 c in Rt)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new N_((c,d)=>this.requestStatusString(c,d)))}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"),R_))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${R_} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Hn&&(s=this._parseStack.position+Hn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Hn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Hn))),o||this._dirtyRowTracker.clearRange(),e.length>Hn)for(let c=s;c<e.length;c+=Hn){let d=c+Hn<e.length?c+Hn:e.length,h=typeof e=="string"?this._stringDecoder.decode(e.substring(c,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,d),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,h))return this._preserveStack(n,i,h,c),this._logSlowResolvingAsync(r),r}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,c))return this._preserveStack(n,i,c,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),a=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);a<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(a,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,r){let n,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,a=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,d=this._curAttrData,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&h.getWidth(this._activeBuffer.x-1)===2&&h.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let f=this._parser.precedingJoinState;for(let p=t;p<r;++p){if(n=e[p],n<127&&s){let _=s[String.fromCharCode(n)];_&&(n=_.charCodeAt(0))}let m=this._unicodeService.charProperties(n,f);i=Di.extractWidth(m);let g=Di.extractShouldJoin(m),S=g?Di.extractWidth(f):0;if(f=m,o&&this._onA11yChar.fire(Yn(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-S>l){if(a){let _=h,x=this._activeBuffer.x-S;for(this._activeBuffer.x=S,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),h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),S>0&&h instanceof go&&h.copyCellsFrom(_,x,0,S,!1);x<l;)_.setCellFromCodepoint(x++,0,1,d)}else if(this._activeBuffer.x=l-1,i===2)continue}if(g&&this._activeBuffer.x){let _=h.getWidth(this._activeBuffer.x-1)?1:2;h.addCodepointToCell(this._activeBuffer.x-_,n,i);for(let x=i-S;--x>=0;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(c&&(h.insertCells(this._activeBuffer.x,i-S,this._activeBuffer.getNullCell(d)),h.getWidth(l-1)===2&&h.setCellFromCodepoint(l-1,0,1,d)),h.setCellFromCodepoint(this._activeBuffer.x++,n,i,d),i>0)for(;--i;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&r-t>0&&h.getWidth(this._activeBuffer.x)===0&&!h.hasContent(this._activeBuffer.x)&&h.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>L_(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new N_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Sr(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,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),i),n&&(s.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 i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,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,i=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(i-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(bt));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=Di.extractWidth(t),i=this._activeBuffer.x-n,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*r),l=0;for(let c=0;c<s.length;){let d=s.codePointAt(c)||0;o[l++]=d,c+=d>65535?2:1}let a=l;for(let c=1;c<r;++c)o.copyWithin(a,0,l),a+=l;return this.print(o,0,a),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Z.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Z.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Z.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Z.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Z.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,Ti),this._charsetService.setgCharset(1,Ti),this._charsetService.setgCharset(2,Ti),this._charsetService.setgCharset(3,Ti);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){(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let n=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:l,cols:a}=this._bufferService,{active:c,alt:d}=l,h=this._optionsService.rawOptions,f=(g,S)=>(o.triggerDataEvent(`${Z.ESC}[${t?"":"?"}${g};${S}$y`),!0),p=g=>g?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(h.convertEol)):f(m,0):m===1?f(m,p(n.applicationCursorKeys)):m===3?f(m,h.windowOptions.setWinLines?a===80?2:a===132?1:0:0):m===6?f(m,p(n.origin)):m===7?f(m,p(n.wraparound)):m===8?f(m,3):m===9?f(m,p(i==="X10")):m===12?f(m,p(h.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(n.reverseWraparound)):m===66?f(m,p(n.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i==="VT200")):m===1002?f(m,p(i==="DRAG")):m===1003?f(m,p(i==="ANY")):m===1004?f(m,p(n.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(s==="SGR")):m===1015?f(m,4):m===1016?f(m,p(s==="SGR_PIXELS")):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(c===d)):m===2004?f(m,p(n.bracketedPasteMode)):m===2026?f(m,p(n.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,r,n,i){return t===2?(e|=50331648,e&=-16777216,e|=_l.fromColorRGB([r,n,i])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let n=[0,0,-1,0,0,0],i=0,s=0;do{if(n[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),l=0;do n[1]===5&&(i=1),n[s+l+1+i]=o[l];while(++l<o.length&&l+s+1+i<n.length);break}if(n[1]===5&&s+i>=2||n[1]===2&&s+i>=5)break;n[1]&&(i=1)}while(++s+t<e.length&&s+i<n.length);for(let o=2;o<n.length;++o)n[o]===-1&&(n[o]=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 s}_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=bt.fg,e.bg=bt.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 i=0;i<t;i++)r=e.params[i],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(i)?e.getSubParams(i)[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|=bt.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=bt.bg&16777215):r===38||r===48||r===58?i+=this._extractColor(e,i,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|=bt.fg&16777215,n.bg&=-67108864,n.bg|=bt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Z.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.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(`${Z.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=bt.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(!L_(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(`${Z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>T_&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>T_&&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(),i=r.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(I_(s))if(i==="?")t.push({type:0,index:s});else{let o=P_(i);o&&t.push({type:1,index:s,color:o})}}}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,i=r.findIndex(s=>s.startsWith("id="));return i!==-1&&(n=r[i].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 i=P_(r[n]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}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 i=parseInt(r[n]);I_(i)&&t.push({type:2,index:i})}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,Ti),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(VL[e[0]],Rt[e[1]]||Ti),!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=bt.clone(),this._eraseAttrDataInternal=bt.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 Hr;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=o=>(this._coreService.triggerDataEvent(`${Z.ESC}${o}${Z.ESC}\\`),!0),n=this._bufferService.buffer,i=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}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Id=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&&(M_=e,e=t,t=M_),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Id=_t([ge(0,or)],Id);function I_(e){return 0<=e&&e<256}var qL=5e7,D_=12,YL=50,XL=class extends Be{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 se),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>qL)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],i=this._action(n,t);if(i){let o=l=>performance.now()-r>=D_?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);i.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=D_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>YL&&(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()}},Dd=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let l=t.addMarker(t.ybase+t.y),a={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(a,l)),this._dataByLinkId.set(a.id,a),a.id}let r=e,n=this._getEntryIdKey(r),i=this._entriesWithId.get(n);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.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)))}};Dd=_t([ge(0,or)],Dd);var j_=!1,GL=class extends Be{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Is),this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onData=this._register(new se),this.onData=this._onData.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new se),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new se),this._instantiationService=new yL,this.optionsService=this._register(new LL(e)),this._instantiationService.setService(lr,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Td)),this._instantiationService.setService(or,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Pd)),this._instantiationService.setService(i1,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Ld)),this._instantiationService.setService(Gi,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Rd)),this._instantiationService.setService(n1,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Di)),this._instantiationService.setService(gT,this.unicodeService),this._charsetService=this._instantiationService.createInstance(jL),this._instantiationService.setService(mT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Dd),this._instantiationService.setService(s1,this._oscLinkService),this._inputHandler=this._register(new KL(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ht.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ht.forward(this._bufferService.onResize,this._onResize)),this._register(Ht.forward(this.coreService.onData,this._onData)),this._register(Ht.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 XL((t,r)=>this._inputHandler.parse(t,r))),this._register(Ht.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new se),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&&!j_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),j_=!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,B1),t=Math.max(t,O1),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(E_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(E_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ot(()=>{for(let t of e)t.dispose()})}}},QL={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 JL(e,t,r,n){var o;let i={type:0,cancel:!1,key:void 0},s=(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?i.key=Z.ESC+"OA":i.key=Z.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=Z.ESC+"OD":i.key=Z.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=Z.ESC+"OC":i.key=Z.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=Z.ESC+"OB":i.key=Z.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":Z.DEL,e.altKey&&(i.key=Z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Z.ESC+"[Z";break}i.key=Z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Z.ESC+Z.CR:Z.CR,i.cancel=!0;break;case 27:i.key=Z.ESC,e.altKey&&(i.key=Z.ESC+Z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=Z.ESC+"[1;"+(s+1)+"D":t?i.key=Z.ESC+"OD":i.key=Z.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=Z.ESC+"[1;"+(s+1)+"C":t?i.key=Z.ESC+"OC":i.key=Z.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=Z.ESC+"[1;"+(s+1)+"A":t?i.key=Z.ESC+"OA":i.key=Z.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=Z.ESC+"[1;"+(s+1)+"B":t?i.key=Z.ESC+"OB":i.key=Z.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Z.ESC+"[2~");break;case 46:s?i.key=Z.ESC+"[3;"+(s+1)+"~":i.key=Z.ESC+"[3~";break;case 36:s?i.key=Z.ESC+"[1;"+(s+1)+"H":t?i.key=Z.ESC+"OH":i.key=Z.ESC+"[H";break;case 35:s?i.key=Z.ESC+"[1;"+(s+1)+"F":t?i.key=Z.ESC+"OF":i.key=Z.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=Z.ESC+"[5;"+(s+1)+"~":i.key=Z.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=Z.ESC+"[6;"+(s+1)+"~":i.key=Z.ESC+"[6~";break;case 112:s?i.key=Z.ESC+"[1;"+(s+1)+"P":i.key=Z.ESC+"OP";break;case 113:s?i.key=Z.ESC+"[1;"+(s+1)+"Q":i.key=Z.ESC+"OQ";break;case 114:s?i.key=Z.ESC+"[1;"+(s+1)+"R":i.key=Z.ESC+"OR";break;case 115:s?i.key=Z.ESC+"[1;"+(s+1)+"S":i.key=Z.ESC+"OS";break;case 116:s?i.key=Z.ESC+"[15;"+(s+1)+"~":i.key=Z.ESC+"[15~";break;case 117:s?i.key=Z.ESC+"[17;"+(s+1)+"~":i.key=Z.ESC+"[17~";break;case 118:s?i.key=Z.ESC+"[18;"+(s+1)+"~":i.key=Z.ESC+"[18~";break;case 119:s?i.key=Z.ESC+"[19;"+(s+1)+"~":i.key=Z.ESC+"[19~";break;case 120:s?i.key=Z.ESC+"[20;"+(s+1)+"~":i.key=Z.ESC+"[20~";break;case 121:s?i.key=Z.ESC+"[21;"+(s+1)+"~":i.key=Z.ESC+"[21~";break;case 122:s?i.key=Z.ESC+"[23;"+(s+1)+"~":i.key=Z.ESC+"[23~";break;case 123:s?i.key=Z.ESC+"[24;"+(s+1)+"~":i.key=Z.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Z.DEL:e.keyCode===219?i.key=Z.ESC:e.keyCode===220?i.key=Z.FS:e.keyCode===221&&(i.key=Z.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let l=(o=QL[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)i.key=Z.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let a=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(a);e.shiftKey&&(c=c.toUpperCase()),i.key=Z.ESC+c}else if(e.keyCode===32)i.key=Z.ESC+(e.ctrlKey?Z.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),i.key=Z.ESC+a,i.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=Z.US),e.key==="@"&&(i.key=Z.NUL));break}return i}var vt=0,ZL=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ec,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ec,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((i,s)=>this._getKey(i)-this._getKey(s)),t=0,r=0,n=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<n.length;i++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(n[i]=e[t],t++):n[i]=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||(vt=this._search(t),vt===-1)||this._getKey(this._array[vt])!==t)return!1;do if(this._array[vt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(vt),!0;while(++vt<this._array.length&&this._getKey(this._array[vt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,r=new Array(this._array.length-e.length),n=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:r[n++]=this._array[i];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&&(vt=this._search(e),!(vt<0||vt>=this._array.length)&&this._getKey(this._array[vt])===e))do yield this._array[vt];while(++vt<this._array.length&&this._getKey(this._array[vt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(vt=this._search(e),!(vt<0||vt>=this._array.length)&&this._getKey(this._array[vt])===e))do t(this._array[vt]);while(++vt<this._array.length&&this._getKey(this._array[vt])===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,i=this._getKey(this._array[n]);if(i>e)r=n-1;else if(i<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},Bu=0,A_=0,eR=class extends Be{constructor(){super(),this._decorations=new ZL(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new se),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new se),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ot(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new tR(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,i=0;for(let s of this._decorations.getKeyIterator(t))n=s.options.x??0,i=n+(s.options.width??1),e>=n&&e<i&&(!r||(s.options.layer??"bottom")===r)&&(yield s)}forEachDecorationAtCell(e,t,r,n){this._decorations.forEachByKey(t,i=>{Bu=i.options.x??0,A_=Bu+(i.options.width??1),e>=Bu&&e<A_&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},tR=class extends ci{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new se),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new se),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=ct.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ct.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},rR=1e3,nR=class{constructor(e,t=rR){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 i=n-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_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)}},B_=20,tc=class extends Be{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 i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,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=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new nR(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(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
134
134
|
`))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Le(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ot(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<B_+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
135
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===B_+1&&(this._liveRegion.textContent+=ed.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 i=e;i<=t;i++){let s=r.lines.get(r.ydisp+i),o=[],l=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",a=(r.ydisp+i+1).toString(),c=this._rowElements[i];c&&(l.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=l,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",a),c.setAttribute("aria-setsize",n),this._alignRowWidth(c))}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],i=r.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==n)return;let o,l;if(t===0?(o=r,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=r,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let a=this._createAccessibilityTreeNode();this._rowElements.unshift(a),this._rowContainer.insertAdjacentElement("afterbegin",a)}else{let a=this._createAccessibilityTreeNode();this._rowElements.push(a),this._rowContainer.appendChild(a)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},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:((l=n.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(r.node))return;let i=({node:a,offset:c})=>{let d=a instanceof Text?a.parentNode:a,h=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(d);if(!f)return console.warn("columns is null. Race condition?"),null;let p=c<f.length?f[c]:f.slice(-1)[0]+1;return p>=this._terminal.cols&&(++h,p=0),{row:h,column:p}},s=i(t),o=i(r);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,r=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};tc=_t([ge(1,tp),ge(2,An),ge(3,Bn)],tc);var jd=class extends Be{constructor(e,t,r,n,i){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=n,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new se),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new se),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ot(()=>{var s;Vi(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Le(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Le(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Le(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Le(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 i=r[n];if(i.classList.contains("xterm"))break;if(i.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,i;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):o.provideLinks(e.y,l=>{var c,d;if(this._isMouseOut)return;let a=l==null?void 0:l.map(h=>({link:h}));(c=this._activeProviderReplies)==null||c.set(s,a),r=this._checkLinkProviderResult(s,e,r),((d=this._activeProviderReplies)==null?void 0:d.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 i=t.get(n);if(i)for(let s=0;s<i.length;s++){let o=i[s],l=o.link.range.start.y<e?0:o.link.range.start.x,a=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=l;c<=a;c++){if(r.has(c)){i.splice(s--,1);break}r.add(c)}}}}_checkLinkProviderResult(e,t,r){var s;if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&n){let o=n.find(l=>this._linkAtPosition(l.link,t));o&&(r=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(a=>this._linkAtPosition(a.link,t));if(l){r=!0,this._handleNewLink(l);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&&iR(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,Vi(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,i,s;(n=this._currentLink)!=null&&n.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.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,i=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(n,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!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,i=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(i)}_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,i=t.y*this._bufferService.cols+t.x;return r<=i&&i<=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,i){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:i}}};jd=_t([ge(1,rp),ge(2,Bn),ge(3,or),ge(4,l1)],jd);function iR(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 sR=class extends GL{constructor(e={}){super(e),this._linkifier=this._register(new Is),this.browser=E1,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Is),this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new se),this.onKey=this._onKey.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new se),this.onBell=this._onBell.event,this._onFocus=this._register(new se),this._onBlur=this._register(new se),this._onA11yCharEmitter=this._register(new se),this._onA11yTabEmitter=this._register(new se),this._onWillOpen=this._register(new se),this._setup(),this._decorationService=this._instantiationService.createInstance(eR),this._instantiationService.setService(vl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Y4),this._instantiationService.setService(l1,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(rd)),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(Ht.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ht.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ht.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ht.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ot(()=>{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 i=nt.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${Z.ESC}]${n};${UL(i)}${k1.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=wt.toColor(...t.color));else{let s=r;this._themeService.modifyColors(o=>o[s]=wt.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(tc,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.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(Z.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,i=t.getWidth(r),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Le(this.element,"copy",t=>{this.hasSelection()&&cP(t,this._selectionService)}));let e=t=>uP(t,this.textarea,this.coreService,this.optionsService);this._register(Le(this.textarea,"paste",e)),this._register(Le(this.element,"paste",e)),N1?this._register(Le(this.element,"mousedown",t=>{t.button===2&&qg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Le(this.element,"contextmenu",t=>{qg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),up&&this._register(Le(this.element,"auxclick",t=>{t.button===1&&Jy(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Le(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Le(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Le(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Le(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Le(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Le(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Le(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;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"),((i=this.element)==null?void 0:i.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(Le(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),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",Zh.get()),L1||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(K4,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(An,this._coreBrowserService),this._register(Le(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(Le(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Sd,this._document,this._helperContainer),this._instantiationService.setService(Pc,this._charSizeService),this._themeService=this._instantiationService.createInstance(Nd),this._instantiationService.setService(Fs,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ja),this._instantiationService.setService(o1,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Cd,this.rows,this.screenElement)),this._instantiationService.setService(Bn,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(yd,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(kd),this._instantiationService.setService(rp,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(jd,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(vd,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ed,this.element,this.screenElement,n)),this._instantiationService.setService(vP,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(Ht.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(xd,this.screenElement)),this._register(Le(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),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(tc,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Qa,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Qa,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(wd,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(s){var c,d,h,f,p;let o=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!o)return!1;let l,a;switch(s.overrideType||s.type){case"mousemove":a=32,s.buttons===void 0?(l=3,s.button!==void 0&&(l=s.button<3?s.button:3)):l=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":a=0,l=s.button<3?s.button:3;break;case"mousedown":a=1,l=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let m=s.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(s,(f=(h=(d=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:d.device)==null?void 0:h.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;a=m<0?0:1,l=4;break;default:return!1}return a===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:a,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(r(s),s.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(s)),wheel:s=>(r(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&r(s)},mousemove:s=>{s.buttons||r(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),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()),s&8?n.mousemove||(t.addEventListener("mousemove",i.mousemove),n.mousemove=i.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),s&16?n.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),n.wheel=i.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),s&2?n.mouseup||(n.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),s&4?n.mousedrag||(n.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Le(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return r(s),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(s)})),this._register(Le(t,"wheel",s=>{var o,l,a,c,d;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(a=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:a.cell)==null?void 0:c.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(s,!0);let h=Z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(s,!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){Qy(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=JL(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===Z.ETX||r.key===Z.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)&&(oR(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(bt));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(Z.ESC+"[I"):this.coreService.triggerDataEvent(Z.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(`${Z.ESC}[4;${r};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[6;${i};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function oR(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var lR=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)}},aR=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 Hr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},O_=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 aR(t)}getNullCell(){return new Hr}},cR=class extends Be{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new se),this.onBufferChange=this._onBufferChange.event,this._normal=new O_(this._core.buffers.normal,"normal"),this._alternate=new O_(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)}},uR=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)}},hR=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}},dR=["cols","rows"],on=0,fR=class extends Be{constructor(e){super(),this._core=this._register(new sR(e)),this._addonManager=this._register(new lR),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],r=(n,i)=>{this._checkReadonlyOptions(n),this._core.options[n]=i};for(let n in this._core.options){let i={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,i)}}_checkReadonlyOptions(e){if(dR.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 uR(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new hR(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 cR(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
|
|
135
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===B_+1&&(this._liveRegion.textContent+=ed.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 i=e;i<=t;i++){let s=r.lines.get(r.ydisp+i),o=[],l=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",a=(r.ydisp+i+1).toString(),c=this._rowElements[i];c&&(l.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=l,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",a),c.setAttribute("aria-setsize",n),this._alignRowWidth(c))}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],i=r.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==n)return;let o,l;if(t===0?(o=r,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=r,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let a=this._createAccessibilityTreeNode();this._rowElements.unshift(a),this._rowContainer.insertAdjacentElement("afterbegin",a)}else{let a=this._createAccessibilityTreeNode();this._rowElements.push(a),this._rowContainer.appendChild(a)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},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:((l=n.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(r.node))return;let i=({node:a,offset:c})=>{let d=a instanceof Text?a.parentNode:a,h=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(d);if(!f)return console.warn("columns is null. Race condition?"),null;let p=c<f.length?f[c]:f.slice(-1)[0]+1;return p>=this._terminal.cols&&(++h,p=0),{row:h,column:p}},s=i(t),o=i(r);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,r=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};tc=_t([ge(1,tp),ge(2,An),ge(3,Bn)],tc);var jd=class extends Be{constructor(e,t,r,n,i){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=n,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new se),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new se),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ot(()=>{var s;Vi(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Le(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Le(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Le(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Le(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 i=r[n];if(i.classList.contains("xterm"))break;if(i.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,i;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):o.provideLinks(e.y,l=>{var c,d;if(this._isMouseOut)return;let a=l==null?void 0:l.map(h=>({link:h}));(c=this._activeProviderReplies)==null||c.set(s,a),r=this._checkLinkProviderResult(s,e,r),((d=this._activeProviderReplies)==null?void 0:d.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 i=t.get(n);if(i)for(let s=0;s<i.length;s++){let o=i[s],l=o.link.range.start.y<e?0:o.link.range.start.x,a=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=l;c<=a;c++){if(r.has(c)){i.splice(s--,1);break}r.add(c)}}}}_checkLinkProviderResult(e,t,r){var s;if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&n){let o=n.find(l=>this._linkAtPosition(l.link,t));o&&(r=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(a=>this._linkAtPosition(a.link,t));if(l){r=!0,this._handleNewLink(l);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&&iR(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,Vi(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,i,s;(n=this._currentLink)!=null&&n.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.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,i=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(n,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!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,i=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(i)}_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,i=t.y*this._bufferService.cols+t.x;return r<=i&&i<=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,i){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:i}}};jd=_t([ge(1,rp),ge(2,Bn),ge(3,or),ge(4,l1)],jd);function iR(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 sR=class extends GL{constructor(e={}){super(e),this._linkifier=this._register(new Is),this.browser=E1,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Is),this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new se),this.onKey=this._onKey.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new se),this.onBell=this._onBell.event,this._onFocus=this._register(new se),this._onBlur=this._register(new se),this._onA11yCharEmitter=this._register(new se),this._onA11yTabEmitter=this._register(new se),this._onWillOpen=this._register(new se),this._setup(),this._decorationService=this._instantiationService.createInstance(eR),this._instantiationService.setService(vl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Y4),this._instantiationService.setService(l1,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(rd)),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(Ht.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ht.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ht.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ht.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ot(()=>{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 i=nt.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${Z.ESC}]${n};${UL(i)}${k1.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=wt.toColor(...t.color));else{let s=r;this._themeService.modifyColors(o=>o[s]=wt.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(tc,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.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(Z.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,i=t.getWidth(r),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Le(this.element,"copy",t=>{this.hasSelection()&&cT(t,this._selectionService)}));let e=t=>uT(t,this.textarea,this.coreService,this.optionsService);this._register(Le(this.textarea,"paste",e)),this._register(Le(this.element,"paste",e)),N1?this._register(Le(this.element,"mousedown",t=>{t.button===2&&qg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Le(this.element,"contextmenu",t=>{qg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),up&&this._register(Le(this.element,"auxclick",t=>{t.button===1&&Jy(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Le(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Le(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Le(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Le(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Le(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Le(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Le(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;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"),((i=this.element)==null?void 0:i.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(Le(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),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",Zh.get()),L1||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(K4,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(An,this._coreBrowserService),this._register(Le(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(Le(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Sd,this._document,this._helperContainer),this._instantiationService.setService(Tc,this._charSizeService),this._themeService=this._instantiationService.createInstance(Nd),this._instantiationService.setService(Fs,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ja),this._instantiationService.setService(o1,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Cd,this.rows,this.screenElement)),this._instantiationService.setService(Bn,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(yd,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(kd),this._instantiationService.setService(rp,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(jd,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(vd,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ed,this.element,this.screenElement,n)),this._instantiationService.setService(vT,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(Ht.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(xd,this.screenElement)),this._register(Le(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),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(tc,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Qa,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Qa,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(wd,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(s){var c,d,h,f,p;let o=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!o)return!1;let l,a;switch(s.overrideType||s.type){case"mousemove":a=32,s.buttons===void 0?(l=3,s.button!==void 0&&(l=s.button<3?s.button:3)):l=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":a=0,l=s.button<3?s.button:3;break;case"mousedown":a=1,l=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let m=s.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(s,(f=(h=(d=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:d.device)==null?void 0:h.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;a=m<0?0:1,l=4;break;default:return!1}return a===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:a,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(r(s),s.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(s)),wheel:s=>(r(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&r(s)},mousemove:s=>{s.buttons||r(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),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()),s&8?n.mousemove||(t.addEventListener("mousemove",i.mousemove),n.mousemove=i.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),s&16?n.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),n.wheel=i.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),s&2?n.mouseup||(n.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),s&4?n.mousedrag||(n.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Le(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return r(s),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(s)})),this._register(Le(t,"wheel",s=>{var o,l,a,c,d;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(a=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:a.cell)==null?void 0:c.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(s,!0);let h=Z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(s,!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){Qy(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=JL(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===Z.ETX||r.key===Z.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)&&(oR(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(bt));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(Z.ESC+"[I"):this.coreService.triggerDataEvent(Z.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(`${Z.ESC}[4;${r};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[6;${i};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function oR(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var lR=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)}},aR=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 Hr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},O_=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 aR(t)}getNullCell(){return new Hr}},cR=class extends Be{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new se),this.onBufferChange=this._onBufferChange.event,this._normal=new O_(this._core.buffers.normal,"normal"),this._alternate=new O_(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)}},uR=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)}},hR=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}},dR=["cols","rows"],on=0,fR=class extends Be{constructor(e){super(),this._core=this._register(new sR(e)),this._addonManager=this._register(new lR),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],r=(n,i)=>{this._checkReadonlyOptions(n),this._core.options[n]=i};for(let n in this._core.options){let i={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,i)}}_checkReadonlyOptions(e){if(dR.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 uR(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new hR(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 cR(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
|
|
136
136
|
`,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 Zh.get()},set promptLabel(e){Zh.set(e)},get tooMuchOutput(){return ed.get()},set tooMuchOutput(e){ed.set(e)}}}_verifyIntegers(...e){for(on of e)if(on===1/0||isNaN(on)||on%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(on of e)if(on&&(on===1/0||isNaN(on)||on%1!==0||on<0))throw new Error("This API only accepts positive integers")}};/**
|
|
137
137
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
138
138
|
* @license MIT
|
|
@@ -155,7 +155,7 @@ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){t
|
|
|
155
155
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
156
156
|
* http://bellard.org/jslinux/
|
|
157
157
|
* Copyright (c) 2011 Fabrice Bellard
|
|
158
|
-
*/var _R=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){let r=xR.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,n)=>{if(this._options.hover){let{range:i}=t;this._options.hover(r,n,i)}},t))}};function vR(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var xR=class _a{static computeLink(t,r,n,i){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=_a._getWindowedLineStrings(t-1,n),a=o.join(""),c,d=[];for(;c=s.exec(a);){let h=c[0];if(!vR(h))continue;let[f,p]=_a._mapStrIdx(n,l,0,c.index),[m,g]=_a._mapStrIdx(n,f,p,h.length);if(f===-1||p===-1||m===-1||g===-1)continue;let S={start:{x:p+1,y:f+1},end:{x:g,y:m+1}};d.push({range:S,text:h,activate:i})}return d}static _getWindowedLineStrings(t,r){let n,i=t,s=t,o=0,l="",a=[];if(n=r.buffer.active.getLine(t)){let c=n.translateToString(!0);if(n.isWrapped&&c[0]!==" "){for(o=0;(n=r.buffer.active.getLine(--i))&&o<2048&&(l=n.translateToString(!0),o+=l.length,a.push(l),!(!n.isWrapped||l.indexOf(" ")!==-1)););a.reverse()}for(a.push(c),o=0;(n=r.buffer.active.getLine(++s))&&n.isWrapped&&o<2048&&(l=n.translateToString(!0),o+=l.length,a.push(l),l.indexOf(" ")===-1););}return[a,i]}static _mapStrIdx(t,r,n,i){let s=t.buffer.active,o=s.getNullCell(),l=n;for(;i;){let a=s.getLine(r);if(!a)return[-1,-1];for(let c=l;c<a.length;++c){a.getCell(c,o);let d=o.getChars();if(o.getWidth()&&(i-=d.length||1,c===a.length-1&&d==="")){let h=s.getLine(r+1);h&&h.isWrapped&&(h.getCell(0,o),o.getWidth()===2&&(i+=1))}if(i<0)return[r,c]}r++,l=0}return[r,l]}},yR=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function bR(e,t){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 wR=class{constructor(e=bR,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||yR;this._linkProvider=this._terminal.registerLinkProvider(new _R(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const z_={background:"#0f1117",foreground:"#cdd6f4",cursor:"#f38ba8",cursorAccent:"#0f1117",selectionBackground:"rgba(166, 227, 161, 0.3)",selectionForeground:"#cdd6f4",black:"#45475a",red:"#f38ba8",green:"#a6e3a1",yellow:"#f9e2af",blue:"#89b4fa",magenta:"#cba6f7",cyan:"#94e2d5",white:"#bac2de",brightBlack:"#585b70",brightRed:"#f38ba8",brightGreen:"#a6e3a1",brightYellow:"#f9e2af",brightBlue:"#89b4fa",brightMagenta:"#cba6f7",brightCyan:"#94e2d5",brightWhite:"#a6adc8"},$1=b.forwardRef(({onInput:e,onResize:t,fontSize:r=13},n)=>{const i=b.useRef(null),s=b.useRef(null),o=b.useRef(null),[l,a]=b.useState(!1);return b.useImperativeHandle(n,()=>({write:c=>{var d;(d=s.current)==null||d.write(c)},clear:()=>{var c;(c=s.current)==null||c.clear()},fit:()=>{var c;try{(c=o.current)==null||c.fit(),s.current&&(t==null||t(s.current.cols,s.current.rows))}catch{}},bumpResize:()=>{var c;try{(c=o.current)==null||c.fit();const d=s.current;if(!d)return;const h=d.cols,f=d.rows;t==null||t(h+5,f),setTimeout(()=>{t==null||t(h,f)},100)}catch{}}})),b.useEffect(()=>{if(!i.current)return;const c=new fR({cursorBlink:!0,cursorStyle:"bar",fontSize:r,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:z_,allowTransparency:!0,scrollback:5e3,convertEol:!1}),d=new gR,h=new wR;c.loadAddon(d),c.loadAddon(h),c.open(i.current),requestAnimationFrame(()=>{d.fit(),t==null||t(c.cols,c.rows),a(!0)});const f=c.onData(m=>{e(m)}),p=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{d.fit(),t==null||t(c.cols,c.rows)}catch{}})});return p.observe(i.current),s.current=c,o.current=d,()=>{f.dispose(),p.disconnect(),c.dispose(),s.current=null,o.current=null}},[r]),u.jsx("div",{ref:i,className:"w-full h-full rounded-lg overflow-hidden transition-opacity duration-200",style:{background:z_.background,opacity:l?1:0}})});$1.displayName="CliTerminal";function $_({label:e,value:t,sub:r,icon:n}){return u.jsxs("div",{className:"px-4 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[u.jsx("span",{className:"text-base flex items-center",children:n}),u.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wide font-semibold",children:e})]}),u.jsx("div",{className:"text-[22px] font-bold text-text-primary tracking-tight",children:t}),r&&u.jsx("div",{className:"text-[11px] text-text-muted mt-0.5",children:r})]})}function F_({value:e,max:t,label:r,color:n="#8b5cf6",detail:i,compact:s=!1}){const o=t>0?Math.min(Math.round(e/t*100),100):0,l=o>85?"#ef4444":o>60?"#f59e0b":n;return s?u.jsxs("div",{className:"flex-1",children:[u.jsxs("div",{className:"flex justify-between mb-0.5",children:[u.jsx("span",{className:"text-[9px] text-text-muted uppercase tracking-wide font-semibold",children:r}),u.jsxs("span",{className:"text-[10px] text-text-secondary font-semibold",children:[o,"%"]})]}),u.jsx("div",{className:"h-1 bg-white/[0.04] rounded-sm overflow-hidden",children:u.jsx("div",{className:"h-full rounded-sm transition-[width] duration-500",style:{width:`${o}%`,background:l}})})]}):u.jsxs("div",{className:"flex-1",children:[u.jsxs("div",{className:"flex justify-between mb-1.5",children:[u.jsx("span",{className:"text-[11px] text-text-secondary font-medium",children:r}),u.jsxs("span",{className:"text-[13px] text-text-primary font-bold",children:[o,"%"]})]}),u.jsx("div",{className:"h-1.5 bg-white/[0.04] rounded-sm overflow-hidden",children:u.jsx("div",{className:"h-full rounded-sm transition-[width] duration-[600ms]",style:{width:`${o}%`,background:`linear-gradient(90deg, ${l}, ${l}cc)`}})}),i&&u.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:i})]})}function SR({screenshot:e,isCapturing:t,onRefresh:r,onAction:n,addLog:i,connState:s,connScreenshot:o}){const l=b.useRef(null),a=b.useRef(null),c=b.useRef(null),[d,h]=b.useState(!0),[f,p]=b.useState(2e3),[m,g]=b.useState(null),[S,_]=b.useState(""),[,x]=b.useState(!1),[w,N]=b.useState([]),L=b.useRef(0),[C,F]=b.useState(!1),[T,q]=b.useState(!1),E=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[A,R]=b.useState(E?"mouse":"touch"),[P,$]=b.useState(1),z=b.useRef(!1),[D,H]=b.useState(1),[I,W]=b.useState(0),[y,Q]=b.useState(0),ae=b.useRef(0),k=b.useRef(t),we=b.useRef(r),U=b.useRef(n),Y=b.useRef(null),te=b.useRef(null),fe=b.useRef(!1),de=b.useRef(null),Oe=b.useRef(0),Ve=b.useRef(null),Ie=b.useRef(1),G=b.useRef({x:0,y:0}),me=b.useRef(!1),Re=b.useRef(D),J=b.useRef(I),oe=b.useRef(y),Fe=b.useRef(A);b.useEffect(()=>{k.current=t},[t]),b.useEffect(()=>{we.current=r},[r]),b.useEffect(()=>{Re.current=D},[D]),b.useEffect(()=>{J.current=I},[I]),b.useEffect(()=>{oe.current=y},[y]),b.useEffect(()=>{U.current=n},[n]),b.useEffect(()=>{Fe.current=A},[A]),b.useEffect(()=>{var O;(O=l.current)==null||O.focus()},[]);const We=s==="connected",Ne=s!=="connected"&&s!=="connecting",ze=We&&o?o:e;b.useEffect(()=>{if(!E||z.current||!ze)return;const O=c.current,ue=a.current;if(!O||!ue)return;const M=()=>{const j=ue.clientWidth,V=ue.clientHeight,X=O.naturalWidth,he=O.naturalHeight;if(!X||!he||!j||!V)return;const ce=Math.min(j/X,V/he),pe=Math.max(j/X,V/he)/ce;pe>1.01&&($(pe),H(pe),Re.current=pe),z.current=!0};O.complete&&O.naturalWidth?M():O.addEventListener("load",M,{once:!0})},[ze,E]);const Pe=.5;b.useEffect(()=>{D<=Pe&&(W(0),Q(0))},[D,Pe]);const qe=(O,ue,M)=>{if(M<=Pe)return{x:0,y:0};const j=(M-1)/(2*M)*100,V=(M-1)/(2*M)*100;return{x:Math.max(-j,Math.min(j,O)),y:Math.max(-V,Math.min(V,ue))}};b.useEffect(()=>{if(!d||!Ne)return;let O=null;const ue=()=>{O&&clearInterval(O),!document.hidden&&(O=setInterval(()=>{var j;if(!k.current){const V=((j=l.current)==null?void 0:j.clientWidth)||0,X=Math.max(400,Math.ceil(V/100)*100);we.current(X)}},f))},M=()=>{document.hidden?(O&&clearInterval(O),O=null):ue()};return ue(),document.addEventListener("visibilitychange",M),()=>{O&&clearInterval(O),document.removeEventListener("visibilitychange",M)}},[d,Ne,f]);const Mt=(O,ue)=>{if(!c.current)return null;const M=c.current.getBoundingClientRect();return!M.width||!M.height?null:{nx:Math.max(0,Math.min(1,(O-M.left)/M.width)),ny:Math.max(0,Math.min(1,(ue-M.top)/M.height))}},Mr=(O,ue,M)=>{const j=a.current;if(!j)return;const V=j.getBoundingClientRect(),X=++L.current;N(he=>[...he,{id:X,x:O-V.left,y:ue-V.top,type:M}]),setTimeout(()=>N(he=>he.filter(ce=>ce.id!==X)),600)},K=(O,ue,M)=>{const j=c.current,V=a.current;if(!j||!V)return;const X=j.getBoundingClientRect(),he=V.getBoundingClientRect(),ce=j.naturalWidth||X.width,ve=j.naturalHeight||X.height,pe=ce/ve,le=X.width/X.height;let Te,_e,Ye,pt;pe>le?(Te=X.width,_e=X.width/pe,Ye=0,pt=(X.height-_e)/2):(_e=X.height,Te=X.height*pe,Ye=(X.width-Te)/2,pt=0);const Ct=X.left-he.left+Ye+Te*O,ar=X.top-he.top+pt+_e*ue,Zt=++L.current;N(xr=>[...xr,{id:Zt,x:Ct,y:ar,type:M}]),setTimeout(()=>N(xr=>xr.filter(Ji=>Ji.id!==Zt)),600)},ne=async O=>{var M;const ue=Mt(O.clientX,O.clientY);if(ue){g(`Click: ${Math.round(ue.nx*100)}%, ${Math.round(ue.ny*100)}%`),Mr(O.clientX,O.clientY,"left"),(M=l.current)==null||M.focus();try{const j=await n("input_click",{nx:ue.nx,ny:ue.ny});j!=null&&j.success||i(`❌ Click failed: ${j==null?void 0:j.error}`)}catch(j){i(`❌ Click error: ${j.message||j}`)}}},Se=async(O,ue,M,j=0)=>{try{await n("input_key",{type:M?"char":"keyDown",key:O,code:ue,text:M?O:void 0,unmodifiedText:M?O:void 0,modifiers:j})}catch(V){i(`❌ Key error: ${V.message||V}`)}},Me=async O=>{if(O.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(O.key)&&O.preventDefault();let M=0;O.altKey&&(M|=1),O.ctrlKey&&(M|=2),O.metaKey&&(M|=4),O.shiftKey&&(M|=8),g(`Key: ${O.key}`),await Se(O.key,O.code,O.key.length===1,M)},$e=async O=>{if(O.key==="Enter"){if(O.nativeEvent.isComposing)return;if(S){const ue=S;_(""),g(`IME Sent: ${ue}`);try{const M=await n("input_type",{text:ue});M!=null&&M.success||i(`❌ IME error: ${M==null?void 0:M.error}`)}catch(M){i(`❌ IME error: ${M.message}`)}}else g("Key: Enter"),await Se("Enter","Enter",!1)}};b.useEffect(()=>{const O=l.current;if(!O)return;const ue=M=>{var j;if((j=c.current)!=null&&j.contains(M.target)){M.preventDefault();const V=Date.now();if(V-ae.current<40)return;ae.current=V;const X=Mt(M.clientX,M.clientY);if(!X)return;g(`Scroll: ${Math.round(M.deltaY)}`),n("input_wheel",{nx:X.nx,ny:X.ny,deltaX:Math.round(M.deltaX),deltaY:Math.round(M.deltaY)}).catch(()=>{})}};return O.addEventListener("wheel",ue,{passive:!1}),()=>O.removeEventListener("wheel",ue)},[n]);const[ft,It]=b.useState(null),Ee=b.useRef(null);return b.useEffect(()=>{if(A==="mouse"&&!Ee.current){const O={nx:.5,ny:.5};Ee.current=O,It(O)}},[A]),b.useEffect(()=>{const O=l.current;if(!O)return;const ue=ce=>{if(!c.current)return null;const ve=c.current.getBoundingClientRect();return!ve.width||!ve.height?null:{nx:Math.max(0,Math.min(1,(ce.clientX-ve.left)/ve.width)),ny:Math.max(0,Math.min(1,(ce.clientY-ve.top)/ve.height))}},M=(ce,ve)=>{if(!c.current)return{dnx:0,dny:0};const pe=c.current,le=pe.getBoundingClientRect(),Te=pe.naturalWidth||le.width,_e=pe.naturalHeight||le.height,Ye=Te/_e,pt=le.width/le.height;let Ct,ar;return Ye>pt?(Ct=le.width,ar=le.width/Ye):(ar=le.height,Ct=le.height*Ye),{dnx:ce/Ct,dny:ve/ar}},j=(ce,ve,pe)=>{if(pe<=1.05)return;const le=-(ce-.5)*100,Te=-(ve-.5)*100,_e=qe(le,Te,pe);(Math.abs(_e.x-J.current)>.1||Math.abs(_e.y-oe.current)>.1)&&(W(_e.x),Q(_e.y),J.current=_e.x,oe.current=_e.y)},V=ce=>{if(ce.preventDefault(),ce.touches.length===1){const ve=ce.touches[0];Y.current={x:ve.clientX,y:ve.clientY,time:Date.now()},te.current={x:ve.clientX,y:ve.clientY},me.current||(fe.current=!1),de.current=setTimeout(()=>{if(!fe.current&&!me.current)if(fe.current=!0,Fe.current==="mouse"){const pe=Ee.current||{nx:.5,ny:.5};g("Right Click"),K(pe.nx,pe.ny,"right"),U.current("input_click",{...pe,button:"right"}).catch(()=>{})}else{const pe=ue(ve);pe&&(g("Right Click"),K(pe.nx,pe.ny,"right"),U.current("input_click",{...pe,button:"right"}).catch(()=>{}))}},500)}else if(ce.touches.length===2){clearTimeout(de.current),fe.current=!0,me.current=!0;const ve=ce.touches[1].clientX-ce.touches[0].clientX,pe=ce.touches[1].clientY-ce.touches[0].clientY;Ve.current=Math.sqrt(ve*ve+pe*pe),Ie.current=Re.current,G.current={x:(ce.touches[0].clientX+ce.touches[1].clientX)/2,y:(ce.touches[0].clientY+ce.touches[1].clientY)/2}}},X=ce=>{if(ce.preventDefault(),ce.touches.length===1&&te.current){const ve=ce.touches[0],pe=ve.clientX-te.current.x,le=ve.clientY-te.current.y;if(!fe.current&&Y.current){const Te=ve.clientX-Y.current.x,_e=ve.clientY-Y.current.y;Math.sqrt(Te*Te+_e*_e)>8&&(fe.current=!0,clearTimeout(de.current))}if(fe.current)if(Fe.current==="mouse"){const Te=M(pe,le),_e=Ee.current||{nx:.5,ny:.5},Ye=Math.max(0,Math.min(1,_e.nx+Te.dnx)),pt=Math.max(0,Math.min(1,_e.ny+Te.dny));Ee.current={nx:Ye,ny:pt},It({nx:Ye,ny:pt}),g(`Cursor: ${Math.round(Ye*100)}%, ${Math.round(pt*100)}%`),j(Ye,pt,Re.current);const Ct=Date.now();Ct-ae.current>=30&&(ae.current=Ct,U.current("input_mouseMoved",{nx:Ye,ny:pt}).catch(()=>{}))}else if(Re.current>1){const Te=a.current;if(Te){const _e=Te.clientWidth,Ye=Te.clientHeight,pt=J.current+pe/_e*100,Ct=oe.current+le/Ye*100,ar=qe(pt,Ct,Re.current);W(ar.x),Q(ar.y),J.current=ar.x,oe.current=ar.y}}else{const Te=ue(ve);if(Te){const _e=Date.now();_e-ae.current>=40&&(ae.current=_e,g("Scroll"),U.current("input_wheel",{nx:Te.nx,ny:Te.ny,deltaX:Math.round(-pe*2.5),deltaY:Math.round(-le*2.5)}).catch(()=>{}))}}te.current={x:ve.clientX,y:ve.clientY}}else if(ce.touches.length===2&&Ve.current!==null){const ve=ce.touches[1].clientX-ce.touches[0].clientX,pe=ce.touches[1].clientY-ce.touches[0].clientY,Te=Math.sqrt(ve*ve+pe*pe)/Ve.current,_e=(ce.touches[0].clientX+ce.touches[1].clientX)/2,Ye=(ce.touches[0].clientY+ce.touches[1].clientY)/2,pt=_e-G.current.x,Ct=Ye-G.current.y,ar=Math.abs(Te-1)>.03;if(Fe.current==="mouse"){if(ar){const Zt=Math.max(Pe,Math.min(5,Ie.current*Te));H(Zt),Re.current=Zt}else if(Math.abs(pt)>2||Math.abs(Ct)>2){const Zt=Ee.current||{nx:.5,ny:.5},xr=Date.now();xr-ae.current>=30&&(ae.current=xr,g("Scroll"),U.current("input_wheel",{nx:Zt.nx,ny:Zt.ny,deltaX:Math.round(-pt*3),deltaY:Math.round(-Ct*3)}).catch(()=>{}))}}else{const Zt=Math.max(Pe,Math.min(5,Ie.current*Te));H(Zt),Re.current=Zt;const xr=a.current;if(xr&&Zt>1){const Ji=xr.clientWidth,Mc=xr.clientHeight,Ic=J.current+pt/Ji*100,Dc=oe.current+Ct/Mc*100,On=qe(Ic,Dc,Zt);W(On.x),Q(On.y),J.current=On.x,oe.current=On.y}}G.current={x:_e,y:Ye}}},he=ce=>{var ve;if(clearTimeout(de.current),Ve.current=null,ce.touches.length===1&&me.current){const pe=ce.touches[0];Y.current={x:pe.clientX,y:pe.clientY,time:Date.now()},te.current={x:pe.clientX,y:pe.clientY},fe.current=!0;return}if(ce.touches.length===0){if(me.current){me.current=!1,fe.current=!1;return}if(ce.changedTouches.length===1&&!fe.current){const pe=ce.changedTouches[0],le=Date.now(),Te=le-(((ve=Y.current)==null?void 0:ve.time)||0);if(Te<60||Te>400){fe.current=!1;return}if(Y.current){const _e=pe.clientX-Y.current.x,Ye=pe.clientY-Y.current.y;if(Math.sqrt(_e*_e+Ye*Ye)>12){fe.current=!1;return}}if(Fe.current==="mouse"){const _e=Ee.current||ue(pe);_e&&(g(`Click: ${Math.round(_e.nx*100)}%, ${Math.round(_e.ny*100)}%`),K(_e.nx,_e.ny,"left"),U.current("input_click",{..._e}).catch(()=>{}))}else{const _e=ue(pe);if(!_e)return;le-Oe.current<300?(g("Double tap"),K(_e.nx,_e.ny,"double"),U.current("input_click",{..._e,clickCount:2}).catch(()=>{}),Oe.current=0):(g(`Tap: ${Math.round(_e.nx*100)}%, ${Math.round(_e.ny*100)}%`),K(_e.nx,_e.ny,"left"),U.current("input_click",{..._e}).catch(()=>{}),Oe.current=le)}}fe.current=!1}};return O.addEventListener("touchstart",V,{passive:!1}),O.addEventListener("touchmove",X,{passive:!1}),O.addEventListener("touchend",he,{passive:!1}),()=>{O.removeEventListener("touchstart",V),O.removeEventListener("touchmove",X),O.removeEventListener("touchend",he),clearTimeout(de.current)}},[]),u.jsxs("div",{ref:l,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:Me,onContextMenu:O=>O.preventDefault(),onFocus:()=>x(!0),onBlur:()=>x(!1),tabIndex:0,children:[u.jsxs("div",{ref:a,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[ze?u.jsx("img",{ref:c,src:ze,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${D}) translate(${I}%, ${y}%)`,transformOrigin:"center center",cursor:A==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:ne,onContextMenu:O=>O.preventDefault(),onDragStart:O=>O.preventDefault()}):u.jsxs("div",{className:"text-slate-800 text-center",children:[u.jsx("div",{className:"text-5xl mb-3",children:"🌑"}),u.jsx("div",{className:"text-[13px] font-semibold",children:"Connecting to Host..."})]}),A==="mouse"&&ft&&ze&&c.current&&(()=>{var Ct;const O=c.current,ue=O.getBoundingClientRect(),M=(Ct=a.current)==null?void 0:Ct.getBoundingClientRect();if(!M)return null;const j=O.naturalWidth||ue.width,V=O.naturalHeight||ue.height,X=j/V,he=ue.width/ue.height;let ce,ve,pe,le;X>he?(ce=ue.width,ve=ue.width/X,pe=0,le=(ue.height-ve)/2):(ve=ue.height,ce=ue.height*X,pe=(ue.width-ce)/2,le=0);const Te=ue.left-M.left+pe+ce*ft.nx,_e=ue.top-M.top+le+ve*ft.ny,Ye=Math.max(8,Math.min(M.width-8,Te)),pt=Math.max(8,Math.min(M.height-8,_e));return u.jsxs("div",{style:{position:"absolute",left:Ye-8,top:pt-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[u.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),u.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),u.jsx("div",{style:{position:"absolute",left:5,top:5,width:6,height:6,borderRadius:"50%",background:"#3b82f6",boxShadow:"0 0 8px rgba(59,130,246,0.6)"}})]})})(),w.map(O=>{const M={left:"59,130,246",right:"239,68,68",double:"34,197,94"}[O.type];return u.jsxs("div",{style:{position:"absolute",left:O.x,top:O.y,pointerEvents:"none",zIndex:200,transform:"translate(-50%, -50%)"},children:[u.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`2px solid rgba(${M}, 0.8)`,animation:"click-ripple-ring 0.5s ease-out forwards",position:"absolute",left:-20,top:-20}}),u.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:`rgba(${M}, 0.9)`,boxShadow:`0 0 12px rgba(${M}, 0.6)`,animation:"click-ripple-dot 0.4s ease-out forwards",position:"absolute",left:-4,top:-4}})]},O.id)})]}),u.jsxs("div",{onTouchStart:O=>O.stopPropagation(),className:"absolute bottom-0 left-0 right-0 z-[1000] flex items-center justify-center gap-1.5 px-3 py-2 bg-black/75 backdrop-blur-xl border-t border-white/[0.08] touch-none",children:[u.jsxs("div",{onClick:()=>{R(O=>{const ue=O==="touch"?"mouse":"touch";if(ue==="mouse"&&!Ee.current){const M={nx:.5,ny:.5};Ee.current=M,It(M)}return ue})},className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${A==="mouse"?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:[u.jsx("span",{className:"text-sm",children:A==="mouse"?"🖱️":"👆"}),u.jsx("span",{className:`text-[10px] font-bold ${A==="mouse"?"text-blue-400":"text-slate-400"}`,children:A==="mouse"?"Mouse":"Touch"})]}),u.jsxs("div",{className:"relative",children:[u.jsx("div",{onClick:()=>{q(!T),F(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${T?"bg-emerald-500/25 border border-emerald-500/40":"bg-white/[0.08] border border-white/10"}`,children:u.jsx("span",{className:"text-sm",children:"⌨️"})}),T&&u.jsx("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 w-[220px] bg-neutral-950/[0.98] backdrop-blur-[30px] rounded-xl border border-white/20 p-[10px_12px] shadow-[0_10px_30px_rgba(0,0,0,0.8)] flex flex-col gap-2 z-[2000]",style:{animation:"slideUp 0.15s ease-out"},children:u.jsx("input",{type:"text",placeholder:"Type & Enter...",value:S,autoFocus:!0,onTouchStart:O=>O.stopPropagation(),onChange:O=>_(O.target.value),onKeyDown:$e,className:"w-full bg-black/60 border border-white/15 rounded-lg px-2.5 py-2 text-white text-[13px] outline-none"})})]}),u.jsx("div",{className:"relative",children:u.jsx("div",{onClick:()=>{F(!C),q(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${C?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:u.jsx("span",{className:"text-sm",children:"⚙️"})})}),u.jsx("div",{className:"w-px h-[18px] bg-white/10"}),u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 rounded-md",style:{background:We?"rgba(16,185,129,0.12)":"rgba(251,191,36,0.12)"},children:[u.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:We?"#10b981":"#fbbf24"}}),u.jsx("span",{className:"text-[8px] font-extrabold",style:{color:We?"#10b981":"#fbbf24"},children:We?"Connected":"WS"})]}),D>1&&u.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(D*100),"%"]}),m&&u.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:m})]})]}),C&&u.jsxs("div",{onTouchStart:O=>O.stopPropagation(),style:{position:"absolute",bottom:56,left:"50%",transform:"translateX(-50%)",width:220,background:"rgba(23, 23, 23, 0.95)",backdropFilter:"blur(25px)",borderRadius:14,border:"1px solid rgba(255,255,255,0.1)",padding:14,boxShadow:"0 12px 40px rgba(0,0,0,0.6)",display:"flex",flexDirection:"column",gap:12,zIndex:1001,touchAction:"none",animation:"slideUpSidebar 0.15s ease-out"},children:[u.jsx("div",{style:{fontSize:9,fontWeight:900,color:"#3b82f6",letterSpacing:1.5},children:"SETTINGS"}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[u.jsxs("div",{style:{fontSize:10,color:"#888",fontWeight:700},children:["ZOOM: ",D<=(E?P:1)+.01?E?"FILL":"FIT":`${Math.round(D*100)}%`]}),u.jsxs("div",{style:{display:"flex",gap:4},children:[u.jsx("button",{onClick:O=>{O.stopPropagation(),H(ue=>Math.max(.5,ue-.25))},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"−"}),u.jsx("button",{onClick:O=>{O.stopPropagation();const ue=E?P:1;H(ue),Re.current=ue,W(0),Q(0)},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:9,fontWeight:800,cursor:"pointer"},children:E?"FILL":"FIT"}),u.jsx("button",{onClick:O=>{O.stopPropagation(),H(ue=>Math.min(5,ue+.25))},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"+"})]})]}),u.jsx("button",{onClick:O=>{var j;O.stopPropagation();const ue=((j=l.current)==null?void 0:j.clientWidth)||0,M=ue>0?Math.max(400,Math.ceil(ue/100)*100):void 0;r(M)},style:{width:"100%",background:"#3b82f6",color:"#fff",border:"none",padding:"8px",borderRadius:6,fontSize:11,fontWeight:800,cursor:"pointer"},children:"FORCE SYNC"}),u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(255,255,255,0.05)",padding:"6px 10px",borderRadius:6},children:[u.jsx("span",{style:{fontSize:10,color:"#888",fontWeight:700},children:"AUTO REF."}),u.jsx("input",{type:"checkbox",checked:d,onChange:O=>h(O.target.checked)})]}),u.jsxs("select",{value:f,onChange:O=>p(Number(O.target.value)),style:{background:"rgba(255,255,255,0.05)",color:"#fff",border:"none",borderRadius:6,padding:"6px",fontSize:10,fontWeight:600,outline:"none"},children:[u.jsx("option",{value:500,children:"0.5s Interval"}),u.jsx("option",{value:1e3,children:"1.0s Interval"}),u.jsx("option",{value:2e3,children:"2.0s Interval"}),u.jsx("option",{value:4e3,children:"4.0s Interval"})]})]}),u.jsx("style",{children:`
|
|
158
|
+
*/var _R=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){let r=xR.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,n)=>{if(this._options.hover){let{range:i}=t;this._options.hover(r,n,i)}},t))}};function vR(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var xR=class _a{static computeLink(t,r,n,i){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=_a._getWindowedLineStrings(t-1,n),a=o.join(""),c,d=[];for(;c=s.exec(a);){let h=c[0];if(!vR(h))continue;let[f,p]=_a._mapStrIdx(n,l,0,c.index),[m,g]=_a._mapStrIdx(n,f,p,h.length);if(f===-1||p===-1||m===-1||g===-1)continue;let S={start:{x:p+1,y:f+1},end:{x:g,y:m+1}};d.push({range:S,text:h,activate:i})}return d}static _getWindowedLineStrings(t,r){let n,i=t,s=t,o=0,l="",a=[];if(n=r.buffer.active.getLine(t)){let c=n.translateToString(!0);if(n.isWrapped&&c[0]!==" "){for(o=0;(n=r.buffer.active.getLine(--i))&&o<2048&&(l=n.translateToString(!0),o+=l.length,a.push(l),!(!n.isWrapped||l.indexOf(" ")!==-1)););a.reverse()}for(a.push(c),o=0;(n=r.buffer.active.getLine(++s))&&n.isWrapped&&o<2048&&(l=n.translateToString(!0),o+=l.length,a.push(l),l.indexOf(" ")===-1););}return[a,i]}static _mapStrIdx(t,r,n,i){let s=t.buffer.active,o=s.getNullCell(),l=n;for(;i;){let a=s.getLine(r);if(!a)return[-1,-1];for(let c=l;c<a.length;++c){a.getCell(c,o);let d=o.getChars();if(o.getWidth()&&(i-=d.length||1,c===a.length-1&&d==="")){let h=s.getLine(r+1);h&&h.isWrapped&&(h.getCell(0,o),o.getWidth()===2&&(i+=1))}if(i<0)return[r,c]}r++,l=0}return[r,l]}},yR=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function bR(e,t){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 wR=class{constructor(e=bR,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||yR;this._linkProvider=this._terminal.registerLinkProvider(new _R(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const z_={background:"#0f1117",foreground:"#cdd6f4",cursor:"#f38ba8",cursorAccent:"#0f1117",selectionBackground:"rgba(166, 227, 161, 0.3)",selectionForeground:"#cdd6f4",black:"#45475a",red:"#f38ba8",green:"#a6e3a1",yellow:"#f9e2af",blue:"#89b4fa",magenta:"#cba6f7",cyan:"#94e2d5",white:"#bac2de",brightBlack:"#585b70",brightRed:"#f38ba8",brightGreen:"#a6e3a1",brightYellow:"#f9e2af",brightBlue:"#89b4fa",brightMagenta:"#cba6f7",brightCyan:"#94e2d5",brightWhite:"#a6adc8"},$1=b.forwardRef(({onInput:e,onResize:t,fontSize:r=13},n)=>{const i=b.useRef(null),s=b.useRef(null),o=b.useRef(null),[l,a]=b.useState(!1);return b.useImperativeHandle(n,()=>({write:c=>{var d;(d=s.current)==null||d.write(c)},clear:()=>{var c;(c=s.current)==null||c.clear()},fit:()=>{var c;try{(c=o.current)==null||c.fit(),s.current&&(t==null||t(s.current.cols,s.current.rows))}catch{}},bumpResize:()=>{var c;try{(c=o.current)==null||c.fit();const d=s.current;if(!d)return;const h=d.cols,f=d.rows;t==null||t(h+5,f),setTimeout(()=>{t==null||t(h,f)},100)}catch{}}})),b.useEffect(()=>{if(!i.current)return;const c=new fR({cursorBlink:!0,cursorStyle:"bar",fontSize:r,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:z_,allowTransparency:!0,scrollback:5e3,convertEol:!1}),d=new gR,h=new wR;c.loadAddon(d),c.loadAddon(h),c.open(i.current),requestAnimationFrame(()=>{d.fit(),t==null||t(c.cols,c.rows),a(!0)});const f=c.onData(m=>{e(m)}),p=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{d.fit(),t==null||t(c.cols,c.rows)}catch{}})});return p.observe(i.current),s.current=c,o.current=d,()=>{f.dispose(),p.disconnect(),c.dispose(),s.current=null,o.current=null}},[r]),u.jsx("div",{ref:i,className:"w-full h-full rounded-lg overflow-hidden transition-opacity duration-200",style:{background:z_.background,opacity:l?1:0}})});$1.displayName="CliTerminal";function $_({label:e,value:t,sub:r,icon:n}){return u.jsxs("div",{className:"px-4 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[u.jsx("span",{className:"text-base flex items-center",children:n}),u.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wide font-semibold",children:e})]}),u.jsx("div",{className:"text-[22px] font-bold text-text-primary tracking-tight",children:t}),r&&u.jsx("div",{className:"text-[11px] text-text-muted mt-0.5",children:r})]})}function F_({value:e,max:t,label:r,color:n="#8b5cf6",detail:i,compact:s=!1}){const o=t>0?Math.min(Math.round(e/t*100),100):0,l=o>85?"#ef4444":o>60?"#f59e0b":n;return s?u.jsxs("div",{className:"flex-1",children:[u.jsxs("div",{className:"flex justify-between mb-0.5",children:[u.jsx("span",{className:"text-[9px] text-text-muted uppercase tracking-wide font-semibold",children:r}),u.jsxs("span",{className:"text-[10px] text-text-secondary font-semibold",children:[o,"%"]})]}),u.jsx("div",{className:"h-1 bg-white/[0.04] rounded-sm overflow-hidden",children:u.jsx("div",{className:"h-full rounded-sm transition-[width] duration-500",style:{width:`${o}%`,background:l}})})]}):u.jsxs("div",{className:"flex-1",children:[u.jsxs("div",{className:"flex justify-between mb-1.5",children:[u.jsx("span",{className:"text-[11px] text-text-secondary font-medium",children:r}),u.jsxs("span",{className:"text-[13px] text-text-primary font-bold",children:[o,"%"]})]}),u.jsx("div",{className:"h-1.5 bg-white/[0.04] rounded-sm overflow-hidden",children:u.jsx("div",{className:"h-full rounded-sm transition-[width] duration-[600ms]",style:{width:`${o}%`,background:`linear-gradient(90deg, ${l}, ${l}cc)`}})}),i&&u.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:i})]})}function SR({screenshot:e,isCapturing:t,onRefresh:r,onAction:n,addLog:i,connState:s,connScreenshot:o}){const l=b.useRef(null),a=b.useRef(null),c=b.useRef(null),[d,h]=b.useState(!0),[f,p]=b.useState(2e3),[m,g]=b.useState(null),[S,_]=b.useState(""),[,x]=b.useState(!1),[w,N]=b.useState([]),L=b.useRef(0),[C,F]=b.useState(!1),[P,q]=b.useState(!1),E=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[A,R]=b.useState(E?"mouse":"touch"),[T,$]=b.useState(1),z=b.useRef(!1),[D,H]=b.useState(1),[I,W]=b.useState(0),[y,J]=b.useState(0),ae=b.useRef(0),k=b.useRef(t),we=b.useRef(r),U=b.useRef(n),Y=b.useRef(null),te=b.useRef(null),fe=b.useRef(!1),de=b.useRef(null),Oe=b.useRef(0),Ve=b.useRef(null),Ie=b.useRef(1),G=b.useRef({x:0,y:0}),me=b.useRef(!1),Re=b.useRef(D),Q=b.useRef(I),oe=b.useRef(y),Fe=b.useRef(A);b.useEffect(()=>{k.current=t},[t]),b.useEffect(()=>{we.current=r},[r]),b.useEffect(()=>{Re.current=D},[D]),b.useEffect(()=>{Q.current=I},[I]),b.useEffect(()=>{oe.current=y},[y]),b.useEffect(()=>{U.current=n},[n]),b.useEffect(()=>{Fe.current=A},[A]),b.useEffect(()=>{var O;(O=l.current)==null||O.focus()},[]);const We=s==="connected",Ne=s!=="connected"&&s!=="connecting",ze=We&&o?o:e;b.useEffect(()=>{if(!E||z.current||!ze)return;const O=c.current,ue=a.current;if(!O||!ue)return;const M=()=>{const j=ue.clientWidth,V=ue.clientHeight,X=O.naturalWidth,he=O.naturalHeight;if(!X||!he||!j||!V)return;const ce=Math.min(j/X,V/he),pe=Math.max(j/X,V/he)/ce;pe>1.01&&($(pe),H(pe),Re.current=pe),z.current=!0};O.complete&&O.naturalWidth?M():O.addEventListener("load",M,{once:!0})},[ze,E]);const Te=.5;b.useEffect(()=>{D<=Te&&(W(0),J(0))},[D,Te]);const qe=(O,ue,M)=>{if(M<=Te)return{x:0,y:0};const j=(M-1)/(2*M)*100,V=(M-1)/(2*M)*100;return{x:Math.max(-j,Math.min(j,O)),y:Math.max(-V,Math.min(V,ue))}};b.useEffect(()=>{if(!d||!Ne)return;let O=null;const ue=()=>{O&&clearInterval(O),!document.hidden&&(O=setInterval(()=>{var j;if(!k.current){const V=((j=l.current)==null?void 0:j.clientWidth)||0,X=Math.max(400,Math.ceil(V/100)*100);we.current(X)}},f))},M=()=>{document.hidden?(O&&clearInterval(O),O=null):ue()};return ue(),document.addEventListener("visibilitychange",M),()=>{O&&clearInterval(O),document.removeEventListener("visibilitychange",M)}},[d,Ne,f]);const Mt=(O,ue)=>{if(!c.current)return null;const M=c.current.getBoundingClientRect();return!M.width||!M.height?null:{nx:Math.max(0,Math.min(1,(O-M.left)/M.width)),ny:Math.max(0,Math.min(1,(ue-M.top)/M.height))}},Mr=(O,ue,M)=>{const j=a.current;if(!j)return;const V=j.getBoundingClientRect(),X=++L.current;N(he=>[...he,{id:X,x:O-V.left,y:ue-V.top,type:M}]),setTimeout(()=>N(he=>he.filter(ce=>ce.id!==X)),600)},K=(O,ue,M)=>{const j=c.current,V=a.current;if(!j||!V)return;const X=j.getBoundingClientRect(),he=V.getBoundingClientRect(),ce=j.naturalWidth||X.width,ve=j.naturalHeight||X.height,pe=ce/ve,le=X.width/X.height;let Pe,_e,Ye,pt;pe>le?(Pe=X.width,_e=X.width/pe,Ye=0,pt=(X.height-_e)/2):(_e=X.height,Pe=X.height*pe,Ye=(X.width-Pe)/2,pt=0);const Ct=X.left-he.left+Ye+Pe*O,ar=X.top-he.top+pt+_e*ue,Zt=++L.current;N(xr=>[...xr,{id:Zt,x:Ct,y:ar,type:M}]),setTimeout(()=>N(xr=>xr.filter(Ji=>Ji.id!==Zt)),600)},ne=async O=>{var M;const ue=Mt(O.clientX,O.clientY);if(ue){g(`Click: ${Math.round(ue.nx*100)}%, ${Math.round(ue.ny*100)}%`),Mr(O.clientX,O.clientY,"left"),(M=l.current)==null||M.focus();try{const j=await n("input_click",{nx:ue.nx,ny:ue.ny});j!=null&&j.success||i(`❌ Click failed: ${j==null?void 0:j.error}`)}catch(j){i(`❌ Click error: ${j.message||j}`)}}},Se=async(O,ue,M,j=0)=>{try{await n("input_key",{type:M?"char":"keyDown",key:O,code:ue,text:M?O:void 0,unmodifiedText:M?O:void 0,modifiers:j})}catch(V){i(`❌ Key error: ${V.message||V}`)}},Me=async O=>{if(O.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(O.key)&&O.preventDefault();let M=0;O.altKey&&(M|=1),O.ctrlKey&&(M|=2),O.metaKey&&(M|=4),O.shiftKey&&(M|=8),g(`Key: ${O.key}`),await Se(O.key,O.code,O.key.length===1,M)},$e=async O=>{if(O.key==="Enter"){if(O.nativeEvent.isComposing)return;if(S){const ue=S;_(""),g(`IME Sent: ${ue}`);try{const M=await n("input_type",{text:ue});M!=null&&M.success||i(`❌ IME error: ${M==null?void 0:M.error}`)}catch(M){i(`❌ IME error: ${M.message}`)}}else g("Key: Enter"),await Se("Enter","Enter",!1)}};b.useEffect(()=>{const O=l.current;if(!O)return;const ue=M=>{var j;if((j=c.current)!=null&&j.contains(M.target)){M.preventDefault();const V=Date.now();if(V-ae.current<40)return;ae.current=V;const X=Mt(M.clientX,M.clientY);if(!X)return;g(`Scroll: ${Math.round(M.deltaY)}`),n("input_wheel",{nx:X.nx,ny:X.ny,deltaX:Math.round(M.deltaX),deltaY:Math.round(M.deltaY)}).catch(()=>{})}};return O.addEventListener("wheel",ue,{passive:!1}),()=>O.removeEventListener("wheel",ue)},[n]);const[ft,It]=b.useState(null),Ee=b.useRef(null);return b.useEffect(()=>{if(A==="mouse"&&!Ee.current){const O={nx:.5,ny:.5};Ee.current=O,It(O)}},[A]),b.useEffect(()=>{const O=l.current;if(!O)return;const ue=ce=>{if(!c.current)return null;const ve=c.current.getBoundingClientRect();return!ve.width||!ve.height?null:{nx:Math.max(0,Math.min(1,(ce.clientX-ve.left)/ve.width)),ny:Math.max(0,Math.min(1,(ce.clientY-ve.top)/ve.height))}},M=(ce,ve)=>{if(!c.current)return{dnx:0,dny:0};const pe=c.current,le=pe.getBoundingClientRect(),Pe=pe.naturalWidth||le.width,_e=pe.naturalHeight||le.height,Ye=Pe/_e,pt=le.width/le.height;let Ct,ar;return Ye>pt?(Ct=le.width,ar=le.width/Ye):(ar=le.height,Ct=le.height*Ye),{dnx:ce/Ct,dny:ve/ar}},j=(ce,ve,pe)=>{if(pe<=1.05)return;const le=-(ce-.5)*100,Pe=-(ve-.5)*100,_e=qe(le,Pe,pe);(Math.abs(_e.x-Q.current)>.1||Math.abs(_e.y-oe.current)>.1)&&(W(_e.x),J(_e.y),Q.current=_e.x,oe.current=_e.y)},V=ce=>{if(ce.preventDefault(),ce.touches.length===1){const ve=ce.touches[0];Y.current={x:ve.clientX,y:ve.clientY,time:Date.now()},te.current={x:ve.clientX,y:ve.clientY},me.current||(fe.current=!1),de.current=setTimeout(()=>{if(!fe.current&&!me.current)if(fe.current=!0,Fe.current==="mouse"){const pe=Ee.current||{nx:.5,ny:.5};g("Right Click"),K(pe.nx,pe.ny,"right"),U.current("input_click",{...pe,button:"right"}).catch(()=>{})}else{const pe=ue(ve);pe&&(g("Right Click"),K(pe.nx,pe.ny,"right"),U.current("input_click",{...pe,button:"right"}).catch(()=>{}))}},500)}else if(ce.touches.length===2){clearTimeout(de.current),fe.current=!0,me.current=!0;const ve=ce.touches[1].clientX-ce.touches[0].clientX,pe=ce.touches[1].clientY-ce.touches[0].clientY;Ve.current=Math.sqrt(ve*ve+pe*pe),Ie.current=Re.current,G.current={x:(ce.touches[0].clientX+ce.touches[1].clientX)/2,y:(ce.touches[0].clientY+ce.touches[1].clientY)/2}}},X=ce=>{if(ce.preventDefault(),ce.touches.length===1&&te.current){const ve=ce.touches[0],pe=ve.clientX-te.current.x,le=ve.clientY-te.current.y;if(!fe.current&&Y.current){const Pe=ve.clientX-Y.current.x,_e=ve.clientY-Y.current.y;Math.sqrt(Pe*Pe+_e*_e)>8&&(fe.current=!0,clearTimeout(de.current))}if(fe.current)if(Fe.current==="mouse"){const Pe=M(pe,le),_e=Ee.current||{nx:.5,ny:.5},Ye=Math.max(0,Math.min(1,_e.nx+Pe.dnx)),pt=Math.max(0,Math.min(1,_e.ny+Pe.dny));Ee.current={nx:Ye,ny:pt},It({nx:Ye,ny:pt}),g(`Cursor: ${Math.round(Ye*100)}%, ${Math.round(pt*100)}%`),j(Ye,pt,Re.current);const Ct=Date.now();Ct-ae.current>=30&&(ae.current=Ct,U.current("input_mouseMoved",{nx:Ye,ny:pt}).catch(()=>{}))}else if(Re.current>1){const Pe=a.current;if(Pe){const _e=Pe.clientWidth,Ye=Pe.clientHeight,pt=Q.current+pe/_e*100,Ct=oe.current+le/Ye*100,ar=qe(pt,Ct,Re.current);W(ar.x),J(ar.y),Q.current=ar.x,oe.current=ar.y}}else{const Pe=ue(ve);if(Pe){const _e=Date.now();_e-ae.current>=40&&(ae.current=_e,g("Scroll"),U.current("input_wheel",{nx:Pe.nx,ny:Pe.ny,deltaX:Math.round(-pe*2.5),deltaY:Math.round(-le*2.5)}).catch(()=>{}))}}te.current={x:ve.clientX,y:ve.clientY}}else if(ce.touches.length===2&&Ve.current!==null){const ve=ce.touches[1].clientX-ce.touches[0].clientX,pe=ce.touches[1].clientY-ce.touches[0].clientY,Pe=Math.sqrt(ve*ve+pe*pe)/Ve.current,_e=(ce.touches[0].clientX+ce.touches[1].clientX)/2,Ye=(ce.touches[0].clientY+ce.touches[1].clientY)/2,pt=_e-G.current.x,Ct=Ye-G.current.y,ar=Math.abs(Pe-1)>.03;if(Fe.current==="mouse"){if(ar){const Zt=Math.max(Te,Math.min(5,Ie.current*Pe));H(Zt),Re.current=Zt}else if(Math.abs(pt)>2||Math.abs(Ct)>2){const Zt=Ee.current||{nx:.5,ny:.5},xr=Date.now();xr-ae.current>=30&&(ae.current=xr,g("Scroll"),U.current("input_wheel",{nx:Zt.nx,ny:Zt.ny,deltaX:Math.round(-pt*3),deltaY:Math.round(-Ct*3)}).catch(()=>{}))}}else{const Zt=Math.max(Te,Math.min(5,Ie.current*Pe));H(Zt),Re.current=Zt;const xr=a.current;if(xr&&Zt>1){const Ji=xr.clientWidth,Mc=xr.clientHeight,Ic=Q.current+pt/Ji*100,Dc=oe.current+Ct/Mc*100,On=qe(Ic,Dc,Zt);W(On.x),J(On.y),Q.current=On.x,oe.current=On.y}}G.current={x:_e,y:Ye}}},he=ce=>{var ve;if(clearTimeout(de.current),Ve.current=null,ce.touches.length===1&&me.current){const pe=ce.touches[0];Y.current={x:pe.clientX,y:pe.clientY,time:Date.now()},te.current={x:pe.clientX,y:pe.clientY},fe.current=!0;return}if(ce.touches.length===0){if(me.current){me.current=!1,fe.current=!1;return}if(ce.changedTouches.length===1&&!fe.current){const pe=ce.changedTouches[0],le=Date.now(),Pe=le-(((ve=Y.current)==null?void 0:ve.time)||0);if(Pe<60||Pe>400){fe.current=!1;return}if(Y.current){const _e=pe.clientX-Y.current.x,Ye=pe.clientY-Y.current.y;if(Math.sqrt(_e*_e+Ye*Ye)>12){fe.current=!1;return}}if(Fe.current==="mouse"){const _e=Ee.current||ue(pe);_e&&(g(`Click: ${Math.round(_e.nx*100)}%, ${Math.round(_e.ny*100)}%`),K(_e.nx,_e.ny,"left"),U.current("input_click",{..._e}).catch(()=>{}))}else{const _e=ue(pe);if(!_e)return;le-Oe.current<300?(g("Double tap"),K(_e.nx,_e.ny,"double"),U.current("input_click",{..._e,clickCount:2}).catch(()=>{}),Oe.current=0):(g(`Tap: ${Math.round(_e.nx*100)}%, ${Math.round(_e.ny*100)}%`),K(_e.nx,_e.ny,"left"),U.current("input_click",{..._e}).catch(()=>{}),Oe.current=le)}}fe.current=!1}};return O.addEventListener("touchstart",V,{passive:!1}),O.addEventListener("touchmove",X,{passive:!1}),O.addEventListener("touchend",he,{passive:!1}),()=>{O.removeEventListener("touchstart",V),O.removeEventListener("touchmove",X),O.removeEventListener("touchend",he),clearTimeout(de.current)}},[]),u.jsxs("div",{ref:l,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:Me,onContextMenu:O=>O.preventDefault(),onFocus:()=>x(!0),onBlur:()=>x(!1),tabIndex:0,children:[u.jsxs("div",{ref:a,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[ze?u.jsx("img",{ref:c,src:ze,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${D}) translate(${I}%, ${y}%)`,transformOrigin:"center center",cursor:A==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:ne,onContextMenu:O=>O.preventDefault(),onDragStart:O=>O.preventDefault()}):u.jsxs("div",{className:"text-slate-800 text-center",children:[u.jsx("div",{className:"text-5xl mb-3",children:"🌑"}),u.jsx("div",{className:"text-[13px] font-semibold",children:"Connecting to Host..."})]}),A==="mouse"&&ft&&ze&&c.current&&(()=>{var Ct;const O=c.current,ue=O.getBoundingClientRect(),M=(Ct=a.current)==null?void 0:Ct.getBoundingClientRect();if(!M)return null;const j=O.naturalWidth||ue.width,V=O.naturalHeight||ue.height,X=j/V,he=ue.width/ue.height;let ce,ve,pe,le;X>he?(ce=ue.width,ve=ue.width/X,pe=0,le=(ue.height-ve)/2):(ve=ue.height,ce=ue.height*X,pe=(ue.width-ce)/2,le=0);const Pe=ue.left-M.left+pe+ce*ft.nx,_e=ue.top-M.top+le+ve*ft.ny,Ye=Math.max(8,Math.min(M.width-8,Pe)),pt=Math.max(8,Math.min(M.height-8,_e));return u.jsxs("div",{style:{position:"absolute",left:Ye-8,top:pt-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[u.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),u.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),u.jsx("div",{style:{position:"absolute",left:5,top:5,width:6,height:6,borderRadius:"50%",background:"#3b82f6",boxShadow:"0 0 8px rgba(59,130,246,0.6)"}})]})})(),w.map(O=>{const M={left:"59,130,246",right:"239,68,68",double:"34,197,94"}[O.type];return u.jsxs("div",{style:{position:"absolute",left:O.x,top:O.y,pointerEvents:"none",zIndex:200,transform:"translate(-50%, -50%)"},children:[u.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`2px solid rgba(${M}, 0.8)`,animation:"click-ripple-ring 0.5s ease-out forwards",position:"absolute",left:-20,top:-20}}),u.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:`rgba(${M}, 0.9)`,boxShadow:`0 0 12px rgba(${M}, 0.6)`,animation:"click-ripple-dot 0.4s ease-out forwards",position:"absolute",left:-4,top:-4}})]},O.id)})]}),u.jsxs("div",{onTouchStart:O=>O.stopPropagation(),className:"absolute bottom-0 left-0 right-0 z-[1000] flex items-center justify-center gap-1.5 px-3 py-2 bg-black/75 backdrop-blur-xl border-t border-white/[0.08] touch-none",children:[u.jsxs("div",{onClick:()=>{R(O=>{const ue=O==="touch"?"mouse":"touch";if(ue==="mouse"&&!Ee.current){const M={nx:.5,ny:.5};Ee.current=M,It(M)}return ue})},className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${A==="mouse"?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:[u.jsx("span",{className:"text-sm",children:A==="mouse"?"🖱️":"👆"}),u.jsx("span",{className:`text-[10px] font-bold ${A==="mouse"?"text-blue-400":"text-slate-400"}`,children:A==="mouse"?"Mouse":"Touch"})]}),u.jsxs("div",{className:"relative",children:[u.jsx("div",{onClick:()=>{q(!P),F(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${P?"bg-emerald-500/25 border border-emerald-500/40":"bg-white/[0.08] border border-white/10"}`,children:u.jsx("span",{className:"text-sm",children:"⌨️"})}),P&&u.jsx("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 w-[220px] bg-neutral-950/[0.98] backdrop-blur-[30px] rounded-xl border border-white/20 p-[10px_12px] shadow-[0_10px_30px_rgba(0,0,0,0.8)] flex flex-col gap-2 z-[2000]",style:{animation:"slideUp 0.15s ease-out"},children:u.jsx("input",{type:"text",placeholder:"Type & Enter...",value:S,autoFocus:!0,onTouchStart:O=>O.stopPropagation(),onChange:O=>_(O.target.value),onKeyDown:$e,className:"w-full bg-black/60 border border-white/15 rounded-lg px-2.5 py-2 text-white text-[13px] outline-none"})})]}),u.jsx("div",{className:"relative",children:u.jsx("div",{onClick:()=>{F(!C),q(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${C?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:u.jsx("span",{className:"text-sm",children:"⚙️"})})}),u.jsx("div",{className:"w-px h-[18px] bg-white/10"}),u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 rounded-md",style:{background:We?"rgba(16,185,129,0.12)":"rgba(251,191,36,0.12)"},children:[u.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:We?"#10b981":"#fbbf24"}}),u.jsx("span",{className:"text-[8px] font-extrabold",style:{color:We?"#10b981":"#fbbf24"},children:We?"Connected":"WS"})]}),D>1&&u.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(D*100),"%"]}),m&&u.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:m})]})]}),C&&u.jsxs("div",{onTouchStart:O=>O.stopPropagation(),style:{position:"absolute",bottom:56,left:"50%",transform:"translateX(-50%)",width:220,background:"rgba(23, 23, 23, 0.95)",backdropFilter:"blur(25px)",borderRadius:14,border:"1px solid rgba(255,255,255,0.1)",padding:14,boxShadow:"0 12px 40px rgba(0,0,0,0.6)",display:"flex",flexDirection:"column",gap:12,zIndex:1001,touchAction:"none",animation:"slideUpSidebar 0.15s ease-out"},children:[u.jsx("div",{style:{fontSize:9,fontWeight:900,color:"#3b82f6",letterSpacing:1.5},children:"SETTINGS"}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[u.jsxs("div",{style:{fontSize:10,color:"#888",fontWeight:700},children:["ZOOM: ",D<=(E?T:1)+.01?E?"FILL":"FIT":`${Math.round(D*100)}%`]}),u.jsxs("div",{style:{display:"flex",gap:4},children:[u.jsx("button",{onClick:O=>{O.stopPropagation(),H(ue=>Math.max(.5,ue-.25))},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"−"}),u.jsx("button",{onClick:O=>{O.stopPropagation();const ue=E?T:1;H(ue),Re.current=ue,W(0),J(0)},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:9,fontWeight:800,cursor:"pointer"},children:E?"FILL":"FIT"}),u.jsx("button",{onClick:O=>{O.stopPropagation(),H(ue=>Math.min(5,ue+.25))},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"+"})]})]}),u.jsx("button",{onClick:O=>{var j;O.stopPropagation();const ue=((j=l.current)==null?void 0:j.clientWidth)||0,M=ue>0?Math.max(400,Math.ceil(ue/100)*100):void 0;r(M)},style:{width:"100%",background:"#3b82f6",color:"#fff",border:"none",padding:"8px",borderRadius:6,fontSize:11,fontWeight:800,cursor:"pointer"},children:"FORCE SYNC"}),u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(255,255,255,0.05)",padding:"6px 10px",borderRadius:6},children:[u.jsx("span",{style:{fontSize:10,color:"#888",fontWeight:700},children:"AUTO REF."}),u.jsx("input",{type:"checkbox",checked:d,onChange:O=>h(O.target.checked)})]}),u.jsxs("select",{value:f,onChange:O=>p(Number(O.target.value)),style:{background:"rgba(255,255,255,0.05)",color:"#fff",border:"none",borderRadius:6,padding:"6px",fontSize:10,fontWeight:600,outline:"none"},children:[u.jsx("option",{value:500,children:"0.5s Interval"}),u.jsx("option",{value:1e3,children:"1.0s Interval"}),u.jsx("option",{value:2e3,children:"2.0s Interval"}),u.jsx("option",{value:4e3,children:"4.0s Interval"})]})]}),u.jsx("style",{children:`
|
|
159
159
|
@keyframes slideUp {
|
|
160
160
|
from { opacity: 0; transform: translateY(6px); }
|
|
161
161
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -173,8 +173,8 @@ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){t
|
|
|
173
173
|
50% { transform: scale(1.8); opacity: 0.6; }
|
|
174
174
|
100% { transform: scale(0.5); opacity: 0; }
|
|
175
175
|
}
|
|
176
|
-
`})]})}function kR({screenshotUrl:e,mode:t="preview",zoom:r=100,interactive:n=!1,connectionState:i,onDismiss:s,onClickAt:o,onKeyDown:l,badge:a,emptyMessage:c,aspectRatio:d,className:h,style:f}){const p=b.useRef(null),m=b.useCallback(g=>{if(!n||!o||!p.current)return;const S=p.current,_=S.getBoundingClientRect(),x=(g.clientX-_.left)/_.width*S.naturalWidth,w=(g.clientY-_.top)/_.height*S.naturalHeight;o(x,w,S.naturalWidth,S.naturalHeight)},[n,o]);return t==="preview"?e?u.jsxs("div",{className:`relative rounded-xl overflow-hidden border border-border-subtle bg-bg-secondary ${h||""}`,style:{aspectRatio:d||"16/9",...f},children:[u.jsx("img",{ref:p,src:e,alt:"IDE Screenshot",className:"w-full h-full object-cover"}),s&&u.jsx("button",{onClick:s,className:"absolute top-2.5 right-2.5 bg-black/50 border-none text-white w-5 h-5 rounded-full text-[10px] z-10 cursor-pointer flex items-center justify-center",children:"✕"})]}):null:e?u.jsxs("div",{className:`${n?"screenshot-interactive":""} ${h||""} relative h-full flex items-center justify-center overflow-auto`,tabIndex:n?0:void 0,onKeyDown:n?l:void 0,style:f,children:[u.jsx("img",{ref:p,src:e,alt:"IDE Screenshot",onClick:n?m:void 0,className:"max-w-full max-h-full object-contain",style:{...n?{cursor:"crosshair"}:{},...r!==100?{transform:`scale(${r/100})`,transformOrigin:"center center"}:{}}}),a&&u.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 bg-black/70 text-white px-3.5 py-1.5 rounded-[20px] text-xs font-semibold backdrop-blur-sm",children:a})]}):u.jsxs("div",{className:`flex items-center justify-center flex-col gap-2 h-full text-text-muted ${h||""}`,style:f,children:[u.jsx("p",{className:"text-base",children:c||"🖥 Waiting for screenshot stream..."}),i&&u.jsxs("p",{className:"text-[13px] mt-2 opacity-50",children:["P2P: ",i]})]})}function F1({activeConv:e,onModalButton:t}){const[r,n]=b.useState(null);if(b.useEffect(()=>{n(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=o=>{r||(n(o),t(o))},s=o=>o.replace(/[⌥⏎⇧⌫⌘⌃↵]/g,"").replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi,"").trim();return u.jsxs("div",{className:"bg-gradient-to-br from-amber-600 to-amber-700 text-white py-2.5 px-4 shrink-0 z-[5]",children:[e.modalMessage&&u.jsx("div",{className:"text-[11px] opacity-85 mb-1.5 whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:e.modalMessage.replace(/[\n\r]+/g," ").slice(0,120)}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"font-black text-xs flex items-center gap-2",children:[u.jsx(qy,{size:14})," ",r?"PROCESSING...":"ACTION REQUIRED"]}),u.jsx("div",{className:"flex gap-2 flex-wrap",children:e.modalButtons.map((o,l)=>{const a=s(o).toLowerCase(),c=/^(run|approve|accept|yes|allow|always)/.test(a),d=/^(reject|deny|delete|remove|abort)/.test(a),h=r===o,f=r!==null;return u.jsx("button",{onClick:()=>i(o),disabled:f,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${c?"bg-white text-amber-700 font-extrabold":d?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${f&&!h?"opacity-40":"opacity-100"} ${f?"cursor-not-allowed":"cursor-pointer"}`,children:h?"⏳ ...":s(o)},l)})})]})]})}const Dr=new Map;function CR({ideId:e,ideType:t,agentType:r,agentName:n,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var we;const{sendCommand:a}=gi(),c=!!(o||l),d=`${e}:${r}`,h=Dr.get(d),[f,p]=b.useState(!1),[m,g]=b.useState(!1),[S,_]=b.useState((h==null?void 0:h.models)||[]),[x,w]=b.useState((h==null?void 0:h.modes)||[]),N=U=>U?typeof U=="string"?U:typeof U=="object"?U.name||U.id||JSON.stringify(U):String(U):"",[L,C]=b.useState(N(i)),[F,T]=b.useState(N(s)),[q,E]=b.useState(!1),[A,R]=b.useState(!1),P=b.useRef(0),$=U=>U.map(Y=>typeof Y=="string"?Y:(Y==null?void 0:Y.name)||(Y==null?void 0:Y.id)||String(Y));b.useEffect(()=>{if(o){const U=o.find(Y=>Y.category==="model");if(U){const Y=$(U.options.map(fe=>fe.value));_(Y),U.currentValue&&C(N(U.currentValue));const te=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...te,models:Y})}}if(l&&l.length>0){const U=$(l.map(te=>te.id));w(U);const Y=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...Y,modes:U})}else if(o){const U=o.find(Y=>Y.category!=="model");if(U){const Y=$(U.options.map(fe=>fe.value));w(Y),U.currentValue&&T(N(U.currentValue));const te=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...te,modes:Y})}}},[o,l,d]),b.useEffect(()=>{p(!1),g(!1),C(N(i)),T(N(s));const U=Dr.get(d);U?(_(U.models),w(U.modes)):(_([]),w([]))},[e,r]),b.useEffect(()=>{i&&Date.now()>P.current&&C(N(i))},[i]),b.useEffect(()=>{s&&Date.now()>P.current&&T(N(s))},[s]);const z=b.useCallback(async(U,Y={})=>{const te={...Y},fe=e.split(":");return fe.length>=3&&(fe[1]==="ide"||fe[1]==="cli"||fe[1]==="acp")&&(te._targetInstance=fe.slice(2).join(":"),te._targetType=fe[1]),await a(e,U,te)},[e]),D=async()=>{var U,Y;if(S.length>0){p(!f);return}if(c){p(!0);return}E(!0);try{const te=await z("list_extension_models",{agentType:r,ideType:t}),fe=(te==null?void 0:te.models)||((U=te==null?void 0:te.result)==null?void 0:U.models)||[],de=$(fe);_(de),te!=null&&te.current&&C(N(te.current)),(Y=te==null?void 0:te.result)!=null&&Y.current&&C(N(te.result.current));const Oe=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...Oe,models:de}),p(!0)}catch{}finally{E(!1)}},H=async()=>{var U,Y;if(x.length>0){g(!m);return}if(c){g(!0);return}R(!0);try{const te=await z("list_extension_modes",{agentType:r,ideType:t}),fe=(te==null?void 0:te.modes)||((U=te==null?void 0:te.result)==null?void 0:U.modes)||[],de=$(fe);w(de),te!=null&&te.current&&T(N(te.current)),(Y=te==null?void 0:te.result)!=null&&Y.current&&T(N(te.result.current));const Oe=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...Oe,modes:de}),g(!0)}catch{}finally{R(!1)}},I=async U=>{p(!1),C(U),P.current=Date.now()+5e3;try{c?await z("change_model",{agentType:r,ideType:t,model:U}):await z("set_extension_model",{agentType:r,ideType:t,model:U})}catch{}},W=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(U=>U.category!=="model")),y=W?(we=o==null?void 0:o.find(U=>U.category!=="model"))==null?void 0:we.configId:void 0,Q=async U=>{g(!1),T(U),P.current=Date.now()+5e3;try{c&&W&&y?await z("set_thought_level",{agentType:r,ideType:t,configId:y,value:U}):c?await z("set_mode",{agentType:r,ideType:t,mode:U}):await z("set_extension_mode",{agentType:r,ideType:t,mode:U})}catch{}},k={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[r]||"#94a3b8";return u.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 flex-wrap text-[10px] border-t border-border-subtle bg-[var(--surface-primary)]",children:[u.jsx("span",{className:"text-[9px] font-bold tracking-wide uppercase opacity-70",style:{color:k},children:n}),u.jsx("span",{className:"text-border-subtle text-[10px]",children:"│"}),u.jsxs("div",{className:"relative",children:[u.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:f?`${k}55`:"transparent",border:"1px solid",color:L?"var(--text-primary)":"var(--text-muted)"},onClick:D,children:[u.jsx("span",{className:"text-[9px] opacity-60",children:"🤖"}),q?"...":L||"Model",u.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),f&&S.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>p(!1)}),u.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[u.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:"SELECT MODEL"}),S.map(U=>u.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:U===L?`${k}18`:"transparent",color:U===L?k:"var(--text-secondary)",fontWeight:U===L?600:400,borderLeft:U===L?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Y=>{Y.currentTarget.style.background=`${k}12`},onMouseLeave:Y=>{Y.currentTarget.style.background=U===L?`${k}18`:"transparent"},onClick:()=>I(U),children:U},U))]})]})]}),u.jsxs("div",{className:"relative",children:[u.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:m?`${k}55`:"transparent",border:"1px solid",color:F?"var(--text-primary)":"var(--text-muted)"},onClick:H,children:[u.jsx("span",{className:"text-[9px] opacity-60",children:W?"🧠":"⚡"}),A?"...":F||(W?"Thinking":"Mode"),u.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),m&&x.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>g(!1)}),u.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[u.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:W?"SELECT THINKING LEVEL":"SELECT MODE"}),x.map(U=>u.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:U===F?`${k}18`:"transparent",color:U===F?k:"var(--text-secondary)",fontWeight:U===F?600:400,borderLeft:U===F?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Y=>{Y.currentTarget.style.background=`${k}12`},onMouseLeave:Y=>{Y.currentTarget.style.background=U===F?`${k}18`:"transparent"},onClick:()=>Q(U),children:U},U))]})]})]})]})}const In=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),tn=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function W1({activeConv:e,ides:t,agentInput:r,setAgentInput:n,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a,userName:c}){const d=b.useRef(null),{sendCommand:h}=gi(),[f,p]=b.useState([]),[m,g]=b.useState(0),[S,_]=b.useState(!0),[x,w]=b.useState(!1),N=b.useRef("");e.tabKey!==N.current&&(N.current=e.tabKey,p([]),g(0),_(!0));const L=b.useCallback(async()=>{var T,q,E,A,R,P;if(!(x||!S)){w(!0);try{const $=t.find(y=>y.id===e.ideId),z=($==null?void 0:$.daemonId)||((T=e.ideId)==null?void 0:T.split(":")[0])||"";if(!z){_(!1);return}const D=e.ideType||e.agentType||"",H=(e.ideId||"").split(":"),I=H.length>=3?H.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:z,agentType:D,instanceId:I,offset:m});const W=await h(z,"chat_history",{agentType:D,offset:m,limit:30,instanceId:I});console.log("[ChatPane] got result:",{count:((q=W.messages)==null?void 0:q.length)||0,hasMore:W.hasMore}),((E=W.messages)==null?void 0:E.length)>0&&(p(y=>[...W.messages,...y]),g(y=>y+W.messages.length)),_(W.hasMore)}catch($){console.warn("[ChatPane] Failed to load history:",$),!((A=$==null?void 0:$.message)!=null&&A.includes("P2P not available"))&&!((R=$==null?void 0:$.message)!=null&&R.includes("channel not open"))&&!((P=$==null?void 0:$.message)!=null&&P.includes("P2P not connected"))&&_(!1)}finally{w(!1)}}},[x,S,m,t,e]),C=b.useRef(0);b.useEffect(()=>{if(e.messages.length<10&&S&&!x&&f.length===0){const T=C.current;if(T>8)return;const E=setTimeout(()=>{C.current=T+1,L()},T===0?500:3e3);return()=>clearTimeout(E)}else f.length>0&&(C.current=0)},[e.tabKey,e.messages.length,S,x,f.length,L]);const F=(()=>{const T=e.messages.map((A,R)=>{const P=`${e.ideId}-${A.id??`i-${R}`}`;return{...A,receivedAt:A.receivedAt||l[P]||0}});if(f.length===0)return T;const q=new Set(T.map(A=>`${A.role}:${(A.content||"").slice(0,100)}`));return[...f.filter(A=>!q.has(`${A.role}:${(A.content||"").slice(0,100)}`)),...T]})();return u.jsxs(u.Fragment,{children:[u.jsx(Xy,{messages:F,actionLogs:a.filter(T=>T.ideId===e.tabKey).sort((T,q)=>T.timestamp-q.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",userName:c,isCliMode:In(e)||tn(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:L,isLoadingMore:x,hasMoreHistory:S,emptyState:e.messages.length===0?e.status==="not_monitored"?u.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[u.jsx("div",{className:"text-3xl opacity-60",children:u.jsx(Yy,{size:28})}),u.jsx("div",{className:"text-[13px] opacity-50",children:"Agent not monitored"}),u.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Switching...":u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," Open ",e.displayPrimary," Panel"]})}),u.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Click to switch monitoring to this agent"})]}):e.status==="panel_hidden"?u.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[u.jsx("div",{className:"text-3xl opacity-60",children:u.jsx(q3,{size:28})}),u.jsx("div",{className:"text-[13px] opacity-50",children:"Panel is not visible in IDE"}),u.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Opening...":u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," Open ",e.displayPrimary," Panel"]})}),u.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Open the agent sidebar in your IDE to start viewing messages"})]}):void 0:void 0}),!In(e)&&(()=>{var q,E,A,R;const T=t.find(P=>P.id===e.ideId);return u.jsx(CR,{ideId:e.ideId,ideType:e.ideType,agentType:e.streamSource==="agent-stream"?e.agentType:((E=(q=T==null?void 0:T.agents)==null?void 0:q[0])==null?void 0:E.type)||e.ideType,agentName:e.streamSource==="agent-stream"?e.agentName:((R=(A=T==null?void 0:T.agents)==null?void 0:A[0])==null?void 0:R.name)||e.agentName,serverModel:(T==null?void 0:T.currentModel)||void 0,serverMode:(T==null?void 0:T.currentPlan)||void 0,acpConfigOptions:tn(e)?T==null?void 0:T.acpConfigOptions:void 0,acpModes:tn(e)?T==null?void 0:T.acpModes:void 0})})(),u.jsx("div",{className:"dashboard-input-area px-3 py-2.5 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:u.jsxs("div",{className:"flex gap-2.5 items-center",children:[u.jsx("div",{className:"flex-1 relative",children:u.jsx("input",{ref:d,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:T=>n(T.target.value),onPaste:T=>{const q=T.clipboardData.getData("text");q&&n(E=>E+q),T.preventDefault()},onKeyDown:T=>{if(T.key==="Enter"){if(T.nativeEvent.isComposing){T.preventDefault();return}T.preventDefault(),i()}},onBlur:T=>{if(window.innerWidth<768){const q=T.relatedTarget;if((q==null?void 0:q.tagName)==="BUTTON")return;setTimeout(()=>{document.documentElement.scrollTop=0},300)}},className:"w-full h-10 rounded-[20px] px-4 bg-bg-secondary border border-border-subtle text-sm text-text-primary"})}),u.jsx("button",{onClick:i,disabled:!r.trim(),className:`w-10 h-10 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${r.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:r.trim()?"text-white":"text-text-muted",children:u.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}const Ou=new Set,H1={emit(e,t){for(const r of Ou)r(e,t)},on(e){return Ou.add(e),()=>{Ou.delete(e)}}};function ER({activeConv:e,ptyBuffers:t,terminalRef:r,agentInput:n,setAgentInput:i,handleSendChat:s,handleModalButton:o}){var p;const l=b.useRef(null),{sendCommand:a,sendData:c}=gi(),d=(p=e.ideId)!=null&&p.includes(":cli:")?e.ideId.split(":cli:")[1]:"",h=e.tabKey,f=e.ideType||e.agentType||"";return b.useEffect(()=>{const m=t.current.get(h);if(m&&m.length>0){const g=setTimeout(()=>{var S;for(const _ of m)(S=r.current)==null||S.write(_);requestAnimationFrame(()=>{var _;(_=r.current)==null||_.bumpResize()})},100);return()=>clearTimeout(g)}},[h]),b.useEffect(()=>{const m=H1.on((g,S)=>{var x;if(!S)return;(g===d||g===f)&&((x=r.current)==null||x.write(S))});return()=>{m()}},[d,f]),u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--surface-primary)] border-b border-border-subtle shrink-0",children:[u.jsx("div",{className:"flex gap-1",children:u.jsx("div",{className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-accent text-white",children:"⬛ Terminal"})}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("div",{className:"text-[10px] text-text-muted",children:[e.agentName," — Terminal"]}),u.jsx("button",{onClick:()=>{if(!r.current||!e)return;const m=t.current.get(e.tabKey);if(m&&m.length>0)for(const g of m)r.current.write(g);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var g;(g=r.current)==null||g.bumpResize()})})},title:"Refresh terminal (replay buffer + TUI redraw)",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-bg-secondary text-text-secondary border border-border-subtle cursor-pointer leading-none",children:"↺"}),u.jsx("button",{onClick:async()=>{var S;const m=(S=e.ideId)!=null&&S.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";if(!window.confirm(`Stop ${m}?
|
|
177
|
-
This will terminate the CLI process.`))return;const g=e.ideId||e.daemonId||"";try{await a(g,"stop_cli",{cliType:m})}catch(_){console.error("Stop CLI failed:",_)}},title:"Stop CLI process",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-red-500/[0.08] text-red-400 border border-red-500/30 cursor-pointer leading-none font-semibold",children:"■ Stop"})]})]}),u.jsx(F1,{activeConv:e,onModalButton:o}),u.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:u.jsx($1,{ref:r,onInput:m=>{var _;const g=e.ideId||e.daemonId||"",S=(_=e.ideId)!=null&&_.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(g,{type:"pty_input",cliType:S,data:m})||a(g,"pty_input",{cliType:S,data:m}).catch(console.error)},onResize:(m,g)=>{var x;const S=e.ideId||e.daemonId||"",_=(x=e.ideId)!=null&&x.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(S,{type:"pty_resize",cliType:_,cols:m,rows:g})||a(S,"pty_resize",{cliType:_,cols:m,rows:g,force:!0}).catch(()=>{})}},e.tabKey)}),u.jsx("div",{className:"px-3 py-2 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:u.jsxs("div",{className:"flex gap-2.5 items-center",children:[u.jsx("div",{className:"flex-1 relative",children:u.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:n,onChange:m=>i(m.target.value),onPaste:m=>{const g=m.clipboardData.getData("text");g&&i(S=>S+g),m.preventDefault()},onKeyDown:m=>{if(m.key==="Enter"){if(m.nativeEvent.isComposing){m.preventDefault();return}m.preventDefault(),s()}},className:"w-full h-9 rounded-[18px] px-4 bg-bg-secondary border border-border-subtle text-[13px] text-text-primary"})}),u.jsx("button",{onClick:s,disabled:!n.trim(),className:`w-9 h-9 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${n.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:n.trim()?"text-white":"text-text-muted",children:u.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function NR({wsStatus:e,showReconnected:t,loginUrl:r}){const n=e==="disconnected"||e==="reconnecting"||e==="offline"||e==="auth_failed",i=e==="auth_failed"?"red":e==="offline"?"orange":"violet",s={red:"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))",orange:"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))",violet:"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))"},o={red:"1px solid rgba(239,68,68,0.2)",orange:"1px solid rgba(255,107,53,0.2)",violet:"1px solid rgba(139,92,246,0.2)"},l={red:"#ef4444",orange:"#ff6b35",violet:"#a78bfa"};return u.jsxs(u.Fragment,{children:[n&&u.jsxs("div",{className:"py-2.5 px-5 text-[13px] font-semibold flex items-center gap-2.5 justify-center",style:{background:s[i],borderBottom:o[i],color:l[i]},children:[u.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-5 h-5",style:{opacity:e==="auth_failed"?.6:1,animation:e==="auth_failed"?void 0:"pulse 2s ease-in-out infinite",filter:e==="auth_failed"?"grayscale(1)":void 0}}),e==="offline"&&"Network offline — waiting for connection...",e==="disconnected"&&"Reconnecting to server...",e==="reconnecting"&&"Reconnecting to server...",e==="auth_failed"&&(r?u.jsxs(u.Fragment,{children:["Session expired."," ",u.jsx("a",{href:r,className:"text-inherit underline",children:"Log in again"})]}):"Connection failed — please restart the server.")]}),t&&e==="connected"&&u.jsxs("div",{className:"py-2 px-4 text-xs font-semibold flex items-center gap-2 justify-center bg-gradient-to-r from-green-500/[0.12] to-green-500/[0.04] text-green-400 border-b border-green-500/15 animate-[fadeIn_0.3s_ease]",children:[u.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-4 h-4"}),"Connected"]})]})}const zu=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),$u=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function TR({activeConv:e,agentCount:t,wsStatus:r,isConnected:n,onOpenHistory:i}){const s=Os(),o=n?"#22c55e":r==="connected"?"#eab308":"#ef4444",l=n?"0 0 4px #22c55e80":r==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480";return u.jsxs("div",{className:"dashboard-header",children:[u.jsx("div",{className:"flex items-center gap-3",children:u.jsxs("div",{className:"leading-tight",children:[u.jsxs("h1",{className:"header-title m-0 flex items-center gap-1.5",children:[u.jsx(Xa,{size:18}),u.jsx("span",{className:"header-title-desktop",children:"Dashboard"}),u.jsx("span",{className:"header-title-mobile",children:(e==null?void 0:e.displayPrimary)||"Dashboard"}),u.jsx("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:u.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full align-middle",style:{background:o,boxShadow:l}})})]}),u.jsxs("div",{className:"header-subtitle text-[11px] items-center gap-1",children:[t," agent",t!==1?"s":""," active",u.jsx("span",{title:n?"Connected":r==="connected"?"Partial":"Disconnected",className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{background:o,boxShadow:l}})]})]})}),u.jsxs("div",{className:"flex gap-2 items-center",children:[e&&!zu(e)&&!$u(e)&&u.jsxs("button",{onClick:()=>s(`/ide/${e.ideId}`),className:"btn btn-primary btn-sm border-none px-2.5 py-1.5 flex items-center gap-1 text-xs",title:"IDE View",children:[u.jsx(X3,{size:14})," IDE"]}),e&&!zu(e)&&!$u(e)&&u.jsx("button",{onClick:i,className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5 flex items-center gap-1",title:"Chat History",children:u.jsx(U3,{size:16})}),e&&!zu(e)&&!$u(e)&&u.jsx("button",{onClick:()=>s(`/ide/${e.ideId}?view=remote`),className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5",title:"Remote Control",children:u.jsx(Ro,{size:16})})]})]})}function Ar(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function PR(e){if(e<60)return`${Math.round(e)}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const r=Math.floor(t/60),n=t%60;if(r<24)return n>0?`${r}h ${n}m`:`${r}h`;const i=Math.floor(r/24),s=r%24;return`${i}d ${s}h`}function W_(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function H_(e){return(e.id||"").includes(":cli:")}function U_(e){return(e.id||"").includes(":acp:")}function Ad(e,t){return Ar(e)}function LR(e){if(!Array.isArray(e)||e.length<=1)return e;const t=new Map,r=["generating","streaming","active","connected","idle","panel_hidden"];for(const n of e){const i=(n.name||n.id||"").toLowerCase().replace(/\s+/g,"-"),s=t.get(i);if(!s){t.set(i,n);continue}const o=r.indexOf(s.status||"idle"),l=r.indexOf(n.status||"idle");l>=0&&(o<0||l<o)&&t.set(i,n)}return Array.from(t.values())}function RR({activeConv:e,ides:t,isCreatingChat:r,isRefreshingHistory:n,onClose:i,onNewChat:s,onSwitchSession:o,onRefreshHistory:l}){var h;const a=t.find(f=>f.id===e.ideId),c=(a==null?void 0:a.chats)||[],d=(h=a==null?void 0:a.activeChat)==null?void 0:h.id;return u.jsxs("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center",children:[u.jsx("div",{onClick:i,className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),u.jsxs("div",{className:"card fade-in relative w-[90%] max-w-[500px] max-h-[80vh] flex flex-col p-0 overflow-hidden shadow-[0_20px_40px_rgba(0,0,0,0.4)] rounded-[20px]",children:[u.jsxs("div",{className:"px-6 py-5 border-b border-border-subtle flex justify-between items-center bg-[var(--surface-primary)]",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"m-0 text-lg font-extrabold",children:"Chat History"}),u.jsxs("div",{className:"text-xs text-text-muted mt-0.5",children:[e.displayPrimary," — ",Ar(e.ideType)]})]}),u.jsx("button",{onClick:i,className:"bg-transparent border-none text-xl text-text-muted cursor-pointer",children:"✕"})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-3 bg-bg-primary",children:[u.jsx("button",{onClick:s,disabled:r,className:"w-full p-3.5 rounded-xl mb-3 bg-indigo-500/10 border border-dashed border-accent text-accent font-bold text-sm cursor-pointer",children:r?"⌛ Creating...":"+ Start New Chat Session"}),c.map(f=>u.jsxs("div",{onClick:()=>{o(e.ideId,f.id),i()},className:`p-4 rounded-xl mb-2 cursor-pointer border transition-all ${d===f.id?"bg-[var(--bg-glass-hover)] border-accent":"bg-[var(--surface-secondary)] border-border-subtle"}`,children:[u.jsx("div",{className:`font-bold text-sm mb-1 ${d===f.id?"text-[var(--accent-primary-light)]":"text-text-primary"}`,children:f.title||"Untitled Session"}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-mono",children:[f.id.substring(0,12),"..."]}),d===f.id&&u.jsx("span",{className:"text-[10px] bg-accent text-white px-2 py-0.5 rounded-[10px] font-extrabold",children:"ACTIVE"})]})]},f.id)),c.length===0&&u.jsxs("div",{className:"py-10 px-5 text-center text-text-muted",children:[u.jsx("div",{className:"text-3xl mb-3 opacity-60",children:u.jsx(Z3,{size:32})}),u.jsx("div",{className:"text-[13px]",children:"No recent chat sessions found."})]})]}),u.jsx("div",{className:"px-5 py-4 bg-[var(--surface-tertiary)] border-t border-border-subtle text-right",children:u.jsx("button",{onClick:l,disabled:n,className:"btn btn-secondary btn-sm rounded-[10px]",children:n?"⌛ Refreshing...":u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(K3,{size:13})," Refresh History"]})})})]})]})}const V_={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function MR({toasts:e,onDismiss:t,onClickToast:r}){return u.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:e.map(n=>u.jsx("div",{className:"fade-in text-white px-5 py-3 rounded-xl text-[13px] font-semibold shadow-[0_8px_32px_rgba(0,0,0,0.3)] backdrop-blur-lg pointer-events-auto cursor-pointer animate-[toast-in_0.3s_ease-out] max-w-[360px]",style:{background:V_[n.type]||V_.info},onClick:()=>{r&&r(n),t(n.id)},children:n.message},n.id))})}const IR=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function DR(e){return e.workspace||"Workspace"}function jR(e,t,r,n){var s;const i={};if(r)for(const o of r){const l=o;if(l.type==="adhdev-daemon"||l.daemonMode){const a=l.machine||{},c=l.machineNickname,d=a.hostname||((s=l.system)==null?void 0:s.hostname)||"",h=c||(d&&d!=="Unknown"?d.replace(/\.local$/,""):null)||`Machine ${(l.id||"").substring(0,6)}`;i[l.id]=h}}return e.flatMap(o=>{var S,_,x,w,N;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((S=o.id)==null?void 0:S.split(":")[0])||o.id,d=n?n[c]||"new":void 0,h=DR(o),f=Ar(o.type),p=o.agentStreams,m=Array.isArray(p)?p.map(L=>({...L,activeModal:L.activeModal??void 0})):[],g=IR(o);if(g){const L=Ad(o.type),C=(_=o.agents)==null?void 0:_[0],F=(x=o.activeChat)==null?void 0:x.activeModal,T=F&&Array.isArray(F.buttons)&&F.buttons.length>0,q=(w=o.activeChat)==null?void 0:w.status,E=q==="generating"||q==="loading"||q&&q.toLowerCase()==="thinking",R=T||q==="waiting_approval"?"waiting_approval":E?"working":(C==null?void 0:C.status)||"idle",P=o.activeChat||{title:"",messages:[]};let $=P.title&&String(P.title).trim()?String(P.title).trim():"";const z=(N=o.activeChat)==null?void 0:N.id,D=o.chats;if(z&&Array.isArray(D)&&D.length>0){const Q=D.find(ae=>ae.id===z||ae.id&&String(ae.id)===String(z));Q!=null&&Q.title&&String(Q.title).trim()&&($=String(Q.title).trim())}const H=P.messages||[],I=t[o.id]||[],W=new Map;H.filter(Q=>Q.role==="user").forEach(Q=>{W.set(Q.content,(W.get(Q.content)||0)+1)});const y=I.filter(Q=>{const ae=W.get(Q.content)||0;return ae>0?(W.set(Q.content,ae-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:L,agentType:In(o)||tn(o)?o.type:(C==null?void 0:C.type)||"ide-native",status:R,title:$,messages:[...H,...y],ideType:o.type,workspaceName:h,displayPrimary:$||L||h,displaySecondary:f,cdpConnected:o.cdpConnected,modalButtons:T?F.buttons:void 0,modalMessage:T?F.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,connectionState:d})}if(g&&(In(o)||tn(o)))return l;for(const L of m){const C=L.activeModal&&Array.isArray(L.activeModal.buttons)&&L.activeModal.buttons.length>0,F=C?"waiting_approval":L.status==="streaming"?"working":L.status,T=`${o.id}:${L.agentType}`,q=L.messages||[],E=t[T]||[],A=new Map;q.filter(P=>P.role==="user").forEach(P=>{A.set(P.content,(A.get(P.content)||0)+1)});const R=E.filter(P=>{const $=A.get(P.content)||0;return $>0?(A.set(P.content,$-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:L.agentName,agentType:L.agentType,status:F,title:"",messages:[...q,...R],ideType:o.type,workspaceName:h,displayPrimary:L.agentName,displaySecondary:f,cdpConnected:o.cdpConnected,modalButtons:C?L.activeModal.buttons:void 0,modalMessage:C?L.activeModal.message:void 0,streamSource:"agent-stream",tabKey:T,machineName:a,connectionState:d})}return l.length===0&&l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:Ad(o.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:o.type,workspaceName:h,displayPrimary:h,displaySecondary:f,cdpConnected:o.cdpConnected,streamSource:"native",tabKey:o.id,connectionState:d}),l})}function AR(e,t){var l,a,c,d;const r=[],{daemonId:n,existingDaemon:i,timestamp:s}=t,o=s||e.timestamp||Date.now();r.push({...i||{},id:n,type:"adhdev-daemon",status:"online",daemonMode:!0,timestamp:o,...e.version&&{version:e.version},...e.machine&&{machine:e.machine,platform:e.machine.platform},...e.instanceId&&{instanceId:e.instanceId},...e.machineNickname!==void 0&&{machineNickname:e.machineNickname},...e.p2p&&{p2p:e.p2p},..."system"in e&&{system:e.system},..."hostname"in e&&{hostname:e.hostname},...e.workspaces&&{workspaces:e.workspaces},...e.defaultWorkspaceId!==void 0&&{defaultWorkspaceId:e.defaultWorkspaceId},...e.defaultWorkspacePath!==void 0&&{defaultWorkspacePath:e.defaultWorkspacePath},...e.workspaceActivity&&{workspaceActivity:e.workspaceActivity},...e.detectedIdes&&{detectedIdes:e.detectedIdes},..."availableProviders"in e&&{availableProviders:e.availableProviders},cdpConnected:e.managedIdes.some(h=>h.cdpConnected),managedIdeIds:e.managedIdes.map(h=>`${n}:ide:${h.instanceId}`),managedCliIds:e.managedClis.map(h=>h.id?`${n}:cli:${h.id}`:`${n}:cli:${h.cliType}`),managedAcpIds:e.managedAcps.map(h=>h.id?`${n}:acp:${h.id}`:`${n}:acp:${h.acpType}`)});for(const h of e.managedIdes)r.push({id:`${n}:ide:${h.instanceId}`,type:h.ideType,ideType:h.ideType,version:h.ideVersion,status:h.cdpConnected?"online":"detected",daemonId:n,instanceId:h.instanceId,workspace:h.workspace,terminals:h.terminals,agents:h.aiAgents,activeChat:h.activeChat,chats:h.chats,agentStreams:h.agentStreams,cdpConnected:h.cdpConnected,currentModel:h.currentModel,currentPlan:h.currentPlan,currentAutoApprove:h.currentAutoApprove,timestamp:o});for(const h of e.managedClis){const f=h.id?`${n}:cli:${h.id}`:`${n}:cli:${h.cliType}`;r.push({id:f,type:h.cliType,ideType:h.cliType,agentType:h.cliType,status:h.status||"running",daemonId:n,instanceId:h.id,cliName:h.cliName,mode:h.mode||"terminal",workspace:h.workspace,activeChat:h.activeChat,agentStreams:[{agentType:h.cliType,agentName:h.cliName,extensionId:"cli-agent",status:h.status==="generating"?"streaming":h.status==="waiting_approval"?"waiting_approval":"idle",messages:((l=h.activeChat)==null?void 0:l.messages)||[],inputContent:"",activeModal:(a=h.activeChat)==null?void 0:a.activeModal}],timestamp:o,_isCli:!0})}for(const h of e.managedAcps){const f=h.id?`${n}:acp:${h.id}`:`${n}:acp:${h.acpType}`;r.push({id:f,type:h.acpType,ideType:h.acpType,agentType:h.acpType,status:h.status||"running",daemonId:n,instanceId:h.id,cliName:h.acpName,mode:"chat",workspace:h.workspace,activeChat:h.activeChat,currentModel:h.currentModel,currentPlan:h.currentPlan,acpConfigOptions:h.acpConfigOptions,acpModes:h.acpModes,agentStreams:[{agentType:h.acpType,agentName:h.acpName,extensionId:"acp-agent",status:h.status==="generating"?"streaming":h.status==="waiting_approval"?"waiting_approval":"idle",messages:((c=h.activeChat)==null?void 0:c.messages)||[],inputContent:"",activeModal:(d=h.activeChat)==null?void 0:d.activeModal}],timestamp:o,_isAcp:!0})}return r}function U1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=U1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function BR(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=U1(e))&&(n&&(n+=" "),n+=t);return n}const OR=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},zR=(e,t)=>({classGroupId:e,validator:t}),V1=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),rc="-",K_=[],$R="arbitrary..",FR=e=>{const t=HR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return WR(o);const l=o.split(rc),a=l[0]===""&&l.length>1?1:0;return K1(l,a,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const a=n[o],c=r[o];return a?c?OR(c,a):a:c||K_}return r[o]||K_}}},K1=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],s=r.nextPart.get(i);if(s){const c=K1(e,t+1,s);if(c)return c}const o=r.validators;if(o===null)return;const l=t===0?e.join(rc):e.slice(t).join(rc),a=o.length;for(let c=0;c<a;c++){const d=o[c];if(d.validator(l))return d.classGroupId}},WR=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?$R+n:void 0})(),HR=e=>{const{theme:t,classGroups:r}=e;return UR(r,t)},UR=(e,t)=>{const r=V1();for(const n in e){const i=e[n];hp(i,r,n,t)}return r},hp=(e,t,r,n)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];VR(o,t,r,n)}},VR=(e,t,r,n)=>{if(typeof e=="string"){KR(e,t,r);return}if(typeof e=="function"){qR(e,t,r,n);return}YR(e,t,r,n)},KR=(e,t,r)=>{const n=e===""?t:q1(t,e);n.classGroupId=r},qR=(e,t,r,n)=>{if(XR(e)){hp(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(zR(r,e))},YR=(e,t,r,n)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,a]=i[o];hp(a,q1(t,l),r,n)}},q1=(e,t)=>{let r=e;const n=t.split(rc),i=n.length;for(let s=0;s<i;s++){const o=n[s];let l=r.nextPart.get(o);l||(l=V1(),r.nextPart.set(o,l)),r=l}return r},XR=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,GR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const i=(s,o)=>{r[s]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in r?r[s]=o:i(s,o)}}},Bd="!",q_=":",QR=[],Y_=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),JR=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=i=>{const s=[];let o=0,l=0,a=0,c;const d=i.length;for(let g=0;g<d;g++){const S=i[g];if(o===0&&l===0){if(S===q_){s.push(i.slice(a,g)),a=g+1;continue}if(S==="/"){c=g;continue}}S==="["?o++:S==="]"?o--:S==="("?l++:S===")"&&l--}const h=s.length===0?i:i.slice(a);let f=h,p=!1;h.endsWith(Bd)?(f=h.slice(0,-1),p=!0):h.startsWith(Bd)&&(f=h.slice(1),p=!0);const m=c&&c>a?c-a:void 0;return Y_(s,p,f,m)};if(t){const i=t+q_,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):Y_(QR,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},ZR=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let s=0;s<r.length;s++){const o=r[s],l=o[0]==="[",a=t.has(o);l||a?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},eM=e=>({cache:GR(e.cacheSize),parseClassName:JR(e),sortModifiers:ZR(e),...FR(e)}),tM=/\s+/,rM=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(tM);let a="";for(let c=l.length-1;c>=0;c-=1){const d=l[c],{isExternal:h,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=r(d);if(h){a=d+(a.length>0?" "+a:a);continue}let S=!!g,_=n(S?m.substring(0,g):m);if(!_){if(!S){a=d+(a.length>0?" "+a:a);continue}if(_=n(m),!_){a=d+(a.length>0?" "+a:a);continue}S=!1}const x=f.length===0?"":f.length===1?f[0]:s(f).join(":"),w=p?x+Bd:x,N=w+_;if(o.indexOf(N)>-1)continue;o.push(N);const L=i(_,S);for(let C=0;C<L.length;++C){const F=L[C];o.push(w+F)}a=d+(a.length>0?" "+a:a)}return a},nM=(...e)=>{let t=0,r,n,i="";for(;t<e.length;)(r=e[t++])&&(n=Y1(r))&&(i&&(i+=" "),i+=n);return i},Y1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Y1(e[n]))&&(r&&(r+=" "),r+=t);return r},iM=(e,...t)=>{let r,n,i,s;const o=a=>{const c=t.reduce((d,h)=>h(d),e());return r=eM(c),n=r.cache.get,i=r.cache.set,s=l,l(a)},l=a=>{const c=n(a);if(c)return c;const d=rM(a,r);return i(a,d),d};return s=o,(...a)=>s(nM(...a))},sM=[],Tt=e=>{const t=r=>r[e]||sM;return t.isThemeGetter=!0,t},X1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,G1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oM=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,uM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=e=>oM.test(e),Ae=e=>!!e&&!Number.isNaN(Number(e)),Vn=e=>!!e&&Number.isInteger(Number(e)),Fu=e=>e.endsWith("%")&&Ae(e.slice(0,-1)),xn=e=>lM.test(e),Q1=()=>!0,dM=e=>aM.test(e)&&!cM.test(e),dp=()=>!1,fM=e=>uM.test(e),pM=e=>hM.test(e),mM=e=>!ye(e)&&!be(e),gM=e=>vi(e,eb,dp),ye=e=>X1.test(e),wi=e=>vi(e,tb,dM),X_=e=>vi(e,kM,Ae),_M=e=>vi(e,nb,Q1),vM=e=>vi(e,rb,dp),G_=e=>vi(e,J1,dp),xM=e=>vi(e,Z1,pM),Yl=e=>vi(e,ib,fM),be=e=>G1.test(e),lo=e=>Qi(e,tb),yM=e=>Qi(e,rb),Q_=e=>Qi(e,J1),bM=e=>Qi(e,eb),wM=e=>Qi(e,Z1),Xl=e=>Qi(e,ib,!0),SM=e=>Qi(e,nb,!0),vi=(e,t,r)=>{const n=X1.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Qi=(e,t,r=!1)=>{const n=G1.exec(e);return n?n[1]?t(n[1]):r:!1},J1=e=>e==="position"||e==="percentage",Z1=e=>e==="image"||e==="url",eb=e=>e==="length"||e==="size"||e==="bg-size",tb=e=>e==="length",kM=e=>e==="number",rb=e=>e==="family-name",nb=e=>e==="number"||e==="weight",ib=e=>e==="shadow",CM=()=>{const e=Tt("color"),t=Tt("font"),r=Tt("text"),n=Tt("font-weight"),i=Tt("tracking"),s=Tt("leading"),o=Tt("breakpoint"),l=Tt("container"),a=Tt("spacing"),c=Tt("radius"),d=Tt("shadow"),h=Tt("inset-shadow"),f=Tt("text-shadow"),p=Tt("drop-shadow"),m=Tt("blur"),g=Tt("perspective"),S=Tt("aspect"),_=Tt("ease"),x=Tt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...N(),be,ye],C=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],T=()=>[be,ye,a],q=()=>[Un,"full","auto",...T()],E=()=>[Vn,"none","subgrid",be,ye],A=()=>["auto",{span:["full",Vn,be,ye]},Vn,be,ye],R=()=>[Vn,"auto",be,ye],P=()=>["auto","min","max","fr",be,ye],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...T()],H=()=>[Un,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],I=()=>[Un,"screen","full","dvw","lvw","svw","min","max","fit",...T()],W=()=>[Un,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],y=()=>[e,be,ye],Q=()=>[...N(),Q_,G_,{position:[be,ye]}],ae=()=>["no-repeat",{repeat:["","x","y","space","round"]}],k=()=>["auto","cover","contain",bM,gM,{size:[be,ye]}],we=()=>[Fu,lo,wi],U=()=>["","none","full",c,be,ye],Y=()=>["",Ae,lo,wi],te=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[Ae,Fu,Q_,G_],Oe=()=>["","none",m,be,ye],Ve=()=>["none",Ae,be,ye],Ie=()=>["none",Ae,be,ye],G=()=>[Ae,be,ye],me=()=>[Un,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xn],breakpoint:[xn],color:[Q1],container:[xn],"drop-shadow":[xn],ease:["in","out","in-out"],font:[mM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xn],shadow:[xn],spacing:["px",Ae],text:[xn],"text-shadow":[xn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Un,ye,be,S]}],container:["container"],columns:[{columns:[Ae,ye,be,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{"inset-s":q(),start:q()}],end:[{"inset-e":q(),end:q()}],"inset-bs":[{"inset-bs":q()}],"inset-be":[{"inset-be":q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[Vn,"auto",be,ye]}],basis:[{basis:[Un,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ae,Un,"auto","initial","none",ye]}],grow:[{grow:["",Ae,be,ye]}],shrink:[{shrink:["",Ae,be,ye]}],order:[{order:[Vn,"first","last","none",be,ye]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...I()]}],"min-inline-size":[{"min-inline":["auto",...I()]}],"max-inline-size":[{"max-inline":["none",...I()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[l,"screen",...H()]}],"min-w":[{"min-w":[l,"screen","none",...H()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,lo,wi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,SM,_M]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fu,ye]}],"font-family":[{font:[yM,vM,t]}],"font-features":[{"font-features":[ye]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,be,ye]}],"line-clamp":[{"line-clamp":[Ae,"none",be,X_]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",be,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",be,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:y()}],"text-color":[{text:y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ae,"from-font","auto",be,wi]}],"text-decoration-color":[{decoration:y()}],"underline-offset":[{"underline-offset":[Ae,"auto",be,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be,ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",be,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:k()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Vn,be,ye],radial:["",be,ye],conic:[Vn,be,ye]},wM,xM]}],"bg-color":[{bg:y()}],"gradient-from-pos":[{from:we()}],"gradient-via-pos":[{via:we()}],"gradient-to-pos":[{to:we()}],"gradient-from":[{from:y()}],"gradient-via":[{via:y()}],"gradient-to":[{to:y()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:y()}],"border-color-x":[{"border-x":y()}],"border-color-y":[{"border-y":y()}],"border-color-s":[{"border-s":y()}],"border-color-e":[{"border-e":y()}],"border-color-bs":[{"border-bs":y()}],"border-color-be":[{"border-be":y()}],"border-color-t":[{"border-t":y()}],"border-color-r":[{"border-r":y()}],"border-color-b":[{"border-b":y()}],"border-color-l":[{"border-l":y()}],"divide-color":[{divide:y()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ae,be,ye]}],"outline-w":[{outline:["",Ae,lo,wi]}],"outline-color":[{outline:y()}],shadow:[{shadow:["","none",d,Xl,Yl]}],"shadow-color":[{shadow:y()}],"inset-shadow":[{"inset-shadow":["none",h,Xl,Yl]}],"inset-shadow-color":[{"inset-shadow":y()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:y()}],"ring-offset-w":[{"ring-offset":[Ae,wi]}],"ring-offset-color":[{"ring-offset":y()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":y()}],"text-shadow":[{"text-shadow":["none",f,Xl,Yl]}],"text-shadow-color":[{"text-shadow":y()}],opacity:[{opacity:[Ae,be,ye]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":y()}],"mask-image-linear-to-color":[{"mask-linear-to":y()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":y()}],"mask-image-t-to-color":[{"mask-t-to":y()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":y()}],"mask-image-r-to-color":[{"mask-r-to":y()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":y()}],"mask-image-b-to-color":[{"mask-b-to":y()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":y()}],"mask-image-l-to-color":[{"mask-l-to":y()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":y()}],"mask-image-x-to-color":[{"mask-x-to":y()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":y()}],"mask-image-y-to-color":[{"mask-y-to":y()}],"mask-image-radial":[{"mask-radial":[be,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":y()}],"mask-image-radial-to-color":[{"mask-radial-to":y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[Ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":y()}],"mask-image-conic-to-color":[{"mask-conic-to":y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:k()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",be,ye]}],filter:[{filter:["","none",be,ye]}],blur:[{blur:Oe()}],brightness:[{brightness:[Ae,be,ye]}],contrast:[{contrast:[Ae,be,ye]}],"drop-shadow":[{"drop-shadow":["","none",p,Xl,Yl]}],"drop-shadow-color":[{"drop-shadow":y()}],grayscale:[{grayscale:["",Ae,be,ye]}],"hue-rotate":[{"hue-rotate":[Ae,be,ye]}],invert:[{invert:["",Ae,be,ye]}],saturate:[{saturate:[Ae,be,ye]}],sepia:[{sepia:["",Ae,be,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",be,ye]}],"backdrop-blur":[{"backdrop-blur":Oe()}],"backdrop-brightness":[{"backdrop-brightness":[Ae,be,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Ae,be,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ae,be,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ae,be,ye]}],"backdrop-invert":[{"backdrop-invert":["",Ae,be,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Ae,be,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Ae,be,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Ae,be,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",be,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ae,"initial",be,ye]}],ease:[{ease:["linear","initial",_,be,ye]}],delay:[{delay:[Ae,be,ye]}],animate:[{animate:["none",x,be,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,be,ye]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ve()}],"rotate-x":[{"rotate-x":Ve()}],"rotate-y":[{"rotate-y":Ve()}],"rotate-z":[{"rotate-z":Ve()}],scale:[{scale:Ie()}],"scale-x":[{"scale-x":Ie()}],"scale-y":[{"scale-y":Ie()}],"scale-z":[{"scale-z":Ie()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[be,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":["translate-none"],accent:[{accent:y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",be,ye]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",be,ye]}],fill:[{fill:["none",...y()]}],"stroke-w":[{stroke:[Ae,lo,wi,X_]}],stroke:[{stroke:["none",...y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},EM=iM(CM);function sl(...e){return EM(BR(e))}function NM({icon:e,title:t,subtitle:r,badge:n,actions:i,className:s}){return u.jsxs("div",{className:sl("flex items-center justify-between px-6 py-4 border-b border-border-subtle bg-surface-primary animate-[fadeIn_0.3s_ease-out_forwards]",s),children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"text-lg font-bold text-text-primary flex items-center gap-2.5 tracking-tight",children:[u.jsx("span",{children:e})," ",t,n&&u.jsxs("span",{className:"text-xs font-semibold px-2 py-0.5 rounded-full bg-accent/10 text-accent-light",children:[n.count!==void 0?n.count:""," ",n.text]})]}),u.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:r})]}),i&&u.jsx("div",{className:"flex gap-2",children:i})]})}function ao({title:e,icon:t,description:r,accentColor:n,className:i,children:s}){return u.jsxs("div",{className:sl("bg-bg-card border border-border-subtle rounded-2xl p-5 backdrop-blur-xl transition-all","hover:border-border-default hover:shadow-glow",n&&"border-l-[3px]",i),style:n?{borderLeftColor:n}:void 0,children:[(e||r)&&u.jsxs("div",{className:"mb-4",children:[e&&u.jsxs("h3",{className:"text-base font-semibold text-text-primary",children:[t&&u.jsx("span",{className:"mr-1.5",children:t}),e]}),r&&u.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:r})]}),s]})}function TM({icon:e,title:t,description:r,action:n,className:i}){return u.jsxs("div",{className:sl("py-16 px-5 text-center bg-bg-glass border-2 border-dashed border-border-subtle rounded-2xl",i),children:[u.jsx("div",{className:"text-5xl mb-4 opacity-50",children:e}),u.jsx("h3",{className:"text-lg font-bold text-text-secondary mb-2",children:t}),u.jsx("p",{className:"text-sm text-text-muted max-w-sm mx-auto mb-5 leading-relaxed",children:r}),n]})}const PM={online:"bg-green-500/10 text-green-400 border-green-500/30",idle:"bg-yellow-500/10 text-yellow-400 border-yellow-500/30",busy:"bg-orange-500/10 text-orange-400 border-orange-500/30",error:"bg-red-500/10 text-red-400 border-red-500/30",offline:"bg-gray-500/10 text-text-secondary border-gray-500/30"},LM={online:"bg-green-500",idle:"bg-yellow-500",busy:"bg-orange-500",error:"bg-red-500",offline:"bg-gray-500"};function RM({status:e,label:t,className:r}){const n=t||e;return u.jsxs("span",{className:sl("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",PM[e],r),children:[u.jsx("span",{className:sl("w-2 h-2 rounded-full animate-[pulse-dot_2s_ease-in-out_infinite]",LM[e])}),n]})}function MM(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function J_(){try{const e=localStorage.getItem("theme");if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function Wu(e){return e==="system"?MM():e}function IM(){const[e,t]=b.useState(J_),[r,n]=b.useState(()=>Wu(J_()));b.useEffect(()=>{document.documentElement.setAttribute("data-theme",r)},[r]),b.useEffect(()=>{const o=window.matchMedia("(prefers-color-scheme: light)"),l=a=>{e==="system"&&n(a.matches?"light":"dark")};return o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[e]);const i=b.useCallback(o=>{t(o),n(Wu(o));try{localStorage.setItem("theme",o)}catch{}},[]),s=b.useCallback(()=>{t(o=>{const l=o==="dark"?"light":o==="light"?"system":"dark";n(Wu(l));try{localStorage.setItem("theme",l)}catch{}return l})},[]);return{theme:r,preference:e,setPreference:i,cycleTheme:s,isDark:r==="dark"}}const Z_={dark:"Dark",light:"Light",system:"System"};function DM({collapsed:e}){const{preference:t,cycleTheme:r}=IM(),n=t==="dark"?u.jsx(tP,{size:16}):t==="light"?u.jsx(eP,{size:16}):u.jsx(rP,{size:16});return u.jsxs("div",{className:`nav-item cursor-pointer ${e?"justify-center py-2.5 px-0":""}`,onClick:r,title:`Theme: ${Z_[t]} (click to cycle)`,children:[u.jsx("span",{className:"nav-icon",children:n}),!e&&u.jsx("span",{className:"text-xs",children:Z_[t]})]})}function is({label:e,description:t,checked:r,disabled:n,onChange:i,extra:s}){return u.jsxs("label",{className:"flex justify-between items-center cursor-pointer",children:[u.jsxs("div",{children:[u.jsx("div",{className:"font-medium text-sm",children:e}),u.jsx("div",{className:"text-[11px] text-text-muted",children:t})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[s,u.jsx("input",{type:"checkbox",checked:r,disabled:n,onChange:o=>i(o.target.checked),className:"w-5 h-5 accent-accent"})]})]})}const sb="adhdev_notification_prefs",ev={globalEnabled:!0,disconnectAlert:!0,browserNotifications:!0,completionAlert:!0,approvalAlert:!0};function jM(){try{const e=localStorage.getItem(sb);if(e){const t=JSON.parse(e);return{...ev,...t}}}catch{}return{...ev}}function AM(e){try{localStorage.setItem(sb,JSON.stringify(e))}catch{}}let kn=jM(),va=[];function BM(){va.forEach(e=>e())}function OM(e){kn={...kn,...e},AM(kn),BM()}function zM(){const[,e]=b.useState(0);b.useEffect(()=>{const r=()=>e(n=>n+1);return va.push(r),()=>{va=va.filter(n=>n!==r)}},[]);const t=b.useCallback(r=>{OM(r)},[]);return[{...kn},t]}function Hu(e){if(!kn.globalEnabled)return!1;switch(e){case"disconnect":return kn.disconnectAlert;case"completion":return kn.completionAlert;case"approval":return kn.approvalAlert;case"browser":return kn.browserNotifications;default:return!0}}function $M({onPrefChange:e}){const[t,r]=zM(),n=(i,s)=>{r({[i]:s}),e==null||e(i,s)};return u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsx(is,{label:"🔔 Notifications",description:"Master toggle for all alerts",checked:t.globalEnabled,onChange:i=>n("globalEnabled",i)}),t.globalEnabled&&u.jsx("div",{className:"border-t border-border-subtle my-0.5"}),t.globalEnabled&&u.jsx(is,{label:"🖥️ Browser Notifications",description:"Desktop alerts when tab is inactive",checked:t.browserNotifications,onChange:i=>n("browserNotifications",i)}),t.globalEnabled&&t.browserNotifications&&u.jsxs("div",{className:"ml-5 pl-3 border-l-2 border-border-subtle flex flex-col gap-2",children:[u.jsx(is,{label:"✅ Completion Alerts",description:"Notify when agent finishes a task",checked:t.completionAlert,onChange:i=>n("completionAlert",i)}),u.jsx(is,{label:"⚡ Approval Alerts",description:"Notify when agent needs approval",checked:t.approvalAlert,onChange:i=>n("approvalAlert",i)}),u.jsx(is,{label:"📡 Connection Alerts",description:"Alert when a daemon disconnects",checked:t.disconnectAlert,onChange:i=>n("disconnectAlert",i)})]}),!t.globalEnabled&&u.jsx("p",{className:"text-[11px] text-text-muted italic",children:"All notifications are disabled. Enable the master toggle to configure individual alerts."})]})}function FM({ides:e,emptyMessage:t,sendDaemonCommand:r,onDisconnect:n,onRevokeToken:i}){const s=e.filter(o=>o.type==="adhdev-daemon");return s.length===0?u.jsx(TM,{icon:"🔌",title:"No machines connected",description:t||"Run 'adhdev daemon' on your machine to connect."}):u.jsx("div",{className:"flex flex-col gap-2",children:s.map(o=>u.jsx(WM,{ide:o,sendDaemonCommand:r,onDisconnect:n,onRevokeToken:i},o.id))})}function tv({title:e,message:t,confirmLabel:r,confirmColor:n,onConfirm:i,onCancel:s}){const o=n==="red"?"bg-red-500/20 text-red-400 border-red-500/30 hover:bg-red-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30 hover:bg-amber-500/30";return b0.createPortal(u.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",style:{zIndex:9999},onClick:s,children:u.jsxs("div",{className:"bg-bg-primary border border-border-subtle rounded-xl p-5 max-w-sm w-full mx-4 shadow-2xl",onClick:l=>l.stopPropagation(),children:[u.jsx("div",{className:"font-semibold text-sm mb-3",children:e}),u.jsx("div",{className:"text-xs text-text-muted leading-relaxed mb-5 whitespace-pre-line",children:t}),u.jsxs("div",{className:"flex gap-2 justify-end",children:[u.jsx("button",{onClick:s,className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-bg-secondary text-text-secondary border border-border-subtle hover:bg-bg-glass transition-colors",children:"Cancel"}),u.jsx("button",{onClick:i,className:`text-xs px-3 py-1.5 rounded-lg font-medium border transition-colors ${o}`,children:r})]})]})}),document.body)}function WM({ide:e,sendDaemonCommand:t,onDisconnect:r,onRevokeToken:n}){var q,E,A,R;const[i,s]=b.useState("idle"),[o,l]=b.useState(""),[a,c]=b.useState(null),[d,h]=b.useState("idle"),[f,p]=b.useState(""),m=e,g=m.version||m.daemonVersion||null,S=((q=m.machine)==null?void 0:q.hostname)||((E=m.system)==null?void 0:E.hostname)||"",_=((A=m.machine)==null?void 0:A.platform)||((R=m.system)==null?void 0:R.platform)||"",x=m.machineNickname||(S==null?void 0:S.replace(/\.local$/,""))||"Machine",w=_==="win32"?"🪟":_==="darwin"?"🍎":"🐧",N=async()=>{var P,$,z;if(t){s("upgrading"),l("Installing latest version...");try{const D=await t(e.id,"daemon_upgrade",{});(P=D==null?void 0:D.result)!=null&&P.upgraded||($=D==null?void 0:D.result)!=null&&$.success?(s("done"),l(`Upgraded to v${D.result.version||"latest"}. Daemon is restarting...`)):(s("error"),l(((z=D==null?void 0:D.result)==null?void 0:z.error)||"Upgrade failed"))}catch(D){s("error"),l((D==null?void 0:D.message)||"Connection lost during upgrade")}}},L=async()=>{if(c(null),!!r){h("loading");try{await r(e.id),h("done"),p("Machine disconnected.")}catch(P){h("error"),p((P==null?void 0:P.message)||"Failed to disconnect")}}},C=async()=>{if(c(null),!!n){h("loading");try{await n(e.id),h("done"),p('Token revoked. Machine must run "adhdev setup" to reconnect.')}catch(P){h("error"),p((P==null?void 0:P.message)||"Failed to revoke token")}}},F="0.5.25",T=!g||g!==F;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"bg-bg-glass rounded-lg px-4 py-3 border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("span",{className:"text-xl",children:w}),u.jsxs("div",{children:[u.jsx("div",{className:"font-medium text-sm",children:x}),u.jsxs("div",{className:"text-xs text-text-muted font-mono flex items-center gap-2",children:[u.jsxs("span",{children:[e.id.substring(0,12),"…"]}),g&&u.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${T?"bg-amber-500/15 text-amber-400":"bg-bg-secondary"}`,children:["v",g,!T&&" ✓"]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[t&&T&&u.jsx("button",{onClick:N,disabled:i==="upgrading"||i==="done",className:`text-xs px-2.5 py-1 rounded-md font-medium transition-all
|
|
176
|
+
`})]})}function kR({screenshotUrl:e,mode:t="preview",zoom:r=100,interactive:n=!1,connectionState:i,onDismiss:s,onClickAt:o,onKeyDown:l,badge:a,emptyMessage:c,aspectRatio:d,className:h,style:f}){const p=b.useRef(null),m=b.useCallback(g=>{if(!n||!o||!p.current)return;const S=p.current,_=S.getBoundingClientRect(),x=(g.clientX-_.left)/_.width*S.naturalWidth,w=(g.clientY-_.top)/_.height*S.naturalHeight;o(x,w,S.naturalWidth,S.naturalHeight)},[n,o]);return t==="preview"?e?u.jsxs("div",{className:`relative rounded-xl overflow-hidden border border-border-subtle bg-bg-secondary ${h||""}`,style:{aspectRatio:d||"16/9",...f},children:[u.jsx("img",{ref:p,src:e,alt:"IDE Screenshot",className:"w-full h-full object-cover"}),s&&u.jsx("button",{onClick:s,className:"absolute top-2.5 right-2.5 bg-black/50 border-none text-white w-5 h-5 rounded-full text-[10px] z-10 cursor-pointer flex items-center justify-center",children:"✕"})]}):null:e?u.jsxs("div",{className:`${n?"screenshot-interactive":""} ${h||""} relative h-full flex items-center justify-center overflow-auto`,tabIndex:n?0:void 0,onKeyDown:n?l:void 0,style:f,children:[u.jsx("img",{ref:p,src:e,alt:"IDE Screenshot",onClick:n?m:void 0,className:"max-w-full max-h-full object-contain",style:{...n?{cursor:"crosshair"}:{},...r!==100?{transform:`scale(${r/100})`,transformOrigin:"center center"}:{}}}),a&&u.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 bg-black/70 text-white px-3.5 py-1.5 rounded-[20px] text-xs font-semibold backdrop-blur-sm",children:a})]}):u.jsxs("div",{className:`flex items-center justify-center flex-col gap-2 h-full text-text-muted ${h||""}`,style:f,children:[u.jsx("p",{className:"text-base",children:c||"🖥 Waiting for screenshot stream..."}),i&&u.jsxs("p",{className:"text-[13px] mt-2 opacity-50",children:["P2P: ",i]})]})}function F1({activeConv:e,onModalButton:t}){const[r,n]=b.useState(null);if(b.useEffect(()=>{n(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=o=>{r||(n(o),t(o))},s=o=>o.replace(/[⌥⏎⇧⌫⌘⌃↵]/g,"").replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi,"").trim();return u.jsxs("div",{className:"bg-gradient-to-br from-amber-600 to-amber-700 text-white py-2.5 px-4 shrink-0 z-[5]",children:[e.modalMessage&&u.jsx("div",{className:"text-[11px] opacity-85 mb-1.5 whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:e.modalMessage.replace(/[\n\r]+/g," ").slice(0,120)}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"font-black text-xs flex items-center gap-2",children:[u.jsx(qy,{size:14})," ",r?"PROCESSING...":"ACTION REQUIRED"]}),u.jsx("div",{className:"flex gap-2 flex-wrap",children:e.modalButtons.map((o,l)=>{const a=s(o).toLowerCase(),c=/^(run|approve|accept|yes|allow|always)/.test(a),d=/^(reject|deny|delete|remove|abort)/.test(a),h=r===o,f=r!==null;return u.jsx("button",{onClick:()=>i(o),disabled:f,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${c?"bg-white text-amber-700 font-extrabold":d?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${f&&!h?"opacity-40":"opacity-100"} ${f?"cursor-not-allowed":"cursor-pointer"}`,children:h?"⏳ ...":s(o)},l)})})]})]})}const Dr=new Map;function CR({ideId:e,ideType:t,agentType:r,agentName:n,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var we;const{sendCommand:a}=gi(),c=!!(o||l),d=`${e}:${r}`,h=Dr.get(d),[f,p]=b.useState(!1),[m,g]=b.useState(!1),[S,_]=b.useState((h==null?void 0:h.models)||[]),[x,w]=b.useState((h==null?void 0:h.modes)||[]),N=U=>U?typeof U=="string"?U:typeof U=="object"?U.name||U.id||JSON.stringify(U):String(U):"",[L,C]=b.useState(N(i)),[F,P]=b.useState(N(s)),[q,E]=b.useState(!1),[A,R]=b.useState(!1),T=b.useRef(0),$=U=>U.map(Y=>typeof Y=="string"?Y:(Y==null?void 0:Y.name)||(Y==null?void 0:Y.id)||String(Y));b.useEffect(()=>{if(o){const U=o.find(Y=>Y.category==="model");if(U){const Y=$(U.options.map(fe=>fe.value));_(Y),U.currentValue&&C(N(U.currentValue));const te=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...te,models:Y})}}if(l&&l.length>0){const U=$(l.map(te=>te.id));w(U);const Y=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...Y,modes:U})}else if(o){const U=o.find(Y=>Y.category!=="model");if(U){const Y=$(U.options.map(fe=>fe.value));w(Y),U.currentValue&&P(N(U.currentValue));const te=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...te,modes:Y})}}},[o,l,d]),b.useEffect(()=>{p(!1),g(!1),C(N(i)),P(N(s));const U=Dr.get(d);U?(_(U.models),w(U.modes)):(_([]),w([]))},[e,r]),b.useEffect(()=>{i&&Date.now()>T.current&&C(N(i))},[i]),b.useEffect(()=>{s&&Date.now()>T.current&&P(N(s))},[s]);const z=b.useCallback(async(U,Y={})=>{const te={...Y},fe=e.split(":");return fe.length>=3&&(fe[1]==="ide"||fe[1]==="cli"||fe[1]==="acp")&&(te._targetInstance=fe.slice(2).join(":"),te._targetType=fe[1]),await a(e,U,te)},[e]),D=async()=>{var U,Y;if(S.length>0){p(!f);return}if(c){p(!0);return}E(!0);try{const te=await z("list_extension_models",{agentType:r,ideType:t}),fe=(te==null?void 0:te.models)||((U=te==null?void 0:te.result)==null?void 0:U.models)||[],de=$(fe);_(de),te!=null&&te.current&&C(N(te.current)),(Y=te==null?void 0:te.result)!=null&&Y.current&&C(N(te.result.current));const Oe=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...Oe,models:de}),p(!0)}catch{}finally{E(!1)}},H=async()=>{var U,Y;if(x.length>0){g(!m);return}if(c){g(!0);return}R(!0);try{const te=await z("list_extension_modes",{agentType:r,ideType:t}),fe=(te==null?void 0:te.modes)||((U=te==null?void 0:te.result)==null?void 0:U.modes)||[],de=$(fe);w(de),te!=null&&te.current&&P(N(te.current)),(Y=te==null?void 0:te.result)!=null&&Y.current&&P(N(te.result.current));const Oe=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...Oe,modes:de}),g(!0)}catch{}finally{R(!1)}},I=async U=>{p(!1),C(U),T.current=Date.now()+5e3;try{c?await z("change_model",{agentType:r,ideType:t,model:U}):await z("set_extension_model",{agentType:r,ideType:t,model:U})}catch{}},W=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(U=>U.category!=="model")),y=W?(we=o==null?void 0:o.find(U=>U.category!=="model"))==null?void 0:we.configId:void 0,J=async U=>{g(!1),P(U),T.current=Date.now()+5e3;try{c&&W&&y?await z("set_thought_level",{agentType:r,ideType:t,configId:y,value:U}):c?await z("set_mode",{agentType:r,ideType:t,mode:U}):await z("set_extension_mode",{agentType:r,ideType:t,mode:U})}catch{}},k={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[r]||"#94a3b8";return u.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 flex-wrap text-[10px] border-t border-border-subtle bg-[var(--surface-primary)]",children:[u.jsx("span",{className:"text-[9px] font-bold tracking-wide uppercase opacity-70",style:{color:k},children:n}),u.jsx("span",{className:"text-border-subtle text-[10px]",children:"│"}),u.jsxs("div",{className:"relative",children:[u.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:f?`${k}55`:"transparent",border:"1px solid",color:L?"var(--text-primary)":"var(--text-muted)"},onClick:D,children:[u.jsx("span",{className:"text-[9px] opacity-60",children:"🤖"}),q?"...":L||"Model",u.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),f&&S.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>p(!1)}),u.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[u.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:"SELECT MODEL"}),S.map(U=>u.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:U===L?`${k}18`:"transparent",color:U===L?k:"var(--text-secondary)",fontWeight:U===L?600:400,borderLeft:U===L?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Y=>{Y.currentTarget.style.background=`${k}12`},onMouseLeave:Y=>{Y.currentTarget.style.background=U===L?`${k}18`:"transparent"},onClick:()=>I(U),children:U},U))]})]})]}),u.jsxs("div",{className:"relative",children:[u.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:m?`${k}55`:"transparent",border:"1px solid",color:F?"var(--text-primary)":"var(--text-muted)"},onClick:H,children:[u.jsx("span",{className:"text-[9px] opacity-60",children:W?"🧠":"⚡"}),A?"...":F||(W?"Thinking":"Mode"),u.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),m&&x.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>g(!1)}),u.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[u.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:W?"SELECT THINKING LEVEL":"SELECT MODE"}),x.map(U=>u.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:U===F?`${k}18`:"transparent",color:U===F?k:"var(--text-secondary)",fontWeight:U===F?600:400,borderLeft:U===F?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Y=>{Y.currentTarget.style.background=`${k}12`},onMouseLeave:Y=>{Y.currentTarget.style.background=U===F?`${k}18`:"transparent"},onClick:()=>J(U),children:U},U))]})]})]})]})}const In=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),tn=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function W1({activeConv:e,ides:t,agentInput:r,setAgentInput:n,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a,userName:c}){const d=b.useRef(null),{sendCommand:h}=gi(),[f,p]=b.useState([]),[m,g]=b.useState(0),[S,_]=b.useState(!0),[x,w]=b.useState(!1),N=b.useRef("");e.tabKey!==N.current&&(N.current=e.tabKey,p([]),g(0),_(!0));const L=b.useCallback(async()=>{var P,q,E,A,R,T;if(!(x||!S)){w(!0);try{const $=t.find(y=>y.id===e.ideId),z=($==null?void 0:$.daemonId)||((P=e.ideId)==null?void 0:P.split(":")[0])||"";if(!z){_(!1);return}const D=e.ideType||e.agentType||"",H=(e.ideId||"").split(":"),I=H.length>=3?H.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:z,agentType:D,instanceId:I,offset:m});const W=await h(z,"chat_history",{agentType:D,offset:m,limit:30,instanceId:I});console.log("[ChatPane] got result:",{count:((q=W.messages)==null?void 0:q.length)||0,hasMore:W.hasMore}),((E=W.messages)==null?void 0:E.length)>0&&(p(y=>[...W.messages,...y]),g(y=>y+W.messages.length)),_(W.hasMore)}catch($){console.warn("[ChatPane] Failed to load history:",$),!((A=$==null?void 0:$.message)!=null&&A.includes("P2P not available"))&&!((R=$==null?void 0:$.message)!=null&&R.includes("channel not open"))&&!((T=$==null?void 0:$.message)!=null&&T.includes("P2P not connected"))&&_(!1)}finally{w(!1)}}},[x,S,m,t,e]),C=b.useRef(0);b.useEffect(()=>{if(e.messages.length<10&&S&&!x&&f.length===0){const P=C.current;if(P>8)return;const E=setTimeout(()=>{C.current=P+1,L()},P===0?500:3e3);return()=>clearTimeout(E)}else f.length>0&&(C.current=0)},[e.tabKey,e.messages.length,S,x,f.length,L]);const F=(()=>{const P=e.messages.map((A,R)=>{const T=`${e.ideId}-${A.id??`i-${R}`}`;return{...A,receivedAt:A.receivedAt||l[T]||0}});if(f.length===0)return P;const q=new Set(P.map(A=>`${A.role}:${(A.content||"").slice(0,100)}`));return[...f.filter(A=>!q.has(`${A.role}:${(A.content||"").slice(0,100)}`)),...P]})();return u.jsxs(u.Fragment,{children:[u.jsx(Xy,{messages:F,actionLogs:a.filter(P=>P.ideId===e.tabKey).sort((P,q)=>P.timestamp-q.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",userName:c,isCliMode:In(e)||tn(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:L,isLoadingMore:x,hasMoreHistory:S,emptyState:e.messages.length===0?e.status==="not_monitored"?u.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[u.jsx("div",{className:"text-3xl opacity-60",children:u.jsx(Yy,{size:28})}),u.jsx("div",{className:"text-[13px] opacity-50",children:"Agent not monitored"}),u.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Switching...":u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," Open ",e.displayPrimary," Panel"]})}),u.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Click to switch monitoring to this agent"})]}):e.status==="panel_hidden"?u.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[u.jsx("div",{className:"text-3xl opacity-60",children:u.jsx(qP,{size:28})}),u.jsx("div",{className:"text-[13px] opacity-50",children:"Panel is not visible in IDE"}),u.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Opening...":u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," Open ",e.displayPrimary," Panel"]})}),u.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Open the agent sidebar in your IDE to start viewing messages"})]}):void 0:void 0}),!In(e)&&(()=>{var q,E,A,R;const P=t.find(T=>T.id===e.ideId);return u.jsx(CR,{ideId:e.ideId,ideType:e.ideType,agentType:e.streamSource==="agent-stream"?e.agentType:((E=(q=P==null?void 0:P.agents)==null?void 0:q[0])==null?void 0:E.type)||e.ideType,agentName:e.streamSource==="agent-stream"?e.agentName:((R=(A=P==null?void 0:P.agents)==null?void 0:A[0])==null?void 0:R.name)||e.agentName,serverModel:(P==null?void 0:P.currentModel)||void 0,serverMode:(P==null?void 0:P.currentPlan)||void 0,acpConfigOptions:tn(e)?P==null?void 0:P.acpConfigOptions:void 0,acpModes:tn(e)?P==null?void 0:P.acpModes:void 0})})(),u.jsx("div",{className:"dashboard-input-area px-3 py-2.5 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:u.jsxs("div",{className:"flex gap-2.5 items-center",children:[u.jsx("div",{className:"flex-1 relative",children:u.jsx("input",{ref:d,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:P=>n(P.target.value),onPaste:P=>{const q=P.clipboardData.getData("text");q&&n(E=>E+q),P.preventDefault()},onKeyDown:P=>{if(P.key==="Enter"){if(P.nativeEvent.isComposing){P.preventDefault();return}P.preventDefault(),i()}},onBlur:P=>{if(window.innerWidth<768){const q=P.relatedTarget;if((q==null?void 0:q.tagName)==="BUTTON")return;setTimeout(()=>{document.documentElement.scrollTop=0},300)}},className:"w-full h-10 rounded-[20px] px-4 bg-bg-secondary border border-border-subtle text-sm text-text-primary"})}),u.jsx("button",{onClick:i,disabled:!r.trim(),className:`w-10 h-10 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${r.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:r.trim()?"text-white":"text-text-muted",children:u.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}const Ou=new Set,H1={emit(e,t){for(const r of Ou)r(e,t)},on(e){return Ou.add(e),()=>{Ou.delete(e)}}};function ER({activeConv:e,ptyBuffers:t,terminalRef:r,agentInput:n,setAgentInput:i,handleSendChat:s,handleModalButton:o}){var p;const l=b.useRef(null),{sendCommand:a,sendData:c}=gi(),d=(p=e.ideId)!=null&&p.includes(":cli:")?e.ideId.split(":cli:")[1]:"",h=e.tabKey,f=e.ideType||e.agentType||"";return b.useEffect(()=>{const m=t.current.get(h);if(m&&m.length>0){const g=setTimeout(()=>{var S;for(const _ of m)(S=r.current)==null||S.write(_);requestAnimationFrame(()=>{var _;(_=r.current)==null||_.bumpResize()})},100);return()=>clearTimeout(g)}},[h]),b.useEffect(()=>{const m=H1.on((g,S)=>{var x;if(!S)return;(g===d||g===f)&&((x=r.current)==null||x.write(S))});return()=>{m()}},[d,f]),u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--surface-primary)] border-b border-border-subtle shrink-0",children:[u.jsx("div",{className:"flex gap-1",children:u.jsx("div",{className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-accent text-white",children:"⬛ Terminal"})}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("div",{className:"text-[10px] text-text-muted",children:[e.agentName," — Terminal"]}),u.jsx("button",{onClick:()=>{if(!r.current||!e)return;const m=t.current.get(e.tabKey);if(m&&m.length>0)for(const g of m)r.current.write(g);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var g;(g=r.current)==null||g.bumpResize()})})},title:"Refresh terminal (replay buffer + TUI redraw)",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-bg-secondary text-text-secondary border border-border-subtle cursor-pointer leading-none",children:"↺"}),u.jsx("button",{onClick:async()=>{var S;const m=(S=e.ideId)!=null&&S.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";if(!window.confirm(`Stop ${m}?
|
|
177
|
+
This will terminate the CLI process.`))return;const g=e.ideId||e.daemonId||"";try{await a(g,"stop_cli",{cliType:m})}catch(_){console.error("Stop CLI failed:",_)}},title:"Stop CLI process",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-red-500/[0.08] text-red-400 border border-red-500/30 cursor-pointer leading-none font-semibold",children:"■ Stop"})]})]}),u.jsx(F1,{activeConv:e,onModalButton:o}),u.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:u.jsx($1,{ref:r,onInput:m=>{var _;const g=e.ideId||e.daemonId||"",S=(_=e.ideId)!=null&&_.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(g,{type:"pty_input",cliType:S,data:m})||a(g,"pty_input",{cliType:S,data:m}).catch(console.error)},onResize:(m,g)=>{var x;const S=e.ideId||e.daemonId||"",_=(x=e.ideId)!=null&&x.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(S,{type:"pty_resize",cliType:_,cols:m,rows:g})||a(S,"pty_resize",{cliType:_,cols:m,rows:g,force:!0}).catch(()=>{})}},e.tabKey)}),u.jsx("div",{className:"px-3 py-2 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:u.jsxs("div",{className:"flex gap-2.5 items-center",children:[u.jsx("div",{className:"flex-1 relative",children:u.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:n,onChange:m=>i(m.target.value),onPaste:m=>{const g=m.clipboardData.getData("text");g&&i(S=>S+g),m.preventDefault()},onKeyDown:m=>{if(m.key==="Enter"){if(m.nativeEvent.isComposing){m.preventDefault();return}m.preventDefault(),s()}},className:"w-full h-9 rounded-[18px] px-4 bg-bg-secondary border border-border-subtle text-[13px] text-text-primary"})}),u.jsx("button",{onClick:s,disabled:!n.trim(),className:`w-9 h-9 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${n.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:n.trim()?"text-white":"text-text-muted",children:u.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function NR({wsStatus:e,showReconnected:t,loginUrl:r}){const n=e==="disconnected"||e==="reconnecting"||e==="offline"||e==="auth_failed",i=e==="auth_failed"?"red":e==="offline"?"orange":"violet",s={red:"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))",orange:"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))",violet:"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))"},o={red:"1px solid rgba(239,68,68,0.2)",orange:"1px solid rgba(255,107,53,0.2)",violet:"1px solid rgba(139,92,246,0.2)"},l={red:"#ef4444",orange:"#ff6b35",violet:"#a78bfa"};return u.jsxs(u.Fragment,{children:[n&&u.jsxs("div",{className:"py-2.5 px-5 text-[13px] font-semibold flex items-center gap-2.5 justify-center",style:{background:s[i],borderBottom:o[i],color:l[i]},children:[u.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-5 h-5",style:{opacity:e==="auth_failed"?.6:1,animation:e==="auth_failed"?void 0:"pulse 2s ease-in-out infinite",filter:e==="auth_failed"?"grayscale(1)":void 0}}),e==="offline"&&"Network offline — waiting for connection...",e==="disconnected"&&"Reconnecting to server...",e==="reconnecting"&&"Reconnecting to server...",e==="auth_failed"&&(r?u.jsxs(u.Fragment,{children:["Session expired."," ",u.jsx("a",{href:r,className:"text-inherit underline",children:"Log in again"})]}):"Connection failed — please restart the server.")]}),t&&e==="connected"&&u.jsxs("div",{className:"py-2 px-4 text-xs font-semibold flex items-center gap-2 justify-center bg-gradient-to-r from-green-500/[0.12] to-green-500/[0.04] text-green-400 border-b border-green-500/15 animate-[fadeIn_0.3s_ease]",children:[u.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-4 h-4"}),"Connected"]})]})}const zu=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),$u=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function PR({activeConv:e,agentCount:t,wsStatus:r,isConnected:n,onOpenHistory:i}){const s=Os(),o=n?"#22c55e":r==="connected"?"#eab308":"#ef4444",l=n?"0 0 4px #22c55e80":r==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480";return u.jsxs("div",{className:"dashboard-header",children:[u.jsx("div",{className:"flex items-center gap-3",children:u.jsxs("div",{className:"leading-tight",children:[u.jsxs("h1",{className:"header-title m-0 flex items-center gap-1.5",children:[u.jsx(Xa,{size:18}),u.jsx("span",{className:"header-title-desktop",children:"Dashboard"}),u.jsx("span",{className:"header-title-mobile",children:(e==null?void 0:e.displayPrimary)||"Dashboard"}),u.jsx("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:u.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full align-middle",style:{background:o,boxShadow:l}})})]}),u.jsxs("div",{className:"header-subtitle text-[11px] items-center gap-1",children:[t," agent",t!==1?"s":""," active",u.jsx("span",{title:n?"Connected":r==="connected"?"Partial":"Disconnected",className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{background:o,boxShadow:l}})]})]})}),u.jsxs("div",{className:"flex gap-2 items-center",children:[e&&!zu(e)&&!$u(e)&&u.jsxs("button",{onClick:()=>s(`/ide/${e.ideId}`),className:"btn btn-primary btn-sm border-none px-2.5 py-1.5 flex items-center gap-1 text-xs",title:"IDE View",children:[u.jsx(XP,{size:14})," IDE"]}),e&&!zu(e)&&!$u(e)&&u.jsx("button",{onClick:i,className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5 flex items-center gap-1",title:"Chat History",children:u.jsx(UP,{size:16})}),e&&!zu(e)&&!$u(e)&&u.jsx("button",{onClick:()=>s(`/ide/${e.ideId}?view=remote`),className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5",title:"Remote Control",children:u.jsx(Ro,{size:16})})]})]})}function Ar(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function TR(e){if(e<60)return`${Math.round(e)}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const r=Math.floor(t/60),n=t%60;if(r<24)return n>0?`${r}h ${n}m`:`${r}h`;const i=Math.floor(r/24),s=r%24;return`${i}d ${s}h`}function W_(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function H_(e){return(e.id||"").includes(":cli:")}function U_(e){return(e.id||"").includes(":acp:")}function Ad(e,t){return Ar(e)}function LR(e){if(!Array.isArray(e)||e.length<=1)return e;const t=new Map,r=["generating","streaming","active","connected","idle","panel_hidden"];for(const n of e){const i=(n.name||n.id||"").toLowerCase().replace(/\s+/g,"-"),s=t.get(i);if(!s){t.set(i,n);continue}const o=r.indexOf(s.status||"idle"),l=r.indexOf(n.status||"idle");l>=0&&(o<0||l<o)&&t.set(i,n)}return Array.from(t.values())}function RR({activeConv:e,ides:t,isCreatingChat:r,isRefreshingHistory:n,onClose:i,onNewChat:s,onSwitchSession:o,onRefreshHistory:l}){var h;const a=t.find(f=>f.id===e.ideId),c=(a==null?void 0:a.chats)||[],d=(h=a==null?void 0:a.activeChat)==null?void 0:h.id;return u.jsxs("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center",children:[u.jsx("div",{onClick:i,className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),u.jsxs("div",{className:"card fade-in relative w-[90%] max-w-[500px] max-h-[80vh] flex flex-col p-0 overflow-hidden shadow-[0_20px_40px_rgba(0,0,0,0.4)] rounded-[20px]",children:[u.jsxs("div",{className:"px-6 py-5 border-b border-border-subtle flex justify-between items-center bg-[var(--surface-primary)]",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"m-0 text-lg font-extrabold",children:"Chat History"}),u.jsxs("div",{className:"text-xs text-text-muted mt-0.5",children:[e.displayPrimary," — ",Ar(e.ideType)]})]}),u.jsx("button",{onClick:i,className:"bg-transparent border-none text-xl text-text-muted cursor-pointer",children:"✕"})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-3 bg-bg-primary",children:[u.jsx("button",{onClick:s,disabled:r,className:"w-full p-3.5 rounded-xl mb-3 bg-indigo-500/10 border border-dashed border-accent text-accent font-bold text-sm cursor-pointer",children:r?"⌛ Creating...":"+ Start New Chat Session"}),c.map(f=>u.jsxs("div",{onClick:()=>{o(e.ideId,f.id),i()},className:`p-4 rounded-xl mb-2 cursor-pointer border transition-all ${d===f.id?"bg-[var(--bg-glass-hover)] border-accent":"bg-[var(--surface-secondary)] border-border-subtle"}`,children:[u.jsx("div",{className:`font-bold text-sm mb-1 ${d===f.id?"text-[var(--accent-primary-light)]":"text-text-primary"}`,children:f.title||"Untitled Session"}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-mono",children:[f.id.substring(0,12),"..."]}),d===f.id&&u.jsx("span",{className:"text-[10px] bg-accent text-white px-2 py-0.5 rounded-[10px] font-extrabold",children:"ACTIVE"})]})]},f.id)),c.length===0&&u.jsxs("div",{className:"py-10 px-5 text-center text-text-muted",children:[u.jsx("div",{className:"text-3xl mb-3 opacity-60",children:u.jsx(ZP,{size:32})}),u.jsx("div",{className:"text-[13px]",children:"No recent chat sessions found."})]})]}),u.jsx("div",{className:"px-5 py-4 bg-[var(--surface-tertiary)] border-t border-border-subtle text-right",children:u.jsx("button",{onClick:l,disabled:n,className:"btn btn-secondary btn-sm rounded-[10px]",children:n?"⌛ Refreshing...":u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(KP,{size:13})," Refresh History"]})})})]})]})}const V_={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function MR({toasts:e,onDismiss:t,onClickToast:r}){return u.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:e.map(n=>u.jsx("div",{className:"fade-in text-white px-5 py-3 rounded-xl text-[13px] font-semibold shadow-[0_8px_32px_rgba(0,0,0,0.3)] backdrop-blur-lg pointer-events-auto cursor-pointer animate-[toast-in_0.3s_ease-out] max-w-[360px]",style:{background:V_[n.type]||V_.info},onClick:()=>{r&&r(n),t(n.id)},children:n.message},n.id))})}const IR=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function DR(e){return e.workspace||"Workspace"}function jR(e,t,r,n){var s;const i={};if(r)for(const o of r){const l=o;if(l.type==="adhdev-daemon"||l.daemonMode){const a=l.machine||{},c=l.machineNickname,d=a.hostname||((s=l.system)==null?void 0:s.hostname)||"",h=c||(d&&d!=="Unknown"?d.replace(/\.local$/,""):null)||`Machine ${(l.id||"").substring(0,6)}`;i[l.id]=h}}return e.flatMap(o=>{var S,_,x,w,N;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((S=o.id)==null?void 0:S.split(":")[0])||o.id,d=n?n[c]||"new":void 0,h=DR(o),f=Ar(o.type),p=o.agentStreams,m=Array.isArray(p)?p.map(L=>({...L,activeModal:L.activeModal??void 0})):[],g=IR(o);if(g){const L=Ad(o.type),C=(_=o.agents)==null?void 0:_[0],F=(x=o.activeChat)==null?void 0:x.activeModal,P=F&&Array.isArray(F.buttons)&&F.buttons.length>0,q=(w=o.activeChat)==null?void 0:w.status,E=q==="generating"||q==="loading"||q&&q.toLowerCase()==="thinking",R=P||q==="waiting_approval"?"waiting_approval":E?"working":(C==null?void 0:C.status)||"idle",T=o.activeChat||{title:"",messages:[]};let $=T.title&&String(T.title).trim()?String(T.title).trim():"";const z=(N=o.activeChat)==null?void 0:N.id,D=o.chats;if(z&&Array.isArray(D)&&D.length>0){const J=D.find(ae=>ae.id===z||ae.id&&String(ae.id)===String(z));J!=null&&J.title&&String(J.title).trim()&&($=String(J.title).trim())}const H=T.messages||[],I=t[o.id]||[],W=new Map;H.filter(J=>J.role==="user").forEach(J=>{W.set(J.content,(W.get(J.content)||0)+1)});const y=I.filter(J=>{const ae=W.get(J.content)||0;return ae>0?(W.set(J.content,ae-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:L,agentType:In(o)||tn(o)?o.type:(C==null?void 0:C.type)||"ide-native",status:R,title:$,messages:[...H,...y],ideType:o.type,workspaceName:h,displayPrimary:$||h,displaySecondary:f,cdpConnected:o.cdpConnected,modalButtons:P?F.buttons:void 0,modalMessage:P?F.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,connectionState:d})}if(g&&(In(o)||tn(o)))return l;for(const L of m){const C=L.activeModal&&Array.isArray(L.activeModal.buttons)&&L.activeModal.buttons.length>0,F=C?"waiting_approval":L.status==="streaming"?"working":L.status,P=`${o.id}:${L.agentType}`,q=L.messages||[],E=t[P]||[],A=new Map;q.filter(T=>T.role==="user").forEach(T=>{A.set(T.content,(A.get(T.content)||0)+1)});const R=E.filter(T=>{const $=A.get(T.content)||0;return $>0?(A.set(T.content,$-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:L.agentName,agentType:L.agentType,status:F,title:"",messages:[...q,...R],ideType:o.type,workspaceName:h,displayPrimary:h,displaySecondary:`${f}·${L.agentName}`,cdpConnected:o.cdpConnected,modalButtons:C?L.activeModal.buttons:void 0,modalMessage:C?L.activeModal.message:void 0,streamSource:"agent-stream",tabKey:P,machineName:a,connectionState:d})}return l.length===0&&l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:Ad(o.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:o.type,workspaceName:h,displayPrimary:h,displaySecondary:f,cdpConnected:o.cdpConnected,streamSource:"native",tabKey:o.id,connectionState:d}),l})}function AR(e,t){var l,a,c,d;const r=[],{daemonId:n,existingDaemon:i,timestamp:s}=t,o=s||e.timestamp||Date.now();r.push({...i||{},id:n,type:"adhdev-daemon",status:"online",daemonMode:!0,timestamp:o,...e.version&&{version:e.version},...e.machine&&{machine:e.machine,platform:e.machine.platform},...e.instanceId&&{instanceId:e.instanceId},...e.machineNickname!==void 0&&{machineNickname:e.machineNickname},...e.p2p&&{p2p:e.p2p},..."system"in e&&{system:e.system},..."hostname"in e&&{hostname:e.hostname},...e.workspaces&&{workspaces:e.workspaces},...e.defaultWorkspaceId!==void 0&&{defaultWorkspaceId:e.defaultWorkspaceId},...e.defaultWorkspacePath!==void 0&&{defaultWorkspacePath:e.defaultWorkspacePath},...e.workspaceActivity&&{workspaceActivity:e.workspaceActivity},...e.detectedIdes&&{detectedIdes:e.detectedIdes},..."availableProviders"in e&&{availableProviders:e.availableProviders},cdpConnected:e.managedIdes.some(h=>h.cdpConnected),managedIdeIds:e.managedIdes.map(h=>`${n}:ide:${h.instanceId}`),managedCliIds:e.managedClis.map(h=>h.id?`${n}:cli:${h.id}`:`${n}:cli:${h.cliType}`),managedAcpIds:e.managedAcps.map(h=>h.id?`${n}:acp:${h.id}`:`${n}:acp:${h.acpType}`)});for(const h of e.managedIdes)r.push({id:`${n}:ide:${h.instanceId}`,type:h.ideType,ideType:h.ideType,version:h.ideVersion,status:h.cdpConnected?"online":"detected",daemonId:n,instanceId:h.instanceId,workspace:h.workspace,terminals:h.terminals,agents:h.aiAgents,activeChat:h.activeChat,chats:h.chats,agentStreams:h.agentStreams,cdpConnected:h.cdpConnected,currentModel:h.currentModel,currentPlan:h.currentPlan,currentAutoApprove:h.currentAutoApprove,timestamp:o});for(const h of e.managedClis){const f=h.id?`${n}:cli:${h.id}`:`${n}:cli:${h.cliType}`;r.push({id:f,type:h.cliType,ideType:h.cliType,agentType:h.cliType,status:h.status||"running",daemonId:n,instanceId:h.id,cliName:h.cliName,mode:h.mode||"terminal",workspace:h.workspace,activeChat:h.activeChat,agentStreams:[{agentType:h.cliType,agentName:h.cliName,extensionId:"cli-agent",status:h.status==="generating"?"streaming":h.status==="waiting_approval"?"waiting_approval":"idle",messages:((l=h.activeChat)==null?void 0:l.messages)||[],inputContent:"",activeModal:(a=h.activeChat)==null?void 0:a.activeModal}],timestamp:o,_isCli:!0})}for(const h of e.managedAcps){const f=h.id?`${n}:acp:${h.id}`:`${n}:acp:${h.acpType}`;r.push({id:f,type:h.acpType,ideType:h.acpType,agentType:h.acpType,status:h.status||"running",daemonId:n,instanceId:h.id,cliName:h.acpName,mode:"chat",workspace:h.workspace,activeChat:h.activeChat,currentModel:h.currentModel,currentPlan:h.currentPlan,acpConfigOptions:h.acpConfigOptions,acpModes:h.acpModes,agentStreams:[{agentType:h.acpType,agentName:h.acpName,extensionId:"acp-agent",status:h.status==="generating"?"streaming":h.status==="waiting_approval"?"waiting_approval":"idle",messages:((c=h.activeChat)==null?void 0:c.messages)||[],inputContent:"",activeModal:(d=h.activeChat)==null?void 0:d.activeModal}],timestamp:o,_isAcp:!0})}return r}function U1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=U1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function BR(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=U1(e))&&(n&&(n+=" "),n+=t);return n}const OR=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},zR=(e,t)=>({classGroupId:e,validator:t}),V1=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),rc="-",K_=[],$R="arbitrary..",FR=e=>{const t=HR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return WR(o);const l=o.split(rc),a=l[0]===""&&l.length>1?1:0;return K1(l,a,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const a=n[o],c=r[o];return a?c?OR(c,a):a:c||K_}return r[o]||K_}}},K1=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],s=r.nextPart.get(i);if(s){const c=K1(e,t+1,s);if(c)return c}const o=r.validators;if(o===null)return;const l=t===0?e.join(rc):e.slice(t).join(rc),a=o.length;for(let c=0;c<a;c++){const d=o[c];if(d.validator(l))return d.classGroupId}},WR=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?$R+n:void 0})(),HR=e=>{const{theme:t,classGroups:r}=e;return UR(r,t)},UR=(e,t)=>{const r=V1();for(const n in e){const i=e[n];hp(i,r,n,t)}return r},hp=(e,t,r,n)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];VR(o,t,r,n)}},VR=(e,t,r,n)=>{if(typeof e=="string"){KR(e,t,r);return}if(typeof e=="function"){qR(e,t,r,n);return}YR(e,t,r,n)},KR=(e,t,r)=>{const n=e===""?t:q1(t,e);n.classGroupId=r},qR=(e,t,r,n)=>{if(XR(e)){hp(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(zR(r,e))},YR=(e,t,r,n)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,a]=i[o];hp(a,q1(t,l),r,n)}},q1=(e,t)=>{let r=e;const n=t.split(rc),i=n.length;for(let s=0;s<i;s++){const o=n[s];let l=r.nextPart.get(o);l||(l=V1(),r.nextPart.set(o,l)),r=l}return r},XR=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,GR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const i=(s,o)=>{r[s]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in r?r[s]=o:i(s,o)}}},Bd="!",q_=":",QR=[],Y_=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),JR=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=i=>{const s=[];let o=0,l=0,a=0,c;const d=i.length;for(let g=0;g<d;g++){const S=i[g];if(o===0&&l===0){if(S===q_){s.push(i.slice(a,g)),a=g+1;continue}if(S==="/"){c=g;continue}}S==="["?o++:S==="]"?o--:S==="("?l++:S===")"&&l--}const h=s.length===0?i:i.slice(a);let f=h,p=!1;h.endsWith(Bd)?(f=h.slice(0,-1),p=!0):h.startsWith(Bd)&&(f=h.slice(1),p=!0);const m=c&&c>a?c-a:void 0;return Y_(s,p,f,m)};if(t){const i=t+q_,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):Y_(QR,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},ZR=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let s=0;s<r.length;s++){const o=r[s],l=o[0]==="[",a=t.has(o);l||a?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},eM=e=>({cache:GR(e.cacheSize),parseClassName:JR(e),sortModifiers:ZR(e),...FR(e)}),tM=/\s+/,rM=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(tM);let a="";for(let c=l.length-1;c>=0;c-=1){const d=l[c],{isExternal:h,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=r(d);if(h){a=d+(a.length>0?" "+a:a);continue}let S=!!g,_=n(S?m.substring(0,g):m);if(!_){if(!S){a=d+(a.length>0?" "+a:a);continue}if(_=n(m),!_){a=d+(a.length>0?" "+a:a);continue}S=!1}const x=f.length===0?"":f.length===1?f[0]:s(f).join(":"),w=p?x+Bd:x,N=w+_;if(o.indexOf(N)>-1)continue;o.push(N);const L=i(_,S);for(let C=0;C<L.length;++C){const F=L[C];o.push(w+F)}a=d+(a.length>0?" "+a:a)}return a},nM=(...e)=>{let t=0,r,n,i="";for(;t<e.length;)(r=e[t++])&&(n=Y1(r))&&(i&&(i+=" "),i+=n);return i},Y1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Y1(e[n]))&&(r&&(r+=" "),r+=t);return r},iM=(e,...t)=>{let r,n,i,s;const o=a=>{const c=t.reduce((d,h)=>h(d),e());return r=eM(c),n=r.cache.get,i=r.cache.set,s=l,l(a)},l=a=>{const c=n(a);if(c)return c;const d=rM(a,r);return i(a,d),d};return s=o,(...a)=>s(nM(...a))},sM=[],Pt=e=>{const t=r=>r[e]||sM;return t.isThemeGetter=!0,t},X1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,G1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oM=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,uM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=e=>oM.test(e),Ae=e=>!!e&&!Number.isNaN(Number(e)),Vn=e=>!!e&&Number.isInteger(Number(e)),Fu=e=>e.endsWith("%")&&Ae(e.slice(0,-1)),xn=e=>lM.test(e),Q1=()=>!0,dM=e=>aM.test(e)&&!cM.test(e),dp=()=>!1,fM=e=>uM.test(e),pM=e=>hM.test(e),mM=e=>!ye(e)&&!be(e),gM=e=>vi(e,eb,dp),ye=e=>X1.test(e),wi=e=>vi(e,tb,dM),X_=e=>vi(e,kM,Ae),_M=e=>vi(e,nb,Q1),vM=e=>vi(e,rb,dp),G_=e=>vi(e,J1,dp),xM=e=>vi(e,Z1,pM),Yl=e=>vi(e,ib,fM),be=e=>G1.test(e),lo=e=>Qi(e,tb),yM=e=>Qi(e,rb),Q_=e=>Qi(e,J1),bM=e=>Qi(e,eb),wM=e=>Qi(e,Z1),Xl=e=>Qi(e,ib,!0),SM=e=>Qi(e,nb,!0),vi=(e,t,r)=>{const n=X1.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Qi=(e,t,r=!1)=>{const n=G1.exec(e);return n?n[1]?t(n[1]):r:!1},J1=e=>e==="position"||e==="percentage",Z1=e=>e==="image"||e==="url",eb=e=>e==="length"||e==="size"||e==="bg-size",tb=e=>e==="length",kM=e=>e==="number",rb=e=>e==="family-name",nb=e=>e==="number"||e==="weight",ib=e=>e==="shadow",CM=()=>{const e=Pt("color"),t=Pt("font"),r=Pt("text"),n=Pt("font-weight"),i=Pt("tracking"),s=Pt("leading"),o=Pt("breakpoint"),l=Pt("container"),a=Pt("spacing"),c=Pt("radius"),d=Pt("shadow"),h=Pt("inset-shadow"),f=Pt("text-shadow"),p=Pt("drop-shadow"),m=Pt("blur"),g=Pt("perspective"),S=Pt("aspect"),_=Pt("ease"),x=Pt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...N(),be,ye],C=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],P=()=>[be,ye,a],q=()=>[Un,"full","auto",...P()],E=()=>[Vn,"none","subgrid",be,ye],A=()=>["auto",{span:["full",Vn,be,ye]},Vn,be,ye],R=()=>[Vn,"auto",be,ye],T=()=>["auto","min","max","fr",be,ye],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...P()],H=()=>[Un,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],I=()=>[Un,"screen","full","dvw","lvw","svw","min","max","fit",...P()],W=()=>[Un,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],y=()=>[e,be,ye],J=()=>[...N(),Q_,G_,{position:[be,ye]}],ae=()=>["no-repeat",{repeat:["","x","y","space","round"]}],k=()=>["auto","cover","contain",bM,gM,{size:[be,ye]}],we=()=>[Fu,lo,wi],U=()=>["","none","full",c,be,ye],Y=()=>["",Ae,lo,wi],te=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[Ae,Fu,Q_,G_],Oe=()=>["","none",m,be,ye],Ve=()=>["none",Ae,be,ye],Ie=()=>["none",Ae,be,ye],G=()=>[Ae,be,ye],me=()=>[Un,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xn],breakpoint:[xn],color:[Q1],container:[xn],"drop-shadow":[xn],ease:["in","out","in-out"],font:[mM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xn],shadow:[xn],spacing:["px",Ae],text:[xn],"text-shadow":[xn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Un,ye,be,S]}],container:["container"],columns:[{columns:[Ae,ye,be,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{"inset-s":q(),start:q()}],end:[{"inset-e":q(),end:q()}],"inset-bs":[{"inset-bs":q()}],"inset-be":[{"inset-be":q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[Vn,"auto",be,ye]}],basis:[{basis:[Un,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ae,Un,"auto","initial","none",ye]}],grow:[{grow:["",Ae,be,ye]}],shrink:[{shrink:["",Ae,be,ye]}],order:[{order:[Vn,"first","last","none",be,ye]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...I()]}],"min-inline-size":[{"min-inline":["auto",...I()]}],"max-inline-size":[{"max-inline":["none",...I()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[l,"screen",...H()]}],"min-w":[{"min-w":[l,"screen","none",...H()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,lo,wi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,SM,_M]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fu,ye]}],"font-family":[{font:[yM,vM,t]}],"font-features":[{"font-features":[ye]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,be,ye]}],"line-clamp":[{"line-clamp":[Ae,"none",be,X_]}],leading:[{leading:[s,...P()]}],"list-image":[{"list-image":["none",be,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",be,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:y()}],"text-color":[{text:y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ae,"from-font","auto",be,wi]}],"text-decoration-color":[{decoration:y()}],"underline-offset":[{"underline-offset":[Ae,"auto",be,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be,ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",be,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:k()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Vn,be,ye],radial:["",be,ye],conic:[Vn,be,ye]},wM,xM]}],"bg-color":[{bg:y()}],"gradient-from-pos":[{from:we()}],"gradient-via-pos":[{via:we()}],"gradient-to-pos":[{to:we()}],"gradient-from":[{from:y()}],"gradient-via":[{via:y()}],"gradient-to":[{to:y()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:y()}],"border-color-x":[{"border-x":y()}],"border-color-y":[{"border-y":y()}],"border-color-s":[{"border-s":y()}],"border-color-e":[{"border-e":y()}],"border-color-bs":[{"border-bs":y()}],"border-color-be":[{"border-be":y()}],"border-color-t":[{"border-t":y()}],"border-color-r":[{"border-r":y()}],"border-color-b":[{"border-b":y()}],"border-color-l":[{"border-l":y()}],"divide-color":[{divide:y()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ae,be,ye]}],"outline-w":[{outline:["",Ae,lo,wi]}],"outline-color":[{outline:y()}],shadow:[{shadow:["","none",d,Xl,Yl]}],"shadow-color":[{shadow:y()}],"inset-shadow":[{"inset-shadow":["none",h,Xl,Yl]}],"inset-shadow-color":[{"inset-shadow":y()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:y()}],"ring-offset-w":[{"ring-offset":[Ae,wi]}],"ring-offset-color":[{"ring-offset":y()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":y()}],"text-shadow":[{"text-shadow":["none",f,Xl,Yl]}],"text-shadow-color":[{"text-shadow":y()}],opacity:[{opacity:[Ae,be,ye]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":y()}],"mask-image-linear-to-color":[{"mask-linear-to":y()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":y()}],"mask-image-t-to-color":[{"mask-t-to":y()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":y()}],"mask-image-r-to-color":[{"mask-r-to":y()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":y()}],"mask-image-b-to-color":[{"mask-b-to":y()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":y()}],"mask-image-l-to-color":[{"mask-l-to":y()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":y()}],"mask-image-x-to-color":[{"mask-x-to":y()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":y()}],"mask-image-y-to-color":[{"mask-y-to":y()}],"mask-image-radial":[{"mask-radial":[be,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":y()}],"mask-image-radial-to-color":[{"mask-radial-to":y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[Ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":y()}],"mask-image-conic-to-color":[{"mask-conic-to":y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:k()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",be,ye]}],filter:[{filter:["","none",be,ye]}],blur:[{blur:Oe()}],brightness:[{brightness:[Ae,be,ye]}],contrast:[{contrast:[Ae,be,ye]}],"drop-shadow":[{"drop-shadow":["","none",p,Xl,Yl]}],"drop-shadow-color":[{"drop-shadow":y()}],grayscale:[{grayscale:["",Ae,be,ye]}],"hue-rotate":[{"hue-rotate":[Ae,be,ye]}],invert:[{invert:["",Ae,be,ye]}],saturate:[{saturate:[Ae,be,ye]}],sepia:[{sepia:["",Ae,be,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",be,ye]}],"backdrop-blur":[{"backdrop-blur":Oe()}],"backdrop-brightness":[{"backdrop-brightness":[Ae,be,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Ae,be,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ae,be,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ae,be,ye]}],"backdrop-invert":[{"backdrop-invert":["",Ae,be,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Ae,be,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Ae,be,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Ae,be,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",be,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ae,"initial",be,ye]}],ease:[{ease:["linear","initial",_,be,ye]}],delay:[{delay:[Ae,be,ye]}],animate:[{animate:["none",x,be,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,be,ye]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ve()}],"rotate-x":[{"rotate-x":Ve()}],"rotate-y":[{"rotate-y":Ve()}],"rotate-z":[{"rotate-z":Ve()}],scale:[{scale:Ie()}],"scale-x":[{"scale-x":Ie()}],"scale-y":[{"scale-y":Ie()}],"scale-z":[{"scale-z":Ie()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[be,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":["translate-none"],accent:[{accent:y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",be,ye]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",be,ye]}],fill:[{fill:["none",...y()]}],"stroke-w":[{stroke:[Ae,lo,wi,X_]}],stroke:[{stroke:["none",...y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},EM=iM(CM);function sl(...e){return EM(BR(e))}function NM({icon:e,title:t,subtitle:r,badge:n,actions:i,className:s}){return u.jsxs("div",{className:sl("flex items-center justify-between px-6 py-4 border-b border-border-subtle bg-surface-primary animate-[fadeIn_0.3s_ease-out_forwards]",s),children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"text-lg font-bold text-text-primary flex items-center gap-2.5 tracking-tight",children:[u.jsx("span",{children:e})," ",t,n&&u.jsxs("span",{className:"text-xs font-semibold px-2 py-0.5 rounded-full bg-accent/10 text-accent-light",children:[n.count!==void 0?n.count:""," ",n.text]})]}),u.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:r})]}),i&&u.jsx("div",{className:"flex gap-2",children:i})]})}function ao({title:e,icon:t,description:r,accentColor:n,className:i,children:s}){return u.jsxs("div",{className:sl("bg-bg-card border border-border-subtle rounded-2xl p-5 backdrop-blur-xl transition-all","hover:border-border-default hover:shadow-glow",n&&"border-l-[3px]",i),style:n?{borderLeftColor:n}:void 0,children:[(e||r)&&u.jsxs("div",{className:"mb-4",children:[e&&u.jsxs("h3",{className:"text-base font-semibold text-text-primary",children:[t&&u.jsx("span",{className:"mr-1.5",children:t}),e]}),r&&u.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:r})]}),s]})}function PM({icon:e,title:t,description:r,action:n,className:i}){return u.jsxs("div",{className:sl("py-16 px-5 text-center bg-bg-glass border-2 border-dashed border-border-subtle rounded-2xl",i),children:[u.jsx("div",{className:"text-5xl mb-4 opacity-50",children:e}),u.jsx("h3",{className:"text-lg font-bold text-text-secondary mb-2",children:t}),u.jsx("p",{className:"text-sm text-text-muted max-w-sm mx-auto mb-5 leading-relaxed",children:r}),n]})}const TM={online:"bg-green-500/10 text-green-400 border-green-500/30",idle:"bg-yellow-500/10 text-yellow-400 border-yellow-500/30",busy:"bg-orange-500/10 text-orange-400 border-orange-500/30",error:"bg-red-500/10 text-red-400 border-red-500/30",offline:"bg-gray-500/10 text-text-secondary border-gray-500/30"},LM={online:"bg-green-500",idle:"bg-yellow-500",busy:"bg-orange-500",error:"bg-red-500",offline:"bg-gray-500"};function RM({status:e,label:t,className:r}){const n=t||e;return u.jsxs("span",{className:sl("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",TM[e],r),children:[u.jsx("span",{className:sl("w-2 h-2 rounded-full animate-[pulse-dot_2s_ease-in-out_infinite]",LM[e])}),n]})}function MM(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function J_(){try{const e=localStorage.getItem("theme");if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function Wu(e){return e==="system"?MM():e}function IM(){const[e,t]=b.useState(J_),[r,n]=b.useState(()=>Wu(J_()));b.useEffect(()=>{document.documentElement.setAttribute("data-theme",r)},[r]),b.useEffect(()=>{const o=window.matchMedia("(prefers-color-scheme: light)"),l=a=>{e==="system"&&n(a.matches?"light":"dark")};return o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[e]);const i=b.useCallback(o=>{t(o),n(Wu(o));try{localStorage.setItem("theme",o)}catch{}},[]),s=b.useCallback(()=>{t(o=>{const l=o==="dark"?"light":o==="light"?"system":"dark";n(Wu(l));try{localStorage.setItem("theme",l)}catch{}return l})},[]);return{theme:r,preference:e,setPreference:i,cycleTheme:s,isDark:r==="dark"}}const Z_={dark:"Dark",light:"Light",system:"System"};function DM({collapsed:e}){const{preference:t,cycleTheme:r}=IM(),n=t==="dark"?u.jsx(tT,{size:16}):t==="light"?u.jsx(eT,{size:16}):u.jsx(rT,{size:16});return u.jsxs("div",{className:`nav-item cursor-pointer ${e?"justify-center py-2.5 px-0":""}`,onClick:r,title:`Theme: ${Z_[t]} (click to cycle)`,children:[u.jsx("span",{className:"nav-icon",children:n}),!e&&u.jsx("span",{className:"text-xs",children:Z_[t]})]})}function is({label:e,description:t,checked:r,disabled:n,onChange:i,extra:s}){return u.jsxs("label",{className:"flex justify-between items-center cursor-pointer",children:[u.jsxs("div",{children:[u.jsx("div",{className:"font-medium text-sm",children:e}),u.jsx("div",{className:"text-[11px] text-text-muted",children:t})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[s,u.jsx("input",{type:"checkbox",checked:r,disabled:n,onChange:o=>i(o.target.checked),className:"w-5 h-5 accent-accent"})]})]})}const sb="adhdev_notification_prefs",ev={globalEnabled:!0,disconnectAlert:!0,browserNotifications:!0,completionAlert:!0,approvalAlert:!0};function jM(){try{const e=localStorage.getItem(sb);if(e){const t=JSON.parse(e);return{...ev,...t}}}catch{}return{...ev}}function AM(e){try{localStorage.setItem(sb,JSON.stringify(e))}catch{}}let kn=jM(),va=[];function BM(){va.forEach(e=>e())}function OM(e){kn={...kn,...e},AM(kn),BM()}function zM(){const[,e]=b.useState(0);b.useEffect(()=>{const r=()=>e(n=>n+1);return va.push(r),()=>{va=va.filter(n=>n!==r)}},[]);const t=b.useCallback(r=>{OM(r)},[]);return[{...kn},t]}function Hu(e){if(!kn.globalEnabled)return!1;switch(e){case"disconnect":return kn.disconnectAlert;case"completion":return kn.completionAlert;case"approval":return kn.approvalAlert;case"browser":return kn.browserNotifications;default:return!0}}function $M({onPrefChange:e}){const[t,r]=zM(),n=(i,s)=>{r({[i]:s}),e==null||e(i,s)};return u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsx(is,{label:"🔔 Notifications",description:"Master toggle for all alerts",checked:t.globalEnabled,onChange:i=>n("globalEnabled",i)}),t.globalEnabled&&u.jsx("div",{className:"border-t border-border-subtle my-0.5"}),t.globalEnabled&&u.jsx(is,{label:"🖥️ Browser Notifications",description:"Desktop alerts when tab is inactive",checked:t.browserNotifications,onChange:i=>n("browserNotifications",i)}),t.globalEnabled&&t.browserNotifications&&u.jsxs("div",{className:"ml-5 pl-3 border-l-2 border-border-subtle flex flex-col gap-2",children:[u.jsx(is,{label:"✅ Completion Alerts",description:"Notify when agent finishes a task",checked:t.completionAlert,onChange:i=>n("completionAlert",i)}),u.jsx(is,{label:"⚡ Approval Alerts",description:"Notify when agent needs approval",checked:t.approvalAlert,onChange:i=>n("approvalAlert",i)}),u.jsx(is,{label:"📡 Connection Alerts",description:"Alert when a daemon disconnects",checked:t.disconnectAlert,onChange:i=>n("disconnectAlert",i)})]}),!t.globalEnabled&&u.jsx("p",{className:"text-[11px] text-text-muted italic",children:"All notifications are disabled. Enable the master toggle to configure individual alerts."})]})}function FM({ides:e,emptyMessage:t,sendDaemonCommand:r,onDisconnect:n,onRevokeToken:i}){const s=e.filter(o=>o.type==="adhdev-daemon");return s.length===0?u.jsx(PM,{icon:"🔌",title:"No machines connected",description:t||"Run 'adhdev daemon' on your machine to connect."}):u.jsx("div",{className:"flex flex-col gap-2",children:s.map(o=>u.jsx(WM,{ide:o,sendDaemonCommand:r,onDisconnect:n,onRevokeToken:i},o.id))})}function tv({title:e,message:t,confirmLabel:r,confirmColor:n,onConfirm:i,onCancel:s}){const o=n==="red"?"bg-red-500/20 text-red-400 border-red-500/30 hover:bg-red-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30 hover:bg-amber-500/30";return b0.createPortal(u.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",style:{zIndex:9999},onClick:s,children:u.jsxs("div",{className:"bg-bg-primary border border-border-subtle rounded-xl p-5 max-w-sm w-full mx-4 shadow-2xl",onClick:l=>l.stopPropagation(),children:[u.jsx("div",{className:"font-semibold text-sm mb-3",children:e}),u.jsx("div",{className:"text-xs text-text-muted leading-relaxed mb-5 whitespace-pre-line",children:t}),u.jsxs("div",{className:"flex gap-2 justify-end",children:[u.jsx("button",{onClick:s,className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-bg-secondary text-text-secondary border border-border-subtle hover:bg-bg-glass transition-colors",children:"Cancel"}),u.jsx("button",{onClick:i,className:`text-xs px-3 py-1.5 rounded-lg font-medium border transition-colors ${o}`,children:r})]})]})}),document.body)}function WM({ide:e,sendDaemonCommand:t,onDisconnect:r,onRevokeToken:n}){var q,E,A,R;const[i,s]=b.useState("idle"),[o,l]=b.useState(""),[a,c]=b.useState(null),[d,h]=b.useState("idle"),[f,p]=b.useState(""),m=e,g=m.version||m.daemonVersion||null,S=((q=m.machine)==null?void 0:q.hostname)||((E=m.system)==null?void 0:E.hostname)||"",_=((A=m.machine)==null?void 0:A.platform)||((R=m.system)==null?void 0:R.platform)||"",x=m.machineNickname||(S==null?void 0:S.replace(/\.local$/,""))||"Machine",w=_==="win32"?"🪟":_==="darwin"?"🍎":"🐧",N=async()=>{var T,$,z;if(t){s("upgrading"),l("Installing latest version...");try{const D=await t(e.id,"daemon_upgrade",{});(T=D==null?void 0:D.result)!=null&&T.upgraded||($=D==null?void 0:D.result)!=null&&$.success?(s("done"),l(`Upgraded to v${D.result.version||"latest"}. Daemon is restarting...`)):(s("error"),l(((z=D==null?void 0:D.result)==null?void 0:z.error)||"Upgrade failed"))}catch(D){s("error"),l((D==null?void 0:D.message)||"Connection lost during upgrade")}}},L=async()=>{if(c(null),!!r){h("loading");try{await r(e.id),h("done"),p("Machine disconnected.")}catch(T){h("error"),p((T==null?void 0:T.message)||"Failed to disconnect")}}},C=async()=>{if(c(null),!!n){h("loading");try{await n(e.id),h("done"),p('Token revoked. Machine must run "adhdev setup" to reconnect.')}catch(T){h("error"),p((T==null?void 0:T.message)||"Failed to revoke token")}}},F="0.5.27",P=!g||g!==F;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"bg-bg-glass rounded-lg px-4 py-3 border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("span",{className:"text-xl",children:w}),u.jsxs("div",{children:[u.jsx("div",{className:"font-medium text-sm",children:x}),u.jsxs("div",{className:"text-xs text-text-muted font-mono flex items-center gap-2",children:[u.jsxs("span",{children:[e.id.substring(0,12),"…"]}),g&&u.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${P?"bg-amber-500/15 text-amber-400":"bg-bg-secondary"}`,children:["v",g,!P&&" ✓"]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[t&&P&&u.jsx("button",{onClick:N,disabled:i==="upgrading"||i==="done",className:`text-xs px-2.5 py-1 rounded-md font-medium transition-all
|
|
178
178
|
disabled:opacity-50 disabled:cursor-not-allowed
|
|
179
179
|
bg-accent-primary/10 text-accent-primary hover:bg-accent-primary/20`,title:`Update to v${F}`,children:i==="upgrading"?u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx("span",{className:"animate-spin",children:"⟳"})," Upgrading..."]}):i==="done"?"✓ Updated":`↑ Update${` to v${F}`}`}),r&&u.jsx("button",{onClick:()=>c("disconnect"),disabled:d==="loading",className:`text-xs px-2 py-1 rounded-md font-medium transition-all
|
|
180
180
|
bg-amber-500/10 text-amber-400 hover:bg-amber-500/20
|
|
@@ -191,8 +191,8 @@ This will:
|
|
|
191
191
|
• Invalidate the connection token
|
|
192
192
|
• Require running "adhdev setup" again on that machine
|
|
193
193
|
|
|
194
|
-
Use this if you accidentally set up on a shared/public computer and want to ensure it can never reconnect.`,confirmLabel:"Revoke Token",confirmColor:"red",onConfirm:C,onCancel:()=>c(null)})]})}const HM={enabled:!0,onApproval:!0,onComplete:!0,onError:!0,throttleMs:5e3};async function UM(){return"Notification"in window?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"}function ob(){return"Notification"in window&&Notification.permission==="granted"}let Si=null;async function VM(){if(Si!==null)return Si;try{if(!("serviceWorker"in navigator)||!("PushManager"in window))return Si=!1,!1;const e=await navigator.serviceWorker.getRegistration();return e?(Si=!!await e.pushManager.getSubscription(),Si):(Si=!1,!1)}catch{return Si=!1,!1}}function KM(e,t,r){if(ob())try{const n=new Notification(e,{body:t,icon:"/otter-logo.png",tag:r||`adhdev-${Date.now()}`,silent:!1});setTimeout(()=>n.close(),8e3),n.onclick=()=>{window.focus(),n.close()}}catch{}}function qM(e,t={}){const r={...HM,...t},n=b.useRef(new Map),i=b.useRef(0),s=b.useRef(null);b.useEffect(()=>{VM().then(l=>{s.current=l})},[]);const o=b.useCallback((l,a,c)=>{const d=Date.now();d-i.current<r.throttleMs||(i.current=d,KM(l,a,c))},[r.throttleMs]);b.useEffect(()=>{var l;if(!(!r.enabled||!ob())&&Hu("browser")&&s.current!==!0){if(document.hasFocus()){for(const a of e)n.current.set(a.id,a.status||"idle");return}for(const a of e){const c=n.current.get(a.id),d=a.status||"idle",h=a.name||a.id;if(r.onApproval&&Hu("approval")&&d==="waiting_approval"&&c!=="waiting_approval"){const f=((l=a.activeModal)==null?void 0:l.message)||"Action requires your approval";o(`🔔 ${h} — Approval needed`,f.slice(0,120),`approval-${a.id}`)}r.onComplete&&Hu("completion")&&c==="generating"&&d==="idle"&&o(`✅ ${h} — Task complete`,"Agent has finished working",`complete-${a.id}`),r.onError&&d==="error"&&c!=="error"&&o(`⚠️ ${h} — Error`,"Agent encountered an error",`error-${a.id}`),n.current.set(a.id,d)}}},[e,r.enabled,r.onApproval,r.onComplete,r.onError,o])}let YM=Zo;function fp(){return YM()}class XM{constructor(){Hs(this,"listeners",new Map)}send(t){}isConnected(){return!1}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>{var n;(n=this.listeners.get(t))==null||n.delete(r)}}emit(t,...r){var n;(n=this.listeners.get(t))==null||n.forEach(i=>i(...r))}}let GM=new XM;class QM{constructor(){Hs(this,"ptyCallbacks",new Set)}sendPtyInput(t,r,n){return!1}sendPtyResize(t,r,n,i){return!1}async requestChatHistory(t,r,n,i,s){return{messages:[],hasMore:!1}}retryConnection(t){}getState(t){return"disconnected"}sendData(t,r){return!1}get(t){}onScreenshot(t,r){return()=>{}}onStatusEvent(t){return()=>{}}onPtyOutput(t){return this.ptyCallbacks.add(t),()=>{this.ptyCallbacks.delete(t)}}emitPtyOutput(t,r){this.ptyCallbacks.forEach(n=>n(t,r))}}let dr=new QM,lb=dr;function ab({sendDaemonCommand:e,activeConv:t,ides:r,updateIdeChats:n,setToasts:i,setLocalUserMessages:s,setClearedTabs:o,setActionLogs:l,pinTab:a,isStandalone:c}){const[d,h]=b.useState(""),[f,p]=b.useState(!1),[m,g]=b.useState(!1),[S,_]=b.useState(!1),x=b.useCallback(async()=>{if(!t)return;const E=d.trim();if(!E)return;const A=t.ideId,R=t.tabKey;h(""),a(R,[100,500,1500,3e3]);const P=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,$={role:"user",content:E,timestamp:Date.now(),_localId:P};s(z=>({...z,[R]:[...z[R]||[],$]}));try{if(In(t)&&!tn(t)){const z=A||t.daemonId||"";if(!z)return;const D=t.ideType||t.agentType||"";await e(z,"agent_command",{agentType:D,cliType:D,action:"send_chat",message:E,text:E})}else if(tn(t)){const z=A||t.daemonId||"";if(!z)return;await e(z,"send_chat",{message:E,text:E,agentType:t.agentType})}else{const z=A||t.daemonId||"";if(!z)return;await e(z,"send_chat",{message:E,text:E,...t.streamSource==="agent-stream"&&{agentType:t.agentType}})}setTimeout(()=>{const z=Date.now()-6e4;s(D=>{const H=D[R];if(!H)return D;const I=H.filter(W=>W.timestamp>z);return I.length===H.length?D:{...D,[R]:I}})},6e4)}catch(z){console.error("Send failed",z),h(E),s(D=>({...D,[R]:(D[R]||[]).filter(H=>H._localId!==P)}))}},[t,d,e,s,a]),w=b.useCallback(async()=>{if(t)try{c?await e(t.ideId,"launch_ide",{ideType:t.ideType,enableCdp:!0}):await e(t.ideId,"vscode_command_exec",{commandId:"adhdev.relaunchWithCdp",args:[{force:!0}]})}catch(E){console.error("Relaunch failed",E)}},[t,c,e]),N=b.useCallback(async E=>{try{await e("standalone","launch_ide",{ideType:E,enableCdp:!0})}catch(A){console.error("Launch failed",A)}},[e]),L=b.useCallback(async E=>{if(t){console.log("[ModalButton] ideId:",t.ideId,"button:",E),l(A=>[...A,{ideId:t.tabKey,text:`🖱️ **${E}** clicked`,timestamp:Date.now()}]);try{let A;if(In(t)&&!tn(t)){const P=(t.modalButtons||[]).indexOf(E),$=E.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase();let z;P>=0?z=`${P+1}\r`:/^(deny|no|reject|cancel)/.test($)?z="3\r":/always/.test($)?z="2\r":z="1\r";const D=t.daemonId||t.ideId,H=t.ideType||t.agentType||"";lb.sendPtyInput(D,H,z)||await e(D,"pty_input",{cliType:H,data:z}),A={success:!0}}else{const R=E.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),P=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(R),$=t.ideId||t.daemonId||"";A=await e($,"resolve_action",{button:E,action:P?"approve":"reject",...t.streamSource==="agent-stream"&&{agentType:t.agentType}})}A.success||l(R=>[...R,{ideId:t.tabKey,text:`⚠️ **${E}** failed — button not found`,timestamp:Date.now()}])}catch(A){console.error("[ModalButton] Error:",A),l(R=>[...R,{ideId:t.tabKey,text:`❌ **${E}** error`,timestamp:Date.now()}])}}},[t,e,l]),C=b.useCallback(async(E,A)=>{try{const R=E||(t==null?void 0:t.daemonId)||"",P=await e(R,"switch_chat",{id:A,sessionId:A,...(t==null?void 0:t.streamSource)==="agent-stream"&&{agentType:t==null?void 0:t.agentType}}),$=P==null?void 0:P.result;(P==null?void 0:P.success)===!0||$==="switched"||$==="switched-by-title"||($===!1||$==="not_found"?i(D=>[...D,{id:Date.now(),message:"⚠️ Session tab not found — try refreshing history",type:"warning",timestamp:Date.now()}]):typeof $=="string"&&$.startsWith("error:")?i(D=>[...D,{id:Date.now(),message:`⚠️ Switch error: ${$}`,type:"warning",timestamp:Date.now()}]):i(D=>[...D,{id:Date.now(),message:"⚠️ Session switch failed",type:"warning",timestamp:Date.now()}]))}catch(R){console.error("Switch failed",R),i(P=>[...P,{id:Date.now(),message:`❌ Switch failed: ${R.message||"connection error"}`,type:"warning",timestamp:Date.now()}])}},[t,e,i]),F=b.useCallback(async()=>{if(!(!t||f)){p(!0);try{const E=t.ideId||t.daemonId||"";await e(E,"new_chat",{...t.streamSource==="agent-stream"&&{agentType:t.agentType}}),o(A=>({...A,[t.tabKey]:Date.now()})),s(A=>({...A,[t.tabKey]:[]}))}catch(E){console.error("New chat failed",E)}finally{p(!1)}}},[t,f,e,o,s]),T=b.useCallback(async()=>{if(!t||S)return;_(!0);const E=t.tabKey;try{await e(t.ideId,"agent_stream_focus",{agentType:t.agentType}),a(E,[200,1500,3e3])}catch(A){console.error("Focus agent failed",A)}finally{_(!1)}},[t,S,e,a]),q=b.useCallback(async()=>{var E;if(!(!t||m)){g(!0);try{const A=t.ideId||t.daemonId||"",R=await e(A,"list_chats",{forceExpand:!0,...t.streamSource==="agent-stream"&&{agentType:t.agentType}}),P=(R==null?void 0:R.chats)||((E=R==null?void 0:R.result)==null?void 0:E.chats);R!=null&&R.success&&Array.isArray(P)&&n(t.ideId,P)}catch(A){console.error("Refresh history failed",A)}finally{g(!1)}}},[t,m,e,n]);return{agentInput:d,setAgentInput:h,isCreatingChat:f,isRefreshingHistory:m,isFocusingAgent:S,handleSendChat:x,handleRelaunch:w,handleLaunchIde:N,handleModalButton:L,handleSwitchSession:C,handleNewChat:F,handleFocusAgent:T,handleRefreshHistory:q}}let Uu=null;function JM({conversations:e,ides:t,messageReceivedAt:r,actionLogs:n,ptyBuffers:i,screenshotMap:s,setScreenshotMap:o,sendDaemonCommand:l,updateIdeChats:a,setToasts:c,setLocalUserMessages:d,setClearedTabs:h,setActionLogs:f,pinTab:p,isStandalone:m,userName:g,groupIndex:S,isFocused:_,onFocus:x,isSplitMode:w,numGroups:N,onMoveTab:L,onClose:C,onReceiveTab:F,style:T,detectedIdes:q,handleLaunchIde:E,onActiveTabChange:A,initialActiveTabId:R,initialTabOrder:P,onTabOrderChange:$}){const{sendCommand:z}=gi(),D=b.useRef(null),[H,I]=b.useState(!1),W=b.useRef(0),[y,Q]=b.useState(R??null);b.useEffect(()=>{R&&R!==y&&Q(R)},[R]);const[ae,k]=b.useState(P??[]),[we,U]=b.useState(null),Y=b.useRef(null);b.useEffect(()=>{const J=new Set(e.map(oe=>oe.tabKey));k(oe=>{const Fe=oe.filter(ze=>J.has(ze)),We=e.filter(ze=>!oe.includes(ze.tabKey)).map(ze=>ze.tabKey),Ne=[...Fe,...We];return Ne.length===oe.length&&Ne.every((ze,Pe)=>ze===oe[Pe])?oe:Ne})},[e]);const te=we??ae,fe=b.useMemo(()=>{if(te.length===0)return e;const J=new Map(te.map((oe,Fe)=>[oe,Fe]));return[...e].sort((oe,Fe)=>{const We=J.get(oe.tabKey)??999,Ne=J.get(Fe.tabKey)??999;return We-Ne})},[e,te]);b.useEffect(()=>{if(fe.length===0){Q(null),A==null||A(null);return}y&&fe.some(J=>J.tabKey===y)||(Q(fe[0].tabKey),A==null||A(fe[0].tabKey))},[fe,y]);const de=fe.find(J=>J.tabKey===y),Oe=b.useCallback((J,oe,Fe)=>{k(We=>{const Ne=We.filter(qe=>qe!==J),ze=Ne.indexOf(oe);if(ze<0)return We;const Pe=Fe==="left"?ze:ze+1;return Ne.splice(Pe,0,J),$==null||$(Ne),Ne}),U(null)},[$]),Ve=b.useCallback((J,oe,Fe)=>{const Ne=(ae.length>0?ae:e.map(qe=>qe.tabKey)).filter(qe=>qe!==J),ze=Ne.indexOf(oe);if(ze<0)return;const Pe=Fe==="left"?ze:ze+1;Ne.splice(Pe,0,J),U(Ne)},[ae,e]),Ie=ab({sendDaemonCommand:l,activeConv:de,ides:t,updateIdeChats:a,setToasts:c,setLocalUserMessages:d,setClearedTabs:h,setActionLogs:f,pinTab:p,isStandalone:m}),[G,me]=b.useState(null);b.useEffect(()=>{if(!G)return;const J=()=>me(null);return window.addEventListener("click",J),()=>window.removeEventListener("click",J)},[G]);const Re=de&&In(de)&&!tn(de);return b.useEffect(()=>{const J=()=>{W.current=0,I(!1),U(null)};return window.addEventListener("dragend",J),()=>window.removeEventListener("dragend",J)},[]),u.jsxs("div",{className:"flex flex-col min-h-0 min-w-0 flex-1 overflow-hidden",onClick:x,onDragEnter:J=>{if(J.dataTransfer.types.includes("text/tab-key")){W.current++;const oe=Uu;oe&&e.some(We=>We.tabKey===oe)||I(!0)}},onDragOver:J=>{J.dataTransfer.types.includes("text/tab-key")&&J.preventDefault()},onDragLeave:()=>{W.current--,W.current<=0&&(W.current=0,I(!1))},onDrop:J=>{W.current=0,I(!1),U(null);const oe=J.dataTransfer.getData("text/tab-key");if(!oe)return;J.preventDefault(),e.some(We=>We.tabKey===oe)?k(We=>{const Ne=We.filter(ze=>ze!==oe);return Ne.push(oe),$==null||$(Ne),Ne}):F&&F(oe)},style:{...T,outline:H?"2px dashed var(--accent-primary)":"none",outlineOffset:"-2px",transition:"outline 0.15s ease"},children:[u.jsx("div",{className:"flex items-center bg-bg-secondary border-b border-border-subtle shrink-0 gap-0",children:u.jsxs("div",{className:"flex-1 flex overflow-x-auto overflow-y-visible pt-1.5 pb-0 gap-1 select-none",style:{paddingLeft:8,paddingRight:4,scrollbarWidth:"none"},onWheel:J=>{const oe=J.currentTarget;Math.abs(J.deltaY)>Math.abs(J.deltaX)&&(J.preventDefault(),oe.scrollLeft+=J.deltaY)},children:[fe.map((J,oe)=>{const Fe=y===J.tabKey,We=J.status==="working"?"agent-tab-working":J.status==="waiting_approval"?"agent-tab-waiting":"",Ne=J.connectionState==="failed"||J.connectionState==="closed",ze=Y.current===J.tabKey;return u.jsxs("div",{"data-tabkey":J.tabKey,className:`${We} shrink-0 px-2.5 py-1.5 rounded-t-lg cursor-pointer flex items-center gap-2 relative`,draggable:!("ontouchstart"in window),onDragStart:Pe=>{Uu=J.tabKey,Y.current=J.tabKey,Pe.dataTransfer.setData("text/tab-key",J.tabKey),Pe.dataTransfer.effectAllowed="move"},onDragEnd:()=>{Uu=null,Y.current=null,U(null),W.current=0,I(!1)},onDragOver:Pe=>{const qe=Y.current;if(!(!qe||qe===J.tabKey)&&Pe.dataTransfer.types.includes("text/tab-key")){Pe.preventDefault(),Pe.stopPropagation();const Mt=Pe.currentTarget.getBoundingClientRect(),Mr=Mt.left+Mt.width/2,K=Pe.clientX<Mr?"left":"right";Ve(qe,J.tabKey,K)}},onDrop:Pe=>{Pe.preventDefault(),Pe.stopPropagation();const qe=Pe.dataTransfer.getData("text/tab-key");if(qe&&qe!==J.tabKey){const Mt=Pe.currentTarget.getBoundingClientRect(),Mr=Mt.left+Mt.width/2,K=Pe.clientX<Mr?"left":"right";fe.some(ne=>ne.tabKey===qe)?Oe(qe,J.tabKey,K):F&&F(qe)}U(null)},onClick:Pe=>{Pe.stopPropagation(),x(),Q(J.tabKey),A==null||A(J.tabKey),J.streamSource==="agent-stream"&&J.agentType&&z(J.ideId,"agent_stream_focus",{agentType:J.agentType}).catch(()=>{}),In(J)&&setTimeout(()=>{var qe,Mt;return(Mt=(qe=D.current)==null?void 0:qe.bumpResize)==null?void 0:Mt.call(qe)},100)},onContextMenu:Pe=>{L&&!("ontouchstart"in window)&&(Pe.preventDefault(),me({x:Pe.clientX,y:Pe.clientY,tabKey:J.tabKey}))},style:{background:Fe?"var(--bg-primary)":"var(--bg-glass)",borderTop:Fe?"1px solid var(--border-subtle)":"1px solid transparent",borderLeft:Fe?"1px solid var(--border-subtle)":"1px solid transparent",borderRight:Fe?"1px solid var(--border-subtle)":"1px solid transparent",opacity:ze?.4:Ne?Fe?.6:.3:Fe?1:.65,transition:"transform 0.2s ease, opacity 0.15s ease"},children:[J.status==="working"?u.jsx("div",{className:"tab-spinner"}):J.status==="waiting_approval"?u.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400",children:"▲"}):Ne?u.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400 animate-pulse",children:"○"}):J.connectionState==="connecting"?u.jsx("span",{className:"text-[8px] px-[5px] py-px text-blue-400",children:"○"}):J.connectionState==="connected"?u.jsx("span",{className:"text-[8px] px-[5px] py-px text-green-400",children:"●"}):u.jsx("span",{className:"text-[8px] px-[5px] py-px text-text-muted",children:"●"}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-xs font-bold whitespace-nowrap overflow-hidden text-ellipsis",children:J.displayPrimary}),u.jsx("div",{className:"text-[8px] opacity-50 flex gap-1 items-center",children:Ne?u.jsx("span",{className:"text-yellow-400 opacity-100",children:"Reconnecting…"}):u.jsxs(u.Fragment,{children:[J.displaySecondary,J.machineName&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"opacity-40",children:"·"}),u.jsxs("span",{className:"opacity-70",children:["🖥 ",J.machineName]})]})]})})]}),oe<9&&u.jsx("span",{className:"text-[9px] opacity-35 font-mono ml-0.5 shrink-0",children:oe+1})]},J.tabKey)}),e.length===0&&u.jsx("div",{className:"p-2 text-xs opacity-40",children:"No tabs in this group"})]})}),u.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden relative",children:de?u.jsxs(u.Fragment,{children:[u.jsx(F1,{activeConv:de,onModalButton:Ie.handleModalButton}),u.jsx("div",{className:"desktop-only px-3 pt-1 pb-2",children:!Re&&!tn(de)&&s[de.ideId]?u.jsx(kR,{screenshotUrl:s[de.ideId],mode:"preview",onDismiss:()=>{const J={...s};delete J[de.ideId],o(J)}}):!Re&&!tn(de)&&de.cdpConnected===!1?u.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 py-2 bg-yellow-500/[0.08] border border-yellow-500/20 rounded-lg text-xs text-text-secondary",children:[u.jsx("span",{className:"text-sm",children:u.jsx(qy,{size:14})}),u.jsx("span",{className:"flex-1",children:"CDP not connected — chat history & screenshots unavailable."}),u.jsx("button",{className:"btn btn-sm bg-yellow-500/15 text-yellow-500 border border-yellow-500/30 text-[10px] whitespace-nowrap shrink-0",onClick:Ie.handleRelaunch,children:"Relaunch with CDP"})]}):null}),Re?u.jsx(ER,{activeConv:de,ptyBuffers:i,terminalRef:D,agentInput:Ie.agentInput,setAgentInput:Ie.setAgentInput,handleSendChat:Ie.handleSendChat,handleModalButton:Ie.handleModalButton}):u.jsx(W1,{activeConv:de,ides:t,agentInput:Ie.agentInput,setAgentInput:Ie.setAgentInput,handleSendChat:Ie.handleSendChat,handleFocusAgent:Ie.handleFocusAgent,isFocusingAgent:Ie.isFocusingAgent,messageReceivedAt:r,actionLogs:n,userName:g})]}):u.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",children:e.length===0&&!w&&q&&E?u.jsxs("div",{className:"empty-dashboard",children:[u.jsx("div",{className:"glow-orb",children:u.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-12 h-12"})}),u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"font-bold text-lg mb-1.5",children:"No IDE connected"}),u.jsx("div",{className:"text-[13px] text-text-muted",style:{marginBottom:q.length>0?16:0},children:m?"Launch an IDE with CDP to start monitoring":"Launch your IDE with the ADHDev extension to start"}),m&&q.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:q.map(J=>u.jsx("button",{className:"btn btn-sm bg-violet-500/10 border border-violet-500/25 text-violet-400 text-xs font-semibold px-4 py-2 rounded-lg cursor-pointer flex items-center gap-1.5 transition-all",onClick:()=>E(J.type),onMouseEnter:oe=>oe.currentTarget.style.background="rgba(139,92,246,0.2)",onMouseLeave:oe=>oe.currentTarget.style.background="rgba(139,92,246,0.1)",children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(G3,{size:14})," Launch ",J.name]})},J.type))})]})]}):u.jsx("div",{className:"text-sm text-text-muted opacity-50",children:w?"Move a tab here to view":"No active agent"})})}),G&&L&&u.jsxs("div",{className:"fixed z-50 bg-bg-primary border border-border-subtle rounded-lg shadow-lg py-1 min-w-[160px]",style:{left:G.x,top:G.y},onClick:()=>me(null),children:[S>0&&u.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs hover:bg-bg-secondary transition-colors",onClick:()=>{L(G.tabKey,"left"),me(null)},children:"← Move to Left Group"}),S<N-1&&u.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs hover:bg-bg-secondary transition-colors",onClick:()=>{L(G.tabKey,"right"),me(null)},children:"Move to Right Group →"}),N<4&&u.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs hover:bg-bg-secondary transition-colors",onClick:()=>{L(G.tabKey,"new"),me(null)},children:"Split to New Group ◨"}),S===0&&N===1&&u.jsx("div",{className:"px-3 py-1.5 text-[11px] text-text-muted opacity-50 italic",children:"No other groups available"})]})]})}function ZM(){const{sendCommand:e}=gi(),[t,r]=A0(),n=t.get("activeTab"),i=fp(),{updateIdeChats:s,screenshotMap:o,setScreenshotMap:l}=i,a=i.ides||[],c=i.toasts||[],d=i.setToasts||(()=>{}),h=i.wsStatus||"connected",f=i.isConnected??!0,p=i.connectionStates||{};i.retryConnection;const m=i.showReconnected||!1,[g,S]=b.useState(()=>{try{const M=sessionStorage.getItem("adhdev_splitGroups");if(M){const j=JSON.parse(M);return new Map(j)}}catch{}return new Map}),[_,x]=b.useState(()=>{try{const M=sessionStorage.getItem("adhdev_focusedGroup");if(M)return parseInt(M,10)||0}catch{}return 0}),[w,N]=b.useState(()=>{try{const M=sessionStorage.getItem("adhdev_groupActiveTabs");if(M)return JSON.parse(M)}catch{}return{}}),L=b.useRef(!1),[C,F]=b.useState(()=>{try{const M=sessionStorage.getItem("adhdev_groupTabOrders");if(M)return JSON.parse(M)}catch{}return{}}),[T,q]=b.useState(()=>{try{const M=sessionStorage.getItem("adhdev_splitSizes");if(M)return JSON.parse(M)}catch{}return[]});b.useEffect(()=>{try{g.size===0?sessionStorage.removeItem("adhdev_splitGroups"):sessionStorage.setItem("adhdev_splitGroups",JSON.stringify([...g.entries()]))}catch{}},[g]),b.useEffect(()=>{try{T.length>0?sessionStorage.setItem("adhdev_splitSizes",JSON.stringify(T)):sessionStorage.removeItem("adhdev_splitSizes")}catch{}},[T]),b.useEffect(()=>{try{sessionStorage.setItem("adhdev_focusedGroup",String(_))}catch{}},[_]),b.useEffect(()=>{try{sessionStorage.setItem("adhdev_groupActiveTabs",JSON.stringify(w))}catch{}},[w]),b.useEffect(()=>{try{sessionStorage.setItem("adhdev_groupTabOrders",JSON.stringify(C))}catch{}},[C]);const[E,A]=b.useState(()=>typeof window<"u"&&window.innerWidth<768);b.useEffect(()=>{const M=window.matchMedia("(max-width: 767px)"),j=V=>A(V.matches);return M.addEventListener("change",j),()=>M.removeEventListener("change",j)},[]);const R=b.useMemo(()=>E||g.size===0?1:Math.max(1,...g.values())+1,[g,E]),P=R>1,$=b.useCallback((M,j)=>{S(V=>{const X=new Map(V);return j===0?X.delete(M):X.set(M,j),X}),x(j)},[]),z=b.useCallback(M=>{S(j=>{const X=(j.size===0?0:Math.max(0,...j.values()))+1;if(X>=4)return j;const he=new Map(j);return he.set(M,X),he}),x(j=>j+1)},[]),D=b.useCallback(M=>{S(j=>{const V=new Map;for(const[X,he]of j)he!==M&&(he>M?V.set(X,he-1):V.set(X,he));return V}),q(j=>{if(j.length<=1)return[];const V=[...j];V.splice(M,1);const X=V.reduce((he,ce)=>he+ce,0);return V.map(he=>he/X*100)}),x(0)},[]),H=b.useRef(null),I=b.useCallback((M,j)=>{j.preventDefault();const V=H.current;if(!V)return;const X=j.clientX,he=V.offsetWidth,ce=T.length===R?[...T]:Array(R).fill(100/R),ve=le=>{const _e=(le.clientX-X)/he*100,Ye=[...ce];Ye[M]=Math.max(15,ce[M]+_e),Ye[M+1]=Math.max(15,ce[M+1]-_e),q(Ye)},pe=()=>{document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",pe),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",ve),document.addEventListener("mouseup",pe)},[T,R]),[W,y]=b.useState({}),[Q,ae]=b.useState(!1),[k,we]=b.useState([]),[U,Y]=b.useState({}),[te,fe]=b.useState({}),[de,Oe]=b.useState(!1),[Ve,Ie]=b.useState(!1);b.useEffect(()=>{const M=V=>{var X;(X=V.dataTransfer)!=null&&X.types.includes("text/tab-key")&&Ie(!0)},j=()=>{Ie(!1),Oe(!1)};return window.addEventListener("dragstart",M),window.addEventListener("dragend",j),window.addEventListener("drop",j),()=>{window.removeEventListener("dragstart",M),window.removeEventListener("dragend",j),window.removeEventListener("drop",j)}},[]);const G=a.find(M=>M.type==="adhdev-daemon"),me=(G==null?void 0:G.detectedIdes)||[],Re=!!G,J=b.useMemo(()=>{const M=a.filter(V=>V.type!=="adhdev-daemon"),j=new Map;for(const V of M){const X=j.get(V.id);if(!X)j.set(V.id,V);else{const he=(X.workspace?1:0)+(X.activeChat?1:0);((V.workspace?1:0)+(V.activeChat?1:0)>he||(V.timestamp||0)>(X.timestamp||0))&&j.set(V.id,V)}}return Array.from(j.values())},[a]),oe=b.useMemo(()=>{const M=jR(J,U,a,p),j=Date.now();return M.map(V=>{const X=te[V.tabKey];return X&&j-X<5e3?{...V,messages:[],title:""}:V})},[J,U,te,a]);b.useEffect(()=>{UM()},[]);const Fe=b.useMemo(()=>oe.map(M=>({id:M.tabKey,name:M.title||M.agentName||M.ideId,status:M.status,activeModal:M.modalMessage?{message:M.modalMessage,buttons:M.modalButtons}:null})),[oe]);qM(Fe);const We=b.useMemo(()=>{const M=Array.from({length:R},()=>[]);for(const j of oe){const V=g.get(j.tabKey)??0,X=Math.min(V,R-1);M[X].push(j)}return M},[oe,g,R]);b.useEffect(()=>{const M=new Set(oe.map(j=>j.tabKey));S(j=>{let V=!1;const X=new Map;for(const[he,ce]of j)M.has(he)?X.set(he,ce):V=!0;return V?X:j})},[oe]),b.useEffect(()=>{if(P)for(let M=R-1;M>=1;M--)[...g.values()].some(V=>V===M)||D(M)},[g,R,P,D]),b.useEffect(()=>{if(!n||L.current||oe.length===0)return;const M=oe.find(j=>j.tabKey===n)||oe.find(j=>j.ideId===n)||oe.find(j=>j.ideType===n||j.agentType===n);if(M){const j=g.get(M.tabKey)??0;N(V=>({...V,[j]:M.tabKey})),x(j),L.current=!0,r(V=>{const X=new URLSearchParams(V);return X.delete("activeTab"),X},{replace:!0})}},[n,oe,g]),b.useEffect(()=>{if(Object.keys(te).length===0)return;const j=setTimeout(()=>{fe(V=>{const X=Date.now(),he={};for(const[ce,ve]of Object.entries(V))X-ve<5e3&&(he[ce]=ve);return Object.keys(he).length===Object.keys(V).length?V:he})},5500);return()=>clearTimeout(j)},[te]);const Ne=b.useMemo(()=>{var j,V;const M=w[_];if(M){const X=oe.find(he=>he.tabKey===M);if(X)return X}return((j=We[_])==null?void 0:j[0])||((V=We[0])==null?void 0:V[0])},[w,_,oe,We]),ze=b.useCallback((M,j)=>{},[]);b.useEffect(()=>{var X;const M=Date.now();let j=!1;const V={...W};for(const he of oe)(X=he.messages)!=null&&X.length&&he.messages.forEach((ce,ve)=>{const pe=`${he.ideId}-${ce.id??`i-${ve}`}`;V[pe]==null&&(V[pe]=M,j=!0)});j&&y(V)},[oe]);const Pe=b.useRef(!1);b.useEffect(()=>{if(!Q){Pe.current=!1;return}if(!Ne||Pe.current||Mr)return;const M=a.find(j=>j.id===Ne.ideId);M&&(!M.chats||M.chats.length===0)&&(Pe.current=!0,Me())},[Q,Ne==null?void 0:Ne.ideId]),b.useEffect(()=>{const M=setInterval(()=>{const j=Date.now()-3e5;we(V=>{const X=V.filter(he=>he.timestamp>j).slice(-100);return X.length===V.length?V:X})},6e4);return()=>clearInterval(M)},[]);const qe=b.useRef(new Map);b.useEffect(()=>{const M=(V,X)=>{var he;if(X){H1.emit(V,X);for(const ce of oe){if(!In(ce))continue;const ve=(he=ce.ideId)!=null&&he.includes(":cli:")?ce.ideId.split(":cli:")[1]:"";if(V===ve||V===ce.agentType||V===ce.ideType){const le=qe.current.get(ce.tabKey)||[];le.push(X),le.length>1e4&&le.splice(0,le.length-5e3),qe.current.set(ce.tabKey,le)}}}},j=lb.onPtyOutput(M);return()=>{j()}},[oe]),b.useEffect(()=>{const M=j=>{if(j.ctrlKey&&j.key==="\\"){if(j.preventDefault(),P)S(new Map),x(0);else{const V=oe[1];V&&z(V.tabKey)}return}j.ctrlKey&&(j.key==="["||j.key==="]")&&P&&(j.preventDefault(),x(V=>j.key==="]"?Math.min(V+1,R-1):Math.max(V-1,0)))};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[P,oe,z,R]),b.useEffect(()=>{const M=GM.on("status_event",j=>{var ce;const V=Ar(j.ideType||"");let X="",he="info";if(j.event==="agent:generating_completed"){const ve=j.duration?` (${j.duration}s)`:"";X=`✅ ${V} agent task completed${ve}`,he="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}if(j.ideId){const pe={role:"system",timestamp:Date.now(),content:`✅ Task completed${ve}`,_localId:`sys_complete_${Date.now()}`};Y(le=>{for(const Te of Object.keys(le))if(Te.includes(j.ideId))return{...le,[Te]:[...le[Te]||[],pe]};return le})}}else if(j.event==="agent:generating_started")j.ideId&&Y(ve=>{const pe={...ve};for(const le of Object.keys(pe))le.includes(j.ideId)&&(pe[le]=(pe[le]||[]).filter(Te=>{var _e;return!(Te.role==="system"&&((_e=Te._localId)!=null&&_e.startsWith("sys_complete_")))}));return pe});else if((j.event==="agent:waiting_approval"||j.event==="agent:approval_needed")&&(X=`⚡ ${V} approval needed`,he="warning",j.ideId)){const ve=j.modalMessage||"Approval requested",pe=(ce=j.modalButtons)!=null&&ce.length?j.modalButtons.map(Te=>`[${Te}]`).join(" "):"[Approve] [Reject]",le={role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${ve}
|
|
195
|
-
${pe}`,_localId:`sys_approval_${Date.now()}`};Y(
|
|
194
|
+
Use this if you accidentally set up on a shared/public computer and want to ensure it can never reconnect.`,confirmLabel:"Revoke Token",confirmColor:"red",onConfirm:C,onCancel:()=>c(null)})]})}const HM={enabled:!0,onApproval:!0,onComplete:!0,onError:!0,throttleMs:5e3};async function UM(){return"Notification"in window?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"}function ob(){return"Notification"in window&&Notification.permission==="granted"}let Si=null;async function VM(){if(Si!==null)return Si;try{if(!("serviceWorker"in navigator)||!("PushManager"in window))return Si=!1,!1;const e=await navigator.serviceWorker.getRegistration();return e?(Si=!!await e.pushManager.getSubscription(),Si):(Si=!1,!1)}catch{return Si=!1,!1}}function KM(e,t,r){if(ob())try{const n=new Notification(e,{body:t,icon:"/otter-logo.png",tag:r||`adhdev-${Date.now()}`,silent:!1});setTimeout(()=>n.close(),8e3),n.onclick=()=>{window.focus(),n.close()}}catch{}}function qM(e,t={}){const r={...HM,...t},n=b.useRef(new Map),i=b.useRef(0),s=b.useRef(null);b.useEffect(()=>{VM().then(l=>{s.current=l})},[]);const o=b.useCallback((l,a,c)=>{const d=Date.now();d-i.current<r.throttleMs||(i.current=d,KM(l,a,c))},[r.throttleMs]);b.useEffect(()=>{var l;if(!(!r.enabled||!ob())&&Hu("browser")&&s.current!==!0){if(document.hasFocus()){for(const a of e)n.current.set(a.id,a.status||"idle");return}for(const a of e){const c=n.current.get(a.id),d=a.status||"idle",h=a.name||a.id;if(r.onApproval&&Hu("approval")&&d==="waiting_approval"&&c!=="waiting_approval"){const f=((l=a.activeModal)==null?void 0:l.message)||"Action requires your approval";o(`🔔 ${h} — Approval needed`,f.slice(0,120),`approval-${a.id}`)}r.onComplete&&Hu("completion")&&c==="generating"&&d==="idle"&&o(`✅ ${h} — Task complete`,"Agent has finished working",`complete-${a.id}`),r.onError&&d==="error"&&c!=="error"&&o(`⚠️ ${h} — Error`,"Agent encountered an error",`error-${a.id}`),n.current.set(a.id,d)}}},[e,r.enabled,r.onApproval,r.onComplete,r.onError,o])}let YM=Zo;function fp(){return YM()}class XM{constructor(){Hs(this,"listeners",new Map)}send(t){}isConnected(){return!1}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>{var n;(n=this.listeners.get(t))==null||n.delete(r)}}emit(t,...r){var n;(n=this.listeners.get(t))==null||n.forEach(i=>i(...r))}}let GM=new XM;class QM{constructor(){Hs(this,"ptyCallbacks",new Set)}sendPtyInput(t,r,n){return!1}sendPtyResize(t,r,n,i){return!1}async requestChatHistory(t,r,n,i,s){return{messages:[],hasMore:!1}}retryConnection(t){}getState(t){return"disconnected"}sendData(t,r){return!1}get(t){}onScreenshot(t,r){return()=>{}}onStatusEvent(t){return()=>{}}onPtyOutput(t){return this.ptyCallbacks.add(t),()=>{this.ptyCallbacks.delete(t)}}emitPtyOutput(t,r){this.ptyCallbacks.forEach(n=>n(t,r))}}let dr=new QM,lb=dr;function ab({sendDaemonCommand:e,activeConv:t,ides:r,updateIdeChats:n,setToasts:i,setLocalUserMessages:s,setClearedTabs:o,setActionLogs:l,pinTab:a,isStandalone:c}){const[d,h]=b.useState(""),[f,p]=b.useState(!1),[m,g]=b.useState(!1),[S,_]=b.useState(!1),x=b.useCallback(async()=>{if(!t)return;const E=d.trim();if(!E)return;const A=t.ideId,R=t.tabKey;h(""),a(R,[100,500,1500,3e3]);const T=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,$={role:"user",content:E,timestamp:Date.now(),_localId:T};s(z=>({...z,[R]:[...z[R]||[],$]}));try{if(In(t)&&!tn(t)){const z=A||t.daemonId||"";if(!z)return;const D=t.ideType||t.agentType||"";await e(z,"agent_command",{agentType:D,cliType:D,action:"send_chat",message:E,text:E})}else if(tn(t)){const z=A||t.daemonId||"";if(!z)return;await e(z,"send_chat",{message:E,text:E,agentType:t.agentType})}else{const z=A||t.daemonId||"";if(!z)return;await e(z,"send_chat",{message:E,text:E,...t.streamSource==="agent-stream"&&{agentType:t.agentType}})}setTimeout(()=>{const z=Date.now()-6e4;s(D=>{const H=D[R];if(!H)return D;const I=H.filter(W=>W.timestamp>z);return I.length===H.length?D:{...D,[R]:I}})},6e4)}catch(z){console.error("Send failed",z),h(E),s(D=>({...D,[R]:(D[R]||[]).filter(H=>H._localId!==T)}))}},[t,d,e,s,a]),w=b.useCallback(async()=>{if(t)try{c?await e(t.ideId,"launch_ide",{ideType:t.ideType,enableCdp:!0}):await e(t.ideId,"vscode_command_exec",{commandId:"adhdev.relaunchWithCdp",args:[{force:!0}]})}catch(E){console.error("Relaunch failed",E)}},[t,c,e]),N=b.useCallback(async E=>{try{await e("standalone","launch_ide",{ideType:E,enableCdp:!0})}catch(A){console.error("Launch failed",A)}},[e]),L=b.useCallback(async E=>{if(t){console.log("[ModalButton] ideId:",t.ideId,"button:",E),l(A=>[...A,{ideId:t.tabKey,text:`🖱️ **${E}** clicked`,timestamp:Date.now()}]);try{let A;if(In(t)&&!tn(t)){const T=(t.modalButtons||[]).indexOf(E),$=E.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase();let z;T>=0?z=`${T+1}\r`:/^(deny|no|reject|cancel)/.test($)?z="3\r":/always/.test($)?z="2\r":z="1\r";const D=t.daemonId||t.ideId,H=t.ideType||t.agentType||"";lb.sendPtyInput(D,H,z)||await e(D,"pty_input",{cliType:H,data:z}),A={success:!0}}else{const R=E.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),T=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(R),$=t.ideId||t.daemonId||"";A=await e($,"resolve_action",{button:E,action:T?"approve":"reject",...t.streamSource==="agent-stream"&&{agentType:t.agentType}})}A.success||l(R=>[...R,{ideId:t.tabKey,text:`⚠️ **${E}** failed — button not found`,timestamp:Date.now()}])}catch(A){console.error("[ModalButton] Error:",A),l(R=>[...R,{ideId:t.tabKey,text:`❌ **${E}** error`,timestamp:Date.now()}])}}},[t,e,l]),C=b.useCallback(async(E,A)=>{try{const R=E||(t==null?void 0:t.daemonId)||"",T=await e(R,"switch_chat",{id:A,sessionId:A,...(t==null?void 0:t.streamSource)==="agent-stream"&&{agentType:t==null?void 0:t.agentType}}),$=T==null?void 0:T.result;(T==null?void 0:T.success)===!0||$==="switched"||$==="switched-by-title"||($===!1||$==="not_found"?i(D=>[...D,{id:Date.now(),message:"⚠️ Session tab not found — try refreshing history",type:"warning",timestamp:Date.now()}]):typeof $=="string"&&$.startsWith("error:")?i(D=>[...D,{id:Date.now(),message:`⚠️ Switch error: ${$}`,type:"warning",timestamp:Date.now()}]):i(D=>[...D,{id:Date.now(),message:"⚠️ Session switch failed",type:"warning",timestamp:Date.now()}]))}catch(R){console.error("Switch failed",R),i(T=>[...T,{id:Date.now(),message:`❌ Switch failed: ${R.message||"connection error"}`,type:"warning",timestamp:Date.now()}])}},[t,e,i]),F=b.useCallback(async()=>{if(!(!t||f)){p(!0);try{const E=t.ideId||t.daemonId||"";await e(E,"new_chat",{...t.streamSource==="agent-stream"&&{agentType:t.agentType}}),o(A=>({...A,[t.tabKey]:Date.now()})),s(A=>({...A,[t.tabKey]:[]}))}catch(E){console.error("New chat failed",E)}finally{p(!1)}}},[t,f,e,o,s]),P=b.useCallback(async()=>{if(!t||S)return;_(!0);const E=t.tabKey;try{await e(t.ideId,"agent_stream_focus",{agentType:t.agentType}),a(E,[200,1500,3e3])}catch(A){console.error("Focus agent failed",A)}finally{_(!1)}},[t,S,e,a]),q=b.useCallback(async()=>{var E;if(!(!t||m)){g(!0);try{const A=t.ideId||t.daemonId||"",R=await e(A,"list_chats",{forceExpand:!0,...t.streamSource==="agent-stream"&&{agentType:t.agentType}}),T=(R==null?void 0:R.chats)||((E=R==null?void 0:R.result)==null?void 0:E.chats);R!=null&&R.success&&Array.isArray(T)&&n(t.ideId,T)}catch(A){console.error("Refresh history failed",A)}finally{g(!1)}}},[t,m,e,n]);return{agentInput:d,setAgentInput:h,isCreatingChat:f,isRefreshingHistory:m,isFocusingAgent:S,handleSendChat:x,handleRelaunch:w,handleLaunchIde:N,handleModalButton:L,handleSwitchSession:C,handleNewChat:F,handleFocusAgent:P,handleRefreshHistory:q}}let Uu=null;function JM({conversations:e,ides:t,messageReceivedAt:r,actionLogs:n,ptyBuffers:i,screenshotMap:s,setScreenshotMap:o,sendDaemonCommand:l,updateIdeChats:a,setToasts:c,setLocalUserMessages:d,setClearedTabs:h,setActionLogs:f,pinTab:p,isStandalone:m,userName:g,groupIndex:S,isFocused:_,onFocus:x,isSplitMode:w,numGroups:N,onMoveTab:L,onClose:C,onReceiveTab:F,style:P,detectedIdes:q,handleLaunchIde:E,onActiveTabChange:A,initialActiveTabId:R,initialTabOrder:T,onTabOrderChange:$}){const{sendCommand:z}=gi(),D=b.useRef(null),[H,I]=b.useState(!1),W=b.useRef(0),[y,J]=b.useState(R??null);b.useEffect(()=>{R&&R!==y&&J(R)},[R]);const[ae,k]=b.useState(T??[]),[we,U]=b.useState(null),Y=b.useRef(null);b.useEffect(()=>{const Q=new Set(e.map(oe=>oe.tabKey));k(oe=>{const Fe=oe.filter(ze=>Q.has(ze)),We=e.filter(ze=>!oe.includes(ze.tabKey)).map(ze=>ze.tabKey),Ne=[...Fe,...We];return Ne.length===oe.length&&Ne.every((ze,Te)=>ze===oe[Te])?oe:Ne})},[e]);const te=we??ae,fe=b.useMemo(()=>{if(te.length===0)return e;const Q=new Map(te.map((oe,Fe)=>[oe,Fe]));return[...e].sort((oe,Fe)=>{const We=Q.get(oe.tabKey)??999,Ne=Q.get(Fe.tabKey)??999;return We-Ne})},[e,te]);b.useEffect(()=>{if(fe.length===0){J(null),A==null||A(null);return}y&&fe.some(Q=>Q.tabKey===y)||(J(fe[0].tabKey),A==null||A(fe[0].tabKey))},[fe,y]);const de=fe.find(Q=>Q.tabKey===y),Oe=b.useCallback((Q,oe,Fe)=>{k(We=>{const Ne=We.filter(qe=>qe!==Q),ze=Ne.indexOf(oe);if(ze<0)return We;const Te=Fe==="left"?ze:ze+1;return Ne.splice(Te,0,Q),$==null||$(Ne),Ne}),U(null)},[$]),Ve=b.useCallback((Q,oe,Fe)=>{const Ne=(ae.length>0?ae:e.map(qe=>qe.tabKey)).filter(qe=>qe!==Q),ze=Ne.indexOf(oe);if(ze<0)return;const Te=Fe==="left"?ze:ze+1;Ne.splice(Te,0,Q),U(Ne)},[ae,e]),Ie=ab({sendDaemonCommand:l,activeConv:de,ides:t,updateIdeChats:a,setToasts:c,setLocalUserMessages:d,setClearedTabs:h,setActionLogs:f,pinTab:p,isStandalone:m}),[G,me]=b.useState(null);b.useEffect(()=>{if(!G)return;const Q=()=>me(null);return window.addEventListener("click",Q),()=>window.removeEventListener("click",Q)},[G]);const Re=de&&In(de)&&!tn(de);return b.useEffect(()=>{const Q=()=>{W.current=0,I(!1),U(null)};return window.addEventListener("dragend",Q),window.addEventListener("drop",Q),()=>{window.removeEventListener("dragend",Q),window.removeEventListener("drop",Q)}},[]),u.jsxs("div",{className:"flex flex-col min-h-0 min-w-0 flex-1 overflow-hidden",onClick:x,onDragEnter:Q=>{if(Q.dataTransfer.types.includes("text/tab-key")){W.current++;const oe=Uu;oe&&e.some(We=>We.tabKey===oe)||I(!0)}},onDragOver:Q=>{Q.dataTransfer.types.includes("text/tab-key")&&Q.preventDefault()},onDragLeave:()=>{W.current--,W.current<=0&&(W.current=0,I(!1))},onDrop:Q=>{W.current=0,I(!1),U(null);const oe=Q.dataTransfer.getData("text/tab-key");if(!oe)return;Q.preventDefault(),e.some(We=>We.tabKey===oe)?k(We=>{const Ne=We.filter(ze=>ze!==oe);return Ne.push(oe),$==null||$(Ne),Ne}):F&&F(oe)},style:{...P,outline:H?"2px dashed var(--accent-primary)":"none",outlineOffset:"-2px",transition:"outline 0.15s ease"},children:[u.jsx("div",{className:"flex items-center bg-bg-secondary border-b border-border-subtle shrink-0 gap-0",children:u.jsxs("div",{className:"flex-1 flex overflow-x-auto overflow-y-visible pt-1.5 pb-0 gap-1 select-none",style:{paddingLeft:8,paddingRight:4,scrollbarWidth:"none"},onWheel:Q=>{const oe=Q.currentTarget;Math.abs(Q.deltaY)>Math.abs(Q.deltaX)&&(Q.preventDefault(),oe.scrollLeft+=Q.deltaY)},children:[fe.map((Q,oe)=>{const Fe=y===Q.tabKey,We=Q.status==="working"?"agent-tab-working":Q.status==="waiting_approval"?"agent-tab-waiting":"",Ne=Q.connectionState==="failed"||Q.connectionState==="closed",ze=Y.current===Q.tabKey;return u.jsxs("div",{"data-tabkey":Q.tabKey,className:`${We} shrink-0 px-2.5 py-1.5 rounded-t-lg cursor-pointer flex items-center gap-2 relative`,draggable:!("ontouchstart"in window),onDragStart:Te=>{Uu=Q.tabKey,Y.current=Q.tabKey,Te.dataTransfer.setData("text/tab-key",Q.tabKey),Te.dataTransfer.effectAllowed="move"},onDragEnd:()=>{Uu=null,Y.current=null,we&&(k(we),$==null||$(we)),U(null),W.current=0,I(!1)},onDragOver:Te=>{const qe=Y.current;if(!(!qe||qe===Q.tabKey)&&Te.dataTransfer.types.includes("text/tab-key")){Te.preventDefault(),Te.stopPropagation();const Mt=Te.currentTarget.getBoundingClientRect(),Mr=Mt.left+Mt.width/2,K=Te.clientX<Mr?"left":"right";Ve(qe,Q.tabKey,K)}},onDrop:Te=>{Te.preventDefault(),Te.stopPropagation();const qe=Te.dataTransfer.getData("text/tab-key");if(qe&&qe!==Q.tabKey){const Mt=Te.currentTarget.getBoundingClientRect(),Mr=Mt.left+Mt.width/2,K=Te.clientX<Mr?"left":"right";fe.some(ne=>ne.tabKey===qe)?Oe(qe,Q.tabKey,K):F&&F(qe)}U(null)},onClick:Te=>{Te.stopPropagation(),x(),J(Q.tabKey),A==null||A(Q.tabKey),Q.streamSource==="agent-stream"&&Q.agentType&&z(Q.ideId,"agent_stream_focus",{agentType:Q.agentType}).catch(()=>{}),In(Q)&&setTimeout(()=>{var qe,Mt;return(Mt=(qe=D.current)==null?void 0:qe.bumpResize)==null?void 0:Mt.call(qe)},100)},onContextMenu:Te=>{L&&!("ontouchstart"in window)&&(Te.preventDefault(),me({x:Te.clientX,y:Te.clientY,tabKey:Q.tabKey}))},style:{background:Fe?"var(--bg-primary)":"var(--bg-glass)",borderTop:Fe?"1px solid var(--border-subtle)":"1px solid transparent",borderLeft:Fe?"1px solid var(--border-subtle)":"1px solid transparent",borderRight:Fe?"1px solid var(--border-subtle)":"1px solid transparent",opacity:ze?.4:Ne?Fe?.6:.3:Fe?1:.65,transition:"transform 0.2s ease, opacity 0.15s ease"},children:[Q.status==="working"?u.jsx("div",{className:"tab-spinner"}):Q.status==="waiting_approval"?u.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400",children:"▲"}):Ne?u.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400 animate-pulse",children:"○"}):Q.connectionState==="connecting"?u.jsx("span",{className:"text-[8px] px-[5px] py-px text-blue-400",children:"○"}):Q.connectionState==="connected"?u.jsx("span",{className:"text-[8px] px-[5px] py-px text-green-400",children:"●"}):u.jsx("span",{className:"text-[8px] px-[5px] py-px text-text-muted",children:"●"}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-xs font-bold whitespace-nowrap overflow-hidden text-ellipsis",children:Q.displayPrimary}),u.jsx("div",{className:"text-[8px] opacity-50 flex gap-1 items-center",children:Ne?u.jsx("span",{className:"text-yellow-400 opacity-100",children:"Reconnecting…"}):u.jsxs(u.Fragment,{children:[Q.displaySecondary,Q.machineName&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"opacity-40",children:"·"}),u.jsxs("span",{className:"opacity-70",children:["🖥 ",Q.machineName]})]})]})})]}),oe<9&&u.jsx("span",{className:"text-[9px] opacity-35 font-mono ml-0.5 shrink-0",children:oe+1})]},Q.tabKey)}),e.length===0&&u.jsx("div",{className:"p-2 text-xs opacity-40",children:"No tabs in this group"})]})}),u.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden relative",children:de?u.jsxs(u.Fragment,{children:[u.jsx(F1,{activeConv:de,onModalButton:Ie.handleModalButton}),u.jsx("div",{className:"desktop-only px-3 pt-1 pb-2",children:!Re&&!tn(de)&&s[de.ideId]?u.jsx(kR,{screenshotUrl:s[de.ideId],mode:"preview",onDismiss:()=>{const Q={...s};delete Q[de.ideId],o(Q)}}):!Re&&!tn(de)&&de.cdpConnected===!1?u.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 py-2 bg-yellow-500/[0.08] border border-yellow-500/20 rounded-lg text-xs text-text-secondary",children:[u.jsx("span",{className:"text-sm",children:u.jsx(qy,{size:14})}),u.jsx("span",{className:"flex-1",children:"CDP not connected — chat history & screenshots unavailable."}),u.jsx("button",{className:"btn btn-sm bg-yellow-500/15 text-yellow-500 border border-yellow-500/30 text-[10px] whitespace-nowrap shrink-0",onClick:Ie.handleRelaunch,children:"Relaunch with CDP"})]}):null}),Re?u.jsx(ER,{activeConv:de,ptyBuffers:i,terminalRef:D,agentInput:Ie.agentInput,setAgentInput:Ie.setAgentInput,handleSendChat:Ie.handleSendChat,handleModalButton:Ie.handleModalButton}):u.jsx(W1,{activeConv:de,ides:t,agentInput:Ie.agentInput,setAgentInput:Ie.setAgentInput,handleSendChat:Ie.handleSendChat,handleFocusAgent:Ie.handleFocusAgent,isFocusingAgent:Ie.isFocusingAgent,messageReceivedAt:r,actionLogs:n,userName:g})]}):u.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",children:e.length===0&&!w&&q&&E?u.jsxs("div",{className:"empty-dashboard",children:[u.jsx("div",{className:"glow-orb",children:u.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-12 h-12"})}),u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"font-bold text-lg mb-1.5",children:"No IDE connected"}),u.jsx("div",{className:"text-[13px] text-text-muted",style:{marginBottom:q.length>0?16:0},children:m?"Launch an IDE with CDP to start monitoring":"Launch your IDE with the ADHDev extension to start"}),m&&q.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:q.map(Q=>u.jsx("button",{className:"btn btn-sm bg-violet-500/10 border border-violet-500/25 text-violet-400 text-xs font-semibold px-4 py-2 rounded-lg cursor-pointer flex items-center gap-1.5 transition-all",onClick:()=>E(Q.type),onMouseEnter:oe=>oe.currentTarget.style.background="rgba(139,92,246,0.2)",onMouseLeave:oe=>oe.currentTarget.style.background="rgba(139,92,246,0.1)",children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(GP,{size:14})," Launch ",Q.name]})},Q.type))})]})]}):u.jsx("div",{className:"text-sm text-text-muted opacity-50",children:w?"Move a tab here to view":"No active agent"})})}),G&&L&&u.jsxs("div",{className:"fixed z-50 bg-bg-primary border border-border-subtle rounded-lg shadow-lg py-1 min-w-[160px]",style:{left:G.x,top:G.y},onClick:()=>me(null),children:[S>0&&u.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs hover:bg-bg-secondary transition-colors",onClick:()=>{L(G.tabKey,"left"),me(null)},children:"← Move to Left Group"}),S<N-1&&u.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs hover:bg-bg-secondary transition-colors",onClick:()=>{L(G.tabKey,"right"),me(null)},children:"Move to Right Group →"}),N<4&&u.jsx("button",{className:"w-full text-left px-3 py-1.5 text-xs hover:bg-bg-secondary transition-colors",onClick:()=>{L(G.tabKey,"new"),me(null)},children:"Split to New Group ◨"}),S===0&&N===1&&u.jsx("div",{className:"px-3 py-1.5 text-[11px] text-text-muted opacity-50 italic",children:"No other groups available"})]})]})}function ZM(){const{sendCommand:e}=gi(),[t,r]=A0(),n=t.get("activeTab"),i=fp(),{updateIdeChats:s,screenshotMap:o,setScreenshotMap:l}=i,a=i.ides||[],c=i.toasts||[],d=i.setToasts||(()=>{}),h=i.wsStatus||"connected",f=i.isConnected??!0,p=i.connectionStates||{};i.retryConnection;const m=i.showReconnected||!1,[g,S]=b.useState(()=>{try{const M=sessionStorage.getItem("adhdev_splitGroups");if(M){const j=JSON.parse(M);return new Map(j)}}catch{}return new Map}),[_,x]=b.useState(()=>{try{const M=sessionStorage.getItem("adhdev_focusedGroup");if(M)return parseInt(M,10)||0}catch{}return 0}),[w,N]=b.useState(()=>{try{const M=sessionStorage.getItem("adhdev_groupActiveTabs");if(M)return JSON.parse(M)}catch{}return{}}),L=b.useRef(!1),[C,F]=b.useState(()=>{try{const M=sessionStorage.getItem("adhdev_groupTabOrders");if(M)return JSON.parse(M)}catch{}return{}}),[P,q]=b.useState(()=>{try{const M=sessionStorage.getItem("adhdev_splitSizes");if(M)return JSON.parse(M)}catch{}return[]});b.useEffect(()=>{try{g.size===0?sessionStorage.removeItem("adhdev_splitGroups"):sessionStorage.setItem("adhdev_splitGroups",JSON.stringify([...g.entries()]))}catch{}},[g]),b.useEffect(()=>{try{P.length>0?sessionStorage.setItem("adhdev_splitSizes",JSON.stringify(P)):sessionStorage.removeItem("adhdev_splitSizes")}catch{}},[P]),b.useEffect(()=>{try{sessionStorage.setItem("adhdev_focusedGroup",String(_))}catch{}},[_]),b.useEffect(()=>{try{sessionStorage.setItem("adhdev_groupActiveTabs",JSON.stringify(w))}catch{}},[w]),b.useEffect(()=>{try{sessionStorage.setItem("adhdev_groupTabOrders",JSON.stringify(C))}catch{}},[C]);const[E,A]=b.useState(()=>typeof window<"u"&&window.innerWidth<768);b.useEffect(()=>{const M=window.matchMedia("(max-width: 767px)"),j=V=>A(V.matches);return M.addEventListener("change",j),()=>M.removeEventListener("change",j)},[]);const R=b.useMemo(()=>E||g.size===0?1:Math.max(1,...g.values())+1,[g,E]),T=R>1,$=b.useCallback((M,j)=>{S(V=>{const X=new Map(V);return j===0?X.delete(M):X.set(M,j),X}),x(j)},[]),z=b.useCallback(M=>{S(j=>{const X=(j.size===0?0:Math.max(0,...j.values()))+1;if(X>=4)return j;const he=new Map(j);return he.set(M,X),he}),x(j=>j+1)},[]),D=b.useCallback(M=>{S(j=>{const V=new Map;for(const[X,he]of j)he!==M&&(he>M?V.set(X,he-1):V.set(X,he));return V}),q(j=>{if(j.length<=1)return[];const V=[...j];V.splice(M,1);const X=V.reduce((he,ce)=>he+ce,0);return V.map(he=>he/X*100)}),x(0)},[]),H=b.useRef(null),I=b.useCallback((M,j)=>{j.preventDefault();const V=H.current;if(!V)return;const X=j.clientX,he=V.offsetWidth,ce=P.length===R?[...P]:Array(R).fill(100/R),ve=le=>{const _e=(le.clientX-X)/he*100,Ye=[...ce];Ye[M]=Math.max(15,ce[M]+_e),Ye[M+1]=Math.max(15,ce[M+1]-_e),q(Ye)},pe=()=>{document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",pe),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",ve),document.addEventListener("mouseup",pe)},[P,R]),[W,y]=b.useState({}),[J,ae]=b.useState(!1),[k,we]=b.useState([]),[U,Y]=b.useState({}),[te,fe]=b.useState({}),[de,Oe]=b.useState(!1),[Ve,Ie]=b.useState(!1);b.useEffect(()=>{const M=V=>{var X;(X=V.dataTransfer)!=null&&X.types.includes("text/tab-key")&&Ie(!0)},j=()=>{Ie(!1),Oe(!1)};return window.addEventListener("dragstart",M),window.addEventListener("dragend",j),window.addEventListener("drop",j),()=>{window.removeEventListener("dragstart",M),window.removeEventListener("dragend",j),window.removeEventListener("drop",j)}},[]);const G=a.find(M=>M.type==="adhdev-daemon"),me=(G==null?void 0:G.detectedIdes)||[],Re=!!G,Q=b.useMemo(()=>{const M=a.filter(V=>V.type!=="adhdev-daemon"),j=new Map;for(const V of M){const X=j.get(V.id);if(!X)j.set(V.id,V);else{const he=(X.workspace?1:0)+(X.activeChat?1:0);((V.workspace?1:0)+(V.activeChat?1:0)>he||(V.timestamp||0)>(X.timestamp||0))&&j.set(V.id,V)}}return Array.from(j.values())},[a]),oe=b.useMemo(()=>{const M=jR(Q,U,a,p),j=Date.now();return M.map(V=>{const X=te[V.tabKey];return X&&j-X<5e3?{...V,messages:[],title:""}:V})},[Q,U,te,a]);b.useEffect(()=>{UM()},[]);const Fe=b.useMemo(()=>oe.map(M=>({id:M.tabKey,name:M.title||M.agentName||M.ideId,status:M.status,activeModal:M.modalMessage?{message:M.modalMessage,buttons:M.modalButtons}:null})),[oe]);qM(Fe);const We=b.useMemo(()=>{const M=Array.from({length:R},()=>[]);for(const j of oe){const V=g.get(j.tabKey)??0,X=Math.min(V,R-1);M[X].push(j)}return M},[oe,g,R]);b.useEffect(()=>{const M=new Set(oe.map(j=>j.tabKey));S(j=>{let V=!1;const X=new Map;for(const[he,ce]of j)M.has(he)?X.set(he,ce):V=!0;return V?X:j})},[oe]),b.useEffect(()=>{if(T)for(let M=R-1;M>=1;M--)[...g.values()].some(V=>V===M)||D(M)},[g,R,T,D]),b.useEffect(()=>{if(!n||L.current||oe.length===0)return;const M=oe.find(j=>j.tabKey===n)||oe.find(j=>j.ideId===n)||oe.find(j=>j.ideType===n||j.agentType===n);if(M){const j=g.get(M.tabKey)??0;N(V=>({...V,[j]:M.tabKey})),x(j),L.current=!0,r(V=>{const X=new URLSearchParams(V);return X.delete("activeTab"),X},{replace:!0})}},[n,oe,g]),b.useEffect(()=>{if(Object.keys(te).length===0)return;const j=setTimeout(()=>{fe(V=>{const X=Date.now(),he={};for(const[ce,ve]of Object.entries(V))X-ve<5e3&&(he[ce]=ve);return Object.keys(he).length===Object.keys(V).length?V:he})},5500);return()=>clearTimeout(j)},[te]);const Ne=b.useMemo(()=>{var j,V;const M=w[_];if(M){const X=oe.find(he=>he.tabKey===M);if(X)return X}return((j=We[_])==null?void 0:j[0])||((V=We[0])==null?void 0:V[0])},[w,_,oe,We]),ze=b.useCallback((M,j)=>{},[]);b.useEffect(()=>{var X;const M=Date.now();let j=!1;const V={...W};for(const he of oe)(X=he.messages)!=null&&X.length&&he.messages.forEach((ce,ve)=>{const pe=`${he.ideId}-${ce.id??`i-${ve}`}`;V[pe]==null&&(V[pe]=M,j=!0)});j&&y(V)},[oe]);const Te=b.useRef(!1);b.useEffect(()=>{if(!J){Te.current=!1;return}if(!Ne||Te.current||Mr)return;const M=a.find(j=>j.id===Ne.ideId);M&&(!M.chats||M.chats.length===0)&&(Te.current=!0,Me())},[J,Ne==null?void 0:Ne.ideId]),b.useEffect(()=>{const M=setInterval(()=>{const j=Date.now()-3e5;we(V=>{const X=V.filter(he=>he.timestamp>j).slice(-100);return X.length===V.length?V:X})},6e4);return()=>clearInterval(M)},[]);const qe=b.useRef(new Map);b.useEffect(()=>{const M=(V,X)=>{var he;if(X){H1.emit(V,X);for(const ce of oe){if(!In(ce))continue;const ve=(he=ce.ideId)!=null&&he.includes(":cli:")?ce.ideId.split(":cli:")[1]:"";if(V===ve||V===ce.agentType||V===ce.ideType){const le=qe.current.get(ce.tabKey)||[];le.push(X),le.length>1e4&&le.splice(0,le.length-5e3),qe.current.set(ce.tabKey,le)}}}},j=lb.onPtyOutput(M);return()=>{j()}},[oe]),b.useEffect(()=>{const M=j=>{if(j.ctrlKey&&j.key==="\\"){if(j.preventDefault(),T)S(new Map),x(0);else{const V=oe[1];V&&z(V.tabKey)}return}j.ctrlKey&&(j.key==="["||j.key==="]")&&T&&(j.preventDefault(),x(V=>j.key==="]"?Math.min(V+1,R-1):Math.max(V-1,0)))};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[T,oe,z,R]),b.useEffect(()=>{const M=GM.on("status_event",j=>{var ce;const V=Ar(j.ideType||"");let X="",he="info";if(j.event==="agent:generating_completed"){const ve=j.duration?` (${j.duration}s)`:"";X=`✅ ${V} agent task completed${ve}`,he="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}if(j.ideId){const pe={role:"system",timestamp:Date.now(),content:`✅ Task completed${ve}`,_localId:`sys_complete_${Date.now()}`};Y(le=>{for(const Pe of Object.keys(le))if(Pe.includes(j.ideId))return{...le,[Pe]:[...le[Pe]||[],pe]};return le})}}else if(j.event==="agent:generating_started")j.ideId&&Y(ve=>{const pe={...ve};for(const le of Object.keys(pe))le.includes(j.ideId)&&(pe[le]=(pe[le]||[]).filter(Pe=>{var _e;return!(Pe.role==="system"&&((_e=Pe._localId)!=null&&_e.startsWith("sys_complete_")))}));return pe});else if((j.event==="agent:waiting_approval"||j.event==="agent:approval_needed")&&(X=`⚡ ${V} approval needed`,he="warning",j.ideId)){const ve=j.modalMessage||"Approval requested",pe=(ce=j.modalButtons)!=null&&ce.length?j.modalButtons.map(Pe=>`[${Pe}]`).join(" "):"[Approve] [Reject]",le={role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${ve}
|
|
195
|
+
${pe}`,_localId:`sys_approval_${Date.now()}`};Y(Pe=>{for(const _e of Object.keys(Pe))if(_e.includes(j.ideId))return{...Pe,[_e]:[...Pe[_e]||[],le]};return Pe})}if(X){const ve=Date.now();d(pe=>[...pe.slice(-4),{id:ve,message:X,type:he,timestamp:ve,ideId:j.ideId}]),setTimeout(()=>d(pe=>pe.filter(le=>le.id!==ve)),5e3)}});return()=>M()},[]),b.useEffect(()=>{var j;const M=V=>{const X=V.data;(X==null?void 0:X.type)==="notification_action"&&X.action==="approve"&&X.ideId&&e(X.ideId,"resolve_action",{action:"approve",button:"Approve"}).catch(he=>console.error("[SW Action] approve failed:",he))};return(j=navigator.serviceWorker)==null||j.addEventListener("message",M),()=>{var V;return(V=navigator.serviceWorker)==null?void 0:V.removeEventListener("message",M)}},[]);const{isCreatingChat:Mt,isRefreshingHistory:Mr,handleLaunchIde:K,handleSwitchSession:ne,handleNewChat:Se,handleRefreshHistory:Me}=ab({sendDaemonCommand:e,activeConv:Ne,ides:a,updateIdeChats:s,setToasts:d,setLocalUserMessages:Y,setClearedTabs:fe,setActionLogs:we,pinTab:ze,isStandalone:Re}),$e=b.useMemo(()=>a.filter(M=>M.type==="adhdev-daemon"&&M.versionMismatch),[a]),[ft,It]=b.useState(!1),[Ee,O]=b.useState({}),ue=b.useCallback(async M=>{var j,V;O(X=>({...X,[M]:"upgrading"}));try{const X=await e(M,"daemon_upgrade",{});(j=X==null?void 0:X.result)!=null&&j.upgraded||(V=X==null?void 0:X.result)!=null&&V.success?O(he=>({...he,[M]:"done"})):O(he=>({...he,[M]:"error"}))}catch{O(X=>({...X,[M]:"error"}))}},[e]);return u.jsxs("div",{className:"page-dashboard flex-1 min-h-0 bg-bg-primary text-text-primary flex flex-col overflow-hidden",children:[u.jsx(NR,{wsStatus:h,showReconnected:m}),$e.length>0&&!ft&&u.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-2 bg-amber-500/[0.08] border-b border-amber-500/20 text-xs text-text-secondary shrink-0 flex-wrap",children:[u.jsx("span",{className:"text-sm shrink-0",children:"🔄"}),u.jsxs("span",{className:"flex-1 flex items-center gap-2 flex-wrap min-w-0",children:[u.jsxs("span",{children:["Update available: ",u.jsxs("strong",{children:["v",$e[0].version]})," → ",u.jsxs("strong",{children:["v",$e[0].serverVersion]})]}),$e.map(M=>{var X;const j=M.machineNickname||((X=M.machine)==null?void 0:X.hostname)||M.hostname||"Machine",V=Ee[M.id];return u.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-amber-500/[0.08] border border-amber-500/15",children:[u.jsx("span",{className:"font-medium text-text-primary",children:j}),u.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",M.version]}),V==="upgrading"?u.jsx("span",{className:"text-[10px] text-amber-400 animate-pulse",children:"upgrading…"}):V==="done"?u.jsx("span",{className:"text-[10px] text-green-400",children:"✓ restarting"}):V==="error"?u.jsx("button",{className:"text-[10px] text-red-400 hover:text-red-300 underline cursor-pointer",onClick:()=>ue(M.id),children:"retry"}):u.jsx("button",{className:"text-[10px] font-semibold text-amber-400 hover:text-amber-300 cursor-pointer px-1.5 py-px rounded bg-amber-500/10 border border-amber-500/20 transition-colors",onClick:()=>ue(M.id),children:"Upgrade"})]},M.id)})]}),u.jsx("button",{className:"text-text-muted hover:text-text-primary transition-colors text-sm px-1 shrink-0",onClick:()=>It(!0),title:"Dismiss",children:"✕"})]}),u.jsx(PR,{activeConv:Ne,agentCount:Q.length,wsStatus:h,isConnected:f,onOpenHistory:()=>ae(!0)}),u.jsxs("div",{ref:H,className:`flex-1 min-h-0 flex ${T?"flex-row":"flex-col"} overflow-hidden`,children:[We.map((M,j)=>{const V=T&&P.length===R?`${P[j]}%`:void 0;return u.jsxs(vv.Fragment,{children:[T&&j>0&&u.jsx("div",{className:"shrink-0 w-1 cursor-col-resize hover:bg-accent-primary/30 transition-colors relative group",style:{background:"var(--border-subtle)"},onMouseDown:X=>I(j-1,X),onDoubleClick:()=>D(j),title:"Drag to resize · Double-click to merge",children:u.jsx("div",{className:"absolute inset-y-0 -left-1 -right-1 group-hover:bg-accent-primary/10"})}),u.jsx(JM,{style:T?{flexBasis:V??`${100/R}%`,flexGrow:V?0:1,flexShrink:V?0:1}:void 0,conversations:M,ides:a,messageReceivedAt:W,actionLogs:k,ptyBuffers:qe,screenshotMap:o,setScreenshotMap:l,sendDaemonCommand:e,updateIdeChats:s,setToasts:d,setLocalUserMessages:Y,setClearedTabs:fe,setActionLogs:we,pinTab:ze,isStandalone:Re,userName:i.userName,groupIndex:j,isFocused:_===j,onFocus:()=>x(j),isSplitMode:T,numGroups:R,onMoveTab:(X,he)=>{he==="left"&&j>0?$(X,j-1):he==="right"&&j<R-1?$(X,j+1):he==="new"&&R<4&&z(X)},onClose:T?()=>D(j):void 0,onReceiveTab:X=>$(X,j),detectedIdes:j===0?me:void 0,handleLaunchIde:j===0?K:void 0,onActiveTabChange:X=>N(he=>({...he,[j]:X})),initialActiveTabId:w[j],initialTabOrder:C[j],onTabOrderChange:X=>F(he=>({...he,[j]:X}))})]},j)}),!E&&R<4&&u.jsxs("div",{className:"relative shrink-0 w-0 z-50",children:[u.jsx("div",{className:"fixed right-0 top-0 bottom-0 w-16",style:{pointerEvents:Ve?"auto":"none"},onDragOver:M=>{M.dataTransfer.types.includes("text/tab-key")&&(M.preventDefault(),Oe(!0))},onDragLeave:()=>Oe(!1),onDrop:M=>{M.preventDefault(),Oe(!1);const j=M.dataTransfer.getData("text/tab-key");j&&z(j)}}),u.jsx("div",{className:"absolute right-0 top-0 bottom-0 pointer-events-none transition-all duration-200",style:{width:de?"120px":"0px",background:"var(--accent-primary)",opacity:de?.15:0,borderLeft:de?"2px dashed var(--accent-primary)":"none"}})]})]}),J&&Ne&&u.jsx(RR,{activeConv:Ne,ides:a,isCreatingChat:Mt,isRefreshingHistory:Mr,onClose:()=>ae(!1),onNewChat:Se,onSwitchSession:ne,onRefreshHistory:Me}),u.jsx("style",{children:`
|
|
196
196
|
body { overflow: hidden; overscroll - behavior: none; }
|
|
197
197
|
.btn { cursor: pointer; border - radius: 8px; font - weight: 600; font - size: 14px; transition: all 0.2s; }
|
|
198
198
|
.btn - sm { padding: 6px 12px; font - size: 12px; }
|
|
@@ -209,6 +209,6 @@ ${pe}`,_localId:`sys_approval_${Date.now()}`};Y(Te=>{for(const _e of Object.keys
|
|
|
209
209
|
from { opacity: 0; transform: translateX(40px); }
|
|
210
210
|
to { opacity: 1; transform: translateX(0); }
|
|
211
211
|
}
|
|
212
|
-
`})]})}function eI(e){return e.split(":")[0]||""}function tI({renderHeaderActions:e}={}){var Oe,Ve,Ie;const{id:t}=M0(),r=Os(),n=fp(),i=n.ides||[],s=n.connectionStates||{},{sendCommand:o}=gi(),l=b.useMemo(()=>eI(t||""),[t]),a=b.useMemo(()=>i.find(G=>G.id===t),[i,t]),c=(a==null?void 0:a.type)||void 0,d=c?c.charAt(0).toUpperCase()+c.slice(1):"IDE",h=(a==null?void 0:a.activeChat)||null,f=(a==null?void 0:a.agentStreams)||[],p=n.isConnected??!0,m=s[l]||(p?"connected":"new"),g=b.useMemo(()=>i.find(G=>G.id===l||G.daemonId===l),[i,l]),S=(g==null?void 0:g.machineNickname)||((Oe=g==null?void 0:g.machine)==null?void 0:Oe.hostname)||"",_=(a==null?void 0:a.workspace)||"",[x]=A0(),w=typeof window<"u"&&window.innerWidth<=768,N=x.get("view")||(w?"chat":"split"),[L,C]=b.useState(N),[F,T]=b.useState("ide"),[q,E]=b.useState(""),[A,R]=b.useState(!1),[P,$]=b.useState(null),[z,D]=b.useState(null),[H,I]=b.useState([]),W=h==null?void 0:h.status,y=(((Ie=(Ve=h==null?void 0:h.activeModal)==null?void 0:Ve.buttons)==null?void 0:Ie.length)??0)>0,Q=W==="generating"||W==="loading"||W&&W.toLowerCase()==="thinking",k=y||W==="waiting_approval"?"waiting_approval":Q?"working":W||"idle",we=b.useMemo(()=>{var G,me;return{ideId:t||"",daemonId:l,agentName:Ad(c||""),agentType:c||"",status:k,title:(h==null?void 0:h.title)||"",messages:(h==null?void 0:h.messages)||[],ideType:c||"",workspaceName:(a==null?void 0:a.workspaceName)||"",displayPrimary:d,displaySecondary:(a==null?void 0:a.workspaceName)||"",cdpConnected:!0,modalButtons:(G=h==null?void 0:h.activeModal)==null?void 0:G.buttons,modalMessage:(me=h==null?void 0:h.activeModal)==null?void 0:me.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,h,a,d,k]);b.useEffect(()=>l?dr.onScreenshot("ide-page",(me,Re)=>{if(me!==l)return;const J=new FileReader;J.onload=()=>$(J.result),J.readAsDataURL(Re)}):void 0,[l]),b.useEffect(()=>l?dr.onStatusEvent((me,Re)=>{if(me!==l)return;let J="",oe="info";if(Re.event==="agent:generating_completed"?(J=`✅ Task completed${Re.duration?` (${Re.duration}s)`:""}`,oe="success"):(Re.event==="agent:waiting_approval"||Re.event==="agent:approval_requested")&&(J="⚡ Approval needed",oe="warning"),J){const Fe=Date.now();I(Ne=>[...Ne.slice(-4),{id:Fe,message:J,type:oe}]),setTimeout(()=>I(Ne=>Ne.filter(ze=>ze.id!==Fe)),oe==="warning"?1e4:5e3)}}):void 0,[l]);const U=b.useMemo(()=>{if(!t)return c;const G=t.split(":");return G.length>=3&&G[1]==="ide"?G.slice(2).join(":"):c},[t,c]);b.useEffect(()=>{const G=l?dr.get(l):null;!G||!(m==="connected")||(L!=="chat"&&U?G.startScreenshots(U):G.stopScreenshots(U))},[L,m,U,l]);const Y=b.useCallback(async(G,me={})=>{if(!t)throw new Error("No IDE ID");const Re={...me};if(!Re._targetInstance&&t){const oe=t.split(":");oe.length>=3&&(oe[1]==="ide"||oe[1]==="cli")&&(Re._targetInstance=oe.slice(2).join(":"),Re._targetType=oe[1])}const J=l?dr.get(l):null;return J!=null&&J.hasCommandChannel?await J.sendCommand(G,Re):J&&J.connectionState!=="failed"&&J.connectionState!=="closed"&&await new Promise(Fe=>{const We=Date.now(),Ne=()=>{if(J.hasCommandChannel)return Fe(!0);if(Date.now()-We>3e3)return Fe(!1);setTimeout(Ne,200)};Ne()})&&J.hasCommandChannel?await J.sendCommand(G,Re):await o(t,G,Re)},[t,l]),te=async()=>{const G=q.trim();if(!(!G||!t||A)){E(""),R(!0);try{await Y("send_chat",{message:G,waitForResponse:!0})}catch(me){console.error("[IDE] Send failed:",me)}finally{R(!1)}}},fe=async G=>{if(t)try{const me=await o(t,"screenshot",{width:G?Math.min(G,1280):1280});me!=null&&me.success&&(me!=null&&me.base64)&&D(`data:image/jpeg;base64,${me.base64}`)}catch(me){console.error("[IDE] Screenshot failed:",me)}},de=f.length>0;return t?u.jsxs("div",{className:"ide-page",children:[u.jsxs("header",{className:"ide-header",children:[u.jsxs("div",{className:"ide-header-left",children:[u.jsxs("div",{className:"ide-title",children:[u.jsx(Xa,{size:16}),u.jsx("span",{className:"ide-name",children:d}),u.jsx("span",{className:"ide-name-mobile",children:"IDE"}),_&&u.jsx("span",{className:"ide-workspace",children:_}),u.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),u.jsxs("div",{className:"ide-status-pill",children:[u.jsx("span",{className:`ide-dot ${m==="connected"?"online":"connecting"}`}),u.jsx("span",{className:"ide-status-text",children:m==="connected"?"Connected":m==="connecting"?"Connecting":"WS"})]}),S&&u.jsx("span",{className:"ide-machine-label",children:S})]}),u.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(G=>u.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:L===G?"1px solid var(--accent-primary)":"none",background:L===G?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:L===G?"var(--accent-primary)":void 0},onClick:()=>C(G),children:G==="chat"?u.jsx(Xa,{size:14}):G==="split"?"⊞":u.jsx(Ro,{size:14})},G)),e&&e({daemonId:l,ideInstanceId:t||""}),u.jsxs("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs flex items-center justify-center shrink-0",onClick:()=>r(-1),children:["←",u.jsx("span",{className:"hidden md:inline ml-1",children:"Back"})]})]})]}),u.jsxs("div",{className:"ide-content",children:[u.jsxs("div",{className:`ide-chat-panel ${L==="chat"?"full":""} ${L==="remote"?"hidden":""}`,children:[de&&u.jsxs("div",{className:"ide-chat-tabs",children:[u.jsx("button",{className:`ide-chat-tab ${F==="ide"?"active":""}`,onClick:()=>T("ide"),children:d}),u.jsxs("button",{className:`ide-chat-tab ext ${F==="extensions"?"active":""}`,onClick:()=>T("extensions"),children:["Extensions ",u.jsx("span",{className:"ide-ext-badge",children:f.length})]})]}),F==="extensions"&&de?u.jsx(iP,{ideId:t,agentStreams:f,sendCommand:async(G,me)=>{try{const Re=l?dr.get(l):null;if(Re&&m==="connected"){await Promise.race([Re.sendCommand(G,me),new Promise((J,oe)=>setTimeout(()=>oe(new Error("connection timeout")),3e3))]);return}}catch{}await o(t,G,me)}}):u.jsx(W1,{activeConv:we,ides:i,agentInput:q,setAgentInput:E,handleSendChat:te,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[],userName:n.userName})]}),u.jsx("div",{className:`ide-remote-panel ${L==="remote"?"full":""} ${L==="chat"?"hidden":""}`,children:u.jsx(SR,{screenshot:z,isCapturing:!1,onRefresh:fe,addLog:()=>{},connState:m,connScreenshot:P,onAction:async(G,me)=>{const Re=l?dr.get(l):null;if(!Re||m!=="connected")return console.warn("[RemoteInput] P2P not connected"),{success:!1,error:"P2P not connected"};const J=(a==null?void 0:a.instanceId)||U;return await Re.sendInput(G,me,J)}})})]}),H.length>0&&u.jsx("div",{className:"ide-toasts",children:H.map(G=>u.jsx("div",{className:`ide-toast ${G.type}`,onClick:()=>I(me=>me.filter(Re=>Re.id!==G.id)),children:G.message},G.id))})]}):u.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function rI(e){const t=Math.floor((Date.now()-e)/1e3);return t<45?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function nI(){var _p,vp,xp,yp,bp,wp,Sp,kp,Cp,Ep;const{id:e}=M0(),t=Os(),{sendCommand:r}=gi(),n=r,i=fp(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=b.useState([]),[c,d]=b.useState([]),[h,f]=b.useState(0),[p,m]=b.useState(!0),[g,S]=b.useState("debug"),[_,x]=b.useState(null),[w,N]=b.useState([]),[L,C]=b.useState(!1),[F,T]=b.useState(""),[q,E]=b.useState(""),[A,R]=b.useState(""),[P,$]=b.useState(""),[z,D]=b.useState(""),[H,I]=b.useState(""),[W,y]=b.useState(""),[Q,ae]=b.useState("overview"),[k,we]=b.useState([]),[U,Y]=b.useState(!1),[te,fe]=b.useState(!1),[de,Oe]=b.useState(""),[Ve,Ie]=b.useState([]),[G,me]=b.useState(!1),[Re,J]=b.useState(null),[oe,Fe]=b.useState("all"),[We,Ne]=b.useState(""),[ze,Pe]=b.useState(!1),[qe,Mt]=b.useState({}),[Mr,K]=b.useState(null),[ne,Se]=b.useState(null),Me=b.useRef(null),$e=b.useRef(!1);b.useEffect(()=>{if(!e||Q!=="logs"||!p)return;const v=async()=>{try{const ie=await r(e,"get_logs",{count:200,minLevel:g,since:h}),ke=(ie==null?void 0:ie.result)||ie;if(ie!=null&&ie.success&&Array.isArray(ke==null?void 0:ke.logs)&&ke.logs.length>0){d(yr=>[...yr,...ke.logs.map(Kr=>({timestamp:Kr.ts,level:Kr.level,message:`[${Kr.category}] ${Kr.message}`}))].slice(-300));const Ge=Math.max(...ke.logs.map(yr=>yr.ts));f(Ge)}}catch{}};v();const B=setInterval(v,3e3);return()=>clearInterval(B)},[e,Q,p,h,g]),b.useEffect(()=>{if(p&&c.length>0){const v=$e.current?"smooth":"instant";setTimeout(()=>{var B;(B=Me.current)==null||B.scrollIntoView({behavior:v}),$e.current=!0},50)}},[c.length,l.length,p]),b.useEffect(()=>{Q!=="logs"&&($e.current=!1)},[Q]),b.useEffect(()=>{if(!e||Q!=="ides")return;(async()=>{try{const B=await r(e,"get_ide_extensions",{}),ie=(B==null?void 0:B.result)||B;ie!=null&&ie.success&&(ie!=null&&ie.ides)&&Mt(ie.ides)}catch{}})()},[e,Q]);const ft=async()=>{var v;if(e){me(!0);try{const B=await r(e,"get_provider_settings",{}),ie=(B==null?void 0:B.result)||B;if(B!=null&&B.success&&(ie!=null&&ie.settings)){const ke=[];for(const[Ge,yr]of Object.entries(ie.settings)){const cr=ue.find(Kr=>Kr.type===Ge);ke.push({type:Ge,displayName:(cr==null?void 0:cr.displayName)||Ge,icon:(cr==null?void 0:cr.icon)||"",category:(cr==null?void 0:cr.category)||"unknown",schema:yr,values:((v=ie.values)==null?void 0:v[Ge])||{}})}ke.sort((Ge,yr)=>Ge.category.localeCompare(yr.category)||Ge.displayName.localeCompare(yr.displayName)),Ie(ke)}}catch{}me(!1)}};b.useEffect(()=>{Q==="providers"&&Ve.length===0&&ft()},[Q]);const It=async(v,B,ie)=>{J(`${v}.${B}`),Ie(ke=>ke.map(Ge=>Ge.type===v?{...Ge,values:{...Ge.values,[B]:ie}}:Ge));try{const ke=await r(e,"set_provider_setting",{providerType:v,key:B,value:ie});ke!=null&&ke.success||ft()}catch{ft()}J(null)},Ee=s.find(v=>v.id===e&&v.daemonMode),O=Ee?{id:Ee.id,hostname:((_p=Ee.machine)==null?void 0:_p.hostname)||Ee.id,platform:((vp=Ee.machine)==null?void 0:vp.platform)||"unknown",arch:((xp=Ee.machine)==null?void 0:xp.arch)||"",cpus:((yp=Ee.machine)==null?void 0:yp.cpus)||0,totalMem:((bp=Ee.machine)==null?void 0:bp.totalMem)||0,freeMem:((wp=Ee.machine)==null?void 0:wp.freeMem)||0,availableMem:(Sp=Ee.machine)==null?void 0:Sp.availableMem,loadavg:((kp=Ee.machine)==null?void 0:kp.loadavg)||[],uptime:((Cp=Ee.machine)==null?void 0:Cp.uptime)||0,release:((Ep=Ee.machine)==null?void 0:Ep.release)||"",cdpConnected:!!(Ee.ides||[]).some(v=>v.cdpConnected),machineNickname:Ee.machineNickname||null,p2p:Ee.p2p||{available:!1,state:"unavailable",peers:0,screenshotActive:!1},detectedIdes:Ee.detectedIdes||[],managedIdeIds:Ee.managedIdeIds||[],managedCliIds:Ee.managedCliIds||[],workspaces:Ee.workspaces||[],defaultWorkspaceId:Ee.defaultWorkspaceId??Ee.activeWorkspaceId??null,defaultWorkspacePath:Ee.defaultWorkspacePath??Ee.activeWorkspacePath??null,workspaceActivity:Ee.workspaceActivity||[]}:null,ue=(Ee==null?void 0:Ee.availableProviders)||[],M={};for(const v of ue)M[v.type]=v.icon;const j=v=>M[v]||"",V=ue.filter(v=>v.category==="cli"),X=ue.filter(v=>v.category==="acp");b.useEffect(()=>{!A&&V.length>0&&R(V[0].type)},[A,V.length]),b.useEffect(()=>{!P&&X.length>0&&$(X[0].type)},[P,X.length]);const he=s.filter(v=>v.daemonId===e&&!v.daemonMode).filter(v=>!H_(v)&&!U_(v)).map(v=>({id:v.id,type:v.type,version:v.version||"",instanceId:v.instanceId||"",status:v.status,workspace:v.workspace||null,terminals:v.terminals||0,aiAgents:LR(v.aiAgents||v.agents||[]),activeChat:v.activeChat||null,chats:v.chats||[],agentStreams:v.agentStreams||[],cdpConnected:v.cdpConnected||!1,daemonId:e})),ce=s.filter(v=>v.daemonId===e&&H_(v)).map(v=>({id:v.id,type:v.type,cliName:v.cliName||v.type,status:v.status,workspace:v.workspace||"",activeChat:v.activeChat||null,daemonId:e})),ve=s.filter(v=>v.daemonId===e&&U_(v)).map(v=>({id:v.id,type:v.type,acpName:v.cliName||v.type,status:v.status,workspace:v.workspace||"",activeChat:v.activeChat||null,currentModel:v.currentModel,currentPlan:v.currentPlan,daemonId:e})),pe=(O==null?void 0:O.detectedIdes)||[],le=(v,B)=>{a(ie=>[...ie.slice(-100),{timestamp:Date.now(),level:v,message:B}]),setTimeout(()=>{var ie;return(ie=Me.current)==null?void 0:ie.scrollIntoView({behavior:"smooth"})},100)},Te=async v=>{if(!(!e||_)){x(v),le("info",`Launching ${Ar(v)}...`);try{const B=await r(e,"launch_ide",{ideType:v,enableCdp:!0});le(B!=null&&B.success?"info":"error",B!=null&&B.success?`${Ar(v)} launched`:`Failed: ${B==null?void 0:B.error}`)}catch(B){le("error",`Launch error: ${B.message}`)}finally{x(null)}}},_e=async v=>{if(!e)return;const{cliType:B,dir:ie,workspaceId:ke,useDefaultWorkspace:Ge,useHome:yr,argsStr:cr,model:Kr}=v;if(!B){le("warn","Select a CLI or ACP provider first");return}const fb=cr?cr.split(/\s+/).filter(Boolean):void 0,Np=(ie==null?void 0:ie.trim())||(ke?"(saved id)":Ge?"(default workspace)":yr?"(home)":"");le("info",`Launching ${B}${Np?` in ${Np}`:""}${Kr?` (model: ${Kr})`:""}...`);try{const xi={cliType:B,cliArgs:fb,initialModel:Kr||void 0};ie!=null&&ie.trim()?xi.dir=ie.trim():ke?xi.workspaceId=ke:Ge?xi.useDefaultWorkspace=!0:yr&&(xi.useHome=!0);const br=await r(e,"launch_cli",xi),_n=(br==null?void 0:br.result)||br;br!=null&&br.success?(le("info",`${B} launched`),(_n==null?void 0:_n.launchSource)==="home"?le("info","📂 Running in home directory (explicit choice)"):(_n==null?void 0:_n.launchSource)==="defaultWorkspace"&&le("info","📂 Using default workspace (explicit choice)")):(le("error",`Failed: ${(br==null?void 0:br.error)||(_n==null?void 0:_n.error)}`),(br==null?void 0:br.code)==="WORKSPACE_LAUNCH_CONTEXT_REQUIRED"&&Se({cliType:B,argsStr:cr,model:Kr}))}catch(xi){le("error",`Launch error: ${xi.message}`)}},Ye=(v,B,ie,ke)=>{if(e){if(!v){le("warn","Select a provider");return}if(!B.trim()){Se({cliType:v,argsStr:ie,model:ke});return}_e({cliType:v,dir:B,argsStr:ie,model:ke})}},pt=async(v,B,ie)=>{if(e&&window.confirm(`Stop ${v}?
|
|
212
|
+
`})]})}function eI(e){return e.split(":")[0]||""}function tI({renderHeaderActions:e}={}){var Oe,Ve,Ie;const{id:t}=M0(),r=Os(),n=fp(),i=n.ides||[],s=n.connectionStates||{},{sendCommand:o}=gi(),l=b.useMemo(()=>eI(t||""),[t]),a=b.useMemo(()=>i.find(G=>G.id===t),[i,t]),c=(a==null?void 0:a.type)||void 0,d=c?c.charAt(0).toUpperCase()+c.slice(1):"IDE",h=(a==null?void 0:a.activeChat)||null,f=(a==null?void 0:a.agentStreams)||[],p=n.isConnected??!0,m=s[l]||(p?"connected":"new"),g=b.useMemo(()=>i.find(G=>G.id===l||G.daemonId===l),[i,l]),S=(g==null?void 0:g.machineNickname)||((Oe=g==null?void 0:g.machine)==null?void 0:Oe.hostname)||"",_=(a==null?void 0:a.workspace)||"",[x]=A0(),w=typeof window<"u"&&window.innerWidth<=768,N=x.get("view")||(w?"chat":"split"),[L,C]=b.useState(N),[F,P]=b.useState("ide"),[q,E]=b.useState(""),[A,R]=b.useState(!1),[T,$]=b.useState(null),[z,D]=b.useState(null),[H,I]=b.useState([]),W=h==null?void 0:h.status,y=(((Ie=(Ve=h==null?void 0:h.activeModal)==null?void 0:Ve.buttons)==null?void 0:Ie.length)??0)>0,J=W==="generating"||W==="loading"||W&&W.toLowerCase()==="thinking",k=y||W==="waiting_approval"?"waiting_approval":J?"working":W||"idle",we=b.useMemo(()=>{var G,me;return{ideId:t||"",daemonId:l,agentName:Ad(c||""),agentType:c||"",status:k,title:(h==null?void 0:h.title)||"",messages:(h==null?void 0:h.messages)||[],ideType:c||"",workspaceName:(a==null?void 0:a.workspaceName)||"",displayPrimary:d,displaySecondary:(a==null?void 0:a.workspaceName)||"",cdpConnected:!0,modalButtons:(G=h==null?void 0:h.activeModal)==null?void 0:G.buttons,modalMessage:(me=h==null?void 0:h.activeModal)==null?void 0:me.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,h,a,d,k]);b.useEffect(()=>l?dr.onScreenshot("ide-page",(me,Re)=>{if(me!==l)return;const Q=new FileReader;Q.onload=()=>$(Q.result),Q.readAsDataURL(Re)}):void 0,[l]),b.useEffect(()=>l?dr.onStatusEvent((me,Re)=>{if(me!==l)return;let Q="",oe="info";if(Re.event==="agent:generating_completed"?(Q=`✅ Task completed${Re.duration?` (${Re.duration}s)`:""}`,oe="success"):(Re.event==="agent:waiting_approval"||Re.event==="agent:approval_requested")&&(Q="⚡ Approval needed",oe="warning"),Q){const Fe=Date.now();I(Ne=>[...Ne.slice(-4),{id:Fe,message:Q,type:oe}]),setTimeout(()=>I(Ne=>Ne.filter(ze=>ze.id!==Fe)),oe==="warning"?1e4:5e3)}}):void 0,[l]);const U=b.useMemo(()=>{if(!t)return c;const G=t.split(":");return G.length>=3&&G[1]==="ide"?G.slice(2).join(":"):c},[t,c]);b.useEffect(()=>{const G=l?dr.get(l):null;!G||!(m==="connected")||(L!=="chat"&&U?G.startScreenshots(U):G.stopScreenshots(U))},[L,m,U,l]);const Y=b.useCallback(async(G,me={})=>{if(!t)throw new Error("No IDE ID");const Re={...me};if(!Re._targetInstance&&t){const oe=t.split(":");oe.length>=3&&(oe[1]==="ide"||oe[1]==="cli")&&(Re._targetInstance=oe.slice(2).join(":"),Re._targetType=oe[1])}const Q=l?dr.get(l):null;return Q!=null&&Q.hasCommandChannel?await Q.sendCommand(G,Re):Q&&Q.connectionState!=="failed"&&Q.connectionState!=="closed"&&await new Promise(Fe=>{const We=Date.now(),Ne=()=>{if(Q.hasCommandChannel)return Fe(!0);if(Date.now()-We>3e3)return Fe(!1);setTimeout(Ne,200)};Ne()})&&Q.hasCommandChannel?await Q.sendCommand(G,Re):await o(t,G,Re)},[t,l]),te=async()=>{const G=q.trim();if(!(!G||!t||A)){E(""),R(!0);try{await Y("send_chat",{message:G,waitForResponse:!0})}catch(me){console.error("[IDE] Send failed:",me)}finally{R(!1)}}},fe=async G=>{if(t)try{const me=await o(t,"screenshot",{width:G?Math.min(G,1280):1280});me!=null&&me.success&&(me!=null&&me.base64)&&D(`data:image/jpeg;base64,${me.base64}`)}catch(me){console.error("[IDE] Screenshot failed:",me)}},de=f.length>0;return t?u.jsxs("div",{className:"ide-page",children:[u.jsxs("header",{className:"ide-header",children:[u.jsxs("div",{className:"ide-header-left",children:[u.jsxs("div",{className:"ide-title",children:[u.jsx(Xa,{size:16}),u.jsx("span",{className:"ide-name",children:d}),u.jsx("span",{className:"ide-name-mobile",children:"IDE"}),_&&u.jsx("span",{className:"ide-workspace",children:_}),u.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),u.jsxs("div",{className:"ide-status-pill",children:[u.jsx("span",{className:`ide-dot ${m==="connected"?"online":"connecting"}`}),u.jsx("span",{className:"ide-status-text",children:m==="connected"?"Connected":m==="connecting"?"Connecting":"WS"})]}),S&&u.jsx("span",{className:"ide-machine-label",children:S})]}),u.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(G=>u.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:L===G?"1px solid var(--accent-primary)":"none",background:L===G?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:L===G?"var(--accent-primary)":void 0},onClick:()=>C(G),children:G==="chat"?u.jsx(Xa,{size:14}):G==="split"?"⊞":u.jsx(Ro,{size:14})},G)),e&&e({daemonId:l,ideInstanceId:t||""}),u.jsxs("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs flex items-center justify-center shrink-0",onClick:()=>r(-1),children:["←",u.jsx("span",{className:"hidden md:inline ml-1",children:"Back"})]})]})]}),u.jsxs("div",{className:"ide-content",children:[u.jsxs("div",{className:`ide-chat-panel ${L==="chat"?"full":""} ${L==="remote"?"hidden":""}`,children:[de&&u.jsxs("div",{className:"ide-chat-tabs",children:[u.jsx("button",{className:`ide-chat-tab ${F==="ide"?"active":""}`,onClick:()=>P("ide"),children:d}),u.jsxs("button",{className:`ide-chat-tab ext ${F==="extensions"?"active":""}`,onClick:()=>P("extensions"),children:["Extensions ",u.jsx("span",{className:"ide-ext-badge",children:f.length})]})]}),F==="extensions"&&de?u.jsx(iT,{ideId:t,agentStreams:f,sendCommand:async(G,me)=>{try{const Re=l?dr.get(l):null;if(Re&&m==="connected"){await Promise.race([Re.sendCommand(G,me),new Promise((Q,oe)=>setTimeout(()=>oe(new Error("connection timeout")),3e3))]);return}}catch{}await o(t,G,me)}}):u.jsx(W1,{activeConv:we,ides:i,agentInput:q,setAgentInput:E,handleSendChat:te,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[],userName:n.userName})]}),u.jsx("div",{className:`ide-remote-panel ${L==="remote"?"full":""} ${L==="chat"?"hidden":""}`,children:u.jsx(SR,{screenshot:z,isCapturing:!1,onRefresh:fe,addLog:()=>{},connState:m,connScreenshot:T,onAction:async(G,me)=>{const Re=l?dr.get(l):null;if(!Re||m!=="connected")return console.warn("[RemoteInput] P2P not connected"),{success:!1,error:"P2P not connected"};const Q=(a==null?void 0:a.instanceId)||U;return await Re.sendInput(G,me,Q)}})})]}),H.length>0&&u.jsx("div",{className:"ide-toasts",children:H.map(G=>u.jsx("div",{className:`ide-toast ${G.type}`,onClick:()=>I(me=>me.filter(Re=>Re.id!==G.id)),children:G.message},G.id))})]}):u.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function rI(e){const t=Math.floor((Date.now()-e)/1e3);return t<45?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function nI(){var _p,vp,xp,yp,bp,wp,Sp,kp,Cp,Ep;const{id:e}=M0(),t=Os(),{sendCommand:r}=gi(),n=r,i=fp(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=b.useState([]),[c,d]=b.useState([]),[h,f]=b.useState(0),[p,m]=b.useState(!0),[g,S]=b.useState("debug"),[_,x]=b.useState(null),[w,N]=b.useState([]),[L,C]=b.useState(!1),[F,P]=b.useState(""),[q,E]=b.useState(""),[A,R]=b.useState(""),[T,$]=b.useState(""),[z,D]=b.useState(""),[H,I]=b.useState(""),[W,y]=b.useState(""),[J,ae]=b.useState("overview"),[k,we]=b.useState([]),[U,Y]=b.useState(!1),[te,fe]=b.useState(!1),[de,Oe]=b.useState(""),[Ve,Ie]=b.useState([]),[G,me]=b.useState(!1),[Re,Q]=b.useState(null),[oe,Fe]=b.useState("all"),[We,Ne]=b.useState(""),[ze,Te]=b.useState(!1),[qe,Mt]=b.useState({}),[Mr,K]=b.useState(null),[ne,Se]=b.useState(null),Me=b.useRef(null),$e=b.useRef(!1);b.useEffect(()=>{if(!e||J!=="logs"||!p)return;const v=async()=>{try{const ie=await r(e,"get_logs",{count:200,minLevel:g,since:h}),ke=(ie==null?void 0:ie.result)||ie;if(ie!=null&&ie.success&&Array.isArray(ke==null?void 0:ke.logs)&&ke.logs.length>0){d(yr=>[...yr,...ke.logs.map(Kr=>({timestamp:Kr.ts,level:Kr.level,message:`[${Kr.category}] ${Kr.message}`}))].slice(-300));const Ge=Math.max(...ke.logs.map(yr=>yr.ts));f(Ge)}}catch{}};v();const B=setInterval(v,3e3);return()=>clearInterval(B)},[e,J,p,h,g]),b.useEffect(()=>{if(p&&c.length>0){const v=$e.current?"smooth":"instant";setTimeout(()=>{var B;(B=Me.current)==null||B.scrollIntoView({behavior:v}),$e.current=!0},50)}},[c.length,l.length,p]),b.useEffect(()=>{J!=="logs"&&($e.current=!1)},[J]),b.useEffect(()=>{if(!e||J!=="ides")return;(async()=>{try{const B=await r(e,"get_ide_extensions",{}),ie=(B==null?void 0:B.result)||B;ie!=null&&ie.success&&(ie!=null&&ie.ides)&&Mt(ie.ides)}catch{}})()},[e,J]);const ft=async()=>{var v;if(e){me(!0);try{const B=await r(e,"get_provider_settings",{}),ie=(B==null?void 0:B.result)||B;if(B!=null&&B.success&&(ie!=null&&ie.settings)){const ke=[];for(const[Ge,yr]of Object.entries(ie.settings)){const cr=ue.find(Kr=>Kr.type===Ge);ke.push({type:Ge,displayName:(cr==null?void 0:cr.displayName)||Ge,icon:(cr==null?void 0:cr.icon)||"",category:(cr==null?void 0:cr.category)||"unknown",schema:yr,values:((v=ie.values)==null?void 0:v[Ge])||{}})}ke.sort((Ge,yr)=>Ge.category.localeCompare(yr.category)||Ge.displayName.localeCompare(yr.displayName)),Ie(ke)}}catch{}me(!1)}};b.useEffect(()=>{J==="providers"&&Ve.length===0&&ft()},[J]);const It=async(v,B,ie)=>{Q(`${v}.${B}`),Ie(ke=>ke.map(Ge=>Ge.type===v?{...Ge,values:{...Ge.values,[B]:ie}}:Ge));try{const ke=await r(e,"set_provider_setting",{providerType:v,key:B,value:ie});ke!=null&&ke.success||ft()}catch{ft()}Q(null)},Ee=s.find(v=>v.id===e&&v.daemonMode),O=Ee?{id:Ee.id,hostname:((_p=Ee.machine)==null?void 0:_p.hostname)||Ee.id,platform:((vp=Ee.machine)==null?void 0:vp.platform)||"unknown",arch:((xp=Ee.machine)==null?void 0:xp.arch)||"",cpus:((yp=Ee.machine)==null?void 0:yp.cpus)||0,totalMem:((bp=Ee.machine)==null?void 0:bp.totalMem)||0,freeMem:((wp=Ee.machine)==null?void 0:wp.freeMem)||0,availableMem:(Sp=Ee.machine)==null?void 0:Sp.availableMem,loadavg:((kp=Ee.machine)==null?void 0:kp.loadavg)||[],uptime:((Cp=Ee.machine)==null?void 0:Cp.uptime)||0,release:((Ep=Ee.machine)==null?void 0:Ep.release)||"",cdpConnected:!!(Ee.ides||[]).some(v=>v.cdpConnected),machineNickname:Ee.machineNickname||null,p2p:Ee.p2p||{available:!1,state:"unavailable",peers:0,screenshotActive:!1},detectedIdes:Ee.detectedIdes||[],managedIdeIds:Ee.managedIdeIds||[],managedCliIds:Ee.managedCliIds||[],workspaces:Ee.workspaces||[],defaultWorkspaceId:Ee.defaultWorkspaceId??Ee.activeWorkspaceId??null,defaultWorkspacePath:Ee.defaultWorkspacePath??Ee.activeWorkspacePath??null,workspaceActivity:Ee.workspaceActivity||[]}:null,ue=(Ee==null?void 0:Ee.availableProviders)||[],M={};for(const v of ue)M[v.type]=v.icon;const j=v=>M[v]||"",V=ue.filter(v=>v.category==="cli"),X=ue.filter(v=>v.category==="acp");b.useEffect(()=>{!A&&V.length>0&&R(V[0].type)},[A,V.length]),b.useEffect(()=>{!T&&X.length>0&&$(X[0].type)},[T,X.length]);const he=s.filter(v=>v.daemonId===e&&!v.daemonMode).filter(v=>!H_(v)&&!U_(v)).map(v=>({id:v.id,type:v.type,version:v.version||"",instanceId:v.instanceId||"",status:v.status,workspace:v.workspace||null,terminals:v.terminals||0,aiAgents:LR(v.aiAgents||v.agents||[]),activeChat:v.activeChat||null,chats:v.chats||[],agentStreams:v.agentStreams||[],cdpConnected:v.cdpConnected||!1,daemonId:e})),ce=s.filter(v=>v.daemonId===e&&H_(v)).map(v=>({id:v.id,type:v.type,cliName:v.cliName||v.type,status:v.status,workspace:v.workspace||"",activeChat:v.activeChat||null,daemonId:e})),ve=s.filter(v=>v.daemonId===e&&U_(v)).map(v=>({id:v.id,type:v.type,acpName:v.cliName||v.type,status:v.status,workspace:v.workspace||"",activeChat:v.activeChat||null,currentModel:v.currentModel,currentPlan:v.currentPlan,daemonId:e})),pe=(O==null?void 0:O.detectedIdes)||[],le=(v,B)=>{a(ie=>[...ie.slice(-100),{timestamp:Date.now(),level:v,message:B}]),setTimeout(()=>{var ie;return(ie=Me.current)==null?void 0:ie.scrollIntoView({behavior:"smooth"})},100)},Pe=async v=>{if(!(!e||_)){x(v),le("info",`Launching ${Ar(v)}...`);try{const B=await r(e,"launch_ide",{ideType:v,enableCdp:!0});le(B!=null&&B.success?"info":"error",B!=null&&B.success?`${Ar(v)} launched`:`Failed: ${B==null?void 0:B.error}`)}catch(B){le("error",`Launch error: ${B.message}`)}finally{x(null)}}},_e=async v=>{if(!e)return;const{cliType:B,dir:ie,workspaceId:ke,useDefaultWorkspace:Ge,useHome:yr,argsStr:cr,model:Kr}=v;if(!B){le("warn","Select a CLI or ACP provider first");return}const fb=cr?cr.split(/\s+/).filter(Boolean):void 0,Np=(ie==null?void 0:ie.trim())||(ke?"(saved id)":Ge?"(default workspace)":yr?"(home)":"");le("info",`Launching ${B}${Np?` in ${Np}`:""}${Kr?` (model: ${Kr})`:""}...`);try{const xi={cliType:B,cliArgs:fb,initialModel:Kr||void 0};ie!=null&&ie.trim()?xi.dir=ie.trim():ke?xi.workspaceId=ke:Ge?xi.useDefaultWorkspace=!0:yr&&(xi.useHome=!0);const br=await r(e,"launch_cli",xi),_n=(br==null?void 0:br.result)||br;br!=null&&br.success?(le("info",`${B} launched`),(_n==null?void 0:_n.launchSource)==="home"?le("info","📂 Running in home directory (explicit choice)"):(_n==null?void 0:_n.launchSource)==="defaultWorkspace"&&le("info","📂 Using default workspace (explicit choice)")):(le("error",`Failed: ${(br==null?void 0:br.error)||(_n==null?void 0:_n.error)}`),(br==null?void 0:br.code)==="WORKSPACE_LAUNCH_CONTEXT_REQUIRED"&&Se({cliType:B,argsStr:cr,model:Kr}))}catch(xi){le("error",`Launch error: ${xi.message}`)}},Ye=(v,B,ie,ke)=>{if(e){if(!v){le("warn","Select a provider");return}if(!B.trim()){Se({cliType:v,argsStr:ie,model:ke});return}_e({cliType:v,dir:B,argsStr:ie,model:ke})}},pt=async(v,B,ie)=>{if(e&&window.confirm(`Stop ${v}?
|
|
213
213
|
This will terminate the process.`))try{const ke=await r(e,"stop_cli",{cliType:v,dir:B,_targetInstance:ie});ke!=null&&ke.success?le("info",`${v} stopped`):le("error",`Stop failed: ${(ke==null?void 0:ke.error)||"Unknown error"}`)}catch(ke){le("error",`Stop failed: ${ke.message}`)}},Ct=async v=>{try{await r(v.daemonId,"restart_ide",{ideType:v.type}),le("info",`${Ar(v.type)} restart initiated`)}catch(B){le("error",`Restart failed: ${B.message}`)}},ar=async v=>{if(window.confirm(`Stop ${Ar(v.type)}?
|
|
214
|
-
This will disconnect CDP and optionally kill the process.`))try{const B=await r(v.daemonId,"stop_ide",{ideType:v.type,killProcess:!0});B!=null&&B.success?le("info",`${Ar(v.type)} stopped`):le("error",`Stop failed: ${(B==null?void 0:B.error)||"Unknown error"}`)}catch(B){le("error",`Stop failed: ${B.message}`)}},Zt=async()=>{if(e)try{const v=await r(e,"detect_ides",{});le("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){le("error",`Detection failed: ${v.message}`)}},xr=async()=>{if(e){C(!0);try{const v=await r(e,"get_recent_workspaces",{});v!=null&&v.success&&Array.isArray(v==null?void 0:v.result)&&N(v.result)}catch(v){le("error",`Failed: ${v.message}`)}finally{C(!1)}}},Ji=async()=>{if(!(!e||!We.trim())){Pe(!0);try{const v=await r(e,"workspace_add",{path:We.trim()});v!=null&&v.success?(le("info",`Workspace added: ${We.trim()}`),Ne("")):le("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){le("error",v.message)}finally{Pe(!1)}}},Mc=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){Pe(!0);try{const B=await r(e,"workspace_remove",{id:v});B!=null&&B.success?le("info","Workspace removed"):le("error",(B==null?void 0:B.error)||"workspace_remove failed")}catch(B){le("error",B.message)}finally{Pe(!1)}}},Ic=async v=>{if(e){Pe(!0);try{const B=await r(e,"workspace_set_default",v===null?{clear:!0}:{id:v});if(B!=null&&B.success){le("info",v?"Default workspace updated":"Default workspace cleared");const ie=typeof B.defaultWorkspacePath=="string"?B.defaultWorkspacePath:"";ie&&(T(ie),D(ie))}else le("error",(B==null?void 0:B.error)||"workspace_set_default failed")}catch(B){le("error",B.message)}finally{Pe(!1)}}},Dc=async v=>{if(!e||!v.trim())return;const B=v.trim();Pe(!0);try{const ie=await r(e,"workspace_set_default",{path:B});ie!=null&&ie.success?(le("info","Default workspace set from history"),T(B),D(B)):le("error",(ie==null?void 0:ie.error)||"Could not set default (path missing on disk?)")}catch(ie){le("error",ie.message)}finally{Pe(!1)}},On=b.useCallback(async()=>{var v;if(e){Y(!0);try{let B=await r(e,"get_cli_history",{});B!=null&&B.success||(B=await n(e,"get_cli_history"));const ie=(B==null?void 0:B.history)??((v=B==null?void 0:B.result)==null?void 0:v.history);B!=null&&B.success&&Array.isArray(ie)&&we(ie)}catch{}Y(!1)}},[e,r,n]);b.useEffect(()=>{Q==="overview"&&e&&On()},[Q,e,On]);const pp=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:de}),le("info",`Nickname set to "${de||"(cleared)"}"`),fe(!1)}catch(v){le("error",`Failed: ${v.message}`)}};if(!O)return o?u.jsxs("div",{className:"p-10 text-center text-text-muted",children:[u.jsx("h2",{className:"text-text-primary",children:"Machine not found"}),u.jsx("p",{className:"mt-3",children:"The machine may be offline or not yet connected."}),u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):u.jsx("div",{className:"p-10 text-center text-text-muted",children:u.jsx("p",{children:"⏳ Loading machine..."})});const mp=O.availableMem??O.freeMem,cb=O.totalMem>0?Math.min(100,Math.max(0,Math.round((O.totalMem-mp)/O.totalMem*100))):0,gp=O.loadavg[0]||0,ub=O.machineNickname||O.hostname,hb=(v,B,ie)=>{const ke=ue.find(yr=>yr.type===v),Ge=(ie||[]).join(" ");(ke==null?void 0:ke.category)==="acp"?($(v),D(B),y(Ge),ae("acps")):(R(v),T(B),E(Ge),ae("clis"))},db=[{id:"overview",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Y3,{size:14})," Overview"]})},{id:"ides",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Ro,{size:14})," IDEs"]}),count:he.length},{id:"clis",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Yy,{size:14})," CLIs"]}),count:ce.length},{id:"acps",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Q3,{size:14})," ACP Agents"]}),count:ve.length},{id:"providers",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Ky,{size:14})," Providers"]}),count:Ve.length>0?Ve.length:void 0},{id:"logs",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(W3,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsxs("div",{className:"dashboard-header !flex-col !items-stretch",children:[u.jsx("div",{className:"flex items-center justify-between w-full",children:u.jsxs("div",{className:"flex items-center gap-2 md:gap-3.5 w-full min-w-0",children:[u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back flex shrink-0",children:"←"}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[te?u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsx("input",{autoFocus:!0,value:de,onChange:v=>Oe(v.target.value),onKeyDown:v=>{v.key==="Enter"&&pp(),v.key==="Escape"&&fe(!1)},placeholder:"Machine nickname...",className:"px-2.5 py-1 rounded-md border border-violet-500/30 bg-bg-secondary text-text-primary text-sm font-semibold w-[140px] md:w-[200px]"}),u.jsx("button",{onClick:pp,className:"machine-btn text-green-500 border-green-500/30 shrink-0",children:"✓"}),u.jsx("button",{onClick:()=>fe(!1),className:"machine-btn shrink-0",children:"✕"})]}):u.jsx("h1",{className:"header-title cursor-pointer truncate",onClick:()=>{fe(!0),Oe(O.machineNickname||"")},title:"Click to set nickname",children:ub}),u.jsx("span",{className:"status-dot-md online shrink-0"})]}),u.jsxs("div",{className:"header-subtitle mt-1 flex-wrap gap-1 md:gap-2 items-center display-none-mobile",children:[u.jsxs("span",{children:[O.platform," · ",O.arch," · ",O.cpus," cores"]}),O.p2p.available&&u.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:O.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:O.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",O.p2p.state==="connected"?`● ${O.p2p.peers}`:"○"]}),O.cdpConnected&&u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500 shrink-0",children:"CDP ●"}),O.machineNickname&&u.jsxs("span",{className:"text-text-muted opacity-80 shrink-0",children:["(",O.hostname,")"]})]})]})]})}),u.jsx("div",{className:"machine-tabs w-full overflow-x-auto overflow-y-hidden pb-1 -mb-1 mt-2",children:db.map(v=>u.jsxs("button",{onClick:()=>ae(v.id),className:`machine-tab shrink-0${Q===v.id?" active":""}`,children:[v.label,v.count!==void 0&&u.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),u.jsxs("div",{className:"page-content",children:[Q==="overview"&&u.jsxs("div",{children:[u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[u.jsx($_,{icon:u.jsx(Ug,{size:16}),label:"Uptime",value:PR(O.uptime)}),u.jsx($_,{icon:u.jsx(Ro,{size:16}),label:"IDEs",value:`${he.length}`,sub:`${ce.length} CLIs`})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),u.jsxs("div",{className:"flex gap-6",children:[u.jsx(F_,{value:Math.min(Math.round(gp/O.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${gp.toFixed(2)} avg / ${O.cpus} cores`}),u.jsx(F_,{value:cb,max:100,label:"Memory",color:"#3b82f6",detail:`${W_(O.totalMem-mp)} / ${W_(O.totalMem)}${O.platform==="darwin"?" (approx.)":""}`})]})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," Workspaces"]})}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:["One list for IDE, CLI, and ACP: saved paths below, and a single ",u.jsx("strong",{className:"text-text-secondary font-medium",children:"default"}),'. The default opens in the IDE when you launch it, pre-fills CLI/ACP directories, and is what "Default" launch uses.']}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-3",children:[u.jsx("span",{className:"text-[10px] text-text-muted",children:"Default:"}),u.jsxs("select",{className:"text-xs bg-bg-primary border border-border-subtle rounded-lg px-2 py-1 max-w-[min(100%,420px)]",disabled:ze,value:O.defaultWorkspaceId||"",onChange:v=>{const B=v.target.value;Ic(B===""?null:B)},children:[u.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(O.workspaces||[]).map(v=>u.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),O.defaultWorkspacePath&&u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:O.defaultWorkspacePath,children:O.defaultWorkspacePath})]}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[u.jsx("input",{className:"flex-1 min-w-[200px] text-xs bg-bg-primary border border-border-subtle rounded-lg px-2.5 py-1.5",placeholder:"Absolute workspace path to add…",value:We,disabled:ze,onChange:v=>Ne(v.target.value),onKeyDown:v=>v.key==="Enter"&&void Ji()}),u.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:ze,onClick:()=>void Ji(),children:"Add"})]}),(O.workspaces||[]).length>0&&u.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(O.workspaces||[]).map(v=>u.jsxs("li",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[u.jsx("span",{className:"font-mono truncate flex-1",title:v.path,children:v.path}),u.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:ze,onClick:()=>void Mc(v.id),children:"Remove"})]},v.id))})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle border-violet-500/15",children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1 flex items-center gap-1.5",children:[u.jsx(Ug,{size:14})," Pick up where you left off"]}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:"Same workspaces as above. Re-run CLI/ACP, or open CLIs/ACP tab with a path filled; IDE launch uses the default automatically when set."}),u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent CLI / ACP launches"}),k.length>0?u.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:k.slice(0,10).map((v,B)=>{const ie=v.label||`${v.cliType} · ${(v.dir||"").split("/").filter(Boolean).pop()||v.dir||"?"}`;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsxs("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,240px)]",title:v.dir,children:[j(v.cliType)," ",ie]}),u.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:v.dir,children:v.dir}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void _e({cliType:v.cliType,dir:v.dir,argsStr:(v.cliArgs||[]).join(" ")}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>hb(v.cliType,v.dir,v.cliArgs),children:"Open tab…"})]})]},`${v.cliType}-${v.dir}-${v.timestamp}-${B}`)})}):u.jsx("p",{className:"text-[11px] text-text-muted mb-4",children:"No launch history yet — start a CLI or ACP from the tabs below, then return here."}),(O.workspaceActivity||[]).length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent workspace paths"}),u.jsx("div",{className:"flex flex-col gap-1.5",children:(O.workspaceActivity||[]).slice(0,12).map(v=>{const B=v.path.split("/").filter(Boolean).pop()||v.path,ie=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="default"||v.kind==="active"?"●":"",ke=(v.kind==="cli"||v.kind==="acp")&&!!v.agentType;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsx("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,200px)]",title:v.path,children:B}),ie&&u.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:ie}),v.agentType&&u.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),u.jsx("span",{className:"text-[9px] text-text-muted",children:rI(v.lastUsedAt)}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[ke&&u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void _e({cliType:v.agentType,dir:v.path}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{T(v.path),D(v.path),ae("clis")},children:"CLIs tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{T(v.path),D(v.path),ae("acps")},children:"ACP tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:ze,onClick:()=>void Dc(v.path),children:"Set default"})]})]},`${v.path}-${v.lastUsedAt}`)})})]})]}),u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"IDEs"}),u.jsx("button",{onClick:()=>ae("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),he.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No IDEs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:he.map(v=>{var ie;const B=(v.agentStreams||[]).some(ke=>ke.status==="generating"||ke.status==="streaming")||((ie=v.activeChat)==null?void 0:ie.status)==="generating";return u.jsxs("div",{onClick:()=>t(`/ide/${v.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${B?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[u.jsx("span",{children:j(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:Ar(v.type)}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace||""}),B&&u.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),u.jsx("span",{className:`${B?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:B?"#fb923c":"#22c55e",boxShadow:B?"0 0 8px rgba(249,115,22,0.4)":"none",animation:B?"pulse-dot 1.5s infinite":"none"}})]},v.id)})})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"CLIs"}),u.jsx("button",{onClick:()=>ae("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),ce.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:ce.map(v=>u.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-glass",children:[u.jsx("span",{children:j(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace.split("/").pop()}),u.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),O.detectedIdes.length>0&&u.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),u.jsx("div",{className:"flex flex-wrap gap-1.5",children:O.detectedIdes.map(v=>u.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${v.running?"bg-green-500/[0.06] border border-green-500/[0.12] text-green-300":"bg-bg-glass border border-border-subtle text-text-muted"}`,children:[u.jsx("span",{children:j(v.type)}),v.name||v.type,u.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),Q==="ides"&&u.jsxs("div",{children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",he.length,")"]}),he.length===0?u.jsx("div",{className:"py-10 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No IDEs currently running. Launch one below."}):u.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:he.map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsx("span",{className:"font-semibold text-sm text-text-primary",children:Ar(v.type)}),v.version&&u.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.version]}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),u.jsxs("div",{className:"flex gap-1.5",children:[u.jsxs("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[u.jsx(Ro,{size:13})," Control"]}),u.jsx("button",{onClick:()=>Ct(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"}),u.jsx("button",{onClick:()=>ar(v),className:"machine-btn text-red-400 border-red-500/30",children:"■ Stop"})]})]}),u.jsxs("div",{className:"text-xs text-text-secondary mb-2",children:[u.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",v.workspace||"—"]}),v.aiAgents.length>0&&u.jsx("div",{className:"flex gap-1 mb-2 flex-wrap",children:v.aiAgents.map(B=>u.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${B.status==="generating"||B.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[B.name," · ",B.status]},B.id))}),(qe[v.type]||[]).length>0&&u.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:[u.jsx("div",{className:"text-[10px] text-text-muted font-semibold uppercase tracking-wider mb-1.5",children:"Extensions"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:(qe[v.type]||[]).map(B=>u.jsxs("button",{disabled:Mr===`${v.type}.${B.type}`,onClick:async()=>{const ie=`${v.type}.${B.type}`;K(ie);try{await r(e,"set_ide_extension",{ideType:v.type,extensionType:B.type,enabled:!B.enabled}),Mt(ke=>({...ke,[v.type]:(ke[v.type]||[]).map(Ge=>Ge.type===B.type?{...Ge,enabled:!Ge.enabled}:Ge)}))}catch(ke){console.error("Extension toggle failed:",ke)}finally{K(null)}},className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-medium border transition-colors duration-150 cursor-pointer ${B.enabled?"bg-violet-500/[0.08] border-violet-500/20 text-violet-400":"bg-bg-glass border-border-subtle text-text-muted"}`,children:[u.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${B.enabled?"bg-violet-400 shadow-[0_0_4px_rgba(139,92,246,0.4)]":"bg-zinc-600"}`}),B.name,u.jsx("span",{className:"text-[9px] font-normal",children:B.enabled?"ON":"OFF"})]},B.type))})]})]},v.id))}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",pe.length,")"]}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:[O.defaultWorkspacePath?`Opens in default workspace: ${O.defaultWorkspacePath.split("/").filter(Boolean).pop()||O.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."," ","Multi-window supported — running IDEs can be launched again as a new window."]}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[pe.map(v=>{const B=v.running||he.some(ie=>(ie.type||"").toLowerCase()===(v.type||"").toLowerCase());return u.jsxs("button",{onClick:()=>Te(v.type||v.id||""),disabled:!!_,className:`machine-btn-primary flex items-center gap-1.5 ${B?"!border-green-500/30":""}`,style:{opacity:_&&_!==v.type?.4:1},children:[u.jsx("span",{children:j(v.type)}),B&&u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_4px_rgba(34,197,94,0.4)]"}),_===v.type?"⏳ Launching...":`▶ ${v.name||Ar(v.type)}`,B&&u.jsx("span",{className:"text-[9px] text-green-400 font-normal",children:"+ window"})]},v.type)}),pe.length===0&&u.jsxs("div",{className:"text-xs text-text-muted italic",children:["No IDEs detected.",u.jsxs("button",{onClick:Zt,className:"machine-btn ml-2 flex items-center gap-1",children:[u.jsx(V3,{size:12})," Scan"]})]})]})]}),Q==="clis"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch New CLI"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:A,onChange:v=>R(v.target.value),className:"machine-input",children:V.length>0?V.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:F,onChange:v=>T(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:q,onChange:v=>E(v.target.value),className:"machine-input min-w-[150px]"}),u.jsx("button",{onClick:()=>Ye(A,F,q||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(O!=null&&O.defaultWorkspacePath),title:O!=null&&O.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void _e({cliType:A,useDefaultWorkspace:!0,argsStr:q||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void _e({cliType:A,useHome:!0,argsStr:q||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ce.length,")"]}),ce.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:ce.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),u.jsx("div",{className:"text-[11px] text-text-muted",children:v.workspace})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),v.status==="stopped"?u.jsx("button",{onClick:()=>Ye(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"History"}),u.jsx("button",{onClick:On,disabled:U,className:"machine-btn",children:U?"⏳":"↻ Load"})]}),k.length>0&&u.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,B)=>{var ie,ke;return u.jsxs("div",{onClick:()=>{R(v.cliType),T(v.dir),E((v.cliArgs||[]).join(" "))},className:"flex justify-between items-center px-2.5 py-1.5 rounded-md cursor-pointer bg-bg-glass border border-border-subtle text-xs transition-[background] duration-150",onMouseEnter:Ge=>Ge.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:Ge=>Ge.currentTarget.style.background="var(--bg-glass)",children:[u.jsxs("div",{className:"flex gap-1.5 items-center text-text-secondary",children:[u.jsx("span",{children:j(v.cliType)}),u.jsx("span",{children:((ie=v.dir)==null?void 0:ie.split("/").filter(Boolean).pop())||"root"}),((ke=v.cliArgs)==null?void 0:ke.length)>0&&u.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),u.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},B)})}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:L,className:"machine-btn",children:L?"⏳":"↻ Load"})]}),w.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((v,B)=>u.jsx("button",{onClick:()=>T(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Mo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),Q==="acps"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch ACP Agent"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:P,onChange:v=>$(v.target.value),className:"machine-input",children:X.length>0?X.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or picker / Default / Home)",value:z,onChange:v=>D(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Model (default)",value:H,onChange:v=>I(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:W,onChange:v=>y(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("button",{onClick:()=>Ye(P,z,W||void 0,H||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(O!=null&&O.defaultWorkspacePath),title:O!=null&&O.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void _e({cliType:P,useDefaultWorkspace:!0,argsStr:W||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void _e({cliType:P,useHome:!0,argsStr:W||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ve.length,")"]}),ve.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No ACP agents running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:ve.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),u.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[u.jsx("span",{children:v.workspace}),v.currentModel&&u.jsxs("span",{className:"text-cyan-500",children:["🤖 ",v.currentModel]}),v.currentPlan&&u.jsxs("span",{className:"text-amber-500",children:["📋 ",v.currentPlan]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":v.status==="generating"?"bg-orange-500/[0.08] text-orange-400":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),u.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:u.jsx(Xa,{size:14})}),v.status==="stopped"?u.jsx("button",{onClick:()=>Ye(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:L,className:"machine-btn",children:L?"⏳":"↻ Load"})]}),w.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((v,B)=>u.jsx("button",{onClick:()=>D(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Mo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),Q==="providers"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-4",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(v=>u.jsx("button",{onClick:()=>Fe(v),className:`machine-btn text-[10px] px-2 py-0.5 ${oe===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsx("button",{onClick:ft,disabled:G,className:"machine-btn",children:G?"⏳ Loading...":"↻ Refresh"})]}),G&&Ve.length===0?u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading provider settings..."}):u.jsx("div",{className:"flex flex-col gap-2",children:Ve.filter(v=>oe==="all"||v.category===oe).map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-lg",children:v.icon}),u.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:v.category==="acp"?"rgba(139,92,246,0.08)":v.category==="cli"?"rgba(59,130,246,0.08)":v.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:v.category==="acp"?"#a78bfa":v.category==="cli"?"#60a5fa":v.category==="ide"?"#86efac":"#fbbf24"},children:v.category})]}),u.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(B=>u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"text-xs font-medium text-text-primary",children:[B.label||B.key,Re===`${v.type}.${B.key}`&&u.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),B.description&&u.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:B.description})]}),u.jsx("div",{className:"shrink-0",children:B.type==="boolean"?u.jsx("button",{onClick:()=>It(v.type,B.key,!(v.values[B.key]??B.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[B.key]??B.default?"#8b5cf6":"var(--border-subtle)"},children:u.jsx("div",{className:"w-4 h-4 rounded-full bg-white absolute top-[3px] transition-[left] duration-200 shadow-[0_1px_3px_rgba(0,0,0,0.3)]",style:{left:v.values[B.key]??B.default?21:3}})}):B.type==="number"?u.jsx("input",{type:"number",value:v.values[B.key]??B.default??0,min:B.min,max:B.max,onChange:ie=>{const ke=parseInt(ie.target.value)||0;B.min!==void 0&&ke<B.min||B.max!==void 0&&ke>B.max||It(v.type,B.key,ke)},className:"machine-input w-20 text-center text-[11px]"}):B.type==="select"&&B.options?u.jsx("select",{value:v.values[B.key]??B.default??"",onChange:ie=>It(v.type,B.key,ie.target.value),className:"machine-input text-[11px]",children:B.options.map(ie=>u.jsx("option",{value:ie,children:ie},ie))}):u.jsx("input",{type:"text",value:v.values[B.key]??B.default??"",onBlur:ie=>It(v.type,B.key,ie.target.value),className:"machine-input w-[120px] text-[11px]"})})]},B.key))})]},v.type))})]}),Q==="logs"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-3",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(v=>u.jsx("button",{onClick:()=>{S(v),d([]),f(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${g===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),u.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"⏸ Pause":"▶ Resume"}),u.jsx("button",{onClick:()=>{d([]),f(0)},className:"machine-btn",children:"Clear"})]})]}),u.jsxs("div",{className:"bg-bg-secondary border border-border-subtle rounded-xl p-3 min-h-[200px] max-h-[500px] overflow-y-auto font-mono text-[11px] leading-relaxed",children:[c.length===0&&u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,B)=>u.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[u.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),u.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#475569":"#8b5cf6"},children:v.level==="error"?"ERR":v.level==="warn"?"WRN":v.level==="debug"?"DBG":"INF"}),u.jsx("span",{children:v.message})]},B)),u.jsx("div",{ref:Me})]})]})]}),ne&&O&&u.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/55 backdrop-blur-[2px]",role:"dialog","aria-modal":"true","aria-labelledby":"launch-pick-title",children:u.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border-subtle bg-bg-secondary shadow-xl p-5",children:[u.jsx("h2",{id:"launch-pick-title",className:"text-sm font-semibold text-text-primary m-0 mb-1",children:"Where should this run?"}),u.jsx("p",{className:"text-[11px] text-text-muted m-0 mb-4",children:"Nothing is assumed. Pick a saved workspace, your default workspace, or home — or cancel and type a path."}),u.jsx("div",{className:"flex flex-col gap-2 mb-4 max-h-48 overflow-y-auto",children:(O.workspaces||[]).length===0?u.jsx("span",{className:"text-[11px] text-text-muted",children:"No saved workspaces yet. Add one in Overview or type a path above."}):(O.workspaces||[]).map(v=>u.jsxs("button",{type:"button",className:"text-left text-xs px-3 py-2 rounded-lg border border-border-subtle bg-bg-primary hover:bg-violet-500/[0.08] transition-colors",onClick:()=>{const B=ne;Se(null),_e({cliType:B.cliType,workspaceId:v.id,argsStr:B.argsStr,model:B.model})},children:[u.jsx("span",{className:"font-medium text-text-primary block truncate",children:v.label||v.path}),u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:v.path})]},v.id))}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",disabled:!O.defaultWorkspacePath,onClick:()=>{const v=ne;Se(null),_e({cliType:v.cliType,useDefaultWorkspace:!0,argsStr:v.argsStr,model:v.model})},children:"Default workspace"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{const v=ne;Se(null),_e({cliType:v.cliType,useHome:!0,argsStr:v.argsStr,model:v.model})},children:"Home directory"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>Se(null),children:"Cancel"})]})]})})]})}function iI(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new URLSearchParams(window.location.search).get("token");return n?`${t}?token=${encodeURIComponent(n)}`:t}const rv=iI(),nv=3e3,sI=3e4;let Sn=null,oI=0;const nc=new Map,Od=new Set;let ki=null;async function xa(e,t,r){const n=Sn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++oI}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{nc.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);nc.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),n.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:r||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:r||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class lI{constructor(t){Hs(this,"daemonId");Hs(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN}get connectionState(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return xa(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId;return xa(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ki&&(clearInterval(ki),ki=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId,i=await xa(n,"screenshot",{width:1280});if(i!=null&&i.success&&(i!=null&&i.base64)){const s=await fetch(`data:image/jpeg;base64,${i.base64}`).then(o=>o.blob());Od.forEach(o=>o(this.daemonId,s))}}catch{}};r(),ki=setInterval(r,2e3)}stopScreenshots(t){ki&&(clearInterval(ki),ki=null)}}let Ci=null;function aI(e){(!Ci||Ci.daemonId!==e)&&(Ci=new lI(e));const t=dr._originalGet||dr.get.bind(dr);dr._originalGet=t,dr.get=r=>r===e||r.startsWith("standalone")?Ci:t(r),dr.getState=r=>(r===e||r.startsWith("standalone"))&&(Ci==null?void 0:Ci.connectionState)||"disconnected",dr.onScreenshot=(r,n)=>(Od.add(n),()=>{Od.delete(n)})}function cI({children:e}){const t=b.useRef(Km()),r=Km();t.current=r;const{setUserName:n}=Zo(),i=b.useRef(n);i.current=n;const[,s]=b.useState("disconnected"),o=b.useRef(null),l=b.useRef(),a=b.useRef(nv),c=b.useRef(!0);return b.useEffect(()=>{c.current=!0;function d(){var p,m;if(!c.current||((p=o.current)==null?void 0:p.readyState)===WebSocket.OPEN||((m=o.current)==null?void 0:m.readyState)===WebSocket.CONNECTING)return;s("connecting"),console.log(`[Standalone WS] Connecting to ${rv}...`);let f;try{f=new WebSocket(rv)}catch(g){console.error("[Standalone WS] Failed to create WebSocket:",g),h();return}o.current=f,f.onopen=()=>{if(!c.current){f.close();return}s("connected"),a.current=nv,console.log("[Standalone WS] Connected")},Sn=f,f.onmessage=g=>{var S;try{const _=JSON.parse(g.data);if((_.type==="command_result"||_.type==="error")&&_.requestId){const x=nc.get(_.requestId);x&&(nc.delete(_.requestId),_.type==="error"?x.reject(new Error(((S=_.data)==null?void 0:S.message)||"Command failed")):x.resolve(_.data));return}if(_.type==="status"||_.type==="initial_state"){const x=_.data;if(!x)return;const{injectEntries:w,markLoaded:N}=t.current,L=x.id||"standalone";aI(L);const C=AR(x,{daemonId:L});C.length>0&&w(C),N(),x.userName&&i.current&&i.current(x.userName)}}catch(_){console.error("[Standalone WS] Parse error:",_)}},f.onclose=()=>{c.current&&(s("disconnected"),o.current=null,h())},f.onerror=g=>{console.warn("[Standalone WS] Error, will reconnect:",g)}}function h(){if(!c.current)return;clearTimeout(l.current);const f=a.current;console.log(`[Standalone WS] Reconnecting in ${f}ms...`),l.current=setTimeout(()=>{a.current=Math.min(a.current*1.5,sI),d()},f)}return d(),()=>{c.current=!1,clearTimeout(l.current),o.current&&(o.current.onclose=null,o.current.close(),o.current=null,Sn=null)}},[]),u.jsx(u.Fragment,{children:e})}function uI({children:e}){return u.jsx(zk,{children:u.jsx(cI,{children:e})})}const hI=[{id:"dashboard",path:"/dashboard",icon:u.jsx($3,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:u.jsx(F3,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:u.jsx(Ky,{}),label:"Settings"}];function dI({children:e}){const t=Os(),r=fl(),[n,i]=b.useState(!1),[s,o]=b.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),l=d=>{t(d),i(!1)},a=()=>{o(d=>{const h=!d;try{localStorage.setItem("sidebar-collapsed",h?"1":"0")}catch{}return h})},c=d=>`nav-item${r.pathname.startsWith(d)?" active":""} cursor-pointer ${s?"justify-center py-2.5 px-0":""}`;return u.jsxs("div",{className:`app-layout${n?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"})]}),n&&u.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:d=>d.key==="Escape"&&i(!1)}),u.jsxs("aside",{className:`sidebar ${n?"sidebar-open":""}`,children:[u.jsxs("div",{className:"sidebar-header",children:[u.jsxs("div",{className:`sidebar-logo ${s?"justify-center gap-0":""}`,children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!s&&u.jsx("span",{children:"ADHDev"})]}),u.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),u.jsx("nav",{className:"sidebar-nav",children:hI.map(d=>u.jsxs("div",{className:c(d.path),id:`nav-${d.id}`,onClick:()=>l(d.path),title:s?d.label:void 0,children:[u.jsx("span",{className:"nav-icon",children:d.icon}),!s&&d.label]},d.id))}),u.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[u.jsxs("div",{className:`nav-item cursor-pointer${r.pathname==="/about"?" active":""} ${s?"justify-center py-2.5 px-0":""}`,id:"nav-about",onClick:()=>t("/about"),title:s?"About":void 0,children:[u.jsx("span",{className:"nav-icon",children:u.jsx(H3,{})}),!s&&"About"]}),!s&&u.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.25"]}),u.jsx(DM,{collapsed:s}),u.jsxs("div",{className:`nav-item cursor-pointer ${s?"justify-center py-2.5 px-0":"mt-1"}`,onClick:a,title:s?"Expand sidebar":"Collapse sidebar",children:[u.jsx("span",{className:"nav-icon text-base",children:s?"›":"‹"}),!s&&u.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),u.jsx("main",{className:"main-content relative",children:u.jsx("div",{className:"main-content-inner",children:e})})]})}const fI=[{icon:"🏠",title:"Local-first",desc:"Everything runs on your machine. No data leaves your network. Full privacy by design."},{icon:"💬",title:"Agent chat relay",desc:"Read and respond to AI conversations in real-time across all connected IDEs."},{icon:"📸",title:"Live screenshots",desc:"View your IDE screens directly in the browser via local WebSocket streaming."},{icon:"🎛️",title:"Remote control",desc:"Click, type, and interact with your IDE from the dashboard — no window switching."},{icon:"🔌",title:"Multi-IDE support",desc:"Monitor and control multiple IDEs simultaneously — VS Code, Cursor, Windsurf, and more."},{icon:"⚡",title:"Extension agents",desc:"Manage extension-based agents like Cline and Roo Code alongside native IDE agents."}],pI=[{icon:"🌍",title:"Access from anywhere",desc:"Control your agents from any device, any network. No VPN or port forwarding needed."},{icon:"🔗",title:"WebRTC P2P streaming",desc:"End-to-end encrypted peer-to-peer connection for zero-latency remote screenshots and control."},{icon:"📱",title:"Mobile notifications",desc:"Get push notifications when agents need approval. Quick approve/reject from your phone."},{icon:"📡",title:"REST API access",desc:"Integrate with Slack, CI/CD pipelines, or custom tools. Scoped API keys with granular permissions."},{icon:"👥",title:"Team dashboard",desc:"Share a unified view across your team. See who's running what, where, in real time."},{icon:"🔐",title:"Enterprise security",desc:"SSO, RBAC, audit logs, and SLA guarantees for production teams."}],mI=[{feature:"Agent chat relay",selfhost:!0,cloud:!0},{feature:"Live IDE screenshots",selfhost:!0,cloud:!0},{feature:"Remote IDE control",selfhost:!0,cloud:!0},{feature:"Multi-IDE monitoring",selfhost:!0,cloud:!0},{feature:"Extension agent support",selfhost:!0,cloud:!0},{feature:"CLI agent support",selfhost:!0,cloud:!0},{feature:"Access from any network",selfhost:!1,cloud:!0},{feature:"WebRTC P2P streaming",selfhost:!1,cloud:!0},{feature:"Mobile push notifications",selfhost:!1,cloud:!0},{feature:"REST API & webhooks",selfhost:!1,cloud:!0},{feature:"Team collaboration",selfhost:!1,cloud:!0},{feature:"Multi-machine (Burrows)",selfhost:!1,cloud:!0},{feature:"SSO / RBAC / Audit logs",selfhost:!1,cloud:!0}],Vu={ides:["VS Code","Cursor","Antigravity","Windsurf","Trae","PearAI","Kiro","VSCodium","VS Code Insiders"],agents:["GitHub Copilot","Cline","Roo Code"],cli:["Gemini CLI","Claude Code","Codex CLI"]};function gI(){return u.jsxs("div",{className:"py-8 px-6 max-w-[860px] mx-auto text-text-primary",children:[u.jsxs("div",{className:"text-center mb-10",children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-14 h-14 mb-3 mx-auto"}),u.jsx("h1",{className:"text-[26px] font-extrabold mb-1.5 text-text-primary",children:"ADHDev"}),u.jsx("p",{className:"text-[13px] text-text-muted",children:"Agent Dashboard Hub for Dev — Self-hosted Edition"}),u.jsxs("div",{className:"inline-block mt-3 px-3 py-1 text-[11px] font-semibold tracking-wide rounded-full bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:["SELFHOST v","0.5.25"]})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"✅"})," What's included"]}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-3",children:fI.map(e=>u.jsxs("div",{className:"bg-bg-glass border border-border-subtle rounded-xl px-4 py-4 transition-colors hover:border-border-default",children:[u.jsx("div",{className:"text-xl mb-1.5",children:e.icon}),u.jsx("div",{className:"font-semibold text-[13px] mb-1",children:e.title}),u.jsx("div",{className:"text-[12px] text-text-muted leading-relaxed",children:e.desc})]},e.title))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsx("h2",{className:"text-lg font-bold mb-4",children:"Compatible with"}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-5",children:[{label:"IDEs",items:Vu.ides},{label:"Extension agents",items:Vu.agents},{label:"CLI agents",items:Vu.cli}].map(e=>u.jsxs("div",{children:[u.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-2 uppercase",children:e.label}),u.jsx("div",{className:"flex flex-col gap-1",children:e.items.map(t=>u.jsx("div",{className:"text-[12px] px-2.5 py-1.5 bg-bg-glass rounded-md border border-border-subtle",children:t},t))})]},e.label))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"⚖️"})," Self-hosted vs Cloud"]}),u.jsx("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:u.jsxs("table",{className:"w-full text-[13px]",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"bg-bg-secondary",children:[u.jsx("th",{className:"text-left px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[100px]",children:"Selfhost"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-[11px] uppercase tracking-wider w-[100px] text-violet-500",children:"Cloud"})]})}),u.jsx("tbody",{children:mI.map((e,t)=>u.jsxs("tr",{className:t%2===0?"bg-bg-glass":"",children:[u.jsx("td",{className:"px-4 py-2 text-text-secondary",children:e.feature}),u.jsx("td",{className:"text-center px-4 py-2",children:e.selfhost?u.jsx("span",{className:"text-emerald-500",children:"✓"}):u.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),u.jsx("td",{className:"text-center px-4 py-2",children:u.jsx("span",{className:"text-emerald-500",children:"✓"})})]},e.feature))})]})})]}),u.jsx("section",{className:"mb-10",children:u.jsx("div",{className:"rounded-2xl border border-violet-500/20 bg-violet-500/[0.04] px-6 py-6",children:u.jsxs("div",{className:"flex items-start gap-4",children:[u.jsx("div",{className:"text-3xl shrink-0",children:"🚀"}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h3",{className:"font-bold text-[15px] mb-1.5",children:"Unlock more with ADHDev Cloud"}),u.jsx("p",{className:"text-[13px] text-text-muted leading-relaxed mb-4",children:"Access your agents from anywhere — your phone, another laptop, or a coffee shop. Cloud adds WebRTC P2P streaming, mobile push notifications, REST API, team collaboration, and multi-machine support. Your local setup stays exactly the same."}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2.5 mb-5",children:pI.map(e=>u.jsxs("div",{className:"flex gap-2.5 items-start",children:[u.jsx("span",{className:"text-base shrink-0 mt-0.5",children:e.icon}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[12px]",children:e.title}),u.jsx("div",{className:"text-[11px] text-text-muted leading-snug",children:e.desc})]})]},e.title))}),u.jsxs("div",{className:"flex gap-3 flex-wrap",children:[u.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Try ADHDev Cloud →"}),u.jsx("a",{href:"https://github.com/vilmire/adhdev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"GitHub"}),u.jsx("a",{href:"https://discord.gg/WJD3tCfBzk",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Discord"})]})]})]})})}),u.jsxs("div",{className:"text-center text-xs text-text-muted pt-4 border-t border-border-subtle",children:[u.jsx("p",{children:"© 2026 ADHDev · Your AI sidekick otter 🦦"}),u.jsx("p",{className:"mt-1 opacity-60",children:"Self-hosted edition — all data stays on your machine"})]})]})}function _I(){const{ides:e}=Zo(),t=e.find(h=>h.type==="adhdev-daemon"),r=(t==null?void 0:t.detectedIdes)||[],{sendCommand:n}=gi(),{userName:i}=Zo(),[s,o]=b.useState(i||"");b.useEffect(()=>{i!==void 0&&o(i)},[i]);const l=h=>{const f=h.target.value.trim();t!=null&&t.id&&f!==i&&n(t.id,"set_user_name",{userName:f}).catch(console.error)},[a,c]=b.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),d=h=>{c(h);try{localStorage.setItem("adhdev_sound",h?"1":"0")}catch{}};return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(NM,{icon:"⚙️",title:"Settings",subtitle:"Local daemon configuration & preferences"}),u.jsxs("div",{className:"page-content",children:[u.jsx(ao,{title:"Daemon",className:"mb-4",children:u.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-x-4 gap-y-2.5 text-sm",children:[u.jsx("span",{className:"text-text-muted",children:"Version"}),u.jsxs("span",{className:"font-mono text-xs",children:["v","0.5.25"]}),u.jsx("span",{className:"text-text-muted",children:"Status"}),u.jsx("span",{className:t?"text-green-400":"text-yellow-400",children:t?"● Running":"○ Not connected"}),u.jsx("span",{className:"text-text-muted",children:"WebSocket"}),u.jsx("span",{className:"font-mono text-xs",children:"ws://localhost:19222"}),u.jsx("span",{className:"text-text-muted",children:"HTTP"}),u.jsx("span",{className:"font-mono text-xs",children:"http://localhost:19280"})]})}),u.jsx(ao,{title:"Detected IDEs",className:"mb-4",children:r.length===0?u.jsx("p",{className:"text-sm text-text-muted",children:"No IDEs detected. Start an IDE to see it here."}):u.jsx("div",{className:"flex flex-col gap-1.5",children:r.map(h=>u.jsxs("div",{className:"flex justify-between items-center bg-bg-glass rounded-lg px-3.5 py-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:`w-2 h-2 rounded-full ${h.running?"bg-green-400":"bg-text-muted/30"}`}),u.jsx("span",{className:"text-sm font-medium",children:h.name})]}),u.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:h.type})]},h.type))})}),u.jsx(ao,{title:"Machine",className:"mb-4",children:u.jsx(FM,{ides:e,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),u.jsx(ao,{title:"Notifications",className:"mb-4",children:u.jsx($M,{})}),u.jsx(ao,{title:"Preferences",className:"mb-4",children:u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsxs("div",{className:"flex items-center justify-between px-3.5 py-4 bg-bg-glass rounded-xl border border-border-subtle hover:border-border-hover transition-colors",children:[u.jsxs("div",{className:"flex flex-col gap-1 pr-4 max-w-[500px]",children:[u.jsx("span",{className:"text-sm font-semibold flex items-center gap-2",children:"👤 Display Name"}),u.jsx("span",{className:"text-[12px] text-text-muted leading-relaxed",children:"Your name shown in chat threads and on the team dashboard."})]}),u.jsx("input",{type:"text",className:"bg-bg-primary border border-border-strong rounded-lg px-3 py-1.5 text-sm w-48 text-right focus:border-accent-primary focus:outline-none transition-colors",placeholder:"Anonymous",value:s,onChange:h=>o(h.target.value),onBlur:l,onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur()}})]}),u.jsx(is,{label:"🔊 Sound Effects",description:"Play a sound when agent completes or needs approval",checked:a,onChange:d})]})})]})]})}function iv(){const{ides:e}=Zo(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?u.jsx(aa,{to:`/machines/${t.id}`,replace:!0}):e.length>0?u.jsx(aa,{to:`/machines/${e[0].id}`,replace:!0}):u.jsx(aa,{to:"/dashboard",replace:!0})}function vI(){return u.jsx(Bk,{children:u.jsx(uI,{children:u.jsx(Hk,{value:{sendCommand:xa,sendData:()=>!1},children:u.jsx(dI,{children:u.jsxs(Ik,{children:[u.jsx(yn,{path:"/dashboard",element:u.jsx(ZM,{})}),u.jsx(yn,{path:"/ide/:id",element:u.jsx(tI,{})}),u.jsx(yn,{path:"/machine",element:u.jsx(iv,{})}),u.jsx(yn,{path:"/machines/:id",element:u.jsx(nI,{})}),u.jsx(yn,{path:"/machines",element:u.jsx(iv,{})}),u.jsx(yn,{path:"/about",element:u.jsx(gI,{})}),u.jsx(yn,{path:"/settings",element:u.jsx(_I,{})}),u.jsx(yn,{path:"*",element:u.jsx(aa,{to:"/dashboard",replace:!0})})]})})})})})}w0(document.getElementById("root")).render(u.jsx(b.StrictMode,{children:u.jsx(vI,{})}));
|
|
214
|
+
This will disconnect CDP and optionally kill the process.`))try{const B=await r(v.daemonId,"stop_ide",{ideType:v.type,killProcess:!0});B!=null&&B.success?le("info",`${Ar(v.type)} stopped`):le("error",`Stop failed: ${(B==null?void 0:B.error)||"Unknown error"}`)}catch(B){le("error",`Stop failed: ${B.message}`)}},Zt=async()=>{if(e)try{const v=await r(e,"detect_ides",{});le("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){le("error",`Detection failed: ${v.message}`)}},xr=async()=>{if(e){C(!0);try{const v=await r(e,"get_recent_workspaces",{});v!=null&&v.success&&Array.isArray(v==null?void 0:v.result)&&N(v.result)}catch(v){le("error",`Failed: ${v.message}`)}finally{C(!1)}}},Ji=async()=>{if(!(!e||!We.trim())){Te(!0);try{const v=await r(e,"workspace_add",{path:We.trim()});v!=null&&v.success?(le("info",`Workspace added: ${We.trim()}`),Ne("")):le("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){le("error",v.message)}finally{Te(!1)}}},Mc=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){Te(!0);try{const B=await r(e,"workspace_remove",{id:v});B!=null&&B.success?le("info","Workspace removed"):le("error",(B==null?void 0:B.error)||"workspace_remove failed")}catch(B){le("error",B.message)}finally{Te(!1)}}},Ic=async v=>{if(e){Te(!0);try{const B=await r(e,"workspace_set_default",v===null?{clear:!0}:{id:v});if(B!=null&&B.success){le("info",v?"Default workspace updated":"Default workspace cleared");const ie=typeof B.defaultWorkspacePath=="string"?B.defaultWorkspacePath:"";ie&&(P(ie),D(ie))}else le("error",(B==null?void 0:B.error)||"workspace_set_default failed")}catch(B){le("error",B.message)}finally{Te(!1)}}},Dc=async v=>{if(!e||!v.trim())return;const B=v.trim();Te(!0);try{const ie=await r(e,"workspace_set_default",{path:B});ie!=null&&ie.success?(le("info","Default workspace set from history"),P(B),D(B)):le("error",(ie==null?void 0:ie.error)||"Could not set default (path missing on disk?)")}catch(ie){le("error",ie.message)}finally{Te(!1)}},On=b.useCallback(async()=>{var v;if(e){Y(!0);try{let B=await r(e,"get_cli_history",{});B!=null&&B.success||(B=await n(e,"get_cli_history"));const ie=(B==null?void 0:B.history)??((v=B==null?void 0:B.result)==null?void 0:v.history);B!=null&&B.success&&Array.isArray(ie)&&we(ie)}catch{}Y(!1)}},[e,r,n]);b.useEffect(()=>{J==="overview"&&e&&On()},[J,e,On]);const pp=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:de}),le("info",`Nickname set to "${de||"(cleared)"}"`),fe(!1)}catch(v){le("error",`Failed: ${v.message}`)}};if(!O)return o?u.jsxs("div",{className:"p-10 text-center text-text-muted",children:[u.jsx("h2",{className:"text-text-primary",children:"Machine not found"}),u.jsx("p",{className:"mt-3",children:"The machine may be offline or not yet connected."}),u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):u.jsx("div",{className:"p-10 text-center text-text-muted",children:u.jsx("p",{children:"⏳ Loading machine..."})});const mp=O.availableMem??O.freeMem,cb=O.totalMem>0?Math.min(100,Math.max(0,Math.round((O.totalMem-mp)/O.totalMem*100))):0,gp=O.loadavg[0]||0,ub=O.machineNickname||O.hostname,hb=(v,B,ie)=>{const ke=ue.find(yr=>yr.type===v),Ge=(ie||[]).join(" ");(ke==null?void 0:ke.category)==="acp"?($(v),D(B),y(Ge),ae("acps")):(R(v),P(B),E(Ge),ae("clis"))},db=[{id:"overview",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(YP,{size:14})," Overview"]})},{id:"ides",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Ro,{size:14})," IDEs"]}),count:he.length},{id:"clis",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Yy,{size:14})," CLIs"]}),count:ce.length},{id:"acps",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(QP,{size:14})," ACP Agents"]}),count:ve.length},{id:"providers",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Ky,{size:14})," Providers"]}),count:Ve.length>0?Ve.length:void 0},{id:"logs",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(WP,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsxs("div",{className:"dashboard-header !flex-col !items-stretch",children:[u.jsx("div",{className:"flex items-center justify-between w-full",children:u.jsxs("div",{className:"flex items-center gap-2 md:gap-3.5 w-full min-w-0",children:[u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back flex shrink-0",children:"←"}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[te?u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsx("input",{autoFocus:!0,value:de,onChange:v=>Oe(v.target.value),onKeyDown:v=>{v.key==="Enter"&&pp(),v.key==="Escape"&&fe(!1)},placeholder:"Machine nickname...",className:"px-2.5 py-1 rounded-md border border-violet-500/30 bg-bg-secondary text-text-primary text-sm font-semibold w-[140px] md:w-[200px]"}),u.jsx("button",{onClick:pp,className:"machine-btn text-green-500 border-green-500/30 shrink-0",children:"✓"}),u.jsx("button",{onClick:()=>fe(!1),className:"machine-btn shrink-0",children:"✕"})]}):u.jsx("h1",{className:"header-title cursor-pointer truncate",onClick:()=>{fe(!0),Oe(O.machineNickname||"")},title:"Click to set nickname",children:ub}),u.jsx("span",{className:"status-dot-md online shrink-0"})]}),u.jsxs("div",{className:"header-subtitle mt-1 flex-wrap gap-1 md:gap-2 items-center display-none-mobile",children:[u.jsxs("span",{children:[O.platform," · ",O.arch," · ",O.cpus," cores"]}),O.p2p.available&&u.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:O.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:O.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",O.p2p.state==="connected"?`● ${O.p2p.peers}`:"○"]}),O.cdpConnected&&u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500 shrink-0",children:"CDP ●"}),O.machineNickname&&u.jsxs("span",{className:"text-text-muted opacity-80 shrink-0",children:["(",O.hostname,")"]})]})]})]})}),u.jsx("div",{className:"machine-tabs w-full overflow-x-auto overflow-y-hidden pb-1 -mb-1 mt-2",children:db.map(v=>u.jsxs("button",{onClick:()=>ae(v.id),className:`machine-tab shrink-0${J===v.id?" active":""}`,children:[v.label,v.count!==void 0&&u.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),u.jsxs("div",{className:"page-content",children:[J==="overview"&&u.jsxs("div",{children:[u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[u.jsx($_,{icon:u.jsx(Ug,{size:16}),label:"Uptime",value:TR(O.uptime)}),u.jsx($_,{icon:u.jsx(Ro,{size:16}),label:"IDEs",value:`${he.length}`,sub:`${ce.length} CLIs`})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),u.jsxs("div",{className:"flex gap-6",children:[u.jsx(F_,{value:Math.min(Math.round(gp/O.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${gp.toFixed(2)} avg / ${O.cpus} cores`}),u.jsx(F_,{value:cb,max:100,label:"Memory",color:"#3b82f6",detail:`${W_(O.totalMem-mp)} / ${W_(O.totalMem)}${O.platform==="darwin"?" (approx.)":""}`})]})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," Workspaces"]})}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:["One list for IDE, CLI, and ACP: saved paths below, and a single ",u.jsx("strong",{className:"text-text-secondary font-medium",children:"default"}),'. The default opens in the IDE when you launch it, pre-fills CLI/ACP directories, and is what "Default" launch uses.']}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-3",children:[u.jsx("span",{className:"text-[10px] text-text-muted",children:"Default:"}),u.jsxs("select",{className:"text-xs bg-bg-primary border border-border-subtle rounded-lg px-2 py-1 max-w-[min(100%,420px)]",disabled:ze,value:O.defaultWorkspaceId||"",onChange:v=>{const B=v.target.value;Ic(B===""?null:B)},children:[u.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(O.workspaces||[]).map(v=>u.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),O.defaultWorkspacePath&&u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:O.defaultWorkspacePath,children:O.defaultWorkspacePath})]}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[u.jsx("input",{className:"flex-1 min-w-[200px] text-xs bg-bg-primary border border-border-subtle rounded-lg px-2.5 py-1.5",placeholder:"Absolute workspace path to add…",value:We,disabled:ze,onChange:v=>Ne(v.target.value),onKeyDown:v=>v.key==="Enter"&&void Ji()}),u.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:ze,onClick:()=>void Ji(),children:"Add"})]}),(O.workspaces||[]).length>0&&u.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(O.workspaces||[]).map(v=>u.jsxs("li",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[u.jsx("span",{className:"font-mono truncate flex-1",title:v.path,children:v.path}),u.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:ze,onClick:()=>void Mc(v.id),children:"Remove"})]},v.id))})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle border-violet-500/15",children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1 flex items-center gap-1.5",children:[u.jsx(Ug,{size:14})," Pick up where you left off"]}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:"Same workspaces as above. Re-run CLI/ACP, or open CLIs/ACP tab with a path filled; IDE launch uses the default automatically when set."}),u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent CLI / ACP launches"}),k.length>0?u.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:k.slice(0,10).map((v,B)=>{const ie=v.label||`${v.cliType} · ${(v.dir||"").split("/").filter(Boolean).pop()||v.dir||"?"}`;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsxs("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,240px)]",title:v.dir,children:[j(v.cliType)," ",ie]}),u.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:v.dir,children:v.dir}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void _e({cliType:v.cliType,dir:v.dir,argsStr:(v.cliArgs||[]).join(" ")}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>hb(v.cliType,v.dir,v.cliArgs),children:"Open tab…"})]})]},`${v.cliType}-${v.dir}-${v.timestamp}-${B}`)})}):u.jsx("p",{className:"text-[11px] text-text-muted mb-4",children:"No launch history yet — start a CLI or ACP from the tabs below, then return here."}),(O.workspaceActivity||[]).length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent workspace paths"}),u.jsx("div",{className:"flex flex-col gap-1.5",children:(O.workspaceActivity||[]).slice(0,12).map(v=>{const B=v.path.split("/").filter(Boolean).pop()||v.path,ie=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="default"||v.kind==="active"?"●":"",ke=(v.kind==="cli"||v.kind==="acp")&&!!v.agentType;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsx("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,200px)]",title:v.path,children:B}),ie&&u.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:ie}),v.agentType&&u.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),u.jsx("span",{className:"text-[9px] text-text-muted",children:rI(v.lastUsedAt)}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[ke&&u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void _e({cliType:v.agentType,dir:v.path}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{P(v.path),D(v.path),ae("clis")},children:"CLIs tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{P(v.path),D(v.path),ae("acps")},children:"ACP tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:ze,onClick:()=>void Dc(v.path),children:"Set default"})]})]},`${v.path}-${v.lastUsedAt}`)})})]})]}),u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"IDEs"}),u.jsx("button",{onClick:()=>ae("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),he.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No IDEs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:he.map(v=>{var ie;const B=(v.agentStreams||[]).some(ke=>ke.status==="generating"||ke.status==="streaming")||((ie=v.activeChat)==null?void 0:ie.status)==="generating";return u.jsxs("div",{onClick:()=>t(`/ide/${v.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${B?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[u.jsx("span",{children:j(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:Ar(v.type)}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace||""}),B&&u.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),u.jsx("span",{className:`${B?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:B?"#fb923c":"#22c55e",boxShadow:B?"0 0 8px rgba(249,115,22,0.4)":"none",animation:B?"pulse-dot 1.5s infinite":"none"}})]},v.id)})})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"CLIs"}),u.jsx("button",{onClick:()=>ae("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),ce.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:ce.map(v=>u.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-glass",children:[u.jsx("span",{children:j(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace.split("/").pop()}),u.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),O.detectedIdes.length>0&&u.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),u.jsx("div",{className:"flex flex-wrap gap-1.5",children:O.detectedIdes.map(v=>u.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${v.running?"bg-green-500/[0.06] border border-green-500/[0.12] text-green-300":"bg-bg-glass border border-border-subtle text-text-muted"}`,children:[u.jsx("span",{children:j(v.type)}),v.name||v.type,u.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),J==="ides"&&u.jsxs("div",{children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",he.length,")"]}),he.length===0?u.jsx("div",{className:"py-10 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No IDEs currently running. Launch one below."}):u.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:he.map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsx("span",{className:"font-semibold text-sm text-text-primary",children:Ar(v.type)}),v.version&&u.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.version]}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),u.jsxs("div",{className:"flex gap-1.5",children:[u.jsxs("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[u.jsx(Ro,{size:13})," Control"]}),u.jsx("button",{onClick:()=>Ct(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"}),u.jsx("button",{onClick:()=>ar(v),className:"machine-btn text-red-400 border-red-500/30",children:"■ Stop"})]})]}),u.jsxs("div",{className:"text-xs text-text-secondary mb-2",children:[u.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",v.workspace||"—"]}),v.aiAgents.length>0&&u.jsx("div",{className:"flex gap-1 mb-2 flex-wrap",children:v.aiAgents.map(B=>u.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${B.status==="generating"||B.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[B.name," · ",B.status]},B.id))}),(qe[v.type]||[]).length>0&&u.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:[u.jsx("div",{className:"text-[10px] text-text-muted font-semibold uppercase tracking-wider mb-1.5",children:"Extensions"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:(qe[v.type]||[]).map(B=>u.jsxs("button",{disabled:Mr===`${v.type}.${B.type}`,onClick:async()=>{const ie=`${v.type}.${B.type}`;K(ie);try{await r(e,"set_ide_extension",{ideType:v.type,extensionType:B.type,enabled:!B.enabled}),Mt(ke=>({...ke,[v.type]:(ke[v.type]||[]).map(Ge=>Ge.type===B.type?{...Ge,enabled:!Ge.enabled}:Ge)}))}catch(ke){console.error("Extension toggle failed:",ke)}finally{K(null)}},className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-medium border transition-colors duration-150 cursor-pointer ${B.enabled?"bg-violet-500/[0.08] border-violet-500/20 text-violet-400":"bg-bg-glass border-border-subtle text-text-muted"}`,children:[u.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${B.enabled?"bg-violet-400 shadow-[0_0_4px_rgba(139,92,246,0.4)]":"bg-zinc-600"}`}),B.name,u.jsx("span",{className:"text-[9px] font-normal",children:B.enabled?"ON":"OFF"})]},B.type))})]})]},v.id))}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",pe.length,")"]}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:[O.defaultWorkspacePath?`Opens in default workspace: ${O.defaultWorkspacePath.split("/").filter(Boolean).pop()||O.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."," ","Multi-window supported — running IDEs can be launched again as a new window."]}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[pe.map(v=>{const B=v.running||he.some(ie=>(ie.type||"").toLowerCase()===(v.type||"").toLowerCase());return u.jsxs("button",{onClick:()=>Pe(v.type||v.id||""),disabled:!!_,className:`machine-btn-primary flex items-center gap-1.5 ${B?"!border-green-500/30":""}`,style:{opacity:_&&_!==v.type?.4:1},children:[u.jsx("span",{children:j(v.type)}),B&&u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_4px_rgba(34,197,94,0.4)]"}),_===v.type?"⏳ Launching...":`▶ ${v.name||Ar(v.type)}`,B&&u.jsx("span",{className:"text-[9px] text-green-400 font-normal",children:"+ window"})]},v.type)}),pe.length===0&&u.jsxs("div",{className:"text-xs text-text-muted italic",children:["No IDEs detected.",u.jsxs("button",{onClick:Zt,className:"machine-btn ml-2 flex items-center gap-1",children:[u.jsx(VP,{size:12})," Scan"]})]})]})]}),J==="clis"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch New CLI"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:A,onChange:v=>R(v.target.value),className:"machine-input",children:V.length>0?V.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:F,onChange:v=>P(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:q,onChange:v=>E(v.target.value),className:"machine-input min-w-[150px]"}),u.jsx("button",{onClick:()=>Ye(A,F,q||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(O!=null&&O.defaultWorkspacePath),title:O!=null&&O.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void _e({cliType:A,useDefaultWorkspace:!0,argsStr:q||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void _e({cliType:A,useHome:!0,argsStr:q||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ce.length,")"]}),ce.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:ce.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),u.jsx("div",{className:"text-[11px] text-text-muted",children:v.workspace})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),v.status==="stopped"?u.jsx("button",{onClick:()=>Ye(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"History"}),u.jsx("button",{onClick:On,disabled:U,className:"machine-btn",children:U?"⏳":"↻ Load"})]}),k.length>0&&u.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,B)=>{var ie,ke;return u.jsxs("div",{onClick:()=>{R(v.cliType),P(v.dir),E((v.cliArgs||[]).join(" "))},className:"flex justify-between items-center px-2.5 py-1.5 rounded-md cursor-pointer bg-bg-glass border border-border-subtle text-xs transition-[background] duration-150",onMouseEnter:Ge=>Ge.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:Ge=>Ge.currentTarget.style.background="var(--bg-glass)",children:[u.jsxs("div",{className:"flex gap-1.5 items-center text-text-secondary",children:[u.jsx("span",{children:j(v.cliType)}),u.jsx("span",{children:((ie=v.dir)==null?void 0:ie.split("/").filter(Boolean).pop())||"root"}),((ke=v.cliArgs)==null?void 0:ke.length)>0&&u.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),u.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},B)})}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:L,className:"machine-btn",children:L?"⏳":"↻ Load"})]}),w.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((v,B)=>u.jsx("button",{onClick:()=>P(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Mo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),J==="acps"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch ACP Agent"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:T,onChange:v=>$(v.target.value),className:"machine-input",children:X.length>0?X.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or picker / Default / Home)",value:z,onChange:v=>D(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Model (default)",value:H,onChange:v=>I(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:W,onChange:v=>y(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("button",{onClick:()=>Ye(T,z,W||void 0,H||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(O!=null&&O.defaultWorkspacePath),title:O!=null&&O.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void _e({cliType:T,useDefaultWorkspace:!0,argsStr:W||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void _e({cliType:T,useHome:!0,argsStr:W||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ve.length,")"]}),ve.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No ACP agents running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:ve.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),u.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[u.jsx("span",{children:v.workspace}),v.currentModel&&u.jsxs("span",{className:"text-cyan-500",children:["🤖 ",v.currentModel]}),v.currentPlan&&u.jsxs("span",{className:"text-amber-500",children:["📋 ",v.currentPlan]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":v.status==="generating"?"bg-orange-500/[0.08] text-orange-400":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),u.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:u.jsx(Xa,{size:14})}),v.status==="stopped"?u.jsx("button",{onClick:()=>Ye(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:L,className:"machine-btn",children:L?"⏳":"↻ Load"})]}),w.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((v,B)=>u.jsx("button",{onClick:()=>D(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Mo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),J==="providers"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-4",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(v=>u.jsx("button",{onClick:()=>Fe(v),className:`machine-btn text-[10px] px-2 py-0.5 ${oe===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsx("button",{onClick:ft,disabled:G,className:"machine-btn",children:G?"⏳ Loading...":"↻ Refresh"})]}),G&&Ve.length===0?u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading provider settings..."}):u.jsx("div",{className:"flex flex-col gap-2",children:Ve.filter(v=>oe==="all"||v.category===oe).map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-lg",children:v.icon}),u.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:v.category==="acp"?"rgba(139,92,246,0.08)":v.category==="cli"?"rgba(59,130,246,0.08)":v.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:v.category==="acp"?"#a78bfa":v.category==="cli"?"#60a5fa":v.category==="ide"?"#86efac":"#fbbf24"},children:v.category})]}),u.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(B=>u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"text-xs font-medium text-text-primary",children:[B.label||B.key,Re===`${v.type}.${B.key}`&&u.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),B.description&&u.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:B.description})]}),u.jsx("div",{className:"shrink-0",children:B.type==="boolean"?u.jsx("button",{onClick:()=>It(v.type,B.key,!(v.values[B.key]??B.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[B.key]??B.default?"#8b5cf6":"var(--border-subtle)"},children:u.jsx("div",{className:"w-4 h-4 rounded-full bg-white absolute top-[3px] transition-[left] duration-200 shadow-[0_1px_3px_rgba(0,0,0,0.3)]",style:{left:v.values[B.key]??B.default?21:3}})}):B.type==="number"?u.jsx("input",{type:"number",value:v.values[B.key]??B.default??0,min:B.min,max:B.max,onChange:ie=>{const ke=parseInt(ie.target.value)||0;B.min!==void 0&&ke<B.min||B.max!==void 0&&ke>B.max||It(v.type,B.key,ke)},className:"machine-input w-20 text-center text-[11px]"}):B.type==="select"&&B.options?u.jsx("select",{value:v.values[B.key]??B.default??"",onChange:ie=>It(v.type,B.key,ie.target.value),className:"machine-input text-[11px]",children:B.options.map(ie=>u.jsx("option",{value:ie,children:ie},ie))}):u.jsx("input",{type:"text",value:v.values[B.key]??B.default??"",onBlur:ie=>It(v.type,B.key,ie.target.value),className:"machine-input w-[120px] text-[11px]"})})]},B.key))})]},v.type))})]}),J==="logs"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-3",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(v=>u.jsx("button",{onClick:()=>{S(v),d([]),f(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${g===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),u.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"⏸ Pause":"▶ Resume"}),u.jsx("button",{onClick:()=>{d([]),f(0)},className:"machine-btn",children:"Clear"})]})]}),u.jsxs("div",{className:"bg-bg-secondary border border-border-subtle rounded-xl p-3 min-h-[200px] max-h-[500px] overflow-y-auto font-mono text-[11px] leading-relaxed",children:[c.length===0&&u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,B)=>u.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[u.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),u.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#475569":"#8b5cf6"},children:v.level==="error"?"ERR":v.level==="warn"?"WRN":v.level==="debug"?"DBG":"INF"}),u.jsx("span",{children:v.message})]},B)),u.jsx("div",{ref:Me})]})]})]}),ne&&O&&u.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/55 backdrop-blur-[2px]",role:"dialog","aria-modal":"true","aria-labelledby":"launch-pick-title",children:u.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border-subtle bg-bg-secondary shadow-xl p-5",children:[u.jsx("h2",{id:"launch-pick-title",className:"text-sm font-semibold text-text-primary m-0 mb-1",children:"Where should this run?"}),u.jsx("p",{className:"text-[11px] text-text-muted m-0 mb-4",children:"Nothing is assumed. Pick a saved workspace, your default workspace, or home — or cancel and type a path."}),u.jsx("div",{className:"flex flex-col gap-2 mb-4 max-h-48 overflow-y-auto",children:(O.workspaces||[]).length===0?u.jsx("span",{className:"text-[11px] text-text-muted",children:"No saved workspaces yet. Add one in Overview or type a path above."}):(O.workspaces||[]).map(v=>u.jsxs("button",{type:"button",className:"text-left text-xs px-3 py-2 rounded-lg border border-border-subtle bg-bg-primary hover:bg-violet-500/[0.08] transition-colors",onClick:()=>{const B=ne;Se(null),_e({cliType:B.cliType,workspaceId:v.id,argsStr:B.argsStr,model:B.model})},children:[u.jsx("span",{className:"font-medium text-text-primary block truncate",children:v.label||v.path}),u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:v.path})]},v.id))}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",disabled:!O.defaultWorkspacePath,onClick:()=>{const v=ne;Se(null),_e({cliType:v.cliType,useDefaultWorkspace:!0,argsStr:v.argsStr,model:v.model})},children:"Default workspace"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{const v=ne;Se(null),_e({cliType:v.cliType,useHome:!0,argsStr:v.argsStr,model:v.model})},children:"Home directory"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>Se(null),children:"Cancel"})]})]})})]})}function iI(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new URLSearchParams(window.location.search).get("token");return n?`${t}?token=${encodeURIComponent(n)}`:t}const rv=iI(),nv=3e3,sI=3e4;let Sn=null,oI=0;const nc=new Map,Od=new Set;let ki=null;async function xa(e,t,r){const n=Sn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++oI}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{nc.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);nc.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),n.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:r||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:r||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class lI{constructor(t){Hs(this,"daemonId");Hs(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN}get connectionState(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return xa(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId;return xa(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ki&&(clearInterval(ki),ki=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId,i=await xa(n,"screenshot",{width:1280});if(i!=null&&i.success&&(i!=null&&i.base64)){const s=await fetch(`data:image/jpeg;base64,${i.base64}`).then(o=>o.blob());Od.forEach(o=>o(this.daemonId,s))}}catch{}};r(),ki=setInterval(r,2e3)}stopScreenshots(t){ki&&(clearInterval(ki),ki=null)}}let Ci=null;function aI(e){(!Ci||Ci.daemonId!==e)&&(Ci=new lI(e));const t=dr._originalGet||dr.get.bind(dr);dr._originalGet=t,dr.get=r=>r===e||r.startsWith("standalone")?Ci:t(r),dr.getState=r=>(r===e||r.startsWith("standalone"))&&(Ci==null?void 0:Ci.connectionState)||"disconnected",dr.onScreenshot=(r,n)=>(Od.add(n),()=>{Od.delete(n)})}function cI({children:e}){const t=b.useRef(Km()),r=Km();t.current=r;const{setUserName:n}=Zo(),i=b.useRef(n);i.current=n;const[,s]=b.useState("disconnected"),o=b.useRef(null),l=b.useRef(),a=b.useRef(nv),c=b.useRef(!0);return b.useEffect(()=>{c.current=!0;function d(){var p,m;if(!c.current||((p=o.current)==null?void 0:p.readyState)===WebSocket.OPEN||((m=o.current)==null?void 0:m.readyState)===WebSocket.CONNECTING)return;s("connecting"),console.log(`[Standalone WS] Connecting to ${rv}...`);let f;try{f=new WebSocket(rv)}catch(g){console.error("[Standalone WS] Failed to create WebSocket:",g),h();return}o.current=f,f.onopen=()=>{if(!c.current){f.close();return}s("connected"),a.current=nv,console.log("[Standalone WS] Connected")},Sn=f,f.onmessage=g=>{var S;try{const _=JSON.parse(g.data);if((_.type==="command_result"||_.type==="error")&&_.requestId){const x=nc.get(_.requestId);x&&(nc.delete(_.requestId),_.type==="error"?x.reject(new Error(((S=_.data)==null?void 0:S.message)||"Command failed")):x.resolve(_.data));return}if(_.type==="status"||_.type==="initial_state"){const x=_.data;if(!x)return;const{injectEntries:w,markLoaded:N}=t.current,L=x.id||"standalone";aI(L);const C=AR(x,{daemonId:L});C.length>0&&w(C),N(),x.userName&&i.current&&i.current(x.userName)}}catch(_){console.error("[Standalone WS] Parse error:",_)}},f.onclose=()=>{c.current&&(s("disconnected"),o.current=null,h())},f.onerror=g=>{console.warn("[Standalone WS] Error, will reconnect:",g)}}function h(){if(!c.current)return;clearTimeout(l.current);const f=a.current;console.log(`[Standalone WS] Reconnecting in ${f}ms...`),l.current=setTimeout(()=>{a.current=Math.min(a.current*1.5,sI),d()},f)}return d(),()=>{c.current=!1,clearTimeout(l.current),o.current&&(o.current.onclose=null,o.current.close(),o.current=null,Sn=null)}},[]),u.jsx(u.Fragment,{children:e})}function uI({children:e}){return u.jsx(zk,{children:u.jsx(cI,{children:e})})}const hI=[{id:"dashboard",path:"/dashboard",icon:u.jsx($P,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:u.jsx(FP,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:u.jsx(Ky,{}),label:"Settings"}];function dI({children:e}){const t=Os(),r=fl(),[n,i]=b.useState(!1),[s,o]=b.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),l=d=>{t(d),i(!1)},a=()=>{o(d=>{const h=!d;try{localStorage.setItem("sidebar-collapsed",h?"1":"0")}catch{}return h})},c=d=>`nav-item${r.pathname.startsWith(d)?" active":""} cursor-pointer ${s?"justify-center py-2.5 px-0":""}`;return u.jsxs("div",{className:`app-layout${n?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"})]}),n&&u.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:d=>d.key==="Escape"&&i(!1)}),u.jsxs("aside",{className:`sidebar ${n?"sidebar-open":""}`,children:[u.jsxs("div",{className:"sidebar-header",children:[u.jsxs("div",{className:`sidebar-logo ${s?"justify-center gap-0":""}`,children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!s&&u.jsx("span",{children:"ADHDev"})]}),u.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),u.jsx("nav",{className:"sidebar-nav",children:hI.map(d=>u.jsxs("div",{className:c(d.path),id:`nav-${d.id}`,onClick:()=>l(d.path),title:s?d.label:void 0,children:[u.jsx("span",{className:"nav-icon",children:d.icon}),!s&&d.label]},d.id))}),u.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[u.jsxs("div",{className:`nav-item cursor-pointer${r.pathname==="/about"?" active":""} ${s?"justify-center py-2.5 px-0":""}`,id:"nav-about",onClick:()=>t("/about"),title:s?"About":void 0,children:[u.jsx("span",{className:"nav-icon",children:u.jsx(HP,{})}),!s&&"About"]}),!s&&u.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.27"]}),u.jsx(DM,{collapsed:s}),u.jsxs("div",{className:`nav-item cursor-pointer ${s?"justify-center py-2.5 px-0":"mt-1"}`,onClick:a,title:s?"Expand sidebar":"Collapse sidebar",children:[u.jsx("span",{className:"nav-icon text-base",children:s?"›":"‹"}),!s&&u.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),u.jsx("main",{className:"main-content relative",children:u.jsx("div",{className:"main-content-inner",children:e})})]})}const fI=[{icon:"🏠",title:"Local-first",desc:"Everything runs on your machine. No data leaves your network. Full privacy by design."},{icon:"💬",title:"Agent chat relay",desc:"Read and respond to AI conversations in real-time across all connected IDEs."},{icon:"📸",title:"Live screenshots",desc:"View your IDE screens directly in the browser via local WebSocket streaming."},{icon:"🎛️",title:"Remote control",desc:"Click, type, and interact with your IDE from the dashboard — no window switching."},{icon:"🔌",title:"Multi-IDE support",desc:"Monitor and control multiple IDEs simultaneously — VS Code, Cursor, Windsurf, and more."},{icon:"⚡",title:"Extension agents",desc:"Manage extension-based agents like Cline and Roo Code alongside native IDE agents."}],pI=[{icon:"🌍",title:"Access from anywhere",desc:"Control your agents from any device, any network. No VPN or port forwarding needed."},{icon:"🔗",title:"WebRTC P2P streaming",desc:"End-to-end encrypted peer-to-peer connection for zero-latency remote screenshots and control."},{icon:"📱",title:"Mobile notifications",desc:"Get push notifications when agents need approval. Quick approve/reject from your phone."},{icon:"📡",title:"REST API access",desc:"Integrate with Slack, CI/CD pipelines, or custom tools. Scoped API keys with granular permissions."},{icon:"👥",title:"Team dashboard",desc:"Share a unified view across your team. See who's running what, where, in real time."},{icon:"🔐",title:"Enterprise security",desc:"SSO, RBAC, audit logs, and SLA guarantees for production teams."}],mI=[{feature:"Agent chat relay",selfhost:!0,cloud:!0},{feature:"Live IDE screenshots",selfhost:!0,cloud:!0},{feature:"Remote IDE control",selfhost:!0,cloud:!0},{feature:"Multi-IDE monitoring",selfhost:!0,cloud:!0},{feature:"Extension agent support",selfhost:!0,cloud:!0},{feature:"CLI agent support",selfhost:!0,cloud:!0},{feature:"Access from any network",selfhost:!1,cloud:!0},{feature:"WebRTC P2P streaming",selfhost:!1,cloud:!0},{feature:"Mobile push notifications",selfhost:!1,cloud:!0},{feature:"REST API & webhooks",selfhost:!1,cloud:!0},{feature:"Team collaboration",selfhost:!1,cloud:!0},{feature:"Multi-machine (Burrows)",selfhost:!1,cloud:!0},{feature:"SSO / RBAC / Audit logs",selfhost:!1,cloud:!0}],Vu={ides:["VS Code","Cursor","Antigravity","Windsurf","Trae","PearAI","Kiro","VSCodium","VS Code Insiders"],agents:["GitHub Copilot","Cline","Roo Code"],cli:["Gemini CLI","Claude Code","Codex CLI"]};function gI(){return u.jsxs("div",{className:"py-8 px-6 max-w-[860px] mx-auto text-text-primary",children:[u.jsxs("div",{className:"text-center mb-10",children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-14 h-14 mb-3 mx-auto"}),u.jsx("h1",{className:"text-[26px] font-extrabold mb-1.5 text-text-primary",children:"ADHDev"}),u.jsx("p",{className:"text-[13px] text-text-muted",children:"Agent Dashboard Hub for Dev — Self-hosted Edition"}),u.jsxs("div",{className:"inline-block mt-3 px-3 py-1 text-[11px] font-semibold tracking-wide rounded-full bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:["SELFHOST v","0.5.27"]})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"✅"})," What's included"]}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-3",children:fI.map(e=>u.jsxs("div",{className:"bg-bg-glass border border-border-subtle rounded-xl px-4 py-4 transition-colors hover:border-border-default",children:[u.jsx("div",{className:"text-xl mb-1.5",children:e.icon}),u.jsx("div",{className:"font-semibold text-[13px] mb-1",children:e.title}),u.jsx("div",{className:"text-[12px] text-text-muted leading-relaxed",children:e.desc})]},e.title))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsx("h2",{className:"text-lg font-bold mb-4",children:"Compatible with"}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-5",children:[{label:"IDEs",items:Vu.ides},{label:"Extension agents",items:Vu.agents},{label:"CLI agents",items:Vu.cli}].map(e=>u.jsxs("div",{children:[u.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-2 uppercase",children:e.label}),u.jsx("div",{className:"flex flex-col gap-1",children:e.items.map(t=>u.jsx("div",{className:"text-[12px] px-2.5 py-1.5 bg-bg-glass rounded-md border border-border-subtle",children:t},t))})]},e.label))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"⚖️"})," Self-hosted vs Cloud"]}),u.jsx("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:u.jsxs("table",{className:"w-full text-[13px]",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"bg-bg-secondary",children:[u.jsx("th",{className:"text-left px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[100px]",children:"Selfhost"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-[11px] uppercase tracking-wider w-[100px] text-violet-500",children:"Cloud"})]})}),u.jsx("tbody",{children:mI.map((e,t)=>u.jsxs("tr",{className:t%2===0?"bg-bg-glass":"",children:[u.jsx("td",{className:"px-4 py-2 text-text-secondary",children:e.feature}),u.jsx("td",{className:"text-center px-4 py-2",children:e.selfhost?u.jsx("span",{className:"text-emerald-500",children:"✓"}):u.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),u.jsx("td",{className:"text-center px-4 py-2",children:u.jsx("span",{className:"text-emerald-500",children:"✓"})})]},e.feature))})]})})]}),u.jsx("section",{className:"mb-10",children:u.jsx("div",{className:"rounded-2xl border border-violet-500/20 bg-violet-500/[0.04] px-6 py-6",children:u.jsxs("div",{className:"flex items-start gap-4",children:[u.jsx("div",{className:"text-3xl shrink-0",children:"🚀"}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h3",{className:"font-bold text-[15px] mb-1.5",children:"Unlock more with ADHDev Cloud"}),u.jsx("p",{className:"text-[13px] text-text-muted leading-relaxed mb-4",children:"Access your agents from anywhere — your phone, another laptop, or a coffee shop. Cloud adds WebRTC P2P streaming, mobile push notifications, REST API, team collaboration, and multi-machine support. Your local setup stays exactly the same."}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2.5 mb-5",children:pI.map(e=>u.jsxs("div",{className:"flex gap-2.5 items-start",children:[u.jsx("span",{className:"text-base shrink-0 mt-0.5",children:e.icon}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[12px]",children:e.title}),u.jsx("div",{className:"text-[11px] text-text-muted leading-snug",children:e.desc})]})]},e.title))}),u.jsxs("div",{className:"flex gap-3 flex-wrap",children:[u.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Try ADHDev Cloud →"}),u.jsx("a",{href:"https://github.com/vilmire/adhdev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"GitHub"}),u.jsx("a",{href:"https://discord.gg/WJD3tCfBzk",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Discord"})]})]})]})})}),u.jsxs("div",{className:"text-center text-xs text-text-muted pt-4 border-t border-border-subtle",children:[u.jsx("p",{children:"© 2026 ADHDev · Your AI sidekick otter 🦦"}),u.jsx("p",{className:"mt-1 opacity-60",children:"Self-hosted edition — all data stays on your machine"})]})]})}function _I(){const{ides:e}=Zo(),t=e.find(h=>h.type==="adhdev-daemon"),r=(t==null?void 0:t.detectedIdes)||[],{sendCommand:n}=gi(),{userName:i}=Zo(),[s,o]=b.useState(i||"");b.useEffect(()=>{i!==void 0&&o(i)},[i]);const l=h=>{const f=h.target.value.trim();t!=null&&t.id&&f!==i&&n(t.id,"set_user_name",{userName:f}).catch(console.error)},[a,c]=b.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),d=h=>{c(h);try{localStorage.setItem("adhdev_sound",h?"1":"0")}catch{}};return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(NM,{icon:"⚙️",title:"Settings",subtitle:"Local daemon configuration & preferences"}),u.jsxs("div",{className:"page-content",children:[u.jsx(ao,{title:"Daemon",className:"mb-4",children:u.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-x-4 gap-y-2.5 text-sm",children:[u.jsx("span",{className:"text-text-muted",children:"Version"}),u.jsxs("span",{className:"font-mono text-xs",children:["v","0.5.27"]}),u.jsx("span",{className:"text-text-muted",children:"Status"}),u.jsx("span",{className:t?"text-green-400":"text-yellow-400",children:t?"● Running":"○ Not connected"}),u.jsx("span",{className:"text-text-muted",children:"WebSocket"}),u.jsx("span",{className:"font-mono text-xs",children:"ws://localhost:19222"}),u.jsx("span",{className:"text-text-muted",children:"HTTP"}),u.jsx("span",{className:"font-mono text-xs",children:"http://localhost:19280"})]})}),u.jsx(ao,{title:"Detected IDEs",className:"mb-4",children:r.length===0?u.jsx("p",{className:"text-sm text-text-muted",children:"No IDEs detected. Start an IDE to see it here."}):u.jsx("div",{className:"flex flex-col gap-1.5",children:r.map(h=>u.jsxs("div",{className:"flex justify-between items-center bg-bg-glass rounded-lg px-3.5 py-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:`w-2 h-2 rounded-full ${h.running?"bg-green-400":"bg-text-muted/30"}`}),u.jsx("span",{className:"text-sm font-medium",children:h.name})]}),u.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:h.type})]},h.type))})}),u.jsx(ao,{title:"Machine",className:"mb-4",children:u.jsx(FM,{ides:e,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),u.jsx(ao,{title:"Notifications",className:"mb-4",children:u.jsx($M,{})}),u.jsx(ao,{title:"Preferences",className:"mb-4",children:u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsxs("div",{className:"flex items-center justify-between px-3.5 py-4 bg-bg-glass rounded-xl border border-border-subtle hover:border-border-hover transition-colors",children:[u.jsxs("div",{className:"flex flex-col gap-1 pr-4 max-w-[500px]",children:[u.jsx("span",{className:"text-sm font-semibold flex items-center gap-2",children:"👤 Display Name"}),u.jsx("span",{className:"text-[12px] text-text-muted leading-relaxed",children:"Your name shown in chat threads and on the team dashboard."})]}),u.jsx("input",{type:"text",className:"bg-bg-primary border border-border-strong rounded-lg px-3 py-1.5 text-sm w-48 text-right focus:border-accent-primary focus:outline-none transition-colors",placeholder:"Anonymous",value:s,onChange:h=>o(h.target.value),onBlur:l,onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur()}})]}),u.jsx(is,{label:"🔊 Sound Effects",description:"Play a sound when agent completes or needs approval",checked:a,onChange:d})]})})]})]})}function iv(){const{ides:e}=Zo(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?u.jsx(aa,{to:`/machines/${t.id}`,replace:!0}):e.length>0?u.jsx(aa,{to:`/machines/${e[0].id}`,replace:!0}):u.jsx(aa,{to:"/dashboard",replace:!0})}function vI(){return u.jsx(Bk,{children:u.jsx(uI,{children:u.jsx(Hk,{value:{sendCommand:xa,sendData:()=>!1},children:u.jsx(dI,{children:u.jsxs(Ik,{children:[u.jsx(yn,{path:"/dashboard",element:u.jsx(ZM,{})}),u.jsx(yn,{path:"/ide/:id",element:u.jsx(tI,{})}),u.jsx(yn,{path:"/machine",element:u.jsx(iv,{})}),u.jsx(yn,{path:"/machines/:id",element:u.jsx(nI,{})}),u.jsx(yn,{path:"/machines",element:u.jsx(iv,{})}),u.jsx(yn,{path:"/about",element:u.jsx(gI,{})}),u.jsx(yn,{path:"/settings",element:u.jsx(_I,{})}),u.jsx(yn,{path:"*",element:u.jsx(aa,{to:"/dashboard",replace:!0})})]})})})})})}w0(document.getElementById("root")).render(u.jsx(b.StrictMode,{children:u.jsx(vI,{})}));
|