@adhdev/daemon-standalone 0.5.2 โ 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-94oyUw_i.js +186 -0
- package/public/assets/index-96w38vUG.js +186 -0
- package/public/assets/index-B10-caE3.css +32 -0
- package/public/assets/{index-CBNZegw7.js โ index-B2YMaA0y.js} +48 -48
- package/public/assets/index-BFcENe83.js +186 -0
- package/public/assets/index-BLoxWHbc.css +32 -0
- package/public/assets/index-BRaYxriU.js +186 -0
- package/public/assets/index-BiGfAi3p.css +32 -0
- package/public/assets/index-BoMNLSFo.js +186 -0
- package/public/assets/index-Bqd63kEf.js +186 -0
- package/public/assets/index-BrRx73WW.css +32 -0
- package/public/assets/index-BtFBYt4S.js +186 -0
- package/public/assets/index-Buh3CKsZ.css +32 -0
- package/public/assets/index-BwTB9bq4.css +32 -0
- package/public/assets/index-C3WbW5-9.css +32 -0
- package/public/assets/index-C3kQpRwM.js +186 -0
- package/public/assets/index-CBPu6684.css +32 -0
- package/public/assets/index-CRb5jZSP.js +186 -0
- package/public/assets/index-CcwtBh4z.css +32 -0
- package/public/assets/index-Cdl_Uf8k.css +32 -0
- package/public/assets/index-CiRrLeo4.js +186 -0
- package/public/assets/index-CwzgUmt4.css +32 -0
- package/public/assets/index-D3r1MeBL.css +32 -0
- package/public/assets/index-D41sUK70.js +186 -0
- package/public/assets/index-D5ZAG2ed.js +186 -0
- package/public/assets/index-DCq6bTMj.css +32 -0
- package/public/assets/index-DDN-N8-r.css +32 -0
- package/public/assets/index-DE_LrhPD.js +186 -0
- package/public/assets/index-DH3JFo3P.js +186 -0
- package/public/assets/index-DHu8pF3J.js +186 -0
- package/public/assets/index-DJbQi3ra.js +186 -0
- package/public/assets/index-DR6VqErb.js +186 -0
- package/public/assets/index-DTXVM3Vb.css +32 -0
- package/public/assets/index-Ddcbtwg-.js +186 -0
- package/public/assets/index-Dg92qUFt.js +186 -0
- package/public/assets/index-DhLjcjFc.css +32 -0
- package/public/assets/index-DmdYQOWM.js +186 -0
- package/public/assets/index-DthOENaz.css +32 -0
- package/public/assets/index-DvOOmQ1s.js +186 -0
- package/public/assets/index-W2ECenxW.css +32 -0
- package/public/assets/index-_0NDaGCi.js +186 -0
- package/public/assets/index-c_ex_bK7.js +186 -0
- package/public/assets/index-fQgFNmvM.js +186 -0
- package/public/assets/index-j9BGHnc1.js +186 -0
- package/public/assets/index-oQ8GgkYr.css +32 -0
- package/public/assets/index-qBcMLS7S.js +186 -0
- package/public/assets/index-u7iXS4BI.js +186 -0
- package/public/assets/index-uCH1wvbu.js +186 -0
- package/public/index.html +2 -2
- package/public/assets/index-CXefPiE6.css +0 -32
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
var Jx=Object.defineProperty;var e1=(e,t,r)=>t in e?Jx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ss=(e,t,r)=>e1(e,typeof t!="symbol"?t+"":t,r);function t1(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var Vl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ed(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var p_={exports:{}},Na={},m_={exports:{}},Ie={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Mo=Symbol.for("react.element"),r1=Symbol.for("react.portal"),n1=Symbol.for("react.fragment"),i1=Symbol.for("react.strict_mode"),s1=Symbol.for("react.profiler"),o1=Symbol.for("react.provider"),l1=Symbol.for("react.context"),a1=Symbol.for("react.forward_ref"),c1=Symbol.for("react.suspense"),u1=Symbol.for("react.memo"),h1=Symbol.for("react.lazy"),$f=Symbol.iterator;function d1(e){return e===null||typeof e!="object"?null:(e=$f&&e[$f]||e["@@iterator"],typeof e=="function"?e:null)}var g_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},__=Object.assign,v_={};function ds(e,t,r){this.props=e,this.context=t,this.refs=v_,this.updater=r||g_}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 y_(){}y_.prototype=ds.prototype;function td(e,t,r){this.props=e,this.context=t,this.refs=v_,this.updater=r||g_}var rd=td.prototype=new y_;rd.constructor=td;__(rd,ds.prototype);rd.isPureReactComponent=!0;var Wf=Array.isArray,x_=Object.prototype.hasOwnProperty,nd={current:null},w_={key:!0,ref:!0,__self:!0,__source:!0};function S_(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)x_.call(t,n)&&!w_.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:Mo,type:e,key:s,ref:o,props:i,_owner:nd.current}}function f1(e,t){return{$$typeof:Mo,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function id(e){return typeof e=="object"&&e!==null&&e.$$typeof===Mo}function p1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var Hf=/\/+/g;function tc(e,t){return typeof e=="object"&&e!==null&&e.key!=null?p1(""+e.key):t.toString(36)}function Sl(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 Mo:case r1:o=!0}}if(o)return o=e,i=i(o),e=n===""?"."+tc(o,0):n,Wf(i)?(r="",e!=null&&(r=e.replace(Hf,"$&/")+"/"),Sl(i,t,r,"",function(c){return c})):i!=null&&(id(i)&&(i=f1(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Hf,"$&/")+"/")+e)),t.push(i)),1;if(o=0,n=n===""?".":n+":",Wf(e))for(var l=0;l<e.length;l++){s=e[l];var a=n+tc(s,l);o+=Sl(s,t,r,a,i)}else if(a=d1(e),typeof a=="function")for(e=a.call(e),l=0;!(s=e.next()).done;)s=s.value,a=n+tc(s,l++),o+=Sl(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 Xo(e,t,r){if(e==null)return e;var n=[],i=0;return Sl(e,n,"","",function(s){return t.call(r,s,i++)}),n}function m1(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 Ht={current:null},bl={transition:null},g1={ReactCurrentDispatcher:Ht,ReactCurrentBatchConfig:bl,ReactCurrentOwner:nd};function b_(){throw Error("act(...) is not supported in production builds of React.")}Ie.Children={map:Xo,forEach:function(e,t,r){Xo(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Xo(e,function(){t++}),t},toArray:function(e){return Xo(e,function(t){return t})||[]},only:function(e){if(!id(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ie.Component=ds;Ie.Fragment=n1;Ie.Profiler=s1;Ie.PureComponent=td;Ie.StrictMode=i1;Ie.Suspense=c1;Ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=g1;Ie.act=b_;Ie.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=__({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=nd.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)x_.call(t,a)&&!w_.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:Mo,type:e.type,key:i,ref:s,props:n,_owner:o}};Ie.createContext=function(e){return e={$$typeof:l1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o1,_context:e},e.Consumer=e};Ie.createElement=S_;Ie.createFactory=function(e){var t=S_.bind(null,e);return t.type=e,t};Ie.createRef=function(){return{current:null}};Ie.forwardRef=function(e){return{$$typeof:a1,render:e}};Ie.isValidElement=id;Ie.lazy=function(e){return{$$typeof:h1,_payload:{_status:-1,_result:e},_init:m1}};Ie.memo=function(e,t){return{$$typeof:u1,type:e,compare:t===void 0?null:t}};Ie.startTransition=function(e){var t=bl.transition;bl.transition={};try{e()}finally{bl.transition=t}};Ie.unstable_act=b_;Ie.useCallback=function(e,t){return Ht.current.useCallback(e,t)};Ie.useContext=function(e){return Ht.current.useContext(e)};Ie.useDebugValue=function(){};Ie.useDeferredValue=function(e){return Ht.current.useDeferredValue(e)};Ie.useEffect=function(e,t){return Ht.current.useEffect(e,t)};Ie.useId=function(){return Ht.current.useId()};Ie.useImperativeHandle=function(e,t,r){return Ht.current.useImperativeHandle(e,t,r)};Ie.useInsertionEffect=function(e,t){return Ht.current.useInsertionEffect(e,t)};Ie.useLayoutEffect=function(e,t){return Ht.current.useLayoutEffect(e,t)};Ie.useMemo=function(e,t){return Ht.current.useMemo(e,t)};Ie.useReducer=function(e,t,r){return Ht.current.useReducer(e,t,r)};Ie.useRef=function(e){return Ht.current.useRef(e)};Ie.useState=function(e){return Ht.current.useState(e)};Ie.useSyncExternalStore=function(e,t,r){return Ht.current.useSyncExternalStore(e,t,r)};Ie.useTransition=function(){return Ht.current.useTransition()};Ie.version="18.3.1";m_.exports=Ie;var w=m_.exports;const _1=ed(w),v1=t1({__proto__:null,default:_1},[w]);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var y1=w,x1=Symbol.for("react.element"),w1=Symbol.for("react.fragment"),S1=Object.prototype.hasOwnProperty,b1=y1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,k1={key:!0,ref:!0,__self:!0,__source:!0};function k_(e,t,r){var n,i={},s=null,o=null;r!==void 0&&(s=""+r),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)S1.call(t,n)&&!k1.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:x1,type:e,key:s,ref:o,props:i,_owner:b1.current}}Na.Fragment=w1;Na.jsx=k_;Na.jsxs=k_;p_.exports=Na;var d=p_.exports,C_={exports:{}},fr={},E_={exports:{}},N_={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(P,$){var b=P.length;P.push($);e:for(;0<b;){var ne=b-1>>>1,ce=P[ne];if(0<i(ce,$))P[ne]=$,P[b]=ce,b=ne;else break e}}function r(P){return P.length===0?null:P[0]}function n(P){if(P.length===0)return null;var $=P[0],b=P.pop();if(b!==$){P[0]=b;e:for(var ne=0,ce=P.length,k=ce>>>1;ne<k;){var _e=2*(ne+1)-1,X=P[_e],te=_e+1,Y=P[te];if(0>i(X,b))te<ce&&0>i(Y,X)?(P[ne]=Y,P[te]=b,ne=te):(P[ne]=X,P[_e]=b,ne=_e);else if(te<ce&&0>i(Y,b))P[ne]=Y,P[te]=b,ne=te;else break e}}return $}function i(P,$){var b=P.sortIndex-$.sortIndex;return b!==0?b:P.id-$.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=[],h=1,u=null,f=3,p=!1,m=!1,g=!1,S=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(P){for(var $=r(c);$!==null;){if($.callback===null)n(c);else if($.startTime<=P)n(c),$.sortIndex=$.expirationTime,t(a,$);else break;$=r(c)}}function N(P){if(g=!1,x(P),!m)if(r(a)!==null)m=!0,j(T);else{var $=r(c);$!==null&&q(N,$.startTime-P)}}function T(P,$){m=!1,g&&(g=!1,_(O),O=-1),p=!0;var b=f;try{for(x($),u=r(a);u!==null&&(!(u.expirationTime>$)||P&&!H());){var ne=u.callback;if(typeof ne=="function"){u.callback=null,f=u.priorityLevel;var ce=ne(u.expirationTime<=$);$=e.unstable_now(),typeof ce=="function"?u.callback=ce:u===r(a)&&n(a),x($)}else n(a);u=r(a)}if(u!==null)var k=!0;else{var _e=r(c);_e!==null&&q(N,_e.startTime-$),k=!1}return k}finally{u=null,f=b,p=!1}}var C=!1,R=null,O=-1,z=5,E=-1;function H(){return!(e.unstable_now()-E<z)}function A(){if(R!==null){var P=e.unstable_now();E=P;var $=!0;try{$=R(!0,P)}finally{$?M():(C=!1,R=null)}}else C=!1}var M;if(typeof y=="function")M=function(){y(A)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,L=V.port2;V.port1.onmessage=A,M=function(){L.postMessage(null)}}else M=function(){S(A,0)};function j(P){R=P,C||(C=!0,M())}function q(P,$){O=S(function(){P(e.unstable_now())},$)}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(P){P.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,j(T))},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(a)},e.unstable_next=function(P){switch(f){case 1:case 2:case 3:var $=3;break;default:$=f}var b=f;f=$;try{return P()}finally{f=b}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,$){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var b=f;f=P;try{return $()}finally{f=b}},e.unstable_scheduleCallback=function(P,$,b){var ne=e.unstable_now();switch(typeof b=="object"&&b!==null?(b=b.delay,b=typeof b=="number"&&0<b?ne+b:ne):b=ne,P){case 1:var ce=-1;break;case 2:ce=250;break;case 5:ce=1073741823;break;case 4:ce=1e4;break;default:ce=5e3}return ce=b+ce,P={id:h++,callback:$,priorityLevel:P,startTime:b,expirationTime:ce,sortIndex:-1},b>ne?(P.sortIndex=b,t(c,P),r(a)===null&&P===r(c)&&(g?(_(O),O=-1):g=!0,q(N,b-ne))):(P.sortIndex=ce,t(a,P),m||p||(m=!0,j(T))),P},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(P){var $=f;return function(){var b=f;f=$;try{return P.apply(this,arguments)}finally{f=b}}}})(N_);E_.exports=N_;var C1=E_.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var E1=w,dr=C1;function re(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 T_=new Set,co={};function ki(e,t){ns(e,t),ns(e+"Capture",t)}function ns(e,t){for(co[e]=t,e=0;e<t.length;e++)T_.add(t[e])}var dn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),au=Object.prototype.hasOwnProperty,N1=/^[: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]*$/,Uf={},Vf={};function T1(e){return au.call(Vf,e)?!0:au.call(Uf,e)?!1:N1.test(e)?Vf[e]=!0:(Uf[e]=!0,!1)}function L1(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 P1(e,t,r,n){if(t===null||typeof t>"u"||L1(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 Ut(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 Pt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Pt[e]=new Ut(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Pt[t]=new Ut(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Pt[e]=new Ut(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Pt[e]=new Ut(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){Pt[e]=new Ut(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Pt[e]=new Ut(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Pt[e]=new Ut(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Pt[e]=new Ut(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Pt[e]=new Ut(e,5,!1,e.toLowerCase(),null,!1,!1)});var sd=/[\-:]([a-z])/g;function od(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(sd,od);Pt[t]=new Ut(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(sd,od);Pt[t]=new Ut(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(sd,od);Pt[t]=new Ut(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Pt[e]=new Ut(e,1,!1,e.toLowerCase(),null,!1,!1)});Pt.xlinkHref=new Ut("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Pt[e]=new Ut(e,1,!1,e.toLowerCase(),null,!0,!0)});function ld(e,t,r,n){var i=Pt.hasOwnProperty(t)?Pt[t]:null;(i!==null?i.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(P1(t,r,i,n)&&(r=null),n||i===null?T1(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 gn=E1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Go=Symbol.for("react.element"),ji=Symbol.for("react.portal"),Bi=Symbol.for("react.fragment"),ad=Symbol.for("react.strict_mode"),cu=Symbol.for("react.profiler"),L_=Symbol.for("react.provider"),P_=Symbol.for("react.context"),cd=Symbol.for("react.forward_ref"),uu=Symbol.for("react.suspense"),hu=Symbol.for("react.suspense_list"),ud=Symbol.for("react.memo"),En=Symbol.for("react.lazy"),D_=Symbol.for("react.offscreen"),Kf=Symbol.iterator;function bs(e){return e===null||typeof e!="object"?null:(e=Kf&&e[Kf]||e["@@iterator"],typeof e=="function"?e:null)}var Je=Object.assign,rc;function Fs(e){if(rc===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);rc=t&&t[1]||""}return`
|
|
34
|
+
`+rc+e}var nc=!1;function ic(e,t){if(!e||nc)return"";nc=!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
|
+
`),s=n.stack.split(`
|
|
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{nc=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Fs(e):""}function D1(e){switch(e.tag){case 5:return Fs(e.type);case 16:return Fs("Lazy");case 13:return Fs("Suspense");case 19:return Fs("SuspenseList");case 0:case 2:case 15:return e=ic(e.type,!1),e;case 11:return e=ic(e.type.render,!1),e;case 1:return e=ic(e.type,!0),e;default:return""}}function du(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 Bi:return"Fragment";case ji:return"Portal";case cu:return"Profiler";case ad:return"StrictMode";case uu:return"Suspense";case hu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case P_:return(e.displayName||"Context")+".Consumer";case L_:return(e._context.displayName||"Context")+".Provider";case cd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ud:return t=e.displayName||null,t!==null?t:du(e.type)||"Memo";case En:t=e._payload,e=e._init;try{return du(e(t))}catch{}}return null}function I1(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 du(t);case 8:return t===ad?"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 Un(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function I_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function R1(e){var t=I_(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 Qo(e){e._valueTracker||(e._valueTracker=R1(e))}function R_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=I_(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Kl(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 fu(e,t){var r=t.checked;return Je({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function qf(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Un(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 M_(e,t){t=t.checked,t!=null&&ld(e,"checked",t,!1)}function pu(e,t){M_(e,t);var r=Un(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")?mu(e,t.type,r):t.hasOwnProperty("defaultValue")&&mu(e,t.type,Un(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Yf(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 mu(e,t,r){(t!=="number"||Kl(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var $s=Array.isArray;function Xi(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=""+Un(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 gu(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(re(91));return Je({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Xf(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(re(92));if($s(r)){if(1<r.length)throw Error(re(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Un(r)}}function A_(e,t){var r=Un(t.value),n=Un(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 Gf(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function j_(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 _u(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?j_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Zo,B_=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(Zo=Zo||document.createElement("div"),Zo.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Zo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function uo(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Xs={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},M1=["Webkit","ms","Moz","O"];Object.keys(Xs).forEach(function(e){M1.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Xs[t]=Xs[e]})});function O_(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Xs.hasOwnProperty(e)&&Xs[e]?(""+t).trim():t+"px"}function z_(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=O_(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var A1=Je({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 vu(e,t){if(t){if(A1[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(re(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(re(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(re(61))}if(t.style!=null&&typeof t.style!="object")throw Error(re(62))}}function yu(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 xu=null;function hd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wu=null,Gi=null,Qi=null;function Qf(e){if(e=Bo(e)){if(typeof wu!="function")throw Error(re(280));var t=e.stateNode;t&&(t=Ia(t),wu(e.stateNode,e.type,t))}}function F_(e){Gi?Qi?Qi.push(e):Qi=[e]:Gi=e}function $_(){if(Gi){var e=Gi,t=Qi;if(Qi=Gi=null,Qf(e),t)for(e=0;e<t.length;e++)Qf(t[e])}}function W_(e,t){return e(t)}function H_(){}var sc=!1;function U_(e,t,r){if(sc)return e(t,r);sc=!0;try{return W_(e,t,r)}finally{sc=!1,(Gi!==null||Qi!==null)&&(H_(),$_())}}function ho(e,t){var r=e.stateNode;if(r===null)return null;var n=Ia(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(re(231,t,typeof r));return r}var Su=!1;if(dn)try{var ks={};Object.defineProperty(ks,"passive",{get:function(){Su=!0}}),window.addEventListener("test",ks,ks),window.removeEventListener("test",ks,ks)}catch{Su=!1}function j1(e,t,r,n,i,s,o,l,a){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(h){this.onError(h)}}var Gs=!1,ql=null,Yl=!1,bu=null,B1={onError:function(e){Gs=!0,ql=e}};function O1(e,t,r,n,i,s,o,l,a){Gs=!1,ql=null,j1.apply(B1,arguments)}function z1(e,t,r,n,i,s,o,l,a){if(O1.apply(this,arguments),Gs){if(Gs){var c=ql;Gs=!1,ql=null}else throw Error(re(198));Yl||(Yl=!0,bu=c)}}function Ci(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 Zf(e){if(Ci(e)!==e)throw Error(re(188))}function F1(e){var t=e.alternate;if(!t){if(t=Ci(e),t===null)throw Error(re(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 Zf(i),e;if(s===n)return Zf(i),t;s=s.sibling}throw Error(re(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(re(189))}}if(r.alternate!==n)throw Error(re(190))}if(r.tag!==3)throw Error(re(188));return r.stateNode.current===r?e:t}function K_(e){return e=F1(e),e!==null?q_(e):null}function q_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=q_(e);if(t!==null)return t;e=e.sibling}return null}var Y_=dr.unstable_scheduleCallback,Jf=dr.unstable_cancelCallback,$1=dr.unstable_shouldYield,W1=dr.unstable_requestPaint,st=dr.unstable_now,H1=dr.unstable_getCurrentPriorityLevel,dd=dr.unstable_ImmediatePriority,X_=dr.unstable_UserBlockingPriority,Xl=dr.unstable_NormalPriority,U1=dr.unstable_LowPriority,G_=dr.unstable_IdlePriority,Ta=null,Qr=null;function V1(e){if(Qr&&typeof Qr.onCommitFiberRoot=="function")try{Qr.onCommitFiberRoot(Ta,e,void 0,(e.current.flags&128)===128)}catch{}}var Br=Math.clz32?Math.clz32:Y1,K1=Math.log,q1=Math.LN2;function Y1(e){return e>>>=0,e===0?32:31-(K1(e)/q1|0)|0}var Jo=64,el=4194304;function Ws(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 Gl(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=Ws(l):(s&=o,s!==0&&(n=Ws(s)))}else o=r&~i,o!==0?n=Ws(o):s!==0&&(n=Ws(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-Br(t),i=1<<r,n|=e[r],t&=~i;return n}function X1(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 G1(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Br(s),l=1<<o,a=i[o];a===-1?(!(l&r)||l&n)&&(i[o]=X1(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function ku(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Q_(){var e=Jo;return Jo<<=1,!(Jo&4194240)&&(Jo=64),e}function oc(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Ao(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Br(t),e[t]=r}function Q1(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-Br(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}function fd(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Br(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var je=0;function Z_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var J_,pd,ev,tv,rv,Cu=!1,tl=[],An=null,jn=null,Bn=null,fo=new Map,po=new Map,Ln=[],Z1="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 ep(e,t){switch(e){case"focusin":case"focusout":An=null;break;case"dragenter":case"dragleave":jn=null;break;case"mouseover":case"mouseout":Bn=null;break;case"pointerover":case"pointerout":fo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":po.delete(t.pointerId)}}function Cs(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=Bo(t),t!==null&&pd(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function J1(e,t,r,n,i){switch(t){case"focusin":return An=Cs(An,e,t,r,n,i),!0;case"dragenter":return jn=Cs(jn,e,t,r,n,i),!0;case"mouseover":return Bn=Cs(Bn,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return fo.set(s,Cs(fo.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,po.set(s,Cs(po.get(s)||null,e,t,r,n,i)),!0}return!1}function nv(e){var t=ai(e.target);if(t!==null){var r=Ci(t);if(r!==null){if(t=r.tag,t===13){if(t=V_(r),t!==null){e.blockedOn=t,rv(e.priority,function(){ev(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 kl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Eu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);xu=n,r.target.dispatchEvent(n),xu=null}else return t=Bo(r),t!==null&&pd(t),e.blockedOn=r,!1;t.shift()}return!0}function tp(e,t,r){kl(e)&&r.delete(t)}function ew(){Cu=!1,An!==null&&kl(An)&&(An=null),jn!==null&&kl(jn)&&(jn=null),Bn!==null&&kl(Bn)&&(Bn=null),fo.forEach(tp),po.forEach(tp)}function Es(e,t){e.blockedOn===t&&(e.blockedOn=null,Cu||(Cu=!0,dr.unstable_scheduleCallback(dr.unstable_NormalPriority,ew)))}function mo(e){function t(i){return Es(i,e)}if(0<tl.length){Es(tl[0],e);for(var r=1;r<tl.length;r++){var n=tl[r];n.blockedOn===e&&(n.blockedOn=null)}}for(An!==null&&Es(An,e),jn!==null&&Es(jn,e),Bn!==null&&Es(Bn,e),fo.forEach(t),po.forEach(t),r=0;r<Ln.length;r++)n=Ln[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Ln.length&&(r=Ln[0],r.blockedOn===null);)nv(r),r.blockedOn===null&&Ln.shift()}var Zi=gn.ReactCurrentBatchConfig,Ql=!0;function tw(e,t,r,n){var i=je,s=Zi.transition;Zi.transition=null;try{je=1,md(e,t,r,n)}finally{je=i,Zi.transition=s}}function rw(e,t,r,n){var i=je,s=Zi.transition;Zi.transition=null;try{je=4,md(e,t,r,n)}finally{je=i,Zi.transition=s}}function md(e,t,r,n){if(Ql){var i=Eu(e,t,r,n);if(i===null)gc(e,t,n,Zl,r),ep(e,n);else if(J1(i,e,t,r,n))n.stopPropagation();else if(ep(e,n),t&4&&-1<Z1.indexOf(e)){for(;i!==null;){var s=Bo(i);if(s!==null&&J_(s),s=Eu(e,t,r,n),s===null&&gc(e,t,n,Zl,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else gc(e,t,n,null,r)}}var Zl=null;function Eu(e,t,r,n){if(Zl=null,e=hd(n),e=ai(e),e!==null)if(t=Ci(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 Zl=e,null}function iv(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(H1()){case dd:return 1;case X_:return 4;case Xl:case U1:return 16;case G_:return 536870912;default:return 16}default:return 16}}var Dn=null,gd=null,Cl=null;function sv(){if(Cl)return Cl;var e,t=gd,r=t.length,n,i="value"in Dn?Dn.value:Dn.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 Cl=i.slice(e,1<n?1-n:void 0)}function El(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 rl(){return!0}function rp(){return!1}function pr(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)?rl:rp,this.isPropagationStopped=rp,this}return Je(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=rl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=rl)},persist:function(){},isPersistent:rl}),t}var fs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_d=pr(fs),jo=Je({},fs,{view:0,detail:0}),nw=pr(jo),lc,ac,Ns,La=Je({},jo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vd,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!==Ns&&(Ns&&e.type==="mousemove"?(lc=e.screenX-Ns.screenX,ac=e.screenY-Ns.screenY):ac=lc=0,Ns=e),lc)},movementY:function(e){return"movementY"in e?e.movementY:ac}}),np=pr(La),iw=Je({},La,{dataTransfer:0}),sw=pr(iw),ow=Je({},jo,{relatedTarget:0}),cc=pr(ow),lw=Je({},fs,{animationName:0,elapsedTime:0,pseudoElement:0}),aw=pr(lw),cw=Je({},fs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),uw=pr(cw),hw=Je({},fs,{data:0}),ip=pr(hw),dw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fw={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 mw(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=pw[e])?!!t[e]:!1}function vd(){return mw}var gw=Je({},jo,{key:function(e){if(e.key){var t=dw[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=El(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?fw[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vd,charCode:function(e){return e.type==="keypress"?El(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?El(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),_w=pr(gw),vw=Je({},La,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sp=pr(vw),yw=Je({},jo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vd}),xw=pr(yw),ww=Je({},fs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Sw=pr(ww),bw=Je({},La,{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}),kw=pr(bw),Cw=[9,13,27,32],yd=dn&&"CompositionEvent"in window,Qs=null;dn&&"documentMode"in document&&(Qs=document.documentMode);var Ew=dn&&"TextEvent"in window&&!Qs,ov=dn&&(!yd||Qs&&8<Qs&&11>=Qs),op=" ",lp=!1;function lv(e,t){switch(e){case"keyup":return Cw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function av(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Oi=!1;function Nw(e,t){switch(e){case"compositionend":return av(t);case"keypress":return t.which!==32?null:(lp=!0,op);case"textInput":return e=t.data,e===op&&lp?null:e;default:return null}}function Tw(e,t){if(Oi)return e==="compositionend"||!yd&&lv(e,t)?(e=sv(),Cl=gd=Dn=null,Oi=!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 ov&&t.locale!=="ko"?null:t.data;default:return null}}var Lw={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 ap(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Lw[e.type]:t==="textarea"}function cv(e,t,r,n){F_(n),t=Jl(t,"onChange"),0<t.length&&(r=new _d("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Zs=null,go=null;function Pw(e){xv(e,0)}function Pa(e){var t=$i(e);if(R_(t))return e}function Dw(e,t){if(e==="change")return t}var uv=!1;if(dn){var uc;if(dn){var hc="oninput"in document;if(!hc){var cp=document.createElement("div");cp.setAttribute("oninput","return;"),hc=typeof cp.oninput=="function"}uc=hc}else uc=!1;uv=uc&&(!document.documentMode||9<document.documentMode)}function up(){Zs&&(Zs.detachEvent("onpropertychange",hv),go=Zs=null)}function hv(e){if(e.propertyName==="value"&&Pa(go)){var t=[];cv(t,go,e,hd(e)),U_(Pw,t)}}function Iw(e,t,r){e==="focusin"?(up(),Zs=t,go=r,Zs.attachEvent("onpropertychange",hv)):e==="focusout"&&up()}function Rw(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Pa(go)}function Mw(e,t){if(e==="click")return Pa(t)}function Aw(e,t){if(e==="input"||e==="change")return Pa(t)}function jw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Fr=typeof Object.is=="function"?Object.is:jw;function _o(e,t){if(Fr(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(!au.call(t,i)||!Fr(e[i],t[i]))return!1}return!0}function hp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dp(e,t){var r=hp(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=hp(r)}}function dv(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?dv(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function fv(){for(var e=window,t=Kl();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Kl(e.document)}return t}function xd(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 Bw(e){var t=fv(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&dv(r.ownerDocument.documentElement,r)){if(n!==null&&xd(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=dp(r,s);var o=dp(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 Ow=dn&&"documentMode"in document&&11>=document.documentMode,zi=null,Nu=null,Js=null,Tu=!1;function fp(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Tu||zi==null||zi!==Kl(n)||(n=zi,"selectionStart"in n&&xd(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}),Js&&_o(Js,n)||(Js=n,n=Jl(Nu,"onSelect"),0<n.length&&(t=new _d("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=zi)))}function nl(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Fi={animationend:nl("Animation","AnimationEnd"),animationiteration:nl("Animation","AnimationIteration"),animationstart:nl("Animation","AnimationStart"),transitionend:nl("Transition","TransitionEnd")},dc={},pv={};dn&&(pv=document.createElement("div").style,"AnimationEvent"in window||(delete Fi.animationend.animation,delete Fi.animationiteration.animation,delete Fi.animationstart.animation),"TransitionEvent"in window||delete Fi.transitionend.transition);function Da(e){if(dc[e])return dc[e];if(!Fi[e])return e;var t=Fi[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in pv)return dc[e]=t[r];return e}var mv=Da("animationend"),gv=Da("animationiteration"),_v=Da("animationstart"),vv=Da("transitionend"),yv=new Map,pp="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 Kn(e,t){yv.set(e,t),ki(t,[e])}for(var fc=0;fc<pp.length;fc++){var pc=pp[fc],zw=pc.toLowerCase(),Fw=pc[0].toUpperCase()+pc.slice(1);Kn(zw,"on"+Fw)}Kn(mv,"onAnimationEnd");Kn(gv,"onAnimationIteration");Kn(_v,"onAnimationStart");Kn("dblclick","onDoubleClick");Kn("focusin","onFocus");Kn("focusout","onBlur");Kn(vv,"onTransitionEnd");ns("onMouseEnter",["mouseout","mouseover"]);ns("onMouseLeave",["mouseout","mouseover"]);ns("onPointerEnter",["pointerout","pointerover"]);ns("onPointerLeave",["pointerout","pointerover"]);ki("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ki("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ki("onBeforeInput",["compositionend","keypress","textInput","paste"]);ki("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ki("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ki("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hs="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(" "),$w=new Set("cancel close invalid load scroll toggle".split(" ").concat(Hs));function mp(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,z1(n,t,void 0,e),e.currentTarget=null}function xv(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;mp(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;mp(i,l,c),s=a}}}if(Yl)throw e=bu,Yl=!1,bu=null,e}function He(e,t){var r=t[Ru];r===void 0&&(r=t[Ru]=new Set);var n=e+"__bubble";r.has(n)||(wv(t,e,2,!1),r.add(n))}function mc(e,t,r){var n=0;t&&(n|=4),wv(r,e,n,t)}var il="_reactListening"+Math.random().toString(36).slice(2);function vo(e){if(!e[il]){e[il]=!0,T_.forEach(function(r){r!=="selectionchange"&&($w.has(r)||mc(r,!1,e),mc(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[il]||(t[il]=!0,mc("selectionchange",!1,t))}}function wv(e,t,r,n){switch(iv(t)){case 1:var i=tw;break;case 4:i=rw;break;default:i=md}r=i.bind(null,t,r,e),i=void 0,!Su||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=ai(l),o===null)return;if(a=o.tag,a===5||a===6){n=s=o;continue e}l=l.parentNode}}n=n.return}U_(function(){var c=s,h=hd(r),u=[];e:{var f=yv.get(e);if(f!==void 0){var p=_d,m=e;switch(e){case"keypress":if(El(r)===0)break e;case"keydown":case"keyup":p=_w;break;case"focusin":m="focus",p=cc;break;case"focusout":m="blur",p=cc;break;case"beforeblur":case"afterblur":p=cc;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=np;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=sw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=xw;break;case mv:case gv:case _v:p=aw;break;case vv:p=Sw;break;case"scroll":p=nw;break;case"wheel":p=kw;break;case"copy":case"cut":case"paste":p=uw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=sp}var g=(t&4)!==0,S=!g&&e==="scroll",_=g?f!==null?f+"Capture":null:f;g=[];for(var y=c,x;y!==null;){x=y;var N=x.stateNode;if(x.tag===5&&N!==null&&(x=N,_!==null&&(N=ho(y,_),N!=null&&g.push(yo(y,N,x)))),S)break;y=y.return}0<g.length&&(f=new p(f,m,null,r,h),u.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==xu&&(m=r.relatedTarget||r.fromElement)&&(ai(m)||m[fn]))break e;if((p||f)&&(f=h.window===h?h:(f=h.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=r.relatedTarget||r.toElement,p=c,m=m?ai(m):null,m!==null&&(S=Ci(m),m!==S||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(g=np,N="onMouseLeave",_="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(g=sp,N="onPointerLeave",_="onPointerEnter",y="pointer"),S=p==null?f:$i(p),x=m==null?f:$i(m),f=new g(N,y+"leave",p,r,h),f.target=S,f.relatedTarget=x,N=null,ai(h)===c&&(g=new g(_,y+"enter",m,r,h),g.target=x,g.relatedTarget=S,N=g),S=N,p&&m)t:{for(g=p,_=m,y=0,x=g;x;x=Di(x))y++;for(x=0,N=_;N;N=Di(N))x++;for(;0<y-x;)g=Di(g),y--;for(;0<x-y;)_=Di(_),x--;for(;y--;){if(g===_||_!==null&&g===_.alternate)break t;g=Di(g),_=Di(_)}g=null}else g=null;p!==null&&gp(u,f,p,g,!1),m!==null&&S!==null&&gp(u,S,m,g,!0)}}e:{if(f=c?$i(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var T=Dw;else if(ap(f))if(uv)T=Aw;else{T=Rw;var C=Iw}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(T=Mw);if(T&&(T=T(e,c))){cv(u,T,r,h);break e}C&&C(e,f,c),e==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&mu(f,"number",f.value)}switch(C=c?$i(c):window,e){case"focusin":(ap(C)||C.contentEditable==="true")&&(zi=C,Nu=c,Js=null);break;case"focusout":Js=Nu=zi=null;break;case"mousedown":Tu=!0;break;case"contextmenu":case"mouseup":case"dragend":Tu=!1,fp(u,r,h);break;case"selectionchange":if(Ow)break;case"keydown":case"keyup":fp(u,r,h)}var R;if(yd)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else Oi?lv(e,r)&&(O="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(O="onCompositionStart");O&&(ov&&r.locale!=="ko"&&(Oi||O!=="onCompositionStart"?O==="onCompositionEnd"&&Oi&&(R=sv()):(Dn=h,gd="value"in Dn?Dn.value:Dn.textContent,Oi=!0)),C=Jl(c,O),0<C.length&&(O=new ip(O,e,null,r,h),u.push({event:O,listeners:C}),R?O.data=R:(R=av(r),R!==null&&(O.data=R)))),(R=Ew?Nw(e,r):Tw(e,r))&&(c=Jl(c,"onBeforeInput"),0<c.length&&(h=new ip("onBeforeInput","beforeinput",null,r,h),u.push({event:h,listeners:c}),h.data=R))}xv(u,t)})}function yo(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Jl(e,t){for(var r=t+"Capture",n=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=ho(e,r),s!=null&&n.unshift(yo(e,s,i)),s=ho(e,t),s!=null&&n.push(yo(e,s,i))),e=e.return}return n}function Di(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function gp(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=ho(r,s),a!=null&&o.unshift(yo(r,a,l))):i||(a=ho(r,s),a!=null&&o.push(yo(r,a,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var Ww=/\r\n?/g,Hw=/\u0000|\uFFFD/g;function _p(e){return(typeof e=="string"?e:""+e).replace(Ww,`
|
|
38
|
+
`).replace(Hw,"")}function sl(e,t,r){if(t=_p(t),_p(e)!==t&&r)throw Error(re(425))}function ea(){}var Lu=null,Pu=null;function Du(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 Iu=typeof setTimeout=="function"?setTimeout:void 0,Uw=typeof clearTimeout=="function"?clearTimeout:void 0,vp=typeof Promise=="function"?Promise:void 0,Vw=typeof queueMicrotask=="function"?queueMicrotask:typeof vp<"u"?function(e){return vp.resolve(null).then(e).catch(Kw)}:Iu;function Kw(e){setTimeout(function(){throw e})}function _c(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),mo(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);mo(t)}function On(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 yp(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 ps=Math.random().toString(36).slice(2),Xr="__reactFiber$"+ps,xo="__reactProps$"+ps,fn="__reactContainer$"+ps,Ru="__reactEvents$"+ps,qw="__reactListeners$"+ps,Yw="__reactHandles$"+ps;function ai(e){var t=e[Xr];if(t)return t;for(var r=e.parentNode;r;){if(t=r[fn]||r[Xr]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=yp(e);e!==null;){if(r=e[Xr])return r;e=yp(e)}return t}e=r,r=e.parentNode}return null}function Bo(e){return e=e[Xr]||e[fn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function $i(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(re(33))}function Ia(e){return e[xo]||null}var Mu=[],Wi=-1;function qn(e){return{current:e}}function Ve(e){0>Wi||(e.current=Mu[Wi],Mu[Wi]=null,Wi--)}function $e(e,t){Wi++,Mu[Wi]=e.current,e.current=t}var Vn={},Bt=qn(Vn),Jt=qn(!1),gi=Vn;function is(e,t){var r=e.type.contextTypes;if(!r)return Vn;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 er(e){return e=e.childContextTypes,e!=null}function ta(){Ve(Jt),Ve(Bt)}function xp(e,t,r){if(Bt.current!==Vn)throw Error(re(168));$e(Bt,t),$e(Jt,r)}function Sv(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(re(108,I1(e)||"Unknown",i));return Je({},r,n)}function ra(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vn,gi=Bt.current,$e(Bt,e),$e(Jt,Jt.current),!0}function wp(e,t,r){var n=e.stateNode;if(!n)throw Error(re(169));r?(e=Sv(e,t,gi),n.__reactInternalMemoizedMergedChildContext=e,Ve(Jt),Ve(Bt),$e(Bt,e)):Ve(Jt),$e(Jt,r)}var on=null,Ra=!1,vc=!1;function bv(e){on===null?on=[e]:on.push(e)}function Xw(e){Ra=!0,bv(e)}function Yn(){if(!vc&&on!==null){vc=!0;var e=0,t=je;try{var r=on;for(je=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}on=null,Ra=!1}catch(i){throw on!==null&&(on=on.slice(e+1)),Y_(dd,Yn),i}finally{je=t,vc=!1}}return null}var Hi=[],Ui=0,na=null,ia=0,Sr=[],br=0,_i=null,an=1,cn="";function ni(e,t){Hi[Ui++]=ia,Hi[Ui++]=na,na=e,ia=t}function kv(e,t,r){Sr[br++]=an,Sr[br++]=cn,Sr[br++]=_i,_i=e;var n=an;e=cn;var i=32-Br(n)-1;n&=~(1<<i),r+=1;var s=32-Br(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,an=1<<32-Br(t)+i|r<<i|n,cn=s+e}else an=1<<s|r<<i|n,cn=e}function wd(e){e.return!==null&&(ni(e,1),kv(e,1,0))}function Sd(e){for(;e===na;)na=Hi[--Ui],Hi[Ui]=null,ia=Hi[--Ui],Hi[Ui]=null;for(;e===_i;)_i=Sr[--br],Sr[br]=null,cn=Sr[--br],Sr[br]=null,an=Sr[--br],Sr[br]=null}var ur=null,cr=null,Ke=!1,Ar=null;function Cv(e,t){var r=Cr(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 Sp(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,ur=e,cr=On(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ur=e,cr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=_i!==null?{id:an,overflow:cn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Cr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,ur=e,cr=null,!0):!1;default:return!1}}function Au(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ju(e){if(Ke){var t=cr;if(t){var r=t;if(!Sp(e,t)){if(Au(e))throw Error(re(418));t=On(r.nextSibling);var n=ur;t&&Sp(e,t)?Cv(n,r):(e.flags=e.flags&-4097|2,Ke=!1,ur=e)}}else{if(Au(e))throw Error(re(418));e.flags=e.flags&-4097|2,Ke=!1,ur=e}}}function bp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ur=e}function ol(e){if(e!==ur)return!1;if(!Ke)return bp(e),Ke=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Du(e.type,e.memoizedProps)),t&&(t=cr)){if(Au(e))throw Ev(),Error(re(418));for(;t;)Cv(e,t),t=On(t.nextSibling)}if(bp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(re(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){cr=On(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}cr=null}}else cr=ur?On(e.stateNode.nextSibling):null;return!0}function Ev(){for(var e=cr;e;)e=On(e.nextSibling)}function ss(){cr=ur=null,Ke=!1}function bd(e){Ar===null?Ar=[e]:Ar.push(e)}var Gw=gn.ReactCurrentBatchConfig;function Ts(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(re(309));var n=r.stateNode}if(!n)throw Error(re(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(re(284));if(!r._owner)throw Error(re(290,e))}return e}function ll(e,t){throw e=Object.prototype.toString.call(t),Error(re(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function kp(e){var t=e._init;return t(e._payload)}function Nv(e){function t(_,y){if(e){var x=_.deletions;x===null?(_.deletions=[y],_.flags|=16):x.push(y)}}function r(_,y){if(!e)return null;for(;y!==null;)t(_,y),y=y.sibling;return null}function n(_,y){for(_=new Map;y!==null;)y.key!==null?_.set(y.key,y):_.set(y.index,y),y=y.sibling;return _}function i(_,y){return _=Wn(_,y),_.index=0,_.sibling=null,_}function s(_,y,x){return _.index=x,e?(x=_.alternate,x!==null?(x=x.index,x<y?(_.flags|=2,y):x):(_.flags|=2,y)):(_.flags|=1048576,y)}function o(_){return e&&_.alternate===null&&(_.flags|=2),_}function l(_,y,x,N){return y===null||y.tag!==6?(y=Cc(x,_.mode,N),y.return=_,y):(y=i(y,x),y.return=_,y)}function a(_,y,x,N){var T=x.type;return T===Bi?h(_,y,x.props.children,N,x.key):y!==null&&(y.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===En&&kp(T)===y.type)?(N=i(y,x.props),N.ref=Ts(_,y,x),N.return=_,N):(N=Rl(x.type,x.key,x.props,null,_.mode,N),N.ref=Ts(_,y,x),N.return=_,N)}function c(_,y,x,N){return y===null||y.tag!==4||y.stateNode.containerInfo!==x.containerInfo||y.stateNode.implementation!==x.implementation?(y=Ec(x,_.mode,N),y.return=_,y):(y=i(y,x.children||[]),y.return=_,y)}function h(_,y,x,N,T){return y===null||y.tag!==7?(y=fi(x,_.mode,N,T),y.return=_,y):(y=i(y,x),y.return=_,y)}function u(_,y,x){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Cc(""+y,_.mode,x),y.return=_,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Go:return x=Rl(y.type,y.key,y.props,null,_.mode,x),x.ref=Ts(_,null,y),x.return=_,x;case ji:return y=Ec(y,_.mode,x),y.return=_,y;case En:var N=y._init;return u(_,N(y._payload),x)}if($s(y)||bs(y))return y=fi(y,_.mode,x,null),y.return=_,y;ll(_,y)}return null}function f(_,y,x,N){var T=y!==null?y.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return T!==null?null:l(_,y,""+x,N);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Go:return x.key===T?a(_,y,x,N):null;case ji:return x.key===T?c(_,y,x,N):null;case En:return T=x._init,f(_,y,T(x._payload),N)}if($s(x)||bs(x))return T!==null?null:h(_,y,x,N,null);ll(_,x)}return null}function p(_,y,x,N,T){if(typeof N=="string"&&N!==""||typeof N=="number")return _=_.get(x)||null,l(y,_,""+N,T);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case Go:return _=_.get(N.key===null?x:N.key)||null,a(y,_,N,T);case ji:return _=_.get(N.key===null?x:N.key)||null,c(y,_,N,T);case En:var C=N._init;return p(_,y,x,C(N._payload),T)}if($s(N)||bs(N))return _=_.get(x)||null,h(y,_,N,T,null);ll(y,N)}return null}function m(_,y,x,N){for(var T=null,C=null,R=y,O=y=0,z=null;R!==null&&O<x.length;O++){R.index>O?(z=R,R=null):z=R.sibling;var E=f(_,R,x[O],N);if(E===null){R===null&&(R=z);break}e&&R&&E.alternate===null&&t(_,R),y=s(E,y,O),C===null?T=E:C.sibling=E,C=E,R=z}if(O===x.length)return r(_,R),Ke&&ni(_,O),T;if(R===null){for(;O<x.length;O++)R=u(_,x[O],N),R!==null&&(y=s(R,y,O),C===null?T=R:C.sibling=R,C=R);return Ke&&ni(_,O),T}for(R=n(_,R);O<x.length;O++)z=p(R,_,O,x[O],N),z!==null&&(e&&z.alternate!==null&&R.delete(z.key===null?O:z.key),y=s(z,y,O),C===null?T=z:C.sibling=z,C=z);return e&&R.forEach(function(H){return t(_,H)}),Ke&&ni(_,O),T}function g(_,y,x,N){var T=bs(x);if(typeof T!="function")throw Error(re(150));if(x=T.call(x),x==null)throw Error(re(151));for(var C=T=null,R=y,O=y=0,z=null,E=x.next();R!==null&&!E.done;O++,E=x.next()){R.index>O?(z=R,R=null):z=R.sibling;var H=f(_,R,E.value,N);if(H===null){R===null&&(R=z);break}e&&R&&H.alternate===null&&t(_,R),y=s(H,y,O),C===null?T=H:C.sibling=H,C=H,R=z}if(E.done)return r(_,R),Ke&&ni(_,O),T;if(R===null){for(;!E.done;O++,E=x.next())E=u(_,E.value,N),E!==null&&(y=s(E,y,O),C===null?T=E:C.sibling=E,C=E);return Ke&&ni(_,O),T}for(R=n(_,R);!E.done;O++,E=x.next())E=p(R,_,O,E.value,N),E!==null&&(e&&E.alternate!==null&&R.delete(E.key===null?O:E.key),y=s(E,y,O),C===null?T=E:C.sibling=E,C=E);return e&&R.forEach(function(A){return t(_,A)}),Ke&&ni(_,O),T}function S(_,y,x,N){if(typeof x=="object"&&x!==null&&x.type===Bi&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Go:e:{for(var T=x.key,C=y;C!==null;){if(C.key===T){if(T=x.type,T===Bi){if(C.tag===7){r(_,C.sibling),y=i(C,x.props.children),y.return=_,_=y;break e}}else if(C.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===En&&kp(T)===C.type){r(_,C.sibling),y=i(C,x.props),y.ref=Ts(_,C,x),y.return=_,_=y;break e}r(_,C);break}else t(_,C);C=C.sibling}x.type===Bi?(y=fi(x.props.children,_.mode,N,x.key),y.return=_,_=y):(N=Rl(x.type,x.key,x.props,null,_.mode,N),N.ref=Ts(_,y,x),N.return=_,_=N)}return o(_);case ji:e:{for(C=x.key;y!==null;){if(y.key===C)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){r(_,y.sibling),y=i(y,x.children||[]),y.return=_,_=y;break e}else{r(_,y);break}else t(_,y);y=y.sibling}y=Ec(x,_.mode,N),y.return=_,_=y}return o(_);case En:return C=x._init,S(_,y,C(x._payload),N)}if($s(x))return m(_,y,x,N);if(bs(x))return g(_,y,x,N);ll(_,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(r(_,y.sibling),y=i(y,x),y.return=_,_=y):(r(_,y),y=Cc(x,_.mode,N),y.return=_,_=y),o(_)):r(_,y)}return S}var os=Nv(!0),Tv=Nv(!1),sa=qn(null),oa=null,Vi=null,kd=null;function Cd(){kd=Vi=oa=null}function Ed(e){var t=sa.current;Ve(sa),e._currentValue=t}function Bu(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 Ji(e,t){oa=e,kd=Vi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Zt=!0),e.firstContext=null)}function Tr(e){var t=e._currentValue;if(kd!==e)if(e={context:e,memoizedValue:t,next:null},Vi===null){if(oa===null)throw Error(re(308));Vi=e,oa.dependencies={lanes:0,firstContext:e}}else Vi=Vi.next=e;return t}var ci=null;function Nd(e){ci===null?ci=[e]:ci.push(e)}function Lv(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,Nd(t)):(r.next=i.next,i.next=r),t.interleaved=r,pn(e,n)}function pn(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 Nn=!1;function Td(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Pv(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 hn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function zn(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Ae&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,pn(e,r)}return i=n.interleaved,i===null?(t.next=t,Nd(n)):(t.next=i.next,i.next=t),n.interleaved=t,pn(e,r)}function Nl(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,fd(e,r)}}function Cp(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 la(e,t,r,n){var i=e.updateQueue;Nn=!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 h=e.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==o&&(l===null?h.firstBaseUpdate=c:l.next=c,h.lastBaseUpdate=a))}if(s!==null){var u=i.baseState;o=0,h=c=a=null,l=s;do{var f=l.lane,p=l.eventTime;if((n&f)===f){h!==null&&(h=h.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"){u=m.call(p,u,f);break e}u=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m=="function"?m.call(p,u,f):m,f==null)break e;u=Je({},u,f);break e;case 2:Nn=!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},h===null?(c=h=p,a=u):h=h.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(h===null&&(a=u),i.baseState=a,i.firstBaseUpdate=c,i.lastBaseUpdate=h,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);yi|=o,e.lanes=o,e.memoizedState=u}}function Ep(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(re(191,i));i.call(n)}}}var Oo={},Zr=qn(Oo),wo=qn(Oo),So=qn(Oo);function ui(e){if(e===Oo)throw Error(re(174));return e}function Ld(e,t){switch($e(So,t),$e(wo,e),$e(Zr,Oo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:_u(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=_u(t,e)}Ve(Zr),$e(Zr,t)}function ls(){Ve(Zr),Ve(wo),Ve(So)}function Dv(e){ui(So.current);var t=ui(Zr.current),r=_u(t,e.type);t!==r&&($e(wo,e),$e(Zr,r))}function Pd(e){wo.current===e&&(Ve(Zr),Ve(wo))}var Qe=qn(0);function aa(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 yc=[];function Dd(){for(var e=0;e<yc.length;e++)yc[e]._workInProgressVersionPrimary=null;yc.length=0}var Tl=gn.ReactCurrentDispatcher,xc=gn.ReactCurrentBatchConfig,vi=0,Ze=null,ft=null,vt=null,ca=!1,eo=!1,bo=0,Qw=0;function It(){throw Error(re(321))}function Id(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Fr(e[r],t[r]))return!1;return!0}function Rd(e,t,r,n,i,s){if(vi=s,Ze=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Tl.current=e===null||e.memoizedState===null?tS:rS,e=r(n,i),eo){s=0;do{if(eo=!1,bo=0,25<=s)throw Error(re(301));s+=1,vt=ft=null,t.updateQueue=null,Tl.current=nS,e=r(n,i)}while(eo)}if(Tl.current=ua,t=ft!==null&&ft.next!==null,vi=0,vt=ft=Ze=null,ca=!1,t)throw Error(re(300));return e}function Md(){var e=bo!==0;return bo=0,e}function Kr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?Ze.memoizedState=vt=e:vt=vt.next=e,vt}function Lr(){if(ft===null){var e=Ze.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var t=vt===null?Ze.memoizedState:vt.next;if(t!==null)vt=t,ft=e;else{if(e===null)throw Error(re(310));ft=e,e={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},vt===null?Ze.memoizedState=vt=e:vt=vt.next=e}return vt}function ko(e,t){return typeof t=="function"?t(e):t}function wc(e){var t=Lr(),r=t.queue;if(r===null)throw Error(re(311));r.lastRenderedReducer=e;var n=ft,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 h=c.lane;if((vi&h)===h)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 u={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=u,o=n):a=a.next=u,Ze.lanes|=h,yi|=h}c=c.next}while(c!==null&&c!==s);a===null?o=n:a.next=l,Fr(n,t.memoizedState)||(Zt=!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,Ze.lanes|=s,yi|=s,i=i.next;while(i!==e)}else i===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Sc(e){var t=Lr(),r=t.queue;if(r===null)throw Error(re(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);Fr(s,t.memoizedState)||(Zt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function Iv(){}function Rv(e,t){var r=Ze,n=Lr(),i=t(),s=!Fr(n.memoizedState,i);if(s&&(n.memoizedState=i,Zt=!0),n=n.queue,Ad(jv.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||vt!==null&&vt.memoizedState.tag&1){if(r.flags|=2048,Co(9,Av.bind(null,r,n,i,t),void 0,null),St===null)throw Error(re(349));vi&30||Mv(r,t,i)}return i}function Mv(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Ze.updateQueue,t===null?(t={lastEffect:null,stores:null},Ze.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Av(e,t,r,n){t.value=r,t.getSnapshot=n,Bv(t)&&Ov(e)}function jv(e,t,r){return r(function(){Bv(t)&&Ov(e)})}function Bv(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Fr(e,r)}catch{return!0}}function Ov(e){var t=pn(e,1);t!==null&&Or(t,e,1,-1)}function Np(e){var t=Kr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ko,lastRenderedState:e},t.queue=e,e=e.dispatch=eS.bind(null,Ze,e),[t.memoizedState,e]}function Co(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=Ze.updateQueue,t===null?(t={lastEffect:null,stores:null},Ze.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 zv(){return Lr().memoizedState}function Ll(e,t,r,n){var i=Kr();Ze.flags|=e,i.memoizedState=Co(1|t,r,void 0,n===void 0?null:n)}function Ma(e,t,r,n){var i=Lr();n=n===void 0?null:n;var s=void 0;if(ft!==null){var o=ft.memoizedState;if(s=o.destroy,n!==null&&Id(n,o.deps)){i.memoizedState=Co(t,r,s,n);return}}Ze.flags|=e,i.memoizedState=Co(1|t,r,s,n)}function Tp(e,t){return Ll(8390656,8,e,t)}function Ad(e,t){return Ma(2048,8,e,t)}function Fv(e,t){return Ma(4,2,e,t)}function $v(e,t){return Ma(4,4,e,t)}function Wv(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 Hv(e,t,r){return r=r!=null?r.concat([e]):null,Ma(4,4,Wv.bind(null,t,e),r)}function jd(){}function Uv(e,t){var r=Lr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Id(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Vv(e,t){var r=Lr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Id(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Kv(e,t,r){return vi&21?(Fr(r,t)||(r=Q_(),Ze.lanes|=r,yi|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Zt=!0),e.memoizedState=r)}function Zw(e,t){var r=je;je=r!==0&&4>r?r:4,e(!0);var n=xc.transition;xc.transition={};try{e(!1),t()}finally{je=r,xc.transition=n}}function qv(){return Lr().memoizedState}function Jw(e,t,r){var n=$n(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Yv(e))Xv(t,r);else if(r=Lv(e,t,r,n),r!==null){var i=Wt();Or(r,e,n,i),Gv(r,t,n)}}function eS(e,t,r){var n=$n(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Yv(e))Xv(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,Fr(l,o)){var a=t.interleaved;a===null?(i.next=i,Nd(t)):(i.next=a.next,a.next=i),t.interleaved=i;return}}catch{}finally{}r=Lv(e,t,i,n),r!==null&&(i=Wt(),Or(r,e,n,i),Gv(r,t,n))}}function Yv(e){var t=e.alternate;return e===Ze||t!==null&&t===Ze}function Xv(e,t){eo=ca=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Gv(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,fd(e,r)}}var ua={readContext:Tr,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useInsertionEffect:It,useLayoutEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useMutableSource:It,useSyncExternalStore:It,useId:It,unstable_isNewReconciler:!1},tS={readContext:Tr,useCallback:function(e,t){return Kr().memoizedState=[e,t===void 0?null:t],e},useContext:Tr,useEffect:Tp,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Ll(4194308,4,Wv.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Ll(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ll(4,2,e,t)},useMemo:function(e,t){var r=Kr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Kr();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=Jw.bind(null,Ze,e),[n.memoizedState,e]},useRef:function(e){var t=Kr();return e={current:e},t.memoizedState=e},useState:Np,useDebugValue:jd,useDeferredValue:function(e){return Kr().memoizedState=e},useTransition:function(){var e=Np(!1),t=e[0];return e=Zw.bind(null,e[1]),Kr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ze,i=Kr();if(Ke){if(r===void 0)throw Error(re(407));r=r()}else{if(r=t(),St===null)throw Error(re(349));vi&30||Mv(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,Tp(jv.bind(null,n,s,e),[e]),n.flags|=2048,Co(9,Av.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=Kr(),t=St.identifierPrefix;if(Ke){var r=cn,n=an;r=(n&~(1<<32-Br(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=bo++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=Qw++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},rS={readContext:Tr,useCallback:Uv,useContext:Tr,useEffect:Ad,useImperativeHandle:Hv,useInsertionEffect:Fv,useLayoutEffect:$v,useMemo:Vv,useReducer:wc,useRef:zv,useState:function(){return wc(ko)},useDebugValue:jd,useDeferredValue:function(e){var t=Lr();return Kv(t,ft.memoizedState,e)},useTransition:function(){var e=wc(ko)[0],t=Lr().memoizedState;return[e,t]},useMutableSource:Iv,useSyncExternalStore:Rv,useId:qv,unstable_isNewReconciler:!1},nS={readContext:Tr,useCallback:Uv,useContext:Tr,useEffect:Ad,useImperativeHandle:Hv,useInsertionEffect:Fv,useLayoutEffect:$v,useMemo:Vv,useReducer:Sc,useRef:zv,useState:function(){return Sc(ko)},useDebugValue:jd,useDeferredValue:function(e){var t=Lr();return ft===null?t.memoizedState=e:Kv(t,ft.memoizedState,e)},useTransition:function(){var e=Sc(ko)[0],t=Lr().memoizedState;return[e,t]},useMutableSource:Iv,useSyncExternalStore:Rv,useId:qv,unstable_isNewReconciler:!1};function Rr(e,t){if(e&&e.defaultProps){t=Je({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Ou(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:Je({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Aa={isMounted:function(e){return(e=e._reactInternals)?Ci(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Wt(),i=$n(e),s=hn(n,i);s.payload=t,r!=null&&(s.callback=r),t=zn(e,s,i),t!==null&&(Or(t,e,i,n),Nl(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Wt(),i=$n(e),s=hn(n,i);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=zn(e,s,i),t!==null&&(Or(t,e,i,n),Nl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Wt(),n=$n(e),i=hn(r,n);i.tag=2,t!=null&&(i.callback=t),t=zn(e,i,n),t!==null&&(Or(t,e,n,r),Nl(t,e,n))}};function Lp(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?!_o(r,n)||!_o(i,s):!0}function Qv(e,t,r){var n=!1,i=Vn,s=t.contextType;return typeof s=="object"&&s!==null?s=Tr(s):(i=er(t)?gi:Bt.current,n=t.contextTypes,s=(n=n!=null)?is(e,i):Vn),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Aa,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function Pp(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&&Aa.enqueueReplaceState(t,t.state,null)}function zu(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs={},Td(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Tr(s):(s=er(t)?gi:Bt.current,i.context=is(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Ou(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&&Aa.enqueueReplaceState(i,i.state,null),la(e,r,i,n),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function as(e,t){try{var r="",n=t;do r+=D1(n),n=n.return;while(n);var i=r}catch(s){i=`
|
|
39
|
+
Error generating stack: `+s.message+`
|
|
40
|
+
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function bc(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Fu(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var iS=typeof WeakMap=="function"?WeakMap:Map;function Zv(e,t,r){r=hn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){da||(da=!0,Gu=n),Fu(e,t)},r}function Jv(e,t,r){r=hn(-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(){Fu(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){Fu(e,t),typeof n!="function"&&(Fn===null?Fn=new Set([this]):Fn.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function Dp(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new iS;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=vS.bind(null,e,t,r),t.then(e,e))}function Ip(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 Rp(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=hn(-1,1),t.tag=2,zn(r,t,1))),r.lanes|=1),e)}var sS=gn.ReactCurrentOwner,Zt=!1;function Ft(e,t,r,n){t.child=e===null?Tv(t,null,r,n):os(t,e.child,r,n)}function Mp(e,t,r,n,i){r=r.render;var s=t.ref;return Ji(t,i),n=Rd(e,t,r,n,s,i),r=Md(),e!==null&&!Zt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,mn(e,t,i)):(Ke&&r&&wd(t),t.flags|=1,Ft(e,t,n,i),t.child)}function Ap(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!Ud(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,e0(e,t,s,n,i)):(e=Rl(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:_o,r(o,n)&&e.ref===t.ref)return mn(e,t,i)}return t.flags|=1,e=Wn(s,n),e.ref=t.ref,e.return=t,t.child=e}function e0(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(_o(s,n)&&e.ref===t.ref)if(Zt=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&(Zt=!0);else return t.lanes=e.lanes,mn(e,t,i)}return $u(e,t,r,n,i)}function t0(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},$e(qi,lr),lr|=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,$e(qi,lr),lr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,$e(qi,lr),lr|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,$e(qi,lr),lr|=n;return Ft(e,t,i,r),t.child}function r0(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function $u(e,t,r,n,i){var s=er(r)?gi:Bt.current;return s=is(t,s),Ji(t,i),r=Rd(e,t,r,n,s,i),n=Md(),e!==null&&!Zt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,mn(e,t,i)):(Ke&&n&&wd(t),t.flags|=1,Ft(e,t,r,i),t.child)}function jp(e,t,r,n,i){if(er(r)){var s=!0;ra(t)}else s=!1;if(Ji(t,i),t.stateNode===null)Pl(e,t),Qv(t,r,n),zu(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=Tr(c):(c=er(r)?gi:Bt.current,c=is(t,c));var h=r.getDerivedStateFromProps,u=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||a!==c)&&Pp(t,o,n,c),Nn=!1;var f=t.memoizedState;o.state=f,la(t,n,o,i),a=t.memoizedState,l!==n||f!==a||Jt.current||Nn?(typeof h=="function"&&(Ou(t,r,h,n),a=t.memoizedState),(l=Nn||Lp(t,r,l,n,f,a,c))?(u||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=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,Pv(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Rr(t.type,l),o.props=c,u=t.pendingProps,f=o.context,a=r.contextType,typeof a=="object"&&a!==null?a=Tr(a):(a=er(r)?gi:Bt.current,a=is(t,a));var p=r.getDerivedStateFromProps;(h=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==u||f!==a)&&Pp(t,o,n,a),Nn=!1,f=t.memoizedState,o.state=f,la(t,n,o,i);var m=t.memoizedState;l!==u||f!==m||Jt.current||Nn?(typeof p=="function"&&(Ou(t,r,p,n),m=t.memoizedState),(c=Nn||Lp(t,r,c,n,f,m,a)||!1)?(h||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 Wu(e,t,r,n,s,i)}function Wu(e,t,r,n,i,s){r0(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&wp(t,r,!1),mn(e,t,s);n=t.stateNode,sS.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=os(t,e.child,null,s),t.child=os(t,null,l,s)):Ft(e,t,l,s),t.memoizedState=n.state,i&&wp(t,r,!0),t.child}function n0(e){var t=e.stateNode;t.pendingContext?xp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&xp(e,t.context,!1),Ld(e,t.containerInfo)}function Bp(e,t,r,n,i){return ss(),bd(i),t.flags|=256,Ft(e,t,r,n),t.child}var Hu={dehydrated:null,treeContext:null,retryLane:0};function Uu(e){return{baseLanes:e,cachePool:null,transitions:null}}function i0(e,t,r){var n=t.pendingProps,i=Qe.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),$e(Qe,i&1),e===null)return ju(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=Oa(o,n,0,null),e=fi(e,n,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Uu(r),t.memoizedState=Hu,e):Bd(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return oS(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=Wn(i,a),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=Wn(l,s):(s=fi(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?Uu(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=Hu,n}return s=e.child,e=s.sibling,n=Wn(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 Bd(e,t){return t=Oa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function al(e,t,r,n){return n!==null&&bd(n),os(t,e.child,null,r),e=Bd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function oS(e,t,r,n,i,s,o){if(r)return t.flags&256?(t.flags&=-257,n=bc(Error(re(422))),al(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=Oa({mode:"visible",children:n.children},i,0,null),s=fi(s,i,o,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,t.mode&1&&os(t,e.child,null,o),t.child.memoizedState=Uu(o),t.memoizedState=Hu,s);if(!(t.mode&1))return al(e,t,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,s=Error(re(419)),n=bc(s,n,void 0),al(e,t,o,n)}if(l=(o&e.childLanes)!==0,Zt||l){if(n=St,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,pn(e,i),Or(n,e,i,-1))}return Hd(),n=bc(Error(re(421))),al(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=yS.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,cr=On(i.nextSibling),ur=t,Ke=!0,Ar=null,e!==null&&(Sr[br++]=an,Sr[br++]=cn,Sr[br++]=_i,an=e.id,cn=e.overflow,_i=t),t=Bd(t,n.children),t.flags|=4096,t)}function Op(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Bu(e.return,t,r)}function kc(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 s0(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(Ft(e,t,n.children,r),n=Qe.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&&Op(e,r,t);else if(e.tag===19)Op(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($e(Qe,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&&aa(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),kc(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&&aa(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}kc(t,!0,r,null,s);break;case"together":kc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Pl(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),yi|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(re(153));if(t.child!==null){for(e=t.child,r=Wn(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Wn(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function lS(e,t,r){switch(t.tag){case 3:n0(t),ss();break;case 5:Dv(t);break;case 1:er(t.type)&&ra(t);break;case 4:Ld(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;$e(sa,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?($e(Qe,Qe.current&1),t.flags|=128,null):r&t.child.childLanes?i0(e,t,r):($e(Qe,Qe.current&1),e=mn(e,t,r),e!==null?e.sibling:null);$e(Qe,Qe.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return s0(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),$e(Qe,Qe.current),n)break;return null;case 22:case 23:return t.lanes=0,t0(e,t,r)}return mn(e,t,r)}var o0,Vu,l0,a0;o0=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}};Vu=function(){};l0=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,ui(Zr.current);var s=null;switch(r){case"input":i=fu(e,i),n=fu(e,n),s=[];break;case"select":i=Je({},i,{value:void 0}),n=Je({},n,{value:void 0}),s=[];break;case"textarea":i=gu(e,i),n=gu(e,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=ea)}vu(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"&&(co.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"&&(co.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&He("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)}};a0=function(e,t,r,n){r!==n&&(t.flags|=4)};function Ls(e,t){if(!Ke)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 Rt(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 aS(e,t,r){var n=t.pendingProps;switch(Sd(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(t),null;case 1:return er(t.type)&&ta(),Rt(t),null;case 3:return n=t.stateNode,ls(),Ve(Jt),Ve(Bt),Dd(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ol(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ar!==null&&(Ju(Ar),Ar=null))),Vu(e,t),Rt(t),null;case 5:Pd(t);var i=ui(So.current);if(r=t.type,e!==null&&t.stateNode!=null)l0(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(re(166));return Rt(t),null}if(e=ui(Zr.current),ol(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[Xr]=t,n[xo]=s,e=(t.mode&1)!==0,r){case"dialog":He("cancel",n),He("close",n);break;case"iframe":case"object":case"embed":He("load",n);break;case"video":case"audio":for(i=0;i<Hs.length;i++)He(Hs[i],n);break;case"source":He("error",n);break;case"img":case"image":case"link":He("error",n),He("load",n);break;case"details":He("toggle",n);break;case"input":qf(n,s),He("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},He("invalid",n);break;case"textarea":Xf(n,s),He("invalid",n)}vu(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&&sl(n.textContent,l,e),i=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&sl(n.textContent,l,e),i=["children",""+l]):co.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&He("scroll",n)}switch(r){case"input":Qo(n),Yf(n,s,!0);break;case"textarea":Qo(n),Gf(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=ea)}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=j_(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[Xr]=t,e[xo]=n,o0(e,t,!1,!1),t.stateNode=e;e:{switch(o=yu(r,n),r){case"dialog":He("cancel",e),He("close",e),i=n;break;case"iframe":case"object":case"embed":He("load",e),i=n;break;case"video":case"audio":for(i=0;i<Hs.length;i++)He(Hs[i],e);i=n;break;case"source":He("error",e),i=n;break;case"img":case"image":case"link":He("error",e),He("load",e),i=n;break;case"details":He("toggle",e),i=n;break;case"input":qf(e,n),i=fu(e,n),He("invalid",e);break;case"option":i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=Je({},n,{value:void 0}),He("invalid",e);break;case"textarea":Xf(e,n),i=gu(e,n),He("invalid",e);break;default:i=n}vu(r,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?z_(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&B_(e,a)):s==="children"?typeof a=="string"?(r!=="textarea"||a!=="")&&uo(e,a):typeof a=="number"&&uo(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(co.hasOwnProperty(s)?a!=null&&s==="onScroll"&&He("scroll",e):a!=null&&ld(e,s,a,o))}switch(r){case"input":Qo(e),Yf(e,n,!1);break;case"textarea":Qo(e),Gf(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Un(n.value));break;case"select":e.multiple=!!n.multiple,s=n.value,s!=null?Xi(e,!!n.multiple,s,!1):n.defaultValue!=null&&Xi(e,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=ea)}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 Rt(t),null;case 6:if(e&&t.stateNode!=null)a0(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(re(166));if(r=ui(So.current),ui(Zr.current),ol(t)){if(n=t.stateNode,r=t.memoizedProps,n[Xr]=t,(s=n.nodeValue!==r)&&(e=ur,e!==null))switch(e.tag){case 3:sl(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&sl(n.nodeValue,r,(e.mode&1)!==0)}s&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Xr]=t,t.stateNode=n}return Rt(t),null;case 13:if(Ve(Qe),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ke&&cr!==null&&t.mode&1&&!(t.flags&128))Ev(),ss(),t.flags|=98560,s=!1;else if(s=ol(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(re(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(re(317));s[Xr]=t}else ss(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rt(t),s=!1}else Ar!==null&&(Ju(Ar),Ar=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||Qe.current&1?pt===0&&(pt=3):Hd())),t.updateQueue!==null&&(t.flags|=4),Rt(t),null);case 4:return ls(),Vu(e,t),e===null&&vo(t.stateNode.containerInfo),Rt(t),null;case 10:return Ed(t.type._context),Rt(t),null;case 17:return er(t.type)&&ta(),Rt(t),null;case 19:if(Ve(Qe),s=t.memoizedState,s===null)return Rt(t),null;if(n=(t.flags&128)!==0,o=s.rendering,o===null)if(n)Ls(s,!1);else{if(pt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=aa(e),o!==null){for(t.flags|=128,Ls(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 $e(Qe,Qe.current&1|2),t.child}e=e.sibling}s.tail!==null&&st()>cs&&(t.flags|=128,n=!0,Ls(s,!1),t.lanes=4194304)}else{if(!n)if(e=aa(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ls(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ke)return Rt(t),null}else 2*st()-s.renderingStartTime>cs&&r!==1073741824&&(t.flags|=128,n=!0,Ls(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=st(),t.sibling=null,r=Qe.current,$e(Qe,n?r&1|2:r&1),t):(Rt(t),null);case 22:case 23:return Wd(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?lr&1073741824&&(Rt(t),t.subtreeFlags&6&&(t.flags|=8192)):Rt(t),null;case 24:return null;case 25:return null}throw Error(re(156,t.tag))}function cS(e,t){switch(Sd(t),t.tag){case 1:return er(t.type)&&ta(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ls(),Ve(Jt),Ve(Bt),Dd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Pd(t),null;case 13:if(Ve(Qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(re(340));ss()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ve(Qe),null;case 4:return ls(),null;case 10:return Ed(t.type._context),null;case 22:case 23:return Wd(),null;case 24:return null;default:return null}}var cl=!1,At=!1,uS=typeof WeakSet=="function"?WeakSet:Set,he=null;function Ki(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){rt(e,t,n)}else r.current=null}function Ku(e,t,r){try{r()}catch(n){rt(e,t,n)}}var zp=!1;function hS(e,t){if(Lu=Ql,e=fv(),xd(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,h=0,u=e,f=null;t:for(;;){for(var p;u!==r||i!==0&&u.nodeType!==3||(l=o+i),u!==s||n!==0&&u.nodeType!==3||(a=o+n),u.nodeType===3&&(o+=u.nodeValue.length),(p=u.firstChild)!==null;)f=u,u=p;for(;;){if(u===e)break t;if(f===r&&++c===i&&(l=o),f===s&&++h===n&&(a=o),(p=u.nextSibling)!==null)break;u=f,f=u.parentNode}u=p}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Pu={focusedElem:e,selectionRange:r},Ql=!1,he=t;he!==null;)if(t=he,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,he=e;else for(;he!==null;){t=he;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,y=_.getSnapshotBeforeUpdate(t.elementType===t.type?g:Rr(t.type,g),S);_.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(re(163))}}catch(N){rt(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,he=e;break}he=t.return}return m=zp,zp=!1,m}function to(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&&Ku(t,r,s)}i=i.next}while(i!==n)}}function ja(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 qu(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 c0(e){var t=e.alternate;t!==null&&(e.alternate=null,c0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Xr],delete t[xo],delete t[Ru],delete t[qw],delete t[Yw])),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 u0(e){return e.tag===5||e.tag===3||e.tag===4}function Fp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||u0(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 Yu(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=ea));else if(n!==4&&(e=e.child,e!==null))for(Yu(e,t,r),e=e.sibling;e!==null;)Yu(e,t,r),e=e.sibling}function Xu(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(Xu(e,t,r),e=e.sibling;e!==null;)Xu(e,t,r),e=e.sibling}var Et=null,Mr=!1;function xn(e,t,r){for(r=r.child;r!==null;)h0(e,t,r),r=r.sibling}function h0(e,t,r){if(Qr&&typeof Qr.onCommitFiberUnmount=="function")try{Qr.onCommitFiberUnmount(Ta,r)}catch{}switch(r.tag){case 5:At||Ki(r,t);case 6:var n=Et,i=Mr;Et=null,xn(e,t,r),Et=n,Mr=i,Et!==null&&(Mr?(e=Et,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Et.removeChild(r.stateNode));break;case 18:Et!==null&&(Mr?(e=Et,r=r.stateNode,e.nodeType===8?_c(e.parentNode,r):e.nodeType===1&&_c(e,r),mo(e)):_c(Et,r.stateNode));break;case 4:n=Et,i=Mr,Et=r.stateNode.containerInfo,Mr=!0,xn(e,t,r),Et=n,Mr=i;break;case 0:case 11:case 14:case 15:if(!At&&(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)&&Ku(r,t,o),i=i.next}while(i!==n)}xn(e,t,r);break;case 1:if(!At&&(Ki(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){rt(r,t,l)}xn(e,t,r);break;case 21:xn(e,t,r);break;case 22:r.mode&1?(At=(n=At)||r.memoizedState!==null,xn(e,t,r),At=n):xn(e,t,r);break;default:xn(e,t,r)}}function $p(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new uS),t.forEach(function(n){var i=xS.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Dr(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:Et=l.stateNode,Mr=!1;break e;case 3:Et=l.stateNode.containerInfo,Mr=!0;break e;case 4:Et=l.stateNode.containerInfo,Mr=!0;break e}l=l.return}if(Et===null)throw Error(re(160));h0(s,o,i),Et=null,Mr=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(c){rt(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)d0(t,e),t=t.sibling}function d0(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Dr(t,e),Wr(e),n&4){try{to(3,e,e.return),ja(3,e)}catch(g){rt(e,e.return,g)}try{to(5,e,e.return)}catch(g){rt(e,e.return,g)}}break;case 1:Dr(t,e),Wr(e),n&512&&r!==null&&Ki(r,r.return);break;case 5:if(Dr(t,e),Wr(e),n&512&&r!==null&&Ki(r,r.return),e.flags&32){var i=e.stateNode;try{uo(i,"")}catch(g){rt(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&&M_(i,s),yu(l,o);var c=yu(l,s);for(o=0;o<a.length;o+=2){var h=a[o],u=a[o+1];h==="style"?z_(i,u):h==="dangerouslySetInnerHTML"?B_(i,u):h==="children"?uo(i,u):ld(i,h,u,c)}switch(l){case"input":pu(i,s);break;case"textarea":A_(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?Xi(i,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?Xi(i,!!s.multiple,s.defaultValue,!0):Xi(i,!!s.multiple,s.multiple?[]:"",!1))}i[xo]=s}catch(g){rt(e,e.return,g)}}break;case 6:if(Dr(t,e),Wr(e),n&4){if(e.stateNode===null)throw Error(re(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(g){rt(e,e.return,g)}}break;case 3:if(Dr(t,e),Wr(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{mo(t.containerInfo)}catch(g){rt(e,e.return,g)}break;case 4:Dr(t,e),Wr(e);break;case 13:Dr(t,e),Wr(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Fd=st())),n&4&&$p(e);break;case 22:if(h=r!==null&&r.memoizedState!==null,e.mode&1?(At=(c=At)||h,Dr(t,e),At=c):Dr(t,e),Wr(e),n&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(he=e,h=e.child;h!==null;){for(u=he=h;he!==null;){switch(f=he,p=f.child,f.tag){case 0:case 11:case 14:case 15:to(4,f,f.return);break;case 1:Ki(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){rt(n,r,g)}}break;case 5:Ki(f,f.return);break;case 22:if(f.memoizedState!==null){Hp(u);continue}}p!==null?(p.return=f,he=p):Hp(u)}h=h.sibling}e:for(h=null,u=e;;){if(u.tag===5){if(h===null){h=u;try{i=u.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=u.stateNode,a=u.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=O_("display",o))}catch(g){rt(e,e.return,g)}}}else if(u.tag===6){if(h===null)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(g){rt(e,e.return,g)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;h===u&&(h=null),u=u.return}h===u&&(h=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:Dr(t,e),Wr(e),n&4&&$p(e);break;case 21:break;default:Dr(t,e),Wr(e)}}function Wr(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(u0(r)){var n=r;break e}r=r.return}throw Error(re(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(uo(i,""),n.flags&=-33);var s=Fp(e);Xu(e,s,i);break;case 3:case 4:var o=n.stateNode.containerInfo,l=Fp(e);Yu(e,l,o);break;default:throw Error(re(161))}}catch(a){rt(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function dS(e,t,r){he=e,f0(e)}function f0(e,t,r){for(var n=(e.mode&1)!==0;he!==null;){var i=he,s=i.child;if(i.tag===22&&n){var o=i.memoizedState!==null||cl;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||At;l=cl;var c=At;if(cl=o,(At=a)&&!c)for(he=i;he!==null;)o=he,a=o.child,o.tag===22&&o.memoizedState!==null?Up(i):a!==null?(a.return=o,he=a):Up(i);for(;s!==null;)he=s,f0(s),s=s.sibling;he=i,cl=l,At=c}Wp(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,he=s):Wp(e)}}function Wp(e){for(;he!==null;){var t=he;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:At||ja(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!At)if(r===null)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:Rr(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Ep(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}Ep(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 h=c.memoizedState;if(h!==null){var u=h.dehydrated;u!==null&&mo(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(re(163))}At||t.flags&512&&qu(t)}catch(f){rt(t,t.return,f)}}if(t===e){he=null;break}if(r=t.sibling,r!==null){r.return=t.return,he=r;break}he=t.return}}function Hp(e){for(;he!==null;){var t=he;if(t===e){he=null;break}var r=t.sibling;if(r!==null){r.return=t.return,he=r;break}he=t.return}}function Up(e){for(;he!==null;){var t=he;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{ja(4,t)}catch(a){rt(t,r,a)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var i=t.return;try{n.componentDidMount()}catch(a){rt(t,i,a)}}var s=t.return;try{qu(t)}catch(a){rt(t,s,a)}break;case 5:var o=t.return;try{qu(t)}catch(a){rt(t,o,a)}}}catch(a){rt(t,t.return,a)}if(t===e){he=null;break}var l=t.sibling;if(l!==null){l.return=t.return,he=l;break}he=t.return}}var fS=Math.ceil,ha=gn.ReactCurrentDispatcher,Od=gn.ReactCurrentOwner,Er=gn.ReactCurrentBatchConfig,Ae=0,St=null,ct=null,Lt=0,lr=0,qi=qn(0),pt=0,Eo=null,yi=0,Ba=0,zd=0,ro=null,Qt=null,Fd=0,cs=1/0,sn=null,da=!1,Gu=null,Fn=null,ul=!1,In=null,fa=0,no=0,Qu=null,Dl=-1,Il=0;function Wt(){return Ae&6?st():Dl!==-1?Dl:Dl=st()}function $n(e){return e.mode&1?Ae&2&&Lt!==0?Lt&-Lt:Gw.transition!==null?(Il===0&&(Il=Q_()),Il):(e=je,e!==0||(e=window.event,e=e===void 0?16:iv(e.type)),e):1}function Or(e,t,r,n){if(50<no)throw no=0,Qu=null,Error(re(185));Ao(e,r,n),(!(Ae&2)||e!==St)&&(e===St&&(!(Ae&2)&&(Ba|=r),pt===4&&Pn(e,Lt)),tr(e,n),r===1&&Ae===0&&!(t.mode&1)&&(cs=st()+500,Ra&&Yn()))}function tr(e,t){var r=e.callbackNode;G1(e,t);var n=Gl(e,e===St?Lt:0);if(n===0)r!==null&&Jf(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&Jf(r),t===1)e.tag===0?Xw(Vp.bind(null,e)):bv(Vp.bind(null,e)),Vw(function(){!(Ae&6)&&Yn()}),r=null;else{switch(Z_(n)){case 1:r=dd;break;case 4:r=X_;break;case 16:r=Xl;break;case 536870912:r=G_;break;default:r=Xl}r=w0(r,p0.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function p0(e,t){if(Dl=-1,Il=0,Ae&6)throw Error(re(327));var r=e.callbackNode;if(es()&&e.callbackNode!==r)return null;var n=Gl(e,e===St?Lt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=pa(e,n);else{t=n;var i=Ae;Ae|=2;var s=g0();(St!==e||Lt!==t)&&(sn=null,cs=st()+500,di(e,t));do try{gS();break}catch(l){m0(e,l)}while(!0);Cd(),ha.current=s,Ae=i,ct!==null?t=0:(St=null,Lt=0,t=pt)}if(t!==0){if(t===2&&(i=ku(e),i!==0&&(n=i,t=Zu(e,i))),t===1)throw r=Eo,di(e,0),Pn(e,n),tr(e,st()),r;if(t===6)Pn(e,n);else{if(i=e.current.alternate,!(n&30)&&!pS(i)&&(t=pa(e,n),t===2&&(s=ku(e),s!==0&&(n=s,t=Zu(e,s))),t===1))throw r=Eo,di(e,0),Pn(e,n),tr(e,st()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(re(345));case 2:ii(e,Qt,sn);break;case 3:if(Pn(e,n),(n&130023424)===n&&(t=Fd+500-st(),10<t)){if(Gl(e,0)!==0)break;if(i=e.suspendedLanes,(i&n)!==n){Wt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Iu(ii.bind(null,e,Qt,sn),t);break}ii(e,Qt,sn);break;case 4:if(Pn(e,n),(n&4194240)===n)break;for(t=e.eventTimes,i=-1;0<n;){var o=31-Br(n);s=1<<o,o=t[o],o>i&&(i=o),n&=~s}if(n=i,n=st()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*fS(n/1960))-n,10<n){e.timeoutHandle=Iu(ii.bind(null,e,Qt,sn),n);break}ii(e,Qt,sn);break;case 5:ii(e,Qt,sn);break;default:throw Error(re(329))}}}return tr(e,st()),e.callbackNode===r?p0.bind(null,e):null}function Zu(e,t){var r=ro;return e.current.memoizedState.isDehydrated&&(di(e,t).flags|=256),e=pa(e,t),e!==2&&(t=Qt,Qt=r,t!==null&&Ju(t)),e}function Ju(e){Qt===null?Qt=e:Qt.push.apply(Qt,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(!Fr(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 Pn(e,t){for(t&=~zd,t&=~Ba,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Br(t),n=1<<r;e[r]=-1,t&=~n}}function Vp(e){if(Ae&6)throw Error(re(327));es();var t=Gl(e,0);if(!(t&1))return tr(e,st()),null;var r=pa(e,t);if(e.tag!==0&&r===2){var n=ku(e);n!==0&&(t=n,r=Zu(e,n))}if(r===1)throw r=Eo,di(e,0),Pn(e,t),tr(e,st()),r;if(r===6)throw Error(re(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ii(e,Qt,sn),tr(e,st()),null}function $d(e,t){var r=Ae;Ae|=1;try{return e(t)}finally{Ae=r,Ae===0&&(cs=st()+500,Ra&&Yn())}}function xi(e){In!==null&&In.tag===0&&!(Ae&6)&&es();var t=Ae;Ae|=1;var r=Er.transition,n=je;try{if(Er.transition=null,je=1,e)return e()}finally{je=n,Er.transition=r,Ae=t,!(Ae&6)&&Yn()}}function Wd(){lr=qi.current,Ve(qi)}function di(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,Uw(r)),ct!==null)for(r=ct.return;r!==null;){var n=r;switch(Sd(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&ta();break;case 3:ls(),Ve(Jt),Ve(Bt),Dd();break;case 5:Pd(n);break;case 4:ls();break;case 13:Ve(Qe);break;case 19:Ve(Qe);break;case 10:Ed(n.type._context);break;case 22:case 23:Wd()}r=r.return}if(St=e,ct=e=Wn(e.current,null),Lt=lr=t,pt=0,Eo=null,zd=Ba=yi=0,Qt=ro=null,ci!==null){for(t=0;t<ci.length;t++)if(r=ci[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}ci=null}return e}function m0(e,t){do{var r=ct;try{if(Cd(),Tl.current=ua,ca){for(var n=Ze.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}ca=!1}if(vi=0,vt=ft=Ze=null,eo=!1,bo=0,Od.current=null,r===null||r.return===null){pt=1,Eo=t,ct=null;break}e:{var s=e,o=r.return,l=r,a=t;if(t=Lt,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var c=a,h=l,u=h.tag;if(!(h.mode&1)&&(u===0||u===11||u===15)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var p=Ip(o);if(p!==null){p.flags&=-257,Rp(p,o,l,s,t),p.mode&1&&Dp(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)){Dp(s,c,t),Hd();break e}a=Error(re(426))}}else if(Ke&&l.mode&1){var S=Ip(o);if(S!==null){!(S.flags&65536)&&(S.flags|=256),Rp(S,o,l,s,t),bd(as(a,l));break e}}s=a=as(a,l),pt!==4&&(pt=2),ro===null?ro=[s]:ro.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var _=Zv(s,a,t);Cp(s,_);break e;case 1:l=a;var y=s.type,x=s.stateNode;if(!(s.flags&128)&&(typeof y.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Fn===null||!Fn.has(x)))){s.flags|=65536,t&=-t,s.lanes|=t;var N=Jv(s,l,t);Cp(s,N);break e}}s=s.return}while(s!==null)}v0(r)}catch(T){t=T,ct===r&&r!==null&&(ct=r=r.return);continue}break}while(!0)}function g0(){var e=ha.current;return ha.current=ua,e===null?ua:e}function Hd(){(pt===0||pt===3||pt===2)&&(pt=4),St===null||!(yi&268435455)&&!(Ba&268435455)||Pn(St,Lt)}function pa(e,t){var r=Ae;Ae|=2;var n=g0();(St!==e||Lt!==t)&&(sn=null,di(e,t));do try{mS();break}catch(i){m0(e,i)}while(!0);if(Cd(),Ae=r,ha.current=n,ct!==null)throw Error(re(261));return St=null,Lt=0,pt}function mS(){for(;ct!==null;)_0(ct)}function gS(){for(;ct!==null&&!$1();)_0(ct)}function _0(e){var t=x0(e.alternate,e,lr);e.memoizedProps=e.pendingProps,t===null?v0(e):ct=t,Od.current=null}function v0(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=cS(r,t),r!==null){r.flags&=32767,ct=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{pt=6,ct=null;return}}else if(r=aS(r,t,lr),r!==null){ct=r;return}if(t=t.sibling,t!==null){ct=t;return}ct=t=e}while(t!==null);pt===0&&(pt=5)}function ii(e,t,r){var n=je,i=Er.transition;try{Er.transition=null,je=1,_S(e,t,r,n)}finally{Er.transition=i,je=n}return null}function _S(e,t,r,n){do es();while(In!==null);if(Ae&6)throw Error(re(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(re(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(Q1(e,s),e===St&&(ct=St=null,Lt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||ul||(ul=!0,w0(Xl,function(){return es(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=Er.transition,Er.transition=null;var o=je;je=1;var l=Ae;Ae|=4,Od.current=null,hS(e,r),d0(r,e),Bw(Pu),Ql=!!Lu,Pu=Lu=null,e.current=r,dS(r),W1(),Ae=l,je=o,Er.transition=s}else e.current=r;if(ul&&(ul=!1,In=e,fa=i),s=e.pendingLanes,s===0&&(Fn=null),V1(r.stateNode),tr(e,st()),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(da)throw da=!1,e=Gu,Gu=null,e;return fa&1&&e.tag!==0&&es(),s=e.pendingLanes,s&1?e===Qu?no++:(no=0,Qu=e):no=0,Yn(),null}function es(){if(In!==null){var e=Z_(fa),t=Er.transition,r=je;try{if(Er.transition=null,je=16>e?16:e,In===null)var n=!1;else{if(e=In,In=null,fa=0,Ae&6)throw Error(re(331));var i=Ae;for(Ae|=4,he=e.current;he!==null;){var s=he,o=s.child;if(he.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(he=c;he!==null;){var h=he;switch(h.tag){case 0:case 11:case 15:to(8,h,s)}var u=h.child;if(u!==null)u.return=h,he=u;else for(;he!==null;){h=he;var f=h.sibling,p=h.return;if(c0(h),h===c){he=null;break}if(f!==null){f.return=p,he=f;break}he=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)}}he=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,he=o;else e:for(;he!==null;){if(s=he,s.flags&2048)switch(s.tag){case 0:case 11:case 15:to(9,s,s.return)}var _=s.sibling;if(_!==null){_.return=s.return,he=_;break e}he=s.return}}var y=e.current;for(he=y;he!==null;){o=he;var x=o.child;if(o.subtreeFlags&2064&&x!==null)x.return=o,he=x;else e:for(o=y;he!==null;){if(l=he,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:ja(9,l)}}catch(T){rt(l,l.return,T)}if(l===o){he=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,he=N;break e}he=l.return}}if(Ae=i,Yn(),Qr&&typeof Qr.onPostCommitFiberRoot=="function")try{Qr.onPostCommitFiberRoot(Ta,e)}catch{}n=!0}return n}finally{je=r,Er.transition=t}}return!1}function Kp(e,t,r){t=as(r,t),t=Zv(e,t,1),e=zn(e,t,1),t=Wt(),e!==null&&(Ao(e,1,t),tr(e,t))}function rt(e,t,r){if(e.tag===3)Kp(e,e,r);else for(;t!==null;){if(t.tag===3){Kp(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Fn===null||!Fn.has(n))){e=as(r,e),e=Jv(t,e,1),t=zn(t,e,1),e=Wt(),t!==null&&(Ao(t,1,e),tr(t,e));break}}t=t.return}}function vS(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=Wt(),e.pingedLanes|=e.suspendedLanes&r,St===e&&(Lt&r)===r&&(pt===4||pt===3&&(Lt&130023424)===Lt&&500>st()-Fd?di(e,0):zd|=r),tr(e,t)}function y0(e,t){t===0&&(e.mode&1?(t=el,el<<=1,!(el&130023424)&&(el=4194304)):t=1);var r=Wt();e=pn(e,t),e!==null&&(Ao(e,t,r),tr(e,r))}function yS(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),y0(e,r)}function xS(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(re(314))}n!==null&&n.delete(t),y0(e,r)}var x0;x0=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Jt.current)Zt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Zt=!1,lS(e,t,r);Zt=!!(e.flags&131072)}else Zt=!1,Ke&&t.flags&1048576&&kv(t,ia,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Pl(e,t),e=t.pendingProps;var i=is(t,Bt.current);Ji(t,r),i=Rd(null,t,n,e,i,r);var s=Md();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,er(n)?(s=!0,ra(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Td(t),i.updater=Aa,t.stateNode=i,i._reactInternals=t,zu(t,n,e,r),t=Wu(null,t,n,!0,s,r)):(t.tag=0,Ke&&s&&wd(t),Ft(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Pl(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=SS(n),e=Rr(n,e),i){case 0:t=$u(null,t,n,e,r);break e;case 1:t=jp(null,t,n,e,r);break e;case 11:t=Mp(null,t,n,e,r);break e;case 14:t=Ap(null,t,n,Rr(n.type,e),r);break e}throw Error(re(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Rr(n,i),$u(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Rr(n,i),jp(e,t,n,i,r);case 3:e:{if(n0(t),e===null)throw Error(re(387));n=t.pendingProps,s=t.memoizedState,i=s.element,Pv(e,t),la(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=as(Error(re(423)),t),t=Bp(e,t,n,r,i);break e}else if(n!==i){i=as(Error(re(424)),t),t=Bp(e,t,n,r,i);break e}else for(cr=On(t.stateNode.containerInfo.firstChild),ur=t,Ke=!0,Ar=null,r=Tv(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ss(),n===i){t=mn(e,t,r);break e}Ft(e,t,n,r)}t=t.child}return t;case 5:return Dv(t),e===null&&ju(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Du(n,i)?o=null:s!==null&&Du(n,s)&&(t.flags|=32),r0(e,t),Ft(e,t,o,r),t.child;case 6:return e===null&&ju(t),null;case 13:return i0(e,t,r);case 4:return Ld(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=os(t,null,n,r):Ft(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Rr(n,i),Mp(e,t,n,i,r);case 7:return Ft(e,t,t.pendingProps,r),t.child;case 8:return Ft(e,t,t.pendingProps.children,r),t.child;case 12:return Ft(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,$e(sa,n._currentValue),n._currentValue=o,s!==null)if(Fr(s.value,o)){if(s.children===i.children&&!Jt.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=hn(-1,r&-r),a.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?a.next=a:(a.next=h.next,h.next=a),c.pending=a}}s.lanes|=r,a=s.alternate,a!==null&&(a.lanes|=r),Bu(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(re(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),Bu(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}Ft(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,Ji(t,r),i=Tr(i),n=n(i),t.flags|=1,Ft(e,t,n,r),t.child;case 14:return n=t.type,i=Rr(n,t.pendingProps),i=Rr(n.type,i),Ap(e,t,n,i,r);case 15:return e0(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Rr(n,i),Pl(e,t),t.tag=1,er(n)?(e=!0,ra(t)):e=!1,Ji(t,r),Qv(t,n,i),zu(t,n,i,r),Wu(null,t,n,!0,e,r);case 19:return s0(e,t,r);case 22:return t0(e,t,r)}throw Error(re(156,t.tag))};function w0(e,t){return Y_(e,t)}function wS(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 Cr(e,t,r,n){return new wS(e,t,r,n)}function Ud(e){return e=e.prototype,!(!e||!e.isReactComponent)}function SS(e){if(typeof e=="function")return Ud(e)?1:0;if(e!=null){if(e=e.$$typeof,e===cd)return 11;if(e===ud)return 14}return 2}function Wn(e,t){var r=e.alternate;return r===null?(r=Cr(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 Rl(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")Ud(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Bi:return fi(r.children,i,s,t);case ad:o=8,i|=8;break;case cu:return e=Cr(12,r,t,i|2),e.elementType=cu,e.lanes=s,e;case uu:return e=Cr(13,r,t,i),e.elementType=uu,e.lanes=s,e;case hu:return e=Cr(19,r,t,i),e.elementType=hu,e.lanes=s,e;case D_:return Oa(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case L_:o=10;break e;case P_:o=9;break e;case cd:o=11;break e;case ud:o=14;break e;case En:o=16,n=null;break e}throw Error(re(130,e==null?e:typeof e,""))}return t=Cr(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function fi(e,t,r,n){return e=Cr(7,e,n,t),e.lanes=r,e}function Oa(e,t,r,n){return e=Cr(22,e,n,t),e.elementType=D_,e.lanes=r,e.stateNode={isHidden:!1},e}function Cc(e,t,r){return e=Cr(6,e,null,t),e.lanes=r,e}function Ec(e,t,r){return t=Cr(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=oc(0),this.expirationTimes=oc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=oc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Vd(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=Cr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Td(s),e}function kS(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ji,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function S0(e){if(!e)return Vn;e=e._reactInternals;e:{if(Ci(e)!==e||e.tag!==1)throw Error(re(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(er(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(re(171))}if(e.tag===1){var r=e.type;if(er(r))return Sv(e,r,t)}return t}function b0(e,t,r,n,i,s,o,l,a){return e=Vd(r,n,!0,e,i,s,o,l,a),e.context=S0(null),r=e.current,n=Wt(),i=$n(r),s=hn(n,i),s.callback=t??null,zn(r,s,i),e.current.lanes=i,Ao(e,i,n),tr(e,n),e}function za(e,t,r,n){var i=t.current,s=Wt(),o=$n(i);return r=S0(r),t.context===null?t.context=r:t.pendingContext=r,t=hn(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=zn(i,t,o),e!==null&&(Or(e,i,o,s),Nl(e,i,o)),o}function ma(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 qp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Kd(e,t){qp(e,t),(e=e.alternate)&&qp(e,t)}function CS(){return null}var k0=typeof reportError=="function"?reportError:function(e){console.error(e)};function qd(e){this._internalRoot=e}Fa.prototype.render=qd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(re(409));za(e,t,null,null)};Fa.prototype.unmount=qd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;xi(function(){za(null,e,null,null)}),t[fn]=null}};function Fa(e){this._internalRoot=e}Fa.prototype.unstable_scheduleHydration=function(e){if(e){var t=tv();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Ln.length&&t!==0&&t<Ln[r].priority;r++);Ln.splice(r,0,e),r===0&&nv(e)}};function Yd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function $a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Yp(){}function ES(e,t,r,n,i){if(i){if(typeof n=="function"){var s=n;n=function(){var c=ma(o);s.call(c)}}var o=b0(t,n,e,0,null,!1,!1,"",Yp);return e._reactRootContainer=o,e[fn]=o.current,vo(e.nodeType===8?e.parentNode:e),xi(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof n=="function"){var l=n;n=function(){var c=ma(a);l.call(c)}}var a=Vd(e,0,!1,null,null,!1,!1,"",Yp);return e._reactRootContainer=a,e[fn]=a.current,vo(e.nodeType===8?e.parentNode:e),xi(function(){za(t,a,r,n)}),a}function Wa(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=ma(o);l.call(a)}}za(t,o,e,i)}else o=ES(r,t,e,i,n);return ma(o)}J_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Ws(t.pendingLanes);r!==0&&(fd(t,r|1),tr(t,st()),!(Ae&6)&&(cs=st()+500,Yn()))}break;case 13:xi(function(){var n=pn(e,1);if(n!==null){var i=Wt();Or(n,e,1,i)}}),Kd(e,1)}};pd=function(e){if(e.tag===13){var t=pn(e,134217728);if(t!==null){var r=Wt();Or(t,e,134217728,r)}Kd(e,134217728)}};ev=function(e){if(e.tag===13){var t=$n(e),r=pn(e,t);if(r!==null){var n=Wt();Or(r,e,t,n)}Kd(e,t)}};tv=function(){return je};rv=function(e,t){var r=je;try{return je=e,t()}finally{je=r}};wu=function(e,t,r){switch(t){case"input":if(pu(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=Ia(n);if(!i)throw Error(re(90));R_(n),pu(n,i)}}}break;case"textarea":A_(e,r);break;case"select":t=r.value,t!=null&&Xi(e,!!r.multiple,t,!1)}};W_=$d;H_=xi;var NS={usingClientEntryPoint:!1,Events:[Bo,$i,Ia,F_,$_,$d]},Ps={findFiberByHostInstance:ai,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},TS={bundleType:Ps.bundleType,version:Ps.version,rendererPackageName:Ps.rendererPackageName,rendererConfig:Ps.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:gn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=K_(e),e===null?null:e.stateNode},findFiberByHostInstance:Ps.findFiberByHostInstance||CS,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 hl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!hl.isDisabled&&hl.supportsFiber)try{Ta=hl.inject(TS),Qr=hl}catch{}}fr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=NS;fr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Yd(t))throw Error(re(200));return kS(e,t,null,r)};fr.createRoot=function(e,t){if(!Yd(e))throw Error(re(299));var r=!1,n="",i=k0;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Vd(e,1,!1,null,null,r,!1,n,i),e[fn]=t.current,vo(e.nodeType===8?e.parentNode:e),new qd(t)};fr.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(re(188)):(e=Object.keys(e).join(","),Error(re(268,e)));return e=K_(t),e=e===null?null:e.stateNode,e};fr.flushSync=function(e){return xi(e)};fr.hydrate=function(e,t,r){if(!$a(t))throw Error(re(200));return Wa(null,e,t,!0,r)};fr.hydrateRoot=function(e,t,r){if(!Yd(e))throw Error(re(405));var n=r!=null&&r.hydratedSources||null,i=!1,s="",o=k0;if(r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=b0(t,null,e,1,r??null,i,!1,s,o),e[fn]=t.current,vo(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 Fa(t)};fr.render=function(e,t,r){if(!$a(t))throw Error(re(200));return Wa(null,e,t,!1,r)};fr.unmountComponentAtNode=function(e){if(!$a(e))throw Error(re(40));return e._reactRootContainer?(xi(function(){Wa(null,null,e,!1,function(){e._reactRootContainer=null,e[fn]=null})}),!0):!1};fr.unstable_batchedUpdates=$d;fr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!$a(r))throw Error(re(200));if(e==null||e._reactInternals===void 0)throw Error(re(38));return Wa(e,t,r,!1,n)};fr.version="18.3.1-next-f1338f8080-20240426";function C0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(C0)}catch(e){console.error(e)}}C0(),C_.exports=fr;var LS=C_.exports,E0,Xp=LS;E0=Xp.createRoot,Xp.hydrateRoot;/**
|
|
41
|
+
* @remix-run/router v1.23.2
|
|
42
|
+
*
|
|
43
|
+
* Copyright (c) Remix Software Inc.
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
+
*
|
|
48
|
+
* @license MIT
|
|
49
|
+
*/function No(){return No=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},No.apply(this,arguments)}var Rn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Rn||(Rn={}));const Gp="popstate";function PS(e){e===void 0&&(e={});function t(n,i){let{pathname:s,search:o,hash:l}=n.location;return eh("",{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:N0(i)}return IS(t,r,null,e)}function ut(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Xd(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function DS(){return Math.random().toString(36).substr(2,8)}function Qp(e,t){return{usr:e.state,key:e.key,idx:t}}function eh(e,t,r,n){return r===void 0&&(r=null),No({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ms(t):t,{state:r,key:t&&t.key||n||DS()})}function N0(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 ms(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 IS(e,t,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,l=Rn.Pop,a=null,c=h();c==null&&(c=0,o.replaceState(No({},o.state,{idx:c}),""));function h(){return(o.state||{idx:null}).idx}function u(){l=Rn.Pop;let S=h(),_=S==null?null:S-c;c=S,a&&a({action:l,location:g.location,delta:_})}function f(S,_){l=Rn.Push;let y=eh(g.location,S,_);c=h()+1;let x=Qp(y,c),N=g.createHref(y);try{o.pushState(x,"",N)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;i.location.assign(N)}s&&a&&a({action:l,location:g.location,delta:1})}function p(S,_){l=Rn.Replace;let y=eh(g.location,S,_);c=h();let x=Qp(y,c),N=g.createHref(y);o.replaceState(x,"",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,y=typeof S=="string"?S:N0(S);return y=y.replace(/ $/,"%20"),ut(_,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,_)}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(Gp,u),a=S,()=>{i.removeEventListener(Gp,u),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 Zp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Zp||(Zp={}));function RS(e,t,r){return r===void 0&&(r="/"),MS(e,t,r)}function MS(e,t,r,n){let i=typeof t=="string"?ms(t):t,s=P0(i.pathname||"/",r);if(s==null)return null;let o=T0(e);AS(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let c=qS(s);l=US(o[a],c)}return l}function T0(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("/")&&(ut(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=pi([n,a.relativePath]),h=r.concat(a);s.children&&s.children.length>0&&(ut(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),T0(s.children,t,h,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:WS(c,s.index),routesMeta:h})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let a of L0(s.path))i(s,o,a)}),t}function L0(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=L0(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 AS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:HS(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const jS=/^:[\w-]+$/,BS=3,OS=2,zS=1,FS=10,$S=-2,Jp=e=>e==="*";function WS(e,t){let r=e.split("/"),n=r.length;return r.some(Jp)&&(n+=$S),t&&(n+=OS),r.filter(i=>!Jp(i)).reduce((i,s)=>i+(jS.test(s)?BS:s===""?zS:FS),n)}function HS(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 US(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,h=s==="/"?t:t.slice(s.length)||"/",u=VS({path:a.relativePath,caseSensitive:a.caseSensitive,end:c},h),f=a.route;if(!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:pi([s,u.pathname]),pathnameBase:ZS(pi([s,u.pathnameBase])),route:f}),u.pathnameBase!=="/"&&(s=pi([s,u.pathnameBase]))}return o}function VS(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=KS(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,h,u)=>{let{paramName:f,isOptional:p}=h;if(f==="*"){let g=l[u]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const m=l[u];return p&&!m?c[f]=void 0:c[f]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function KS(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),Xd(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 qS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Xd(!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 P0(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 YS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,XS=e=>YS.test(e);function GS(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?ms(e):e,s;if(r)if(XS(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),Xd(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=em(r.substring(1),"/"):s=em(r,t)}else s=t;return{pathname:s,search:JS(n),hash:eb(i)}}function em(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 Nc(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 QS(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function D0(e,t){let r=QS(e);return t?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function I0(e,t,r,n){n===void 0&&(n=!1);let i;typeof e=="string"?i=ms(e):(i=No({},e),ut(!i.pathname||!i.pathname.includes("?"),Nc("?","pathname","search",i)),ut(!i.pathname||!i.pathname.includes("#"),Nc("#","pathname","hash",i)),ut(!i.search||!i.search.includes("#"),Nc("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=r;else{let u=t.length-1;if(!n&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),u-=1;i.pathname=f.join("/")}l=u>=0?t[u]:"/"}let a=GS(i,l),c=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(c||h)&&(a.pathname+="/"),a}const pi=e=>e.join("/").replace(/\/\/+/g,"/"),ZS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),JS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,eb=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function tb(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const R0=["post","put","patch","delete"];new Set(R0);const rb=["get",...R0];new Set(rb);/**
|
|
50
|
+
* React Router v6.30.3
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Remix Software Inc.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
+
*
|
|
57
|
+
* @license MIT
|
|
58
|
+
*/function To(){return To=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},To.apply(this,arguments)}const Gd=w.createContext(null),nb=w.createContext(null),zo=w.createContext(null),Ha=w.createContext(null),Xn=w.createContext({outlet:null,matches:[],isDataRoute:!1}),M0=w.createContext(null);function Fo(){return w.useContext(Ha)!=null}function $o(){return Fo()||ut(!1),w.useContext(Ha).location}function A0(e){w.useContext(zo).static||w.useLayoutEffect(e)}function gs(){let{isDataRoute:e}=w.useContext(Xn);return e?gb():ib()}function ib(){Fo()||ut(!1);let e=w.useContext(Gd),{basename:t,future:r,navigator:n}=w.useContext(zo),{matches:i}=w.useContext(Xn),{pathname:s}=$o(),o=JSON.stringify(D0(i,r.v7_relativeSplatPath)),l=w.useRef(!1);return A0(()=>{l.current=!0}),w.useCallback(function(c,h){if(h===void 0&&(h={}),!l.current)return;if(typeof c=="number"){n.go(c);return}let u=I0(c,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:pi([t,u.pathname])),(h.replace?n.replace:n.push)(u,h.state,h)},[t,n,o,s,e])}function j0(){let{matches:e}=w.useContext(Xn),t=e[e.length-1];return t?t.params:{}}function sb(e,t){return ob(e,t)}function ob(e,t,r,n){Fo()||ut(!1);let{navigator:i}=w.useContext(zo),{matches:s}=w.useContext(Xn),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let c=$o(),h;if(t){var u;let S=typeof t=="string"?ms(t):t;a==="/"||(u=S.pathname)!=null&&u.startsWith(a)||ut(!1),h=S}else h=c;let f=h.pathname||"/",p=f;if(a!=="/"){let S=a.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(S.length).join("/")}let m=RS(e,{pathname:p}),g=hb(m&&m.map(S=>Object.assign({},S,{params:Object.assign({},l,S.params),pathname:pi([a,i.encodeLocation?i.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?a:pi([a,i.encodeLocation?i.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),s,r,n);return t&&g?w.createElement(Ha.Provider,{value:{location:To({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:Rn.Pop}},g):g}function lb(){let e=mb(),t=tb(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 w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),r?w.createElement("pre",{style:i},r):null,null)}const ab=w.createElement(lb,null);class cb extends w.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?w.createElement(Xn.Provider,{value:this.props.routeContext},w.createElement(M0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ub(e){let{routeContext:t,match:r,children:n}=e,i=w.useContext(Gd);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),w.createElement(Xn.Provider,{value:t},n)}function hb(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 h=o.findIndex(u=>u.route.id&&(l==null?void 0:l[u.route.id])!==void 0);h>=0||ut(!1),o=o.slice(0,Math.min(o.length,h+1))}let a=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let h=0;h<o.length;h++){let u=o[h];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(c=h),u.route.id){let{loaderData:f,errors:p}=r,m=u.route.loader&&f[u.route.id]===void 0&&(!p||p[u.route.id]===void 0);if(u.route.lazy||m){a=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((h,u,f)=>{let p,m=!1,g=null,S=null;r&&(p=l&&u.route.id?l[u.route.id]:void 0,g=u.route.errorElement||ab,a&&(c<0&&f===0?(_b("route-fallback"),m=!0,S=null):c===f&&(m=!0,S=u.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,f+1)),y=()=>{let x;return p?x=g:m?x=S:u.route.Component?x=w.createElement(u.route.Component,null):u.route.element?x=u.route.element:x=h,w.createElement(ub,{match:u,routeContext:{outlet:h,matches:_,isDataRoute:r!=null},children:x})};return r&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?w.createElement(cb,{location:r.location,revalidation:r.revalidation,component:g,error:p,children:y(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):y()},null)}var B0=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(B0||{}),O0=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}(O0||{});function db(e){let t=w.useContext(Gd);return t||ut(!1),t}function fb(e){let t=w.useContext(nb);return t||ut(!1),t}function pb(e){let t=w.useContext(Xn);return t||ut(!1),t}function z0(e){let t=pb(),r=t.matches[t.matches.length-1];return r.route.id||ut(!1),r.route.id}function mb(){var e;let t=w.useContext(M0),r=fb(),n=z0();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function gb(){let{router:e}=db(B0.UseNavigateStable),t=z0(O0.UseNavigateStable),r=w.useRef(!1);return A0(()=>{r.current=!0}),w.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,To({fromRouteId:t},s)))},[e,t])}const tm={};function _b(e,t,r){tm[e]||(tm[e]=!0)}function vb(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Ml(e){let{to:t,replace:r,state:n,relative:i}=e;Fo()||ut(!1);let{future:s,static:o}=w.useContext(zo),{matches:l}=w.useContext(Xn),{pathname:a}=$o(),c=gs(),h=I0(t,D0(l,s.v7_relativeSplatPath),a,i==="path"),u=JSON.stringify(h);return w.useEffect(()=>c(JSON.parse(u),{replace:r,state:n,relative:i}),[c,u,i,r,n]),null}function Cn(e){ut(!1)}function yb(e){let{basename:t="/",children:r=null,location:n,navigationType:i=Rn.Pop,navigator:s,static:o=!1,future:l}=e;Fo()&&ut(!1);let a=t.replace(/^\/*/,"/"),c=w.useMemo(()=>({basename:a,navigator:s,static:o,future:To({v7_relativeSplatPath:!1},l)}),[a,l,s,o]);typeof n=="string"&&(n=ms(n));let{pathname:h="/",search:u="",hash:f="",state:p=null,key:m="default"}=n,g=w.useMemo(()=>{let S=P0(h,a);return S==null?null:{location:{pathname:S,search:u,hash:f,state:p,key:m},navigationType:i}},[a,h,u,f,p,m,i]);return g==null?null:w.createElement(zo.Provider,{value:c},w.createElement(Ha.Provider,{children:r,value:g}))}function xb(e){let{children:t,location:r}=e;return sb(th(t),r)}new Promise(()=>{});function th(e,t){t===void 0&&(t=[]);let r=[];return w.Children.forEach(e,(n,i)=>{if(!w.isValidElement(n))return;let s=[...t,i];if(n.type===w.Fragment){r.push.apply(r,th(n.props.children,s));return}n.type!==Cn&&ut(!1),!n.props.index||!n.props.children||ut(!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=th(n.props.children,s)),r.push(o)}),r}/**
|
|
59
|
+
* React Router DOM v6.30.3
|
|
60
|
+
*
|
|
61
|
+
* Copyright (c) Remix Software Inc.
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the MIT license found in the
|
|
64
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
65
|
+
*
|
|
66
|
+
* @license MIT
|
|
67
|
+
*/function rh(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 wb(e,t){let r=rh(e);return t&&t.forEach((n,i)=>{r.has(i)||t.getAll(i).forEach(s=>{r.append(i,s)})}),r}const Sb="6";try{window.__reactRouterVersion=Sb}catch{}const bb="startTransition",rm=v1[bb];function kb(e){let{basename:t,children:r,future:n,window:i}=e,s=w.useRef();s.current==null&&(s.current=PS({window:i,v5Compat:!0}));let o=s.current,[l,a]=w.useState({action:o.action,location:o.location}),{v7_startTransition:c}=n||{},h=w.useCallback(u=>{c&&rm?rm(()=>a(u)):a(u)},[a,c]);return w.useLayoutEffect(()=>o.listen(h),[o,h]),w.useEffect(()=>vb(n),[n]),w.createElement(yb,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}var nm;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(nm||(nm={}));var im;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(im||(im={}));function Cb(e){let t=w.useRef(rh(e)),r=w.useRef(!1),n=$o(),i=w.useMemo(()=>wb(n.search,r.current?null:t.current),[n.search]),s=gs(),o=w.useCallback((l,a)=>{const c=rh(typeof l=="function"?l(i):l);r.current=!0,s("?"+c,a)},[s,i]);return[i,o]}const F0=w.createContext({ides:[],updateIdeChats:()=>{},screenshotMap:{},setScreenshotMap:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{},wsStatus:"connected",isConnected:!0,connectionStates:{},connectionTransports:{},showReconnected:!1}),$0=w.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function Eb(e,t){var o,l,a,c;const r=Date.now();if(t.length===0)return e.map(h=>({...h,_lastUpdate:r}));const n=new Map;for(const h of t)n.set(h.id,h);for(const h of e){const u=n.get(h.id);if(!u){n.set(h.id,{...h,_lastUpdate:r});continue}const f=h.timestamp||r,p=u._lastUpdate||u.timestamp||0;if(f>=p){const m=(o=h.chats)!=null&&o.length?h.chats:u.chats;n.set(h.id,{...u,...h,chats:m,_lastUpdate:r})}else(l=h.chats)!=null&&l.length&&!((a=u.chats)!=null&&a.length)&&n.set(h.id,{...u,chats:h.chats})}const i=new Set(e.map(h=>h.id)),s=new Set;for(const h of e){const u=h.daemonId||((c=h.id)==null?void 0:c.split(":")[0]);u&&s.add(u)}for(const[h,u]of n){const f=u.daemonId||h.split(":")[0];if(!s.has(f))continue;const p=r-(u._lastUpdate||u.timestamp||0);(h.includes(":cli:")&&!i.has(h)&&p>1e4||h.includes(":acp:")&&!i.has(h)&&p>1e4||h.includes(":ide:")&&!i.has(h)&&p>3e4)&&n.delete(h)}for(const[h,u]of n)r-(u._lastUpdate||u.timestamp||0)>3e5&&u.status!=="online"&&n.delete(h);return Array.from(n.values())}function Nb({children:e}){const[t,r]=w.useState([]),[n,i]=w.useState({}),[s,o]=w.useState(!1),[l,a]=w.useState([]),c=w.useCallback((u,f)=>{r(p=>p.map(m=>m.id===u?{...m,chats:f}:m))},[]),h={injectEntries:u=>{r(f=>f.length===0?u:Eb(u,f))},markLoaded:()=>o(!0),getIdes:()=>t};return d.jsx($0.Provider,{value:h,children:d.jsx(F0.Provider,{value:{ides:t,updateIdeChats:c,screenshotMap:n,setScreenshotMap:i,initialLoaded:s,toasts:l,setToasts:a,wsStatus:"connected",isConnected:!0,connectionStates:{},connectionTransports:{},showReconnected:!1},children:e})})}function W0(){return w.useContext(F0)}function sm(){return w.useContext($0)}function Tb(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}`,h=await fetch(c,{...o,headers:l});if(h.status===401)throw n==null||n(),new Error("Unauthorized");if(!h.ok){const u=await h.json().catch(()=>({error:h.statusText}));throw new Error(u.error||`API Error: ${h.status}`)}return h.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 Lb=Tb({baseUrl:"http://localhost:3847"});w.createContext(Lb);const Pb={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},H0=w.createContext(Pb);function Db({value:e,children:t}){return d.jsx(H0.Provider,{value:e,children:t})}function Ei(){return w.useContext(H0)}function Ib(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Rb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Mb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ab={};function om(e,t){return(Ab.jsx?Mb:Rb).test(e)}const jb=/[ \t\n\f\r]/g;function Bb(e){return typeof e=="object"?e.type==="text"?lm(e.value):!1:lm(e)}function lm(e){return e.replace(jb,"")===""}class Wo{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}Wo.prototype.normal={};Wo.prototype.property={};Wo.prototype.space=void 0;function U0(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new Wo(r,n,t)}function nh(e){return e.toLowerCase()}class rr{constructor(t,r){this.attribute=r,this.property=t}}rr.prototype.attribute="";rr.prototype.booleanish=!1;rr.prototype.boolean=!1;rr.prototype.commaOrSpaceSeparated=!1;rr.prototype.commaSeparated=!1;rr.prototype.defined=!1;rr.prototype.mustUseProperty=!1;rr.prototype.number=!1;rr.prototype.overloadedBoolean=!1;rr.prototype.property="";rr.prototype.spaceSeparated=!1;rr.prototype.space=void 0;let Ob=0;const Ne=Ni(),ot=Ni(),ih=Ni(),se=Ni(),Fe=Ni(),ts=Ni(),or=Ni();function Ni(){return 2**++Ob}const sh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ne,booleanish:ot,commaOrSpaceSeparated:or,commaSeparated:ts,number:se,overloadedBoolean:ih,spaceSeparated:Fe},Symbol.toStringTag,{value:"Module"})),Tc=Object.keys(sh);class Qd extends rr{constructor(t,r,n,i){let s=-1;if(super(t,r),am(this,"space",i),typeof n=="number")for(;++s<Tc.length;){const o=Tc[s];am(this,Tc[s],(n&sh[o])===sh[o])}}}Qd.prototype.defined=!0;function am(e,t,r){r&&(e[t]=r)}function _s(e){const t={},r={};for(const[n,i]of Object.entries(e.properties)){const s=new Qd(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),t[n]=s,r[nh(n)]=n,r[nh(s.attribute)]=n}return new Wo(t,r,e.space)}const V0=_s({properties:{ariaActiveDescendant:null,ariaAtomic:ot,ariaAutoComplete:null,ariaBusy:ot,ariaChecked:ot,ariaColCount:se,ariaColIndex:se,ariaColSpan:se,ariaControls:Fe,ariaCurrent:null,ariaDescribedBy:Fe,ariaDetails:null,ariaDisabled:ot,ariaDropEffect:Fe,ariaErrorMessage:null,ariaExpanded:ot,ariaFlowTo:Fe,ariaGrabbed:ot,ariaHasPopup:null,ariaHidden:ot,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Fe,ariaLevel:se,ariaLive:null,ariaModal:ot,ariaMultiLine:ot,ariaMultiSelectable:ot,ariaOrientation:null,ariaOwns:Fe,ariaPlaceholder:null,ariaPosInSet:se,ariaPressed:ot,ariaReadOnly:ot,ariaRelevant:null,ariaRequired:ot,ariaRoleDescription:Fe,ariaRowCount:se,ariaRowIndex:se,ariaRowSpan:se,ariaSelected:ot,ariaSetSize:se,ariaSort:null,ariaValueMax:se,ariaValueMin:se,ariaValueNow:se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function K0(e,t){return t in e?e[t]:t}function q0(e,t){return K0(e,t.toLowerCase())}const zb=_s({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ts,acceptCharset:Fe,accessKey:Fe,action:null,allow:null,allowFullScreen:Ne,allowPaymentRequest:Ne,allowUserMedia:Ne,alt:null,as:null,async:Ne,autoCapitalize:null,autoComplete:Fe,autoFocus:Ne,autoPlay:Ne,blocking:Fe,capture:null,charSet:null,checked:Ne,cite:null,className:Fe,cols:se,colSpan:null,content:null,contentEditable:ot,controls:Ne,controlsList:Fe,coords:se|ts,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ne,defer:Ne,dir:null,dirName:null,disabled:Ne,download:ih,draggable:ot,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ne,formTarget:null,headers:Fe,height:se,hidden:ih,high:se,href:null,hrefLang:null,htmlFor:Fe,httpEquiv:Fe,id:null,imageSizes:null,imageSrcSet:null,inert:Ne,inputMode:null,integrity:null,is:null,isMap:Ne,itemId:null,itemProp:Fe,itemRef:Fe,itemScope:Ne,itemType:Fe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ne,low:se,manifest:null,max:null,maxLength:se,media:null,method:null,min:null,minLength:se,multiple:Ne,muted:Ne,name:null,nonce:null,noModule:Ne,noValidate:Ne,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:Ne,optimum:se,pattern:null,ping:Fe,placeholder:null,playsInline:Ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ne,referrerPolicy:null,rel:Fe,required:Ne,reversed:Ne,rows:se,rowSpan:se,sandbox:Fe,scope:null,scoped:Ne,seamless:Ne,selected:Ne,shadowRootClonable:Ne,shadowRootDelegatesFocus:Ne,shadowRootMode:null,shape:null,size:se,sizes:null,slot:null,span:se,spellCheck:ot,src:null,srcDoc:null,srcLang:null,srcSet:null,start:se,step:null,style:null,tabIndex:se,target:null,title:null,translate:null,type:null,typeMustMatch:Ne,useMap:null,value:ot,width:se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Fe,axis:null,background:null,bgColor:null,border:se,borderColor:null,bottomMargin:se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ne,declare:Ne,event:null,face:null,frame:null,frameBorder:null,hSpace:se,leftMargin:se,link:null,longDesc:null,lowSrc:null,marginHeight:se,marginWidth:se,noResize:Ne,noHref:Ne,noShade:Ne,noWrap:Ne,object:null,profile:null,prompt:null,rev:null,rightMargin:se,rules:null,scheme:null,scrolling:ot,standby:null,summary:null,text:null,topMargin:se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ne,disableRemotePlayback:Ne,prefix:null,property:null,results:se,security:null,unselectable:null},space:"html",transform:q0}),Fb=_s({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:or,accentHeight:se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:se,amplitude:se,arabicForm:null,ascent:se,attributeName:null,attributeType:null,azimuth:se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:se,by:null,calcMode:null,capHeight:se,className:Fe,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:se,diffuseConstant:se,direction:null,display:null,dur:null,divisor:se,dominantBaseline:null,download:Ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:se,enableBackground:null,end:null,event:null,exponent:se,externalResourcesRequired:null,fill:null,fillOpacity:se,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:ts,g2:ts,glyphName:ts,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:se,horizOriginX:se,horizOriginY:se,id:null,ideographic:se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:se,k:se,k1:se,k2:se,k3:se,k4:se,kernelMatrix:or,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:se,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:se,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:se,overlineThickness:se,paintOrder:null,panose1:null,path:null,pathLength:se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Fe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:se,pointsAtY:se,pointsAtZ:se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:or,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:or,rev:or,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:or,requiredFeatures:or,requiredFonts:or,requiredFormats:or,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:se,specularExponent:se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:se,strikethroughThickness:se,string:null,stroke:null,strokeDashArray:or,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:se,strokeOpacity:se,strokeWidth:null,style:null,surfaceScale:se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:or,tabIndex:se,tableValues:null,target:null,targetX:se,targetY:se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:or,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:se,underlineThickness:se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:se,values:null,vAlphabetic:se,vMathematical:se,vectorEffect:null,vHanging:se,vIdeographic:se,version:null,vertAdvY:se,vertOriginX:se,vertOriginY:se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:K0}),Y0=_s({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()}}),X0=_s({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:q0}),G0=_s({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),$b={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"},Wb=/[A-Z]/g,cm=/-[a-z]/g,Hb=/^data[-\w.:]+$/i;function Ub(e,t){const r=nh(t);let n=t,i=rr;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Hb.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(cm,Kb);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!cm.test(s)){let o=s.replace(Wb,Vb);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Qd}return new i(n,t)}function Vb(e){return"-"+e.toLowerCase()}function Kb(e){return e.charAt(1).toUpperCase()}const qb=U0([V0,zb,Y0,X0,G0],"html"),Zd=U0([V0,Fb,Y0,X0,G0],"svg");function Yb(e){return e.join(" ").trim()}var Jd={},um=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Xb=/\n/g,Gb=/^\s*/,Qb=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Zb=/^:\s*/,Jb=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ek=/^[;\s]*/,tk=/^\s+|\s+$/g,rk=`
|
|
68
|
+
`,hm="/",dm="*",li="",nk="comment",ik="declaration";function sk(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(Xb);g&&(r+=g.length);var S=m.lastIndexOf(rk);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(Gb)}function h(m){var g;for(m=m||[];g=u();)g!==!1&&m.push(g);return m}function u(){var m=s();if(!(hm!=e.charAt(0)||dm!=e.charAt(1))){for(var g=2;li!=e.charAt(g)&&(dm!=e.charAt(g)||hm!=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:nk,comment:S})}}function f(){var m=s(),g=a(Qb);if(g){if(u(),!a(Zb))return l("property missing ':'");var S=a(Jb),_=m({type:ik,property:fm(g[0].replace(um,li)),value:S?fm(S[0].replace(um,li)):li});return a(ek),_}}function p(){var m=[];h(m);for(var g;g=f();)g!==!1&&(m.push(g),h(m));return m}return c(),p()}function fm(e){return e?e.replace(tk,li):li}var ok=sk,lk=Vl&&Vl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Jd,"__esModule",{value:!0});Jd.default=ck;const ak=lk(ok);function ck(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,ak.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 Ua={};Object.defineProperty(Ua,"__esModule",{value:!0});Ua.camelCase=void 0;var uk=/^--[a-zA-Z0-9_-]+$/,hk=/-([a-z])/g,dk=/^[^-]+$/,fk=/^-(webkit|moz|ms|o|khtml)-/,pk=/^-(ms)-/,mk=function(e){return!e||dk.test(e)||uk.test(e)},gk=function(e,t){return t.toUpperCase()},pm=function(e,t){return"".concat(t,"-")},_k=function(e,t){return t===void 0&&(t={}),mk(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(pk,pm):e=e.replace(fk,pm),e.replace(hk,gk))};Ua.camelCase=_k;var vk=Vl&&Vl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},yk=vk(Jd),xk=Ua;function oh(e,t){var r={};return!e||typeof e!="string"||(0,yk.default)(e,function(n,i){n&&i&&(r[(0,xk.camelCase)(n,t)]=i)}),r}oh.default=oh;var wk=oh;const Sk=ed(wk),Q0=Z0("end"),ef=Z0("start");function Z0(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 bk(e){const t=ef(e),r=Q0(e);if(t&&r)return{start:t,end:r}}function io(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?mm(e.position):"start"in e||"end"in e?mm(e):"line"in e||"column"in e?lh(e):""}function lh(e){return gm(e&&e.line)+":"+gm(e&&e.column)}function mm(e){return lh(e&&e.start)+"-"+lh(e&&e.end)}function gm(e){return e&&typeof e=="number"?e:1}class Ot 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=io(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}}Ot.prototype.file="";Ot.prototype.name="";Ot.prototype.reason="";Ot.prototype.message="";Ot.prototype.stack="";Ot.prototype.column=void 0;Ot.prototype.line=void 0;Ot.prototype.ancestors=void 0;Ot.prototype.cause=void 0;Ot.prototype.fatal=void 0;Ot.prototype.place=void 0;Ot.prototype.ruleId=void 0;Ot.prototype.source=void 0;const tf={}.hasOwnProperty,kk=new Map,Ck=/[A-Z]/g,Ek=new Set(["table","tbody","thead","tfoot","tr"]),Nk=new Set(["td","th"]),J0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Tk(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=jk(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=Ak(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"?Zd:qb,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=ey(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function ey(e,t,r){if(t.type==="element")return Lk(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Pk(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ik(e,t,r);if(t.type==="mdxjsEsm")return Dk(e,t);if(t.type==="root")return Rk(e,t,r);if(t.type==="text")return Mk(e,t)}function Lk(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Zd,e.schema=i),e.ancestors.push(t);const s=ry(e,t.tagName,!1),o=Bk(e,t);let l=nf(e,t);return Ek.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!Bb(a):!0})),ty(e,o,s,t),rf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function Pk(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)}Lo(e,t.position)}function Dk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Lo(e,t.position)}function Ik(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=Zd,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:ry(e,t.name,!0),o=Ok(e,t),l=nf(e,t);return ty(e,o,s,t),rf(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function Rk(e,t,r){const n={};return rf(n,nf(e,t)),e.create(t,e.Fragment,n,r)}function Mk(e,t){return t.value}function ty(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function rf(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function Ak(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 jk(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),a=ef(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 Bk(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&tf.call(t.properties,i)){const s=zk(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Nk.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 Ok(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 Lo(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 Lo(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function nf(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:kk;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=ey(e,s,o);l!==void 0&&r.push(l)}return r}function zk(e,t,r){const n=Ub(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?Ib(r):Yb(r)),n.property==="style"){let i=typeof r=="object"?r:Fk(e,String(r));return e.stylePropertyNameCase==="css"&&(i=$k(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?$b[n.property]||n.property:n.attribute,r]}}function Fk(e,t){try{return Sk(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,i=new Ot("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=J0+"#cannot-parse-style-attribute",i}}function ry(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=om(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=om(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return tf.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);Lo(e)}function Lo(e,t){const r=new Ot("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=J0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function $k(e){const t={};let r;for(r in e)tf.call(e,r)&&(t[Wk(r)]=e[r]);return t}function Wk(e){let t=e.replace(Ck,Hk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Hk(e){return"-"+e.toLowerCase()}const Lc={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"]},Uk={};function sf(e,t){const r=Uk,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return ny(e,n,i)}function ny(e,t,r){if(Vk(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 _m(e.children,t,r)}return Array.isArray(e)?_m(e,t,r):""}function _m(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=ny(e[i],t,r);return n.join("")}function Vk(e){return!!(e&&typeof e=="object")}const vm=document.createElement("i");function of(e){const t="&"+e+";";vm.innerHTML=t;const r=vm.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function hr(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 kr(e,t){return e.length>0?(hr(e,e.length,0,t),e):t}const ym={}.hasOwnProperty;function iy(e){const t={};let r=-1;for(;++r<e.length;)Kk(t,e[r]);return t}function Kk(e,t){let r;for(r in t){const i=(ym.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){ym.call(i,o)||(i[o]=[]);const l=s[o];qk(i[o],Array.isArray(l)?l:l?[l]:[])}}}function qk(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);hr(e,0,0,n)}function sy(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 zr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $t=Gn(/[A-Za-z]/),jt=Gn(/[\dA-Za-z]/),Yk=Gn(/[#-'*+\--9=?A-Z^-~]/);function ga(e){return e!==null&&(e<32||e===127)}const ah=Gn(/\d/),Xk=Gn(/[\dA-Fa-f]/),Gk=Gn(/[!-/:-@[-`{-~]/);function we(e){return e!==null&&e<-2}function Oe(e){return e!==null&&(e<0||e===32)}function De(e){return e===-2||e===-1||e===32}const Va=Gn(new RegExp("\\p{P}|\\p{S}","u")),wi=Gn(/\s/);function Gn(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function vs(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&jt(e.charCodeAt(r+1))&&jt(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 Me(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return De(a)?(e.enter(r),l(a)):t(a)}function l(a){return De(a)&&s++<i?(e.consume(a),l):(e.exit(r),t(a))}}const Qk={tokenize:Zk};function Zk(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"),Me(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 we(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const Jk={tokenize:eC},xm={tokenize:tC};function eC(e){const t=this,r=[];let n=0,i,s,o;return l;function l(x){if(n<r.length){const N=r[n];return t.containerState=N[1],e.attempt(N[0].continuation,a,c)(x)}return c(x)}function a(x){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&y();const N=t.events.length;let T=N,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){C=t.events[T][1].end;break}_(n);let R=N;for(;R<t.events.length;)t.events[R][1].end={...C},R++;return hr(t.events,T+1,0,t.events.slice(N)),t.events.length=R,c(x)}return l(x)}function c(x){if(n===r.length){if(!i)return f(x);if(i.currentConstruct&&i.currentConstruct.concrete)return m(x);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(xm,h,u)(x)}function h(x){return i&&y(),_(n),f(x)}function u(x){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,m(x)}function f(x){return t.containerState={},e.attempt(xm,p,m)(x)}function p(x){return n++,r.push([t.currentConstruct,t.containerState]),f(x)}function m(x){if(x===null){i&&y(),_(0),e.consume(x);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(x)}function g(x){if(x===null){S(e.exit("chunkFlow"),!0),_(0),e.consume(x);return}return we(x)?(e.consume(x),S(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(x),g)}function S(x,N){const T=t.sliceStream(x);if(N&&T.push(null),x.previous=s,s&&(s.next=x),s=x,i.defineSkip(x.start),i.write(T),t.parser.lazy[x.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 R=t.events.length;let O=R,z,E;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(z){E=t.events[O][1].end;break}z=!0}for(_(n),C=R;C<t.events.length;)t.events[C][1].end={...E},C++;hr(t.events,O+1,0,t.events.slice(R)),t.events.length=C}}function _(x){let N=r.length;for(;N-- >x;){const T=r[N];t.containerState=T[1],T[0].exit.call(t,e)}r.length=x}function y(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function tC(e,t,r){return Me(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function us(e){if(e===null||Oe(e)||wi(e))return 1;if(Va(e))return 2}function Ka(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 ch={name:"attention",resolveAll:rC,tokenize:nC};function rC(e,t){let r=-1,n,i,s,o,l,a,c,h;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 u={...e[n][1].end},f={...e[r][1].start};wm(u,-a),wm(f,a),o={type:a>1?"strongSequence":"emphasisSequence",start:u,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=kr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=kr(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=kr(c,Ka(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=kr(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(h=2,c=kr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,hr(e,n-1,r-n+3,c),r=n+c.length-h-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function nC(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=us(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"),h=us(a),u=!h||h===2&&i||r.includes(a),f=!i||i===2&&h||r.includes(n);return c._open=!!(s===42?u:u&&(i||!f)),c._close=!!(s===42?f:f&&(h||!u)),t(a)}}function wm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const iC={name:"autolink",tokenize:sC};function sC(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 $t(p)?(e.consume(p),o):p===64?r(p):c(p)}function o(p){return p===43||p===45||p===46||jt(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||jt(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||ga(p)?r(p):(e.consume(p),a)}function c(p){return p===64?(e.consume(p),h):Yk(p)?(e.consume(p),c):r(p)}function h(p){return jt(p)?u(p):r(p)}function u(p){return p===46?(e.consume(p),n=0,h):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||jt(p))&&n++<63){const m=p===45?f:u;return e.consume(p),m}return r(p)}}const Ho={partial:!0,tokenize:oC};function oC(e,t,r){return n;function n(s){return De(s)?Me(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||we(s)?t(s):r(s)}}const oy={continuation:{tokenize:aC},exit:cC,name:"blockQuote",tokenize:lC};function lC(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 De(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function aC(e,t,r){const n=this;return i;function i(o){return De(o)?Me(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(oy,t,r)(o)}}function cC(e){e.exit("blockQuote")}const ly={name:"characterEscape",tokenize:uC};function uC(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 Gk(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const ay={name:"characterReference",tokenize:hC};function hC(e,t,r){const n=this;let i=0,s,o;return l;function l(u){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),a}function a(u){return u===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(u),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=jt,h(u))}function c(u){return u===88||u===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(u),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=Xk,h):(e.enter("characterReferenceValue"),s=7,o=ah,h(u))}function h(u){if(u===59&&i){const f=e.exit("characterReferenceValue");return o===jt&&!of(n.sliceSerialize(f))?r(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(u)&&i++<s?(e.consume(u),h):r(u)}}const Sm={partial:!0,tokenize:fC},bm={concrete:!0,name:"codeFenced",tokenize:dC};function dC(e,t,r){const n=this,i={partial:!0,tokenize:T};let s=0,o=0,l;return a;function a(C){return c(C)}function c(C){const R=n.events[n.events.length-1];return s=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(C)}function h(C){return C===l?(o++,e.consume(C),h):o<3?r(C):(e.exit("codeFencedFenceSequence"),De(C)?Me(e,u,"whitespace")(C):u(C))}function u(C){return C===null||we(C)?(e.exit("codeFencedFence"),n.interrupt?t(C):e.check(Sm,g,N)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||we(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(C)):De(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Me(e,p,"whitespace")(C)):C===96&&C===l?r(C):(e.consume(C),f)}function p(C){return C===null||we(C)?u(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||we(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(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&&De(C)?Me(e,y,"linePrefix",s+1)(C):y(C)}function y(C){return C===null||we(C)?e.check(Sm,g,N)(C):(e.enter("codeFlowValue"),x(C))}function x(C){return C===null||we(C)?(e.exit("codeFlowValue"),y(C)):(e.consume(C),x)}function N(C){return e.exit("codeFenced"),t(C)}function T(C,R,O){let z=0;return E;function E(L){return C.enter("lineEnding"),C.consume(L),C.exit("lineEnding"),H}function H(L){return C.enter("codeFencedFence"),De(L)?Me(C,A,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):A(L)}function A(L){return L===l?(C.enter("codeFencedFenceSequence"),M(L)):O(L)}function M(L){return L===l?(z++,C.consume(L),M):z>=o?(C.exit("codeFencedFenceSequence"),De(L)?Me(C,V,"whitespace")(L):V(L)):O(L)}function V(L){return L===null||we(L)?(C.exit("codeFencedFence"),R(L)):O(L)}}}function fC(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 Pc={name:"codeIndented",tokenize:mC},pC={partial:!0,tokenize:gC};function mC(e,t,r){const n=this;return i;function i(c){return e.enter("codeIndented"),Me(e,s,"linePrefix",5)(c)}function s(c){const h=n.events[n.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?a(c):we(c)?e.attempt(pC,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||we(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function gC(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):we(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Me(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):we(o)?i(o):r(o)}}const _C={name:"codeText",previous:yC,resolve:vC,tokenize:xC};function vC(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 yC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function xC(e,t,r){let n=0,i,s;return o;function o(u){return e.enter("codeText"),e.enter("codeTextSequence"),l(u)}function l(u){return u===96?(e.consume(u),n++,l):(e.exit("codeTextSequence"),a(u))}function a(u){return u===null?r(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),a):u===96?(s=e.enter("codeTextSequence"),i=0,h(u)):we(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):(e.enter("codeTextData"),c(u))}function c(u){return u===null||u===32||u===96||we(u)?(e.exit("codeTextData"),a(u)):(e.consume(u),c)}function h(u){return u===96?(e.consume(u),i++,h):i===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(s.type="codeTextData",c(u))}}class wC{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&&Ds(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),Ds(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ds(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);Ds(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ds(this.left,r.reverse())}}}function Ds(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 cy(e){const t={};let r=-1,n,i,s,o,l,a,c;const h=new wC(e);for(;++r<h.length;){for(;r in t;)r=t[r];if(n=h.get(r),r&&n[1].type==="chunkFlow"&&h.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,SC(h,r)),r=t[r],c=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=h.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(h.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={...h.get(i)[1].start},l=h.slice(i,r),l.unshift(n),h.splice(i,r-i+1,l))}}return hr(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function SC(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 h,u,f=-1,p=r,m=0,g=0;const S=[g];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(h=n.sliceStream(p),p.next||h.push(null),u&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),u=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]),y=s.pop();a.push([y,y+_.length-1]),e.splice(y,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 bC={resolve:CC,tokenize:EC},kC={partial:!0,tokenize:NC};function CC(e){return cy(e),e}function EC(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):we(l)?e.check(kC,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 NC(e,t,r){const n=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Me(e,s,"linePrefix")}function s(o){if(o===null||we(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 uy(e,t,r,n,i,s,o,l,a){const c=a||Number.POSITIVE_INFINITY;let h=0;return u;function u(_){return _===60?(e.enter(n),e.enter(i),e.enter(s),e.consume(_),e.exit(s),f):_===null||_===32||_===41||ga(_)?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||we(_)?r(_):(e.consume(_),_===92?m:p)}function m(_){return _===60||_===62||_===92?(e.consume(_),p):p(_)}function g(_){return!h&&(_===null||_===41||Oe(_))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(_)):h<c&&_===40?(e.consume(_),h++,g):_===41?(e.consume(_),h--,g):_===null||_===32||_===40||ga(_)?r(_):(e.consume(_),_===92?S:g)}function S(_){return _===40||_===41||_===92?(e.consume(_),g):g(_)}}function hy(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),h}function h(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):we(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===null||p===91||p===93||we(p)||l++>999?(e.exit("chunkString"),h(p)):(e.consume(p),a||(a=!De(p)),p===92?f:u)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,u):u(p)}}function dy(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):we(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Me(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===o||f===null||we(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?u:h)}function u(f){return f===o||f===92?(e.consume(f),h):h(f)}}function so(e,t){let r;return n;function n(i){return we(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):De(i)?Me(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const TC={name:"definition",tokenize:PC},LC={partial:!0,tokenize:DC};function PC(e,t,r){const n=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return hy.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=zr(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 Oe(p)?so(e,c)(p):c(p)}function c(p){return uy(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return e.attempt(LC,u,u)(p)}function u(p){return De(p)?Me(e,f,"whitespace")(p):f(p)}function f(p){return p===null||we(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function DC(e,t,r){return n;function n(l){return Oe(l)?so(e,i)(l):r(l)}function i(l){return dy(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return De(l)?Me(e,o,"whitespace")(l):o(l)}function o(l){return l===null||we(l)?t(l):r(l)}}const IC={name:"hardBreakEscape",tokenize:RC};function RC(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return we(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const MC={name:"headingAtx",resolve:AC,tokenize:jC};function AC(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"},hr(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function jC(e,t,r){let n=0;return i;function i(h){return e.enter("atxHeading"),s(h)}function s(h){return e.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&n++<6?(e.consume(h),o):h===null||Oe(h)?(e.exit("atxHeadingSequence"),l(h)):r(h)}function l(h){return h===35?(e.enter("atxHeadingSequence"),a(h)):h===null||we(h)?(e.exit("atxHeading"),t(h)):De(h)?Me(e,l,"whitespace")(h):(e.enter("atxHeadingText"),c(h))}function a(h){return h===35?(e.consume(h),a):(e.exit("atxHeadingSequence"),l(h))}function c(h){return h===null||h===35||Oe(h)?(e.exit("atxHeadingText"),l(h)):(e.consume(h),c)}}const BC=["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"],km=["pre","script","style","textarea"],OC={concrete:!0,name:"htmlFlow",resolveTo:$C,tokenize:WC},zC={partial:!0,tokenize:UC},FC={partial:!0,tokenize:HC};function $C(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 WC(e,t,r){const n=this;let i,s,o,l,a;return c;function c(k){return h(k)}function h(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),u}function u(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:b):$t(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):$t(k)?(e.consume(k),i=4,n.interrupt?t:b):r(k)}function p(k){return k===45?(e.consume(k),n.interrupt?t:b):r(k)}function m(k){const _e="CDATA[";return k===_e.charCodeAt(l++)?(e.consume(k),l===_e.length?n.interrupt?t:A:m):r(k)}function g(k){return $t(k)?(e.consume(k),o=String.fromCharCode(k),S):r(k)}function S(k){if(k===null||k===47||k===62||Oe(k)){const _e=k===47,X=o.toLowerCase();return!_e&&!s&&km.includes(X)?(i=1,n.interrupt?t(k):A(k)):BC.includes(o.toLowerCase())?(i=6,_e?(e.consume(k),_):n.interrupt?t(k):A(k)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(k):s?y(k):x(k))}return k===45||jt(k)?(e.consume(k),o+=String.fromCharCode(k),S):r(k)}function _(k){return k===62?(e.consume(k),n.interrupt?t:A):r(k)}function y(k){return De(k)?(e.consume(k),y):E(k)}function x(k){return k===47?(e.consume(k),E):k===58||k===95||$t(k)?(e.consume(k),N):De(k)?(e.consume(k),x):E(k)}function N(k){return k===45||k===46||k===58||k===95||jt(k)?(e.consume(k),N):T(k)}function T(k){return k===61?(e.consume(k),C):De(k)?(e.consume(k),T):x(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,R):De(k)?(e.consume(k),C):O(k)}function R(k){return k===a?(e.consume(k),a=null,z):k===null||we(k)?r(k):(e.consume(k),R)}function O(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Oe(k)?T(k):(e.consume(k),O)}function z(k){return k===47||k===62||De(k)?x(k):r(k)}function E(k){return k===62?(e.consume(k),H):r(k)}function H(k){return k===null||we(k)?A(k):De(k)?(e.consume(k),H):r(k)}function A(k){return k===45&&i===2?(e.consume(k),j):k===60&&i===1?(e.consume(k),q):k===62&&i===4?(e.consume(k),ne):k===63&&i===3?(e.consume(k),b):k===93&&i===5?(e.consume(k),$):we(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(zC,ce,M)(k)):k===null||we(k)?(e.exit("htmlFlowData"),M(k)):(e.consume(k),A)}function M(k){return e.check(FC,V,ce)(k)}function V(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),L}function L(k){return k===null||we(k)?M(k):(e.enter("htmlFlowData"),A(k))}function j(k){return k===45?(e.consume(k),b):A(k)}function q(k){return k===47?(e.consume(k),o="",P):A(k)}function P(k){if(k===62){const _e=o.toLowerCase();return km.includes(_e)?(e.consume(k),ne):A(k)}return $t(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),P):A(k)}function $(k){return k===93?(e.consume(k),b):A(k)}function b(k){return k===62?(e.consume(k),ne):k===45&&i===2?(e.consume(k),b):A(k)}function ne(k){return k===null||we(k)?(e.exit("htmlFlowData"),ce(k)):(e.consume(k),ne)}function ce(k){return e.exit("htmlFlow"),t(k)}}function HC(e,t,r){const n=this;return i;function i(o){return we(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 UC(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ho,t,r)}}const VC={name:"htmlText",tokenize:KC};function KC(e,t,r){const n=this;let i,s,o;return l;function l(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),a}function a(b){return b===33?(e.consume(b),c):b===47?(e.consume(b),T):b===63?(e.consume(b),x):$t(b)?(e.consume(b),O):r(b)}function c(b){return b===45?(e.consume(b),h):b===91?(e.consume(b),s=0,m):$t(b)?(e.consume(b),y):r(b)}function h(b){return b===45?(e.consume(b),p):r(b)}function u(b){return b===null?r(b):b===45?(e.consume(b),f):we(b)?(o=u,q(b)):(e.consume(b),u)}function f(b){return b===45?(e.consume(b),p):u(b)}function p(b){return b===62?j(b):b===45?f(b):u(b)}function m(b){const ne="CDATA[";return b===ne.charCodeAt(s++)?(e.consume(b),s===ne.length?g:m):r(b)}function g(b){return b===null?r(b):b===93?(e.consume(b),S):we(b)?(o=g,q(b)):(e.consume(b),g)}function S(b){return b===93?(e.consume(b),_):g(b)}function _(b){return b===62?j(b):b===93?(e.consume(b),_):g(b)}function y(b){return b===null||b===62?j(b):we(b)?(o=y,q(b)):(e.consume(b),y)}function x(b){return b===null?r(b):b===63?(e.consume(b),N):we(b)?(o=x,q(b)):(e.consume(b),x)}function N(b){return b===62?j(b):x(b)}function T(b){return $t(b)?(e.consume(b),C):r(b)}function C(b){return b===45||jt(b)?(e.consume(b),C):R(b)}function R(b){return we(b)?(o=R,q(b)):De(b)?(e.consume(b),R):j(b)}function O(b){return b===45||jt(b)?(e.consume(b),O):b===47||b===62||Oe(b)?z(b):r(b)}function z(b){return b===47?(e.consume(b),j):b===58||b===95||$t(b)?(e.consume(b),E):we(b)?(o=z,q(b)):De(b)?(e.consume(b),z):j(b)}function E(b){return b===45||b===46||b===58||b===95||jt(b)?(e.consume(b),E):H(b)}function H(b){return b===61?(e.consume(b),A):we(b)?(o=H,q(b)):De(b)?(e.consume(b),H):z(b)}function A(b){return b===null||b===60||b===61||b===62||b===96?r(b):b===34||b===39?(e.consume(b),i=b,M):we(b)?(o=A,q(b)):De(b)?(e.consume(b),A):(e.consume(b),V)}function M(b){return b===i?(e.consume(b),i=void 0,L):b===null?r(b):we(b)?(o=M,q(b)):(e.consume(b),M)}function V(b){return b===null||b===34||b===39||b===60||b===61||b===96?r(b):b===47||b===62||Oe(b)?z(b):(e.consume(b),V)}function L(b){return b===47||b===62||Oe(b)?z(b):r(b)}function j(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):r(b)}function q(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),P}function P(b){return De(b)?Me(e,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):$(b)}function $(b){return e.enter("htmlTextData"),o(b)}}const lf={name:"labelEnd",resolveAll:GC,resolveTo:QC,tokenize:ZC},qC={tokenize:JC},YC={tokenize:e2},XC={tokenize:t2};function GC(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&&hr(e,0,e.length,r),e}function QC(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}},h={type:"labelText",start:{...e[s+n+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",a,t],["enter",c,t]],l=kr(l,e.slice(s+1,s+n+3)),l=kr(l,[["enter",h,t]]),l=kr(l,Ka(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=kr(l,[["exit",h,t],e[o-2],e[o-1],["exit",c,t]]),l=kr(l,e.slice(o+1)),l=kr(l,[["exit",a,t]]),hr(e,s,e.length,l),e}function ZC(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?u(f):(o=n.parser.defined.includes(zr(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(qC,h,o?h:u)(f):f===91?e.attempt(YC,h,o?c:u)(f):o?h(f):u(f)}function c(f){return e.attempt(XC,h,u)(f)}function h(f){return t(f)}function u(f){return s._balanced=!0,r(f)}}function JC(e,t,r){return n;function n(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),i}function i(u){return Oe(u)?so(e,s)(u):s(u)}function s(u){return u===41?h(u):uy(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function o(u){return Oe(u)?so(e,a)(u):h(u)}function l(u){return r(u)}function a(u){return u===34||u===39||u===40?dy(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):h(u)}function c(u){return Oe(u)?so(e,h)(u):h(u)}function h(u){return u===41?(e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),e.exit("resource"),t):r(u)}}function e2(e,t,r){const n=this;return i;function i(l){return hy.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes(zr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function t2(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 r2={name:"labelStartImage",resolveAll:lf.resolveAll,tokenize:n2};function n2(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 i2={name:"labelStartLink",resolveAll:lf.resolveAll,tokenize:s2};function s2(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 Dc={name:"lineEnding",tokenize:o2};function o2(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Me(e,t,"linePrefix")}}const Al={name:"thematicBreak",tokenize:l2};function l2(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||we(c))?(e.exit("thematicBreak"),t(c)):r(c)}function a(c){return c===i?(e.consume(c),n++,a):(e.exit("thematicBreakSequence"),De(c)?Me(e,l,"whitespace")(c):l(c))}}const Xt={continuation:{tokenize:h2},exit:f2,name:"list",tokenize:u2},a2={partial:!0,tokenize:p2},c2={partial:!0,tokenize:d2};function u2(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:ah(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(Al,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 ah(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(Ho,n.interrupt?r:h,e.attempt(a2,f,u))}function h(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function u(p){return De(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 h2(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(Ho,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Me(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!De(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(c2,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Me(e,e.attempt(Xt,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function d2(e,t,r){const n=this;return Me(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 f2(e){e.exit(this.containerState.type)}function p2(e,t,r){const n=this;return Me(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!De(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const Cm={name:"setextUnderline",resolveTo:m2,tokenize:g2};function m2(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 g2(e,t,r){const n=this;let i;return s;function s(c){let h=n.events.length,u;for(;h--;)if(n.events[h][1].type!=="lineEnding"&&n.events[h][1].type!=="linePrefix"&&n.events[h][1].type!=="content"){u=n.events[h][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||u)?(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"),De(c)?Me(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||we(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const _2={tokenize:v2};function v2(e){const t=this,r=e.attempt(Ho,n,e.attempt(this.parser.constructs.flowInitial,i,Me(e,e.attempt(this.parser.constructs.flow,i,e.attempt(bC,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 y2={resolveAll:py()},x2=fy("string"),w2=fy("text");function fy(e){return{resolveAll:py(e==="text"?S2: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(h){return c(h)?s(h):l(h)}function l(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),a}function a(h){return c(h)?(r.exit("data"),s(h)):(r.consume(h),a)}function c(h){if(h===null)return!0;const u=i[h];let f=-1;if(u)for(;++f<u.length;){const p=u[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function py(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 S2(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 b2={42:Xt,43:Xt,45:Xt,48:Xt,49:Xt,50:Xt,51:Xt,52:Xt,53:Xt,54:Xt,55:Xt,56:Xt,57:Xt,62:oy},k2={91:TC},C2={[-2]:Pc,[-1]:Pc,32:Pc},E2={35:MC,42:Al,45:[Cm,Al],60:OC,61:Cm,95:Al,96:bm,126:bm},N2={38:ay,92:ly},T2={[-5]:Dc,[-4]:Dc,[-3]:Dc,33:r2,38:ay,42:ch,60:[iC,VC],91:i2,92:[IC,ly],93:lf,95:ch,96:_C},L2={null:[ch,y2]},P2={null:[42,95]},D2={null:[]},I2=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:P2,contentInitial:k2,disable:D2,document:b2,flow:E2,flowInitial:C2,insideSpan:L2,string:N2,text:T2},Symbol.toStringTag,{value:"Module"}));function R2(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:R(T),check:R(C),consume:y,enter:x,exit:N,interrupt:R(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:u};let h=t.tokenize.call(c,a);return t.resolveAll&&s.push(t),c;function u(H){return o=kr(o,H),S(),o[o.length-1]!==null?[]:(O(t,0),c.events=Ka(s,c.events,c),c.events)}function f(H,A){return A2(p(H),A)}function p(H){return M2(o,H)}function m(){const{_bufferIndex:H,_index:A,line:M,column:V,offset:L}=n;return{_bufferIndex:H,_index:A,line:M,column:V,offset:L}}function g(H){i[H.line]=H.column,E()}function S(){let H;for(;n._index<o.length;){const A=o[n._index];if(typeof A=="string")for(H=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===H&&n._bufferIndex<A.length;)_(A.charCodeAt(n._bufferIndex));else _(A)}}function _(H){h=h(H)}function y(H){we(H)?(n.line++,n.column=1,n.offset+=H===-3?2:1,E()):H!==-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=H}function x(H,A){const M=A||{};return M.type=H,M.start=m(),c.events.push(["enter",M,c]),l.push(M),M}function N(H){const A=l.pop();return A.end=m(),c.events.push(["exit",A,c]),A}function T(H,A){O(H,A.from)}function C(H,A){A.restore()}function R(H,A){return M;function M(V,L,j){let q,P,$,b;return Array.isArray(V)?ce(V):"tokenize"in V?ce([V]):ne(V);function ne(te){return Y;function Y(le){const fe=le!==null&&te[le],me=le!==null&&te.null,ye=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(me)?me:me?[me]:[]];return ce(ye)(le)}}function ce(te){return q=te,P=0,te.length===0?j:k(te[P])}function k(te){return Y;function Y(le){return b=z(),$=te,te.partial||(c.currentConstruct=te),te.name&&c.parser.constructs.disable.null.includes(te.name)?X():te.tokenize.call(A?Object.assign(Object.create(c),A):c,a,_e,X)(le)}}function _e(te){return H($,b),L}function X(te){return b.restore(),++P<q.length?k(q[P]):j}}}function O(H,A){H.resolveAll&&!s.includes(H)&&s.push(H),H.resolve&&hr(c.events,A,c.events.length-A,H.resolve(c.events.slice(A),c)),H.resolveTo&&(c.events=H.resolveTo(c.events,c))}function z(){const H=m(),A=c.previous,M=c.currentConstruct,V=c.events.length,L=Array.from(l);return{from:V,restore:j};function j(){n=H,c.previous=A,c.currentConstruct=M,c.events.length=V,l=L,E()}}function E(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function M2(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 A2(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
|
+
`;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 j2(e){const n={constructs:iy([I2,...(e||{}).extensions||[]]),content:i(Qk),defined:[],document:i(Jk),flow:i(_2),lazy:{},string:i(x2),text:i(w2)};return n;function i(s){return o;function o(l){return R2(n,s,l)}}}function B2(e){for(;!cy(e););return e}const Em=/[\0\t\n\r]/g;function O2(){let e=1,t="",r=!0,n;return i;function i(s,o,l){const a=[];let c,h,u,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),u=0,t="",r&&(s.charCodeAt(0)===65279&&u++,r=void 0);u<s.length;){if(Em.lastIndex=u,c=Em.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(u);break}if(p===10&&u===f&&n)a.push(-3),n=void 0;else switch(n&&(a.push(-5),n=void 0),u<f&&(a.push(s.slice(u,f)),e+=f-u),p){case 0:{a.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,a.push(-2);e++<h;)a.push(-1);break}case 10:{a.push(-4),e=1;break}default:n=!0,e=1}u=f+1}return l&&(n&&a.push(-5),t&&a.push(t),a.push(null)),a}}const z2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function F2(e){return e.replace(z2,$2)}function $2(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return sy(r.slice(s?2:1),s?16:10)}return of(r)||e}const my={}.hasOwnProperty;function W2(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),H2(r)(B2(j2(r).document().write(O2()(e,t,!0))))}function H2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(nr),autolinkProtocol:z,autolinkEmail:z,atxHeading:s(mr),blockQuote:s(me),characterEscape:z,characterReference:z,codeFenced:s(ye),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(ye,o),codeText:s(xe,o),codeTextData:z,data:z,codeFlowValue:z,definition:s(Ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(F),hardBreakEscape:s(Pr),hardBreakTrailing:s(Pr),htmlFlow:s(Dt,o),htmlFlowData:z,htmlText:s(Dt,o),htmlTextData:z,image:s($r),label:o,link:s(nr),listItem:s(qt),listItemValue:f,listOrdered:s(gr,u),listUnordered:s(gr),paragraph:s(kt),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(mr),strong:s(Ct),thematicBreak:s(pe)},exit:{atxHeading:a(),atxHeadingSequence:T,autolink:a(),autolinkEmail:fe,autolinkProtocol:le,blockQuote:a(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:X,characterReferenceMarkerNumeric:X,characterReferenceValue:te,characterReference:Y,codeFenced:a(S),codeFencedFence:g,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:a(_),codeText:a(L),codeTextData:E,data:E,definition:a(),definitionDestinationString:N,definitionLabelString:y,definitionTitleString:x,emphasis:a(),hardBreakEscape:a(A),hardBreakTrailing:a(A),htmlFlow:a(M),htmlFlowData:E,htmlText:a(V),htmlTextData:E,image:a(q),label:$,labelText:P,lineEnding:H,link:a(j),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:_e,resourceDestinationString:b,resourceTitleString:ne,resource:ce,setextHeading:a(O),setextHeadingLineSequence:R,setextHeadingText:C,strong:a(),thematicBreak:a()}};gy(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(I){let U={type:"root",children:[]};const Q={stack:[U],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:h,data:r},ge=[];let Pe=-1;for(;++Pe<I.length;)if(I[Pe][1].type==="listOrdered"||I[Pe][1].type==="listUnordered")if(I[Pe][0]==="enter")ge.push(Pe);else{const de=ge.pop();Pe=i(I,de,Pe)}for(Pe=-1;++Pe<I.length;){const de=t[I[Pe][0]];my.call(de,I[Pe][1].type)&&de[I[Pe][1].type].call(Object.assign({sliceSerialize:I[Pe][2].sliceSerialize},Q),I[Pe][1])}if(Q.tokenStack.length>0){const de=Q.tokenStack[Q.tokenStack.length-1];(de[1]||Nm).call(Q,void 0,de[0])}for(U.position={start:wn(I.length>0?I[0][1].start:{line:1,column:1,offset:0}),end:wn(I.length>0?I[I.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)U=t.transforms[Pe](U)||U;return U}function i(I,U,Q){let ge=U-1,Pe=-1,de=!1,D,B,W,ee;for(;++ge<=Q;){const Z=I[ge];switch(Z[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Z[0]==="enter"?Pe++:Pe--,ee=void 0;break}case"lineEndingBlank":{Z[0]==="enter"&&(D&&!ee&&!Pe&&!W&&(W=ge),ee=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ee=void 0}if(!Pe&&Z[0]==="enter"&&Z[1].type==="listItemPrefix"||Pe===-1&&Z[0]==="exit"&&(Z[1].type==="listUnordered"||Z[1].type==="listOrdered")){if(D){let ae=ge;for(B=void 0;ae--;){const J=I[ae];if(J[1].type==="lineEnding"||J[1].type==="lineEndingBlank"){if(J[0]==="exit")continue;B&&(I[B][1].type="lineEndingBlank",de=!0),J[1].type="lineEnding",B=ae}else if(!(J[1].type==="linePrefix"||J[1].type==="blockQuotePrefix"||J[1].type==="blockQuotePrefixWhitespace"||J[1].type==="blockQuoteMarker"||J[1].type==="listItemIndent"))break}W&&(!B||W<B)&&(D._spread=!0),D.end=Object.assign({},B?I[B][1].start:Z[1].end),I.splice(B||ge,0,["exit",D,Z[2]]),ge++,Q++}if(Z[1].type==="listItemPrefix"){const ae={type:"listItem",_spread:!1,start:Object.assign({},Z[1].start),end:void 0};D=ae,I.splice(ge,0,["enter",ae,Z[2]]),ge++,Q++,W=void 0,ee=!0}}}return I[U][1]._spread=de,Q}function s(I,U){return Q;function Q(ge){l.call(this,I(ge),ge),U&&U.call(this,ge)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(I,U,Q){this.stack[this.stack.length-1].children.push(I),this.stack.push(I),this.tokenStack.push([U,Q||void 0]),I.position={start:wn(U.start),end:void 0}}function a(I){return U;function U(Q){I&&I.call(this,Q),c.call(this,Q)}}function c(I,U){const Q=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==I.type&&(U?U.call(this,I,ge[0]):(ge[1]||Nm).call(this,I,ge[0]));else throw new Error("Cannot close `"+I.type+"` ("+io({start:I.start,end:I.end})+"): itโs not open");Q.position.end=wn(I.end)}function h(){return sf(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function f(I){if(this.data.expectingFirstListItemValue){const U=this.stack[this.stack.length-2];U.start=Number.parseInt(this.sliceSerialize(I),10),this.data.expectingFirstListItemValue=void 0}}function p(){const I=this.resume(),U=this.stack[this.stack.length-1];U.lang=I}function m(){const I=this.resume(),U=this.stack[this.stack.length-1];U.meta=I}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const I=this.resume(),U=this.stack[this.stack.length-1];U.value=I.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const I=this.resume(),U=this.stack[this.stack.length-1];U.value=I.replace(/(\r?\n|\r)$/g,"")}function y(I){const U=this.resume(),Q=this.stack[this.stack.length-1];Q.label=U,Q.identifier=zr(this.sliceSerialize(I)).toLowerCase()}function x(){const I=this.resume(),U=this.stack[this.stack.length-1];U.title=I}function N(){const I=this.resume(),U=this.stack[this.stack.length-1];U.url=I}function T(I){const U=this.stack[this.stack.length-1];if(!U.depth){const Q=this.sliceSerialize(I).length;U.depth=Q}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function R(I){const U=this.stack[this.stack.length-1];U.depth=this.sliceSerialize(I).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function z(I){const Q=this.stack[this.stack.length-1].children;let ge=Q[Q.length-1];(!ge||ge.type!=="text")&&(ge=ie(),ge.position={start:wn(I.start),end:void 0},Q.push(ge)),this.stack.push(ge)}function E(I){const U=this.stack.pop();U.value+=this.sliceSerialize(I),U.position.end=wn(I.end)}function H(I){const U=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=U.children[U.children.length-1];Q.position.end=wn(I.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(U.type)&&(z.call(this,I),E.call(this,I))}function A(){this.data.atHardBreak=!0}function M(){const I=this.resume(),U=this.stack[this.stack.length-1];U.value=I}function V(){const I=this.resume(),U=this.stack[this.stack.length-1];U.value=I}function L(){const I=this.resume(),U=this.stack[this.stack.length-1];U.value=I}function j(){const I=this.stack[this.stack.length-1];if(this.data.inReference){const U=this.data.referenceType||"shortcut";I.type+="Reference",I.referenceType=U,delete I.url,delete I.title}else delete I.identifier,delete I.label;this.data.referenceType=void 0}function q(){const I=this.stack[this.stack.length-1];if(this.data.inReference){const U=this.data.referenceType||"shortcut";I.type+="Reference",I.referenceType=U,delete I.url,delete I.title}else delete I.identifier,delete I.label;this.data.referenceType=void 0}function P(I){const U=this.sliceSerialize(I),Q=this.stack[this.stack.length-2];Q.label=F2(U),Q.identifier=zr(U).toLowerCase()}function $(){const I=this.stack[this.stack.length-1],U=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const ge=I.children;Q.children=ge}else Q.alt=U}function b(){const I=this.resume(),U=this.stack[this.stack.length-1];U.url=I}function ne(){const I=this.resume(),U=this.stack[this.stack.length-1];U.title=I}function ce(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function _e(I){const U=this.resume(),Q=this.stack[this.stack.length-1];Q.label=U,Q.identifier=zr(this.sliceSerialize(I)).toLowerCase(),this.data.referenceType="full"}function X(I){this.data.characterReferenceType=I.type}function te(I){const U=this.sliceSerialize(I),Q=this.data.characterReferenceType;let ge;Q?(ge=sy(U,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=of(U);const Pe=this.stack[this.stack.length-1];Pe.value+=ge}function Y(I){const U=this.stack.pop();U.position.end=wn(I.end)}function le(I){E.call(this,I);const U=this.stack[this.stack.length-1];U.url=this.sliceSerialize(I)}function fe(I){E.call(this,I);const U=this.stack[this.stack.length-1];U.url="mailto:"+this.sliceSerialize(I)}function me(){return{type:"blockquote",children:[]}}function ye(){return{type:"code",lang:null,meta:null,value:""}}function xe(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function F(){return{type:"emphasis",children:[]}}function mr(){return{type:"heading",depth:0,children:[]}}function Pr(){return{type:"break"}}function Dt(){return{type:"html",value:""}}function $r(){return{type:"image",title:null,url:"",alt:null}}function nr(){return{type:"link",title:null,url:"",children:[]}}function gr(I){return{type:"list",ordered:I.type==="listOrdered",start:null,spread:I._spread,children:[]}}function qt(I){return{type:"listItem",spread:I._spread,checked:null,children:[]}}function kt(){return{type:"paragraph",children:[]}}function Ct(){return{type:"strong",children:[]}}function ie(){return{type:"text",value:""}}function pe(){return{type:"thematicBreak"}}}function wn(e){return{line:e.line,column:e.column,offset:e.offset}}function gy(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?gy(e,n):U2(e,n)}}function U2(e,t){let r;for(r in t)if(my.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 Nm(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+io({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+io({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+io({start:t.start,end:t.end})+") is still open")}function V2(e){const t=this;t.parser=r;function r(n){return W2(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function K2(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 q2(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
71
|
+
`}]}function Y2(e,t){const r=t.value?t.value+`
|
|
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 X2(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function G2(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Q2(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),i=vs(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 Z2(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 J2(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function _y(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 eE(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return _y(e,t);const i={src:vs(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 tE(e,t){const r={src:vs(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 rE(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 nE(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return _y(e,t);const i={href:vs(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 iE(e,t){const r={href:vs(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 sE(e,t,r){const n=e.all(t),i=r?oE(r):vy(t),s={},o=[];if(typeof t.checked=="boolean"){const h=n[0];let u;h&&h.type==="element"&&h.tagName==="p"?u=h:(u={type:"element",tagName:"p",properties:{},children:[]},n.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.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 h=n[l];(i||l!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
|
|
73
|
+
`}),h.type==="element"&&h.tagName==="p"&&!i?o.push(...h.children):o.push(h)}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 oE(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=vy(r[n])}return t}function vy(e){const t=e.spread;return t??e.children.length>1}function lE(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 aE(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function cE(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function uE(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function hE(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=ef(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 dE(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 u=t.children[a],f={},p=o?o[a]:void 0;p&&(f.align=p);let m={type:"element",tagName:s,properties:f,children:[]};u&&(m.children=e.all(u),e.patch(u,m),m=e.applyData(u,m)),c.push(m)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function fE(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const Tm=9,Lm=32;function pE(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),i=0;const s=[];for(;n;)s.push(Pm(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return s.push(Pm(t.slice(i),i>0,!1)),s.join("")}function Pm(e,t,r){let n=0,i=e.length;if(t){let s=e.codePointAt(n);for(;s===Tm||s===Lm;)n++,s=e.codePointAt(n)}if(r){let s=e.codePointAt(i-1);for(;s===Tm||s===Lm;)i--,s=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}function mE(e,t){const r={type:"text",value:pE(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function gE(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const _E={blockquote:K2,break:q2,code:Y2,delete:X2,emphasis:G2,footnoteReference:Q2,heading:Z2,html:J2,imageReference:eE,image:tE,inlineCode:rE,linkReference:nE,link:iE,listItem:sE,list:lE,paragraph:aE,root:cE,strong:uE,table:hE,tableCell:fE,tableRow:dE,text:mE,thematicBreak:gE,toml:dl,yaml:dl,definition:dl,footnoteDefinition:dl};function dl(){}const yy=-1,qa=0,oo=1,_a=2,af=3,cf=4,uf=5,hf=6,xy=7,wy=8,Dm=typeof self=="object"?self:globalThis,vE=(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 qa:case yy:return r(o,i);case oo:{const l=r([],i);for(const a of o)l.push(n(a));return l}case _a:{const l=r({},i);for(const[a,c]of o)l[n(a)]=n(c);return l}case af:return r(new Date(o),i);case cf:{const{source:l,flags:a}=o;return r(new RegExp(l,a),i)}case uf:{const l=r(new Map,i);for(const[a,c]of o)l.set(n(a),n(c));return l}case hf:{const l=r(new Set,i);for(const a of o)l.add(n(a));return l}case xy:{const{name:l,message:a}=o;return r(new Dm[l](a),i)}case wy: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 Dm[s](o),i)};return n},Im=e=>vE(new Map,e)(0),Ii="",{toString:yE}={},{keys:xE}=Object,Is=e=>{const t=typeof e;if(t!=="object"||!e)return[qa,t];const r=yE.call(e).slice(8,-1);switch(r){case"Array":return[oo,Ii];case"Object":return[_a,Ii];case"Date":return[af,Ii];case"RegExp":return[cf,Ii];case"Map":return[uf,Ii];case"Set":return[hf,Ii];case"DataView":return[oo,r]}return r.includes("Array")?[oo,r]:r.includes("Error")?[xy,r]:[_a,r]},fl=([e,t])=>e===qa&&(t==="function"||t==="symbol"),wE=(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]=Is(o);switch(l){case qa:{let h=o;switch(a){case"bigint":l=wy,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);h=null;break;case"undefined":return i([yy],o)}return i([l,h],o)}case oo:{if(a){let f=o;return a==="DataView"?f=new Uint8Array(o.buffer):a==="ArrayBuffer"&&(f=new Uint8Array(o)),i([a,[...f]],o)}const h=[],u=i([l,h],o);for(const f of o)h.push(s(f));return u}case _a:{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 h=[],u=i([l,h],o);for(const f of xE(o))(e||!fl(Is(o[f])))&&h.push([s(f),s(o[f])]);return u}case af:return i([l,o.toISOString()],o);case cf:{const{source:h,flags:u}=o;return i([l,{source:h,flags:u}],o)}case uf:{const h=[],u=i([l,h],o);for(const[f,p]of o)(e||!(fl(Is(f))||fl(Is(p))))&&h.push([s(f),s(p)]);return u}case hf:{const h=[],u=i([l,h],o);for(const f of o)(e||!fl(Is(f)))&&h.push(s(f));return u}}const{message:c}=o;return i([l,{name:a,message:c}],o)};return s},Rm=(e,{json:t,lossy:r}={})=>{const n=[];return wE(!(t||r),!!t,new Map,n)(e),n},va=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Im(Rm(e,t)):structuredClone(e):(e,t)=>Im(Rm(e,t));function SE(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 bE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function kE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||SE,n=e.options.footnoteBackLabel||bE,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 h=e.all(c),u=String(c.identifier).toUpperCase(),f=vs(u.toLowerCase());let p=0;const m=[],g=e.footnoteCounts.get(u);for(;g!==void 0&&++p<=g;){m.length>0&&m.push({type:"text",value:" "});let y=typeof r=="string"?r:r(a,p);typeof y=="string"&&(y={type:"text",value:y}),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(y)?y:[y]})}const S=h[h.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const y=S.children[S.children.length-1];y&&y.type==="text"?y.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...m)}else h.push(...m);const _={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(h,!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:{...va(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
75
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
76
|
+
`}]}}const Ya=function(e){if(e==null)return TE;if(typeof e=="function")return Xa(e);if(typeof e=="object")return Array.isArray(e)?CE(e):EE(e);if(typeof e=="string")return NE(e);throw new Error("Expected function, string, or object as test")};function CE(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Ya(e[r]);return Xa(n);function n(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function EE(e){const t=e;return Xa(r);function r(n){const i=n;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function NE(e){return Xa(t);function t(r){return r&&r.type===e}}function Xa(e){return t;function t(r,n,i){return!!(LE(r)&&e.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function TE(){return!0}function LE(e){return e!==null&&typeof e=="object"&&"type"in e}const Sy=[],PE=!0,uh=!1,DE="skip";function by(e,t,r,n){let i;typeof t=="function"&&typeof r!="function"?(n=r,r=t):i=t;const s=Ya(i),o=n?-1:1;l(e,void 0,[])();function l(a,c,h){const u=a&&typeof a=="object"?a:{};if(typeof u.type=="string"){const p=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(a.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=Sy,m,g,S;if((!t||s(a,c,h[h.length-1]||void 0))&&(p=IE(r(a,h)),p[0]===uh))return p;if("children"in a&&a.children){const _=a;if(_.children&&p[0]!==DE)for(g=(n?_.children.length:-1)+o,S=h.concat(_);g>-1&&g<_.children.length;){const y=_.children[g];if(m=l(y,g,S)(),m[0]===uh)return m;g=typeof m[1]=="number"?m[1]:g+o}}return p}}}function IE(e){return Array.isArray(e)?e:typeof e=="number"?[PE,e]:e==null?Sy:[e]}function Ga(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),by(e,s,l,i);function l(a,c){const h=c[c.length-1],u=h?h.children.indexOf(a):void 0;return o(a,u,h)}}const hh={}.hasOwnProperty,RE={};function ME(e,t){const r=t||RE,n=new Map,i=new Map,s=new Map,o={..._E,...r.handlers},l={all:c,applyData:jE,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:a,options:r,patch:AE,wrap:OE};return Ga(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const u=h.type==="definition"?n:i,f=String(h.identifier).toUpperCase();u.has(f)||u.set(f,h)}}),l;function a(h,u){const f=h.type,p=l.handlers[f];if(hh.call(l.handlers,f)&&p)return p(l,h,u);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in h){const{children:g,...S}=h,_=va(S);return _.children=l.all(h),_}return va(h)}return(l.options.unknownHandler||BE)(l,h,u)}function c(h){const u=[];if("children"in h){const f=h.children;let p=-1;for(;++p<f.length;){const m=l.one(f[p],h);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Mm(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=Mm(g.value))}Array.isArray(m)?u.push(...m):u.push(m)}}}return u}}function AE(e,t){e.position&&(t.position=bk(e))}function jE(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,va(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function BE(e,t){const r=t.data||{},n="value"in t&&!(hh.call(r,"hProperties")||hh.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 OE(e,t){const r=[];let n=-1;for(t&&r.push({type:"text",value:`
|
|
77
|
+
`});++n<e.length;)n&&r.push({type:"text",value:`
|
|
78
|
+
`}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
79
|
+
`}),r}function Mm(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Am(e,t){const r=ME(e,t),n=r.one(e,void 0),i=kE(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 zE(e,t){return e&&"run"in e?async function(r,n){const i=Am(r,{file:n,...t});await e.run(i,n)}:function(r,n){return Am(r,{file:n,...e||t})}}function jm(e){if(e)throw e}var jl=Object.prototype.hasOwnProperty,ky=Object.prototype.toString,Bm=Object.defineProperty,Om=Object.getOwnPropertyDescriptor,zm=function(t){return typeof Array.isArray=="function"?Array.isArray(t):ky.call(t)==="[object Array]"},Fm=function(t){if(!t||ky.call(t)!=="[object Object]")return!1;var r=jl.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&jl.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var i;for(i in t);return typeof i>"u"||jl.call(t,i)},$m=function(t,r){Bm&&r.name==="__proto__"?Bm(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},Wm=function(t,r){if(r==="__proto__")if(jl.call(t,r)){if(Om)return Om(t,r).value}else return;return t[r]},FE=function e(){var t,r,n,i,s,o,l=arguments[0],a=1,c=arguments.length,h=!1;for(typeof l=="boolean"&&(h=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=Wm(l,r),i=Wm(t,r),l!==i&&(h&&i&&(Fm(i)||(s=zm(i)))?(s?(s=!1,o=n&&zm(n)?n:[]):o=n&&Fm(n)?n:{},$m(l,{name:r,newValue:e(h,o,i)})):typeof i<"u"&&$m(l,{name:r,newValue:i}));return l};const Ic=ed(FE);function dh(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 $E(){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 h=e[++s];let u=-1;if(a){o(a);return}for(;++u<i.length;)(c[u]===null||c[u]===void 0)&&(c[u]=i[u]);i=c,h?WE(h,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 WE(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 h=c;if(l&&r)throw h;return i(h)}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 qr={basename:HE,dirname:UE,extname:VE,join:KE,sep:"/"};function HE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Uo(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 UE(e){if(Uo(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 VE(e){Uo(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 KE(...e){let t=-1,r;for(;++t<e.length;)Uo(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":qE(r)}function qE(e){Uo(e);const t=e.codePointAt(0)===47;let r=YE(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function YE(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 Uo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const XE={cwd:GE};function GE(){return"/"}function fh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function QE(e){if(typeof e=="string")e=new URL(e);else if(!fh(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 ZE(e)}function ZE(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 Rc=["history","path","basename","stem","extname","dirname"];class Cy{constructor(t){let r;t?fh(t)?r={path:t}:typeof t=="string"||JE(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":XE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Rc.length;){const s=Rc[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)Rc.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?qr.basename(this.path):void 0}set basename(t){Ac(t,"basename"),Mc(t,"basename"),this.path=qr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?qr.dirname(this.path):void 0}set dirname(t){Hm(this.basename,"dirname"),this.path=qr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?qr.extname(this.path):void 0}set extname(t){if(Mc(t,"extname"),Hm(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=qr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){fh(t)&&(t=QE(t)),Ac(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?qr.basename(this.path,this.extname):void 0}set stem(t){Ac(t,"stem"),Mc(t,"stem"),this.path=qr.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 Ot(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 Mc(e,t){if(e&&e.includes(qr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+qr.sep+"`")}function Ac(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Hm(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function JE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const e5=function(e){const n=this.constructor.prototype,i=n[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s},t5={}.hasOwnProperty;class df extends e5{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=$E()}copy(){const t=new df;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(Ic(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Oc("data",this.frozen),this.namespace[t]=r,this):t5.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Oc("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=pl(t),n=this.parser||this.Parser;return jc("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),jc("process",this.parser||this.Parser),Bc("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const l=pl(t),a=n.parse(l);n.run(a,l,function(h,u,f){if(h||!u||!f)return c(h);const p=u,m=n.stringify(p,f);i5(m)?f.value=m:f.result=m,c(h,f)});function c(h,u){h||!u?o(h):s?s(u):r(void 0,u)}}}processSync(t){let r=!1,n;return this.freeze(),jc("processSync",this.parser||this.Parser),Bc("processSync",this.compiler||this.Compiler),this.process(t,i),Vm("processSync","process",r),n;function i(s,o){r=!0,jm(s),n=o}}run(t,r,n){Um(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=pl(r);i.run(t,a,c);function c(h,u,f){const p=u||t;h?l(h):o?o(p):n(void 0,p,f)}}}runSync(t,r){let n=!1,i;return this.run(t,r,s),Vm("runSync","run",n),i;function s(o,l){jm(o),i=l,n=!0}}stringify(t,r){this.freeze();const n=pl(r),i=this.compiler||this.Compiler;return Bc("stringify",i),Um(t),i(t,n)}use(t,...r){const n=this.attachers,i=this.namespace;if(Oc("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[h,...u]=c;a(h,u)}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=Ic(!0,i.settings,c.settings))}function l(c){let h=-1;if(c!=null)if(Array.isArray(c))for(;++h<c.length;){const u=c[h];s(u)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function a(c,h){let u=-1,f=-1;for(;++u<n.length;)if(n[u][0]===c){f=u;break}if(f===-1)n.push([c,...h]);else if(h.length>0){let[p,...m]=h;const g=n[f][1];dh(g)&&dh(p)&&(p=Ic(!0,g,p)),n[f]=[c,p,...m]}}}}const r5=new df().freeze();function jc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Bc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Oc(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 Um(e){if(!dh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Vm(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function pl(e){return n5(e)?e:new Cy(e)}function n5(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function i5(e){return typeof e=="string"||s5(e)}function s5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const o5="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Km=[],qm={allowDangerousHtml:!0},l5=/^(https?|ircs?|mailto|xmpp)$/i,a5=[{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 Ym(e){const t=c5(e),r=u5(e);return h5(t.runSync(t.parse(r),r),e)}function c5(e){const t=e.rehypePlugins||Km,r=e.remarkPlugins||Km,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...qm}:qm;return r5().use(V2).use(r).use(zE,n).use(t)}function u5(e){const t=e.children||"",r=new Cy;return typeof t=="string"&&(r.value=t),r}function h5(e,t){const r=t.allowedElements,n=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||d5;for(const h of a5)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+o5+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Ga(e,c),Tk(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(h,u,f){if(h.type==="raw"&&f&&typeof u=="number")return o?f.children.splice(u,1):f.children[u]={type:"text",value:h.value},u;if(h.type==="element"){let p;for(p in Lc)if(Object.hasOwn(Lc,p)&&Object.hasOwn(h.properties,p)){const m=h.properties[p],g=Lc[p];(g===null||g.includes(h.tagName))&&(h.properties[p]=a(String(m||""),p,h))}}if(h.type==="element"){let p=r?!r.includes(h.tagName):s?s.includes(h.tagName):!1;if(!p&&n&&typeof u=="number"&&(p=!n(h,u,f)),p&&f&&typeof u=="number")return l&&h.children?f.children.splice(u,1,...h.children):f.children.splice(u,1),u}}}function d5(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||l5.test(e.slice(0,t))?e:""}function Xm(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 f5(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ey(e,t,r){const i=Ya((r||{}).ignore||[]),s=p5(t);let o=-1;for(;++o<s.length;)by(e,"text",l);function l(c,h){let u=-1,f;for(;++u<h.length;){const p=h[u],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return a(c,h)}function a(c,h){const u=h[h.length-1],f=s[o][0],p=s[o][1];let m=0;const S=u.children.indexOf(c);let _=!1,y=[];f.lastIndex=0;let x=f.exec(c.value);for(;x;){const N=x.index,T={index:x.index,input:x.input,stack:[...h,c]};let C=p(...x,T);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?f.lastIndex=N+1:(m!==N&&y.push({type:"text",value:c.value.slice(m,N)}),Array.isArray(C)?y.push(...C):C&&y.push(C),m=N+x[0].length,_=!0),!f.global)break;x=f.exec(c.value)}return _?(m<c.value.length&&y.push({type:"text",value:c.value.slice(m)}),u.children.splice(S,1,...y)):y=[c],S+y.length}}function p5(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([m5(i[0]),g5(i[1])])}return t}function m5(e){return typeof e=="string"?new RegExp(f5(e),"g"):e}function g5(e){return typeof e=="function"?e:function(){return e}}const zc="phrasing",Fc=["autolink","link","image","label"];function _5(){return{transforms:[k5],enter:{literalAutolink:y5,literalAutolinkEmail:$c,literalAutolinkHttp:$c,literalAutolinkWww:$c},exit:{literalAutolink:b5,literalAutolinkEmail:S5,literalAutolinkHttp:x5,literalAutolinkWww:w5}}}function v5(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:zc,notInConstruct:Fc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:zc,notInConstruct:Fc},{character:":",before:"[ps]",after:"\\/",inConstruct:zc,notInConstruct:Fc}]}}function y5(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function $c(e){this.config.enter.autolinkProtocol.call(this,e)}function x5(e){this.config.exit.autolinkProtocol.call(this,e)}function w5(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 S5(e){this.config.exit.autolinkEmail.call(this,e)}function b5(e){this.exit(e)}function k5(e){Ey(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,C5],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),E5]],{ignore:["link","linkReference"]})}function C5(e,t,r,n,i){let s="";if(!Ny(i)||(/^w/i.test(t)&&(r=t+r,t="",s="http://"),!N5(r)))return!1;const o=T5(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 E5(e,t,r,n){return!Ny(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function N5(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 T5(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=Xm(e,"(");let s=Xm(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 Ny(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||wi(r)||Va(r))&&(!t||r!==47)}Ty.peek=B5;function L5(){this.buffer()}function P5(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function D5(){this.buffer()}function I5(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function R5(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=zr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function M5(e){this.exit(e)}function A5(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=zr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function j5(e){this.exit(e)}function B5(){return"["}function Ty(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 O5(){return{enter:{gfmFootnoteCallString:L5,gfmFootnoteCall:P5,gfmFootnoteDefinitionLabelString:D5,gfmFootnoteDefinition:I5},exit:{gfmFootnoteCallString:R5,gfmFootnoteCall:M5,gfmFootnoteDefinitionLabelString:A5,gfmFootnoteDefinition:j5}}}function z5(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:Ty},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"),h=s.enter("label");return a+=l.move(s.safe(s.associationId(n),{before:a,after:"]"})),h(),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?Ly:F5))),c(),a}}function F5(e,t,r){return t===0?e:Ly(e,t,r)}function Ly(e,t,r){return(r?"":" ")+e}const $5=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Py.peek=K5;function W5(){return{canContainEols:["delete"],enter:{strikethrough:U5},exit:{strikethrough:V5}}}function H5(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$5}],handlers:{delete:Py}}}function U5(e){this.enter({type:"delete",children:[]},e)}function V5(e){this.exit(e)}function Py(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 K5(){return"~"}function q5(e){return e.length}function Y5(e,t){const r=t||{},n=(r.align||[]).concat(),i=r.stringLength||q5,s=[],o=[],l=[],a=[];let c=0,h=-1;for(;++h<e.length;){const g=[],S=[];let _=-1;for(e[h].length>c&&(c=e[h].length);++_<e[h].length;){const y=X5(e[h][_]);if(r.alignDelimiters!==!1){const x=i(y);S[_]=x,(a[_]===void 0||x>a[_])&&(a[_]=x)}g.push(y)}o[h]=g,l[h]=S}let u=-1;if(typeof n=="object"&&"length"in n)for(;++u<c;)s[u]=Gm(n[u]);else{const g=Gm(n);for(;++u<c;)s[u]=g}u=-1;const f=[],p=[];for(;++u<c;){const g=s[u];let S="",_="";g===99?(S=":",_=":"):g===108?S=":":g===114&&(_=":");let y=r.alignDelimiters===!1?1:Math.max(1,a[u]-S.length-_.length);const x=S+"-".repeat(y)+_;r.alignDelimiters!==!1&&(y=S.length+y+_.length,y>a[u]&&(a[u]=y),p[u]=y),f[u]=x}o.splice(1,0,f),l.splice(1,0,p),h=-1;const m=[];for(;++h<o.length;){const g=o[h],S=l[h];u=-1;const _=[];for(;++u<c;){const y=g[u]||"";let x="",N="";if(r.alignDelimiters!==!1){const T=a[u]-(S[u]||0),C=s[u];C===114?x=" ".repeat(T):C===99?T%2?(x=" ".repeat(T/2+.5),N=" ".repeat(T/2-.5)):(x=" ".repeat(T/2),N=x):N=" ".repeat(T)}r.delimiterStart!==!1&&!u&&_.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&y==="")&&(r.delimiterStart!==!1||u)&&_.push(" "),r.alignDelimiters!==!1&&_.push(x),_.push(y),r.alignDelimiters!==!1&&_.push(N),r.padding!==!1&&_.push(" "),(r.delimiterEnd!==!1||u!==c-1)&&_.push("|")}m.push(r.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return m.join(`
|
|
82
|
+
`)}function X5(e){return e==null?"":String(e)}function Gm(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 G5(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()),Q5);return i(),o}function Q5(e,t,r){return">"+(r?"":" ")+e}function Z5(e,t){return Qm(e,t.inConstruct,!0)&&!Qm(e,t.notInConstruct,!1)}function Qm(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 Zm(e,t,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
|
|
83
|
+
`&&Z5(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
|
|
84
|
+
`}function J5(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 eN(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 tN(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 rN(e,t,r,n){const i=tN(r),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(eN(e,r)){const u=r.enter("codeIndented"),f=r.indentLines(s,nN);return u(),f}const l=r.createTracker(n),a=i.repeat(Math.max(J5(s,i)+1,3)),c=r.enter("codeFenced");let h=l.move(a);if(e.lang){const u=r.enter(`codeFencedLang${o}`);h+=l.move(r.safe(e.lang,{before:h,after:" ",encode:["`"],...l.current()})),u()}if(e.lang&&e.meta){const u=r.enter(`codeFencedMeta${o}`);h+=l.move(" "),h+=l.move(r.safe(e.meta,{before:h,after:`
|
|
85
|
+
`,encode:["`"],...l.current()})),u()}return h+=l.move(`
|
|
86
|
+
`),s&&(h+=l.move(s+`
|
|
87
|
+
`)),h+=l.move(a),c(),h}function nN(e,t,r){return(r?"":" ")+e}function ff(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 iN(e,t,r,n){const i=ff(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 sN(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 Po(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ya(e,t,r){const n=us(e),i=us(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}}Dy.peek=oN;function Dy(e,t,r,n){const i=sN(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),h=ya(n.before.charCodeAt(n.before.length-1),c,i);h.inside&&(a=Po(c)+a.slice(1));const u=a.charCodeAt(a.length-1),f=ya(n.after.charCodeAt(0),u,i);f.inside&&(a=a.slice(0,-1)+Po(u));const p=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:h.outside},l+a+p}function oN(e,t,r){return r.options.emphasis||"*"}function lN(e,t){let r=!1;return Ga(e,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,uh}),!!((!e.depth||e.depth<3)&&sf(e)&&(t.options.setext||r))}function aN(e,t,r,n){const i=Math.max(Math.min(6,e.depth||1),1),s=r.createTracker(n);if(lN(e,r)){const h=r.enter("headingSetext"),u=r.enter("phrasing"),f=r.containerPhrasing(e,{...s.current(),before:`
|
|
89
|
+
`,after:`
|
|
90
|
+
`});return u(),h(),f+`
|
|
91
|
+
`+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
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=Po(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),a(),l(),c}Iy.peek=cN;function Iy(e){return e.value||""}function cN(){return"<"}Ry.peek=uN;function Ry(e,t,r,n){const i=ff(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 uN(){return"!"}My.peek=hN;function My(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 h=r.stack;r.stack=[],o=r.enter("reference");const u=r.safe(r.associationId(e),{before:a,after:"]",...l.current()});return o(),r.stack=h,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function hN(){return"!"}Ay.peek=dN;function Ay(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 dN(){return"`"}function jy(e,t){const r=sf(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))}By.peek=fN;function By(e,t,r,n){const i=ff(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let l,a;if(jy(e,r)){const h=r.stack;r.stack=[],l=r.enter("autolink");let u=o.move("<");return u+=o.move(r.containerPhrasing(e,{before:u,after:">",...o.current()})),u+=o.move(">"),l(),r.stack=h,u}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 fN(e,t,r){return jy(e,r)?"<":"["}Oy.peek=pN;function Oy(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 h=r.stack;r.stack=[],o=r.enter("reference");const u=r.safe(r.associationId(e),{before:a,after:"]",...l.current()});return o(),r.stack=h,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function pN(){return"["}function pf(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 mN(e){const t=pf(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 gN(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 zy(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 _N(e,t,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=e.ordered?gN(r):pf(r);const l=e.ordered?o==="."?")":".":mN(r);let a=t&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&h&&(!h.children||!h.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),zy(r)===o&&h){let u=-1;for(;++u<e.children.length;){const f=e.children[u];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 vN(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 yN(e,t,r,n){const i=vN(r);let s=r.bulletCurrent||pf(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()),h);return a(),c;function h(u,f,p){return f?(p?"":" ".repeat(o))+u:(p?s:s+" ".repeat(o-s.length))+u}}function xN(e,t,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(e,n);return s(),i(),o}const wN=Ya(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function SN(e,t,r,n){return(e.children.some(function(o){return wN(o)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function bN(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Fy.peek=kN;function Fy(e,t,r,n){const i=bN(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),h=ya(n.before.charCodeAt(n.before.length-1),c,i);h.inside&&(a=Po(c)+a.slice(1));const u=a.charCodeAt(a.length-1),f=ya(n.after.charCodeAt(0),u,i);f.inside&&(a=a.slice(0,-1)+Po(u));const p=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:h.outside},l+a+p}function kN(e,t,r){return r.options.strong||"*"}function CN(e,t,r,n){return r.safe(e.value,n)}function EN(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 NN(e,t,r){const n=(zy(r)+(r.options.ruleSpaces?" ":"")).repeat(EN(r));return r.options.ruleSpaces?n.slice(0,-1):n}const $y={blockquote:G5,break:Zm,code:rN,definition:iN,emphasis:Dy,hardBreak:Zm,heading:aN,html:Iy,image:Ry,imageReference:My,inlineCode:Ay,link:By,linkReference:Oy,list:_N,listItem:yN,paragraph:xN,root:SN,strong:Fy,text:CN,thematicBreak:NN};function TN(){return{enter:{table:LN,tableData:Jm,tableHeader:Jm,tableRow:DN},exit:{codeText:IN,table:PN,tableData:Wc,tableHeader:Wc,tableRow:Wc}}}function LN(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 PN(e){this.exit(e),this.data.inTable=void 0}function DN(e){this.enter({type:"tableRow",children:[]},e)}function Wc(e){this.exit(e)}function Jm(e){this.enter({type:"tableCell",children:[]},e)}function IN(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,RN));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function RN(e,t){return t==="|"?t:e}function MN(e){const t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
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(h(p,g,S),p.align)}function l(p,m,g,S){const _=u(p,g,S),y=c([_]);return y.slice(0,y.indexOf(`
|
|
95
|
+
`))}function a(p,m,g,S){const _=g.enter("tableCell"),y=g.enter("phrasing"),x=g.containerPhrasing(p,{...S,before:s,after:s});return y(),_(),x}function c(p,m){return Y5(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function h(p,m,g){const S=p.children;let _=-1;const y=[],x=m.enter("table");for(;++_<S.length;)y[_]=u(S[_],m,g);return x(),y}function u(p,m,g){const S=p.children;let _=-1;const y=[],x=m.enter("tableRow");for(;++_<S.length;)y[_]=a(S[_],p,m,g);return x(),y}function f(p,m,g){let S=$y.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function AN(){return{exit:{taskListCheckValueChecked:eg,taskListCheckValueUnchecked:eg,paragraph:BN}}}function jN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ON}}}function eg(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function BN(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 ON(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=$y.listItem(e,t,r,{...n,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(h){return h+o}}function zN(){return[_5(),O5(),W5(),TN(),AN()]}function FN(e){return{extensions:[v5(),z5(e),H5(),MN(e),jN()]}}const $N={tokenize:qN,partial:!0},Wy={tokenize:YN,partial:!0},Hy={tokenize:XN,partial:!0},Uy={tokenize:GN,partial:!0},WN={tokenize:QN,partial:!0},Vy={name:"wwwAutolink",tokenize:VN,previous:qy},Ky={name:"protocolAutolink",tokenize:KN,previous:Yy},_n={name:"emailAutolink",tokenize:UN,previous:Xy},tn={};function HN(){return{text:tn}}let Zn=48;for(;Zn<123;)tn[Zn]=_n,Zn++,Zn===58?Zn=65:Zn===91&&(Zn=97);tn[43]=_n;tn[45]=_n;tn[46]=_n;tn[95]=_n;tn[72]=[_n,Ky];tn[104]=[_n,Ky];tn[87]=[_n,Vy];tn[119]=[_n,Vy];function UN(e,t,r){const n=this;let i,s;return o;function o(u){return!ph(u)||!Xy.call(n,n.previous)||mf(n.events)?r(u):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(u))}function l(u){return ph(u)?(e.consume(u),l):u===64?(e.consume(u),a):r(u)}function a(u){return u===46?e.check(WN,h,c)(u):u===45||u===95||jt(u)?(s=!0,e.consume(u),a):h(u)}function c(u){return e.consume(u),i=!0,a}function h(u){return s&&i&&$t(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(u)):r(u)}}function VN(e,t,r){const n=this;return i;function i(o){return o!==87&&o!==119||!qy.call(n,n.previous)||mf(n.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($N,e.attempt(Wy,e.attempt(Hy,s),r),r)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function KN(e,t,r){const n=this;let i="",s=!1;return o;function o(u){return(u===72||u===104)&&Yy.call(n,n.previous)&&!mf(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(u),e.consume(u),l):r(u)}function l(u){if($t(u)&&i.length<5)return i+=String.fromCodePoint(u),e.consume(u),l;if(u===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(u),a}return r(u)}function a(u){return u===47?(e.consume(u),s?c:(s=!0,a)):r(u)}function c(u){return u===null||ga(u)||Oe(u)||wi(u)||Va(u)?r(u):e.attempt(Wy,e.attempt(Hy,h),r)(u)}function h(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(u)}}function qN(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 YN(e,t,r){let n,i,s;return o;function o(c){return c===46||c===95?e.check(Uy,a,l)(c):c===null||Oe(c)||wi(c)||c!==45&&Va(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 XN(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(Uy,t,s)(o):o===null||Oe(o)||wi(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&n++,e.consume(o),i}}function GN(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||Oe(l)||wi(l)?t(l):r(l)}function i(l){return l===null||l===40||l===91||Oe(l)||wi(l)?t(l):n(l)}function s(l){return $t(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),n):$t(l)?(e.consume(l),o):r(l)}}function QN(e,t,r){return n;function n(s){return e.consume(s),i}function i(s){return jt(s)?r(s):t(s)}}function qy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Oe(e)}function Yy(e){return!$t(e)}function Xy(e){return!(e===47||ph(e))}function ph(e){return e===43||e===45||e===46||e===95||jt(e)}function mf(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 ZN={tokenize:o3,partial:!0};function JN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:n3,continuation:{tokenize:i3},exit:s3}},text:{91:{name:"gfmFootnoteCall",tokenize:r3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:e3,resolveTo:t3}}}}function e3(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=zr(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 t3(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 r3(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return l;function l(u){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),a}function a(u){return u!==94?r(u):(e.enter("gfmFootnoteCallMarker"),e.consume(u),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(u){if(s>999||u===93&&!o||u===null||u===91||Oe(u))return r(u);if(u===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(zr(n.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(u)}return Oe(u)||(o=!0),s++,e.consume(u),u===92?h:c}function h(u){return u===91||u===92||u===93?(e.consume(u),s++,c):c(u)}}function n3(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",h):r(m)}function h(m){if(o>999||m===93&&!l||m===null||m===91||Oe(m))return r(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=zr(n.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Oe(m)||(l=!0),o++,e.consume(m),m===92?u:h}function u(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),Me(e,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return t(m)}}function i3(e,t,r){return e.check(Ho,t,e.attempt(ZN,t,r))}function s3(e){e.exit("gfmFootnoteDefinition")}function o3(e,t,r){const n=this;return Me(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 l3(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 h={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[a][1].end)},u={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[a][1].start)},f=[["enter",h,l],["enter",o[c][1],l],["exit",o[c][1],l],["enter",u,l]],p=l.parser.constructs.insideSpan.null;p&&hr(f,f.length,0,Ka(p,o.slice(c+1,a),l)),hr(f,f.length,0,[["exit",u,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",h,l]]),hr(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,h=this.events;let u=0;return f;function f(m){return c===126&&h[h.length-1][1].type!=="characterEscape"?a(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const g=us(c);if(m===126)return u>1?a(m):(o.consume(m),u++,p);if(u<2&&!r)return a(m);const S=o.exit("strikethroughSequenceTemporary"),_=us(m);return S._open=!_||_===2&&!!g,S._close=!g||g===2&&!!_,l(m)}}}class a3{constructor(){this.map=[]}add(t,r,n){c3(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 c3(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 u3(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 h3(){return{flow:{null:{name:"table",tokenize:d3,resolveAll:f3}}}}function d3(e,t,r){const n=this;let i=0,s=0,o;return l;function l(E){let H=n.events.length-1;for(;H>-1;){const V=n.events[H][1].type;if(V==="lineEnding"||V==="linePrefix")H--;else break}const A=H>-1?n.events[H][1].type:null,M=A==="tableHead"||A==="tableRow"?C:a;return M===C&&n.parser.lazy[n.now().line]?r(E):M(E)}function a(E){return e.enter("tableHead"),e.enter("tableRow"),c(E)}function c(E){return E===124||(o=!0,s+=1),h(E)}function h(E){return E===null?r(E):we(E)?s>1?(s=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):r(E):De(E)?Me(e,h,"whitespace")(E):(s+=1,o&&(o=!1,i+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),u(E)))}function u(E){return E===null||E===124||Oe(E)?(e.exit("data"),h(E)):(e.consume(E),E===92?f:u)}function f(E){return E===92||E===124?(e.consume(E),u):u(E)}function p(E){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(E):(e.enter("tableDelimiterRow"),o=!1,De(E)?Me(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):T(E)}function g(E){return De(E)?Me(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||we(E)?N(E):T(E)}function _(E){return E===45?(e.enter("tableDelimiterFiller"),y(E)):T(E)}function y(E){return E===45?(e.consume(E),y):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(E))}function x(E){return De(E)?Me(e,N,"whitespace")(E):N(E)}function N(E){return E===124?m(E):E===null||we(E)?!o||i!==s?T(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):T(E)}function T(E){return r(E)}function C(E){return e.enter("tableRow"),R(E)}function R(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),R):E===null||we(E)?(e.exit("tableRow"),t(E)):De(E)?Me(e,R,"whitespace")(E):(e.enter("data"),O(E))}function O(E){return E===null||E===124||Oe(E)?(e.exit("data"),R(E)):(e.consume(E),E===92?z:O)}function z(E){return E===92||E===124?(e.consume(E),O):O(E)}}function f3(e,t){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,a=0,c,h,u;const f=new a3;for(;++r<e.length;){const p=e[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(l=!1,a!==0&&(tg(f,t,a,c,h),h=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,u=void 0,s=[0,0,0,0],o=[0,r+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(r,0,[["enter",h,t]])),i=m.type==="tableDelimiterRow"?2:h?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],u=ml(f,t,s,i,void 0,u),s=[0,0,0,0]),o[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],u=ml(f,t,s,i,void 0,u)),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],u=ml(f,t,s,i,r,u)):o[1]!==0&&(u=ml(f,t,o,i,r,u)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(a!==0&&tg(f,t,a,c,h),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=u3(t.events,r))}return e}function ml(e,t,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(s.end=Object.assign({},Ai(t.events,r[0])),e.add(r[0],0,[["exit",s,t]]));const a=Ai(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=Ai(t.events,r[2]),h=Ai(t.events,r[3]),u={type:l,start:Object.assign({},c),end:Object.assign({},h)};if(e.add(r[2],0,[["enter",u,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",u,t]])}return i!==void 0&&(s.end=Object.assign({},Ai(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function tg(e,t,r,n,i){const s=[],o=Ai(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 Ai(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const p3={name:"tasklistCheck",tokenize:g3};function m3(){return{text:{91:p3}}}function g3(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 Oe(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 we(a)?t(a):De(a)?e.check({tokenize:_3},t,r)(a):r(a)}}function _3(e,t,r){return Me(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function v3(e){return iy([HN(),JN(),l3(e),h3(),m3()])}const y3={};function rg(e){const t=this,r=e||y3,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(v3(r)),s.push(zN()),o.push(FN(r))}const x3=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,w3=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,S3=({legacyTitle:e=!1,tagName:t="div"}={})=>r=>{Ga(r,"blockquote",(n,i,s)=>{let o="",l="",a=!0,c=n.children.map(h=>{if(a&&h.type==="paragraph"){const u=h.children[0],f=u.type==="text"?u.value:"",p=e?w3:x3,m=f.match(p);if(m&&(a=!1,o=m[1].toLocaleLowerCase(),l=e&&m[2]||o.toLocaleUpperCase(),f.includes(`
|
|
96
|
+
`)&&(h.children[0]={type:"text",value:f.replace(p,"").replace(/^\n+/,"")}),!f.includes(`
|
|
97
|
+
`))){const g=[];h.children.forEach((S,_)=>{_!=0&&(_==1&&S.type==="break"||g.push(S))}),h.children=[...g]}}return h});o&&(n.data={hName:t,hProperties:{className:["markdown-alert",`markdown-alert-${o}`],dir:"auto"}},c.unshift({type:"paragraph",children:[b3(o),{type:"text",value:l.replace(/^\//,"")}],data:{hProperties:{className:"markdown-alert-title",dir:"auto"}}})),n.children=[...c]})};function b3(e){let t=k3[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 k3={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 C3(e){Ey(e,[/\r?\n|\r/g,E3])}function E3(){return{type:"break"}}function N3(){return function(e){C3(e)}}const Ye={size:18};function T3({size:e=Ye.size,className:t}){return d.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:[d.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}function L3({size:e=Ye.size,className:t}){return d.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:[d.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2"}),d.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2"}),d.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),d.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor",stroke:"none"}),d.jsx("line",{x1:"10",y1:"6",x2:"18",y2:"6"}),d.jsx("line",{x1:"10",y1:"18",x2:"18",y2:"18"})]})}function P3({size:e=Ye.size,className:t}){return d.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:[d.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"}),d.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}),d.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),d.jsx("line",{x1:"8",y1:"14",x2:"14",y2:"14"}),d.jsx("line",{x1:"8",y1:"18",x2:"12",y2:"18"})]})}function D3({size:e=Ye.size,className:t}){return d.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:[d.jsx("circle",{cx:"12",cy:"12",r:"3"}),d.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 I3({size:e=Ye.size,className:t}){return d.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:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),d.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}function gf({size:e=Ye.size,className:t}){return d.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:d.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 lo({size:e=Ye.size,className:t}){return d.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:[d.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),d.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),d.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function R3({size:e=Ye.size,className:t}){return d.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:[d.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),d.jsx("polyline",{points:"14 2 14 8 20 8"}),d.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),d.jsx("line",{x1:"8",y1:"17",x2:"13",y2:"17"})]})}function M3({size:e=Ye.size,className:t}){return d.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:[d.jsx("circle",{cx:"11",cy:"11",r:"8"}),d.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function rs({size:e=Ye.size,className:t}){return d.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:d.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 A3({size:e=Ye.size,className:t}){return d.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:[d.jsx("polyline",{points:"23 4 23 10 17 10"}),d.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})}function Gy({size:e=Ye.size,className:t}){return d.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:[d.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"}),d.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),d.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function Qy({size:e=Ye.size,className:t}){return d.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:[d.jsx("path",{d:"M12 22v-5"}),d.jsx("path",{d:"M9 8V2"}),d.jsx("path",{d:"M15 8V2"}),d.jsx("path",{d:"M18 8v5a6 6 0 0 1-12 0V8z"})]})}function j3({size:e=Ye.size,className:t}){return d.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:[d.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),d.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function ng({size:e=Ye.size,className:t}){return d.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:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function B3({size:e=Ye.size,className:t}){return d.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:[d.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),d.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),d.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})}function O3({size:e=Ye.size,className:t}){return d.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:[d.jsx("polyline",{points:"4 17 10 11 4 5"}),d.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function z3({size:e=Ye.size,className:t}){return d.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:[d.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"}),d.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"}),d.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),d.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]})}function F3({size:e=Ye.size,className:t}){return d.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:[d.jsx("rect",{x:"3",y:"8",width:"18",height:"12",rx:"2"}),d.jsx("path",{d:"M12 2v6"}),d.jsx("circle",{cx:"8.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"}),d.jsx("circle",{cx:"15.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"})]})}function $3({size:e=Ye.size,className:t}){return d.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:d.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 W3({size:e=Ye.size,className:t}){return d.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:[d.jsx("rect",{x:"9",y:"10",width:"6",height:"12",rx:"1"}),d.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 H3({size:e=Ye.size,className:t}){return d.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:[d.jsx("circle",{cx:"12",cy:"12",r:"5"}),d.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),d.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),d.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),d.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),d.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),d.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),d.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),d.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})}function U3({size:e=Ye.size,className:t}){return d.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:d.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function V3({size:e=Ye.size,className:t}){return d.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:[d.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),d.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),d.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function K3(e){const r=e.split(`
|
|
98
|
+
`).map(l=>{if(!l.includes("\r"))return l;const a=l.split("\r").map(u=>u.trim()).filter(Boolean);if(a.length===0)return"";const c=a.filter(u=>u.startsWith("โบ"));if(c.length>0)return c[c.length-1];const h=a.filter(u=>!(/^[โฏโบ>]\s*$/.test(u)||/^[^a-zA-Z0-9\s]\s*\S+[โฆ\.]{1,3}\s*$/.test(u)&&u.length<40||/^[โญโฐโโโฎโฏโโ]+$/.test(u)));return h.length>0?h[h.length-1]:a[a.length-1]}).join(`
|
|
99
|
+
`).split(`
|
|
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 h=l.match(/^[โบโยท]\s*([A-Za-z][A-Za-z0-9_]*)\s*[\(\[]/);if(h)n[h[1]]=(n[h[1]]||0)+1;else{const u=l.replace(/^[โบโยทโต]\s*/,"").trim().slice(0,40);u&&(n[u]=(n[u]||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
|
+
`).replace(/\n{3,}/g,`
|
|
102
|
+
|
|
103
|
+
`).trim();return{toolCounts:n,textContent:o,hasTools:Object.keys(n).length>0}}function Hc(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const Zy=w.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",isCliMode:i=!1,isWorking:s=!1,contextKey:o="",receivedAtMap:l={},emptyState:a,onLoadMore:c,isLoadingMore:h,hasMoreHistory:u},f){var V;const p=w.useRef(null),m=w.useRef(null),g=w.useRef(0),S=w.useRef(""),_=w.useRef(!1),[y,x]=w.useState(new Set),[N,T]=w.useState(new Set),C=w.useRef(!1),R=()=>{const L=p.current;return L?L.scrollHeight-L.scrollTop-L.clientHeight<200:!0},O=t.length>0?`${t.length}:${(((V=t[t.length-1])==null?void 0:V.content)||"").length}`:"0:0";w.useEffect(()=>{var P,$;const L=!_.current,j=S.current!==o;if(S.current=o,L||j){_.current=!0,C.current=!1;const b=()=>{var ne;(ne=m.current)==null||ne.scrollIntoView({behavior:"instant"})};requestAnimationFrame(()=>requestAnimationFrame(b)),setTimeout(b,100),setTimeout(b,300),g.current=t.length;return}t.length>g.current?C.current||(P=m.current)==null||P.scrollIntoView({behavior:"instant"}):R()&&!C.current&&(($=m.current)==null||$.scrollIntoView({behavior:"instant"})),g.current=t.length},[O,o,s]),w.useImperativeHandle(f,()=>({scrollToBottom:(L="smooth")=>{var j;(j=m.current)==null||j.scrollIntoView({behavior:L})}})),w.useEffect(()=>{const L=p.current;if(!L)return;let j;const q=()=>{clearTimeout(j),j=setTimeout(()=>{C.current=!R()},50)};return L.addEventListener("scroll",q,{passive:!0}),()=>{L.removeEventListener("scroll",q),clearTimeout(j)}},[]);const z=w.useRef(!1),E=w.useRef(0),H=w.useRef(!1);w.useEffect(()=>{const L=p.current;if(!L||!H.current||E.current===0)return;const q=L.scrollHeight-E.current;q>0&&(L.scrollTop=q),E.current=0,H.current=!1},[t.length]),w.useEffect(()=>{const L=p.current;if(!L||!c)return;const j=()=>{L.scrollTop<60&&u&&!h&&!z.current&&(z.current=!0,E.current=L.scrollHeight,c(),setTimeout(()=>{z.current=!1},1500))};return L.addEventListener("scroll",j,{passive:!0}),()=>L.removeEventListener("scroll",j)},[c,u,h]);const A=(()=>{const L=t.map(($,b)=>({type:"message",data:$,index:b,ts:$.receivedAt||l[$.id??`i-${b}`]||0}));if(!r||r.length===0)return L;const j=[...r].sort(($,b)=>$.timestamp-b.timestamp).map(($,b)=>({type:"action",data:$,index:b,ts:$.timestamp})),q=[];let P=0;for(const $ of L){for(;P<j.length&&$.ts>0&&j[P].ts<$.ts;)q.push(j[P++]);q.push($)}for(;P<j.length;)q.push(j[P++]);return q})(),M=700;return d.jsxs("div",{ref:p,"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&&d.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60",children:"โณ Loading older messages..."}),u&&!h&&d.jsx("div",{className:"text-center py-2",children:d.jsx("button",{onClick:c,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"})}),A.length===0&&!u&&(a||d.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),A.map(L=>{var me;if(L.type==="action"){const ye=L.data;return d.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:[d.jsx(Ym,{remarkPlugins:[rg],children:ye.text}),d.jsx("span",{className:"text-[10px] opacity-50 ml-2",children:Hc(ye.timestamp)})]},`action-${L.index}`)}const j=L.data,q=L.index,P=(j.role||"").toLowerCase(),$=P==="user"||P==="human",b=j.kind||(P==="tool"?"tool":"standard"),ne=j.receivedAt||l[j.id??`i-${q}`],ce=`${o}-${q}`,k=y.has(ce),_e=N.has(ce);if(b==="thought"){const ye=((me=j.meta)==null?void 0:me.label)||"Thought";return d.jsxs("div",{className:"self-start max-w-[88%] rounded-lg flex-shrink-0 bg-bg-secondary border border-border-subtle",children:[d.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-border-subtle",children:[d.jsx("span",{className:"text-[11px] text-indigo-400",children:d.jsx($3,{size:13})}),d.jsx("span",{className:"text-[11px] text-indigo-400 font-medium",children:ye})]}),d.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:j.content||""})]},`msg-${q}`)}if(b==="tool")return d.jsxs("div",{className:"self-start 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:[d.jsx("span",{className:"text-emerald-500 text-[10px]",children:"โบ"}),d.jsx("span",{className:"text-emerald-500 opacity-80",children:(j.content||"").split(`
|
|
104
|
+
`)[0].slice(0,80)})]},`msg-${q}`);if(b==="terminal"){const ye=j.meta||{},xe=ye.isRunning?"โณ":"โ
",Ce=ye.label||"Ran command";return d.jsxs("div",{className:"self-start max-w-[88%] rounded-lg flex-shrink-0 bg-bg-secondary border border-border-subtle",children:[d.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-border-subtle",children:[d.jsx("span",{className:"text-[11px]",children:xe}),d.jsx("span",{className:"text-[11px] text-emerald-500 font-medium",children:Ce})]}),d.jsx("pre",{className:"px-3 py-2 text-[11px] text-text-muted font-mono leading-relaxed m-0",style:{maxHeight:250,overflowY:"auto",overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"transparent"},children:j.content||""})]},`msg-${q}`)}if(b==="system")return d.jsx("div",{className:"self-center text-[11px] text-text-muted opacity-60 px-3 py-0.5 rounded-[20px] border border-border-subtle",children:(j.content||"").slice(0,100)},`msg-${q}`);const X=!$&&i?K3(j.content||""):null,te=X?X.textContent:j.content||"",Y=X?Object.entries(X.toolCounts):[],le=i&&!$&&!k&&te.length>M,fe=k?j.content||"":le&&!_e?te.slice(0,M):te;return d.jsxs("div",{className:`max-w-[88%] flex flex-col gap-1 ${$?"self-end":"self-start"}`,children:[Y.length>0&&d.jsxs("div",{className:"flex flex-wrap gap-1 items-center mb-0.5",children:[Y.map(([ye,xe])=>d.jsxs("span",{className:"text-[10px] font-mono text-emerald-500 bg-bg-secondary border border-border-subtle rounded px-[7px] py-0.5",children:["โบ ",ye,xe>1?` ร${xe}`:""]},ye)),(X==null?void 0:X.hasTools)&&d.jsx("button",{onClick:()=>x(ye=>{const xe=new Set(ye);return k?xe.delete(ce):xe.add(ce),xe}),className:"text-[10px] text-text-muted bg-transparent border-none cursor-pointer px-1 py-px opacity-50",children:k?"Collapse":"Original"}),!te&&ne!=null&&d.jsx("span",{className:"text-[10px] opacity-35 ml-0.5",children:Hc(ne)})]}),(te||$)&&d.jsxs("div",{className:$?"chat-bubble-user":"",style:{background:$?"linear-gradient(135deg, var(--accent-primary), #4f46e5)":"var(--bg-secondary)",color:$?"#fff":"var(--text-primary)",padding:"12px 16px",borderRadius:$?"16px 16px 4px 16px":"16px 16px 16px 4px",fontSize:13,lineHeight:1.65,border:$?"none":"1px solid var(--border-subtle)"},children:[d.jsxs("div",{className:`flex justify-between items-baseline gap-2 ${te?"mb-1.5":"mb-0"}`,children:[d.jsx("span",{className:"text-[10px] font-bold opacity-60 tracking-wide uppercase",children:$?"You":n}),ne!=null&&d.jsx("span",{className:"text-[10px] opacity-45",children:Hc(ne)})]}),te&&d.jsx("div",{className:"chat-markdown",children:d.jsx(Ym,{remarkPlugins:[rg,S3,N3],children:fe})}),le&&d.jsx("button",{onClick:()=>T(ye=>{const xe=new Set(ye);return _e?xe.delete(ce):xe.add(ce),xe}),className:"mt-1.5 text-[11px] font-semibold text-[var(--accent-primary)] bg-transparent border-none cursor-pointer p-0 opacity-80",children:_e?"Collapse โ":`Show more (${Math.round(te.length/100)*100} chars) โ`})]})]},`msg-${q}`)}),s&&d.jsx("div",{className:"self-start max-w-[90%] bg-bg-secondary rounded-[16px_16px_16px_4px] border border-border-subtle",children:d.jsxs("div",{className:"typing-indicator",children:[d.jsx("div",{className:"dot"}),d.jsx("div",{className:"dot"}),d.jsx("div",{className:"dot"}),d.jsx("span",{className:"text-[11px] text-text-muted ml-1",children:"Agent working..."})]})}),d.jsx("div",{className:"min-h-10",ref:m})]})}),Rs={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"}},Uc={cline:"#22d3ee","roo-code":"#a78bfa",continue:"#34d399",copilot:"#60a5fa"};function q3({agentStreams:e,sendCommand:t}){var f,p,m;const[r,n]=w.useState(null),[i,s]=w.useState(""),[o,l]=w.useState(!1);w.useEffect(()=>{!r&&e.length>0&&n(e[0].agentType)},[e,r]);const a=e.find(g=>g.agentType===r),c=w.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]),h=w.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]),u=w.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:d.jsxs("div",{className:"flex flex-col h-full bg-[#0c0e14] rounded-xl overflow-hidden border border-border-subtle",children:[d.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,_=Uc[g.agentType]||"#94a3b8",y=Rs[g.status]||Rs.idle;return d.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:[d.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:y.dot,boxShadow:g.status==="streaming"?`0 0 6px ${y.dot}`:"none",animation:g.status==="streaming"?"pulse 1.5s infinite":"none"}}),g.agentName,g.status==="waiting_approval"&&d.jsx("span",{className:"text-[10px] px-1.5 py-px rounded bg-yellow-500/20 text-yellow-300 font-semibold",children:"APPROVE"})]},g.agentType)}),d.jsx("div",{className:"flex-1"}),d.jsx("button",{onClick:u,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?d.jsxs(d.Fragment,{children:[d.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:[d.jsx("span",{className:"px-2 py-0.5 rounded font-semibold text-[10px] tracking-wide uppercase",style:{background:(f=Rs[a.status])==null?void 0:f.bg,color:(p=Rs[a.status])==null?void 0:p.text},children:((m=Rs[a.status])==null?void 0:m.label)||a.status}),a.model&&d.jsxs("span",{className:"text-text-muted",children:["Model: ",d.jsx("span",{className:"text-text-secondary",children:a.model})]}),d.jsx("span",{className:"text-text-muted",children:"|"}),d.jsxs("span",{children:[a.messages.length," messages"]})]}),a.activeModal&&d.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:[d.jsx("span",{className:"text-base",children:"โ ๏ธ"}),d.jsx("span",{className:"flex-1 text-[13px] text-yellow-300 leading-snug",children:a.activeModal.message||"Action requires approval"}),d.jsx("button",{onClick:()=>h("approve"),className:"px-3.5 py-1 border-none rounded-md bg-green-500 text-white text-xs font-semibold cursor-pointer",children:"Approve"}),d.jsx("button",{onClick:()=>h("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"})]}),d.jsx(Zy,{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:d.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,"."]})}),d.jsxs("div",{className:"px-3.5 py-2.5 border-t border-border-subtle flex gap-2",children:[d.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"}),d.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, ${Uc[a.agentType]||"#3b82f6"}, ${Uc[a.agentType]||"#3b82f6"}cc)`:"rgba(255,255,255,0.04)",color:i.trim()?"#fff":"#475569",cursor:i.trim()?"pointer":"default"},children:o?"โฆ":"Send"})]})]}):d.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."}),d.jsx("style",{children:`
|
|
105
|
+
@keyframes pulse {
|
|
106
|
+
0%, 100% { opacity: 1; }
|
|
107
|
+
50% { opacity: 0.4; }
|
|
108
|
+
}
|
|
109
|
+
`})]})}/**
|
|
110
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
111
|
+
* @license MIT
|
|
112
|
+
*
|
|
113
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
114
|
+
* @license MIT
|
|
115
|
+
*
|
|
116
|
+
* Originally forked from (with the author's permission):
|
|
117
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
118
|
+
* http://bellard.org/jslinux/
|
|
119
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
120
|
+
*/var Jy=Object.defineProperty,Y3=Object.getOwnPropertyDescriptor,X3=(e,t)=>{for(var r in t)Jy(e,r,{get:t[r],enumerable:!0})},nt=(e,t,r,n)=>{for(var i=n>1?void 0:n?Y3(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&&Jy(t,r,i),i},ue=(e,t)=>(r,n)=>t(r,n,e),ig="Terminal input",mh={get:()=>ig,set:e=>ig=e},sg="Too much output to announce, navigate to rows manually to read",gh={get:()=>sg,set:e=>sg=e};function G3(e){return e.replace(/\r?\n/g,"\r")}function Q3(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Z3(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function J3(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");ex(i,t,r,n)}}function ex(e,t,r,n){e=G3(e),e=Q3(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function tx(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 og(e,t,r,n,i){tx(e,t,r),i&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function Tn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Qa(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 eT=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}},tT=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 h=r-4,u=c;for(;u<r;){for(;u<h&&!((i=e[u])&128)&&!((s=e[u+1])&128)&&!((o=e[u+2])&128)&&!((l=e[u+3])&128);)t[n++]=i,t[n++]=s,t[n++]=o,t[n++]=l,u+=4;if(i=e[u++],i<128)t[n++]=i;else if((i&224)===192){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(a=(i&31)<<6|s&63,a<128){u--;continue}t[n++]=a}else if((i&240)===224){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[u++],(o&192)!==128){u--;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(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[u++],(o&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,n;if(l=e[u++],(l&192)!==128){u--;continue}if(a=(i&7)<<18|(s&63)<<12|(o&63)<<6|l&63,a<65536||a>1114111)continue;t[n++]=a}}return n}},rx="",Mn=" ",Vo=class nx{constructor(){this.fg=0,this.bg=0,this.extended=new xa}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 nx;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}},xa=class ix{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 ix(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Nr=class sx extends Vo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new xa,this.combinedData=""}static fromCharData(t){let r=new sx;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?Tn(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()]}},lg="di$target",_h="di$dependencies",Vc=new Map;function rT(e){return e[_h]||[]}function bt(e){if(Vc.has(e))return Vc.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");nT(t,r,i)};return t._id=e,Vc.set(e,t),t}function nT(e,t,r){t[lg]===t?t[_h].push({id:e,index:r}):(t[_h]=[{id:e,index:r}],t[lg]=t)}var Vt=bt("BufferService"),ox=bt("CoreMouseService"),Ti=bt("CoreService"),iT=bt("CharsetService"),_f=bt("InstantiationService"),lx=bt("LogService"),Kt=bt("OptionsService"),ax=bt("OscLinkService"),sT=bt("UnicodeService"),Ko=bt("DecorationService"),vh=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var h;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,s=new Nr,o=r.getTrimmedLength(),l=-1,a=-1,c=!1;for(let u=0;u<o;u++)if(!(a===-1&&!r.hasContent(u))){if(r.loadCell(u,s),s.hasExtendedAttrs()&&s.extended.urlId)if(a===-1){a=u,l=s.extended.urlId;continue}else c=s.extended.urlId!==l;else a!==-1&&(c=!0);if(c||a!==-1&&u===o-1){let f=(h=this._oscLinkService.getLinkData(l))==null?void 0:h.uri;if(f){let p={start:{x:a+1,y:e},end:{x:u+(!c&&u===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):oT(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=u,l=s.extended.urlId):(a=-1,l=-1)}}t(n)}};vh=nt([ue(0,Vt),ue(1,Kt),ue(2,ax)],vh);function oT(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
121
|
+
|
|
122
|
+
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 Za=bt("CharSizeService"),vn=bt("CoreBrowserService"),vf=bt("MouseService"),yn=bt("RenderService"),lT=bt("SelectionService"),cx=bt("CharacterJoinerService"),ys=bt("ThemeService"),ux=bt("LinkProviderService"),aT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ag.isErrorNoTelemetry(e)?new ag(e.message+`
|
|
123
|
+
|
|
124
|
+
`+e.stack):new Error(e.message+`
|
|
125
|
+
|
|
126
|
+
`+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)}},cT=new aT;function Bl(e){uT(e)||cT.onUnexpectedError(e)}var yh="Canceled";function uT(e){return e instanceof hT?!0:e instanceof Error&&e.name===yh&&e.message===yh}var hT=class extends Error{constructor(){super(yh),this.name=this.message}};function dT(e){return new Error(`Illegal argument: ${e}`)}var ag=class xh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof xh)return t;let r=new xh;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},wh=class hx extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,hx.prototype)}};function ir(e,t=0){return e[e.length-(1+t)]}var fT;(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})(fT||(fT={}));function pT(e,t){let r=this,n=!1,i;return function(){return n||(n=!0,t||(i=e.apply(r,arguments))),i}}var dx;(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 T=N.length-1;T>=0;T--)yield N[T]}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 h(N,T){let C=0;for(let R of N)if(T(R,C++))return!0;return!1}e.some=h;function u(N,T){for(let C of N)if(T(C))return C}e.find=u;function*f(N,T){for(let C of N)T(C)&&(yield C)}e.filter=f;function*p(N,T){let C=0;for(let R of N)yield T(R,C++)}e.map=p;function*m(N,T){let C=0;for(let R of N)yield*T(R,C++)}e.flatMap=m;function*g(...N){for(let T of N)yield*T}e.concat=g;function S(N,T,C){let R=C;for(let O of N)R=T(R,O);return R}e.reduce=S;function*_(N,T,C=N.length){for(T<0&&(T+=N.length),C<0?C+=N.length:C>N.length&&(C=N.length);T<C;T++)yield N[T]}e.slice=_;function y(N,T=Number.POSITIVE_INFINITY){let C=[];if(T===0)return[C,N];let R=N[Symbol.iterator]();for(let O=0;O<T;O++){let z=R.next();if(z.done)return[C,e.empty()];C.push(z.value)}return[C,{[Symbol.iterator](){return R}}]}e.consume=y;async function x(N){let T=[];for await(let C of N)T.push(C);return Promise.resolve(T)}e.asyncToArray=x})(dx||(dx={}));function Si(e){if(dx.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 mT(...e){return qe(()=>Si(e))}function qe(e){return{dispose:pT(()=>{e()})}}var fx=class px{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{Si(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?px.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)}};fx.DISABLE_DISPOSED_WARNING=!1;var Hn=fx,Le=class{constructor(){this._store=new Hn,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)}};Le.None=Object.freeze({dispose(){}});var hs=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}},un=typeof window=="object"?window:globalThis,Sh=class bh{constructor(t){this.element=t,this.next=bh.Undefined,this.prev=bh.Undefined}};Sh.Undefined=new Sh(void 0);var Xe=Sh,cg=class{constructor(){this._first=Xe.Undefined,this._last=Xe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Xe.Undefined}clear(){let e=this._first;for(;e!==Xe.Undefined;){let t=e.next;e.prev=Xe.Undefined,e.next=Xe.Undefined,e=t}this._first=Xe.Undefined,this._last=Xe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Xe(e);if(this._first===Xe.Undefined)this._first=r,this._last=r;else if(t){let 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!==Xe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Xe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Xe.Undefined&&e.next!==Xe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Xe.Undefined&&e.next===Xe.Undefined?(this._first=Xe.Undefined,this._last=Xe.Undefined):e.next===Xe.Undefined?(this._last=this._last.prev,this._last.next=Xe.Undefined):e.prev===Xe.Undefined&&(this._first=this._first.next,this._first.prev=Xe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Xe.Undefined;)yield e.element,e=e.next}},gT=globalThis.performance&&typeof globalThis.performance.now=="function",_T=class mx{static create(t){return new mx(t)}constructor(t){this._now=gT&&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}},Tt;(e=>{e.None=()=>Le.None;function t(A,M){return u(A,()=>{},0,void 0,!0,void 0,M)}e.defer=t;function r(A){return(M,V=null,L)=>{let j=!1,q;return q=A(P=>{if(!j)return q?q.dispose():j=!0,M.call(V,P)},null,L),j&&q.dispose(),q}}e.once=r;function n(A,M,V){return c((L,j=null,q)=>A(P=>L.call(j,M(P)),null,q),V)}e.map=n;function i(A,M,V){return c((L,j=null,q)=>A(P=>{M(P),L.call(j,P)},null,q),V)}e.forEach=i;function s(A,M,V){return c((L,j=null,q)=>A(P=>M(P)&&L.call(j,P),null,q),V)}e.filter=s;function o(A){return A}e.signal=o;function l(...A){return(M,V=null,L)=>{let j=mT(...A.map(q=>q(P=>M.call(V,P))));return h(j,L)}}e.any=l;function a(A,M,V,L){let j=V;return n(A,q=>(j=M(j,q),j),L)}e.reduce=a;function c(A,M){let V,L={onWillAddFirstListener(){V=A(j.fire,j)},onDidRemoveLastListener(){V==null||V.dispose()}},j=new oe(L);return M==null||M.add(j),j.event}function h(A,M){return M instanceof Array?M.push(A):M&&M.add(A),A}function u(A,M,V=100,L=!1,j=!1,q,P){let $,b,ne,ce=0,k,_e={leakWarningThreshold:q,onWillAddFirstListener(){$=A(te=>{ce++,b=M(b,te),L&&!ne&&(X.fire(b),b=void 0),k=()=>{let Y=b;b=void 0,ne=void 0,(!L||ce>1)&&X.fire(Y),ce=0},typeof V=="number"?(clearTimeout(ne),ne=setTimeout(k,V)):ne===void 0&&(ne=0,queueMicrotask(k))})},onWillRemoveListener(){j&&ce>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,$.dispose()}},X=new oe(_e);return P==null||P.add(X),X.event}e.debounce=u;function f(A,M=0,V){return e.debounce(A,(L,j)=>L?(L.push(j),L):[j],M,void 0,!0,void 0,V)}e.accumulate=f;function p(A,M=(L,j)=>L===j,V){let L=!0,j;return s(A,q=>{let P=L||!M(q,j);return L=!1,j=q,P},V)}e.latch=p;function m(A,M,V){return[e.filter(A,M,V),e.filter(A,L=>!M(L),V)]}e.split=m;function g(A,M=!1,V=[],L){let j=V.slice(),q=A(b=>{j?j.push(b):$.fire(b)});L&&L.add(q);let P=()=>{j==null||j.forEach(b=>$.fire(b)),j=null},$=new oe({onWillAddFirstListener(){q||(q=A(b=>$.fire(b)),L&&L.add(q))},onDidAddFirstListener(){j&&(M?setTimeout(P):P())},onDidRemoveLastListener(){q&&q.dispose(),q=null}});return L&&L.add($),$.event}e.buffer=g;function S(A,M){return(V,L,j)=>{let q=M(new y);return A(function(P){let $=q.evaluate(P);$!==_&&V.call(L,$)},void 0,j)}}e.chain=S;let _=Symbol("HaltChainable");class y{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(V=>(M(V),V)),this}filter(M){return this.steps.push(V=>M(V)?V:_),this}reduce(M,V){let L=V;return this.steps.push(j=>(L=M(L,j),L)),this}latch(M=(V,L)=>V===L){let V=!0,L;return this.steps.push(j=>{let q=V||!M(j,L);return V=!1,L=j,q?j:_}),this}evaluate(M){for(let V of this.steps)if(M=V(M),M===_)break;return M}}function x(A,M,V=L=>L){let L=(...$)=>P.fire(V(...$)),j=()=>A.on(M,L),q=()=>A.removeListener(M,L),P=new oe({onWillAddFirstListener:j,onDidRemoveLastListener:q});return P.event}e.fromNodeEventEmitter=x;function N(A,M,V=L=>L){let L=(...$)=>P.fire(V(...$)),j=()=>A.addEventListener(M,L),q=()=>A.removeEventListener(M,L),P=new oe({onWillAddFirstListener:j,onDidRemoveLastListener:q});return P.event}e.fromDOMEventEmitter=N;function T(A){return new Promise(M=>r(A)(M))}e.toPromise=T;function C(A){let M=new oe;return A.then(V=>{M.fire(V)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=C;function R(A,M){return A(V=>M.fire(V))}e.forward=R;function O(A,M,V){return M(V),A(L=>M(L))}e.runAndSubscribe=O;class z{constructor(M,V){this._observable=M,this._counter=0,this._hasChanged=!1;let L={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};this.emitter=new oe(L),V&&V.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,V){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(A,M){return new z(A,M).emitter.event}e.fromObservable=E;function H(A){return(M,V,L)=>{let j=0,q=!1,P={beginUpdate(){j++},endUpdate(){j--,j===0&&(A.reportChanges(),q&&(q=!1,M.call(V)))},handlePossibleChange(){},handleChange(){q=!0}};A.addObserver(P),A.reportChanges();let $={dispose(){A.removeObserver(P)}};return L instanceof Hn?L.add($):Array.isArray(L)&&L.push($),$}}e.fromObservableLight=H})(Tt||(Tt={}));var kh=class Ch{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ch._idPool++}`,Ch.all.add(this)}start(t){this._stopWatch=new _T,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}}};kh.all=new Set,kh._idPool=0;var vT=kh,yT=-1,gx=class _x{constructor(t,r,n=(_x._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let n=this.threshold;if(n<=0||r<n)return;this._stacks||(this._stacks=new Map);let 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 ST(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}};gx._idPool=1;var xT=gx,wT=class vx{constructor(t){this.value=t}static create(){let t=new Error;return new vx(t.stack??"")}print(){console.warn(this.value.split(`
|
|
127
|
+
`).slice(2).join(`
|
|
128
|
+
`))}},ST=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},bT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},kT=0,Kc=class{constructor(e){this.value=e,this.id=kT++}},CT=2,ET,oe=class{constructor(t){var r,n,i,s;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new xT((t==null?void 0:t.onListenerError)??Bl,((n=this._options)==null?void 0:n.leakWarningThreshold)??yT):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new vT(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,h,u;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 bT(`${f}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Bl)(m),Le.None}if(this._disposed)return Le.None;r&&(t=t.bind(r));let i=new Kc(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=wT.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Kc?(this._deliveryQueue??(this._deliveryQueue=new NT),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,(u=(h=this._options)==null?void 0:h.onDidAddFirstListener)==null||u.call(h,this)),this._size++;let o=qe(()=>{s==null||s(),this._removeListener(i)});return n instanceof Hn?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*CT<=r.length){let c=0;for(let h=0;h<r.length;h++)r[h]?r[c++]=r[h]: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)||Bl;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 Kc)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}},NT=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}},Eh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new oe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new oe,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}};Eh.INSTANCE=new Eh;var yf=Eh;function TT(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}yf.INSTANCE.onDidChangeZoomLevel;function LT(e){return yf.INSTANCE.getZoomFactor(e)}yf.INSTANCE.onDidChangeFullscreen;var xs=typeof navigator=="object"?navigator.userAgent:"",Nh=xs.indexOf("Firefox")>=0,PT=xs.indexOf("AppleWebKit")>=0,xf=xs.indexOf("Chrome")>=0,DT=!xf&&xs.indexOf("Safari")>=0;xs.indexOf("Electron/")>=0;xs.indexOf("Android")>=0;var qc=!1;if(typeof un.matchMedia=="function"){let e=un.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=un.matchMedia("(display-mode: fullscreen)");qc=e.matches,TT(un,e,({matches:r})=>{qc&&t.matches||(qc=r)})}var Yi="en",Th=!1,Lh=!1,Ol=!1,yx=!1,gl,zl=Yi,ug=Yi,IT,Ir,mi=globalThis,Nt,h_;typeof mi.vscode<"u"&&typeof mi.vscode.process<"u"?Nt=mi.vscode.process:typeof process<"u"&&typeof((h_=process==null?void 0:process.versions)==null?void 0:h_.node)=="string"&&(Nt=process);var d_,RT=typeof((d_=Nt==null?void 0:Nt.versions)==null?void 0:d_.electron)=="string",MT=RT&&(Nt==null?void 0:Nt.type)==="renderer",f_;if(typeof Nt=="object"){Th=Nt.platform==="win32",Lh=Nt.platform==="darwin",Ol=Nt.platform==="linux",Ol&&Nt.env.SNAP&&Nt.env.SNAP_REVISION,Nt.env.CI||Nt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,gl=Yi,zl=Yi;let e=Nt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);gl=t.userLocale,ug=t.osLocale,zl=t.resolvedLanguage||Yi,IT=(f_=t.languagePack)==null?void 0:f_.translationsConfigFile}catch{}yx=!0}else typeof navigator=="object"&&!MT?(Ir=navigator.userAgent,Th=Ir.indexOf("Windows")>=0,Lh=Ir.indexOf("Macintosh")>=0,(Ir.indexOf("Macintosh")>=0||Ir.indexOf("iPad")>=0||Ir.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ol=Ir.indexOf("Linux")>=0,(Ir==null?void 0:Ir.indexOf("Mobi"))>=0,zl=globalThis._VSCODE_NLS_LANGUAGE||Yi,gl=navigator.language.toLowerCase(),ug=gl):console.error("Unable to resolve platform.");var xx=Th,Jr=Lh,AT=Ol,hg=yx,en=Ir,Sn=zl,jT;(e=>{function t(){return Sn}e.value=t;function r(){return Sn.length===2?Sn==="en":Sn.length>=3?Sn[0]==="e"&&Sn[1]==="n"&&Sn[2]==="-":!1}e.isDefaultVariant=r;function n(){return Sn==="en"}e.isDefault=n})(jT||(jT={}));var BT=typeof mi.postMessage=="function"&&!mi.importScripts;(()=>{if(BT){let e=[];mi.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}),mi.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var OT=!!(en&&en.indexOf("Chrome")>=0);en&&en.indexOf("Firefox")>=0;!OT&&en&&en.indexOf("Safari")>=0;en&&en.indexOf("Edg/")>=0;en&&en.indexOf("Android")>=0;var Ri=typeof navigator=="object"?navigator:{};hg||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ri&&Ri.clipboard&&Ri.clipboard.writeText,hg||Ri&&Ri.clipboard&&Ri.clipboard.readText;var wf=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}},Yc=new wf,dg=new wf,fg=new wf,zT=new Array(230),wx;(e=>{function t(l){return Yc.keyCodeToStr(l)}e.toString=t;function r(l){return Yc.strToKeyCode(l)}e.fromString=r;function n(l){return dg.keyCodeToStr(l)}e.toUserSettingsUS=n;function i(l){return fg.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return dg.strToKeyCode(l)||fg.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 Yc.keyCodeToStr(l)}e.toElectronAccelerator=o})(wx||(wx={}));var FT=class Sx{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 Sx&&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 $T([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},$T=class{constructor(e){if(e.length===0)throw dT("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 WT(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return wx.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Nh)switch(t){case 59:return 85;case 60:if(AT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Jr)return 57;break}else if(PT&&(Jr&&t===93||!Jr&&t===92))return 57;return zT[t]||0}var HT=Jr?256:2048,UT=512,VT=1024,KT=Jr?2048:256,pg=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=WT(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|=HT),this.altKey&&(t|=UT),this.shiftKey&&(t|=VT),this.metaKey&&(t|=KT),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new FT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},mg=new WeakMap;function qT(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 YT=class{static getSameOriginWindowChain(e){let t=mg.get(e);if(!t){t=[],mg.set(e,t);let r=e,n;do n=qT(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}}},_l=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=YT.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},gg=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(xf){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?Nh&&!Jr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")DT&&xx?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?Nh&&!Jr?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()}},bx=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),XT;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof GT?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Tt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:bx})})(XT||(XT={}));var GT=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?bx:(this._emitter||(this._emitter=new oe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Sf=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 wh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new wh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},QT=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 wh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=qe(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},ZT;(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})(ZT||(ZT={}));var _g=class xr{static fromArray(t){return new xr(r=>{r.emitMany(t)})}static fromPromise(t){return new xr(async r=>{r.emitMany(await t)})}static fromPromises(t){return new xr(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new xr(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 oe,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 Tt.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 xr(async n=>{for await(let i of t)n.emitOne(r(i))})}map(t){return xr.map(this,t)}static filter(t,r){return new xr(async n=>{for await(let i of t)r(i)&&n.emitOne(i)})}filter(t){return xr.filter(this,t)}static coalesce(t){return xr.filter(t,r=>!!r)}coalesce(){return xr.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return xr.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())}};_g.EMPTY=_g.fromArray([]);var{getWindow:Gr,getWindowId:JT,onDidRegisterWindow:eL}=function(){let e=new Map,t={window:un,disposables:new Hn};e.set(un.vscodeWindowId,t);let r=new oe,n=new oe,i=new oe;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 Le.None;let l=new Hn,a={window:o,disposables:l.add(new Hn)};return e.set(o.vscodeWindowId,a),l.add(qe(()=>{e.delete(o.vscodeWindowId),n.fire(o)})),l.add(ke(o,_t.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:un},getDocument(o){return Gr(o).document}}}(),tL=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 ke(e,t,r,n){return new tL(e,t,r,n)}var vg=function(e,t,r,n){return ke(e,t,r,n)},bf,rL=class extends QT{constructor(e){super(),this.defaultTarget=e&&Gr(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},yg=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){Bl(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(yg.sort),o.shift().execute();n.set(s,!1)};bf=(s,o,l=0)=>{let a=JT(s),c=new yg(o,l),h=e.get(a);return h||(h=[],e.set(a,h)),h.push(c),r.get(a)||(r.set(a,!0),s.requestAnimationFrame(()=>i(a))),c}})();function nL(e){let t=e.getBoundingClientRect(),r=Gr(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var _t={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"},iL=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=Yt(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Yt(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Yt(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Yt(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Yt(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Yt(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Yt(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Yt(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Yt(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Yt(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Yt(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=Yt(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=Yt(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Yt(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 Yt(e){return typeof e=="number"?`${e}px`:e}function ao(e){return new iL(e)}var kx=class{constructor(){this._hooks=new Hn,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(qe(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=Gr(e)}this._hooks.add(ke(s,_t.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(ke(s,_t.POINTER_UP,o=>this.stopMonitoring(!0)))}};function sL(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 Vr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Vr||(Vr={}));var Us=class Mt extends Le{constructor(){super(),this.dispatched=!1,this.targets=new cg,this.ignoreTargets=new cg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Tt.runAndSubscribe(eL,({window:t,disposables:r})=>{r.add(ke(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(ke(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(ke(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:un,disposables:this._store}))}static addTarget(t){if(!Mt.isTouchDevice())return Le.None;Mt.INSTANCE||(Mt.INSTANCE=new Mt);let r=Mt.INSTANCE.targets.push(t);return qe(r)}static ignoreTarget(t){if(!Mt.isTouchDevice())return Le.None;Mt.INSTANCE||(Mt.INSTANCE=new Mt);let r=Mt.INSTANCE.ignoreTargets.push(t);return qe(r)}static isTouchDevice(){return"ontouchstart"in un||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(Vr.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<Mt.HOLD_DELAY&&Math.abs(a.initialPageX-ir(a.rollingPageX))<30&&Math.abs(a.initialPageY-ir(a.rollingPageY))<30){let h=this.newGestureEvent(Vr.Tap,a.initialTarget);h.pageX=ir(a.rollingPageX),h.pageY=ir(a.rollingPageY),this.dispatchEvent(h)}else if(c>=Mt.HOLD_DELAY&&Math.abs(a.initialPageX-ir(a.rollingPageX))<30&&Math.abs(a.initialPageY-ir(a.rollingPageY))<30){let h=this.newGestureEvent(Vr.Contextmenu,a.initialTarget);h.pageX=ir(a.rollingPageX),h.pageY=ir(a.rollingPageY),this.dispatchEvent(h)}else if(i===1){let h=ir(a.rollingPageX),u=ir(a.rollingPageY),f=ir(a.rollingTimestamps)-a.rollingTimestamps[0],p=h-a.rollingPageX[0],m=u-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,h,Math.abs(m)/f,m>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(Vr.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===Vr.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Mt.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===Vr.Change||t.type===Vr.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=bf(t,()=>{let h=Date.now(),u=h-n,f=0,p=0,m=!0;i+=Mt.SCROLL_FRICTION*u,l+=Mt.SCROLL_FRICTION*u,i>0&&(m=!1,f=s*i*u),l>0&&(m=!1,p=a*l*u);let g=this.newGestureEvent(Vr.Change);g.translationX=f,g.translationY=p,r.forEach(S=>S.dispatchEvent(g)),m||this.inertia(t,r,h,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(Vr.Change,o.initialTarget);l.translationX=s.pageX-ir(o.rollingPageX),l.translationY=s.pageY-ir(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)}};Us.SCROLL_FRICTION=-.005,Us.HOLD_DELAY=700,Us.CLEAR_TAP_COUNT_TIME=400,nt([sL],Us,"isTouchDevice",1);var oL=Us,kf=class extends Le{onclick(e,t){this._register(ke(e,_t.CLICK,r=>t(new _l(Gr(e),r))))}onmousedown(e,t){this._register(ke(e,_t.MOUSE_DOWN,r=>t(new _l(Gr(e),r))))}onmouseover(e,t){this._register(ke(e,_t.MOUSE_OVER,r=>t(new _l(Gr(e),r))))}onmouseleave(e,t){this._register(ke(e,_t.MOUSE_LEAVE,r=>t(new _l(Gr(e),r))))}onkeydown(e,t){this._register(ke(e,_t.KEY_DOWN,r=>t(new pg(r))))}onkeyup(e,t){this._register(ke(e,_t.KEY_UP,r=>t(new pg(r))))}oninput(e,t){this._register(ke(e,_t.INPUT,t))}onblur(e,t){this._register(ke(e,_t.BLUR,t))}onfocus(e,t){this._register(ke(e,_t.FOCUS,t))}onchange(e,t){this._register(ke(e,_t.CHANGE,t))}ignoreGesture(e){return oL.ignoreTarget(e)}},xg=11,lL=class extends kf{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=xg+"px",this.domNode.style.height=xg+"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 kx),this._register(vg(this.bgDomNode,_t.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(vg(this.domNode,_t.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new rL),this._pointerdownScheduleRepeatTimer=this._register(new Sf)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Gr(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()}},aL=class Ph{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 Ph(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 Ph(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}}},cL=class extends Le{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new aL(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 Sg(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=Sg.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)))}},wg=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function Xc(e,t){let r=t-e;return function(n){return e+r*dL(n)}}function uL(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var Sg=class Dh{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),uL(Xc(t,i),Xc(s,r),.33)}return Xc(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 wg(n,i,!1)}return new wg(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return Dh.start(t,r,n)}static start(t,r,n){n=n+10;let i=Date.now()-10;return new Dh(t,r,i,n)}};function hL(e){return Math.pow(e,3)}function dL(e){return 1-hL(1-e)}var fL=class extends Le{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 Sf)}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":"")))}},pL=140,Cx=class extends kf{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 fL(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new kx),this._shouldRender=!0,this.domNode=ao(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(ke(this.domNode.domNode,_t.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new lL(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=ao(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(ke(this.slider.domNode,_t.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=nL(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(xx&&o>pL){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()}},Ex=class Ih{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 Ih(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))),h=(l-c)/(i-n),u=s*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=Ih._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)}},mL=class extends Cx{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Ex(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}},gL=class extends Cx{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Ex(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}},_L=500,bg=50,vL=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Rh=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(xf){let r=Gr(t.browserEvent),n=LT(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 vL(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),h=Math.max(i,o),u=Math.max(s,l);h%a===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Rh.INSTANCE=new Rh;var yL=Rh,xL=class extends kf{constructor(e,t,r){super(),this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new oe),this.onWillScroll=this._onWillScroll.event,this._options=SL(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 gL(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new mL(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=ao(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ao(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ao(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 Sf),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Si(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,Jr&&(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 gg(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Si(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new gg(r))};this._mouseWheelToDispose.push(ke(this._listenOnDomNode,_t.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=yL.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=!Jr&&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 h=bg*s,u=a.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(c,u)}if(o){let h=bg*o,u=a.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(c,u)}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(),_L)}},wL=class extends xL{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 SL(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,Jr&&(t.className+=" mac"),t}var Mh=class extends Le{constructor(e,t,r,n,i,s,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new oe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new cL({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>bf(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new wL(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(Tt.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(qe(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(qe(()=>this._styleElement.remove())),this._register(Tt.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
|
+
`)})),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}};Mh=nt([ue(2,Vt),ue(3,vn),ue(4,ox),ue(5,ys),ue(6,Kt),ue(7,yn)],Mh);var Ah=class extends Le{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(qe(()=>{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()}};Ah=nt([ue(1,Vt),ue(2,vn),ue(3,Ko),ue(4,yn)],Ah);var bL=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)}},Hr={full:0,left:0,center:0,right:0},bn={full:0,left:0,center:0,right:0},Ms={full:0,left:0,center:0,right:0},wa=class extends Le{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 bL,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(qe(()=>{var h;return(h=this._canvas)==null?void 0:h.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);bn.full=this._canvas.width,bn.left=e,bn.center=t,bn.right=e,this._refreshDrawHeightConstants(),Ms.full=1,Ms.left=1,Ms.center=1+bn.left,Ms.right=1+bn.left+bn.center}_refreshDrawHeightConstants(){Hr.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);Hr.left=t,Hr.center=t,Hr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hr.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(Ms[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Hr[e.position||"full"]/2),bn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Hr[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}))}};wa=nt([ue(2,Vt),ue(3,Ko),ue(4,yn),ue(5,Kt),ue(6,ys),ue(7,vn)],wa);var G;(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=`
|
|
130
|
+
`,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=""))(G||(G={}));var Fl;(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="ย"))(Fl||(Fl={}));var Nx;(e=>e.ST=`${G.ESC}\\`)(Nx||(Nx={}));var jh=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(`${G.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)}}};jh=nt([ue(2,Vt),ue(3,Kt),ue(4,Ti),ue(5,yn)],jh);var yt=0,xt=0,wt=0,tt=0,kg={css:"#00000000",rgba:0},at;(e=>{function t(i,s,o,l){return l!==void 0?`#${Jn(i)}${Jn(s)}${Jn(o)}${Jn(l)}`:`#${Jn(i)}${Jn(s)}${Jn(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})(at||(at={}));var Ue;(e=>{function t(a,c){if(tt=(c.rgba&255)/255,tt===1)return{css:c.css,rgba:c.rgba};let h=c.rgba>>24&255,u=c.rgba>>16&255,f=c.rgba>>8&255,p=a.rgba>>24&255,m=a.rgba>>16&255,g=a.rgba>>8&255;yt=p+Math.round((h-p)*tt),xt=m+Math.round((u-m)*tt),wt=g+Math.round((f-g)*tt);let S=at.toCss(yt,xt,wt),_=at.toRgba(yt,xt,wt);return{css:S,rgba:_}}e.blend=t;function r(a){return(a.rgba&255)===255}e.isOpaque=r;function n(a,c,h){let u=$l.ensureContrastRatio(a.rgba,c.rgba,h);if(u)return at.toColor(u>>24&255,u>>16&255,u>>8&255)}e.ensureContrastRatio=n;function i(a){let c=(a.rgba|255)>>>0;return[yt,xt,wt]=$l.toChannels(c),{css:at.toCss(yt,xt,wt),rgba:c}}e.opaque=i;function s(a,c){return tt=Math.round(c*255),[yt,xt,wt]=$l.toChannels(a.rgba),{css:at.toCss(yt,xt,wt,tt),rgba:at.toRgba(yt,xt,wt,tt)}}e.opacity=s;function o(a,c){return tt=a.rgba&255,s(a,tt*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})(Ue||(Ue={}));var Ge;(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 yt=parseInt(i.slice(1,2).repeat(2),16),xt=parseInt(i.slice(2,3).repeat(2),16),wt=parseInt(i.slice(3,4).repeat(2),16),at.toColor(yt,xt,wt);case 5:return yt=parseInt(i.slice(1,2).repeat(2),16),xt=parseInt(i.slice(2,3).repeat(2),16),wt=parseInt(i.slice(3,4).repeat(2),16),tt=parseInt(i.slice(4,5).repeat(2),16),at.toColor(yt,xt,wt,tt);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 yt=parseInt(s[1]),xt=parseInt(s[2]),wt=parseInt(s[3]),tt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),at.toColor(yt,xt,wt,tt);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),[yt,xt,wt,tt]=t.getImageData(0,0,1,1).data,tt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:at.toRgba(yt,xt,wt,tt),css:i}}e.toColor=n})(Ge||(Ge={}));var zt;(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),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),u=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return c*.2126+h*.7152+u*.0722}e.relativeLuminance2=r})(zt||(zt={}));var $l;(e=>{function t(o,l){if(tt=(l&255)/255,tt===1)return l;let a=l>>24&255,c=l>>16&255,h=l>>8&255,u=o>>24&255,f=o>>16&255,p=o>>8&255;return yt=u+Math.round((a-u)*tt),xt=f+Math.round((c-f)*tt),wt=p+Math.round((h-p)*tt),at.toRgba(yt,xt,wt)}e.blend=t;function r(o,l,a){let c=zt.relativeLuminance(o>>8),h=zt.relativeLuminance(l>>8);if(nn(c,h)<a){if(h<c){let p=n(o,l,a),m=nn(c,zt.relativeLuminance(p>>8));if(m<a){let g=i(o,l,a),S=nn(c,zt.relativeLuminance(g>>8));return m>S?p:g}return p}let u=i(o,l,a),f=nn(c,zt.relativeLuminance(u>>8));if(f<a){let p=n(o,l,a),m=nn(c,zt.relativeLuminance(p>>8));return f>m?u:p}return u}}e.ensureContrastRatio=r;function n(o,l,a){let c=o>>24&255,h=o>>16&255,u=o>>8&255,f=l>>24&255,p=l>>16&255,m=l>>8&255,g=nn(zt.relativeLuminance2(f,p,m),zt.relativeLuminance2(c,h,u));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=nn(zt.relativeLuminance2(f,p,m),zt.relativeLuminance2(c,h,u));return(f<<24|p<<16|m<<8|255)>>>0}e.reduceLuminance=n;function i(o,l,a){let c=o>>24&255,h=o>>16&255,u=o>>8&255,f=l>>24&255,p=l>>16&255,m=l>>8&255,g=nn(zt.relativeLuminance2(f,p,m),zt.relativeLuminance2(c,h,u));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=nn(zt.relativeLuminance2(f,p,m),zt.relativeLuminance2(c,h,u));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})($l||($l={}));function Jn(e){let t=e.toString(16);return t.length<2?"0"+t:t}function nn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var kL=class extends Vo{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()]}},Sa=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Nr}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 h=this._getJoinedRanges(n,o,s,t,i);for(let u=0;u<h.length;u++)r.push(h[u])}i=c,o=s,l=this._workCell.fg,a=this._workCell.bg}s+=this._workCell.getChars().length||Mn.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(n,o,s,t,i);for(let h=0;h<c.length;h++)r.push(c[h])}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++)Sa._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||Mn.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}};Sa=nt([ue(0,Vt)],Sa);function CL(e){return 57508<=e&&e<=57558}function EL(e){return 9472<=e&&e<=9631}function NL(e){return CL(e)||EL(e)}function TL(){return{css:{canvas:vl(),cell:vl()},device:{canvas:vl(),cell:vl(),char:{width:0,height:0,left:0,top:0}}}}function vl(){return{width:0,height:0}}var Bh=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 Nr,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,h){let u=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();r&&m<s+1&&(m=s+1);let g,S=0,_="",y=0,x=0,N=0,T=0,C=!1,R=0,O=!1,z=0,E=0,H=[],A=c!==-1&&h!==-1;for(let M=0;M<m;M++){e.loadCell(M,this._workCell);let V=this._workCell.getWidth();if(V===0)continue;let L=!1,j=M>=E,q=M,P=this._workCell;if(f.length>0&&M===f[0][0]&&j){let Ce=f.shift(),F=this._isCellInSelection(Ce[0],t);for(y=Ce[0]+1;y<Ce[1];y++)j&&(j=F===this._isCellInSelection(y,t));j&&(j=!r||s<Ce[0]||s>=Ce[1]),j?(L=!0,P=new kL(this._workCell,e.translateToString(!0,Ce[0],Ce[1]),Ce[1]-Ce[0]),q=Ce[1]-1,V=P.getWidth()):E=Ce[1]}let $=this._isCellInSelection(M,t),b=r&&M===s,ne=A&&M>=c&&M<=h,ce=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,Ce=>{ce=!0});let k=P.getChars()||Mn;if(k===" "&&(P.isUnderline()||P.isOverline())&&(k="ย "),z=V*l-a.get(k,P.isBold(),P.isItalic()),!g)g=this._document.createElement("span");else if(S&&($&&O||!$&&!O&&P.bg===x)&&($&&O&&p.selectionForeground||P.fg===N)&&P.extended.ext===T&&ne===C&&z===R&&!b&&!L&&!ce&&j){P.isInvisible()?_+=Mn:_+=k,S++;continue}else S&&(g.textContent=_),g=this._document.createElement("span"),S=0,_="";if(x=P.bg,N=P.fg,T=P.extended.ext,C=ne,R=z,O=$,L&&s>=M&&s<=q&&(s=M),!this._coreService.isCursorHidden&&b&&this._coreService.isCursorInitialized){if(H.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&H.push("xterm-cursor-blink"),H.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":H.push("xterm-cursor-outline");break;case"block":H.push("xterm-cursor-block");break;case"bar":H.push("xterm-cursor-bar");break;case"underline":H.push("xterm-cursor-underline");break}}if(P.isBold()&&H.push("xterm-bold"),P.isItalic()&&H.push("xterm-italic"),P.isDim()&&H.push("xterm-dim"),P.isInvisible()?_=Mn:_=P.getChars()||Mn,P.isUnderline()&&(H.push(`xterm-underline-${P.extended.underlineStyle}`),_===" "&&(_="ย "),!P.isUnderlineColorDefault()))if(P.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Vo.toColorRGB(P.getUnderlineColor()).join(",")})`;else{let Ce=P.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&P.isBold()&&Ce<8&&(Ce+=8),g.style.textDecorationColor=p.ansi[Ce].css}P.isOverline()&&(H.push("xterm-overline"),_===" "&&(_="ย ")),P.isStrikethrough()&&H.push("xterm-strikethrough"),ne&&(g.style.textDecoration="underline");let _e=P.getFgColor(),X=P.getFgColorMode(),te=P.getBgColor(),Y=P.getBgColorMode(),le=!!P.isInverse();if(le){let Ce=_e;_e=te,te=Ce;let F=X;X=Y,Y=F}let fe,me,ye=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,Ce=>{Ce.options.layer!=="top"&&ye||(Ce.backgroundColorRGB&&(Y=50331648,te=Ce.backgroundColorRGB.rgba>>8&16777215,fe=Ce.backgroundColorRGB),Ce.foregroundColorRGB&&(X=50331648,_e=Ce.foregroundColorRGB.rgba>>8&16777215,me=Ce.foregroundColorRGB),ye=Ce.options.layer==="top")}),!ye&&$&&(fe=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,te=fe.rgba>>8&16777215,Y=50331648,ye=!0,p.selectionForeground&&(X=50331648,_e=p.selectionForeground.rgba>>8&16777215,me=p.selectionForeground)),ye&&H.push("xterm-decoration-top");let xe;switch(Y){case 16777216:case 33554432:xe=p.ansi[te],H.push(`xterm-bg-${te}`);break;case 50331648:xe=at.toColor(te>>16,te>>8&255,te&255),this._addStyle(g,`background-color:#${Cg((te>>>0).toString(16),"0",6)}`);break;case 0:default:le?(xe=p.foreground,H.push("xterm-bg-257")):xe=p.background}switch(fe||P.isDim()&&(fe=Ue.multiplyOpacity(xe,.5)),X){case 16777216:case 33554432:P.isBold()&&_e<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_e+=8),this._applyMinimumContrast(g,xe,p.ansi[_e],P,fe,void 0)||H.push(`xterm-fg-${_e}`);break;case 50331648:let Ce=at.toColor(_e>>16&255,_e>>8&255,_e&255);this._applyMinimumContrast(g,xe,Ce,P,fe,me)||this._addStyle(g,`color:#${Cg(_e.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,xe,p.foreground,P,fe,me)||le&&H.push("xterm-fg-257")}H.length&&(g.className=H.join(" "),H.length=0),!b&&!L&&!ce&&j?S++:g.textContent=_,z!==this.defaultSpacing&&(g.style.letterSpacing=`${z}px`),u.push(g),M=q}return g&&S&&(g.textContent=_),u}_applyMinimumContrast(e,t,r,n,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||NL(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=Ue.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]}};Bh=nt([ue(1,cx),ue(2,Kt),ue(3,vn),ue(4,Ti),ue(5,Ko),ue(6,ys)],Bh);function Cg(e,t,r){for(;e.length<r;)e=t+e;return e}var LL=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}},PL=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 DL(){return new PL}var Gc="xterm-dom-renderer-owner-",vr="xterm-rows",yl="xterm-fg-",Eg="xterm-bg-",As="xterm-focus",xl="xterm-selection",IL=1,Oh=class extends Le{constructor(e,t,r,n,i,s,o,l,a,c,h,u,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=h,this._coreService=u,this._coreBrowserService=f,this._themeService=p,this._terminalClass=IL++,this._rowElements=[],this._selectionRenderModel=DL(),this.onRequestRedraw=this._register(new oe).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(vr),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(xl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=TL(),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(Bh,document),this._element.classList.add(Gc+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(qe(()=>{this._element.classList.remove(Gc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new LL(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} .${vr} 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} .${vr} { 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} .${vr} .xterm-dim { color: ${Ue.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} .${vr}.${As} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${vr}.${As} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${vr}.${As} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${vr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${vr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${vr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${vr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${vr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${xl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${xl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${xl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${yl}${s} { color: ${o.css}; }${this._terminalSelector} .${yl}${s}.xterm-dim { color: ${Ue.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Eg}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${yl}257 { color: ${Ue.opaque(e.background).css}; }${this._terminalSelector} .${yl}257.xterm-dim { color: ${Ue.multiplyOpacity(Ue.opaque(e.background),.5).css}; }${this._terminalSelector} .${Eg}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(As),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(As),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 h=o-s-1;if(l.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,h)),s!==o){let u=i===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,u))}}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,h=this._rowElements[a],u=r.lines.get(c);if(!h||!u)break;h.replaceChildren(...this._rowFactory.createRow(u,c,c===n,o,l,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Gc}${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),h=this._optionsService.rawOptions.cursorBlink,u=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,u,f,c,h,this.dimensions.css.cell.width,this._widthCache,s?p===r?e:0:-1,s?(p===n?t:i)-1:-1))}}};Oh=nt([ue(7,_f),ue(8,Za),ue(9,Kt),ue(10,Vt),ue(11,Ti),ue(12,vn),ue(13,ys)],Oh);var zh=class extends Le{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new oe),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new ML(this._optionsService))}catch{this._measureStrategy=this._register(new RL(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())}};zh=nt([ue(2,Kt)],zh);var Tx=class extends Le{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)}},RL=class extends Tx{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}},ML=class extends Tx{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}},AL=class extends Le{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 jL(this._window)),this._onDprChange=this._register(new oe),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new oe),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Tt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ke(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ke(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}},jL=class extends Le{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new hs),this._onDprChange=this._register(new oe),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(qe(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ke(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)}},BL=class extends Le{constructor(){super(),this.linkProviders=[],this._register(qe(()=>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 Cf(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 OL(e,t,r,n,i,s,o,l,a){if(!s)return;let c=Cf(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 Fh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return OL(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=Cf(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])}}};Fh=nt([ue(0,yn),ue(1,Za)],Fh);var zL=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=[]}},Lx={};X3(Lx,{getSafariVersion:()=>$L,isChromeOS:()=>Rx,isFirefox:()=>Px,isIpad:()=>WL,isIphone:()=>HL,isLegacyEdge:()=>FL,isLinux:()=>Ef,isMac:()=>ba,isNode:()=>Ja,isSafari:()=>Dx,isWindows:()=>Ix});var Ja=typeof process<"u"&&"title"in process,qo=Ja?"node":navigator.userAgent,Yo=Ja?"node":navigator.platform,Px=qo.includes("Firefox"),FL=qo.includes("Edge"),Dx=/^((?!chrome|android).)*safari/i.test(qo);function $L(){if(!Dx)return 0;let e=qo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ba=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Yo),WL=Yo==="iPad",HL=Yo==="iPhone",Ix=["Windows","Win16","Win32","WinCE"].includes(Yo),Ef=Yo.indexOf("Linux")>=0,Rx=/\bCrOS\b/.test(qo),Mx=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()}},UL=class extends Mx{_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())}}},VL=class extends Mx{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ka=!Ja&&"requestIdleCallback"in window?VL:UL,KL=class{constructor(){this._queue=new ka}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},$h=class extends Le{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 hs),this._pausedResizeTask=new KL,this._observerDisposable=this._register(new hs),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 oe),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new oe),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new oe),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new oe),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new zL((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new qL(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(qe(()=>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=qe(()=>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()}};$h=nt([ue(2,Kt),ue(3,Za),ue(4,Ti),ue(5,Ko),ue(6,Vt),ue(7,vn),ue(8,ys)],$h);var qL=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 YL(e,t,r,n){let i=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return QL(i,s,e,t,r,n)+ec(s,t,r,n)+ZL(i,s,e,t,r,n);let o;if(s===t)return o=i>e?"D":"C",Io(Math.abs(i-e),Do(o,n));o=s>t?"D":"C";let l=Math.abs(s-t),a=GL(s>t?e:i,r)+(l-1)*r.cols+1+XL(s>t?i:e);return Io(a,Do(o,n))}function XL(e,t){return e-1}function GL(e,t){return t.cols-e}function QL(e,t,r,n,i,s){return ec(t,n,i,s).length===0?"":Io(jx(e,t,e,t-bi(t,i),!1,i).length,Do("D",s))}function ec(e,t,r,n){let i=e-bi(e,r),s=t-bi(t,r),o=Math.abs(i-s)-JL(e,t,r);return Io(o,Do(Ax(e,t),n))}function ZL(e,t,r,n,i,s){let o;ec(t,n,i,s).length>0?o=n-bi(n,i):o=t;let l=n,a=e4(e,t,r,n,i,s);return Io(jx(e,o,r,l,a==="C",i).length,Do(a,s))}function JL(e,t,r){var o;let n=0,i=e-bi(e,r),s=t-bi(t,r);for(let l=0;l<Math.abs(i-s);l++){let a=Ax(e,t)==="A"?-1:1;(o=r.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&n++}return n}function bi(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 e4(e,t,r,n,i,s){let o;return ec(r,n,i,s).length>0?o=n-bi(n,i):o=t,e<r&&o<=n||e>=r&&o<n?"C":"D"}function Ax(e,t){return e>t?"A":"B"}function jx(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 Do(e,t){let r=t?"O":"[";return G.ESC+r+e}function Io(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var t4=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 Ng(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 Qc=50,r4=15,n4=50,i4=500,s4="ย ",o4=new RegExp(s4,"g"),Wh=class extends Le{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 Nr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new oe),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new oe),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new oe),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new oe),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 t4(this._bufferService),this._activeSelectionMode=0,this._register(qe(()=>{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(o4," ")).join(Ix?`\r
|
|
131
|
+
`:`
|
|
132
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Ef&&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=Ng(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=Cf(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,-Qc),Qc),t/=Qc,t/Math.abs(t)+Math.round(t*(r4-1)))}shouldForceSelection(e){return ba?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(),n4)}_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&&!(ba&&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<i4&&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=YL(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,h=0,u=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&&(h++,S--),s.getWidth(_)===2&&(u++,_++);let y=s.getString(_).length;for(y>1&&(p+=y-1,a+=y-1);S>0&&l>0&&!this._isCharWordSeparator(s.loadCell(S-1,this._workCell));){s.loadCell(S-1,this._workCell);let x=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,S--):x>1&&(f+=x-1,l-=x-1),l--,S--}for(;_<s.length&&a+1<o.length&&!this._isCharWordSeparator(s.loadCell(_+1,this._workCell));){s.loadCell(_+1,this._workCell);let x=this._workCell.getChars().length;this._workCell.getWidth()===2?(u++,_++):x>1&&(p+=x-1,a+=x-1),a++,_++}}a++;let m=l+c-h+f,g=Math.min(this._bufferService.cols,a-l+h+u-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 y=this._bufferService.cols-_.start;m-=y,g+=y}}}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=Ng(r,this._bufferService.cols)}};Wh=nt([ue(3,Vt),ue(4,Ti),ue(5,vf),ue(6,Kt),ue(7,yn),ue(8,vn)],Wh);var Tg=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={}}},Lg=class{constructor(){this._color=new Tg,this._css=new Tg}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()}},ht=Object.freeze((()=>{let e=[Ge.toColor("#2e3436"),Ge.toColor("#cc0000"),Ge.toColor("#4e9a06"),Ge.toColor("#c4a000"),Ge.toColor("#3465a4"),Ge.toColor("#75507b"),Ge.toColor("#06989a"),Ge.toColor("#d3d7cf"),Ge.toColor("#555753"),Ge.toColor("#ef2929"),Ge.toColor("#8ae234"),Ge.toColor("#fce94f"),Ge.toColor("#729fcf"),Ge.toColor("#ad7fa8"),Ge.toColor("#34e2e2"),Ge.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],i=t[r/6%6|0],s=t[r%6];e.push({css:at.toCss(n,i,s),rgba:at.toRgba(n,i,s)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:at.toCss(n,n,n),rgba:at.toRgba(n,n,n)})}return e})()),si=Ge.toColor("#ffffff"),Vs=Ge.toColor("#000000"),Pg=Ge.toColor("#ffffff"),Dg=Vs,js={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},l4=si,Hh=class extends Le{constructor(e){super(),this._optionsService=e,this._contrastCache=new Lg,this._halfContrastCache=new Lg,this._onChangeColors=this._register(new oe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:si,background:Vs,cursor:Pg,cursorAccent:Dg,selectionForeground:void 0,selectionBackgroundTransparent:js,selectionBackgroundOpaque:Ue.blend(Vs,js),selectionInactiveBackgroundTransparent:js,selectionInactiveBackgroundOpaque:Ue.blend(Vs,js),scrollbarSliderBackground:Ue.opacity(si,.2),scrollbarSliderHoverBackground:Ue.opacity(si,.4),scrollbarSliderActiveBackground:Ue.opacity(si,.5),overviewRulerBorder:si,ansi:ht.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=Be(e.foreground,si),t.background=Be(e.background,Vs),t.cursor=Ue.blend(t.background,Be(e.cursor,Pg)),t.cursorAccent=Ue.blend(t.background,Be(e.cursorAccent,Dg)),t.selectionBackgroundTransparent=Be(e.selectionBackground,js),t.selectionBackgroundOpaque=Ue.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Be(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Ue.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Be(e.selectionForeground,kg):void 0,t.selectionForeground===kg&&(t.selectionForeground=void 0),Ue.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Ue.opacity(t.selectionBackgroundTransparent,.3)),Ue.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Ue.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Be(e.scrollbarSliderBackground,Ue.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Be(e.scrollbarSliderHoverBackground,Ue.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Be(e.scrollbarSliderActiveBackground,Ue.opacity(t.foreground,.5)),t.overviewRulerBorder=Be(e.overviewRulerBorder,l4),t.ansi=ht.slice(),t.ansi[0]=Be(e.black,ht[0]),t.ansi[1]=Be(e.red,ht[1]),t.ansi[2]=Be(e.green,ht[2]),t.ansi[3]=Be(e.yellow,ht[3]),t.ansi[4]=Be(e.blue,ht[4]),t.ansi[5]=Be(e.magenta,ht[5]),t.ansi[6]=Be(e.cyan,ht[6]),t.ansi[7]=Be(e.white,ht[7]),t.ansi[8]=Be(e.brightBlack,ht[8]),t.ansi[9]=Be(e.brightRed,ht[9]),t.ansi[10]=Be(e.brightGreen,ht[10]),t.ansi[11]=Be(e.brightYellow,ht[11]),t.ansi[12]=Be(e.brightBlue,ht[12]),t.ansi[13]=Be(e.brightMagenta,ht[13]),t.ansi[14]=Be(e.brightCyan,ht[14]),t.ansi[15]=Be(e.brightWhite,ht[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]=Be(e.extendedAnsi[n],ht[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()}}};Hh=nt([ue(0,Kt)],Hh);function Be(e,t){if(e!==void 0)try{return Ge.toColor(e)}catch{}return t}var a4=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)}},c4=class{constructor(){this._services=new a4,this._services.set(_f,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=rT(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)}},u4={trace:0,debug:1,info:2,warn:3,error:4,off:5},h4="xterm.js: ",Uh=class extends Le{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=u4[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?"":h4)+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)}};Uh=nt([ue(0,Kt)],Uh);var Ig=class extends Le{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new oe),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new oe),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new oe),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}},Te=3,lt=Object.freeze(new Vo),wl=0,Zc=2,Ks=class Bx{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Te);let i=r||Nr.fromCharData([0,rx,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let r=this._data[t*Te+0],n=r&2097151;return[this._data[t*Te+1],r&2097152?this._combined[t]:n?Tn(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*Te+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Te+0]=t|2097152|r[2]<<22):this._data[t*Te+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Te+0]>>22}hasWidth(t){return this._data[t*Te+0]&12582912}getFg(t){return this._data[t*Te+1]}getBg(t){return this._data[t*Te+2]}hasContent(t){return this._data[t*Te+0]&4194303}getCodePoint(t){let r=this._data[t*Te+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Te+0]&2097152}getString(t){let r=this._data[t*Te+0];return r&2097152?this._combined[t]:r&2097151?Tn(r&2097151):""}isProtected(t){return this._data[t*Te+2]&536870912}loadCell(t,r){return wl=t*Te,r.content=this._data[wl+0],r.fg=this._data[wl+1],r.bg=this._data[wl+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*Te+0]=r.content,this._data[t*Te+1]=r.fg,this._data[t*Te+2]=r.bg}setCellFromCodepoint(t,r,n,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Te+0]=r|n<<22,this._data[t*Te+1]=i.fg,this._data[t*Te+2]=i.bg}addCodepointToCell(t,r,n){let i=this._data[t*Te+0];i&2097152?this._combined[t]+=Tn(r):i&2097151?(this._combined[t]=Tn(i&2097151)+Tn(r),i&=-2097152,i|=2097152):i=r|1<<22,n&&(i&=-12582913,i|=n<<22),this._data[t*Te+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 Nr;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 Nr;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*Zc<this._data.buffer.byteLength;let n=t*Te;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*Zc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Zc<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 Bx(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*Te+0]&4194303)return t+(this._data[t*Te+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Te+0]&4194303||this._data[t*Te+2]&50331648)return t+(this._data[t*Te+0]>>22);return 0}copyCellsFrom(t,r,n,i,s){let o=t._data;if(s)for(let a=i-1;a>=0;a--){for(let c=0;c<Te;c++)this._data[(n+a)*Te+c]=o[(r+a)*Te+c];o[(r+a)*Te+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}else for(let a=0;a<i;a++){for(let c=0;c<Te;c++)this._data[(n+a)*Te+c]=o[(r+a)*Te+c];o[(r+a)*Te+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*Te+0],l=o&2097151,a=o&2097152?this._combined[r]:l?Tn(l):Mn;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 d4(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 h=[e.get(l)];for(;a<e.length&&c.isWrapped;)h.push(c),c=e.get(++a);if(!s&&n>=l&&n<a){l+=h.length-1;continue}let u=0,f=Ro(h,u,t),p=1,m=0;for(;p<h.length;){let S=Ro(h,p,t),_=S-m,y=r-f,x=Math.min(_,y);h[u].copyCellsFrom(h[p],m,f,x,!1),f+=x,f===r&&(u++,f=0),m+=x,m===S&&(p++,m=0),f===0&&u!==0&&h[u-1].getWidth(r-1)===2&&(h[u].copyCellsFrom(h[u-1],r-1,f++,1,!1),h[u-1].setCell(r-1,i))}h[u].replaceCells(f,r,i);let g=0;for(let S=h.length-1;S>0&&(S>u||h[S].getTrimmedLength()===0);S--)g++;g>0&&(o.push(l+h.length-g),o.push(g)),l+=h.length-1}return o}function f4(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 p4(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 m4(e,t,r){let n=[],i=e.map((a,c)=>Ro(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=Ro(e,o,t);s>a&&(s-=a,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let h=c?r-1:r;n.push(h),l+=h}return n}function Ro(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 Ox=class zx{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=zx._nextId++,this._onDispose=this.register(new oe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Si(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Ox._nextId=1;var g4=Ox,mt={},oi=mt.B;mt[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:"โฅ","{":"ฯ","|":"โ ","}":"ยฃ","~":"ยท"};mt.A={"#":"ยฃ"};mt.B=void 0;mt[4]={"#":"ยฃ","@":"ยพ","[":"ij","\\":"ยฝ","]":"|","{":"ยจ","|":"f","}":"ยผ","~":"ยด"};mt.C=mt[5]={"[":"ร","\\":"ร","]":"ร
","^":"ร","`":"รฉ","{":"รค","|":"รถ","}":"รฅ","~":"รผ"};mt.R={"#":"ยฃ","@":"ร ","[":"ยฐ","\\":"รง","]":"ยง","{":"รฉ","|":"รน","}":"รจ","~":"ยจ"};mt.Q={"@":"ร ","[":"รข","\\":"รง","]":"รช","^":"รฎ","`":"รด","{":"รฉ","|":"รน","}":"รจ","~":"รป"};mt.K={"@":"ยง","[":"ร","\\":"ร","]":"ร","{":"รค","|":"รถ","}":"รผ","~":"ร"};mt.Y={"#":"ยฃ","@":"ยง","[":"ยฐ","\\":"รง","]":"รฉ","`":"รน","{":"ร ","|":"รฒ","}":"รจ","~":"รฌ"};mt.E=mt[6]={"@":"ร","[":"ร","\\":"ร","]":"ร
","^":"ร","`":"รค","{":"รฆ","|":"รธ","}":"รฅ","~":"รผ"};mt.Z={"#":"ยฃ","@":"ยง","[":"ยก","\\":"ร","]":"ยฟ","{":"ยฐ","|":"รฑ","}":"รง"};mt.H=mt[7]={"@":"ร","[":"ร","\\":"ร","]":"ร
","^":"ร","`":"รฉ","{":"รค","|":"รถ","}":"รฅ","~":"รผ"};mt["="]={"#":"รน","@":"ร ","[":"รฉ","\\":"รง","]":"รช","^":"รฎ",_:"รจ","`":"รด","{":"รค","|":"รถ","}":"รผ","~":"รป"};var Rg=4294967295,Mg=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=lt.clone(),this.savedCharset=oi,this.markers=[],this._nullCell=Nr.fromCharData([0,rx,1,0]),this._whitespaceCell=Nr.fromCharData([0,Mn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ka,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Ig(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 xa),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 xa),this._whitespaceCell}getBlankLine(e,t){return new Ks(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>Rg?Rg:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=lt);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 Ig(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(lt),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 Ks(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 Ks(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=d4(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(lt),r);if(n.length>0){let i=f4(this.lines,n);p4(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(lt),i=r;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ks(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(lt),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 x=this.ybase+this.y;if(x>=o&&x<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),h=m4(a,this._cols,e),u=h.length-a.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+u):f=Math.max(0,this.lines.length-this.lines.maxLength+u);let p=[];for(let x=0;x<u;x++){let N=this.getBlankLine(lt,!0);p.push(N)}p.length>0&&(i.push({start:o+a.length+s,newLines:p}),s+=p.length),a.push(...p);let m=h.length-1,g=h[m];g===0&&(m--,g=h[m]);let S=a.length-u-1,_=c;for(;S>=0;){let x=Math.min(_,g);if(a[m]===void 0)break;if(a[m].copyCellsFrom(a[S],_-x,g-x,x,!0),g-=x,g===0&&(m--,g=h[m]),_-=x,_===0){S--;let N=Math.max(S,0);_=Ro(a,N,this._cols)}}for(let x=0;x<a.length;x++)h[x]<e&&a[x].setCell(h[x],n);let y=u-f;for(;y-- >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+u,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,h=0,u=i[h];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(u&&u.start>c+f){for(let S=u.newLines.length-1;S>=0;S--)this.lines.set(g--,u.newLines[S]);g++,o.push({index:c+1,amount:u.newLines.length}),f+=u.newLines.length,u=i[++h]}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 g4(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)}},_4=class extends Le{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new oe),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 Mg(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Mg(!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)}},Fx=2,$x=1,Vh=class extends Le{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new oe),this.onResize=this._onResize.event,this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Fx),this.rows=Math.max(e.rawOptions.rows||0,$x),this.buffers=this._register(new _4(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))}};Vh=nt([ue(0,Kt)],Vh);var Mi={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:ba,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},v4=["normal","bold","100","200","300","400","500","600","700","800","900"],y4=class extends Le{constructor(e){super(),this._onOptionChange=this._register(new oe),this.onOptionChange=this._onOptionChange.event;let t={...Mi};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(qe(()=>{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 Mi))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in Mi))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=Mi[e]),!x4(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Mi[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=v4.includes(t)?t:Mi[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 x4(e){return e==="block"||e==="underline"||e==="bar"}function qs(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]&&qs(e[n],t-1);return r}var Ag=Object.freeze({insertMode:!1}),jg=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Kh=class extends Le{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 oe),this.onData=this._onData.event,this._onUserInput=this._register(new oe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new oe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new oe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=qs(Ag),this.decPrivateModes=qs(jg)}reset(){this.modes=qs(Ag),this.decPrivateModes=qs(jg)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Kh=nt([ue(0,Vt),ue(1,lx),ue(2,Kt)],Kh);var Bg={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 Jc(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 eu=String.fromCharCode,Og={DEFAULT:e=>{let t=[Jc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${eu(t[0])}${eu(t[1])}${eu(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Jc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Jc(e,!0)};${e.x};${e.y}${t}`}},qh=class extends Le{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 oe),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(Bg))this.addProtocol(n,Bg[n]);for(let n of Object.keys(Og))this.addEncoding(n,Og[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)}};qh=nt([ue(0,Vt),ue(1,Ti),ue(2,Kt)],qh);var tu=[[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]],w4=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],dt;function S4(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 b4=class{constructor(){if(this.version="6",!dt){dt=new Uint8Array(65536),dt.fill(1),dt[0]=0,dt.fill(0,1,32),dt.fill(0,127,160),dt.fill(2,4352,4448),dt[9001]=2,dt[9002]=2,dt.fill(2,11904,42192),dt[12351]=1,dt.fill(2,44032,55204),dt.fill(2,63744,64256),dt.fill(2,65040,65050),dt.fill(2,65072,65136),dt.fill(2,65280,65377),dt.fill(2,65504,65511);for(let e=0;e<tu.length;++e)dt.fill(0,tu[e][0],tu[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?dt[e]:S4(e,w4)?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=hi.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return hi.createPropertyValue(0,r,n)}},hi=class Wl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new oe,this.onChange=this._onChange.event;let t=new b4;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=Wl.extractWidth(l);Wl.extractShouldJoin(l)&&(a-=Wl.extractWidth(n)),r+=a,n=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},k4=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 zg(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 Bs=2147483647,C4=256,Wx=class Yh{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>C4)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 Yh;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 Yh(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>Bs?Bs: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>Bs?Bs: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,Bs):t}},Os=[],E4=class{constructor(){this._state=0,this._active=Os,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=Os}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=Os,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Os,!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",Qa(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=Os,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+=Qa(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}},zs=[],N4=class{constructor(){this._handlers=Object.create(null),this._active=zs,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=zs}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=zs,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||zs,!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",Qa(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=zs,this._ident=0}},Ys=new Wx;Ys.addParam(0);var Fg=class{constructor(e){this._handler=e,this._data="",this._params=Ys,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ys,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Qa(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=Ys,this._data="",this._hitLimit=!1,r));return this._params=Ys,this._data="",this._hitLimit=!1,t}},T4=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}},wr=160,L4=function(){let e=new T4(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(wr,0,2,0),e.add(wr,8,5,8),e.add(wr,6,0,6),e.add(wr,11,0,11),e.add(wr,13,13,13),e}(),P4=class extends Le{constructor(e=L4){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 Wx,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(qe(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new E4),this._dcsParser=this._register(new N4),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:wr)],i>>4){case 2:for(let f=l+1;;++f){if(f>=t||(n=e[f])<32||n>126&&n<wr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<wr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<wr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(n=e[f])<32||n>126&&n<wr){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 h=this._escHandlers[this._collect<<8|n],u=h?h.length-1:-1;for(;u>=0&&(o=h[u](),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(4,h,u,i,l),o;u<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<wr){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<wr){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}}},D4=/^([\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})$/,I4=/^[\da-f]+$/;function $g(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=D4.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),I4.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 ru(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 R4(e,t=16){let[r,n,i]=e;return`rgb:${ru(r,t)}/${ru(n,t)}/${ru(i,t)}`}var M4={"(":0,")":1,"*":2,"+":3,"-":1,".":2},kn=131072,Wg=10;function Hg(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 Ug=5e3,Vg=0,A4=class extends Le{constructor(e,t,r,n,i,s,o,l,a=new P4){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 eT,this._utf8Decoder=new tT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=lt.clone(),this._eraseAttrDataInternal=lt.clone(),this._onRequestBell=this._register(new oe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new oe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new oe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new oe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new oe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new oe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new oe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new oe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new oe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new oe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new oe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new oe),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 Xh(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:h.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,h,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:h,data:u})}),this._parser.setDcsHandlerFallback((c,h,u)=>{h==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:h,payload:u})}),this._parser.setPrintHandler((c,h,u)=>this.print(c,h,u)),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(G.BEL,()=>this.bell()),this._parser.setExecuteHandler(G.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(G.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(G.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(G.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(G.BS,()=>this.backspace()),this._parser.setExecuteHandler(G.HT,()=>this.tab()),this._parser.setExecuteHandler(G.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(G.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Fl.IND,()=>this.index()),this._parser.setExecuteHandler(Fl.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Fl.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 mt)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 Fg((c,h)=>this.requestStatusString(c,h)))}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"),Ug))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Ug} 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>kn&&(s=this._parseStack.position+kn)}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<kn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,kn))),o||this._dirtyRowTracker.clearRange(),e.length>kn)for(let c=s;c<e.length;c+=kn){let h=c+kn<e.length?c+kn:e.length,u=typeof e=="string"?this._stringDecoder.decode(e.substring(c,h),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,h),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,u))return this._preserveStack(n,i,u,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,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);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=hi.extractWidth(m);let g=hi.extractShouldJoin(m),S=g?hi.extractWidth(f):0;if(f=m,o&&this._onA11yChar.fire(Tn(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-S>l){if(a){let _=u,y=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),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),S>0&&u instanceof Ks&&u.copyCellsFrom(_,y,0,S,!1);y<l;)_.setCellFromCodepoint(y++,0,1,h)}else if(this._activeBuffer.x=l-1,i===2)continue}if(g&&this._activeBuffer.x){let _=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-_,n,i);for(let y=i-S;--y>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,i-S,this._activeBuffer.getNullCell(h)),u.getWidth(l-1)===2&&u.setCellFromCodepoint(l-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,n,i,h),i>0)for(;--i;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&r-t>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>Hg(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Fg(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(lt));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=hi.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 h=s.codePointAt(c)||0;o[l++]=h,c+=h>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(G.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(G.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(G.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(G.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(G.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,oi),this._charsetService.setgCharset(1,oi),this._charsetService.setgCharset(2,oi),this._charsetService.setgCharset(3,oi);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:h}=l,u=this._optionsService.rawOptions,f=(g,S)=>(o.triggerDataEvent(`${G.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(u.convertEol)):f(m,0):m===1?f(m,p(n.applicationCursorKeys)):m===3?f(m,u.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(u.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===h)):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|=Vo.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=lt.fg,e.bg=lt.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|=lt.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=lt.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|=lt.fg&16777215,n.bg&=-67108864,n.bg|=lt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${G.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${G.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(`${G.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=lt.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(!Hg(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(`${G.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Wg&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Wg&&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(Kg(s))if(i==="?")t.push({type:0,index:s});else{let o=$g(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=$g(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]);Kg(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,oi),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(M4[e[0]],mt[e[1]]||oi),!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=lt.clone(),this._eraseAttrDataInternal=lt.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 Nr;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(`${G.ESC}${o}${G.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)}},Xh=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&&(Vg=e,e=t,t=Vg),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Xh=nt([ue(0,Vt)],Xh);function Kg(e){return 0<=e&&e<256}var j4=5e7,qg=12,B4=50,O4=class extends Le{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 oe),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>j4)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>=qg?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>=qg)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>B4&&(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()}},Gh=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)))}};Gh=nt([ue(0,Vt)],Gh);var Yg=!1,z4=class extends Le{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new hs),this._onBinary=this._register(new oe),this.onBinary=this._onBinary.event,this._onData=this._register(new oe),this.onData=this._onData.event,this._onLineFeed=this._register(new oe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new oe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new oe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new oe),this._instantiationService=new c4,this.optionsService=this._register(new y4(e)),this._instantiationService.setService(Kt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Vh)),this._instantiationService.setService(Vt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Uh)),this._instantiationService.setService(lx,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Kh)),this._instantiationService.setService(Ti,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(qh)),this._instantiationService.setService(ox,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(hi)),this._instantiationService.setService(sT,this.unicodeService),this._charsetService=this._instantiationService.createInstance(k4),this._instantiationService.setService(iT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Gh),this._instantiationService.setService(ax,this._oscLinkService),this._inputHandler=this._register(new A4(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Tt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Tt.forward(this._bufferService.onResize,this._onResize)),this._register(Tt.forward(this.coreService.onData,this._onData)),this._register(Tt.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 O4((t,r)=>this._inputHandler.parse(t,r))),this._register(Tt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new oe),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&&!Yg&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Yg=!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,Fx),t=Math.max(t,$x),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(zg.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(zg(this._bufferService),!1))),this._windowsWrappingHeuristics.value=qe(()=>{for(let t of e)t.dispose()})}}},F4={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 $4(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=G.ESC+"OA":i.key=G.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=G.ESC+"OD":i.key=G.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=G.ESC+"OC":i.key=G.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=G.ESC+"OB":i.key=G.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":G.DEL,e.altKey&&(i.key=G.ESC+i.key);break;case 9:if(e.shiftKey){i.key=G.ESC+"[Z";break}i.key=G.HT,i.cancel=!0;break;case 13:i.key=e.altKey?G.ESC+G.CR:G.CR,i.cancel=!0;break;case 27:i.key=G.ESC,e.altKey&&(i.key=G.ESC+G.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=G.ESC+"[1;"+(s+1)+"D":t?i.key=G.ESC+"OD":i.key=G.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=G.ESC+"[1;"+(s+1)+"C":t?i.key=G.ESC+"OC":i.key=G.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=G.ESC+"[1;"+(s+1)+"A":t?i.key=G.ESC+"OA":i.key=G.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=G.ESC+"[1;"+(s+1)+"B":t?i.key=G.ESC+"OB":i.key=G.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=G.ESC+"[2~");break;case 46:s?i.key=G.ESC+"[3;"+(s+1)+"~":i.key=G.ESC+"[3~";break;case 36:s?i.key=G.ESC+"[1;"+(s+1)+"H":t?i.key=G.ESC+"OH":i.key=G.ESC+"[H";break;case 35:s?i.key=G.ESC+"[1;"+(s+1)+"F":t?i.key=G.ESC+"OF":i.key=G.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=G.ESC+"[5;"+(s+1)+"~":i.key=G.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=G.ESC+"[6;"+(s+1)+"~":i.key=G.ESC+"[6~";break;case 112:s?i.key=G.ESC+"[1;"+(s+1)+"P":i.key=G.ESC+"OP";break;case 113:s?i.key=G.ESC+"[1;"+(s+1)+"Q":i.key=G.ESC+"OQ";break;case 114:s?i.key=G.ESC+"[1;"+(s+1)+"R":i.key=G.ESC+"OR";break;case 115:s?i.key=G.ESC+"[1;"+(s+1)+"S":i.key=G.ESC+"OS";break;case 116:s?i.key=G.ESC+"[15;"+(s+1)+"~":i.key=G.ESC+"[15~";break;case 117:s?i.key=G.ESC+"[17;"+(s+1)+"~":i.key=G.ESC+"[17~";break;case 118:s?i.key=G.ESC+"[18;"+(s+1)+"~":i.key=G.ESC+"[18~";break;case 119:s?i.key=G.ESC+"[19;"+(s+1)+"~":i.key=G.ESC+"[19~";break;case 120:s?i.key=G.ESC+"[20;"+(s+1)+"~":i.key=G.ESC+"[20~";break;case 121:s?i.key=G.ESC+"[21;"+(s+1)+"~":i.key=G.ESC+"[21~";break;case 122:s?i.key=G.ESC+"[23;"+(s+1)+"~":i.key=G.ESC+"[23~";break;case 123:s?i.key=G.ESC+"[24;"+(s+1)+"~":i.key=G.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=G.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=G.DEL:e.keyCode===219?i.key=G.ESC:e.keyCode===220?i.key=G.FS:e.keyCode===221&&(i.key=G.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let l=(o=F4[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)i.key=G.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=G.ESC+c}else if(e.keyCode===32)i.key=G.ESC+(e.ctrlKey?G.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),i.key=G.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=G.US),e.key==="@"&&(i.key=G.NUL));break}return i}var it=0,W4=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ka,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ka,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||(it=this._search(t),it===-1)||this._getKey(this._array[it])!==t)return!1;do if(this._array[it]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(it),!0;while(++it<this._array.length&&this._getKey(this._array[it])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((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&&(it=this._search(e),!(it<0||it>=this._array.length)&&this._getKey(this._array[it])===e))do yield this._array[it];while(++it<this._array.length&&this._getKey(this._array[it])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(it=this._search(e),!(it<0||it>=this._array.length)&&this._getKey(this._array[it])===e))do t(this._array[it]);while(++it<this._array.length&&this._getKey(this._array[it])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let n=t+r>>1,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}},nu=0,Xg=0,H4=class extends Le{constructor(){super(),this._decorations=new W4(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new oe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new oe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(qe(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new U4(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=>{nu=i.options.x??0,Xg=nu+(i.options.width??1),e>=nu&&e<Xg&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},U4=class extends Hn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new oe),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new oe),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ge.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ge.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},V4=1e3,K4=class{constructor(e,t=V4){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)}},Gg=20,Ca=class extends Le{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 K4(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
|
+
`))),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(ke(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(qe(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Gg+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
134
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Gg+1&&(this._liveRegion.textContent+=gh.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 h=a instanceof Text?a.parentNode:a,u=parseInt(h==null?void 0:h.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(h);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&&(++u,p=0),{row:u,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})`}};Ca=nt([ue(1,_f),ue(2,vn),ue(3,yn)],Ca);var Qh=class extends Le{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 oe),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new oe),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(qe(()=>{var s;Si(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(ke(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ke(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ke(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ke(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,h;if(this._isMouseOut)return;let a=l==null?void 0:l.map(u=>({link:u}));(c=this._activeProviderReplies)==null||c.set(s,a),r=this._checkLinkProviderResult(s,e,r),((h=this._activeProviderReplies)==null?void 0:h.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&&q4(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,Si(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}}};Qh=nt([ue(1,vf),ue(2,yn),ue(3,Vt),ue(4,ux)],Qh);function q4(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 Y4=class extends z4{constructor(e={}){super(e),this._linkifier=this._register(new hs),this.browser=Lx,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new hs),this._onCursorMove=this._register(new oe),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new oe),this.onKey=this._onKey.event,this._onRender=this._register(new oe),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new oe),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new oe),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new oe),this.onBell=this._onBell.event,this._onFocus=this._register(new oe),this._onBlur=this._register(new oe),this._onA11yCharEmitter=this._register(new oe),this._onA11yTabEmitter=this._register(new oe),this._onWillOpen=this._register(new oe),this._setup(),this._decorationService=this._instantiationService.createInstance(H4),this._instantiationService.setService(Ko,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(BL),this._instantiationService.setService(ux,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(vh)),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(Tt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Tt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Tt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Tt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(qe(()=>{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=Ue.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${G.ESC}]${n};${R4(i)}${Nx.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=at.toColor(...t.color));else{let s=r;this._themeService.modifyColors(o=>o[s]=at.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ca,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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(G.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(ke(this.element,"copy",t=>{this.hasSelection()&&Z3(t,this._selectionService)}));let e=t=>J3(t,this.textarea,this.coreService,this.optionsService);this._register(ke(this.textarea,"paste",e)),this._register(ke(this.element,"paste",e)),Px?this._register(ke(this.element,"mousedown",t=>{t.button===2&&og(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ke(this.element,"contextmenu",t=>{og(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Ef&&this._register(ke(this.element,"auxclick",t=>{t.button===1&&tx(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ke(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ke(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ke(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ke(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ke(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ke(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ke(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(ke(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",mh.get()),Rx||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(AL,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(vn,this._coreBrowserService),this._register(ke(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(ke(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(zh,this._document,this._helperContainer),this._instantiationService.setService(Za,this._charSizeService),this._themeService=this._instantiationService.createInstance(Hh),this._instantiationService.setService(ys,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Sa),this._instantiationService.setService(cx,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance($h,this.rows,this.screenElement)),this._instantiationService.setService(yn,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(jh,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Fh),this._instantiationService.setService(vf,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(Qh,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(Mh,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(Wh,this.element,this.screenElement,n)),this._instantiationService.setService(lT,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(Tt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(Ah,this.screenElement)),this._register(ke(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(Ca,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(wa,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(wa,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Oh,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,h,u,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=(u=(h=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:h.device)==null?void 0:u.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(ke(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(ke(t,"wheel",s=>{var o,l,a,c,h;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,(h=e._coreBrowserService)==null?void 0:h.dpr)===0)return this.cancel(s,!0);let u=G.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!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){ex(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=$4(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===G.ETX||r.key===G.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)&&(X4(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(lt));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(G.ESC+"[I"):this.coreService.triggerDataEvent(G.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(`${G.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(`${G.ESC}[6;${i};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function X4(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var G4=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)}},Q4=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 Nr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},Qg=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 Q4(t)}getNullCell(){return new Nr}},Z4=class extends Le{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new oe),this.onBufferChange=this._onBufferChange.event,this._normal=new Qg(this._core.buffers.normal,"normal"),this._alternate=new Qg(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)}},J4=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)}},eP=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}},tP=["cols","rows"],Ur=0,rP=class extends Le{constructor(e){super(),this._core=this._register(new Y4(e)),this._addonManager=this._register(new G4),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(tP.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 J4(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new eP(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 Z4(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
|
+
`,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 mh.get()},set promptLabel(e){mh.set(e)},get tooMuchOutput(){return gh.get()},set tooMuchOutput(e){gh.set(e)}}}_verifyIntegers(...e){for(Ur of e)if(Ur===1/0||isNaN(Ur)||Ur%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ur of e)if(Ur&&(Ur===1/0||isNaN(Ur)||Ur%1!==0||Ur<0))throw new Error("This API only accepts positive integers")}};/**
|
|
136
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
137
|
+
* @license MIT
|
|
138
|
+
*
|
|
139
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
140
|
+
* @license MIT
|
|
141
|
+
*
|
|
142
|
+
* Originally forked from (with the author's permission):
|
|
143
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
144
|
+
* http://bellard.org/jslinux/
|
|
145
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
146
|
+
*/var nP=2,iP=1,sP=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var u;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((u=this._terminal.options.overviewRuler)==null?void 0:u.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),i=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),o={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},l=o.top+o.bottom,a=o.right+o.left,c=n-l,h=i-a-t;return{cols:Math.max(nP,Math.floor(h/e.css.cell.width)),rows:Math.max(iP,Math.floor(c/e.css.cell.height))}}};/**
|
|
147
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
148
|
+
* @license MIT
|
|
149
|
+
*
|
|
150
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
151
|
+
* @license MIT
|
|
152
|
+
*
|
|
153
|
+
* Originally forked from (with the author's permission):
|
|
154
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
155
|
+
* http://bellard.org/jslinux/
|
|
156
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
157
|
+
*/var oP=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){let r=aP.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 lP(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 aP=class Hl{static computeLink(t,r,n,i){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=Hl._getWindowedLineStrings(t-1,n),a=o.join(""),c,h=[];for(;c=s.exec(a);){let u=c[0];if(!lP(u))continue;let[f,p]=Hl._mapStrIdx(n,l,0,c.index),[m,g]=Hl._mapStrIdx(n,f,p,u.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}};h.push({range:S,text:u,activate:i})}return h}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 h=o.getChars();if(o.getWidth()&&(i-=h.length||1,c===a.length-1&&h==="")){let u=s.getLine(r+1);u&&u.isWrapped&&(u.getCell(0,o),o.getWidth()===2&&(i+=1))}if(i<0)return[r,c]}r++,l=0}return[r,l]}},cP=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function uP(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 hP=class{constructor(e=uP,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||cP;this._linkProvider=this._terminal.registerLinkProvider(new oP(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const Zg={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"},Hx=w.forwardRef(({onInput:e,onResize:t,fontSize:r=13},n)=>{const i=w.useRef(null),s=w.useRef(null),o=w.useRef(null),[l,a]=w.useState(!1);return w.useImperativeHandle(n,()=>({write:c=>{var h;(h=s.current)==null||h.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 h=s.current;if(!h)return;const u=h.cols,f=h.rows;t==null||t(u+5,f),setTimeout(()=>{t==null||t(u,f)},100)}catch{}}})),w.useEffect(()=>{if(!i.current)return;const c=new rP({cursorBlink:!0,cursorStyle:"bar",fontSize:r,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:Zg,allowTransparency:!0,scrollback:5e3,convertEol:!1}),h=new sP,u=new hP;c.loadAddon(h),c.loadAddon(u),c.open(i.current),requestAnimationFrame(()=>{h.fit(),t==null||t(c.cols,c.rows),a(!0)});const f=c.onData(m=>{e(m)}),p=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{h.fit(),t==null||t(c.cols,c.rows)}catch{}})});return p.observe(i.current),s.current=c,o.current=h,()=>{f.dispose(),p.disconnect(),c.dispose(),s.current=null,o.current=null}},[r]),d.jsx("div",{ref:i,className:"w-full h-full rounded-lg overflow-hidden transition-opacity duration-200",style:{background:Zg.background,opacity:l?1:0}})});Hx.displayName="CliTerminal";function Jg({label:e,value:t,sub:r,icon:n}){return d.jsxs("div",{className:"px-4 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[d.jsx("span",{className:"text-base flex items-center",children:n}),d.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wide font-semibold",children:e})]}),d.jsx("div",{className:"text-[22px] font-bold text-text-primary tracking-tight",children:t}),r&&d.jsx("div",{className:"text-[11px] text-text-muted mt-0.5",children:r})]})}function e_({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?d.jsxs("div",{className:"flex-1",children:[d.jsxs("div",{className:"flex justify-between mb-0.5",children:[d.jsx("span",{className:"text-[9px] text-text-muted uppercase tracking-wide font-semibold",children:r}),d.jsxs("span",{className:"text-[10px] text-text-secondary font-semibold",children:[o,"%"]})]}),d.jsx("div",{className:"h-1 bg-white/[0.04] rounded-sm overflow-hidden",children:d.jsx("div",{className:"h-full rounded-sm transition-[width] duration-500",style:{width:`${o}%`,background:l}})})]}):d.jsxs("div",{className:"flex-1",children:[d.jsxs("div",{className:"flex justify-between mb-1.5",children:[d.jsx("span",{className:"text-[11px] text-text-secondary font-medium",children:r}),d.jsxs("span",{className:"text-[13px] text-text-primary font-bold",children:[o,"%"]})]}),d.jsx("div",{className:"h-1.5 bg-white/[0.04] rounded-sm overflow-hidden",children:d.jsx("div",{className:"h-full rounded-sm transition-[width] duration-[600ms]",style:{width:`${o}%`,background:`linear-gradient(90deg, ${l}, ${l}cc)`}})}),i&&d.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:i})]})}function dP({screenshot:e,isCapturing:t,onRefresh:r,onAction:n,addLog:i,connState:s,connScreenshot:o}){const l=w.useRef(null),a=w.useRef(null),c=w.useRef(null),[h,u]=w.useState(!0),[f,p]=w.useState(2e3),[m,g]=w.useState(null),[S,_]=w.useState(""),[,y]=w.useState(!1),[x,N]=w.useState(!1),[T,C]=w.useState(!1),R=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[O,z]=w.useState(R?"mouse":"touch"),[E,H]=w.useState(1),[A,M]=w.useState(0),[V,L]=w.useState(0),j=w.useRef(0),q=w.useRef(t),P=w.useRef(r),$=w.useRef(n),b=w.useRef(null),ne=w.useRef(null),ce=w.useRef(!1),k=w.useRef(null),_e=w.useRef(0),X=w.useRef(null),te=w.useRef(1),Y=w.useRef({x:0,y:0}),le=w.useRef(E),fe=w.useRef(A),me=w.useRef(V),ye=w.useRef(O);w.useEffect(()=>{q.current=t},[t]),w.useEffect(()=>{P.current=r},[r]),w.useEffect(()=>{le.current=E},[E]),w.useEffect(()=>{fe.current=A},[A]),w.useEffect(()=>{me.current=V},[V]),w.useEffect(()=>{$.current=n},[n]),w.useEffect(()=>{ye.current=O},[O]),w.useEffect(()=>{var ie;(ie=l.current)==null||ie.focus()},[]);const xe=s==="connected",Ce=s!=="connected"&&s!=="connecting",F=xe&&o?o:e;w.useEffect(()=>{E<=1&&(M(0),L(0))},[E]);const mr=(ie,pe,I)=>{if(I<=1)return{x:0,y:0};const U=(I-1)/(2*I)*100,Q=(I-1)/(2*I)*100;return{x:Math.max(-U,Math.min(U,ie)),y:Math.max(-Q,Math.min(Q,pe))}};w.useEffect(()=>{if(!h||!Ce)return;let ie=null;const pe=()=>{ie&&clearInterval(ie),!document.hidden&&(ie=setInterval(()=>{var U;if(!q.current){const Q=((U=l.current)==null?void 0:U.clientWidth)||0,ge=Math.max(400,Math.ceil(Q/100)*100);P.current(ge)}},f))},I=()=>{document.hidden?(ie&&clearInterval(ie),ie=null):pe()};return pe(),document.addEventListener("visibilitychange",I),()=>{ie&&clearInterval(ie),document.removeEventListener("visibilitychange",I)}},[h,Ce,f]);const Pr=(ie,pe)=>{if(!c.current)return null;const I=c.current.getBoundingClientRect();return!I.width||!I.height?null:{nx:Math.max(0,Math.min(1,(ie-I.left)/I.width)),ny:Math.max(0,Math.min(1,(pe-I.top)/I.height))}},Dt=async ie=>{var I;const pe=Pr(ie.clientX,ie.clientY);if(pe){g(`Click: ${Math.round(pe.nx*100)}%, ${Math.round(pe.ny*100)}%`),(I=l.current)==null||I.focus();try{const U=await n("input_click",{nx:pe.nx,ny:pe.ny});U!=null&&U.success||i(`โ Click failed: ${U==null?void 0:U.error}`)}catch(U){i(`โ Click error: ${U.message||U}`)}}},$r=async(ie,pe,I,U=0)=>{try{await n("input_key",{type:I?"char":"keyDown",key:ie,code:pe,text:I?ie:void 0,unmodifiedText:I?ie:void 0,modifiers:U})}catch(Q){i(`โ Key error: ${Q.message||Q}`)}},nr=async ie=>{if(ie.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(ie.key)&&ie.preventDefault();let I=0;ie.altKey&&(I|=1),ie.ctrlKey&&(I|=2),ie.metaKey&&(I|=4),ie.shiftKey&&(I|=8),g(`Key: ${ie.key}`),await $r(ie.key,ie.code,ie.key.length===1,I)},gr=async ie=>{if(ie.key==="Enter"){if(ie.nativeEvent.isComposing)return;if(S){const pe=S;_(""),g(`IME Sent: ${pe}`);try{const I=await n("input_type",{text:pe});I!=null&&I.success||i(`โ IME error: ${I==null?void 0:I.error}`)}catch(I){i(`โ IME error: ${I.message}`)}}else g("Key: Enter"),await $r("Enter","Enter",!1)}};w.useEffect(()=>{const ie=l.current;if(!ie)return;const pe=I=>{var U;if((U=c.current)!=null&&U.contains(I.target)){I.preventDefault();const Q=Date.now();if(Q-j.current<40)return;j.current=Q;const ge=Pr(I.clientX,I.clientY);if(!ge)return;g(`Scroll: ${Math.round(I.deltaY)}`),n("input_wheel",{nx:ge.nx,ny:ge.ny,deltaX:Math.round(I.deltaX),deltaY:Math.round(I.deltaY)}).catch(()=>{})}};return ie.addEventListener("wheel",pe,{passive:!1}),()=>ie.removeEventListener("wheel",pe)},[n]);const[qt,kt]=w.useState(null),Ct=w.useRef(null);return w.useEffect(()=>{if(O==="mouse"&&!Ct.current){const ie={nx:.5,ny:.5};Ct.current=ie,kt(ie)}},[O]),w.useEffect(()=>{const ie=l.current;if(!ie)return;const pe=de=>{if(!c.current)return null;const D=c.current.getBoundingClientRect();return!D.width||!D.height?null:{nx:Math.max(0,Math.min(1,(de.clientX-D.left)/D.width)),ny:Math.max(0,Math.min(1,(de.clientY-D.top)/D.height))}},I=(de,D)=>{if(!c.current)return{dnx:0,dny:0};const B=c.current,W=B.getBoundingClientRect(),ee=B.naturalWidth||W.width,Z=B.naturalHeight||W.height,ae=ee/Z,J=W.width/W.height;let Se,Ee;return ae>J?(Se=W.width,Ee=W.width/ae):(Ee=W.height,Se=W.height*ae),{dnx:de/Se,dny:D/Ee}},U=(de,D,B)=>{if(B<=1.05)return;const W=-(de-.5)*100,ee=-(D-.5)*100,Z=mr(W,ee,B);(Math.abs(Z.x-fe.current)>.1||Math.abs(Z.y-me.current)>.1)&&(M(Z.x),L(Z.y),fe.current=Z.x,me.current=Z.y)},Q=de=>{if(de.preventDefault(),de.touches.length===1){const D=de.touches[0];b.current={x:D.clientX,y:D.clientY,time:Date.now()},ne.current={x:D.clientX,y:D.clientY},ce.current=!1,k.current=setTimeout(()=>{if(!ce.current)if(ce.current=!0,ye.current==="mouse"){const B=Ct.current||{nx:.5,ny:.5};g("Right Click"),$.current("input_click",{...B,button:"right"}).catch(()=>{})}else{const B=pe(D);B&&(g("Right Click"),$.current("input_click",{...B,button:"right"}).catch(()=>{}))}},500)}else if(de.touches.length===2){clearTimeout(k.current),ce.current=!0;const D=de.touches[1].clientX-de.touches[0].clientX,B=de.touches[1].clientY-de.touches[0].clientY;X.current=Math.sqrt(D*D+B*B),te.current=le.current,Y.current={x:(de.touches[0].clientX+de.touches[1].clientX)/2,y:(de.touches[0].clientY+de.touches[1].clientY)/2}}},ge=de=>{if(de.preventDefault(),de.touches.length===1&&ne.current){const D=de.touches[0],B=D.clientX-ne.current.x,W=D.clientY-ne.current.y;if(!ce.current&&(Math.abs(B)>10||Math.abs(W)>10)&&(ce.current=!0,clearTimeout(k.current)),ce.current)if(ye.current==="mouse"){const ee=I(B,W),Z=Ct.current||{nx:.5,ny:.5},ae=Math.max(0,Math.min(1,Z.nx+ee.dnx)),J=Math.max(0,Math.min(1,Z.ny+ee.dny));Ct.current={nx:ae,ny:J},kt({nx:ae,ny:J}),g(`Cursor: ${Math.round(ae*100)}%, ${Math.round(J*100)}%`),U(ae,J,le.current);const Se=Date.now();Se-j.current>=30&&(j.current=Se,$.current("input_mouseMoved",{nx:ae,ny:J}).catch(()=>{}))}else if(le.current>1){const ee=a.current;if(ee){const Z=ee.clientWidth,ae=ee.clientHeight,J=fe.current+B/Z*100,Se=me.current+W/ae*100,Ee=mr(J,Se,le.current);M(Ee.x),L(Ee.y),fe.current=Ee.x,me.current=Ee.y}}else{const ee=pe(D);if(ee){const Z=Date.now();Z-j.current>=40&&(j.current=Z,g("Scroll"),$.current("input_wheel",{nx:ee.nx,ny:ee.ny,deltaX:Math.round(-B*2.5),deltaY:Math.round(-W*2.5)}).catch(()=>{}))}}ne.current={x:D.clientX,y:D.clientY}}else if(de.touches.length===2&&X.current!==null){const D=de.touches[1].clientX-de.touches[0].clientX,B=de.touches[1].clientY-de.touches[0].clientY,ee=Math.sqrt(D*D+B*B)/X.current,Z=(de.touches[0].clientX+de.touches[1].clientX)/2,ae=(de.touches[0].clientY+de.touches[1].clientY)/2,J=Z-Y.current.x,Se=ae-Y.current.y,Ee=Math.abs(ee-1)>.03;if(ye.current==="mouse"){if(Ee){const Re=Math.max(.5,Math.min(5,te.current*ee));H(Re),le.current=Re}else if(Math.abs(J)>2||Math.abs(Se)>2){const Re=Ct.current||{nx:.5,ny:.5},ze=Date.now();ze-j.current>=30&&(j.current=ze,g("Scroll"),$.current("input_wheel",{nx:Re.nx,ny:Re.ny,deltaX:Math.round(-J*3),deltaY:Math.round(-Se*3)}).catch(()=>{}))}}else{const Re=Math.max(.5,Math.min(5,te.current*ee));H(Re),le.current=Re;const ze=a.current;if(ze&&Re>1){const Qn=ze.clientWidth,_r=ze.clientHeight,ws=fe.current+J/Qn*100,rn=me.current+Se/_r*100,Li=mr(ws,rn,Re);M(Li.x),L(Li.y),fe.current=Li.x,me.current=Li.y}}Y.current={x:Z,y:ae}}},Pe=de=>{var D;if(clearTimeout(k.current),X.current=null,de.touches.length===0&&de.changedTouches.length===1&&!ce.current){const B=de.changedTouches[0],W=Date.now();if(W-(((D=b.current)==null?void 0:D.time)||0)<40)return;if(ye.current==="mouse"){const Z=Ct.current||pe(B);Z&&(g(`Click: ${Math.round(Z.nx*100)}%, ${Math.round(Z.ny*100)}%`),$.current("input_click",{...Z}).catch(()=>{}))}else{const Z=pe(B);if(!Z)return;W-_e.current<300?(g("Double tap"),$.current("input_click",{...Z,clickCount:2}).catch(()=>{}),_e.current=0):(g(`Tap: ${Math.round(Z.nx*100)}%, ${Math.round(Z.ny*100)}%`),$.current("input_click",{...Z}).catch(()=>{}),_e.current=W)}}ce.current=!1};return ie.addEventListener("touchstart",Q,{passive:!1}),ie.addEventListener("touchmove",ge,{passive:!1}),ie.addEventListener("touchend",Pe,{passive:!1}),()=>{ie.removeEventListener("touchstart",Q),ie.removeEventListener("touchmove",ge),ie.removeEventListener("touchend",Pe),clearTimeout(k.current)}},[]),d.jsxs("div",{ref:l,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:nr,onContextMenu:ie=>ie.preventDefault(),onFocus:()=>y(!0),onBlur:()=>y(!1),tabIndex:0,children:[d.jsxs("div",{ref:a,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[F?d.jsx("img",{ref:c,src:F,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${E}) translate(${A}%, ${V}%)`,transformOrigin:"center center",cursor:O==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:Dt,onContextMenu:ie=>ie.preventDefault(),onDragStart:ie=>ie.preventDefault()}):d.jsxs("div",{className:"text-slate-800 text-center",children:[d.jsx("div",{className:"text-5xl mb-3",children:"๐"}),d.jsx("div",{className:"text-[13px] font-semibold",children:"Connecting to Host..."})]}),O==="mouse"&&qt&&F&&c.current&&(()=>{var Se;const ie=c.current,pe=ie.getBoundingClientRect(),I=(Se=a.current)==null?void 0:Se.getBoundingClientRect();if(!I)return null;const U=ie.naturalWidth||pe.width,Q=ie.naturalHeight||pe.height,ge=U/Q,Pe=pe.width/pe.height;let de,D,B,W;ge>Pe?(de=pe.width,D=pe.width/ge,B=0,W=(pe.height-D)/2):(D=pe.height,de=pe.height*ge,B=(pe.width-de)/2,W=0);const ee=pe.left-I.left+B+de*qt.nx,Z=pe.top-I.top+W+D*qt.ny,ae=Math.max(8,Math.min(I.width-8,ee)),J=Math.max(8,Math.min(I.height-8,Z));return d.jsxs("div",{style:{position:"absolute",left:ae-8,top:J-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[d.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),d.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),d.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)"}})]})})()]}),d.jsxs("div",{onTouchStart:ie=>ie.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:[d.jsxs("div",{onClick:()=>{z(ie=>{const pe=ie==="touch"?"mouse":"touch";if(pe==="mouse"&&!Ct.current){const I={nx:.5,ny:.5};Ct.current=I,kt(I)}return pe})},className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${O==="mouse"?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:[d.jsx("span",{className:"text-sm",children:O==="mouse"?"๐ฑ๏ธ":"๐"}),d.jsx("span",{className:`text-[10px] font-bold ${O==="mouse"?"text-blue-400":"text-slate-400"}`,children:O==="mouse"?"Mouse":"Touch"})]}),d.jsxs("div",{className:"relative",children:[d.jsx("div",{onClick:()=>{C(!T),N(!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:d.jsx("span",{className:"text-sm",children:"โจ๏ธ"})}),T&&d.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:d.jsx("input",{type:"text",placeholder:"Type & Enter...",value:S,autoFocus:!0,onTouchStart:ie=>ie.stopPropagation(),onChange:ie=>_(ie.target.value),onKeyDown:gr,className:"w-full bg-black/60 border border-white/15 rounded-lg px-2.5 py-2 text-white text-[13px] outline-none"})})]}),d.jsx("div",{className:"relative",children:d.jsx("div",{onClick:()=>{N(!x),C(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${x?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:d.jsx("span",{className:"text-sm",children:"โ๏ธ"})})}),d.jsx("div",{className:"w-px h-[18px] bg-white/10"}),d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 rounded-md",style:{background:xe?"rgba(16,185,129,0.12)":"rgba(251,191,36,0.12)"},children:[d.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:xe?"#10b981":"#fbbf24"}}),d.jsx("span",{className:"text-[8px] font-extrabold",style:{color:xe?"#10b981":"#fbbf24"},children:xe?"Connected":"WS"})]}),E>1&&d.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(E*100),"%"]}),m&&d.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:m})]})]}),x&&d.jsxs("div",{onTouchStart:ie=>ie.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:[d.jsx("div",{style:{fontSize:9,fontWeight:900,color:"#3b82f6",letterSpacing:1.5},children:"SETTINGS"}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[d.jsxs("div",{style:{fontSize:10,color:"#888",fontWeight:700},children:["ZOOM: ",E===1?"FIT":`${Math.round(E*100)}%`]}),d.jsxs("div",{style:{display:"flex",gap:4},children:[d.jsx("button",{onClick:ie=>{ie.stopPropagation(),H(pe=>Math.max(.5,pe-.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:"โ"}),d.jsx("button",{onClick:ie=>{ie.stopPropagation(),H(1),M(0),L(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:"FIT"}),d.jsx("button",{onClick:ie=>{ie.stopPropagation(),H(pe=>Math.min(5,pe+.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:"+"})]})]}),d.jsx("button",{onClick:ie=>{var U;ie.stopPropagation();const pe=((U=l.current)==null?void 0:U.clientWidth)||0,I=pe>0?Math.max(400,Math.ceil(pe/100)*100):void 0;r(I)},style:{width:"100%",background:"#3b82f6",color:"#fff",border:"none",padding:"8px",borderRadius:6,fontSize:11,fontWeight:800,cursor:"pointer"},children:"FORCE SYNC"}),d.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(255,255,255,0.05)",padding:"6px 10px",borderRadius:6},children:[d.jsx("span",{style:{fontSize:10,color:"#888",fontWeight:700},children:"AUTO REF."}),d.jsx("input",{type:"checkbox",checked:h,onChange:ie=>u(ie.target.checked)})]}),d.jsxs("select",{value:f,onChange:ie=>p(Number(ie.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:[d.jsx("option",{value:500,children:"0.5s Interval"}),d.jsx("option",{value:1e3,children:"1.0s Interval"}),d.jsx("option",{value:2e3,children:"2.0s Interval"}),d.jsx("option",{value:4e3,children:"4.0s Interval"})]})]}),d.jsx("style",{children:`
|
|
158
|
+
@keyframes slideUp {
|
|
159
|
+
from { opacity: 0; transform: translateY(6px); }
|
|
160
|
+
to { opacity: 1; transform: translateY(0); }
|
|
161
|
+
}
|
|
162
|
+
@keyframes slideUpSidebar {
|
|
163
|
+
from { opacity: 0; transform: translateY(6px); }
|
|
164
|
+
to { opacity: 1; transform: translateY(0); }
|
|
165
|
+
}
|
|
166
|
+
`})]})}function fP({screenshotUrl:e,mode:t="preview",zoom:r=100,interactive:n=!1,connectionState:i,onDismiss:s,onClickAt:o,onKeyDown:l,badge:a,emptyMessage:c,aspectRatio:h,className:u,style:f}){const p=w.useRef(null),m=w.useCallback(g=>{if(!n||!o||!p.current)return;const S=p.current,_=S.getBoundingClientRect(),y=(g.clientX-_.left)/_.width*S.naturalWidth,x=(g.clientY-_.top)/_.height*S.naturalHeight;o(y,x,S.naturalWidth,S.naturalHeight)},[n,o]);return t==="preview"?e?d.jsxs("div",{className:`relative rounded-xl overflow-hidden border border-border-subtle bg-bg-secondary ${u||""}`,style:{aspectRatio:h||"16/9",...f},children:[d.jsx("img",{ref:p,src:e,alt:"IDE Screenshot",className:"w-full h-full object-cover"}),s&&d.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?d.jsxs("div",{className:`${n?"screenshot-interactive":""} ${u||""} relative h-full flex items-center justify-center overflow-auto`,tabIndex:n?0:void 0,onKeyDown:n?l:void 0,style:f,children:[d.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&&d.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})]}):d.jsxs("div",{className:`flex items-center justify-center flex-col gap-2 h-full text-text-muted ${u||""}`,style:f,children:[d.jsx("p",{className:"text-base",children:c||"๐ฅ Waiting for screenshot stream..."}),i&&d.jsxs("p",{className:"text-[13px] mt-2 opacity-50",children:["P2P: ",i]})]})}function Ux({activeConv:e,onModalButton:t}){const[r,n]=w.useState(null);if(w.useEffect(()=>{n(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=s=>{r||(n(s),t(s))};return d.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&&d.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)}),d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"font-black text-xs flex items-center gap-2",children:[d.jsx(Gy,{size:14})," ",r?"PROCESSING...":"ACTION REQUIRED"]}),d.jsx("div",{className:"flex gap-2 flex-wrap",children:e.modalButtons.map((s,o)=>{const l=s.replace(/[โฅโโงโซโโ]/g,"").trim().toLowerCase(),a=/^(run|approve|accept|yes|allow|always)/.test(l),c=/^(reject|deny|delete|remove|abort)/.test(l),h=r===s,u=r!==null;return d.jsx("button",{onClick:()=>i(s),disabled:u,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${a?"bg-white text-amber-700 font-extrabold":c?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${u&&!h?"opacity-40":"opacity-100"} ${u?"cursor-not-allowed":"cursor-pointer"}`,children:h?"โณ ...":s.replace(/[โฅโโงโซโโ]/g,"").trim()},o)})})]})]})}const yr=new Map;function pP({ideId:e,ideType:t,agentType:r,agentName:n,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var _e;const{sendCommand:a}=Ei(),c=!!(o||l),h=`${e}:${r}`,u=yr.get(h),[f,p]=w.useState(!1),[m,g]=w.useState(!1),[S,_]=w.useState((u==null?void 0:u.models)||[]),[y,x]=w.useState((u==null?void 0:u.modes)||[]),N=X=>X?typeof X=="string"?X:typeof X=="object"?X.name||X.id||JSON.stringify(X):String(X):"",[T,C]=w.useState(N(i)),[R,O]=w.useState(N(s)),[z,E]=w.useState(!1),[H,A]=w.useState(!1),M=w.useRef(0),V=X=>X.map(te=>typeof te=="string"?te:(te==null?void 0:te.name)||(te==null?void 0:te.id)||String(te));w.useEffect(()=>{if(o){const X=o.find(te=>te.category==="model");if(X){const te=V(X.options.map(le=>le.value));_(te),X.currentValue&&C(N(X.currentValue));const Y=yr.get(h)||{models:[],modes:[]};yr.set(h,{...Y,models:te})}}if(l&&l.length>0){const X=V(l.map(Y=>Y.id));x(X);const te=yr.get(h)||{models:[],modes:[]};yr.set(h,{...te,modes:X})}else if(o){const X=o.find(te=>te.category!=="model");if(X){const te=V(X.options.map(le=>le.value));x(te),X.currentValue&&O(N(X.currentValue));const Y=yr.get(h)||{models:[],modes:[]};yr.set(h,{...Y,modes:te})}}},[o,l,h]),w.useEffect(()=>{p(!1),g(!1),C(N(i)),O(N(s));const X=yr.get(h);X?(_(X.models),x(X.modes)):(_([]),x([]))},[e,r]),w.useEffect(()=>{i&&Date.now()>M.current&&C(N(i))},[i]),w.useEffect(()=>{s&&Date.now()>M.current&&O(N(s))},[s]);const L=w.useCallback(async(X,te={})=>{const Y={...te},le=e.split(":");return le.length>=3&&(le[1]==="ide"||le[1]==="cli"||le[1]==="acp")&&(Y._targetInstance=le.slice(2).join(":"),Y._targetType=le[1]),await a(e,X,Y)},[e]),j=async()=>{var X,te;if(S.length>0){p(!f);return}if(c){p(!0);return}E(!0);try{const Y=await L("list_extension_models",{agentType:r,ideType:t}),le=(Y==null?void 0:Y.models)||((X=Y==null?void 0:Y.result)==null?void 0:X.models)||[],fe=V(le);_(fe),Y!=null&&Y.current&&C(N(Y.current)),(te=Y==null?void 0:Y.result)!=null&&te.current&&C(N(Y.result.current));const me=yr.get(h)||{models:[],modes:[]};yr.set(h,{...me,models:fe}),p(!0)}catch{}finally{E(!1)}},q=async()=>{var X,te;if(y.length>0){g(!m);return}if(c){g(!0);return}A(!0);try{const Y=await L("list_extension_modes",{agentType:r,ideType:t}),le=(Y==null?void 0:Y.modes)||((X=Y==null?void 0:Y.result)==null?void 0:X.modes)||[],fe=V(le);x(fe),Y!=null&&Y.current&&O(N(Y.current)),(te=Y==null?void 0:Y.result)!=null&&te.current&&O(N(Y.result.current));const me=yr.get(h)||{models:[],modes:[]};yr.set(h,{...me,modes:fe}),g(!0)}catch{}finally{A(!1)}},P=async X=>{p(!1),C(X),M.current=Date.now()+5e3;try{c?await L("change_model",{agentType:r,ideType:t,model:X}):await L("set_extension_model",{agentType:r,ideType:t,model:X})}catch{}},$=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(X=>X.category!=="model")),b=$?(_e=o==null?void 0:o.find(X=>X.category!=="model"))==null?void 0:_e.configId:void 0,ne=async X=>{g(!1),O(X),M.current=Date.now()+5e3;try{c&&$&&b?await L("set_thought_level",{agentType:r,ideType:t,configId:b,value:X}):c?await L("set_mode",{agentType:r,ideType:t,mode:X}):await L("set_extension_mode",{agentType:r,ideType:t,mode:X})}catch{}},k={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[r]||"#94a3b8";return d.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:[d.jsx("span",{className:"text-[9px] font-bold tracking-wide uppercase opacity-70",style:{color:k},children:n}),d.jsx("span",{className:"text-border-subtle text-[10px]",children:"โ"}),d.jsxs("div",{className:"relative",children:[d.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:T?"var(--text-primary)":"var(--text-muted)"},onClick:j,children:[d.jsx("span",{className:"text-[9px] opacity-60",children:"๐ค"}),z?"...":T||"Model",d.jsx("span",{className:"text-[7px] opacity-50",children:"โผ"})]}),f&&S.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>p(!1)}),d.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:[d.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(X=>d.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:X===T?`${k}18`:"transparent",color:X===T?k:"var(--text-secondary)",fontWeight:X===T?600:400,borderLeft:X===T?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:te=>{te.currentTarget.style.background=`${k}12`},onMouseLeave:te=>{te.currentTarget.style.background=X===T?`${k}18`:"transparent"},onClick:()=>P(X),children:X},X))]})]})]}),d.jsxs("div",{className:"relative",children:[d.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:R?"var(--text-primary)":"var(--text-muted)"},onClick:q,children:[d.jsx("span",{className:"text-[9px] opacity-60",children:$?"๐ง ":"โก"}),H?"...":R||($?"Thinking":"Mode"),d.jsx("span",{className:"text-[7px] opacity-50",children:"โผ"})]}),m&&y.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>g(!1)}),d.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:[d.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:$?"SELECT THINKING LEVEL":"SELECT MODE"}),y.map(X=>d.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:X===R?`${k}18`:"transparent",color:X===R?k:"var(--text-secondary)",fontWeight:X===R?600:400,borderLeft:X===R?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:te=>{te.currentTarget.style.background=`${k}12`},onMouseLeave:te=>{te.currentTarget.style.background=X===R?`${k}18`:"transparent"},onClick:()=>ne(X),children:X},X))]})]})]})]})}const ar=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),jr=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function Vx({activeConv:e,ides:t,agentInput:r,setAgentInput:n,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a}){const c=w.useRef(null),{sendCommand:h}=Ei(),[u,f]=w.useState([]),[p,m]=w.useState(0),[g,S]=w.useState(!0),[_,y]=w.useState(!1),x=w.useRef("");e.tabKey!==x.current&&(x.current=e.tabKey,f([]),m(0),S(!0));const N=w.useCallback(async()=>{var R,O,z,E,H;if(!(_||!g)){y(!0);try{const A=t.find(P=>P.id===e.ideId),M=(A==null?void 0:A.daemonId)||((R=e.ideId)==null?void 0:R.split(":")[0])||"";if(!M){S(!1);return}const V=e.ideType||e.agentType||"",L=(e.ideId||"").split(":"),j=L.length>=3?L.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:M,agentType:V,instanceId:j,offset:p});const q=await h(M,"chat_history",{agentType:V,offset:p,limit:30,instanceId:j});console.log("[ChatPane] got result:",{count:((O=q.messages)==null?void 0:O.length)||0,hasMore:q.hasMore}),((z=q.messages)==null?void 0:z.length)>0&&(f(P=>[...q.messages,...P]),m(P=>P+q.messages.length)),S(q.hasMore)}catch(A){console.warn("[ChatPane] Failed to load history:",A),!((E=A==null?void 0:A.message)!=null&&E.includes("P2P not available"))&&!((H=A==null?void 0:A.message)!=null&&H.includes("channel not open"))&&S(!1)}finally{y(!1)}}},[_,g,p,t,e]),T=w.useRef(0);w.useEffect(()=>{if(e.messages.length<10&&g&&!_&&u.length===0){const R=T.current;if(R>5)return;const z=setTimeout(()=>{T.current=R+1,N()},R===0?0:2e3);return()=>clearTimeout(z)}else u.length>0&&(T.current=0)},[e.tabKey,e.messages.length,g,_,u.length,N]);const C=(()=>{const R=e.messages.map((E,H)=>{const A=`${e.ideId}-${E.id??`i-${H}`}`;return{...E,receivedAt:E.receivedAt||l[A]||0}});if(u.length===0)return R;const O=new Set(R.map(E=>`${E.role}:${(E.content||"").slice(0,100)}`));return[...u.filter(E=>!O.has(`${E.role}:${(E.content||"").slice(0,100)}`)),...R]})();return d.jsxs(d.Fragment,{children:[d.jsx(Zy,{messages:C,actionLogs:a.filter(R=>R.ideId===e.tabKey).sort((R,O)=>R.timestamp-O.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",isCliMode:ar(e)||jr(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:N,isLoadingMore:_,hasMoreHistory:g,emptyState:e.messages.length===0?e.status==="not_monitored"?d.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[d.jsx("div",{className:"text-3xl opacity-60",children:d.jsx(Qy,{size:28})}),d.jsx("div",{className:"text-[13px] opacity-50",children:"Agent not monitored"}),d.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...":d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(rs,{size:14})," Open ",e.displayPrimary," Panel"]})}),d.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Click to switch monitoring to this agent"})]}):e.status==="panel_hidden"?d.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[d.jsx("div",{className:"text-3xl opacity-60",children:d.jsx(j3,{size:28})}),d.jsx("div",{className:"text-[13px] opacity-50",children:"Panel is not visible in IDE"}),d.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...":d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(rs,{size:14})," Open ",e.displayPrimary," Panel"]})}),d.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}),!ar(e)&&(()=>{const R=t.find(O=>O.id===e.ideId);return d.jsx(pP,{ideId:e.ideId,ideType:e.ideType,agentType:e.streamSource==="agent-stream"?e.agentType:e.ideType,agentName:e.streamSource==="agent-stream"?e.agentName:e.displaySecondary,serverModel:(R==null?void 0:R.currentModel)||void 0,serverMode:(R==null?void 0:R.currentPlan)||void 0,acpConfigOptions:jr(e)?R==null?void 0:R.acpConfigOptions:void 0,acpModes:jr(e)?R==null?void 0:R.acpModes:void 0})})(),d.jsx("div",{className:"dashboard-input-area px-3 py-2.5 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:d.jsxs("div",{className:"flex gap-2.5 items-center",children:[d.jsx("div",{className:"flex-1 relative",children:d.jsx("input",{ref:c,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:R=>n(R.target.value),onPaste:R=>{const O=R.clipboardData.getData("text");O&&n(z=>z+O),R.preventDefault()},onKeyDown:R=>{if(R.key==="Enter"){if(R.nativeEvent.isComposing){R.preventDefault();return}R.preventDefault(),i()}},onBlur:()=>{window.innerWidth<768&&setTimeout(()=>{document.documentElement.scrollTop=0},100)},className:"w-full h-10 rounded-[20px] px-4 bg-bg-secondary border border-border-subtle text-sm text-text-primary"})}),d.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:d.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:d.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function mP({activeConv:e,ptyBuffers:t,terminalRef:r,agentInput:n,setAgentInput:i,handleSendChat:s,handleModalButton:o}){const l=w.useRef(null),{sendCommand:a,sendData:c}=Ei();return d.jsxs(d.Fragment,{children:[d.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:[d.jsx("div",{className:"flex gap-1",children:d.jsx("div",{className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-accent text-white",children:"โฌ Terminal"})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("div",{className:"text-[10px] text-text-muted",children:[e.agentName," โ Terminal"]}),d.jsx("button",{onClick:()=>{if(!r.current||!e)return;const h=t.current.get(e.tabKey);if(h&&h.length>0)for(const u of h)r.current.write(u);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var u;(u=r.current)==null||u.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:"โบ"}),d.jsx("button",{onClick:async()=>{var f;const h=(f=e.ideId)!=null&&f.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";if(!window.confirm(`Stop ${h}?
|
|
167
|
+
This will terminate the CLI process.`))return;const u=e.ideId||e.daemonId||"";try{await a(u,"stop_cli",{cliType:h})}catch(p){console.error("Stop CLI failed:",p)}},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"})]})]}),d.jsx(Ux,{activeConv:e,onModalButton:o}),d.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:d.jsx(Hx,{ref:r,onInput:h=>{var p;const u=e.ideId||e.daemonId||"",f=(p=e.ideId)!=null&&p.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(u,{type:"pty_input",cliType:f,data:h})||a(u,"pty_input",{cliType:f,data:h}).catch(console.error)},onResize:(h,u)=>{var m;const f=e.ideId||e.daemonId||"",p=(m=e.ideId)!=null&&m.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(f,{type:"pty_resize",cliType:p,cols:h,rows:u})||a(f,"pty_resize",{cliType:p,cols:h,rows:u,force:!0}).catch(()=>{})}},e.tabKey)}),d.jsx("div",{className:"px-3 py-2 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:d.jsxs("div",{className:"flex gap-2.5 items-center",children:[d.jsx("div",{className:"flex-1 relative",children:d.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:n,onChange:h=>i(h.target.value),onPaste:h=>{const u=h.clipboardData.getData("text");u&&i(f=>f+u),h.preventDefault()},onKeyDown:h=>{if(h.key==="Enter"){if(h.nativeEvent.isComposing){h.preventDefault();return}h.preventDefault(),s()}},className:"w-full h-9 rounded-[18px] px-4 bg-bg-secondary border border-border-subtle text-[13px] text-text-primary"})}),d.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:d.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:d.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function gP({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 d.jsxs(d.Fragment,{children:[n&&d.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:[d.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?d.jsxs(d.Fragment,{children:["Session expired."," ",d.jsx("a",{href:r,className:"text-inherit underline",children:"Log in again"})]}):"Connection failed โ please restart the server.")]}),t&&e==="connected"&&d.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:[d.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-4 h-4"}),"Connected"]})]})}const iu=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),su=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function _P({activeConv:e,agentCount:t,wsStatus:r,isConnected:n,onOpenHistory:i}){const s=gs(),o=n?"#22c55e":r==="connected"?"#eab308":"#ef4444",l=n?"0 0 4px #22c55e80":r==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480";return d.jsxs("div",{className:"dashboard-header",children:[d.jsx("div",{className:"flex items-center gap-3",children:d.jsxs("div",{className:"leading-tight",children:[d.jsxs("h1",{className:"header-title m-0 flex items-center gap-1.5",children:[d.jsx(gf,{size:18})," Dashboard",d.jsxs("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:[t," Active",d.jsx("span",{className:"inline-block w-[5px] h-[5px] rounded-full ml-1 align-middle",style:{background:o}})]})]}),d.jsxs("div",{className:"header-subtitle text-[11px] items-center gap-1",children:[t," agent",t!==1?"s":""," active",d.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}})]})]})}),d.jsxs("div",{className:"flex gap-2 items-center",children:[e&&!iu(e)&&!su(e)&&d.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:[d.jsx(O3,{size:14})," IDE"]}),e&&!iu(e)&&!su(e)&&d.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:d.jsx(R3,{size:16})}),e&&!iu(e)&&!su(e)&&d.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:d.jsx(lo,{size:16})})]})]})}function Yr(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function vP(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 t_(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function r_(e){return(e.id||"").includes(":cli:")}function n_(e){return(e.id||"").includes(":acp:")}function Zh(e,t){return Yr(e)}function yP(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 xP({activeConv:e,ides:t,isCreatingChat:r,isRefreshingHistory:n,onClose:i,onNewChat:s,onSwitchSession:o,onRefreshHistory:l}){var u;const a=t.find(f=>f.id===e.ideId),c=(a==null?void 0:a.chats)||[],h=(u=a==null?void 0:a.activeChat)==null?void 0:u.id;return d.jsxs("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center",children:[d.jsx("div",{onClick:i,className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),d.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:[d.jsxs("div",{className:"px-6 py-5 border-b border-border-subtle flex justify-between items-center bg-[var(--surface-primary)]",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"m-0 text-lg font-extrabold",children:"Chat History"}),d.jsxs("div",{className:"text-xs text-text-muted mt-0.5",children:[e.displayPrimary," โ ",Yr(e.ideType)]})]}),d.jsx("button",{onClick:i,className:"bg-transparent border-none text-xl text-text-muted cursor-pointer",children:"โ"})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto p-3 bg-bg-primary",children:[d.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=>d.jsxs("div",{onClick:()=>{o(e.ideId,f.id),i()},className:`p-4 rounded-xl mb-2 cursor-pointer border transition-all ${h===f.id?"bg-[var(--bg-glass-hover)] border-accent":"bg-[var(--surface-secondary)] border-border-subtle"}`,children:[d.jsx("div",{className:`font-bold text-sm mb-1 ${h===f.id?"text-[var(--accent-primary-light)]":"text-text-primary"}`,children:f.title||"Untitled Session"}),d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"text-[11px] text-text-muted font-mono",children:[f.id.substring(0,12),"..."]}),h===f.id&&d.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&&d.jsxs("div",{className:"py-10 px-5 text-center text-text-muted",children:[d.jsx("div",{className:"text-3xl mb-3 opacity-60",children:d.jsx(W3,{size:32})}),d.jsx("div",{className:"text-[13px]",children:"No recent chat sessions found."})]})]}),d.jsx("div",{className:"px-5 py-4 bg-[var(--surface-tertiary)] border-t border-border-subtle text-right",children:d.jsx("button",{onClick:l,disabled:n,className:"btn btn-secondary btn-sm rounded-[10px]",children:n?"โ Refreshing...":d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(A3,{size:13})," Refresh History"]})})})]})]})}function wP({sortedConversations:e,activeTabId:t,tabsOverflow:r,tabsContainerRef:n,terminalRef:i,onSelectTab:s,onReorder:o,pinTab:l,clearTabPinTimers:a,retryConnection:c}){const{sendCommand:h}=Ei(),u=w.useRef(null),f=w.useRef(null),p=w.useRef(null),m=w.useRef(null),[g,S]=w.useState(!1),_=w.useCallback((z,E)=>{const H=E.touches[0];p.current={x:H.clientX,y:H.clientY},f.current=z,m.current=setTimeout(()=>{S(!0)},400)},[]),y=w.useCallback(z=>{if(!g||!f.current){m.current&&(clearTimeout(m.current),m.current=null);return}z.preventDefault();const E=z.touches[0],H=n.current;if(!H)return;const A=Array.from(H.querySelectorAll("[data-tabkey]"));for(const M of A){const V=M.getBoundingClientRect();if(E.clientX>=V.left&&E.clientX<=V.right){const L=M.getAttribute("data-tabkey");if(L&&L!==f.current){const j=e.map($=>$.tabKey),q=j.indexOf(f.current),P=j.indexOf(L);if(q!==-1&&P!==-1){const $=[...j];$.splice(q,1),$.splice(P,0,f.current),o($)}}break}}},[g,e,n,o]),x=w.useCallback(()=>{m.current&&(clearTimeout(m.current),m.current=null),S(!1),f.current=null,p.current=null},[]),[N,T]=w.useState(!1),[C,R]=w.useState(!1),O=w.useCallback(()=>{const z=n.current;z&&(T(z.scrollLeft>4),R(z.scrollLeft+z.clientWidth<z.scrollWidth-4))},[n]);return w.useEffect(()=>{const z=n.current;if(!z)return;O(),z.addEventListener("scroll",O,{passive:!0});const E=new ResizeObserver(O);return E.observe(z),()=>{z.removeEventListener("scroll",O),E.disconnect()}},[n,O,e.length]),d.jsxs("div",{className:"relative shrink-0",children:[r&&N&&d.jsx("div",{className:"absolute left-0 top-0 bottom-0 z-[3] w-5 pointer-events-none",style:{background:"linear-gradient(to right, var(--bg-secondary), transparent)"}}),r&&C&&d.jsx("div",{className:"absolute right-0 top-0 bottom-0 z-[3] w-5 pointer-events-none",style:{background:"linear-gradient(to left, var(--bg-secondary), transparent)"}}),d.jsxs("div",{ref:n,className:"dashboard-agent-tabs flex overflow-x-auto overflow-y-visible shrink-0 bg-bg-secondary border-b border-border-subtle pt-1.5 pb-0 gap-1 select-none",onWheel:z=>{const E=n.current;E&&Math.abs(z.deltaY)>Math.abs(z.deltaX)&&(z.preventDefault(),E.scrollLeft+=z.deltaY)},style:{paddingLeft:8,paddingRight:8,scrollbarWidth:"none",WebkitOverflowScrolling:"touch"},children:[e.map((z,E)=>{const H=t===z.tabKey,A=z.status==="working"?"agent-tab-working":z.status==="waiting_approval"?"agent-tab-waiting":"",M=E<9?String(E+1):null,V=z.connectionState==="gave_up";return d.jsxs("div",{"data-tabkey":z.tabKey,className:`${A} shrink-0 px-2.5 py-1.5 rounded-t-lg border-b-0 cursor-grab flex items-center gap-2 transition-all duration-200`,draggable:!0,onDragStart:()=>{u.current=z.tabKey},onDragOver:L=>{L.preventDefault(),L.currentTarget.style.borderLeft="2px solid var(--accent-primary)"},onDragLeave:L=>{L.currentTarget.style.borderLeft=H?"1px solid var(--border-subtle)":"1px solid transparent"},onDrop:L=>{if(L.preventDefault(),L.currentTarget.style.borderLeft=H?"1px solid var(--border-subtle)":"1px solid transparent",!u.current||u.current===z.tabKey)return;const j=e.map(b=>b.tabKey),q=j.indexOf(u.current),P=j.indexOf(z.tabKey);if(q===-1||P===-1)return;const $=[...j];$.splice(q,1),$.splice(P,0,u.current),o($),u.current=null},onDragEnd:()=>{u.current=null},onTouchStart:L=>_(z.tabKey,L),onTouchMove:y,onTouchEnd:x,onClick:()=>{a(),s(z.tabKey),z.streamSource==="agent-stream"&&z.agentType&&(h(z.ideId,"agent_stream_focus",{agentType:z.agentType}).catch(()=>{}),l(z.tabKey,[200,1500])),ar(z)&&setTimeout(()=>{var L,j;(j=(L=i.current)==null?void 0:L.bumpResize)==null||j.call(L)},100)},style:{background:H?"var(--bg-primary)":"var(--bg-glass)",borderTop:H?"1px solid var(--border-subtle)":"1px solid transparent",borderLeft:H?"1px solid var(--border-subtle)":"1px solid transparent",borderRight:H?"1px solid var(--border-subtle)":"1px solid transparent",opacity:g&&f.current===z.tabKey?V?.15:.3:V?H?.6:.3:H?1:.65},children:[z.status==="working"?d.jsx("div",{className:"tab-spinner"}):z.status==="waiting_approval"?d.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400",children:"โฒ"}):z.connectionState==="gave_up"?d.jsx("span",{onClick:L=>{var q;L.stopPropagation();const j=z.daemonId||((q=z.ideId)==null?void 0:q.split(":")[0])||"";c==null||c(j)},title:"Disconnected โ click to reconnect",className:"text-[8px] px-[5px] py-px text-yellow-400 cursor-pointer",children:"โ"}):z.connectionState==="connecting"?d.jsx("span",{className:"text-[8px] px-[5px] py-px text-blue-400",children:"โ"}):z.connectionState==="connected"?d.jsx("span",{className:"text-[8px] px-[5px] py-px text-green-400",children:"โ"}):d.jsx("span",{className:"text-[8px] px-[5px] py-px text-text-muted",children:"โ"}),d.jsxs("div",{className:"min-w-0",children:[d.jsx("div",{className:"text-xs font-bold whitespace-nowrap overflow-hidden text-ellipsis",children:z.displayPrimary}),d.jsxs("div",{className:"text-[8px] opacity-50 flex gap-1 items-center",children:[z.displaySecondary,z.machineName&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"opacity-40",children:"ยท"}),d.jsxs("span",{className:"opacity-70",children:["๐ฅ ",z.machineName]})]})]})]}),M&&d.jsx("span",{className:"text-[9px] opacity-35 font-mono ml-0.5 shrink-0",children:M})]},z.tabKey)}),e.length===0&&d.jsx("div",{className:"p-2 text-xs opacity-40",children:"No active agents online."})]})]})}const i_={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function SP({toasts:e,onDismiss:t,onClickToast:r}){return d.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:e.map(n=>d.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:i_[n.type]||i_.info},onClick:()=>{r&&r(n),t(n.id)},children:n.message},n.id))})}const bP=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function kP(e){var n;const t=(n=e.workspaceFolders)==null?void 0:n[0];return t!=null&&t.name?t.name:((t==null?void 0:t.path)??"").split("/").filter(Boolean).pop()||"Workspace"}function CP(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,h=a.hostname||((s=l.system)==null?void 0:s.hostname)||"",u=c||(h&&h!=="Unknown"?h.replace(/\.local$/,""):null)||`Machine ${(l.id||"").substring(0,6)}`;i[l.id]=u}}return e.flatMap(o=>{var S,_,y,x,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,h=n?n[c]||"new":void 0,u=kP(o),f=Yr(o.type),p=o.agentStreams,m=Array.isArray(p)?p:[],g=bP(o);if(g){const T=Zh(o.type),C=(_=o.agents)==null?void 0:_[0],R=(y=o.activeChat)==null?void 0:y.activeModal,O=R&&Array.isArray(R.buttons)&&R.buttons.length>0,z=(x=o.activeChat)==null?void 0:x.status,E=z==="generating"||z==="loading"||z&&z.toLowerCase()==="thinking",A=O||z==="waiting_approval"?"waiting_approval":E?"working":(C==null?void 0:C.status)||"idle",M=o.activeChat||{title:"",messages:[]};let V=M.title&&String(M.title).trim()?String(M.title).trim():"";const L=(N=o.activeChat)==null?void 0:N.id,j=o.chats;if(L&&Array.isArray(j)&&j.length>0){const ne=j.find(ce=>ce.id===L||ce.id&&String(ce.id)===String(L));ne!=null&&ne.title&&String(ne.title).trim()&&(V=String(ne.title).trim())}const q=M.messages||[],P=t[o.id]||[],$=new Map;q.filter(ne=>ne.role==="user").forEach(ne=>{$.set(ne.content,($.get(ne.content)||0)+1)});const b=P.filter(ne=>{const ce=$.get(ne.content)||0;return ce>0?($.set(ne.content,ce-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:T,agentType:ar(o)||jr(o)?o.type:(C==null?void 0:C.type)||"ide-native",status:A,title:V,messages:[...q,...b],ideType:o.type,workspaceName:u,displayPrimary:V||T||u,displaySecondary:f,cdpconnected:o.cdpconnected,modalButtons:O?R.buttons:void 0,modalMessage:O?R.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,connectionState:h})}if(g&&(ar(o)||jr(o)))return l;for(const T of m){const C=T.activeModal&&Array.isArray(T.activeModal.buttons)&&T.activeModal.buttons.length>0,R=C?"waiting_approval":T.status==="streaming"?"working":T.status,O=`${o.id}:${T.agentType}`,z=T.messages||[],E=t[O]||[],H=new Map;z.filter(M=>M.role==="user").forEach(M=>{H.set(M.content,(H.get(M.content)||0)+1)});const A=E.filter(M=>{const V=H.get(M.content)||0;return V>0?(H.set(M.content,V-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:T.agentName,agentType:T.agentType,status:R,title:"",messages:[...z,...A],ideType:o.type,workspaceName:u,displayPrimary:T.agentName,displaySecondary:f,cdpconnected:o.cdpconnected,modalButtons:C?T.activeModal.buttons:void 0,modalMessage:C?T.activeModal.message:void 0,streamSource:"agent-stream",tabKey:O,machineName:a,connectionState:h})}return l.length===0&&l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:Zh(o.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:o.type,workspaceName:u,displayPrimary:u||f,displaySecondary:f,cdpconnected:o.cdpconnected,streamSource:"native",tabKey:o.id,connectionState:h}),l})}function EP(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function s_(){try{const e=localStorage.getItem("theme");if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function ou(e){return e==="system"?EP():e}function NP(){const[e,t]=w.useState(s_),[r,n]=w.useState(()=>ou(s_()));w.useEffect(()=>{document.documentElement.setAttribute("data-theme",r)},[r]),w.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=w.useCallback(o=>{t(o),n(ou(o));try{localStorage.setItem("theme",o)}catch{}},[]),s=w.useCallback(()=>{t(o=>{const l=o==="dark"?"light":o==="light"?"system":"dark";n(ou(l));try{localStorage.setItem("theme",l)}catch{}return l})},[]);return{theme:r,preference:e,setPreference:i,cycleTheme:s,isDark:r==="dark"}}const o_={dark:"Dark",light:"Light",system:"System"};function TP({collapsed:e}){const{preference:t,cycleTheme:r}=NP(),n=t==="dark"?d.jsx(U3,{size:16}):t==="light"?d.jsx(H3,{size:16}):d.jsx(V3,{size:16});return d.jsxs("div",{className:`nav-item cursor-pointer ${e?"justify-center py-2.5 px-0":""}`,onClick:r,title:`Theme: ${o_[t]} (click to cycle)`,children:[d.jsx("span",{className:"nav-icon",children:n}),!e&&d.jsx("span",{className:"text-xs",children:o_[t]})]})}let LP=W0;function Nf(){return LP()}class PP{constructor(){Ss(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 DP=new PP;class IP{constructor(){Ss(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 Gt=new IP,l_=Gt;const RP={enabled:!0,onApproval:!0,onComplete:!0,onError:!0,throttleMs:5e3};async function MP(){return"Notification"in window?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"}function Kx(){return"Notification"in window&&Notification.permission==="granted"}let ei=null;async function AP(){if(ei!==null)return ei;try{if(!("serviceWorker"in navigator)||!("PushManager"in window))return ei=!1,!1;const e=await navigator.serviceWorker.getRegistration();return e?(ei=!!await e.pushManager.getSubscription(),ei):(ei=!1,!1)}catch{return ei=!1,!1}}function jP(e,t,r){if(Kx())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 BP(e,t={}){const r={...RP,...t},n=w.useRef(new Map),i=w.useRef(0),s=w.useRef(null);w.useEffect(()=>{AP().then(l=>{s.current=l})},[]);const o=w.useCallback((l,a,c)=>{const h=Date.now();h-i.current<r.throttleMs||(i.current=h,jP(l,a,c))},[r.throttleMs]);w.useEffect(()=>{var l;if(!(!r.enabled||!Kx())&&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),h=a.status||"idle",u=a.name||a.id;if(r.onApproval&&h==="waiting_approval"&&c!=="waiting_approval"){const f=((l=a.activeModal)==null?void 0:l.message)||"Action requires your approval";o(`๐ ${u} โ Approval needed`,f.slice(0,120),`approval-${a.id}`)}r.onComplete&&c==="generating"&&h==="idle"&&o(`โ
${u} โ Task complete`,"Agent has finished working",`complete-${a.id}`),r.onError&&h==="error"&&c!=="error"&&o(`โ ๏ธ ${u} โ Error`,"Agent encountered an error",`error-${a.id}`),n.current.set(a.id,h)}}},[e,r.enabled,r.onApproval,r.onComplete,r.onError,o])}function OP(){const{sendCommand:e}=Ei(),t=Nf(),{updateIdeChats:r,screenshotMap:n,setScreenshotMap:i}=t,s=t.ides||[],o=t.toasts||[],l=t.setToasts||(()=>{}),a=t.wsStatus||"connected",c=t.isConnected??!0,h=t.connectionStates||{},u=t.retryConnection,f=t.showReconnected||!1,[p,m]=w.useState(()=>{try{const B=new URLSearchParams(window.location.search).get("activeTab");return B||sessionStorage.getItem("adhdev_dashboard_activeTab")}catch{return null}}),g=w.useCallback(D=>{m(D);try{D?sessionStorage.setItem("adhdev_dashboard_activeTab",D):sessionStorage.removeItem("adhdev_dashboard_activeTab")}catch{}},[]),S=w.useRef([]),[_,y]=w.useState(""),[x,N]=w.useState({}),[T,C]=w.useState(!1),[R,O]=w.useState(!1),[z,E]=w.useState(!1),[H,A]=w.useState([]),[M,V]=w.useState({}),[L,j]=w.useState({}),q=w.useRef(null),P=w.useRef(null),$=w.useRef(null),[b,ne]=w.useState(!1),ce=s.find(D=>D.type==="adhdev-daemon"),k=(ce==null?void 0:ce.detectedIdes)||[],_e=!!ce,X=s.find(D=>(D.type==="adhdev-daemon"||D.daemonMode)&&Array.isArray(D.workspaceActivity)&&D.workspaceActivity.length>0),te=(X==null?void 0:X.workspaceActivity)||[],Y=w.useMemo(()=>{var W,ee;const D=s.filter(Z=>Z.type!=="adhdev-daemon"),B=new Map;for(const Z of D){const ae=B.get(Z.id);if(!ae)B.set(Z.id,Z);else{const J=(((W=ae.workspaceFolders)==null?void 0:W.length)||0)+(ae.activeChat?1:0);((((ee=Z.workspaceFolders)==null?void 0:ee.length)||0)+(Z.activeChat?1:0)>J||(Z.timestamp||0)>(ae.timestamp||0))&&B.set(Z.id,Z)}}return Array.from(B.values())},[s]),le=w.useMemo(()=>{const D=CP(Y,M,s,h),B=Date.now();return D.map(W=>{const ee=L[W.tabKey];return ee&&B-ee<5e3?{...W,messages:[],title:""}:W})},[Y,M,L,s]);w.useEffect(()=>{MP()},[]);const fe=w.useMemo(()=>le.map(D=>({id:D.tabKey,name:D.title||D.agentName||D.ideId,status:D.status,activeModal:D.modalMessage?{message:D.modalMessage,buttons:D.modalButtons}:null})),[le]);BP(fe);const[me,ye]=w.useState(()=>{try{return JSON.parse(sessionStorage.getItem("adhdev_tabOrder")||"[]")}catch{return[]}}),xe=w.useMemo(()=>{if(me.length===0)return le;const D=new Map(me.map((B,W)=>[B,W]));return[...le].sort((B,W)=>{const ee=D.get(B.tabKey)??9999,Z=D.get(W.tabKey)??9999;return ee-Z})},[le,me]);w.useEffect(()=>{const D=$.current;if(!D)return;const B=()=>ne(D.scrollWidth>D.clientWidth+2);B();const W=new ResizeObserver(B);return W.observe(D),D.addEventListener("scroll",B),()=>{W.disconnect(),D.removeEventListener("scroll",B)}},[xe.length]);const Ce=w.useCallback(D=>{ye(D);try{sessionStorage.setItem("adhdev_tabOrder",JSON.stringify(D))}catch{}},[]);w.useEffect(()=>{if(Object.keys(L).length===0)return;const B=setTimeout(()=>{j(W=>{const ee=Date.now(),Z={};for(const[ae,J]of Object.entries(W))ee-J<5e3&&(Z[ae]=J);return Object.keys(Z).length===Object.keys(W).length?W:Z})},5500);return()=>clearTimeout(B)},[L]);const F=xe.find(D=>D.tabKey===p),mr=xe.map(D=>D.tabKey).join(","),Pr=w.useRef(!1);w.useEffect(()=>{if(xe.length===0||Pr.current&&p&&xe.some(B=>B.tabKey===p))return;const D=xe.find(B=>B.cdpconnected===!0);D?g(D.tabKey):(!p||!xe.some(B=>B.tabKey===p))&&g(xe[0].tabKey)},[mr]);const Dt=w.useCallback(()=>{S.current.forEach(D=>clearTimeout(D)),S.current=[]},[]),$r=w.useCallback((D,B)=>{Dt();for(const W of B)S.current.push(setTimeout(()=>g(D),W))},[Dt]);w.useEffect(()=>{var W;if(!((W=F==null?void 0:F.messages)!=null&&W.length))return;const D=F.ideId,B=Date.now();N(ee=>{let Z=!1;const ae={...ee};return F.messages.forEach((J,Se)=>{const Ee=`${D}-${J.id??`i-${Se}`}`;ae[Ee]==null&&(ae[Ee]=B,Z=!0)}),Z?ae:ee})},[F==null?void 0:F.ideId,F==null?void 0:F.messages]);const nr=w.useRef(!1);w.useEffect(()=>{if(!T){nr.current=!1;return}if(!F||nr.current||R)return;const D=s.find(B=>B.id===F.ideId);D&&(!D.chats||D.chats.length===0)&&(nr.current=!0,de())},[T,F==null?void 0:F.ideId]),w.useEffect(()=>{const D=setInterval(()=>{const B=Date.now()-3e5;A(W=>{const ee=W.filter(Z=>Z.timestamp>B).slice(-100);return ee.length===W.length?W:ee})},6e4);return()=>clearInterval(D)},[]);const gr=w.useRef(new Map);w.useEffect(()=>{const D=(W,ee)=>{var Se,Ee,Re;if(!ee)return;for(const ze of le){if(!ar(ze))continue;const _r=(Se=ze.ideId)!=null&&Se.includes(":cli:")?ze.ideId.split(":cli:")[1]:"";if(W===_r||W===ze.agentType||W===ze.ideType){const rn=gr.current.get(ze.tabKey)||[];rn.push(ee),rn.length>1e4&&rn.splice(0,rn.length-5e3),gr.current.set(ze.tabKey,rn)}}const Z=F&&ar(F),ae=(Ee=F==null?void 0:F.ideId)!=null&&Ee.includes(":cli:")?F.ideId.split(":cli:")[1]:"",J=W===ae||W===(F==null?void 0:F.agentType)||W===(F==null?void 0:F.ideType);Z&&J&&((Re=q.current)==null||Re.write(ee))},B=l_.onPtyOutput(D);return()=>{B()}},[F==null?void 0:F.agentType,F==null?void 0:F.ideType,F==null?void 0:F.tabKey,le]),w.useEffect(()=>{if(!F||!ar(F))return;const B=setTimeout(()=>{if(q.current){const W=gr.current.get(F.tabKey);if(W&&W.length>0)for(const ee of W)q.current.write(ee);q.current.bumpResize()}},200);return()=>clearTimeout(B)},[F==null?void 0:F.tabKey]),w.useEffect(()=>{if(!F)return;const D=setTimeout(()=>{var B;(B=P.current)==null||B.focus()},150);return()=>clearTimeout(D)},[F==null?void 0:F.tabKey]),w.useEffect(()=>{const D=B=>{var J,Se,Ee,Re,ze,Qn;const W=parseInt(B.key);if(isNaN(W)||W<1||W>9)return;if(B.ctrlKey){B.preventDefault();const _r=xe[W-1];_r&&(Dt(),g(_r.tabKey));return}const ee=(J=document.activeElement)==null?void 0:J.tagName,Z=ee==="INPUT"||ee==="TEXTAREA"||((Se=document.activeElement)==null?void 0:Se.isContentEditable),ae=((Re=(Ee=document.activeElement)==null?void 0:Ee.closest)==null?void 0:Re.call(Ee,".xterm-helper-textarea"))!=null||((Qn=(ze=document.activeElement)==null?void 0:ze.classList)==null?void 0:Qn.contains("xterm-helper-textarea"));if(!Z&&!ae){B.preventDefault();const _r=xe[W-1];_r&&(Dt(),g(_r.tabKey))}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[xe,Dt,g]),w.useEffect(()=>{const D=DP.on("status_event",B=>{var ae;const W=Yr(B.ideType||"");let ee="",Z="info";if(B.event==="agent:generating_completed"){const J=B.duration?` (${B.duration}s)`:"";ee=`โ
${W} agent task completed${J}`,Z="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}if(B.ideId){const Se={role:"system",timestamp:Date.now(),content:`โ
Task completed${J}`,_localId:`sys_complete_${Date.now()}`};V(Ee=>{for(const Re of Object.keys(Ee))if(Re.includes(B.ideId))return{...Ee,[Re]:[...Ee[Re]||[],Se]};return Ee})}}else if(B.event==="agent:generating_started")B.ideId&&V(J=>{const Se={...J};for(const Ee of Object.keys(Se))Ee.includes(B.ideId)&&(Se[Ee]=(Se[Ee]||[]).filter(Re=>{var ze;return!(Re.role==="system"&&((ze=Re._localId)!=null&&ze.startsWith("sys_complete_")))}));return Se});else if((B.event==="agent:waiting_approval"||B.event==="agent:approval_needed")&&(ee=`โก ${W} approval needed`,Z="warning",B.ideId)){const J=B.modalMessage||"Approval requested",Se=(ae=B.modalButtons)!=null&&ae.length?B.modalButtons.map(Re=>`[${Re}]`).join(" "):"[Approve] [Reject]",Ee={role:"system",timestamp:Date.now(),content:`โก Approval requested: ${J}
|
|
168
|
+
${Se}`,_localId:`sys_approval_${Date.now()}`};V(Re=>{for(const ze of Object.keys(Re))if(ze.includes(B.ideId))return{...Re,[ze]:[...Re[ze]||[],Ee]};return Re})}if(ee){const J=Date.now();l(Se=>[...Se.slice(-4),{id:J,message:ee,type:Z,timestamp:J,ideId:B.ideId}]),setTimeout(()=>l(Se=>Se.filter(Ee=>Ee.id!==J)),5e3)}});return()=>D()},[]),w.useEffect(()=>{var B;const D=W=>{const ee=W.data;(ee==null?void 0:ee.type)==="notification_action"&&ee.action==="approve"&&ee.ideId&&e(ee.ideId,"resolve_action",{action:"approve",button:"Approve"}).catch(Z=>console.error("[SW Action] approve failed:",Z))};return(B=navigator.serviceWorker)==null||B.addEventListener("message",D),()=>{var W;return(W=navigator.serviceWorker)==null?void 0:W.removeEventListener("message",D)}},[]);const qt=async(D,B)=>{try{const W=await e(D,"workspace_set_active",{path:B.trim()});if(W!=null&&W.success){const ee=Date.now(),Z=B.split("/").filter(Boolean).pop()||B;l(ae=>[...ae.slice(-4),{id:ee,message:`Active workspace: ${Z}`,type:"info",timestamp:ee}]),setTimeout(()=>l(ae=>ae.filter(J=>J.id!==ee)),4500)}}catch(W){const ee=Date.now();l(Z=>[...Z.slice(-4),{id:ee,message:`Workspace: ${(W==null?void 0:W.message)||"failed"}`,type:"warning",timestamp:ee}]),setTimeout(()=>l(Z=>Z.filter(ae=>ae.id!==ee)),5e3)}},kt=async()=>{if(!F)return;const D=_.trim();if(!D)return;const B=F.ideId,W=F.tabKey;y(""),$r(W,[100,500,1500,3e3]);const ee=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,Z={role:"user",content:D,timestamp:Date.now(),_localId:ee};V(ae=>({...ae,[W]:[...ae[W]||[],Z]}));try{if(ar(F)&&!jr(F)){const ae=B||F.daemonId||"";if(!ae)return;const J=F.ideType||F.agentType||"";await e(ae,"agent_command",{agentType:J,cliType:J,action:"send_chat",message:D,text:D})}else if(jr(F)){const ae=B||F.daemonId||"";if(!ae)return;await e(ae,"send_chat",{message:D,text:D,agentType:F.agentType})}else{const ae=B||F.daemonId||"";if(!ae)return;await e(ae,"send_chat",{message:D,text:D,...F.streamSource==="agent-stream"&&{agentType:F.agentType}})}setTimeout(()=>{const ae=Date.now()-6e4;V(J=>{const Se=J[W];if(!Se)return J;const Ee=Se.filter(Re=>Re.timestamp>ae);return Ee.length===Se.length?J:{...J,[W]:Ee}})},6e4)}catch(ae){console.error("Send failed",ae),y(D),V(J=>({...J,[W]:(J[W]||[]).filter(Se=>Se._localId!==ee)}))}},Ct=async()=>{if(F)try{_e?await e(F.ideId,"launch_ide",{ideType:F.ideType,enableCdp:!0}):await e(F.ideId,"vscode_command_exec",{commandId:"adhdev.relaunchWithCdp",args:[{force:!0}]})}catch(D){console.error("Relaunch failed",D)}},ie=async D=>{try{await e("standalone","launch_ide",{ideType:D,enableCdp:!0})}catch(B){console.error("Launch failed",B)}},pe=async D=>{if(F){console.log("[ModalButton] ideId:",F.ideId,"button:",D,"agentType:",F.agentType,"source:",F.streamSource),A(B=>[...B,{ideId:F.tabKey,text:`๐ฑ๏ธ **${D}** clicked`,timestamp:Date.now()}]);try{let B;if(ar(F)&&!jr(F)){const ee=(F.modalButtons||[]).indexOf(D),Z=D.replace(/[โฅโโงโซโโ]/g,"").trim().toLowerCase();let ae;ee>=0?ae=`${ee+1}\r`:/^(deny|no|reject|cancel)/.test(Z)?ae="3\r":/always/.test(Z)?ae="2\r":ae="1\r";const J=F.daemonId||F.ideId,Se=F.ideType||F.agentType||"";l_.sendPtyInput(J,Se,ae)||await e(J,"pty_input",{cliType:Se,data:ae}),B={success:!0}}else{const W=D.replace(/[โฅโโงโซโโ]/g,"").trim().toLowerCase(),ee=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(W),Z=F.ideId||F.daemonId||"";B=await e(Z,"resolve_action",{button:D,action:ee?"approve":"reject",...F.streamSource==="agent-stream"&&{agentType:F.agentType}})}console.log("[ModalButton] result:",B),B.success||A(W=>[...W,{ideId:F.tabKey,text:`โ ๏ธ **${D}** failed โ button not found`,timestamp:Date.now()}])}catch(B){console.error("[ModalButton] Error:",B),A(W=>[...W,{ideId:F.tabKey,text:`โ **${D}** error`,timestamp:Date.now()}])}}},I=async(D,B)=>{try{const W=D||(F==null?void 0:F.daemonId)||"",ee=await e(W,"switch_chat",{id:B,sessionId:B,...(F==null?void 0:F.streamSource)==="agent-stream"&&{agentType:F==null?void 0:F.agentType}}),Z=ee==null?void 0:ee.result;(ee==null?void 0:ee.success)===!0||Z==="switched"||Z==="switched-by-title"||(Z===!1||Z==="not_found"?l(J=>[...J,{id:Date.now(),message:"โ ๏ธ Session tab not found โ try refreshing history",type:"warning",timestamp:Date.now()}]):typeof Z=="string"&&Z.startsWith("error:")?l(J=>[...J,{id:Date.now(),message:`โ ๏ธ Switch error: ${Z}`,type:"warning",timestamp:Date.now()}]):l(J=>[...J,{id:Date.now(),message:"โ ๏ธ Session switch failed",type:"warning",timestamp:Date.now()}]))}catch(W){console.error("Switch failed",W),l(ee=>[...ee,{id:Date.now(),message:`โ Switch failed: ${W.message||"connection error"}`,type:"warning",timestamp:Date.now()}])}},U=async()=>{if(!(!F||z)){E(!0);try{const D=F.ideId||F.daemonId||"";await e(D,"new_chat",{...F.streamSource==="agent-stream"&&{agentType:F.agentType}}),j(B=>({...B,[F.tabKey]:Date.now()})),V(B=>({...B,[F.tabKey]:[]}))}catch(D){console.error("New chat failed",D)}finally{E(!1)}}},[Q,ge]=w.useState(!1),Pe=async()=>{if(!F||Q)return;ge(!0);const D=F.tabKey;try{await e(F.ideId,"agent_stream_focus",{agentType:F.agentType}),$r(D,[200,1500,3e3])}catch(B){console.error("Focus agent failed",B)}finally{ge(!1)}},de=async()=>{var D;if(!(!F||R)){O(!0);try{const B=F.ideId||F.daemonId||"",W=await e(B,"list_chats",{forceExpand:!0,...F.streamSource==="agent-stream"&&{agentType:F.agentType}}),ee=(W==null?void 0:W.chats)||((D=W==null?void 0:W.result)==null?void 0:D.chats);W!=null&&W.success&&Array.isArray(ee)&&r(F.ideId,ee)}catch(B){console.error("Refresh history failed",B)}finally{O(!1)}}};return d.jsxs("div",{className:"page-dashboard flex-1 min-h-0 bg-bg-primary text-text-primary flex flex-col overflow-hidden",children:[d.jsx(gP,{wsStatus:a,showReconnected:f}),X&&te.length>0&&d.jsxs("div",{className:"shrink-0 px-4 py-2.5 border-b border-border-subtle bg-bg-secondary/40",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:[d.jsx(rs,{size:12}),"Recent workspaces โ tap to set as active"]}),d.jsx("div",{className:"flex gap-2 overflow-x-auto pb-0.5",children:te.slice(0,12).map(D=>{const B=D.path.split("/").filter(Boolean).pop()||D.path,W=D.kind==="ide"?"IDE":D.kind==="cli"?"CLI":D.kind==="acp"?"ACP":"";return d.jsxs("button",{type:"button",className:"shrink-0 max-w-[200px] px-3 py-1.5 rounded-lg text-left text-[11px] border border-border-subtle bg-bg-primary hover:bg-violet-500/[0.08] hover:border-violet-500/25 transition-colors",title:D.path,onClick:()=>void qt(X.id,D.path),children:[d.jsx("div",{className:"font-medium text-text-primary truncate",children:B}),(W||D.agentType)&&d.jsx("div",{className:"text-[9px] text-text-muted truncate mt-0.5",children:[W,D.agentType].filter(Boolean).join(" ยท ")})]},`${D.path}-${D.lastUsedAt}`)})})]}),d.jsx(_P,{activeConv:F,agentCount:Y.length,wsStatus:a,isConnected:c,onOpenHistory:()=>C(!0)}),d.jsx(wP,{sortedConversations:xe,activeTabId:p,tabsOverflow:b,tabsContainerRef:$,terminalRef:q,onSelectTab:D=>{Pr.current=!0,g(D)},onReorder:Ce,pinTab:$r,clearTabPinTimers:Dt,retryConnection:u}),d.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden relative",children:F?d.jsxs(d.Fragment,{children:[d.jsx(Ux,{activeConv:F,onModalButton:pe}),d.jsx("div",{className:"desktop-only px-3 pt-1 pb-2",children:!ar(F)&&!jr(F)&&n[F.ideId]?d.jsx(fP,{screenshotUrl:n[F.ideId],mode:"preview",onDismiss:()=>{const D={...n};delete D[F.ideId],i(D)}}):!ar(F)&&!jr(F)&&F.cdpconnected===!1?d.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:[d.jsx("span",{className:"text-sm",children:d.jsx(Gy,{size:14})}),d.jsx("span",{className:"flex-1",children:"CDP not connected โ chat history & screenshots unavailable for this IDE."}),d.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:Ct,children:"Relaunch with CDP"})]}):null}),ar(F)&&!jr(F)?d.jsx(mP,{activeConv:F,ptyBuffers:gr,terminalRef:q,agentInput:_,setAgentInput:y,handleSendChat:kt,handleModalButton:pe}):d.jsx(Vx,{activeConv:F,ides:s,agentInput:_,setAgentInput:y,handleSendChat:kt,handleFocusAgent:Pe,isFocusingAgent:Q,messageReceivedAt:x,actionLogs:H})]}):d.jsxs("div",{className:"empty-dashboard",children:[d.jsx("div",{className:"glow-orb",children:d.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-12 h-12"})}),d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"font-bold text-lg mb-1.5",children:"No IDE connected"}),d.jsx("div",{className:"text-[13px] text-text-muted",style:{marginBottom:_e&&k.length>0?16:0},children:_e?"Launch an IDE with CDP to start monitoring":"Launch your IDE with the ADHDev extension to start"}),_e&&k.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:k.filter(D=>D.running||!0).map(D=>d.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:()=>ie(D.type),onMouseEnter:B=>B.currentTarget.style.background="rgba(139,92,246,0.2)",onMouseLeave:B=>B.currentTarget.style.background="rgba(139,92,246,0.1)",children:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(z3,{size:14})," Launch ",D.name]})},D.type))})]})]})}),T&&F&&d.jsx(xP,{activeConv:F,ides:s,isCreatingChat:z,isRefreshingHistory:R,onClose:()=>C(!1),onNewChat:U,onSwitchSession:I,onRefreshHistory:de}),d.jsx("style",{children:`
|
|
169
|
+
body { overflow: hidden; overscroll - behavior: none; }
|
|
170
|
+
.btn { cursor: pointer; border - radius: 8px; font - weight: 600; font - size: 14px; transition: all 0.2s; }
|
|
171
|
+
.btn - sm { padding: 6px 12px; font - size: 12px; }
|
|
172
|
+
.pulse - amber { animation: pulse - amber 2s infinite ease -in -out; }
|
|
173
|
+
@keyframes pulse - amber {
|
|
174
|
+
0 % { transform: scale(1); box- shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
|
|
175
|
+
}
|
|
176
|
+
70 % { transform: scale(1.1); box- shadow: 0 0 0 10px rgba(245, 158, 11, 0);
|
|
177
|
+
}
|
|
178
|
+
100 % { transform: scale(1); box- shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
|
|
179
|
+
}
|
|
180
|
+
`}),d.jsx(SP,{toasts:o,onDismiss:D=>l(B=>B.filter(W=>W.id!==D)),onClickToast:D=>{if(D.ideId){const B=xe.find(W=>W.ideId===D.ideId||W.tabKey===D.ideId);B&&(Dt(),g(B.tabKey))}}}),d.jsx("style",{children:`
|
|
181
|
+
@keyframes toast -in {
|
|
182
|
+
from { opacity: 0; transform: translateX(40px); }
|
|
183
|
+
to { opacity: 1; transform: translateX(0); }
|
|
184
|
+
}
|
|
185
|
+
`})]})}function zP(e){return e.split(":")[0]||""}function FP({renderHeaderActions:e}={}){var _e,X,te;const{id:t}=j0(),r=gs(),n=Nf(),i=n.ides||[],s=n.connectionStates||{},{sendCommand:o}=Ei(),l=w.useMemo(()=>zP(t||""),[t]),a=w.useMemo(()=>i.find(Y=>Y.id===t),[i,t]),c=(a==null?void 0:a.type)||void 0,h=c?c.charAt(0).toUpperCase()+c.slice(1):"IDE",u=(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=w.useMemo(()=>i.find(Y=>Y.id===l||Y.daemonId===l),[i,l]),S=(g==null?void 0:g.machineNickname)||((_e=g==null?void 0:g.machine)==null?void 0:_e.hostname)||"",_=((te=(X=a==null?void 0:a.workspaceFolders)==null?void 0:X[0])==null?void 0:te.name)||"",[y]=Cb(),x=typeof window<"u"&&window.innerWidth<=768,N=y.get("view")||(x?"chat":"split"),[T,C]=w.useState(N),[R,O]=w.useState("ide"),[z,E]=w.useState(""),[H,A]=w.useState(!1),[M,V]=w.useState(null),[L,j]=w.useState(null),[q,P]=w.useState([]),$=w.useMemo(()=>{var Y,le;return{ideId:t||"",daemonId:l,agentName:Zh(c||""),agentType:c||"",status:(u==null?void 0:u.status)||"idle",title:(u==null?void 0:u.title)||"",messages:(u==null?void 0:u.messages)||[],ideType:c||"",workspaceName:(a==null?void 0:a.workspaceName)||"",displayPrimary:h,displaySecondary:(a==null?void 0:a.workspaceName)||"",cdpConnected:!0,modalButtons:(Y=u==null?void 0:u.activeModal)==null?void 0:Y.buttons,modalMessage:(le=u==null?void 0:u.activeModal)==null?void 0:le.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,u,a,h]);w.useEffect(()=>l?Gt.onScreenshot("ide-page",(le,fe)=>{if(le!==l)return;const me=new FileReader;me.onload=()=>V(me.result),me.readAsDataURL(fe)}):void 0,[l]),w.useEffect(()=>l?Gt.onStatusEvent((le,fe)=>{if(le!==l)return;let me="",ye="info";if(fe.event==="agent:generating_completed"?(me=`โ
Task completed${fe.duration?` (${fe.duration}s)`:""}`,ye="success"):(fe.event==="agent:waiting_approval"||fe.event==="agent:approval_requested")&&(me="โก Approval needed",ye="warning"),me){const xe=Date.now();P(F=>[...F.slice(-4),{id:xe,message:me,type:ye}]),setTimeout(()=>P(F=>F.filter(mr=>mr.id!==xe)),ye==="warning"?1e4:5e3)}}):void 0,[l]),w.useEffect(()=>{const Y=l?Gt.get(l):null;!Y||!(m==="connected")||(T!=="chat"?Y.startScreenshots(c):Y.stopScreenshots(c))},[T,m,c,l]);const b=w.useCallback(async(Y,le={})=>{if(!t)throw new Error("No IDE ID");const fe={...le};if(!fe._targetInstance&&t){const ye=t.split(":");ye.length>=3&&(ye[1]==="ide"||ye[1]==="cli")&&(fe._targetInstance=ye.slice(2).join(":"),fe._targetType=ye[1])}const me=l?Gt.get(l):null;return me!=null&&me.hasCommandChannel?await me.sendCommand(Y,fe):me&&me.connectionState!=="failed"&&me.connectionState!=="closed"&&await new Promise(xe=>{const Ce=Date.now(),F=()=>{if(me.hasCommandChannel)return xe(!0);if(Date.now()-Ce>3e3)return xe(!1);setTimeout(F,200)};F()})&&me.hasCommandChannel?await me.sendCommand(Y,fe):await o(t,Y,fe)},[t,l]),ne=async()=>{const Y=z.trim();if(!(!Y||!t||H)){E(""),A(!0);try{await b("send_chat",{message:Y,waitForResponse:!0})}catch(le){console.error("[IDE] Send failed:",le)}finally{A(!1)}}},ce=async Y=>{if(t)try{const le=await o(t,"screenshot",{width:Y?Math.min(Y,1280):1280});le!=null&&le.success&&(le!=null&&le.base64)&&j(`data:image/jpeg;base64,${le.base64}`)}catch(le){console.error("[IDE] Screenshot failed:",le)}},k=f.length>0;return t?d.jsxs("div",{className:"ide-page",children:[d.jsxs("header",{className:"ide-header",children:[d.jsxs("div",{className:"ide-header-left",children:[d.jsxs("div",{className:"ide-title",children:[d.jsx("span",{className:"ide-name",children:h}),_&&d.jsx("span",{className:"ide-workspace",children:_}),d.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),d.jsxs("div",{className:"ide-status-pill",children:[d.jsx("span",{className:`ide-dot ${m==="connected"?"online":"connecting"}`}),d.jsx("span",{className:"ide-status-text",children:m==="connected"?"Connected":m==="connecting"?"Connecting":"WS"})]}),S&&d.jsx("span",{className:"ide-machine-label",children:S})]}),d.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(Y=>d.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:T===Y?"1px solid var(--accent-primary)":"none",background:T===Y?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:T===Y?"var(--accent-primary)":void 0},onClick:()=>C(Y),children:Y==="chat"?d.jsx(gf,{size:14}):Y==="split"?"โ":d.jsx(lo,{size:14})},Y)),e&&e({daemonId:l,ideInstanceId:t||""}),d.jsx("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs",onClick:()=>r("/dashboard"),children:"โ Back"})]})]}),d.jsxs("div",{className:"ide-content",children:[d.jsxs("div",{className:`ide-chat-panel ${T==="chat"?"full":""} ${T==="remote"?"hidden":""}`,children:[k&&d.jsxs("div",{className:"ide-chat-tabs",children:[d.jsx("button",{className:`ide-chat-tab ${R==="ide"?"active":""}`,onClick:()=>O("ide"),children:h}),d.jsxs("button",{className:`ide-chat-tab ext ${R==="extensions"?"active":""}`,onClick:()=>O("extensions"),children:["Extensions ",d.jsx("span",{className:"ide-ext-badge",children:f.length})]})]}),R==="extensions"&&k?d.jsx(q3,{ideId:t,agentStreams:f,sendCommand:async(Y,le)=>{try{const fe=l?Gt.get(l):null;if(fe&&m==="connected"){await Promise.race([fe.sendCommand(Y,le),new Promise((me,ye)=>setTimeout(()=>ye(new Error("connection timeout")),3e3))]);return}}catch{}await o(t,Y,le)}}):d.jsx(Vx,{activeConv:$,ides:i,agentInput:z,setAgentInput:E,handleSendChat:ne,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[]})]}),d.jsx("div",{className:`ide-remote-panel ${T==="remote"?"full":""} ${T==="chat"?"hidden":""}`,children:d.jsx(dP,{screenshot:L,isCapturing:!1,onRefresh:ce,addLog:()=>{},connState:m,connScreenshot:M,onAction:async(Y,le)=>{const fe=l?Gt.get(l):null;if(fe&&m==="connected")try{return await fe.sendInput(Y,le)}catch(me){console.error("[Connection Input] Failed:",me)}return await o(t,"cdp_remote_action",{action:Y,params:le})}})})]}),q.length>0&&d.jsx("div",{className:"ide-toasts",children:q.map(Y=>d.jsx("div",{className:`ide-toast ${Y.type}`,onClick:()=>P(le=>le.filter(fe=>fe.id!==Y.id)),children:Y.message},Y.id))})]}):d.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function $P(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 WP(){var Df,If,Rf,Mf,Af,jf,Bf,Of,zf,Ff;const{id:e}=j0(),t=gs(),{sendCommand:r}=Ei(),n=r,i=Nf(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=w.useState([]),[c,h]=w.useState([]),[u,f]=w.useState(0),[p,m]=w.useState(!0),[g,S]=w.useState("debug"),[_,y]=w.useState(null),[x,N]=w.useState([]),[T,C]=w.useState(!1),[R,O]=w.useState(""),[z,E]=w.useState(""),[H,A]=w.useState(""),[M,V]=w.useState(""),[L,j]=w.useState(""),[q,P]=w.useState(""),[$,b]=w.useState(""),[ne,ce]=w.useState("overview"),[k,_e]=w.useState([]),[X,te]=w.useState(!1),[Y,le]=w.useState(!1),[fe,me]=w.useState(""),[ye,xe]=w.useState([]),[Ce,F]=w.useState(!1),[mr,Pr]=w.useState(null),[Dt,$r]=w.useState("all"),[nr,gr]=w.useState(""),[qt,kt]=w.useState(!1),Ct=w.useRef(null),ie=w.useRef(!1);w.useEffect(()=>{if(!e||ne!=="logs"||!p)return;const v=async()=>{try{const ve=await r(e,"get_logs",{count:200,minLevel:g,since:u}),be=(ve==null?void 0:ve.result)||ve;if(ve!=null&&ve.success&&Array.isArray(be==null?void 0:be.logs)&&be.logs.length>0){h(et=>[...et,...be.logs.map(Pi=>({timestamp:Pi.ts,level:Pi.level,message:`[${Pi.category}] ${Pi.message}`}))].slice(-300));const We=Math.max(...be.logs.map(et=>et.ts));f(We)}}catch{}};v();const K=setInterval(v,3e3);return()=>clearInterval(K)},[e,ne,p,u,g]),w.useEffect(()=>{if(p&&c.length>0){const v=ie.current?"smooth":"instant";setTimeout(()=>{var K;(K=Ct.current)==null||K.scrollIntoView({behavior:v}),ie.current=!0},50)}},[c.length,l.length,p]),w.useEffect(()=>{ne!=="logs"&&(ie.current=!1)},[ne]);const pe=async()=>{var v;if(e){F(!0);try{const K=await r(e,"get_provider_settings",{}),ve=(K==null?void 0:K.result)||K;if(K!=null&&K.success&&(ve!=null&&ve.settings)){const be=[];for(const[We,et]of Object.entries(ve.settings)){const gt=ge.find(Pi=>Pi.type===We);be.push({type:We,displayName:(gt==null?void 0:gt.displayName)||We,icon:(gt==null?void 0:gt.icon)||"",category:(gt==null?void 0:gt.category)||"unknown",schema:et,values:((v=ve.values)==null?void 0:v[We])||{}})}be.sort((We,et)=>We.category.localeCompare(et.category)||We.displayName.localeCompare(et.displayName)),xe(be)}}catch{}F(!1)}};w.useEffect(()=>{ne==="providers"&&ye.length===0&&pe()},[ne]);const I=async(v,K,ve)=>{Pr(`${v}.${K}`),xe(be=>be.map(We=>We.type===v?{...We,values:{...We.values,[K]:ve}}:We));try{const be=await r(e,"set_provider_setting",{providerType:v,key:K,value:ve});be!=null&&be.success||pe()}catch{pe()}Pr(null)},U=s.find(v=>v.id===e&&v.daemonMode),Q=U?{id:U.id,hostname:((Df=U.machine)==null?void 0:Df.hostname)||U.id,platform:((If=U.machine)==null?void 0:If.platform)||"unknown",arch:((Rf=U.machine)==null?void 0:Rf.arch)||"",cpus:((Mf=U.machine)==null?void 0:Mf.cpus)||0,totalMem:((Af=U.machine)==null?void 0:Af.totalMem)||0,freeMem:((jf=U.machine)==null?void 0:jf.freeMem)||0,availableMem:(Bf=U.machine)==null?void 0:Bf.availableMem,loadavg:((Of=U.machine)==null?void 0:Of.loadavg)||[],uptime:((zf=U.machine)==null?void 0:zf.uptime)||0,release:((Ff=U.machine)==null?void 0:Ff.release)||"",cdpconnected:U.cdpconnected||!1,machineNickname:U.machineNickname||null,p2p:U.p2p||{available:!1,state:"unavailable",peers:0},detectedIdes:U.detectedIdes||[],managedIdeIds:U.managedIdeIds||[],managedCliIds:U.managedCliIds||[],workspaces:U.workspaces||[],activeWorkspaceId:U.activeWorkspaceId??null,activeWorkspacePath:U.activeWorkspacePath??null,workspaceActivity:U.workspaceActivity||[]}:null,ge=(U==null?void 0:U.availableProviders)||[],Pe={};for(const v of ge)Pe[v.type]=v.icon;const de=v=>Pe[v]||"",D=ge.filter(v=>v.category==="cli"),B=ge.filter(v=>v.category==="acp");w.useEffect(()=>{!H&&D.length>0&&A(D[0].type)},[H,D.length]),w.useEffect(()=>{!M&&B.length>0&&V(B[0].type)},[M,B.length]);const W=s.filter(v=>v.daemonId===e&&!v.daemonMode).filter(v=>!r_(v)&&!n_(v)).map(v=>({id:v.id,type:v.type,version:v.version||"",instanceId:v.instanceId||"",status:v.status,workspaceFolders:v.workspaceFolders||[],activeFile:v.activeFile||null,terminals:v.terminals||0,aiAgents:yP(v.aiAgents||v.agents||[]),activeChat:v.activeChat||null,chats:v.chats||[],agentStreams:v.agentStreams||[],cdpconnected:v.cdpconnected||!1,daemonId:e})),ee=s.filter(v=>v.daemonId===e&&r_(v)).map(v=>{var K,ve;return{id:v.id,type:v.type,cliName:v.cliName||v.type,status:v.status,workingDir:v.workingDir||((ve=(K=v.workspaceFolders)==null?void 0:K[0])==null?void 0:ve.path)||"",activeChat:v.activeChat||null,daemonId:e}}),Z=s.filter(v=>v.daemonId===e&&n_(v)).map(v=>{var K,ve;return{id:v.id,type:v.type,acpName:v.cliName||v.type,status:v.status,workingDir:v.workingDir||((ve=(K=v.workspaceFolders)==null?void 0:K[0])==null?void 0:ve.path)||"",activeChat:v.activeChat||null,currentModel:v.currentModel,currentPlan:v.currentPlan,daemonId:e}}),ae=((Q==null?void 0:Q.detectedIdes)||[]).filter(v=>!v.running&&!W.some(K=>(K.type||"").toLowerCase()===(v.type||"").toLowerCase())),J=(v,K)=>{a(ve=>[...ve.slice(-100),{timestamp:Date.now(),level:v,message:K}]),setTimeout(()=>{var ve;return(ve=Ct.current)==null?void 0:ve.scrollIntoView({behavior:"smooth"})},100)},Se=async v=>{if(!(!e||_)){y(v),J("info",`Launching ${Yr(v)}...`);try{const K=await r(e,"launch_ide",{ideType:v,enableCdp:!0});J(K!=null&&K.success?"info":"error",K!=null&&K.success?`${Yr(v)} launched`:`Failed: ${K==null?void 0:K.error}`)}catch(K){J("error",`Launch error: ${K.message}`)}finally{y(null)}}},Ee=async(v,K,ve,be)=>{if(e){J("info",`Launching ${v}${K?` in ${K}`:""}${be?` (model: ${be})`:""}...`);try{const We=ve?ve.split(/\s+/).filter(Boolean):void 0,et=await r(e,"launch_cli",{cliType:v,dir:K||void 0,cliArgs:We,initialModel:be||void 0}),gt=(et==null?void 0:et.result)||et;et!=null&&et.success?(J("info",`${v} launched`),gt!=null&>.defaultedToHome&&J("info",`๐ No directory specified โ running in home directory (${gt.dir||"~"})`)):J("error",`Failed: ${(et==null?void 0:et.error)||(gt==null?void 0:gt.error)}`)}catch(We){J("error",`Launch error: ${We.message}`)}}},Re=async(v,K,ve)=>{if(e&&window.confirm(`Stop ${v}?
|
|
186
|
+
This will terminate the process.`))try{const be=await r(e,"stop_cli",{cliType:v,dir:K,_targetInstance:ve});be!=null&&be.success?J("info",`${v} stopped`):J("error",`Stop failed: ${(be==null?void 0:be.error)||"Unknown error"}`)}catch(be){J("error",`Stop failed: ${be.message}`)}},ze=async v=>{try{await r(v.id,"restart_session",{ideType:v.type}),J("info",`${Yr(v.type)} restart initiated`)}catch(K){J("error",`Restart failed: ${K.message}`)}},Qn=async()=>{if(e)try{const v=await r(e,"detect_ides",{});J("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){J("error",`Detection failed: ${v.message}`)}},_r=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){J("error",`Failed: ${v.message}`)}finally{C(!1)}}},ws=async()=>{if(!(!e||!nr.trim())){kt(!0);try{const v=await r(e,"workspace_add",{path:nr.trim()});v!=null&&v.success?(J("info",`Workspace added: ${nr.trim()}`),gr("")):J("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){J("error",v.message)}finally{kt(!1)}}},rn=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){kt(!0);try{const K=await r(e,"workspace_remove",{id:v});K!=null&&K.success?J("info","Workspace removed"):J("error",(K==null?void 0:K.error)||"workspace_remove failed")}catch(K){J("error",K.message)}finally{kt(!1)}}},Li=async v=>{if(e){kt(!0);try{const K=await r(e,"workspace_set_active",v===null?{clear:!0}:{id:v});K!=null&&K.success?J("info",v?"Active workspace updated":"Active workspace cleared"):J("error",(K==null?void 0:K.error)||"workspace_set_active failed")}catch(K){J("error",K.message)}finally{kt(!1)}}},qx=async v=>{if(!(!e||!v.trim())){kt(!0);try{const K=await r(e,"workspace_set_active",{path:v.trim()});K!=null&&K.success?J("info","Workspace activated from history"):J("error",(K==null?void 0:K.error)||"Could not activate (path missing on disk?)")}catch(K){J("error",K.message)}finally{kt(!1)}}},Yx=()=>{const v=Q==null?void 0:Q.activeWorkspacePath;if(!v){J("warn","No active workspace path");return}O(v),j(v),J("info","CLI/ACP launch directory filled from active workspace")},Xx=async()=>{var v;if(e){te(!0);try{const K=await n(e,"get_cli_history");K.success&&((v=K.result)!=null&&v.history)&&_e(K.result.history)}catch{}te(!1)}},Tf=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:fe}),J("info",`Nickname set to "${fe||"(cleared)"}"`),le(!1)}catch(v){J("error",`Failed: ${v.message}`)}};if(!Q)return o?d.jsxs("div",{className:"p-10 text-center text-text-muted",children:[d.jsx("h2",{className:"text-text-primary",children:"Machine not found"}),d.jsx("p",{className:"mt-3",children:"The machine may be offline or not yet connected."}),d.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"โ Back to Burrows"})]}):d.jsx("div",{className:"p-10 text-center text-text-muted",children:d.jsx("p",{children:"โณ Loading machine..."})});const Lf=Q.availableMem??Q.freeMem,Gx=Q.totalMem>0?Math.min(100,Math.max(0,Math.round((Q.totalMem-Lf)/Q.totalMem*100))):0,Pf=Q.loadavg[0]||0,Qx=Q.machineNickname||Q.hostname,Zx=[{id:"overview",label:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(B3,{size:14})," Overview"]})},{id:"ides",label:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(lo,{size:14})," IDEs"]}),count:W.length},{id:"clis",label:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(Qy,{size:14})," CLIs"]}),count:ee.length},{id:"acps",label:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(F3,{size:14})," ACP Agents"]}),count:Z.length},{id:"providers",label:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(D3,{size:14})," Providers"]}),count:ye.length>0?ye.length:void 0},{id:"logs",label:d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(P3,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"px-6 py-4 border-b border-border-subtle bg-surface-primary",children:[d.jsx("div",{className:"flex items-center justify-between",children:d.jsx("div",{className:"flex items-center gap-3.5",children:d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2",children:[Y?d.jsxs("div",{className:"flex gap-1.5 items-center",children:[d.jsx("input",{autoFocus:!0,value:fe,onChange:v=>me(v.target.value),onKeyDown:v=>{v.key==="Enter"&&Tf(),v.key==="Escape"&&le(!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-[200px]"}),d.jsx("button",{onClick:Tf,className:"machine-btn text-green-500 border-green-500/30",children:"โ"}),d.jsx("button",{onClick:()=>le(!1),className:"machine-btn",children:"โ"})]}):d.jsx("h1",{className:"text-lg font-bold text-text-primary m-0 cursor-pointer",onClick:()=>{le(!0),me(Q.machineNickname||"")},title:"Click to set nickname",children:Qx}),d.jsx("span",{className:"status-dot-md online"})]}),d.jsxs("div",{className:"text-[11px] text-text-muted mt-0.5 flex gap-2 items-center",children:[d.jsxs("span",{children:[Q.platform," ยท ",Q.arch," ยท ",Q.cpus," cores"]}),Q.p2p.available&&d.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:Q.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:Q.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",Q.p2p.state==="connected"?`โ ${Q.p2p.peers}`:"โ"]}),Q.cdpconnected&&d.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500",children:"CDP โ"}),Q.machineNickname&&d.jsxs("span",{className:"text-text-muted",children:["(",Q.hostname,")"]})]})]})})}),d.jsx("div",{className:"machine-tabs",children:Zx.map(v=>d.jsxs("button",{onClick:()=>ce(v.id),className:`machine-tab${ne===v.id?" active":""}`,children:[v.label,v.count!==void 0&&d.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),d.jsxs("div",{className:"page-content",children:[ne==="overview"&&d.jsxs("div",{children:[d.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[d.jsx(Jg,{icon:d.jsx(ng,{size:16}),label:"Uptime",value:vP(Q.uptime)}),d.jsx(Jg,{icon:d.jsx(lo,{size:16}),label:"IDEs",value:`${W.length}`,sub:`${ee.length} CLIs`})]}),d.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[d.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),d.jsxs("div",{className:"flex gap-6",children:[d.jsx(e_,{value:Math.min(Math.round(Pf/Q.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${Pf.toFixed(2)} avg / ${Q.cpus} cores`}),d.jsx(e_,{value:Gx,max:100,label:"Memory",color:"#3b82f6",detail:`${t_(Q.totalMem-Lf)} / ${t_(Q.totalMem)}${Q.platform==="darwin"?" (approx.)":""}`})]})]}),d.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[d.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:[d.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider flex items-center gap-1.5",children:[d.jsx(rs,{size:14})," Workspaces"]}),d.jsx("button",{type:"button",className:"machine-btn text-[10px]",disabled:qt||!Q.activeWorkspacePath,onClick:Yx,children:"Use active workspace โ CLI/ACP path"})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-3",children:[d.jsx("span",{className:"text-[10px] text-text-muted",children:"Active:"}),d.jsxs("select",{className:"text-xs bg-bg-primary border border-border-subtle rounded-lg px-2 py-1 max-w-[min(100%,420px)]",disabled:qt,value:Q.activeWorkspaceId||"",onChange:v=>{const K=v.target.value;Li(K===""?null:K)},children:[d.jsx("option",{value:"",children:"(none โ home / cwd)"}),(Q.workspaces||[]).map(v=>d.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),Q.activeWorkspacePath&&d.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:Q.activeWorkspacePath,children:Q.activeWorkspacePath})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[d.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:nr,disabled:qt,onChange:v=>gr(v.target.value),onKeyDown:v=>v.key==="Enter"&&void ws()}),d.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:qt,onClick:()=>void ws(),children:"Add"})]}),(Q.workspaces||[]).length>0&&d.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(Q.workspaces||[]).map(v=>d.jsxs("li",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[d.jsx("span",{className:"font-mono truncate flex-1",title:v.path,children:v.path}),d.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:qt,onClick:()=>void rn(v.id),children:"Remove"})]},v.id))})]}),(Q.workspaceActivity||[]).length>0&&d.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[d.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5 flex items-center gap-1.5",children:[d.jsx(ng,{size:14})," Recent workspaces"]}),d.jsx("div",{className:"flex flex-col gap-1.5",children:(Q.workspaceActivity||[]).slice(0,12).map(v=>{const K=v.path.split("/").filter(Boolean).pop()||v.path,ve=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="active"?"โ":"";return d.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:[d.jsx("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,280px)]",title:v.path,children:K}),ve&&d.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:ve}),v.agentType&&d.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),d.jsx("span",{className:"text-[9px] text-text-muted ml-auto",children:$P(v.lastUsedAt)}),d.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:qt,onClick:()=>{(async()=>(await qx(v.path),O(v.path),j(v.path)))()},children:"Activate + fill CLI/ACP path"})]},`${v.path}-${v.lastUsedAt}`)})})]}),d.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[d.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[d.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[d.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"IDEs"}),d.jsx("button",{onClick:()=>ce("ides"),className:"machine-btn text-[10px]",children:"View All โ"})]}),W.length===0?d.jsx("div",{className:"text-xs text-text-muted italic",children:"No IDEs running"}):d.jsx("div",{className:"flex flex-col gap-1.5",children:W.map(v=>{var ve,be,We;const K=(v.agentStreams||[]).some(et=>et.status==="generating"||et.status==="streaming")||((ve=v.activeChat)==null?void 0:ve.status)==="generating";return d.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 ${K?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[d.jsx("span",{children:de(v.type)}),d.jsx("span",{className:"text-xs text-text-primary font-medium",children:Yr(v.type)}),d.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:((We=(be=v.workspaceFolders)==null?void 0:be[0])==null?void 0:We.name)||""}),K&&d.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"โก Working"}),d.jsx("span",{className:`${K?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:K?"#fb923c":"#22c55e",boxShadow:K?"0 0 8px rgba(249,115,22,0.4)":"none",animation:K?"pulse-dot 1.5s infinite":"none"}})]},v.id)})})]}),d.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[d.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[d.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"CLIs"}),d.jsx("button",{onClick:()=>ce("clis"),className:"machine-btn text-[10px]",children:"View All โ"})]}),ee.length===0?d.jsx("div",{className:"text-xs text-text-muted italic",children:"No CLIs running"}):d.jsx("div",{className:"flex flex-col gap-1.5",children:ee.map(v=>d.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-glass",children:[d.jsx("span",{children:de(v.type)}),d.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),d.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workingDir.split("/").pop()}),d.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),Q.detectedIdes.length>0&&d.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[d.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),d.jsx("div",{className:"flex flex-wrap gap-1.5",children:Q.detectedIdes.map(v=>d.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:[d.jsx("span",{children:de(v.type)}),v.name||v.type,d.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),ne==="ides"&&d.jsxs("div",{children:[d.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",W.length,")"]}),W.length===0?d.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."}):d.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:W.map(v=>{var K,ve;return d.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[d.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-lg",children:de(v.type)}),d.jsx("span",{className:"font-semibold text-sm text-text-primary",children:Yr(v.type)}),v.version&&d.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.version]}),d.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),d.jsxs("div",{className:"flex gap-1.5",children:[d.jsxs("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[d.jsx(lo,{size:13})," Control"]}),d.jsx("button",{onClick:()=>ze(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"โป Restart"})]})]}),d.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(130px,1fr))] gap-1.5 text-xs text-text-secondary",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",((K=v.workspaceFolders)==null?void 0:K.map(be=>be.name).join(", "))||"โ"]}),d.jsxs("div",{children:[d.jsx("span",{className:"text-text-muted",children:"File:"})," ",((ve=v.activeFile)==null?void 0:ve.split("/").pop())||"โ"]}),d.jsxs("div",{children:[d.jsx("span",{className:"text-text-muted",children:"Terminals:"})," ",v.terminals]}),d.jsxs("div",{children:[d.jsx("span",{className:"text-text-muted",children:"CDP:"})," ",v.cdpconnected?"โ connected":"โ Off"]})]}),v.aiAgents.length>0&&d.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:v.aiAgents.map(be=>d.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${be.status==="generating"||be.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[be.name," ยท ",be.status]},be.id))})]},v.id)})}),d.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Available to Launch (",ae.length,")"]}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[ae.map(v=>d.jsxs("button",{onClick:()=>Se(v.type||v.id||""),disabled:!!_,className:"machine-btn-primary flex items-center gap-1.5",style:{opacity:_&&_!==v.type?.4:1},children:[d.jsx("span",{children:de(v.type)}),_===v.type?"โณ Launching...":`โถ ${v.name||Yr(v.type)}`]},v.type)),ae.length===0&&d.jsxs("div",{className:"text-xs text-text-muted italic",children:["All detected IDEs are running, or none detected.",d.jsxs("button",{onClick:Qn,className:"machine-btn ml-2 flex items-center gap-1",children:[d.jsx(M3,{size:12})," Scan"]})]})]})]}),ne==="clis"&&d.jsxs("div",{children:[d.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[d.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:"Launch New CLI"}),d.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[d.jsx("select",{value:H,onChange:v=>A(v.target.value),className:"machine-input",children:D.length>0?D.map(v=>d.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):d.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),d.jsx("input",{type:"text",placeholder:"Working directory...",value:R,onChange:v=>O(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),d.jsx("input",{type:"text",placeholder:"Args (optional)",value:z,onChange:v=>E(v.target.value),className:"machine-input min-w-[150px]"}),d.jsx("button",{onClick:()=>Ee(H,R,z||void 0),className:"machine-btn-primary",children:"โถ Launch"})]})]}),d.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ee.length,")"]}),ee.length===0?d.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"}):d.jsx("div",{className:"flex flex-col gap-2 mb-5",children:ee.map(v=>d.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-2.5",children:[d.jsx("span",{className:"text-lg",children:de(v.type)}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),d.jsx("div",{className:"text-[11px] text-text-muted",children:v.workingDir})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.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"?d.jsx("button",{onClick:()=>Ee(v.type,v.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"โถ"}):d.jsx("button",{onClick:()=>Re(v.type,v.workingDir,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"โ "})]})]},v.id))}),d.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[d.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"History"}),d.jsx("button",{onClick:Xx,disabled:X,className:"machine-btn",children:X?"โณ":"โป Load"})]}),k.length>0&&d.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,K)=>{var ve,be;return d.jsxs("div",{onClick:()=>{A(v.cliType),O(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:We=>We.currentTarget.style.background="rgba(255,255,255,0.06)",onMouseLeave:We=>We.currentTarget.style.background="rgba(255,255,255,0.02)",children:[d.jsxs("div",{className:"flex gap-1.5 items-center text-text-secondary",children:[d.jsx("span",{children:de(v.cliType)}),d.jsx("span",{children:((ve=v.dir)==null?void 0:ve.split("/").filter(Boolean).pop())||"root"}),((be=v.cliArgs)==null?void 0:be.length)>0&&d.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),d.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},K)})}),d.jsxs("div",{className:"mt-5",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[d.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),d.jsx("button",{onClick:_r,disabled:T,className:"machine-btn",children:T?"โณ":"โป Load"})]}),x.length>0&&d.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((v,K)=>d.jsx("button",{onClick:()=>O(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:d.jsxs("span",{className:"flex items-center gap-1",children:[d.jsx(rs,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},K))})]})]}),ne==="acps"&&d.jsxs("div",{children:[d.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[d.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:"Launch ACP Agent"}),d.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[d.jsx("select",{value:M,onChange:v=>V(v.target.value),className:"machine-input",children:B.length>0?B.map(v=>d.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):d.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),d.jsx("input",{type:"text",placeholder:"Working directory...",value:L,onChange:v=>j(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),d.jsx("input",{type:"text",placeholder:"Model (default)",value:q,onChange:v=>P(v.target.value),className:"machine-input min-w-[120px]"}),d.jsx("input",{type:"text",placeholder:"Args (optional)",value:$,onChange:v=>b(v.target.value),className:"machine-input min-w-[120px]"}),d.jsx("button",{onClick:()=>Ee(M,L,$||void 0,q||void 0),className:"machine-btn-primary",children:"โถ Launch"})]})]}),d.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",Z.length,")"]}),Z.length===0?d.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"}):d.jsx("div",{className:"flex flex-col gap-2 mb-5",children:Z.map(v=>d.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-2.5",children:[d.jsx("span",{className:"text-lg",children:de(v.type)}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),d.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[d.jsx("span",{children:v.workingDir}),v.currentModel&&d.jsxs("span",{className:"text-cyan-500",children:["๐ค ",v.currentModel]}),v.currentPlan&&d.jsxs("span",{className:"text-amber-500",children:["๐ ",v.currentPlan]})]})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.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}),d.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:d.jsx(gf,{size:14})}),v.status==="stopped"?d.jsx("button",{onClick:()=>Ee(v.type,v.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"โถ"}):d.jsx("button",{onClick:()=>Re(v.type,v.workingDir,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"โ "})]})]},v.id))}),d.jsxs("div",{className:"mt-5",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[d.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),d.jsx("button",{onClick:_r,disabled:T,className:"machine-btn",children:T?"โณ":"โป Load"})]}),x.length>0&&d.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((v,K)=>d.jsx("button",{onClick:()=>j(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:d.jsxs("span",{className:"flex items-center gap-1",children:[d.jsx(rs,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},K))})]})]}),ne==="providers"&&d.jsxs("div",{children:[d.jsxs("div",{className:"flex justify-between items-center mb-4",children:[d.jsxs("div",{className:"flex gap-1 items-center",children:[d.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(v=>d.jsx("button",{onClick:()=>$r(v),className:`machine-btn text-[10px] px-2 py-0.5 ${Dt===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),d.jsx("button",{onClick:pe,disabled:Ce,className:"machine-btn",children:Ce?"โณ Loading...":"โป Refresh"})]}),Ce&&ye.length===0?d.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading provider settings..."}):d.jsx("div",{className:"flex flex-col gap-2",children:ye.filter(v=>Dt==="all"||v.category===Dt).map(v=>d.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[d.jsx("span",{className:"text-lg",children:v.icon}),d.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),d.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})]}),d.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(K=>d.jsxs("div",{className:"flex items-center justify-between gap-3",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"text-xs font-medium text-text-primary",children:[K.label||K.key,mr===`${v.type}.${K.key}`&&d.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),K.description&&d.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:K.description})]}),d.jsx("div",{className:"shrink-0",children:K.type==="boolean"?d.jsx("button",{onClick:()=>I(v.type,K.key,!(v.values[K.key]??K.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[K.key]??K.default?"#8b5cf6":"rgba(255,255,255,0.08)"},children:d.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[K.key]??K.default?21:3}})}):K.type==="number"?d.jsx("input",{type:"number",value:v.values[K.key]??K.default??0,min:K.min,max:K.max,onChange:ve=>{const be=parseInt(ve.target.value)||0;K.min!==void 0&&be<K.min||K.max!==void 0&&be>K.max||I(v.type,K.key,be)},className:"machine-input w-20 text-center text-[11px]"}):K.type==="select"&&K.options?d.jsx("select",{value:v.values[K.key]??K.default??"",onChange:ve=>I(v.type,K.key,ve.target.value),className:"machine-input text-[11px]",children:K.options.map(ve=>d.jsx("option",{value:ve,children:ve},ve))}):d.jsx("input",{type:"text",value:v.values[K.key]??K.default??"",onBlur:ve=>I(v.type,K.key,ve.target.value),className:"machine-input w-[120px] text-[11px]"})})]},K.key))})]},v.type))})]}),ne==="logs"&&d.jsxs("div",{children:[d.jsxs("div",{className:"flex justify-between items-center mb-3",children:[d.jsxs("div",{className:"flex gap-1 items-center",children:[d.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(v=>d.jsx("button",{onClick:()=>{S(v),h([]),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))]}),d.jsxs("div",{className:"flex gap-1.5 items-center",children:[d.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),d.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"โธ Pause":"โถ Resume"}),d.jsx("button",{onClick:()=>{h([]),f(0)},className:"machine-btn",children:"Clear"})]})]}),d.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&&d.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,K)=>d.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[d.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),d.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"}),d.jsx("span",{children:v.message})]},K)),d.jsx("div",{ref:Ct})]})]})]})]})}function HP(){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 a_=HP(),c_=3e3,UP=3e4;let ln=null,VP=0;const Ea=new Map,Jh=new Set;let ti=null;async function Ul(e,t,r){const n=ln;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++VP}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{Ea.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);Ea.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 KP{constructor(t){Ss(this,"daemonId");Ss(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(ln==null?void 0:ln.readyState)===WebSocket.OPEN}get connectionState(){return(ln==null?void 0:ln.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return Ul(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`standalone:ide:${this.screenshotIdeType}`:this.daemonId;return Ul(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ti&&(clearInterval(ti),ti=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`standalone:ide:${this.screenshotIdeType}`:this.daemonId,i=await Ul(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());Jh.forEach(o=>o("standalone",s))}}catch{}};r(),ti=setInterval(r,2e3)}stopScreenshots(t){ti&&(clearInterval(ti),ti=null)}}let ri=null;function qP(e){(!ri||ri.daemonId!==e)&&(ri=new KP(e));const t=Gt._originalGet||Gt.get.bind(Gt);Gt._originalGet=t,Gt.get=r=>r===e||r.startsWith("standalone")?ri:t(r),Gt.getState=r=>(r===e||r.startsWith("standalone"))&&(ri==null?void 0:ri.connectionState)||"disconnected",Gt.onScreenshot=(r,n)=>(Jh.add(n),()=>{Jh.delete(n)})}function YP({children:e}){const t=w.useRef(sm()),r=sm();t.current=r;const[,n]=w.useState("disconnected"),i=w.useRef(null),s=w.useRef(),o=w.useRef(c_),l=w.useRef(!0);return w.useEffect(()=>{l.current=!0;function a(){var u,f;if(!l.current||((u=i.current)==null?void 0:u.readyState)===WebSocket.OPEN||((f=i.current)==null?void 0:f.readyState)===WebSocket.CONNECTING)return;n("connecting"),console.log(`[Standalone WS] Connecting to ${a_}...`);let h;try{h=new WebSocket(a_)}catch(p){console.error("[Standalone WS] Failed to create WebSocket:",p),c();return}i.current=h,h.onopen=()=>{if(!l.current){h.close();return}n("connected"),o.current=c_,console.log("[Standalone WS] Connected")},ln=h,h.onmessage=p=>{var m;try{const g=JSON.parse(p.data);if((g.type==="command_result"||g.type==="error")&&g.requestId){const S=Ea.get(g.requestId);S&&(Ea.delete(g.requestId),g.type==="error"?S.reject(new Error(((m=g.data)==null?void 0:m.message)||"Command failed")):S.resolve(g.data));return}if(g.type==="status"||g.type==="initial_state"){const S=g.data;if(!S)return;const{injectEntries:_,markLoaded:y}=t.current,x=[],N=S.id||"standalone";qP(N),x.push({id:N,type:"adhdev-daemon",status:"online",daemonMode:!0,machine:{hostname:S.hostname,platform:S.platform,...S.system||{}},system:S.system||null,timestamp:S.timestamp,cdpConnected:S.cdpConnected,detectedIdes:S.detectedIdes||[],availableProviders:S.availableProviders||[],workspaces:S.workspaces,activeWorkspaceId:S.activeWorkspaceId,activeWorkspacePath:S.activeWorkspacePath,workspaceActivity:S.workspaceActivity,managedIdeIds:(S.ides||[]).map(T=>T.id),managedCliIds:(S.clis||[]).map(T=>T.id)});for(const T of S.ides||[])x.push({...T,daemonId:S.id||"standalone",status:T.cdpConnected?"online":"detected"});for(const T of S.clis||[])x.push({...T,daemonId:S.id||"standalone",status:T.isRunning?"running":"stopped"});x.length>0&&_(x),y()}}catch(g){console.error("[Standalone WS] Parse error:",g)}},h.onclose=()=>{l.current&&(n("disconnected"),i.current=null,c())},h.onerror=p=>{console.warn("[Standalone WS] Error, will reconnect:",p)}}function c(){if(!l.current)return;clearTimeout(s.current);const h=o.current;console.log(`[Standalone WS] Reconnecting in ${h}ms...`),s.current=setTimeout(()=>{o.current=Math.min(o.current*1.5,UP),a()},h)}return a(),()=>{l.current=!1,clearTimeout(s.current),i.current&&(i.current.onclose=null,i.current.close(),i.current=null,ln=null)}},[]),d.jsx(d.Fragment,{children:e})}function XP({children:e}){return d.jsx(Nb,{children:d.jsx(YP,{children:e})})}const GP=[{id:"dashboard",path:"/dashboard",icon:d.jsx(T3,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:d.jsx(L3,{}),label:"Burrow"}];function QP({children:e}){const t=gs(),r=$o(),[n,i]=w.useState(!1),[s,o]=w.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),l=h=>{t(h),i(!1)},a=()=>{o(h=>{const u=!h;try{localStorage.setItem("sidebar-collapsed",u?"1":"0")}catch{}return u})},c=h=>`nav-item${r.pathname.startsWith(h)?" active":""} cursor-pointer ${s?"justify-center py-2.5 px-0":""}`;return d.jsxs("div",{className:`app-layout${n?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[d.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[d.jsx("span",{className:"mobile-menu-icon"}),d.jsx("span",{className:"mobile-menu-icon"}),d.jsx("span",{className:"mobile-menu-icon"})]}),n&&d.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:h=>h.key==="Escape"&&i(!1)}),d.jsxs("aside",{className:`sidebar ${n?"sidebar-open":""}`,children:[d.jsxs("div",{className:"sidebar-header",children:[d.jsxs("div",{className:`sidebar-logo ${s?"justify-center gap-0":""}`,children:[d.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!s&&d.jsx("span",{children:"ADHDev"})]}),d.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"โ"})]}),d.jsx("nav",{className:"sidebar-nav",children:GP.map(h=>d.jsxs("div",{className:c(h.path),id:`nav-${h.id}`,onClick:()=>l(h.path),title:s?h.label:void 0,children:[d.jsx("span",{className:"nav-icon",children:h.icon}),!s&&h.label]},h.id))}),d.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[d.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:[d.jsx("span",{className:"nav-icon",children:d.jsx(I3,{})}),!s&&"About"]}),!s&&d.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.3"]}),d.jsx(TP,{collapsed:s}),d.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:[d.jsx("span",{className:"nav-icon text-base",children:s?"โบ":"โน"}),!s&&d.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),d.jsx("main",{className:"main-content relative",children:d.jsx("div",{className:"main-content-inner",children:e})})]})}const ZP=[{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."}],JP=[{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."}],eD=[{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}],lu={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 tD(){return d.jsxs("div",{className:"py-8 px-6 max-w-[860px] mx-auto text-text-primary",children:[d.jsxs("div",{className:"text-center mb-10",children:[d.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-14 h-14 mb-3 mx-auto"}),d.jsx("h1",{className:"text-[26px] font-extrabold mb-1.5 text-text-primary",children:"ADHDev"}),d.jsx("p",{className:"text-[13px] text-text-muted",children:"Agent Dashboard Hub for Dev โ Self-hosted Edition"}),d.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.3"]})]}),d.jsxs("section",{className:"mb-10",children:[d.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[d.jsx("span",{className:"text-base",children:"โ
"})," What's included"]}),d.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-3",children:ZP.map(e=>d.jsxs("div",{className:"bg-bg-glass border border-border-subtle rounded-xl px-4 py-4 transition-colors hover:border-border-default",children:[d.jsx("div",{className:"text-xl mb-1.5",children:e.icon}),d.jsx("div",{className:"font-semibold text-[13px] mb-1",children:e.title}),d.jsx("div",{className:"text-[12px] text-text-muted leading-relaxed",children:e.desc})]},e.title))})]}),d.jsxs("section",{className:"mb-10",children:[d.jsx("h2",{className:"text-lg font-bold mb-4",children:"Compatible with"}),d.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-5",children:[{label:"IDEs",items:lu.ides},{label:"Extension agents",items:lu.agents},{label:"CLI agents",items:lu.cli}].map(e=>d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-2 uppercase",children:e.label}),d.jsx("div",{className:"flex flex-col gap-1",children:e.items.map(t=>d.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))})]}),d.jsxs("section",{className:"mb-10",children:[d.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[d.jsx("span",{className:"text-base",children:"โ๏ธ"})," Self-hosted vs Cloud"]}),d.jsx("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:d.jsxs("table",{className:"w-full text-[13px]",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-bg-secondary",children:[d.jsx("th",{className:"text-left px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),d.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[100px]",children:"Selfhost"}),d.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-[11px] uppercase tracking-wider w-[100px] text-violet-500",children:"Cloud"})]})}),d.jsx("tbody",{children:eD.map((e,t)=>d.jsxs("tr",{className:t%2===0?"bg-bg-glass":"",children:[d.jsx("td",{className:"px-4 py-2 text-text-secondary",children:e.feature}),d.jsx("td",{className:"text-center px-4 py-2",children:e.selfhost?d.jsx("span",{className:"text-emerald-500",children:"โ"}):d.jsx("span",{className:"text-text-muted opacity-40",children:"โ"})}),d.jsx("td",{className:"text-center px-4 py-2",children:d.jsx("span",{className:"text-emerald-500",children:"โ"})})]},e.feature))})]})})]}),d.jsx("section",{className:"mb-10",children:d.jsx("div",{className:"rounded-2xl border border-violet-500/20 bg-violet-500/[0.04] px-6 py-6",children:d.jsxs("div",{className:"flex items-start gap-4",children:[d.jsx("div",{className:"text-3xl shrink-0",children:"๐"}),d.jsxs("div",{className:"flex-1",children:[d.jsx("h3",{className:"font-bold text-[15px] mb-1.5",children:"Unlock more with ADHDev Cloud"}),d.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."}),d.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2.5 mb-5",children:JP.map(e=>d.jsxs("div",{className:"flex gap-2.5 items-start",children:[d.jsx("span",{className:"text-base shrink-0 mt-0.5",children:e.icon}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold text-[12px]",children:e.title}),d.jsx("div",{className:"text-[11px] text-text-muted leading-snug",children:e.desc})]})]},e.title))}),d.jsxs("div",{className:"flex gap-3 flex-wrap",children:[d.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 โ"}),d.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"}),d.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"})]})]})]})})}),d.jsxs("div",{className:"text-center text-xs text-text-muted pt-4 border-t border-border-subtle",children:[d.jsx("p",{children:"ยฉ 2026 ADHDev ยท Your AI sidekick otter ๐ฆฆ"}),d.jsx("p",{className:"mt-1 opacity-60",children:"Self-hosted edition โ all data stays on your machine"})]})]})}function u_(){const{ides:e}=W0(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?d.jsx(Ml,{to:`/machines/${t.id}`,replace:!0}):e.length>0?d.jsx(Ml,{to:`/machines/${e[0].id}`,replace:!0}):d.jsx(Ml,{to:"/dashboard",replace:!0})}function rD(){return d.jsx(kb,{children:d.jsx(XP,{children:d.jsx(Db,{value:{sendCommand:Ul,sendData:()=>!1},children:d.jsx(QP,{children:d.jsxs(xb,{children:[d.jsx(Cn,{path:"/dashboard",element:d.jsx(OP,{})}),d.jsx(Cn,{path:"/ide/:id",element:d.jsx(FP,{})}),d.jsx(Cn,{path:"/machine",element:d.jsx(u_,{})}),d.jsx(Cn,{path:"/machines/:id",element:d.jsx(WP,{})}),d.jsx(Cn,{path:"/machines",element:d.jsx(u_,{})}),d.jsx(Cn,{path:"/about",element:d.jsx(tD,{})}),d.jsx(Cn,{path:"*",element:d.jsx(Ml,{to:"/dashboard",replace:!0})})]})})})})})}E0(document.getElementById("root")).render(d.jsx(w.StrictMode,{children:d.jsx(rD,{})}));
|