@adhdev/daemon-standalone 0.1.0 → 0.4.1

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.
@@ -1,4 +1,4 @@
1
- var d1=Object.defineProperty;var f1=(e,t,n)=>t in e?d1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var os=(e,t,n)=>f1(e,typeof t!="symbol"?t+"":t,n);function p1(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[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"]'))r(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"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(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 r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Ll=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mm={exports:{}},da={},Am={exports:{}},Ee={};/**
1
+ var S1=Object.defineProperty;var w1=(e,t,n)=>t in e?S1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ps=(e,t,n)=>w1(e,typeof t!="symbol"?t+"":t,n);function x1(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[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"]'))r(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"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(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 r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var $l=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Um={exports:{}},ba={},Km={exports:{}},Ie={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@ var d1=Object.defineProperty;var f1=(e,t,n)=>t in e?d1(e,t,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var vo=Symbol.for("react.element"),g1=Symbol.for("react.portal"),m1=Symbol.for("react.fragment"),_1=Symbol.for("react.strict_mode"),v1=Symbol.for("react.profiler"),y1=Symbol.for("react.provider"),S1=Symbol.for("react.context"),w1=Symbol.for("react.forward_ref"),x1=Symbol.for("react.suspense"),b1=Symbol.for("react.memo"),k1=Symbol.for("react.lazy"),df=Symbol.iterator;function C1(e){return e===null||typeof e!="object"?null:(e=df&&e[df]||e["@@iterator"],typeof e=="function"?e:null)}var Bm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nm=Object.assign,zm={};function Qi(e,t,n){this.props=e,this.context=t,this.refs=zm,this.updater=n||Bm}Qi.prototype.isReactComponent={};Qi.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")};Qi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Om(){}Om.prototype=Qi.prototype;function Fh(e,t,n){this.props=e,this.context=t,this.refs=zm,this.updater=n||Bm}var $h=Fh.prototype=new Om;$h.constructor=Fh;Nm($h,Qi.prototype);$h.isPureReactComponent=!0;var ff=Array.isArray,jm=Object.prototype.hasOwnProperty,Wh={current:null},Fm={key:!0,ref:!0,__self:!0,__source:!0};function $m(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)jm.call(t,r)&&!Fm.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;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(r in l=e.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:vo,type:e,key:s,ref:o,props:i,_owner:Wh.current}}function E1(e,t){return{$$typeof:vo,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Hh(e){return typeof e=="object"&&e!==null&&e.$$typeof===vo}function T1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var pf=/\/+/g;function Fa(e,t){return typeof e=="object"&&e!==null&&e.key!=null?T1(""+e.key):t.toString(36)}function ll(e,t,n,r,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 vo:case g1:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+Fa(o,0):r,ff(i)?(n="",e!=null&&(n=e.replace(pf,"$&/")+"/"),ll(i,t,n,"",function(c){return c})):i!=null&&(Hh(i)&&(i=E1(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(pf,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",ff(e))for(var l=0;l<e.length;l++){s=e[l];var a=r+Fa(s,l);o+=ll(s,t,n,a,i)}else if(a=C1(e),typeof a=="function")for(e=a.call(e),l=0;!(s=e.next()).done;)s=s.value,a=r+Fa(s,l++),o+=ll(s,t,n,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 Ao(e,t,n){if(e==null)return e;var r=[],i=0;return ll(e,r,"","",function(s){return t.call(n,s,i++)}),r}function R1(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var At={current:null},al={transition:null},I1={ReactCurrentDispatcher:At,ReactCurrentBatchConfig:al,ReactCurrentOwner:Wh};function Wm(){throw Error("act(...) is not supported in production builds of React.")}Ee.Children={map:Ao,forEach:function(e,t,n){Ao(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ao(e,function(){t++}),t},toArray:function(e){return Ao(e,function(t){return t})||[]},only:function(e){if(!Hh(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ee.Component=Qi;Ee.Fragment=m1;Ee.Profiler=v1;Ee.PureComponent=Fh;Ee.StrictMode=_1;Ee.Suspense=x1;Ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I1;Ee.act=Wm;Ee.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Nm({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Wh.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)jm.call(t,a)&&!Fm.hasOwnProperty(a)&&(r[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){l=Array(a);for(var c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}return{$$typeof:vo,type:e.type,key:i,ref:s,props:r,_owner:o}};Ee.createContext=function(e){return e={$$typeof:S1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:y1,_context:e},e.Consumer=e};Ee.createElement=$m;Ee.createFactory=function(e){var t=$m.bind(null,e);return t.type=e,t};Ee.createRef=function(){return{current:null}};Ee.forwardRef=function(e){return{$$typeof:w1,render:e}};Ee.isValidElement=Hh;Ee.lazy=function(e){return{$$typeof:k1,_payload:{_status:-1,_result:e},_init:R1}};Ee.memo=function(e,t){return{$$typeof:b1,type:e,compare:t===void 0?null:t}};Ee.startTransition=function(e){var t=al.transition;al.transition={};try{e()}finally{al.transition=t}};Ee.unstable_act=Wm;Ee.useCallback=function(e,t){return At.current.useCallback(e,t)};Ee.useContext=function(e){return At.current.useContext(e)};Ee.useDebugValue=function(){};Ee.useDeferredValue=function(e){return At.current.useDeferredValue(e)};Ee.useEffect=function(e,t){return At.current.useEffect(e,t)};Ee.useId=function(){return At.current.useId()};Ee.useImperativeHandle=function(e,t,n){return At.current.useImperativeHandle(e,t,n)};Ee.useInsertionEffect=function(e,t){return At.current.useInsertionEffect(e,t)};Ee.useLayoutEffect=function(e,t){return At.current.useLayoutEffect(e,t)};Ee.useMemo=function(e,t){return At.current.useMemo(e,t)};Ee.useReducer=function(e,t,n){return At.current.useReducer(e,t,n)};Ee.useRef=function(e){return At.current.useRef(e)};Ee.useState=function(e){return At.current.useState(e)};Ee.useSyncExternalStore=function(e,t,n){return At.current.useSyncExternalStore(e,t,n)};Ee.useTransition=function(){return At.current.useTransition()};Ee.version="18.3.1";Am.exports=Ee;var x=Am.exports;const L1=jh(x),P1=p1({__proto__:null,default:L1},[x]);/**
9
+ */var Eo=Symbol.for("react.element"),b1=Symbol.for("react.portal"),k1=Symbol.for("react.fragment"),C1=Symbol.for("react.strict_mode"),E1=Symbol.for("react.profiler"),T1=Symbol.for("react.provider"),R1=Symbol.for("react.context"),I1=Symbol.for("react.forward_ref"),P1=Symbol.for("react.suspense"),L1=Symbol.for("react.memo"),D1=Symbol.for("react.lazy"),bf=Symbol.iterator;function M1(e){return e===null||typeof e!="object"?null:(e=bf&&e[bf]||e["@@iterator"],typeof e=="function"?e:null)}var Vm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},qm=Object.assign,Ym={};function ss(e,t,n){this.props=e,this.context=t,this.refs=Ym,this.updater=n||Vm}ss.prototype.isReactComponent={};ss.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")};ss.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Xm(){}Xm.prototype=ss.prototype;function Qh(e,t,n){this.props=e,this.context=t,this.refs=Ym,this.updater=n||Vm}var Zh=Qh.prototype=new Xm;Zh.constructor=Qh;qm(Zh,ss.prototype);Zh.isPureReactComponent=!0;var kf=Array.isArray,Gm=Object.prototype.hasOwnProperty,Jh={current:null},Qm={key:!0,ref:!0,__self:!0,__source:!0};function Zm(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)Gm.call(t,r)&&!Qm.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;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(r in l=e.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:Eo,type:e,key:s,ref:o,props:i,_owner:Jh.current}}function A1(e,t){return{$$typeof:Eo,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ed(e){return typeof e=="object"&&e!==null&&e.$$typeof===Eo}function B1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Cf=/\/+/g;function Qa(e,t){return typeof e=="object"&&e!==null&&e.key!=null?B1(""+e.key):t.toString(36)}function vl(e,t,n,r,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 Eo:case b1:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+Qa(o,0):r,kf(i)?(n="",e!=null&&(n=e.replace(Cf,"$&/")+"/"),vl(i,t,n,"",function(c){return c})):i!=null&&(ed(i)&&(i=A1(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Cf,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",kf(e))for(var l=0;l<e.length;l++){s=e[l];var a=r+Qa(s,l);o+=vl(s,t,n,a,i)}else if(a=M1(e),typeof a=="function")for(e=a.call(e),l=0;!(s=e.next()).done;)s=s.value,a=r+Qa(s,l++),o+=vl(s,t,n,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 Ko(e,t,n){if(e==null)return e;var r=[],i=0;return vl(e,r,"","",function(s){return t.call(n,s,i++)}),r}function N1(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ht={current:null},yl={transition:null},z1={ReactCurrentDispatcher:Ht,ReactCurrentBatchConfig:yl,ReactCurrentOwner:Jh};function Jm(){throw Error("act(...) is not supported in production builds of React.")}Ie.Children={map:Ko,forEach:function(e,t,n){Ko(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ko(e,function(){t++}),t},toArray:function(e){return Ko(e,function(t){return t})||[]},only:function(e){if(!ed(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ie.Component=ss;Ie.Fragment=k1;Ie.Profiler=E1;Ie.PureComponent=Qh;Ie.StrictMode=C1;Ie.Suspense=P1;Ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=z1;Ie.act=Jm;Ie.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=qm({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Jh.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)Gm.call(t,a)&&!Qm.hasOwnProperty(a)&&(r[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){l=Array(a);for(var c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}return{$$typeof:Eo,type:e.type,key:i,ref:s,props:r,_owner:o}};Ie.createContext=function(e){return e={$$typeof:R1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:T1,_context:e},e.Consumer=e};Ie.createElement=Zm;Ie.createFactory=function(e){var t=Zm.bind(null,e);return t.type=e,t};Ie.createRef=function(){return{current:null}};Ie.forwardRef=function(e){return{$$typeof:I1,render:e}};Ie.isValidElement=ed;Ie.lazy=function(e){return{$$typeof:D1,_payload:{_status:-1,_result:e},_init:N1}};Ie.memo=function(e,t){return{$$typeof:L1,type:e,compare:t===void 0?null:t}};Ie.startTransition=function(e){var t=yl.transition;yl.transition={};try{e()}finally{yl.transition=t}};Ie.unstable_act=Jm;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,n){return Ht.current.useImperativeHandle(e,t,n)};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,n){return Ht.current.useReducer(e,t,n)};Ie.useRef=function(e){return Ht.current.useRef(e)};Ie.useState=function(e){return Ht.current.useState(e)};Ie.useSyncExternalStore=function(e,t,n){return Ht.current.useSyncExternalStore(e,t,n)};Ie.useTransition=function(){return Ht.current.useTransition()};Ie.version="18.3.1";Km.exports=Ie;var x=Km.exports;const O1=Gh(x),j1=x1({__proto__:null,default:O1},[x]);/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@ var d1=Object.defineProperty;var f1=(e,t,n)=>t in e?d1(e,t,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var D1=x,M1=Symbol.for("react.element"),A1=Symbol.for("react.fragment"),B1=Object.prototype.hasOwnProperty,N1=D1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,z1={key:!0,ref:!0,__self:!0,__source:!0};function Hm(e,t,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)B1.call(t,r)&&!z1.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:M1,type:e,key:s,ref:o,props:i,_owner:N1.current}}da.Fragment=A1;da.jsx=Hm;da.jsxs=Hm;Mm.exports=da;var p=Mm.exports,Um={exports:{}},tn={},Km={exports:{}},Vm={};/**
17
+ */var F1=x,$1=Symbol.for("react.element"),W1=Symbol.for("react.fragment"),H1=Object.prototype.hasOwnProperty,U1=F1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,K1={key:!0,ref:!0,__self:!0,__source:!0};function e_(e,t,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)H1.call(t,r)&&!K1.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:$1,type:e,key:s,ref:o,props:i,_owner:U1.current}}ba.Fragment=W1;ba.jsx=e_;ba.jsxs=e_;Um.exports=ba;var p=Um.exports,t_={exports:{}},pn={},n_={exports:{}},r_={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@ var d1=Object.defineProperty;var f1=(e,t,n)=>t in e?d1(e,t,{enumerable:!0,config
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(L,W){var S=L.length;L.push(W);e:for(;0<S;){var Q=S-1>>>1,le=L[Q];if(0<i(le,W))L[Q]=W,L[S]=le,S=Q;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var W=L[0],S=L.pop();if(S!==W){L[0]=S;e:for(var Q=0,le=L.length,k=le>>>1;Q<k;){var ge=2*(Q+1)-1,ie=L[ge],z=ge+1,q=L[z];if(0>i(ie,S))z<le&&0>i(q,ie)?(L[Q]=q,L[z]=S,Q=z):(L[Q]=ie,L[ge]=S,Q=ge);else if(z<le&&0>i(q,S))L[Q]=q,L[z]=S,Q=z;else break e}}return W}function i(L,W){var S=L.sortIndex-W.sortIndex;return S!==0?S:L.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],c=[],h=1,u=null,d=3,f=!1,g=!1,m=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(L){for(var W=n(c);W!==null;){if(W.callback===null)r(c);else if(W.startTime<=L)r(c),W.sortIndex=W.expirationTime,t(a,W);else break;W=n(c)}}function E(L){if(m=!1,y(L),!g)if(n(a)!==null)g=!0,j(R);else{var W=n(c);W!==null&&H(E,W.startTime-L)}}function R(L,W){g=!1,m&&(m=!1,_($),$=-1),f=!0;var S=d;try{for(y(W),u=n(a);u!==null&&(!(u.expirationTime>W)||L&&!I());){var Q=u.callback;if(typeof Q=="function"){u.callback=null,d=u.priorityLevel;var le=Q(u.expirationTime<=W);W=e.unstable_now(),typeof le=="function"?u.callback=le:u===n(a)&&r(a),y(W)}else r(a);u=n(a)}if(u!==null)var k=!0;else{var ge=n(c);ge!==null&&H(E,ge.startTime-W),k=!1}return k}finally{u=null,d=S,f=!1}}var C=!1,M=null,$=-1,G=5,T=-1;function I(){return!(e.unstable_now()-T<G)}function A(){if(M!==null){var L=e.unstable_now();T=L;var W=!0;try{W=M(!0,L)}finally{W?P():(C=!1,M=null)}}else C=!1}var P;if(typeof v=="function")P=function(){v(A)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,B=U.port2;U.port1.onmessage=A,P=function(){B.postMessage(null)}}else P=function(){w(A,0)};function j(L){M=L,C||(C=!0,P())}function H(L,W){$=w(function(){L(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_continueExecution=function(){g||f||(g=!0,j(R))},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return n(a)},e.unstable_next=function(L){switch(d){case 1:case 2:case 3:var W=3;break;default:W=d}var S=d;d=W;try{return L()}finally{d=S}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(L,W){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var S=d;d=L;try{return W()}finally{d=S}},e.unstable_scheduleCallback=function(L,W,S){var Q=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?Q+S:Q):S=Q,L){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=S+le,L={id:h++,callback:W,priorityLevel:L,startTime:S,expirationTime:le,sortIndex:-1},S>Q?(L.sortIndex=S,t(c,L),n(a)===null&&L===n(c)&&(m?(_($),$=-1):m=!0,H(E,S-Q))):(L.sortIndex=le,t(a,L),g||f||(g=!0,j(R))),L},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(L){var W=d;return function(){var S=d;d=W;try{return L.apply(this,arguments)}finally{d=S}}}})(Vm);Km.exports=Vm;var O1=Km.exports;/**
25
+ */(function(e){function t(L,W){var S=L.length;L.push(W);e:for(;0<S;){var Q=S-1>>>1,le=L[Q];if(0<i(le,W))L[Q]=W,L[S]=le,S=Q;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var W=L[0],S=L.pop();if(S!==W){L[0]=S;e:for(var Q=0,le=L.length,k=le>>>1;Q<k;){var ge=2*(Q+1)-1,te=L[ge],F=ge+1,ie=L[F];if(0>i(te,S))F<le&&0>i(ie,te)?(L[Q]=ie,L[F]=S,Q=F):(L[Q]=te,L[ge]=S,Q=ge);else if(F<le&&0>i(ie,S))L[Q]=ie,L[F]=S,Q=F;else break e}}return W}function i(L,W){var S=L.sortIndex-W.sortIndex;return S!==0?S:L.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],c=[],h=1,u=null,d=3,f=!1,g=!1,m=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(L){for(var W=n(c);W!==null;){if(W.callback===null)r(c);else if(W.startTime<=L)r(c),W.sortIndex=W.expirationTime,t(a,W);else break;W=n(c)}}function E(L){if(m=!1,y(L),!g)if(n(a)!==null)g=!0,O(R);else{var W=n(c);W!==null&&H(E,W.startTime-L)}}function R(L,W){g=!1,m&&(m=!1,_($),$=-1),f=!0;var S=d;try{for(y(W),u=n(a);u!==null&&(!(u.expirationTime>W)||L&&!P());){var Q=u.callback;if(typeof Q=="function"){u.callback=null,d=u.priorityLevel;var le=Q(u.expirationTime<=W);W=e.unstable_now(),typeof le=="function"?u.callback=le:u===n(a)&&r(a),y(W)}else r(a);u=n(a)}if(u!==null)var k=!0;else{var ge=n(c);ge!==null&&H(E,ge.startTime-W),k=!1}return k}finally{u=null,d=S,f=!1}}var C=!1,M=null,$=-1,G=5,T=-1;function P(){return!(e.unstable_now()-T<G)}function B(){if(M!==null){var L=e.unstable_now();T=L;var W=!0;try{W=M(!0,L)}finally{W?D():(C=!1,M=null)}}else C=!1}var D;if(typeof v=="function")D=function(){v(B)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,A=U.port2;U.port1.onmessage=B,D=function(){A.postMessage(null)}}else D=function(){w(B,0)};function O(L){M=L,C||(C=!0,D())}function H(L,W){$=w(function(){L(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_continueExecution=function(){g||f||(g=!0,O(R))},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return n(a)},e.unstable_next=function(L){switch(d){case 1:case 2:case 3:var W=3;break;default:W=d}var S=d;d=W;try{return L()}finally{d=S}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(L,W){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var S=d;d=L;try{return W()}finally{d=S}},e.unstable_scheduleCallback=function(L,W,S){var Q=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?Q+S:Q):S=Q,L){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=S+le,L={id:h++,callback:W,priorityLevel:L,startTime:S,expirationTime:le,sortIndex:-1},S>Q?(L.sortIndex=S,t(c,L),n(a)===null&&L===n(c)&&(m?(_($),$=-1):m=!0,H(E,S-Q))):(L.sortIndex=le,t(a,L),g||f||(g=!0,O(R))),L},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(L){var W=d;return function(){var S=d;d=W;try{return L.apply(this,arguments)}finally{d=S}}}})(r_);n_.exports=r_;var V1=n_.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,14 +30,14 @@ var d1=Object.defineProperty;var f1=(e,t,n)=>t in e?d1(e,t,{enumerable:!0,config
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var j1=x,en=O1;function ee(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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 qm=new Set,qs={};function hi(e,t){Wi(e,t),Wi(e+"Capture",t)}function Wi(e,t){for(qs[e]=t,e=0;e<t.length;e++)qm.add(t[e])}var er=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qc=Object.prototype.hasOwnProperty,F1=/^[: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]*$/,gf={},mf={};function $1(e){return qc.call(mf,e)?!0:qc.call(gf,e)?!1:F1.test(e)?mf[e]=!0:(gf[e]=!0,!1)}function W1(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function H1(e,t,n,r){if(t===null||typeof t>"u"||W1(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.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 Bt(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var wt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){wt[e]=new Bt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];wt[t]=new Bt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){wt[e]=new Bt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){wt[e]=new Bt(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){wt[e]=new Bt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){wt[e]=new Bt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){wt[e]=new Bt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){wt[e]=new Bt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){wt[e]=new Bt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Uh=/[\-:]([a-z])/g;function Kh(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(Uh,Kh);wt[t]=new Bt(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(Uh,Kh);wt[t]=new Bt(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(Uh,Kh);wt[t]=new Bt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){wt[e]=new Bt(e,1,!1,e.toLowerCase(),null,!1,!1)});wt.xlinkHref=new Bt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){wt[e]=new Bt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Vh(e,t,n,r){var i=wt.hasOwnProperty(t)?wt[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(H1(t,n,i,r)&&(n=null),r||i===null?$1(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var ir=j1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Bo=Symbol.for("react.element"),xi=Symbol.for("react.portal"),bi=Symbol.for("react.fragment"),qh=Symbol.for("react.strict_mode"),Yc=Symbol.for("react.profiler"),Ym=Symbol.for("react.provider"),Xm=Symbol.for("react.context"),Yh=Symbol.for("react.forward_ref"),Xc=Symbol.for("react.suspense"),Gc=Symbol.for("react.suspense_list"),Xh=Symbol.for("react.memo"),pr=Symbol.for("react.lazy"),Gm=Symbol.for("react.offscreen"),_f=Symbol.iterator;function ls(e){return e===null||typeof e!="object"?null:(e=_f&&e[_f]||e["@@iterator"],typeof e=="function"?e:null)}var qe=Object.assign,$a;function Cs(e){if($a===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);$a=t&&t[1]||""}return`
34
- `+$a+e}var Wa=!1;function Ha(e,t){if(!e||Wa)return"";Wa=!0;var n=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 r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
33
+ */var q1=x,fn=V1;function ee(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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 i_=new Set,to={};function yi(e,t){Gi(e,t),Gi(e+"Capture",t)}function Gi(e,t){for(to[e]=t,e=0;e<t.length;e++)i_.add(t[e])}var ar=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),iu=Object.prototype.hasOwnProperty,Y1=/^[: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]*$/,Ef={},Tf={};function X1(e){return iu.call(Tf,e)?!0:iu.call(Ef,e)?!1:Y1.test(e)?Tf[e]=!0:(Ef[e]=!0,!1)}function G1(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Q1(e,t,n,r){if(t===null||typeof t>"u"||G1(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.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,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Rt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Rt[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];Rt[t]=new Ut(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Rt[e]=new Ut(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Rt[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){Rt[e]=new Ut(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Rt[e]=new Ut(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Rt[e]=new Ut(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Rt[e]=new Ut(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Rt[e]=new Ut(e,5,!1,e.toLowerCase(),null,!1,!1)});var td=/[\-:]([a-z])/g;function nd(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(td,nd);Rt[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(td,nd);Rt[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(td,nd);Rt[t]=new Ut(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Rt[e]=new Ut(e,1,!1,e.toLowerCase(),null,!1,!1)});Rt.xlinkHref=new Ut("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Rt[e]=new Ut(e,1,!1,e.toLowerCase(),null,!0,!0)});function rd(e,t,n,r){var i=Rt.hasOwnProperty(t)?Rt[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Q1(t,n,i,r)&&(n=null),r||i===null?X1(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var dr=q1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Vo=Symbol.for("react.element"),Pi=Symbol.for("react.portal"),Li=Symbol.for("react.fragment"),id=Symbol.for("react.strict_mode"),su=Symbol.for("react.profiler"),s_=Symbol.for("react.provider"),o_=Symbol.for("react.context"),sd=Symbol.for("react.forward_ref"),ou=Symbol.for("react.suspense"),lu=Symbol.for("react.suspense_list"),od=Symbol.for("react.memo"),wr=Symbol.for("react.lazy"),l_=Symbol.for("react.offscreen"),Rf=Symbol.iterator;function gs(e){return e===null||typeof e!="object"?null:(e=Rf&&e[Rf]||e["@@iterator"],typeof e=="function"?e:null)}var Xe=Object.assign,Za;function Ms(e){if(Za===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Za=t&&t[1]||""}return`
34
+ `+Za+e}var Ja=!1;function ec(e,t){if(!e||Ja)return"";Ja=!0;var n=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 r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
35
35
  `),s=r.stack.split(`
36
36
  `),o=i.length-1,l=s.length-1;1<=o&&0<=l&&i[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==s[l]){var a=`
37
- `+i[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Wa=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Cs(e):""}function U1(e){switch(e.tag){case 5:return Cs(e.type);case 16:return Cs("Lazy");case 13:return Cs("Suspense");case 19:return Cs("SuspenseList");case 0:case 2:case 15:return e=Ha(e.type,!1),e;case 11:return e=Ha(e.type.render,!1),e;case 1:return e=Ha(e.type,!0),e;default:return""}}function Qc(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 xi:return"Portal";case Yc:return"Profiler";case qh:return"StrictMode";case Xc:return"Suspense";case Gc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Xm:return(e.displayName||"Context")+".Consumer";case Ym:return(e._context.displayName||"Context")+".Provider";case Yh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Xh:return t=e.displayName||null,t!==null?t:Qc(e.type)||"Memo";case pr:t=e._payload,e=e._init;try{return Qc(e(t))}catch{}}return null}function K1(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 Qc(t);case 8:return t===qh?"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 Dr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Qm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function V1(e){var t=Qm(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function No(e){e._valueTracker||(e._valueTracker=V1(e))}function Zm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Qm(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Pl(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 Zc(e,t){var n=t.checked;return qe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function vf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Dr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Jm(e,t){t=t.checked,t!=null&&Vh(e,"checked",t,!1)}function Jc(e,t){Jm(e,t);var n=Dr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?eu(e,t.type,n):t.hasOwnProperty("defaultValue")&&eu(e,t.type,Dr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function yf(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function eu(e,t,n){(t!=="number"||Pl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Es=Array.isArray;function Bi(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Dr(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function tu(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ee(91));return qe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Sf(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ee(92));if(Es(n)){if(1<n.length)throw Error(ee(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Dr(n)}}function e_(e,t){var n=Dr(t.value),r=Dr(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function wf(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function t_(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 nu(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?t_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var zo,n_=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,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 Ys(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var As={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},q1=["Webkit","ms","Moz","O"];Object.keys(As).forEach(function(e){q1.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),As[t]=As[e]})});function r_(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||As.hasOwnProperty(e)&&As[e]?(""+t).trim():t+"px"}function i_(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=r_(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Y1=qe({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 ru(e,t){if(t){if(Y1[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function iu(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 su=null;function Gh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ou=null,Ni=null,zi=null;function xf(e){if(e=wo(e)){if(typeof ou!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=_a(t),ou(e.stateNode,e.type,t))}}function s_(e){Ni?zi?zi.push(e):zi=[e]:Ni=e}function o_(){if(Ni){var e=Ni,t=zi;if(zi=Ni=null,xf(e),t)for(e=0;e<t.length;e++)xf(t[e])}}function l_(e,t){return e(t)}function a_(){}var Ua=!1;function c_(e,t,n){if(Ua)return e(t,n);Ua=!0;try{return l_(e,t,n)}finally{Ua=!1,(Ni!==null||zi!==null)&&(a_(),o_())}}function Xs(e,t){var n=e.stateNode;if(n===null)return null;var r=_a(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ee(231,t,typeof n));return n}var lu=!1;if(er)try{var as={};Object.defineProperty(as,"passive",{get:function(){lu=!0}}),window.addEventListener("test",as,as),window.removeEventListener("test",as,as)}catch{lu=!1}function X1(e,t,n,r,i,s,o,l,a){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(h){this.onError(h)}}var Bs=!1,Dl=null,Ml=!1,au=null,G1={onError:function(e){Bs=!0,Dl=e}};function Q1(e,t,n,r,i,s,o,l,a){Bs=!1,Dl=null,X1.apply(G1,arguments)}function Z1(e,t,n,r,i,s,o,l,a){if(Q1.apply(this,arguments),Bs){if(Bs){var c=Dl;Bs=!1,Dl=null}else throw Error(ee(198));Ml||(Ml=!0,au=c)}}function di(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u_(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 bf(e){if(di(e)!==e)throw Error(ee(188))}function J1(e){var t=e.alternate;if(!t){if(t=di(e),t===null)throw Error(ee(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return bf(i),e;if(s===r)return bf(i),t;s=s.sibling}throw Error(ee(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o)throw Error(ee(189))}}if(n.alternate!==r)throw Error(ee(190))}if(n.tag!==3)throw Error(ee(188));return n.stateNode.current===n?e:t}function h_(e){return e=J1(e),e!==null?d_(e):null}function d_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=d_(e);if(t!==null)return t;e=e.sibling}return null}var f_=en.unstable_scheduleCallback,kf=en.unstable_cancelCallback,eS=en.unstable_shouldYield,tS=en.unstable_requestPaint,Je=en.unstable_now,nS=en.unstable_getCurrentPriorityLevel,Qh=en.unstable_ImmediatePriority,p_=en.unstable_UserBlockingPriority,Al=en.unstable_NormalPriority,rS=en.unstable_LowPriority,g_=en.unstable_IdlePriority,fa=null,On=null;function iS(e){if(On&&typeof On.onCommitFiberRoot=="function")try{On.onCommitFiberRoot(fa,e,void 0,(e.current.flags&128)===128)}catch{}}var kn=Math.clz32?Math.clz32:lS,sS=Math.log,oS=Math.LN2;function lS(e){return e>>>=0,e===0?32:31-(sS(e)/oS|0)|0}var Oo=64,jo=4194304;function Ts(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 Bl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Ts(l):(s&=o,s!==0&&(r=Ts(s)))}else o=n&~i,o!==0?r=Ts(o):s!==0&&(r=Ts(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-kn(t),i=1<<n,r|=e[n],t&=~i;return r}function aS(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 cS(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-kn(s),l=1<<o,a=i[o];a===-1?(!(l&n)||l&r)&&(i[o]=aS(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function cu(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function m_(){var e=Oo;return Oo<<=1,!(Oo&4194240)&&(Oo=64),e}function Ka(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function yo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-kn(t),e[t]=n}function uS(e,t){var n=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 r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-kn(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function Zh(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-kn(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Le=0;function __(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var v_,Jh,y_,S_,w_,uu=!1,Fo=[],br=null,kr=null,Cr=null,Gs=new Map,Qs=new Map,_r=[],hS="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 Cf(e,t){switch(e){case"focusin":case"focusout":br=null;break;case"dragenter":case"dragleave":kr=null;break;case"mouseover":case"mouseout":Cr=null;break;case"pointerover":case"pointerout":Gs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qs.delete(t.pointerId)}}function cs(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=wo(t),t!==null&&Jh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function dS(e,t,n,r,i){switch(t){case"focusin":return br=cs(br,e,t,n,r,i),!0;case"dragenter":return kr=cs(kr,e,t,n,r,i),!0;case"mouseover":return Cr=cs(Cr,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return Gs.set(s,cs(Gs.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,Qs.set(s,cs(Qs.get(s)||null,e,t,n,r,i)),!0}return!1}function x_(e){var t=Xr(e.target);if(t!==null){var n=di(t);if(n!==null){if(t=n.tag,t===13){if(t=u_(n),t!==null){e.blockedOn=t,w_(e.priority,function(){y_(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function cl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);su=r,n.target.dispatchEvent(r),su=null}else return t=wo(n),t!==null&&Jh(t),e.blockedOn=n,!1;t.shift()}return!0}function Ef(e,t,n){cl(e)&&n.delete(t)}function fS(){uu=!1,br!==null&&cl(br)&&(br=null),kr!==null&&cl(kr)&&(kr=null),Cr!==null&&cl(Cr)&&(Cr=null),Gs.forEach(Ef),Qs.forEach(Ef)}function us(e,t){e.blockedOn===t&&(e.blockedOn=null,uu||(uu=!0,en.unstable_scheduleCallback(en.unstable_NormalPriority,fS)))}function Zs(e){function t(i){return us(i,e)}if(0<Fo.length){us(Fo[0],e);for(var n=1;n<Fo.length;n++){var r=Fo[n];r.blockedOn===e&&(r.blockedOn=null)}}for(br!==null&&us(br,e),kr!==null&&us(kr,e),Cr!==null&&us(Cr,e),Gs.forEach(t),Qs.forEach(t),n=0;n<_r.length;n++)r=_r[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<_r.length&&(n=_r[0],n.blockedOn===null);)x_(n),n.blockedOn===null&&_r.shift()}var Oi=ir.ReactCurrentBatchConfig,Nl=!0;function pS(e,t,n,r){var i=Le,s=Oi.transition;Oi.transition=null;try{Le=1,ed(e,t,n,r)}finally{Le=i,Oi.transition=s}}function gS(e,t,n,r){var i=Le,s=Oi.transition;Oi.transition=null;try{Le=4,ed(e,t,n,r)}finally{Le=i,Oi.transition=s}}function ed(e,t,n,r){if(Nl){var i=hu(e,t,n,r);if(i===null)tc(e,t,r,zl,n),Cf(e,r);else if(dS(i,e,t,n,r))r.stopPropagation();else if(Cf(e,r),t&4&&-1<hS.indexOf(e)){for(;i!==null;){var s=wo(i);if(s!==null&&v_(s),s=hu(e,t,n,r),s===null&&tc(e,t,r,zl,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else tc(e,t,r,null,n)}}var zl=null;function hu(e,t,n,r){if(zl=null,e=Gh(r),e=Xr(e),e!==null)if(t=di(e),t===null)e=null;else if(n=t.tag,n===13){if(e=u_(t),e!==null)return e;e=null}else if(n===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 b_(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(nS()){case Qh:return 1;case p_:return 4;case Al:case rS:return 16;case g_:return 536870912;default:return 16}default:return 16}}var yr=null,td=null,ul=null;function k_(){if(ul)return ul;var e,t=td,n=t.length,r,i="value"in yr?yr.value:yr.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return ul=i.slice(e,1<r?1-r:void 0)}function hl(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 $o(){return!0}function Tf(){return!1}function nn(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?$o:Tf,this.isPropagationStopped=Tf,this}return qe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=$o)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=$o)},persist:function(){},isPersistent:$o}),t}var Zi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},nd=nn(Zi),So=qe({},Zi,{view:0,detail:0}),mS=nn(So),Va,qa,hs,pa=qe({},So,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rd,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!==hs&&(hs&&e.type==="mousemove"?(Va=e.screenX-hs.screenX,qa=e.screenY-hs.screenY):qa=Va=0,hs=e),Va)},movementY:function(e){return"movementY"in e?e.movementY:qa}}),Rf=nn(pa),_S=qe({},pa,{dataTransfer:0}),vS=nn(_S),yS=qe({},So,{relatedTarget:0}),Ya=nn(yS),SS=qe({},Zi,{animationName:0,elapsedTime:0,pseudoElement:0}),wS=nn(SS),xS=qe({},Zi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bS=nn(xS),kS=qe({},Zi,{data:0}),If=nn(kS),CS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ES={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"},TS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=TS[e])?!!t[e]:!1}function rd(){return RS}var IS=qe({},So,{key:function(e){if(e.key){var t=CS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ES[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rd,charCode:function(e){return e.type==="keypress"?hl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),LS=nn(IS),PS=qe({},pa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lf=nn(PS),DS=qe({},So,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rd}),MS=nn(DS),AS=qe({},Zi,{propertyName:0,elapsedTime:0,pseudoElement:0}),BS=nn(AS),NS=qe({},pa,{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}),zS=nn(NS),OS=[9,13,27,32],id=er&&"CompositionEvent"in window,Ns=null;er&&"documentMode"in document&&(Ns=document.documentMode);var jS=er&&"TextEvent"in window&&!Ns,C_=er&&(!id||Ns&&8<Ns&&11>=Ns),Pf=" ",Df=!1;function E_(e,t){switch(e){case"keyup":return OS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function T_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ki=!1;function FS(e,t){switch(e){case"compositionend":return T_(t);case"keypress":return t.which!==32?null:(Df=!0,Pf);case"textInput":return e=t.data,e===Pf&&Df?null:e;default:return null}}function $S(e,t){if(ki)return e==="compositionend"||!id&&E_(e,t)?(e=k_(),ul=td=yr=null,ki=!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 C_&&t.locale!=="ko"?null:t.data;default:return null}}var WS={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 Mf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!WS[e.type]:t==="textarea"}function R_(e,t,n,r){s_(r),t=Ol(t,"onChange"),0<t.length&&(n=new nd("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var zs=null,Js=null;function HS(e){j_(e,0)}function ga(e){var t=Ti(e);if(Zm(t))return e}function US(e,t){if(e==="change")return t}var I_=!1;if(er){var Xa;if(er){var Ga="oninput"in document;if(!Ga){var Af=document.createElement("div");Af.setAttribute("oninput","return;"),Ga=typeof Af.oninput=="function"}Xa=Ga}else Xa=!1;I_=Xa&&(!document.documentMode||9<document.documentMode)}function Bf(){zs&&(zs.detachEvent("onpropertychange",L_),Js=zs=null)}function L_(e){if(e.propertyName==="value"&&ga(Js)){var t=[];R_(t,Js,e,Gh(e)),c_(HS,t)}}function KS(e,t,n){e==="focusin"?(Bf(),zs=t,Js=n,zs.attachEvent("onpropertychange",L_)):e==="focusout"&&Bf()}function VS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ga(Js)}function qS(e,t){if(e==="click")return ga(t)}function YS(e,t){if(e==="input"||e==="change")return ga(t)}function XS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Tn=typeof Object.is=="function"?Object.is:XS;function eo(e,t){if(Tn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!qc.call(t,i)||!Tn(e[i],t[i]))return!1}return!0}function Nf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function zf(e,t){var n=Nf(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Nf(n)}}function P_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?P_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function D_(){for(var e=window,t=Pl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pl(e.document)}return t}function sd(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 GS(e){var t=D_(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&P_(n.ownerDocument.documentElement,n)){if(r!==null&&sd(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=zf(n,s);var o=zf(n,r);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>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var QS=er&&"documentMode"in document&&11>=document.documentMode,Ci=null,du=null,Os=null,fu=!1;function Of(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;fu||Ci==null||Ci!==Pl(r)||(r=Ci,"selectionStart"in r&&sd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Os&&eo(Os,r)||(Os=r,r=Ol(du,"onSelect"),0<r.length&&(t=new nd("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ci)))}function Wo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ei={animationend:Wo("Animation","AnimationEnd"),animationiteration:Wo("Animation","AnimationIteration"),animationstart:Wo("Animation","AnimationStart"),transitionend:Wo("Transition","TransitionEnd")},Qa={},M_={};er&&(M_=document.createElement("div").style,"AnimationEvent"in window||(delete Ei.animationend.animation,delete Ei.animationiteration.animation,delete Ei.animationstart.animation),"TransitionEvent"in window||delete Ei.transitionend.transition);function ma(e){if(Qa[e])return Qa[e];if(!Ei[e])return e;var t=Ei[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in M_)return Qa[e]=t[n];return e}var A_=ma("animationend"),B_=ma("animationiteration"),N_=ma("animationstart"),z_=ma("transitionend"),O_=new Map,jf="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 Ar(e,t){O_.set(e,t),hi(t,[e])}for(var Za=0;Za<jf.length;Za++){var Ja=jf[Za],ZS=Ja.toLowerCase(),JS=Ja[0].toUpperCase()+Ja.slice(1);Ar(ZS,"on"+JS)}Ar(A_,"onAnimationEnd");Ar(B_,"onAnimationIteration");Ar(N_,"onAnimationStart");Ar("dblclick","onDoubleClick");Ar("focusin","onFocus");Ar("focusout","onBlur");Ar(z_,"onTransitionEnd");Wi("onMouseEnter",["mouseout","mouseover"]);Wi("onMouseLeave",["mouseout","mouseover"]);Wi("onPointerEnter",["pointerout","pointerover"]);Wi("onPointerLeave",["pointerout","pointerover"]);hi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));hi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));hi("onBeforeInput",["compositionend","keypress","textInput","paste"]);hi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));hi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));hi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Rs="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(" "),ew=new Set("cancel close invalid load scroll toggle".split(" ").concat(Rs));function Ff(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Z1(r,t,void 0,e),e.currentTarget=null}function j_(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==s&&i.isPropagationStopped())break e;Ff(i,l,c),s=a}else for(o=0;o<r.length;o++){if(l=r[o],a=l.instance,c=l.currentTarget,l=l.listener,a!==s&&i.isPropagationStopped())break e;Ff(i,l,c),s=a}}}if(Ml)throw e=au,Ml=!1,au=null,e}function Oe(e,t){var n=t[vu];n===void 0&&(n=t[vu]=new Set);var r=e+"__bubble";n.has(r)||(F_(t,e,2,!1),n.add(r))}function ec(e,t,n){var r=0;t&&(r|=4),F_(n,e,r,t)}var Ho="_reactListening"+Math.random().toString(36).slice(2);function to(e){if(!e[Ho]){e[Ho]=!0,qm.forEach(function(n){n!=="selectionchange"&&(ew.has(n)||ec(n,!1,e),ec(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ho]||(t[Ho]=!0,ec("selectionchange",!1,t))}}function F_(e,t,n,r){switch(b_(t)){case 1:var i=pS;break;case 4:i=gS;break;default:i=ed}n=i.bind(null,t,n,e),i=void 0,!lu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function tc(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=r.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=Xr(l),o===null)return;if(a=o.tag,a===5||a===6){r=s=o;continue e}l=l.parentNode}}r=r.return}c_(function(){var c=s,h=Gh(n),u=[];e:{var d=O_.get(e);if(d!==void 0){var f=nd,g=e;switch(e){case"keypress":if(hl(n)===0)break e;case"keydown":case"keyup":f=LS;break;case"focusin":g="focus",f=Ya;break;case"focusout":g="blur",f=Ya;break;case"beforeblur":case"afterblur":f=Ya;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=Rf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=vS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=MS;break;case A_:case B_:case N_:f=wS;break;case z_:f=BS;break;case"scroll":f=mS;break;case"wheel":f=zS;break;case"copy":case"cut":case"paste":f=bS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=Lf}var m=(t&4)!==0,w=!m&&e==="scroll",_=m?d!==null?d+"Capture":null:d;m=[];for(var v=c,y;v!==null;){y=v;var E=y.stateNode;if(y.tag===5&&E!==null&&(y=E,_!==null&&(E=Xs(v,_),E!=null&&m.push(no(v,E,y)))),w)break;v=v.return}0<m.length&&(d=new f(d,g,null,n,h),u.push({event:d,listeners:m}))}}if(!(t&7)){e:{if(d=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",d&&n!==su&&(g=n.relatedTarget||n.fromElement)&&(Xr(g)||g[tr]))break e;if((f||d)&&(d=h.window===h?h:(d=h.ownerDocument)?d.defaultView||d.parentWindow:window,f?(g=n.relatedTarget||n.toElement,f=c,g=g?Xr(g):null,g!==null&&(w=di(g),g!==w||g.tag!==5&&g.tag!==6)&&(g=null)):(f=null,g=c),f!==g)){if(m=Rf,E="onMouseLeave",_="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(m=Lf,E="onPointerLeave",_="onPointerEnter",v="pointer"),w=f==null?d:Ti(f),y=g==null?d:Ti(g),d=new m(E,v+"leave",f,n,h),d.target=w,d.relatedTarget=y,E=null,Xr(h)===c&&(m=new m(_,v+"enter",g,n,h),m.target=y,m.relatedTarget=w,E=m),w=E,f&&g)t:{for(m=f,_=g,v=0,y=m;y;y=_i(y))v++;for(y=0,E=_;E;E=_i(E))y++;for(;0<v-y;)m=_i(m),v--;for(;0<y-v;)_=_i(_),y--;for(;v--;){if(m===_||_!==null&&m===_.alternate)break t;m=_i(m),_=_i(_)}m=null}else m=null;f!==null&&$f(u,d,f,m,!1),g!==null&&w!==null&&$f(u,w,g,m,!0)}}e:{if(d=c?Ti(c):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var R=US;else if(Mf(d))if(I_)R=YS;else{R=VS;var C=KS}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(R=qS);if(R&&(R=R(e,c))){R_(u,R,n,h);break e}C&&C(e,d,c),e==="focusout"&&(C=d._wrapperState)&&C.controlled&&d.type==="number"&&eu(d,"number",d.value)}switch(C=c?Ti(c):window,e){case"focusin":(Mf(C)||C.contentEditable==="true")&&(Ci=C,du=c,Os=null);break;case"focusout":Os=du=Ci=null;break;case"mousedown":fu=!0;break;case"contextmenu":case"mouseup":case"dragend":fu=!1,Of(u,n,h);break;case"selectionchange":if(QS)break;case"keydown":case"keyup":Of(u,n,h)}var M;if(id)e:{switch(e){case"compositionstart":var $="onCompositionStart";break e;case"compositionend":$="onCompositionEnd";break e;case"compositionupdate":$="onCompositionUpdate";break e}$=void 0}else ki?E_(e,n)&&($="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&($="onCompositionStart");$&&(C_&&n.locale!=="ko"&&(ki||$!=="onCompositionStart"?$==="onCompositionEnd"&&ki&&(M=k_()):(yr=h,td="value"in yr?yr.value:yr.textContent,ki=!0)),C=Ol(c,$),0<C.length&&($=new If($,e,null,n,h),u.push({event:$,listeners:C}),M?$.data=M:(M=T_(n),M!==null&&($.data=M)))),(M=jS?FS(e,n):$S(e,n))&&(c=Ol(c,"onBeforeInput"),0<c.length&&(h=new If("onBeforeInput","beforeinput",null,n,h),u.push({event:h,listeners:c}),h.data=M))}j_(u,t)})}function no(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ol(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Xs(e,n),s!=null&&r.unshift(no(e,s,i)),s=Xs(e,t),s!=null&&r.push(no(e,s,i))),e=e.return}return r}function _i(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function $f(e,t,n,r,i){for(var s=t._reactName,o=[];n!==null&&n!==r;){var l=n,a=l.alternate,c=l.stateNode;if(a!==null&&a===r)break;l.tag===5&&c!==null&&(l=c,i?(a=Xs(n,s),a!=null&&o.unshift(no(n,a,l))):i||(a=Xs(n,s),a!=null&&o.push(no(n,a,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var tw=/\r\n?/g,nw=/\u0000|\uFFFD/g;function Wf(e){return(typeof e=="string"?e:""+e).replace(tw,`
38
- `).replace(nw,"")}function Uo(e,t,n){if(t=Wf(t),Wf(e)!==t&&n)throw Error(ee(425))}function jl(){}var pu=null,gu=null;function mu(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 _u=typeof setTimeout=="function"?setTimeout:void 0,rw=typeof clearTimeout=="function"?clearTimeout:void 0,Hf=typeof Promise=="function"?Promise:void 0,iw=typeof queueMicrotask=="function"?queueMicrotask:typeof Hf<"u"?function(e){return Hf.resolve(null).then(e).catch(sw)}:_u;function sw(e){setTimeout(function(){throw e})}function nc(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Zs(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Zs(t)}function Er(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 Uf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Ji=Math.random().toString(36).slice(2),Nn="__reactFiber$"+Ji,ro="__reactProps$"+Ji,tr="__reactContainer$"+Ji,vu="__reactEvents$"+Ji,ow="__reactListeners$"+Ji,lw="__reactHandles$"+Ji;function Xr(e){var t=e[Nn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[tr]||n[Nn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Uf(e);e!==null;){if(n=e[Nn])return n;e=Uf(e)}return t}e=n,n=e.parentNode}return null}function wo(e){return e=e[Nn]||e[tr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ti(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ee(33))}function _a(e){return e[ro]||null}var yu=[],Ri=-1;function Br(e){return{current:e}}function Fe(e){0>Ri||(e.current=yu[Ri],yu[Ri]=null,Ri--)}function Ne(e,t){Ri++,yu[Ri]=e.current,e.current=t}var Mr={},Rt=Br(Mr),Wt=Br(!1),ri=Mr;function Hi(e,t){var n=e.type.contextTypes;if(!n)return Mr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ht(e){return e=e.childContextTypes,e!=null}function Fl(){Fe(Wt),Fe(Rt)}function Kf(e,t,n){if(Rt.current!==Mr)throw Error(ee(168));Ne(Rt,t),Ne(Wt,n)}function $_(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(ee(108,K1(e)||"Unknown",i));return qe({},n,r)}function $l(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Mr,ri=Rt.current,Ne(Rt,e),Ne(Wt,Wt.current),!0}function Vf(e,t,n){var r=e.stateNode;if(!r)throw Error(ee(169));n?(e=$_(e,t,ri),r.__reactInternalMemoizedMergedChildContext=e,Fe(Wt),Fe(Rt),Ne(Rt,e)):Fe(Wt),Ne(Wt,n)}var Yn=null,va=!1,rc=!1;function W_(e){Yn===null?Yn=[e]:Yn.push(e)}function aw(e){va=!0,W_(e)}function Nr(){if(!rc&&Yn!==null){rc=!0;var e=0,t=Le;try{var n=Yn;for(Le=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Yn=null,va=!1}catch(i){throw Yn!==null&&(Yn=Yn.slice(e+1)),f_(Qh,Nr),i}finally{Le=t,rc=!1}}return null}var Ii=[],Li=0,Wl=null,Hl=0,cn=[],un=0,ii=null,Gn=1,Qn="";function Wr(e,t){Ii[Li++]=Hl,Ii[Li++]=Wl,Wl=e,Hl=t}function H_(e,t,n){cn[un++]=Gn,cn[un++]=Qn,cn[un++]=ii,ii=e;var r=Gn;e=Qn;var i=32-kn(r)-1;r&=~(1<<i),n+=1;var s=32-kn(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Gn=1<<32-kn(t)+i|n<<i|r,Qn=s+e}else Gn=1<<s|n<<i|r,Qn=e}function od(e){e.return!==null&&(Wr(e,1),H_(e,1,0))}function ld(e){for(;e===Wl;)Wl=Ii[--Li],Ii[Li]=null,Hl=Ii[--Li],Ii[Li]=null;for(;e===ii;)ii=cn[--un],cn[un]=null,Qn=cn[--un],cn[un]=null,Gn=cn[--un],cn[un]=null}var Zt=null,Qt=null,$e=!1,xn=null;function U_(e,t){var n=dn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function qf(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Zt=e,Qt=Er(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Zt=e,Qt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ii!==null?{id:Gn,overflow:Qn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=dn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Zt=e,Qt=null,!0):!1;default:return!1}}function Su(e){return(e.mode&1)!==0&&(e.flags&128)===0}function wu(e){if($e){var t=Qt;if(t){var n=t;if(!qf(e,t)){if(Su(e))throw Error(ee(418));t=Er(n.nextSibling);var r=Zt;t&&qf(e,t)?U_(r,n):(e.flags=e.flags&-4097|2,$e=!1,Zt=e)}}else{if(Su(e))throw Error(ee(418));e.flags=e.flags&-4097|2,$e=!1,Zt=e}}}function Yf(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Zt=e}function Ko(e){if(e!==Zt)return!1;if(!$e)return Yf(e),$e=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!mu(e.type,e.memoizedProps)),t&&(t=Qt)){if(Su(e))throw K_(),Error(ee(418));for(;t;)U_(e,t),t=Er(t.nextSibling)}if(Yf(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Qt=Er(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Qt=null}}else Qt=Zt?Er(e.stateNode.nextSibling):null;return!0}function K_(){for(var e=Qt;e;)e=Er(e.nextSibling)}function Ui(){Qt=Zt=null,$e=!1}function ad(e){xn===null?xn=[e]:xn.push(e)}var cw=ir.ReactCurrentBatchConfig;function ds(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ee(309));var r=n.stateNode}if(!r)throw Error(ee(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(ee(284));if(!n._owner)throw Error(ee(290,e))}return e}function Vo(e,t){throw e=Object.prototype.toString.call(t),Error(ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Xf(e){var t=e._init;return t(e._payload)}function V_(e){function t(_,v){if(e){var y=_.deletions;y===null?(_.deletions=[v],_.flags|=16):y.push(v)}}function n(_,v){if(!e)return null;for(;v!==null;)t(_,v),v=v.sibling;return null}function r(_,v){for(_=new Map;v!==null;)v.key!==null?_.set(v.key,v):_.set(v.index,v),v=v.sibling;return _}function i(_,v){return _=Lr(_,v),_.index=0,_.sibling=null,_}function s(_,v,y){return _.index=y,e?(y=_.alternate,y!==null?(y=y.index,y<v?(_.flags|=2,v):y):(_.flags|=2,v)):(_.flags|=1048576,v)}function o(_){return e&&_.alternate===null&&(_.flags|=2),_}function l(_,v,y,E){return v===null||v.tag!==6?(v=uc(y,_.mode,E),v.return=_,v):(v=i(v,y),v.return=_,v)}function a(_,v,y,E){var R=y.type;return R===bi?h(_,v,y.props.children,E,y.key):v!==null&&(v.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===pr&&Xf(R)===v.type)?(E=i(v,y.props),E.ref=ds(_,v,y),E.return=_,E):(E=vl(y.type,y.key,y.props,null,_.mode,E),E.ref=ds(_,v,y),E.return=_,E)}function c(_,v,y,E){return v===null||v.tag!==4||v.stateNode.containerInfo!==y.containerInfo||v.stateNode.implementation!==y.implementation?(v=hc(y,_.mode,E),v.return=_,v):(v=i(v,y.children||[]),v.return=_,v)}function h(_,v,y,E,R){return v===null||v.tag!==7?(v=ei(y,_.mode,E,R),v.return=_,v):(v=i(v,y),v.return=_,v)}function u(_,v,y){if(typeof v=="string"&&v!==""||typeof v=="number")return v=uc(""+v,_.mode,y),v.return=_,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Bo:return y=vl(v.type,v.key,v.props,null,_.mode,y),y.ref=ds(_,null,v),y.return=_,y;case xi:return v=hc(v,_.mode,y),v.return=_,v;case pr:var E=v._init;return u(_,E(v._payload),y)}if(Es(v)||ls(v))return v=ei(v,_.mode,y,null),v.return=_,v;Vo(_,v)}return null}function d(_,v,y,E){var R=v!==null?v.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return R!==null?null:l(_,v,""+y,E);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Bo:return y.key===R?a(_,v,y,E):null;case xi:return y.key===R?c(_,v,y,E):null;case pr:return R=y._init,d(_,v,R(y._payload),E)}if(Es(y)||ls(y))return R!==null?null:h(_,v,y,E,null);Vo(_,y)}return null}function f(_,v,y,E,R){if(typeof E=="string"&&E!==""||typeof E=="number")return _=_.get(y)||null,l(v,_,""+E,R);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case Bo:return _=_.get(E.key===null?y:E.key)||null,a(v,_,E,R);case xi:return _=_.get(E.key===null?y:E.key)||null,c(v,_,E,R);case pr:var C=E._init;return f(_,v,y,C(E._payload),R)}if(Es(E)||ls(E))return _=_.get(y)||null,h(v,_,E,R,null);Vo(v,E)}return null}function g(_,v,y,E){for(var R=null,C=null,M=v,$=v=0,G=null;M!==null&&$<y.length;$++){M.index>$?(G=M,M=null):G=M.sibling;var T=d(_,M,y[$],E);if(T===null){M===null&&(M=G);break}e&&M&&T.alternate===null&&t(_,M),v=s(T,v,$),C===null?R=T:C.sibling=T,C=T,M=G}if($===y.length)return n(_,M),$e&&Wr(_,$),R;if(M===null){for(;$<y.length;$++)M=u(_,y[$],E),M!==null&&(v=s(M,v,$),C===null?R=M:C.sibling=M,C=M);return $e&&Wr(_,$),R}for(M=r(_,M);$<y.length;$++)G=f(M,_,$,y[$],E),G!==null&&(e&&G.alternate!==null&&M.delete(G.key===null?$:G.key),v=s(G,v,$),C===null?R=G:C.sibling=G,C=G);return e&&M.forEach(function(I){return t(_,I)}),$e&&Wr(_,$),R}function m(_,v,y,E){var R=ls(y);if(typeof R!="function")throw Error(ee(150));if(y=R.call(y),y==null)throw Error(ee(151));for(var C=R=null,M=v,$=v=0,G=null,T=y.next();M!==null&&!T.done;$++,T=y.next()){M.index>$?(G=M,M=null):G=M.sibling;var I=d(_,M,T.value,E);if(I===null){M===null&&(M=G);break}e&&M&&I.alternate===null&&t(_,M),v=s(I,v,$),C===null?R=I:C.sibling=I,C=I,M=G}if(T.done)return n(_,M),$e&&Wr(_,$),R;if(M===null){for(;!T.done;$++,T=y.next())T=u(_,T.value,E),T!==null&&(v=s(T,v,$),C===null?R=T:C.sibling=T,C=T);return $e&&Wr(_,$),R}for(M=r(_,M);!T.done;$++,T=y.next())T=f(M,_,$,T.value,E),T!==null&&(e&&T.alternate!==null&&M.delete(T.key===null?$:T.key),v=s(T,v,$),C===null?R=T:C.sibling=T,C=T);return e&&M.forEach(function(A){return t(_,A)}),$e&&Wr(_,$),R}function w(_,v,y,E){if(typeof y=="object"&&y!==null&&y.type===bi&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Bo:e:{for(var R=y.key,C=v;C!==null;){if(C.key===R){if(R=y.type,R===bi){if(C.tag===7){n(_,C.sibling),v=i(C,y.props.children),v.return=_,_=v;break e}}else if(C.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===pr&&Xf(R)===C.type){n(_,C.sibling),v=i(C,y.props),v.ref=ds(_,C,y),v.return=_,_=v;break e}n(_,C);break}else t(_,C);C=C.sibling}y.type===bi?(v=ei(y.props.children,_.mode,E,y.key),v.return=_,_=v):(E=vl(y.type,y.key,y.props,null,_.mode,E),E.ref=ds(_,v,y),E.return=_,_=E)}return o(_);case xi:e:{for(C=y.key;v!==null;){if(v.key===C)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){n(_,v.sibling),v=i(v,y.children||[]),v.return=_,_=v;break e}else{n(_,v);break}else t(_,v);v=v.sibling}v=hc(y,_.mode,E),v.return=_,_=v}return o(_);case pr:return C=y._init,w(_,v,C(y._payload),E)}if(Es(y))return g(_,v,y,E);if(ls(y))return m(_,v,y,E);Vo(_,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(n(_,v.sibling),v=i(v,y),v.return=_,_=v):(n(_,v),v=uc(y,_.mode,E),v.return=_,_=v),o(_)):n(_,v)}return w}var Ki=V_(!0),q_=V_(!1),Ul=Br(null),Kl=null,Pi=null,cd=null;function ud(){cd=Pi=Kl=null}function hd(e){var t=Ul.current;Fe(Ul),e._currentValue=t}function xu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ji(e,t){Kl=e,cd=Pi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&($t=!0),e.firstContext=null)}function gn(e){var t=e._currentValue;if(cd!==e)if(e={context:e,memoizedValue:t,next:null},Pi===null){if(Kl===null)throw Error(ee(308));Pi=e,Kl.dependencies={lanes:0,firstContext:e}}else Pi=Pi.next=e;return t}var Gr=null;function dd(e){Gr===null?Gr=[e]:Gr.push(e)}function Y_(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,dd(t)):(n.next=i.next,i.next=n),t.interleaved=n,nr(e,r)}function nr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var gr=!1;function fd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function X_(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 Jn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Tr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ie&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,nr(e,n)}return i=r.interleaved,i===null?(t.next=t,dd(r)):(t.next=i.next,i.next=t),r.interleaved=t,nr(e,n)}function dl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zh(e,n)}}function Gf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Vl(e,t,n,r){var i=e.updateQueue;gr=!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 d=l.lane,f=l.eventTime;if((r&d)===d){h!==null&&(h=h.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,m=l;switch(d=t,f=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){u=g.call(f,u,d);break e}u=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,d=typeof g=="function"?g.call(f,u,d):g,d==null)break e;u=qe({},u,d);break e;case 2:gr=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,d=i.effects,d===null?i.effects=[l]:d.push(l))}else f={eventTime:f,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(c=h=f,a=u):h=h.next=f,o|=d;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;d=l,l=d.next,d.next=null,i.lastBaseUpdate=d,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);oi|=o,e.lanes=o,e.memoizedState=u}}function Qf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(ee(191,i));i.call(r)}}}var xo={},jn=Br(xo),io=Br(xo),so=Br(xo);function Qr(e){if(e===xo)throw Error(ee(174));return e}function pd(e,t){switch(Ne(so,t),Ne(io,e),Ne(jn,xo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:nu(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=nu(t,e)}Fe(jn),Ne(jn,t)}function Vi(){Fe(jn),Fe(io),Fe(so)}function G_(e){Qr(so.current);var t=Qr(jn.current),n=nu(t,e.type);t!==n&&(Ne(io,e),Ne(jn,n))}function gd(e){io.current===e&&(Fe(jn),Fe(io))}var Ke=Br(0);function ql(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.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 ic=[];function md(){for(var e=0;e<ic.length;e++)ic[e]._workInProgressVersionPrimary=null;ic.length=0}var fl=ir.ReactCurrentDispatcher,sc=ir.ReactCurrentBatchConfig,si=0,Ve=null,lt=null,ht=null,Yl=!1,js=!1,oo=0,uw=0;function bt(){throw Error(ee(321))}function _d(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Tn(e[n],t[n]))return!1;return!0}function vd(e,t,n,r,i,s){if(si=s,Ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,fl.current=e===null||e.memoizedState===null?pw:gw,e=n(r,i),js){s=0;do{if(js=!1,oo=0,25<=s)throw Error(ee(301));s+=1,ht=lt=null,t.updateQueue=null,fl.current=mw,e=n(r,i)}while(js)}if(fl.current=Xl,t=lt!==null&&lt.next!==null,si=0,ht=lt=Ve=null,Yl=!1,t)throw Error(ee(300));return e}function yd(){var e=oo!==0;return oo=0,e}function Mn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ht===null?Ve.memoizedState=ht=e:ht=ht.next=e,ht}function mn(){if(lt===null){var e=Ve.alternate;e=e!==null?e.memoizedState:null}else e=lt.next;var t=ht===null?Ve.memoizedState:ht.next;if(t!==null)ht=t,lt=e;else{if(e===null)throw Error(ee(310));lt=e,e={memoizedState:lt.memoizedState,baseState:lt.baseState,baseQueue:lt.baseQueue,queue:lt.queue,next:null},ht===null?Ve.memoizedState=ht=e:ht=ht.next=e}return ht}function lo(e,t){return typeof t=="function"?t(e):t}function oc(e){var t=mn(),n=t.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=e;var r=lt,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var l=o=null,a=null,c=s;do{var h=c.lane;if((si&h)===h)a!==null&&(a=a.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var u={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=u,o=r):a=a.next=u,Ve.lanes|=h,oi|=h}c=c.next}while(c!==null&&c!==s);a===null?o=r:a.next=l,Tn(r,t.memoizedState)||($t=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=a,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,Ve.lanes|=s,oi|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function lc(e){var t=mn(),n=t.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);Tn(s,t.memoizedState)||($t=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function Q_(){}function Z_(e,t){var n=Ve,r=mn(),i=t(),s=!Tn(r.memoizedState,i);if(s&&(r.memoizedState=i,$t=!0),r=r.queue,Sd(tv.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||ht!==null&&ht.memoizedState.tag&1){if(n.flags|=2048,ao(9,ev.bind(null,n,r,i,t),void 0,null),gt===null)throw Error(ee(349));si&30||J_(n,t,i)}return i}function J_(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ve.updateQueue,t===null?(t={lastEffect:null,stores:null},Ve.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ev(e,t,n,r){t.value=n,t.getSnapshot=r,nv(t)&&rv(e)}function tv(e,t,n){return n(function(){nv(t)&&rv(e)})}function nv(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Tn(e,n)}catch{return!0}}function rv(e){var t=nr(e,1);t!==null&&Cn(t,e,1,-1)}function Zf(e){var t=Mn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:lo,lastRenderedState:e},t.queue=e,e=e.dispatch=fw.bind(null,Ve,e),[t.memoizedState,e]}function ao(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ve.updateQueue,t===null?(t={lastEffect:null,stores:null},Ve.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function iv(){return mn().memoizedState}function pl(e,t,n,r){var i=Mn();Ve.flags|=e,i.memoizedState=ao(1|t,n,void 0,r===void 0?null:r)}function ya(e,t,n,r){var i=mn();r=r===void 0?null:r;var s=void 0;if(lt!==null){var o=lt.memoizedState;if(s=o.destroy,r!==null&&_d(r,o.deps)){i.memoizedState=ao(t,n,s,r);return}}Ve.flags|=e,i.memoizedState=ao(1|t,n,s,r)}function Jf(e,t){return pl(8390656,8,e,t)}function Sd(e,t){return ya(2048,8,e,t)}function sv(e,t){return ya(4,2,e,t)}function ov(e,t){return ya(4,4,e,t)}function lv(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 av(e,t,n){return n=n!=null?n.concat([e]):null,ya(4,4,lv.bind(null,t,e),n)}function wd(){}function cv(e,t){var n=mn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&_d(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function uv(e,t){var n=mn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&_d(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function hv(e,t,n){return si&21?(Tn(n,t)||(n=m_(),Ve.lanes|=n,oi|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,$t=!0),e.memoizedState=n)}function hw(e,t){var n=Le;Le=n!==0&&4>n?n:4,e(!0);var r=sc.transition;sc.transition={};try{e(!1),t()}finally{Le=n,sc.transition=r}}function dv(){return mn().memoizedState}function dw(e,t,n){var r=Ir(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},fv(e))pv(t,n);else if(n=Y_(e,t,n,r),n!==null){var i=Mt();Cn(n,e,r,i),gv(n,t,r)}}function fw(e,t,n){var r=Ir(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(fv(e))pv(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,n);if(i.hasEagerState=!0,i.eagerState=l,Tn(l,o)){var a=t.interleaved;a===null?(i.next=i,dd(t)):(i.next=a.next,a.next=i),t.interleaved=i;return}}catch{}finally{}n=Y_(e,t,i,r),n!==null&&(i=Mt(),Cn(n,e,r,i),gv(n,t,r))}}function fv(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function pv(e,t){js=Yl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gv(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zh(e,n)}}var Xl={readContext:gn,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useInsertionEffect:bt,useLayoutEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useMutableSource:bt,useSyncExternalStore:bt,useId:bt,unstable_isNewReconciler:!1},pw={readContext:gn,useCallback:function(e,t){return Mn().memoizedState=[e,t===void 0?null:t],e},useContext:gn,useEffect:Jf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pl(4194308,4,lv.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pl(4194308,4,e,t)},useInsertionEffect:function(e,t){return pl(4,2,e,t)},useMemo:function(e,t){var n=Mn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Mn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=dw.bind(null,Ve,e),[r.memoizedState,e]},useRef:function(e){var t=Mn();return e={current:e},t.memoizedState=e},useState:Zf,useDebugValue:wd,useDeferredValue:function(e){return Mn().memoizedState=e},useTransition:function(){var e=Zf(!1),t=e[0];return e=hw.bind(null,e[1]),Mn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ve,i=Mn();if($e){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=t(),gt===null)throw Error(ee(349));si&30||J_(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Jf(tv.bind(null,r,s,e),[e]),r.flags|=2048,ao(9,ev.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Mn(),t=gt.identifierPrefix;if($e){var n=Qn,r=Gn;n=(r&~(1<<32-kn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=oo++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=uw++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},gw={readContext:gn,useCallback:cv,useContext:gn,useEffect:Sd,useImperativeHandle:av,useInsertionEffect:sv,useLayoutEffect:ov,useMemo:uv,useReducer:oc,useRef:iv,useState:function(){return oc(lo)},useDebugValue:wd,useDeferredValue:function(e){var t=mn();return hv(t,lt.memoizedState,e)},useTransition:function(){var e=oc(lo)[0],t=mn().memoizedState;return[e,t]},useMutableSource:Q_,useSyncExternalStore:Z_,useId:dv,unstable_isNewReconciler:!1},mw={readContext:gn,useCallback:cv,useContext:gn,useEffect:Sd,useImperativeHandle:av,useInsertionEffect:sv,useLayoutEffect:ov,useMemo:uv,useReducer:lc,useRef:iv,useState:function(){return lc(lo)},useDebugValue:wd,useDeferredValue:function(e){var t=mn();return lt===null?t.memoizedState=e:hv(t,lt.memoizedState,e)},useTransition:function(){var e=lc(lo)[0],t=mn().memoizedState;return[e,t]},useMutableSource:Q_,useSyncExternalStore:Z_,useId:dv,unstable_isNewReconciler:!1};function Sn(e,t){if(e&&e.defaultProps){t=qe({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function bu(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:qe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Sa={isMounted:function(e){return(e=e._reactInternals)?di(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Mt(),i=Ir(e),s=Jn(r,i);s.payload=t,n!=null&&(s.callback=n),t=Tr(e,s,i),t!==null&&(Cn(t,e,i,r),dl(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Mt(),i=Ir(e),s=Jn(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Tr(e,s,i),t!==null&&(Cn(t,e,i,r),dl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Mt(),r=Ir(e),i=Jn(n,r);i.tag=2,t!=null&&(i.callback=t),t=Tr(e,i,r),t!==null&&(Cn(t,e,r,n),dl(t,e,r))}};function ep(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!eo(n,r)||!eo(i,s):!0}function mv(e,t,n){var r=!1,i=Mr,s=t.contextType;return typeof s=="object"&&s!==null?s=gn(s):(i=Ht(t)?ri:Rt.current,r=t.contextTypes,s=(r=r!=null)?Hi(e,i):Mr),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Sa,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function tp(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Sa.enqueueReplaceState(t,t.state,null)}function ku(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},fd(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=gn(s):(s=Ht(t)?ri:Rt.current,i.context=Hi(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(bu(e,t,s,n),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&&Sa.enqueueReplaceState(i,i.state,null),Vl(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function qi(e,t){try{var n="",r=t;do n+=U1(r),r=r.return;while(r);var i=n}catch(s){i=`
37
+ `+i[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Ja=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ms(e):""}function Z1(e){switch(e.tag){case 5:return Ms(e.type);case 16:return Ms("Lazy");case 13:return Ms("Suspense");case 19:return Ms("SuspenseList");case 0:case 2:case 15:return e=ec(e.type,!1),e;case 11:return e=ec(e.type.render,!1),e;case 1:return e=ec(e.type,!0),e;default:return""}}function au(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 Li:return"Fragment";case Pi:return"Portal";case su:return"Profiler";case id:return"StrictMode";case ou:return"Suspense";case lu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case o_:return(e.displayName||"Context")+".Consumer";case s_:return(e._context.displayName||"Context")+".Provider";case sd:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case od:return t=e.displayName||null,t!==null?t:au(e.type)||"Memo";case wr:t=e._payload,e=e._init;try{return au(e(t))}catch{}}return null}function J1(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 au(t);case 8:return t===id?"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 jr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function a_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function eS(e){var t=a_(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qo(e){e._valueTracker||(e._valueTracker=eS(e))}function c_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=a_(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Wl(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 cu(e,t){var n=t.checked;return Xe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function If(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=jr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function u_(e,t){t=t.checked,t!=null&&rd(e,"checked",t,!1)}function uu(e,t){u_(e,t);var n=jr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?hu(e,t.type,n):t.hasOwnProperty("defaultValue")&&hu(e,t.type,jr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pf(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function hu(e,t,n){(t!=="number"||Wl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var As=Array.isArray;function Hi(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+jr(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function du(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ee(91));return Xe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Lf(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ee(92));if(As(n)){if(1<n.length)throw Error(ee(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:jr(n)}}function h_(e,t){var n=jr(t.value),r=jr(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Df(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function d_(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 fu(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?d_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Yo,f_=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Yo=Yo||document.createElement("div"),Yo.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Yo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function no(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ws={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},tS=["Webkit","ms","Moz","O"];Object.keys(Ws).forEach(function(e){tS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ws[t]=Ws[e]})});function p_(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ws.hasOwnProperty(e)&&Ws[e]?(""+t).trim():t+"px"}function g_(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=p_(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var nS=Xe({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 pu(e,t){if(t){if(nS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function gu(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 mu=null;function ld(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _u=null,Ui=null,Ki=null;function Mf(e){if(e=Io(e)){if(typeof _u!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=Ra(t),_u(e.stateNode,e.type,t))}}function m_(e){Ui?Ki?Ki.push(e):Ki=[e]:Ui=e}function __(){if(Ui){var e=Ui,t=Ki;if(Ki=Ui=null,Mf(e),t)for(e=0;e<t.length;e++)Mf(t[e])}}function v_(e,t){return e(t)}function y_(){}var tc=!1;function S_(e,t,n){if(tc)return e(t,n);tc=!0;try{return v_(e,t,n)}finally{tc=!1,(Ui!==null||Ki!==null)&&(y_(),__())}}function ro(e,t){var n=e.stateNode;if(n===null)return null;var r=Ra(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ee(231,t,typeof n));return n}var vu=!1;if(ar)try{var ms={};Object.defineProperty(ms,"passive",{get:function(){vu=!0}}),window.addEventListener("test",ms,ms),window.removeEventListener("test",ms,ms)}catch{vu=!1}function rS(e,t,n,r,i,s,o,l,a){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(h){this.onError(h)}}var Hs=!1,Hl=null,Ul=!1,yu=null,iS={onError:function(e){Hs=!0,Hl=e}};function sS(e,t,n,r,i,s,o,l,a){Hs=!1,Hl=null,rS.apply(iS,arguments)}function oS(e,t,n,r,i,s,o,l,a){if(sS.apply(this,arguments),Hs){if(Hs){var c=Hl;Hs=!1,Hl=null}else throw Error(ee(198));Ul||(Ul=!0,yu=c)}}function Si(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function w_(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 Af(e){if(Si(e)!==e)throw Error(ee(188))}function lS(e){var t=e.alternate;if(!t){if(t=Si(e),t===null)throw Error(ee(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return Af(i),e;if(s===r)return Af(i),t;s=s.sibling}throw Error(ee(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o)throw Error(ee(189))}}if(n.alternate!==r)throw Error(ee(190))}if(n.tag!==3)throw Error(ee(188));return n.stateNode.current===n?e:t}function x_(e){return e=lS(e),e!==null?b_(e):null}function b_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=b_(e);if(t!==null)return t;e=e.sibling}return null}var k_=fn.unstable_scheduleCallback,Bf=fn.unstable_cancelCallback,aS=fn.unstable_shouldYield,cS=fn.unstable_requestPaint,st=fn.unstable_now,uS=fn.unstable_getCurrentPriorityLevel,ad=fn.unstable_ImmediatePriority,C_=fn.unstable_UserBlockingPriority,Kl=fn.unstable_NormalPriority,hS=fn.unstable_LowPriority,E_=fn.unstable_IdlePriority,ka=null,Yn=null;function dS(e){if(Yn&&typeof Yn.onCommitFiberRoot=="function")try{Yn.onCommitFiberRoot(ka,e,void 0,(e.current.flags&128)===128)}catch{}}var An=Math.clz32?Math.clz32:gS,fS=Math.log,pS=Math.LN2;function gS(e){return e>>>=0,e===0?32:31-(fS(e)/pS|0)|0}var Xo=64,Go=4194304;function Bs(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 Vl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Bs(l):(s&=o,s!==0&&(r=Bs(s)))}else o=n&~i,o!==0?r=Bs(o):s!==0&&(r=Bs(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-An(t),i=1<<n,r|=e[n],t&=~i;return r}function mS(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 _S(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-An(s),l=1<<o,a=i[o];a===-1?(!(l&n)||l&r)&&(i[o]=mS(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function Su(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function T_(){var e=Xo;return Xo<<=1,!(Xo&4194240)&&(Xo=64),e}function nc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function To(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-An(t),e[t]=n}function vS(e,t){var n=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 r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-An(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function cd(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-An(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Me=0;function R_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var I_,ud,P_,L_,D_,wu=!1,Qo=[],Pr=null,Lr=null,Dr=null,io=new Map,so=new Map,kr=[],yS="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 Nf(e,t){switch(e){case"focusin":case"focusout":Pr=null;break;case"dragenter":case"dragleave":Lr=null;break;case"mouseover":case"mouseout":Dr=null;break;case"pointerover":case"pointerout":io.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":so.delete(t.pointerId)}}function _s(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=Io(t),t!==null&&ud(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function SS(e,t,n,r,i){switch(t){case"focusin":return Pr=_s(Pr,e,t,n,r,i),!0;case"dragenter":return Lr=_s(Lr,e,t,n,r,i),!0;case"mouseover":return Dr=_s(Dr,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return io.set(s,_s(io.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,so.set(s,_s(so.get(s)||null,e,t,n,r,i)),!0}return!1}function M_(e){var t=ri(e.target);if(t!==null){var n=Si(t);if(n!==null){if(t=n.tag,t===13){if(t=w_(n),t!==null){e.blockedOn=t,D_(e.priority,function(){P_(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Sl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=xu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);mu=r,n.target.dispatchEvent(r),mu=null}else return t=Io(n),t!==null&&ud(t),e.blockedOn=n,!1;t.shift()}return!0}function zf(e,t,n){Sl(e)&&n.delete(t)}function wS(){wu=!1,Pr!==null&&Sl(Pr)&&(Pr=null),Lr!==null&&Sl(Lr)&&(Lr=null),Dr!==null&&Sl(Dr)&&(Dr=null),io.forEach(zf),so.forEach(zf)}function vs(e,t){e.blockedOn===t&&(e.blockedOn=null,wu||(wu=!0,fn.unstable_scheduleCallback(fn.unstable_NormalPriority,wS)))}function oo(e){function t(i){return vs(i,e)}if(0<Qo.length){vs(Qo[0],e);for(var n=1;n<Qo.length;n++){var r=Qo[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Pr!==null&&vs(Pr,e),Lr!==null&&vs(Lr,e),Dr!==null&&vs(Dr,e),io.forEach(t),so.forEach(t),n=0;n<kr.length;n++)r=kr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<kr.length&&(n=kr[0],n.blockedOn===null);)M_(n),n.blockedOn===null&&kr.shift()}var Vi=dr.ReactCurrentBatchConfig,ql=!0;function xS(e,t,n,r){var i=Me,s=Vi.transition;Vi.transition=null;try{Me=1,hd(e,t,n,r)}finally{Me=i,Vi.transition=s}}function bS(e,t,n,r){var i=Me,s=Vi.transition;Vi.transition=null;try{Me=4,hd(e,t,n,r)}finally{Me=i,Vi.transition=s}}function hd(e,t,n,r){if(ql){var i=xu(e,t,n,r);if(i===null)dc(e,t,r,Yl,n),Nf(e,r);else if(SS(i,e,t,n,r))r.stopPropagation();else if(Nf(e,r),t&4&&-1<yS.indexOf(e)){for(;i!==null;){var s=Io(i);if(s!==null&&I_(s),s=xu(e,t,n,r),s===null&&dc(e,t,r,Yl,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else dc(e,t,r,null,n)}}var Yl=null;function xu(e,t,n,r){if(Yl=null,e=ld(r),e=ri(e),e!==null)if(t=Si(e),t===null)e=null;else if(n=t.tag,n===13){if(e=w_(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Yl=e,null}function A_(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(uS()){case ad:return 1;case C_:return 4;case Kl:case hS:return 16;case E_:return 536870912;default:return 16}default:return 16}}var Er=null,dd=null,wl=null;function B_(){if(wl)return wl;var e,t=dd,n=t.length,r,i="value"in Er?Er.value:Er.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return wl=i.slice(e,1<r?1-r:void 0)}function xl(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 Zo(){return!0}function Of(){return!1}function gn(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Zo:Of,this.isPropagationStopped=Of,this}return Xe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Zo)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Zo)},persist:function(){},isPersistent:Zo}),t}var os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fd=gn(os),Ro=Xe({},os,{view:0,detail:0}),kS=gn(Ro),rc,ic,ys,Ca=Xe({},Ro,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pd,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ys&&(ys&&e.type==="mousemove"?(rc=e.screenX-ys.screenX,ic=e.screenY-ys.screenY):ic=rc=0,ys=e),rc)},movementY:function(e){return"movementY"in e?e.movementY:ic}}),jf=gn(Ca),CS=Xe({},Ca,{dataTransfer:0}),ES=gn(CS),TS=Xe({},Ro,{relatedTarget:0}),sc=gn(TS),RS=Xe({},os,{animationName:0,elapsedTime:0,pseudoElement:0}),IS=gn(RS),PS=Xe({},os,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),LS=gn(PS),DS=Xe({},os,{data:0}),Ff=gn(DS),MS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AS={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"},BS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function NS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=BS[e])?!!t[e]:!1}function pd(){return NS}var zS=Xe({},Ro,{key:function(e){if(e.key){var t=MS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=xl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?AS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pd,charCode:function(e){return e.type==="keypress"?xl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?xl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),OS=gn(zS),jS=Xe({},Ca,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=gn(jS),FS=Xe({},Ro,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pd}),$S=gn(FS),WS=Xe({},os,{propertyName:0,elapsedTime:0,pseudoElement:0}),HS=gn(WS),US=Xe({},Ca,{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}),KS=gn(US),VS=[9,13,27,32],gd=ar&&"CompositionEvent"in window,Us=null;ar&&"documentMode"in document&&(Us=document.documentMode);var qS=ar&&"TextEvent"in window&&!Us,N_=ar&&(!gd||Us&&8<Us&&11>=Us),Wf=" ",Hf=!1;function z_(e,t){switch(e){case"keyup":return VS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function O_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Di=!1;function YS(e,t){switch(e){case"compositionend":return O_(t);case"keypress":return t.which!==32?null:(Hf=!0,Wf);case"textInput":return e=t.data,e===Wf&&Hf?null:e;default:return null}}function XS(e,t){if(Di)return e==="compositionend"||!gd&&z_(e,t)?(e=B_(),wl=dd=Er=null,Di=!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 N_&&t.locale!=="ko"?null:t.data;default:return null}}var GS={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 Uf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!GS[e.type]:t==="textarea"}function j_(e,t,n,r){m_(r),t=Xl(t,"onChange"),0<t.length&&(n=new fd("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ks=null,lo=null;function QS(e){G_(e,0)}function Ea(e){var t=Bi(e);if(c_(t))return e}function ZS(e,t){if(e==="change")return t}var F_=!1;if(ar){var oc;if(ar){var lc="oninput"in document;if(!lc){var Kf=document.createElement("div");Kf.setAttribute("oninput","return;"),lc=typeof Kf.oninput=="function"}oc=lc}else oc=!1;F_=oc&&(!document.documentMode||9<document.documentMode)}function Vf(){Ks&&(Ks.detachEvent("onpropertychange",$_),lo=Ks=null)}function $_(e){if(e.propertyName==="value"&&Ea(lo)){var t=[];j_(t,lo,e,ld(e)),S_(QS,t)}}function JS(e,t,n){e==="focusin"?(Vf(),Ks=t,lo=n,Ks.attachEvent("onpropertychange",$_)):e==="focusout"&&Vf()}function ew(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ea(lo)}function tw(e,t){if(e==="click")return Ea(t)}function nw(e,t){if(e==="input"||e==="change")return Ea(t)}function rw(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var zn=typeof Object.is=="function"?Object.is:rw;function ao(e,t){if(zn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!iu.call(t,i)||!zn(e[i],t[i]))return!1}return!0}function qf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Yf(e,t){var n=qf(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=qf(n)}}function W_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?W_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function H_(){for(var e=window,t=Wl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wl(e.document)}return t}function md(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 iw(e){var t=H_(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&W_(n.ownerDocument.documentElement,n)){if(r!==null&&md(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=Yf(n,s);var o=Yf(n,r);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>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var sw=ar&&"documentMode"in document&&11>=document.documentMode,Mi=null,bu=null,Vs=null,ku=!1;function Xf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ku||Mi==null||Mi!==Wl(r)||(r=Mi,"selectionStart"in r&&md(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vs&&ao(Vs,r)||(Vs=r,r=Xl(bu,"onSelect"),0<r.length&&(t=new fd("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Mi)))}function Jo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ai={animationend:Jo("Animation","AnimationEnd"),animationiteration:Jo("Animation","AnimationIteration"),animationstart:Jo("Animation","AnimationStart"),transitionend:Jo("Transition","TransitionEnd")},ac={},U_={};ar&&(U_=document.createElement("div").style,"AnimationEvent"in window||(delete Ai.animationend.animation,delete Ai.animationiteration.animation,delete Ai.animationstart.animation),"TransitionEvent"in window||delete Ai.transitionend.transition);function Ta(e){if(ac[e])return ac[e];if(!Ai[e])return e;var t=Ai[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in U_)return ac[e]=t[n];return e}var K_=Ta("animationend"),V_=Ta("animationiteration"),q_=Ta("animationstart"),Y_=Ta("transitionend"),X_=new Map,Gf="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 $r(e,t){X_.set(e,t),yi(t,[e])}for(var cc=0;cc<Gf.length;cc++){var uc=Gf[cc],ow=uc.toLowerCase(),lw=uc[0].toUpperCase()+uc.slice(1);$r(ow,"on"+lw)}$r(K_,"onAnimationEnd");$r(V_,"onAnimationIteration");$r(q_,"onAnimationStart");$r("dblclick","onDoubleClick");$r("focusin","onFocus");$r("focusout","onBlur");$r(Y_,"onTransitionEnd");Gi("onMouseEnter",["mouseout","mouseover"]);Gi("onMouseLeave",["mouseout","mouseover"]);Gi("onPointerEnter",["pointerout","pointerover"]);Gi("onPointerLeave",["pointerout","pointerover"]);yi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));yi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));yi("onBeforeInput",["compositionend","keypress","textInput","paste"]);yi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));yi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));yi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ns="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(" "),aw=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ns));function Qf(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,oS(r,t,void 0,e),e.currentTarget=null}function G_(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==s&&i.isPropagationStopped())break e;Qf(i,l,c),s=a}else for(o=0;o<r.length;o++){if(l=r[o],a=l.instance,c=l.currentTarget,l=l.listener,a!==s&&i.isPropagationStopped())break e;Qf(i,l,c),s=a}}}if(Ul)throw e=yu,Ul=!1,yu=null,e}function Fe(e,t){var n=t[Iu];n===void 0&&(n=t[Iu]=new Set);var r=e+"__bubble";n.has(r)||(Q_(t,e,2,!1),n.add(r))}function hc(e,t,n){var r=0;t&&(r|=4),Q_(n,e,r,t)}var el="_reactListening"+Math.random().toString(36).slice(2);function co(e){if(!e[el]){e[el]=!0,i_.forEach(function(n){n!=="selectionchange"&&(aw.has(n)||hc(n,!1,e),hc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[el]||(t[el]=!0,hc("selectionchange",!1,t))}}function Q_(e,t,n,r){switch(A_(t)){case 1:var i=xS;break;case 4:i=bS;break;default:i=hd}n=i.bind(null,t,n,e),i=void 0,!vu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function dc(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===i||a.nodeType===8&&a.parentNode===i))return;o=o.return}for(;l!==null;){if(o=ri(l),o===null)return;if(a=o.tag,a===5||a===6){r=s=o;continue e}l=l.parentNode}}r=r.return}S_(function(){var c=s,h=ld(n),u=[];e:{var d=X_.get(e);if(d!==void 0){var f=fd,g=e;switch(e){case"keypress":if(xl(n)===0)break e;case"keydown":case"keyup":f=OS;break;case"focusin":g="focus",f=sc;break;case"focusout":g="blur",f=sc;break;case"beforeblur":case"afterblur":f=sc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=jf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=ES;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=$S;break;case K_:case V_:case q_:f=IS;break;case Y_:f=HS;break;case"scroll":f=kS;break;case"wheel":f=KS;break;case"copy":case"cut":case"paste":f=LS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=$f}var m=(t&4)!==0,w=!m&&e==="scroll",_=m?d!==null?d+"Capture":null:d;m=[];for(var v=c,y;v!==null;){y=v;var E=y.stateNode;if(y.tag===5&&E!==null&&(y=E,_!==null&&(E=ro(v,_),E!=null&&m.push(uo(v,E,y)))),w)break;v=v.return}0<m.length&&(d=new f(d,g,null,n,h),u.push({event:d,listeners:m}))}}if(!(t&7)){e:{if(d=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",d&&n!==mu&&(g=n.relatedTarget||n.fromElement)&&(ri(g)||g[cr]))break e;if((f||d)&&(d=h.window===h?h:(d=h.ownerDocument)?d.defaultView||d.parentWindow:window,f?(g=n.relatedTarget||n.toElement,f=c,g=g?ri(g):null,g!==null&&(w=Si(g),g!==w||g.tag!==5&&g.tag!==6)&&(g=null)):(f=null,g=c),f!==g)){if(m=jf,E="onMouseLeave",_="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(m=$f,E="onPointerLeave",_="onPointerEnter",v="pointer"),w=f==null?d:Bi(f),y=g==null?d:Bi(g),d=new m(E,v+"leave",f,n,h),d.target=w,d.relatedTarget=y,E=null,ri(h)===c&&(m=new m(_,v+"enter",g,n,h),m.target=y,m.relatedTarget=w,E=m),w=E,f&&g)t:{for(m=f,_=g,v=0,y=m;y;y=Ci(y))v++;for(y=0,E=_;E;E=Ci(E))y++;for(;0<v-y;)m=Ci(m),v--;for(;0<y-v;)_=Ci(_),y--;for(;v--;){if(m===_||_!==null&&m===_.alternate)break t;m=Ci(m),_=Ci(_)}m=null}else m=null;f!==null&&Zf(u,d,f,m,!1),g!==null&&w!==null&&Zf(u,w,g,m,!0)}}e:{if(d=c?Bi(c):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var R=ZS;else if(Uf(d))if(F_)R=nw;else{R=ew;var C=JS}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(R=tw);if(R&&(R=R(e,c))){j_(u,R,n,h);break e}C&&C(e,d,c),e==="focusout"&&(C=d._wrapperState)&&C.controlled&&d.type==="number"&&hu(d,"number",d.value)}switch(C=c?Bi(c):window,e){case"focusin":(Uf(C)||C.contentEditable==="true")&&(Mi=C,bu=c,Vs=null);break;case"focusout":Vs=bu=Mi=null;break;case"mousedown":ku=!0;break;case"contextmenu":case"mouseup":case"dragend":ku=!1,Xf(u,n,h);break;case"selectionchange":if(sw)break;case"keydown":case"keyup":Xf(u,n,h)}var M;if(gd)e:{switch(e){case"compositionstart":var $="onCompositionStart";break e;case"compositionend":$="onCompositionEnd";break e;case"compositionupdate":$="onCompositionUpdate";break e}$=void 0}else Di?z_(e,n)&&($="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&($="onCompositionStart");$&&(N_&&n.locale!=="ko"&&(Di||$!=="onCompositionStart"?$==="onCompositionEnd"&&Di&&(M=B_()):(Er=h,dd="value"in Er?Er.value:Er.textContent,Di=!0)),C=Xl(c,$),0<C.length&&($=new Ff($,e,null,n,h),u.push({event:$,listeners:C}),M?$.data=M:(M=O_(n),M!==null&&($.data=M)))),(M=qS?YS(e,n):XS(e,n))&&(c=Xl(c,"onBeforeInput"),0<c.length&&(h=new Ff("onBeforeInput","beforeinput",null,n,h),u.push({event:h,listeners:c}),h.data=M))}G_(u,t)})}function uo(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Xl(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=ro(e,n),s!=null&&r.unshift(uo(e,s,i)),s=ro(e,t),s!=null&&r.push(uo(e,s,i))),e=e.return}return r}function Ci(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Zf(e,t,n,r,i){for(var s=t._reactName,o=[];n!==null&&n!==r;){var l=n,a=l.alternate,c=l.stateNode;if(a!==null&&a===r)break;l.tag===5&&c!==null&&(l=c,i?(a=ro(n,s),a!=null&&o.unshift(uo(n,a,l))):i||(a=ro(n,s),a!=null&&o.push(uo(n,a,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var cw=/\r\n?/g,uw=/\u0000|\uFFFD/g;function Jf(e){return(typeof e=="string"?e:""+e).replace(cw,`
38
+ `).replace(uw,"")}function tl(e,t,n){if(t=Jf(t),Jf(e)!==t&&n)throw Error(ee(425))}function Gl(){}var Cu=null,Eu=null;function Tu(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 Ru=typeof setTimeout=="function"?setTimeout:void 0,hw=typeof clearTimeout=="function"?clearTimeout:void 0,ep=typeof Promise=="function"?Promise:void 0,dw=typeof queueMicrotask=="function"?queueMicrotask:typeof ep<"u"?function(e){return ep.resolve(null).then(e).catch(fw)}:Ru;function fw(e){setTimeout(function(){throw e})}function fc(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),oo(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);oo(t)}function Mr(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 tp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var ls=Math.random().toString(36).slice(2),Vn="__reactFiber$"+ls,ho="__reactProps$"+ls,cr="__reactContainer$"+ls,Iu="__reactEvents$"+ls,pw="__reactListeners$"+ls,gw="__reactHandles$"+ls;function ri(e){var t=e[Vn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[cr]||n[Vn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=tp(e);e!==null;){if(n=e[Vn])return n;e=tp(e)}return t}e=n,n=e.parentNode}return null}function Io(e){return e=e[Vn]||e[cr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Bi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ee(33))}function Ra(e){return e[ho]||null}var Pu=[],Ni=-1;function Wr(e){return{current:e}}function We(e){0>Ni||(e.current=Pu[Ni],Pu[Ni]=null,Ni--)}function Oe(e,t){Ni++,Pu[Ni]=e.current,e.current=t}var Fr={},Bt=Wr(Fr),en=Wr(!1),hi=Fr;function Qi(e,t){var n=e.type.contextTypes;if(!n)return Fr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function tn(e){return e=e.childContextTypes,e!=null}function Ql(){We(en),We(Bt)}function np(e,t,n){if(Bt.current!==Fr)throw Error(ee(168));Oe(Bt,t),Oe(en,n)}function Z_(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(ee(108,J1(e)||"Unknown",i));return Xe({},n,r)}function Zl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Fr,hi=Bt.current,Oe(Bt,e),Oe(en,en.current),!0}function rp(e,t,n){var r=e.stateNode;if(!r)throw Error(ee(169));n?(e=Z_(e,t,hi),r.__reactInternalMemoizedMergedChildContext=e,We(en),We(Bt),Oe(Bt,e)):We(en),Oe(en,n)}var nr=null,Ia=!1,pc=!1;function J_(e){nr===null?nr=[e]:nr.push(e)}function mw(e){Ia=!0,J_(e)}function Hr(){if(!pc&&nr!==null){pc=!0;var e=0,t=Me;try{var n=nr;for(Me=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}nr=null,Ia=!1}catch(i){throw nr!==null&&(nr=nr.slice(e+1)),k_(ad,Hr),i}finally{Me=t,pc=!1}}return null}var zi=[],Oi=0,Jl=null,ea=0,Sn=[],wn=0,di=null,ir=1,sr="";function Gr(e,t){zi[Oi++]=ea,zi[Oi++]=Jl,Jl=e,ea=t}function ev(e,t,n){Sn[wn++]=ir,Sn[wn++]=sr,Sn[wn++]=di,di=e;var r=ir;e=sr;var i=32-An(r)-1;r&=~(1<<i),n+=1;var s=32-An(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ir=1<<32-An(t)+i|n<<i|r,sr=s+e}else ir=1<<s|n<<i|r,sr=e}function _d(e){e.return!==null&&(Gr(e,1),ev(e,1,0))}function vd(e){for(;e===Jl;)Jl=zi[--Oi],zi[Oi]=null,ea=zi[--Oi],zi[Oi]=null;for(;e===di;)di=Sn[--wn],Sn[wn]=null,sr=Sn[--wn],Sn[wn]=null,ir=Sn[--wn],Sn[wn]=null}var hn=null,un=null,He=!1,Dn=null;function tv(e,t){var n=bn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ip(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,hn=e,un=Mr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,hn=e,un=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=di!==null?{id:ir,overflow:sr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=bn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,hn=e,un=null,!0):!1;default:return!1}}function Lu(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Du(e){if(He){var t=un;if(t){var n=t;if(!ip(e,t)){if(Lu(e))throw Error(ee(418));t=Mr(n.nextSibling);var r=hn;t&&ip(e,t)?tv(r,n):(e.flags=e.flags&-4097|2,He=!1,hn=e)}}else{if(Lu(e))throw Error(ee(418));e.flags=e.flags&-4097|2,He=!1,hn=e}}}function sp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;hn=e}function nl(e){if(e!==hn)return!1;if(!He)return sp(e),He=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Tu(e.type,e.memoizedProps)),t&&(t=un)){if(Lu(e))throw nv(),Error(ee(418));for(;t;)tv(e,t),t=Mr(t.nextSibling)}if(sp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){un=Mr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}un=null}}else un=hn?Mr(e.stateNode.nextSibling):null;return!0}function nv(){for(var e=un;e;)e=Mr(e.nextSibling)}function Zi(){un=hn=null,He=!1}function yd(e){Dn===null?Dn=[e]:Dn.push(e)}var _w=dr.ReactCurrentBatchConfig;function Ss(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ee(309));var r=n.stateNode}if(!r)throw Error(ee(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(ee(284));if(!n._owner)throw Error(ee(290,e))}return e}function rl(e,t){throw e=Object.prototype.toString.call(t),Error(ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function op(e){var t=e._init;return t(e._payload)}function rv(e){function t(_,v){if(e){var y=_.deletions;y===null?(_.deletions=[v],_.flags|=16):y.push(v)}}function n(_,v){if(!e)return null;for(;v!==null;)t(_,v),v=v.sibling;return null}function r(_,v){for(_=new Map;v!==null;)v.key!==null?_.set(v.key,v):_.set(v.index,v),v=v.sibling;return _}function i(_,v){return _=zr(_,v),_.index=0,_.sibling=null,_}function s(_,v,y){return _.index=y,e?(y=_.alternate,y!==null?(y=y.index,y<v?(_.flags|=2,v):y):(_.flags|=2,v)):(_.flags|=1048576,v)}function o(_){return e&&_.alternate===null&&(_.flags|=2),_}function l(_,v,y,E){return v===null||v.tag!==6?(v=wc(y,_.mode,E),v.return=_,v):(v=i(v,y),v.return=_,v)}function a(_,v,y,E){var R=y.type;return R===Li?h(_,v,y.props.children,E,y.key):v!==null&&(v.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===wr&&op(R)===v.type)?(E=i(v,y.props),E.ref=Ss(_,v,y),E.return=_,E):(E=Il(y.type,y.key,y.props,null,_.mode,E),E.ref=Ss(_,v,y),E.return=_,E)}function c(_,v,y,E){return v===null||v.tag!==4||v.stateNode.containerInfo!==y.containerInfo||v.stateNode.implementation!==y.implementation?(v=xc(y,_.mode,E),v.return=_,v):(v=i(v,y.children||[]),v.return=_,v)}function h(_,v,y,E,R){return v===null||v.tag!==7?(v=ai(y,_.mode,E,R),v.return=_,v):(v=i(v,y),v.return=_,v)}function u(_,v,y){if(typeof v=="string"&&v!==""||typeof v=="number")return v=wc(""+v,_.mode,y),v.return=_,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Vo:return y=Il(v.type,v.key,v.props,null,_.mode,y),y.ref=Ss(_,null,v),y.return=_,y;case Pi:return v=xc(v,_.mode,y),v.return=_,v;case wr:var E=v._init;return u(_,E(v._payload),y)}if(As(v)||gs(v))return v=ai(v,_.mode,y,null),v.return=_,v;rl(_,v)}return null}function d(_,v,y,E){var R=v!==null?v.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return R!==null?null:l(_,v,""+y,E);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Vo:return y.key===R?a(_,v,y,E):null;case Pi:return y.key===R?c(_,v,y,E):null;case wr:return R=y._init,d(_,v,R(y._payload),E)}if(As(y)||gs(y))return R!==null?null:h(_,v,y,E,null);rl(_,y)}return null}function f(_,v,y,E,R){if(typeof E=="string"&&E!==""||typeof E=="number")return _=_.get(y)||null,l(v,_,""+E,R);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case Vo:return _=_.get(E.key===null?y:E.key)||null,a(v,_,E,R);case Pi:return _=_.get(E.key===null?y:E.key)||null,c(v,_,E,R);case wr:var C=E._init;return f(_,v,y,C(E._payload),R)}if(As(E)||gs(E))return _=_.get(y)||null,h(v,_,E,R,null);rl(v,E)}return null}function g(_,v,y,E){for(var R=null,C=null,M=v,$=v=0,G=null;M!==null&&$<y.length;$++){M.index>$?(G=M,M=null):G=M.sibling;var T=d(_,M,y[$],E);if(T===null){M===null&&(M=G);break}e&&M&&T.alternate===null&&t(_,M),v=s(T,v,$),C===null?R=T:C.sibling=T,C=T,M=G}if($===y.length)return n(_,M),He&&Gr(_,$),R;if(M===null){for(;$<y.length;$++)M=u(_,y[$],E),M!==null&&(v=s(M,v,$),C===null?R=M:C.sibling=M,C=M);return He&&Gr(_,$),R}for(M=r(_,M);$<y.length;$++)G=f(M,_,$,y[$],E),G!==null&&(e&&G.alternate!==null&&M.delete(G.key===null?$:G.key),v=s(G,v,$),C===null?R=G:C.sibling=G,C=G);return e&&M.forEach(function(P){return t(_,P)}),He&&Gr(_,$),R}function m(_,v,y,E){var R=gs(y);if(typeof R!="function")throw Error(ee(150));if(y=R.call(y),y==null)throw Error(ee(151));for(var C=R=null,M=v,$=v=0,G=null,T=y.next();M!==null&&!T.done;$++,T=y.next()){M.index>$?(G=M,M=null):G=M.sibling;var P=d(_,M,T.value,E);if(P===null){M===null&&(M=G);break}e&&M&&P.alternate===null&&t(_,M),v=s(P,v,$),C===null?R=P:C.sibling=P,C=P,M=G}if(T.done)return n(_,M),He&&Gr(_,$),R;if(M===null){for(;!T.done;$++,T=y.next())T=u(_,T.value,E),T!==null&&(v=s(T,v,$),C===null?R=T:C.sibling=T,C=T);return He&&Gr(_,$),R}for(M=r(_,M);!T.done;$++,T=y.next())T=f(M,_,$,T.value,E),T!==null&&(e&&T.alternate!==null&&M.delete(T.key===null?$:T.key),v=s(T,v,$),C===null?R=T:C.sibling=T,C=T);return e&&M.forEach(function(B){return t(_,B)}),He&&Gr(_,$),R}function w(_,v,y,E){if(typeof y=="object"&&y!==null&&y.type===Li&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Vo:e:{for(var R=y.key,C=v;C!==null;){if(C.key===R){if(R=y.type,R===Li){if(C.tag===7){n(_,C.sibling),v=i(C,y.props.children),v.return=_,_=v;break e}}else if(C.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===wr&&op(R)===C.type){n(_,C.sibling),v=i(C,y.props),v.ref=Ss(_,C,y),v.return=_,_=v;break e}n(_,C);break}else t(_,C);C=C.sibling}y.type===Li?(v=ai(y.props.children,_.mode,E,y.key),v.return=_,_=v):(E=Il(y.type,y.key,y.props,null,_.mode,E),E.ref=Ss(_,v,y),E.return=_,_=E)}return o(_);case Pi:e:{for(C=y.key;v!==null;){if(v.key===C)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){n(_,v.sibling),v=i(v,y.children||[]),v.return=_,_=v;break e}else{n(_,v);break}else t(_,v);v=v.sibling}v=xc(y,_.mode,E),v.return=_,_=v}return o(_);case wr:return C=y._init,w(_,v,C(y._payload),E)}if(As(y))return g(_,v,y,E);if(gs(y))return m(_,v,y,E);rl(_,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(n(_,v.sibling),v=i(v,y),v.return=_,_=v):(n(_,v),v=wc(y,_.mode,E),v.return=_,_=v),o(_)):n(_,v)}return w}var Ji=rv(!0),iv=rv(!1),ta=Wr(null),na=null,ji=null,Sd=null;function wd(){Sd=ji=na=null}function xd(e){var t=ta.current;We(ta),e._currentValue=t}function Mu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function qi(e,t){na=e,Sd=ji=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Jt=!0),e.firstContext=null)}function En(e){var t=e._currentValue;if(Sd!==e)if(e={context:e,memoizedValue:t,next:null},ji===null){if(na===null)throw Error(ee(308));ji=e,na.dependencies={lanes:0,firstContext:e}}else ji=ji.next=e;return t}var ii=null;function bd(e){ii===null?ii=[e]:ii.push(e)}function sv(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,bd(t)):(n.next=i.next,i.next=n),t.interleaved=n,ur(e,r)}function ur(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var xr=!1;function kd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ov(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 lr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ar(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Le&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,ur(e,n)}return i=r.interleaved,i===null?(t.next=t,bd(r)):(t.next=i.next,i.next=t),r.interleaved=t,ur(e,n)}function bl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cd(e,n)}}function lp(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ra(e,t,n,r){var i=e.updateQueue;xr=!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 d=l.lane,f=l.eventTime;if((r&d)===d){h!==null&&(h=h.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,m=l;switch(d=t,f=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){u=g.call(f,u,d);break e}u=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,d=typeof g=="function"?g.call(f,u,d):g,d==null)break e;u=Xe({},u,d);break e;case 2:xr=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,d=i.effects,d===null?i.effects=[l]:d.push(l))}else f={eventTime:f,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(c=h=f,a=u):h=h.next=f,o|=d;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;d=l,l=d.next,d.next=null,i.lastBaseUpdate=d,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);pi|=o,e.lanes=o,e.memoizedState=u}}function ap(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(ee(191,i));i.call(r)}}}var Po={},Xn=Wr(Po),fo=Wr(Po),po=Wr(Po);function si(e){if(e===Po)throw Error(ee(174));return e}function Cd(e,t){switch(Oe(po,t),Oe(fo,e),Oe(Xn,Po),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:fu(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=fu(t,e)}We(Xn),Oe(Xn,t)}function es(){We(Xn),We(fo),We(po)}function lv(e){si(po.current);var t=si(Xn.current),n=fu(t,e.type);t!==n&&(Oe(fo,e),Oe(Xn,n))}function Ed(e){fo.current===e&&(We(Xn),We(fo))}var qe=Wr(0);function ia(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.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 gc=[];function Td(){for(var e=0;e<gc.length;e++)gc[e]._workInProgressVersionPrimary=null;gc.length=0}var kl=dr.ReactCurrentDispatcher,mc=dr.ReactCurrentBatchConfig,fi=0,Ye=null,ft=null,vt=null,sa=!1,qs=!1,go=0,vw=0;function Pt(){throw Error(ee(321))}function Rd(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!zn(e[n],t[n]))return!1;return!0}function Id(e,t,n,r,i,s){if(fi=s,Ye=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,kl.current=e===null||e.memoizedState===null?xw:bw,e=n(r,i),qs){s=0;do{if(qs=!1,go=0,25<=s)throw Error(ee(301));s+=1,vt=ft=null,t.updateQueue=null,kl.current=kw,e=n(r,i)}while(qs)}if(kl.current=oa,t=ft!==null&&ft.next!==null,fi=0,vt=ft=Ye=null,sa=!1,t)throw Error(ee(300));return e}function Pd(){var e=go!==0;return go=0,e}function Hn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?Ye.memoizedState=vt=e:vt=vt.next=e,vt}function Tn(){if(ft===null){var e=Ye.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var t=vt===null?Ye.memoizedState:vt.next;if(t!==null)vt=t,ft=e;else{if(e===null)throw Error(ee(310));ft=e,e={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},vt===null?Ye.memoizedState=vt=e:vt=vt.next=e}return vt}function mo(e,t){return typeof t=="function"?t(e):t}function _c(e){var t=Tn(),n=t.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=e;var r=ft,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var l=o=null,a=null,c=s;do{var h=c.lane;if((fi&h)===h)a!==null&&(a=a.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var u={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=u,o=r):a=a.next=u,Ye.lanes|=h,pi|=h}c=c.next}while(c!==null&&c!==s);a===null?o=r:a.next=l,zn(r,t.memoizedState)||(Jt=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=a,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,Ye.lanes|=s,pi|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function vc(e){var t=Tn(),n=t.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);zn(s,t.memoizedState)||(Jt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function av(){}function cv(e,t){var n=Ye,r=Tn(),i=t(),s=!zn(r.memoizedState,i);if(s&&(r.memoizedState=i,Jt=!0),r=r.queue,Ld(dv.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||vt!==null&&vt.memoizedState.tag&1){if(n.flags|=2048,_o(9,hv.bind(null,n,r,i,t),void 0,null),xt===null)throw Error(ee(349));fi&30||uv(n,t,i)}return i}function uv(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ye.updateQueue,t===null?(t={lastEffect:null,stores:null},Ye.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function hv(e,t,n,r){t.value=n,t.getSnapshot=r,fv(t)&&pv(e)}function dv(e,t,n){return n(function(){fv(t)&&pv(e)})}function fv(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!zn(e,n)}catch{return!0}}function pv(e){var t=ur(e,1);t!==null&&Bn(t,e,1,-1)}function cp(e){var t=Hn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:mo,lastRenderedState:e},t.queue=e,e=e.dispatch=ww.bind(null,Ye,e),[t.memoizedState,e]}function _o(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ye.updateQueue,t===null?(t={lastEffect:null,stores:null},Ye.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function gv(){return Tn().memoizedState}function Cl(e,t,n,r){var i=Hn();Ye.flags|=e,i.memoizedState=_o(1|t,n,void 0,r===void 0?null:r)}function Pa(e,t,n,r){var i=Tn();r=r===void 0?null:r;var s=void 0;if(ft!==null){var o=ft.memoizedState;if(s=o.destroy,r!==null&&Rd(r,o.deps)){i.memoizedState=_o(t,n,s,r);return}}Ye.flags|=e,i.memoizedState=_o(1|t,n,s,r)}function up(e,t){return Cl(8390656,8,e,t)}function Ld(e,t){return Pa(2048,8,e,t)}function mv(e,t){return Pa(4,2,e,t)}function _v(e,t){return Pa(4,4,e,t)}function vv(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 yv(e,t,n){return n=n!=null?n.concat([e]):null,Pa(4,4,vv.bind(null,t,e),n)}function Dd(){}function Sv(e,t){var n=Tn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Rd(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function wv(e,t){var n=Tn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Rd(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function xv(e,t,n){return fi&21?(zn(n,t)||(n=T_(),Ye.lanes|=n,pi|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Jt=!0),e.memoizedState=n)}function yw(e,t){var n=Me;Me=n!==0&&4>n?n:4,e(!0);var r=mc.transition;mc.transition={};try{e(!1),t()}finally{Me=n,mc.transition=r}}function bv(){return Tn().memoizedState}function Sw(e,t,n){var r=Nr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},kv(e))Cv(t,n);else if(n=sv(e,t,n,r),n!==null){var i=Wt();Bn(n,e,r,i),Ev(n,t,r)}}function ww(e,t,n){var r=Nr(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(kv(e))Cv(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,n);if(i.hasEagerState=!0,i.eagerState=l,zn(l,o)){var a=t.interleaved;a===null?(i.next=i,bd(t)):(i.next=a.next,a.next=i),t.interleaved=i;return}}catch{}finally{}n=sv(e,t,i,r),n!==null&&(i=Wt(),Bn(n,e,r,i),Ev(n,t,r))}}function kv(e){var t=e.alternate;return e===Ye||t!==null&&t===Ye}function Cv(e,t){qs=sa=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ev(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cd(e,n)}}var oa={readContext:En,useCallback:Pt,useContext:Pt,useEffect:Pt,useImperativeHandle:Pt,useInsertionEffect:Pt,useLayoutEffect:Pt,useMemo:Pt,useReducer:Pt,useRef:Pt,useState:Pt,useDebugValue:Pt,useDeferredValue:Pt,useTransition:Pt,useMutableSource:Pt,useSyncExternalStore:Pt,useId:Pt,unstable_isNewReconciler:!1},xw={readContext:En,useCallback:function(e,t){return Hn().memoizedState=[e,t===void 0?null:t],e},useContext:En,useEffect:up,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Cl(4194308,4,vv.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Cl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Cl(4,2,e,t)},useMemo:function(e,t){var n=Hn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Hn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Sw.bind(null,Ye,e),[r.memoizedState,e]},useRef:function(e){var t=Hn();return e={current:e},t.memoizedState=e},useState:cp,useDebugValue:Dd,useDeferredValue:function(e){return Hn().memoizedState=e},useTransition:function(){var e=cp(!1),t=e[0];return e=yw.bind(null,e[1]),Hn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ye,i=Hn();if(He){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=t(),xt===null)throw Error(ee(349));fi&30||uv(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,up(dv.bind(null,r,s,e),[e]),r.flags|=2048,_o(9,hv.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Hn(),t=xt.identifierPrefix;if(He){var n=sr,r=ir;n=(r&~(1<<32-An(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=go++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=vw++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},bw={readContext:En,useCallback:Sv,useContext:En,useEffect:Ld,useImperativeHandle:yv,useInsertionEffect:mv,useLayoutEffect:_v,useMemo:wv,useReducer:_c,useRef:gv,useState:function(){return _c(mo)},useDebugValue:Dd,useDeferredValue:function(e){var t=Tn();return xv(t,ft.memoizedState,e)},useTransition:function(){var e=_c(mo)[0],t=Tn().memoizedState;return[e,t]},useMutableSource:av,useSyncExternalStore:cv,useId:bv,unstable_isNewReconciler:!1},kw={readContext:En,useCallback:Sv,useContext:En,useEffect:Ld,useImperativeHandle:yv,useInsertionEffect:mv,useLayoutEffect:_v,useMemo:wv,useReducer:vc,useRef:gv,useState:function(){return vc(mo)},useDebugValue:Dd,useDeferredValue:function(e){var t=Tn();return ft===null?t.memoizedState=e:xv(t,ft.memoizedState,e)},useTransition:function(){var e=vc(mo)[0],t=Tn().memoizedState;return[e,t]},useMutableSource:av,useSyncExternalStore:cv,useId:bv,unstable_isNewReconciler:!1};function Pn(e,t){if(e&&e.defaultProps){t=Xe({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Au(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Xe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var La={isMounted:function(e){return(e=e._reactInternals)?Si(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Wt(),i=Nr(e),s=lr(r,i);s.payload=t,n!=null&&(s.callback=n),t=Ar(e,s,i),t!==null&&(Bn(t,e,i,r),bl(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Wt(),i=Nr(e),s=lr(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Ar(e,s,i),t!==null&&(Bn(t,e,i,r),bl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Wt(),r=Nr(e),i=lr(n,r);i.tag=2,t!=null&&(i.callback=t),t=Ar(e,i,r),t!==null&&(Bn(t,e,r,n),bl(t,e,r))}};function hp(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!ao(n,r)||!ao(i,s):!0}function Tv(e,t,n){var r=!1,i=Fr,s=t.contextType;return typeof s=="object"&&s!==null?s=En(s):(i=tn(t)?hi:Bt.current,r=t.contextTypes,s=(r=r!=null)?Qi(e,i):Fr),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=La,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function dp(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&La.enqueueReplaceState(t,t.state,null)}function Bu(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},kd(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=En(s):(s=tn(t)?hi:Bt.current,i.context=Qi(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Au(e,t,s,n),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&&La.enqueueReplaceState(i,i.state,null),ra(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function ts(e,t){try{var n="",r=t;do n+=Z1(r),r=r.return;while(r);var i=n}catch(s){i=`
39
39
  Error generating stack: `+s.message+`
40
- `+s.stack}return{value:e,source:t,stack:i,digest:null}}function ac(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Cu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var _w=typeof WeakMap=="function"?WeakMap:Map;function _v(e,t,n){n=Jn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ql||(Ql=!0,Bu=r),Cu(e,t)},n}function vv(e,t,n){n=Jn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Cu(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Cu(e,t),typeof r!="function"&&(Rr===null?Rr=new Set([this]):Rr.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function np(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new _w;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Pw.bind(null,e,t,n),t.then(e,e))}function rp(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 ip(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Jn(-1,1),t.tag=2,Tr(n,t,1))),n.lanes|=1),e)}var vw=ir.ReactCurrentOwner,$t=!1;function Pt(e,t,n,r){t.child=e===null?q_(t,null,n,r):Ki(t,e.child,n,r)}function sp(e,t,n,r,i){n=n.render;var s=t.ref;return ji(t,i),r=vd(e,t,n,r,s,i),n=yd(),e!==null&&!$t?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,rr(e,t,i)):($e&&n&&od(t),t.flags|=1,Pt(e,t,r,i),t.child)}function op(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!Id(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,yv(e,t,s,r,i)):(e=vl(n.type,null,r,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(n=n.compare,n=n!==null?n:eo,n(o,r)&&e.ref===t.ref)return rr(e,t,i)}return t.flags|=1,e=Lr(s,r),e.ref=t.ref,e.return=t,t.child=e}function yv(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(eo(s,r)&&e.ref===t.ref)if($t=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&($t=!0);else return t.lanes=e.lanes,rr(e,t,i)}return Eu(e,t,n,r,i)}function Sv(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ne(Mi,Xt),Xt|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ne(Mi,Xt),Xt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,Ne(Mi,Xt),Xt|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,Ne(Mi,Xt),Xt|=r;return Pt(e,t,i,n),t.child}function wv(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Eu(e,t,n,r,i){var s=Ht(n)?ri:Rt.current;return s=Hi(t,s),ji(t,i),n=vd(e,t,n,r,s,i),r=yd(),e!==null&&!$t?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,rr(e,t,i)):($e&&r&&od(t),t.flags|=1,Pt(e,t,n,i),t.child)}function lp(e,t,n,r,i){if(Ht(n)){var s=!0;$l(t)}else s=!1;if(ji(t,i),t.stateNode===null)gl(e,t),mv(t,n,r),ku(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var a=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=gn(c):(c=Ht(n)?ri:Rt.current,c=Hi(t,c));var h=n.getDerivedStateFromProps,u=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||a!==c)&&tp(t,o,r,c),gr=!1;var d=t.memoizedState;o.state=d,Vl(t,r,o,i),a=t.memoizedState,l!==r||d!==a||Wt.current||gr?(typeof h=="function"&&(bu(t,n,h,r),a=t.memoizedState),(l=gr||ep(t,n,l,r,d,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=r,t.memoizedState=a),o.props=r,o.state=a,o.context=c,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,X_(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Sn(t.type,l),o.props=c,u=t.pendingProps,d=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=gn(a):(a=Ht(n)?ri:Rt.current,a=Hi(t,a));var f=n.getDerivedStateFromProps;(h=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==u||d!==a)&&tp(t,o,r,a),gr=!1,d=t.memoizedState,o.state=d,Vl(t,r,o,i);var g=t.memoizedState;l!==u||d!==g||Wt.current||gr?(typeof f=="function"&&(bu(t,n,f,r),g=t.memoizedState),(c=gr||ep(t,n,c,r,d,g,a)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=a,r=c):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return Tu(e,t,n,r,s,i)}function Tu(e,t,n,r,i,s){wv(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&Vf(t,n,!1),rr(e,t,s);r=t.stateNode,vw.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ki(t,e.child,null,s),t.child=Ki(t,null,l,s)):Pt(e,t,l,s),t.memoizedState=r.state,i&&Vf(t,n,!0),t.child}function xv(e){var t=e.stateNode;t.pendingContext?Kf(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Kf(e,t.context,!1),pd(e,t.containerInfo)}function ap(e,t,n,r,i){return Ui(),ad(i),t.flags|=256,Pt(e,t,n,r),t.child}var Ru={dehydrated:null,treeContext:null,retryLane:0};function Iu(e){return{baseLanes:e,cachePool:null,transitions:null}}function bv(e,t,n){var r=t.pendingProps,i=Ke.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),Ne(Ke,i&1),e===null)return wu(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=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=ba(o,r,0,null),e=ei(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Iu(n),t.memoizedState=Ru,e):xd(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return yw(e,t,o,r,l,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,l=i.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=Lr(i,a),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=Lr(l,s):(s=ei(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?Iu(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=Ru,r}return s=e.child,e=s.sibling,r=Lr(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function xd(e,t){return t=ba({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function qo(e,t,n,r){return r!==null&&ad(r),Ki(t,e.child,null,n),e=xd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yw(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=ac(Error(ee(422))),qo(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=ba({mode:"visible",children:r.children},i,0,null),s=ei(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Ki(t,e.child,null,o),t.child.memoizedState=Iu(o),t.memoizedState=Ru,s);if(!(t.mode&1))return qo(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(ee(419)),r=ac(s,r,void 0),qo(e,t,o,r)}if(l=(o&e.childLanes)!==0,$t||l){if(r=gt,r!==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&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,nr(e,i),Cn(r,e,i,-1))}return Rd(),r=ac(Error(ee(421))),qo(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Dw.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,Qt=Er(i.nextSibling),Zt=t,$e=!0,xn=null,e!==null&&(cn[un++]=Gn,cn[un++]=Qn,cn[un++]=ii,Gn=e.id,Qn=e.overflow,ii=t),t=xd(t,r.children),t.flags|=4096,t)}function cp(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),xu(e.return,t,n)}function cc(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function kv(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(Pt(e,t,r.children,n),r=Ke.current,r&2)r=r&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&&cp(e,n,t);else if(e.tag===19)cp(e,n,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}r&=1}if(Ne(Ke,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ql(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),cc(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ql(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}cc(t,!0,n,null,s);break;case"together":cc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function gl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function rr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),oi|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ee(153));if(t.child!==null){for(e=t.child,n=Lr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Lr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Sw(e,t,n){switch(t.tag){case 3:xv(t),Ui();break;case 5:G_(t);break;case 1:Ht(t.type)&&$l(t);break;case 4:pd(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ne(Ul,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ne(Ke,Ke.current&1),t.flags|=128,null):n&t.child.childLanes?bv(e,t,n):(Ne(Ke,Ke.current&1),e=rr(e,t,n),e!==null?e.sibling:null);Ne(Ke,Ke.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return kv(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ne(Ke,Ke.current),r)break;return null;case 22:case 23:return t.lanes=0,Sv(e,t,n)}return rr(e,t,n)}var Cv,Lu,Ev,Tv;Cv=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Lu=function(){};Ev=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Qr(jn.current);var s=null;switch(n){case"input":i=Zc(e,i),r=Zc(e,r),s=[];break;case"select":i=qe({},i,{value:void 0}),r=qe({},r,{value:void 0}),s=[];break;case"textarea":i=tu(e,i),r=tu(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=jl)}ru(n,r);var o;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var l=i[c];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(qs.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var a=r[c];if(l=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(s||(s=[]),s.push(c,n)),n=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"&&(qs.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&Oe("scroll",e),s||l===a||(s=[])):(s=s||[]).push(c,a))}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};Tv=function(e,t,n,r){n!==r&&(t.flags|=4)};function fs(e,t){if(!$e)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function kt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ww(e,t,n){var r=t.pendingProps;switch(ld(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(t),null;case 1:return Ht(t.type)&&Fl(),kt(t),null;case 3:return r=t.stateNode,Vi(),Fe(Wt),Fe(Rt),md(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ko(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,xn!==null&&(Ou(xn),xn=null))),Lu(e,t),kt(t),null;case 5:gd(t);var i=Qr(so.current);if(n=t.type,e!==null&&t.stateNode!=null)Ev(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ee(166));return kt(t),null}if(e=Qr(jn.current),Ko(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Nn]=t,r[ro]=s,e=(t.mode&1)!==0,n){case"dialog":Oe("cancel",r),Oe("close",r);break;case"iframe":case"object":case"embed":Oe("load",r);break;case"video":case"audio":for(i=0;i<Rs.length;i++)Oe(Rs[i],r);break;case"source":Oe("error",r);break;case"img":case"image":case"link":Oe("error",r),Oe("load",r);break;case"details":Oe("toggle",r);break;case"input":vf(r,s),Oe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Oe("invalid",r);break;case"textarea":Sf(r,s),Oe("invalid",r)}ru(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?r.textContent!==l&&(s.suppressHydrationWarning!==!0&&Uo(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Uo(r.textContent,l,e),i=["children",""+l]):qs.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Oe("scroll",r)}switch(n){case"input":No(r),yf(r,s,!0);break;case"textarea":No(r),wf(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=jl)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=t_(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Nn]=t,e[ro]=r,Cv(e,t,!1,!1),t.stateNode=e;e:{switch(o=iu(n,r),n){case"dialog":Oe("cancel",e),Oe("close",e),i=r;break;case"iframe":case"object":case"embed":Oe("load",e),i=r;break;case"video":case"audio":for(i=0;i<Rs.length;i++)Oe(Rs[i],e);i=r;break;case"source":Oe("error",e),i=r;break;case"img":case"image":case"link":Oe("error",e),Oe("load",e),i=r;break;case"details":Oe("toggle",e),i=r;break;case"input":vf(e,r),i=Zc(e,r),Oe("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=qe({},r,{value:void 0}),Oe("invalid",e);break;case"textarea":Sf(e,r),i=tu(e,r),Oe("invalid",e);break;default:i=r}ru(n,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?i_(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&n_(e,a)):s==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&Ys(e,a):typeof a=="number"&&Ys(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(qs.hasOwnProperty(s)?a!=null&&s==="onScroll"&&Oe("scroll",e):a!=null&&Vh(e,s,a,o))}switch(n){case"input":No(e),yf(e,r,!1);break;case"textarea":No(e),wf(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Dr(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Bi(e,!!r.multiple,s,!1):r.defaultValue!=null&&Bi(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=jl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return kt(t),null;case 6:if(e&&t.stateNode!=null)Tv(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ee(166));if(n=Qr(so.current),Qr(jn.current),Ko(t)){if(r=t.stateNode,n=t.memoizedProps,r[Nn]=t,(s=r.nodeValue!==n)&&(e=Zt,e!==null))switch(e.tag){case 3:Uo(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Uo(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Nn]=t,t.stateNode=r}return kt(t),null;case 13:if(Fe(Ke),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if($e&&Qt!==null&&t.mode&1&&!(t.flags&128))K_(),Ui(),t.flags|=98560,s=!1;else if(s=Ko(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(ee(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ee(317));s[Nn]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kt(t),s=!1}else xn!==null&&(Ou(xn),xn=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ke.current&1?at===0&&(at=3):Rd())),t.updateQueue!==null&&(t.flags|=4),kt(t),null);case 4:return Vi(),Lu(e,t),e===null&&to(t.stateNode.containerInfo),kt(t),null;case 10:return hd(t.type._context),kt(t),null;case 17:return Ht(t.type)&&Fl(),kt(t),null;case 19:if(Fe(Ke),s=t.memoizedState,s===null)return kt(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)fs(s,!1);else{if(at!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ql(e),o!==null){for(t.flags|=128,fs(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,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}),n=n.sibling;return Ne(Ke,Ke.current&1|2),t.child}e=e.sibling}s.tail!==null&&Je()>Yi&&(t.flags|=128,r=!0,fs(s,!1),t.lanes=4194304)}else{if(!r)if(e=ql(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),fs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!$e)return kt(t),null}else 2*Je()-s.renderingStartTime>Yi&&n!==1073741824&&(t.flags|=128,r=!0,fs(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Je(),t.sibling=null,n=Ke.current,Ne(Ke,r?n&1|2:n&1),t):(kt(t),null);case 22:case 23:return Td(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Xt&1073741824&&(kt(t),t.subtreeFlags&6&&(t.flags|=8192)):kt(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function xw(e,t){switch(ld(t),t.tag){case 1:return Ht(t.type)&&Fl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi(),Fe(Wt),Fe(Rt),md(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return gd(t),null;case 13:if(Fe(Ke),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Fe(Ke),null;case 4:return Vi(),null;case 10:return hd(t.type._context),null;case 22:case 23:return Td(),null;case 24:return null;default:return null}}var Yo=!1,Et=!1,bw=typeof WeakSet=="function"?WeakSet:Set,de=null;function Di(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Xe(e,t,r)}else n.current=null}function Pu(e,t,n){try{n()}catch(r){Xe(e,t,r)}}var up=!1;function kw(e,t){if(pu=Nl,e=D_(),sd(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,c=0,h=0,u=e,d=null;t:for(;;){for(var f;u!==n||i!==0&&u.nodeType!==3||(l=o+i),u!==s||r!==0&&u.nodeType!==3||(a=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(f=u.firstChild)!==null;)d=u,u=f;for(;;){if(u===e)break t;if(d===n&&++c===i&&(l=o),d===s&&++h===r&&(a=o),(f=u.nextSibling)!==null)break;u=d,d=u.parentNode}u=f}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(gu={focusedElem:e,selectionRange:n},Nl=!1,de=t;de!==null;)if(t=de,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,de=e;else for(;de!==null;){t=de;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,w=g.memoizedState,_=t.stateNode,v=_.getSnapshotBeforeUpdate(t.elementType===t.type?m:Sn(t.type,m),w);_.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(E){Xe(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return g=up,up=!1,g}function Fs(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Pu(t,n,s)}i=i.next}while(i!==r)}}function wa(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Du(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Rv(e){var t=e.alternate;t!==null&&(e.alternate=null,Rv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Nn],delete t[ro],delete t[vu],delete t[ow],delete t[lw])),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 Iv(e){return e.tag===5||e.tag===3||e.tag===4}function hp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Iv(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 Mu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=jl));else if(r!==4&&(e=e.child,e!==null))for(Mu(e,t,n),e=e.sibling;e!==null;)Mu(e,t,n),e=e.sibling}function Au(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Au(e,t,n),e=e.sibling;e!==null;)Au(e,t,n),e=e.sibling}var _t=null,wn=!1;function cr(e,t,n){for(n=n.child;n!==null;)Lv(e,t,n),n=n.sibling}function Lv(e,t,n){if(On&&typeof On.onCommitFiberUnmount=="function")try{On.onCommitFiberUnmount(fa,n)}catch{}switch(n.tag){case 5:Et||Di(n,t);case 6:var r=_t,i=wn;_t=null,cr(e,t,n),_t=r,wn=i,_t!==null&&(wn?(e=_t,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):_t.removeChild(n.stateNode));break;case 18:_t!==null&&(wn?(e=_t,n=n.stateNode,e.nodeType===8?nc(e.parentNode,n):e.nodeType===1&&nc(e,n),Zs(e)):nc(_t,n.stateNode));break;case 4:r=_t,i=wn,_t=n.stateNode.containerInfo,wn=!0,cr(e,t,n),_t=r,wn=i;break;case 0:case 11:case 14:case 15:if(!Et&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Pu(n,t,o),i=i.next}while(i!==r)}cr(e,t,n);break;case 1:if(!Et&&(Di(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Xe(n,t,l)}cr(e,t,n);break;case 21:cr(e,t,n);break;case 22:n.mode&1?(Et=(r=Et)||n.memoizedState!==null,cr(e,t,n),Et=r):cr(e,t,n);break;default:cr(e,t,n)}}function dp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new bw),t.forEach(function(r){var i=Mw.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function vn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:_t=l.stateNode,wn=!1;break e;case 3:_t=l.stateNode.containerInfo,wn=!0;break e;case 4:_t=l.stateNode.containerInfo,wn=!0;break e}l=l.return}if(_t===null)throw Error(ee(160));Lv(s,o,i),_t=null,wn=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(c){Xe(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Pv(t,e),t=t.sibling}function Pv(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(vn(t,e),In(e),r&4){try{Fs(3,e,e.return),wa(3,e)}catch(m){Xe(e,e.return,m)}try{Fs(5,e,e.return)}catch(m){Xe(e,e.return,m)}}break;case 1:vn(t,e),In(e),r&512&&n!==null&&Di(n,n.return);break;case 5:if(vn(t,e),In(e),r&512&&n!==null&&Di(n,n.return),e.flags&32){var i=e.stateNode;try{Ys(i,"")}catch(m){Xe(e,e.return,m)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&Jm(i,s),iu(l,o);var c=iu(l,s);for(o=0;o<a.length;o+=2){var h=a[o],u=a[o+1];h==="style"?i_(i,u):h==="dangerouslySetInnerHTML"?n_(i,u):h==="children"?Ys(i,u):Vh(i,h,u,c)}switch(l){case"input":Jc(i,s);break;case"textarea":e_(i,s);break;case"select":var d=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var f=s.value;f!=null?Bi(i,!!s.multiple,f,!1):d!==!!s.multiple&&(s.defaultValue!=null?Bi(i,!!s.multiple,s.defaultValue,!0):Bi(i,!!s.multiple,s.multiple?[]:"",!1))}i[ro]=s}catch(m){Xe(e,e.return,m)}}break;case 6:if(vn(t,e),In(e),r&4){if(e.stateNode===null)throw Error(ee(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(m){Xe(e,e.return,m)}}break;case 3:if(vn(t,e),In(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Zs(t.containerInfo)}catch(m){Xe(e,e.return,m)}break;case 4:vn(t,e),In(e);break;case 13:vn(t,e),In(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Cd=Je())),r&4&&dp(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(Et=(c=Et)||h,vn(t,e),Et=c):vn(t,e),In(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(de=e,h=e.child;h!==null;){for(u=de=h;de!==null;){switch(d=de,f=d.child,d.tag){case 0:case 11:case 14:case 15:Fs(4,d,d.return);break;case 1:Di(d,d.return);var g=d.stateNode;if(typeof g.componentWillUnmount=="function"){r=d,n=d.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(m){Xe(r,n,m)}}break;case 5:Di(d,d.return);break;case 22:if(d.memoizedState!==null){pp(u);continue}}f!==null?(f.return=d,de=f):pp(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=r_("display",o))}catch(m){Xe(e,e.return,m)}}}else if(u.tag===6){if(h===null)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(m){Xe(e,e.return,m)}}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:vn(t,e),In(e),r&4&&dp(e);break;case 21:break;default:vn(t,e),In(e)}}function In(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Iv(n)){var r=n;break e}n=n.return}throw Error(ee(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Ys(i,""),r.flags&=-33);var s=hp(e);Au(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,l=hp(e);Mu(e,l,o);break;default:throw Error(ee(161))}}catch(a){Xe(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Cw(e,t,n){de=e,Dv(e)}function Dv(e,t,n){for(var r=(e.mode&1)!==0;de!==null;){var i=de,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Yo;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||Et;l=Yo;var c=Et;if(Yo=o,(Et=a)&&!c)for(de=i;de!==null;)o=de,a=o.child,o.tag===22&&o.memoizedState!==null?gp(i):a!==null?(a.return=o,de=a):gp(i);for(;s!==null;)de=s,Dv(s),s=s.sibling;de=i,Yo=l,Et=c}fp(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,de=s):fp(e)}}function fp(e){for(;de!==null;){var t=de;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Et||wa(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Et)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Sn(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Qf(t,s,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Qf(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break;case"img":a.src&&(n.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&&Zs(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ee(163))}Et||t.flags&512&&Du(t)}catch(d){Xe(t,t.return,d)}}if(t===e){de=null;break}if(n=t.sibling,n!==null){n.return=t.return,de=n;break}de=t.return}}function pp(e){for(;de!==null;){var t=de;if(t===e){de=null;break}var n=t.sibling;if(n!==null){n.return=t.return,de=n;break}de=t.return}}function gp(e){for(;de!==null;){var t=de;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{wa(4,t)}catch(a){Xe(t,n,a)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(a){Xe(t,i,a)}}var s=t.return;try{Du(t)}catch(a){Xe(t,s,a)}break;case 5:var o=t.return;try{Du(t)}catch(a){Xe(t,o,a)}}}catch(a){Xe(t,t.return,a)}if(t===e){de=null;break}var l=t.sibling;if(l!==null){l.return=t.return,de=l;break}de=t.return}}var Ew=Math.ceil,Gl=ir.ReactCurrentDispatcher,bd=ir.ReactCurrentOwner,fn=ir.ReactCurrentBatchConfig,Ie=0,gt=null,rt=null,St=0,Xt=0,Mi=Br(0),at=0,co=null,oi=0,xa=0,kd=0,$s=null,Ft=null,Cd=0,Yi=1/0,qn=null,Ql=!1,Bu=null,Rr=null,Xo=!1,Sr=null,Zl=0,Ws=0,Nu=null,ml=-1,_l=0;function Mt(){return Ie&6?Je():ml!==-1?ml:ml=Je()}function Ir(e){return e.mode&1?Ie&2&&St!==0?St&-St:cw.transition!==null?(_l===0&&(_l=m_()),_l):(e=Le,e!==0||(e=window.event,e=e===void 0?16:b_(e.type)),e):1}function Cn(e,t,n,r){if(50<Ws)throw Ws=0,Nu=null,Error(ee(185));yo(e,n,r),(!(Ie&2)||e!==gt)&&(e===gt&&(!(Ie&2)&&(xa|=n),at===4&&vr(e,St)),Ut(e,r),n===1&&Ie===0&&!(t.mode&1)&&(Yi=Je()+500,va&&Nr()))}function Ut(e,t){var n=e.callbackNode;cS(e,t);var r=Bl(e,e===gt?St:0);if(r===0)n!==null&&kf(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&kf(n),t===1)e.tag===0?aw(mp.bind(null,e)):W_(mp.bind(null,e)),iw(function(){!(Ie&6)&&Nr()}),n=null;else{switch(__(r)){case 1:n=Qh;break;case 4:n=p_;break;case 16:n=Al;break;case 536870912:n=g_;break;default:n=Al}n=Fv(n,Mv.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Mv(e,t){if(ml=-1,_l=0,Ie&6)throw Error(ee(327));var n=e.callbackNode;if(Fi()&&e.callbackNode!==n)return null;var r=Bl(e,e===gt?St:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Jl(e,r);else{t=r;var i=Ie;Ie|=2;var s=Bv();(gt!==e||St!==t)&&(qn=null,Yi=Je()+500,Jr(e,t));do try{Iw();break}catch(l){Av(e,l)}while(!0);ud(),Gl.current=s,Ie=i,rt!==null?t=0:(gt=null,St=0,t=at)}if(t!==0){if(t===2&&(i=cu(e),i!==0&&(r=i,t=zu(e,i))),t===1)throw n=co,Jr(e,0),vr(e,r),Ut(e,Je()),n;if(t===6)vr(e,r);else{if(i=e.current.alternate,!(r&30)&&!Tw(i)&&(t=Jl(e,r),t===2&&(s=cu(e),s!==0&&(r=s,t=zu(e,s))),t===1))throw n=co,Jr(e,0),vr(e,r),Ut(e,Je()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(ee(345));case 2:Hr(e,Ft,qn);break;case 3:if(vr(e,r),(r&130023424)===r&&(t=Cd+500-Je(),10<t)){if(Bl(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Mt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=_u(Hr.bind(null,e,Ft,qn),t);break}Hr(e,Ft,qn);break;case 4:if(vr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-kn(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=Je()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ew(r/1960))-r,10<r){e.timeoutHandle=_u(Hr.bind(null,e,Ft,qn),r);break}Hr(e,Ft,qn);break;case 5:Hr(e,Ft,qn);break;default:throw Error(ee(329))}}}return Ut(e,Je()),e.callbackNode===n?Mv.bind(null,e):null}function zu(e,t){var n=$s;return e.current.memoizedState.isDehydrated&&(Jr(e,t).flags|=256),e=Jl(e,t),e!==2&&(t=Ft,Ft=n,t!==null&&Ou(t)),e}function Ou(e){Ft===null?Ft=e:Ft.push.apply(Ft,e)}function Tw(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!Tn(s(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 vr(e,t){for(t&=~kd,t&=~xa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-kn(t),r=1<<n;e[n]=-1,t&=~r}}function mp(e){if(Ie&6)throw Error(ee(327));Fi();var t=Bl(e,0);if(!(t&1))return Ut(e,Je()),null;var n=Jl(e,t);if(e.tag!==0&&n===2){var r=cu(e);r!==0&&(t=r,n=zu(e,r))}if(n===1)throw n=co,Jr(e,0),vr(e,t),Ut(e,Je()),n;if(n===6)throw Error(ee(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Hr(e,Ft,qn),Ut(e,Je()),null}function Ed(e,t){var n=Ie;Ie|=1;try{return e(t)}finally{Ie=n,Ie===0&&(Yi=Je()+500,va&&Nr())}}function li(e){Sr!==null&&Sr.tag===0&&!(Ie&6)&&Fi();var t=Ie;Ie|=1;var n=fn.transition,r=Le;try{if(fn.transition=null,Le=1,e)return e()}finally{Le=r,fn.transition=n,Ie=t,!(Ie&6)&&Nr()}}function Td(){Xt=Mi.current,Fe(Mi)}function Jr(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,rw(n)),rt!==null)for(n=rt.return;n!==null;){var r=n;switch(ld(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Fl();break;case 3:Vi(),Fe(Wt),Fe(Rt),md();break;case 5:gd(r);break;case 4:Vi();break;case 13:Fe(Ke);break;case 19:Fe(Ke);break;case 10:hd(r.type._context);break;case 22:case 23:Td()}n=n.return}if(gt=e,rt=e=Lr(e.current,null),St=Xt=t,at=0,co=null,kd=xa=oi=0,Ft=$s=null,Gr!==null){for(t=0;t<Gr.length;t++)if(n=Gr[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}Gr=null}return e}function Av(e,t){do{var n=rt;try{if(ud(),fl.current=Xl,Yl){for(var r=Ve.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Yl=!1}if(si=0,ht=lt=Ve=null,js=!1,oo=0,bd.current=null,n===null||n.return===null){at=1,co=t,rt=null;break}e:{var s=e,o=n.return,l=n,a=t;if(t=St,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 d=h.alternate;d?(h.updateQueue=d.updateQueue,h.memoizedState=d.memoizedState,h.lanes=d.lanes):(h.updateQueue=null,h.memoizedState=null)}var f=rp(o);if(f!==null){f.flags&=-257,ip(f,o,l,s,t),f.mode&1&&np(s,c,t),t=f,a=c;var g=t.updateQueue;if(g===null){var m=new Set;m.add(a),t.updateQueue=m}else g.add(a);break e}else{if(!(t&1)){np(s,c,t),Rd();break e}a=Error(ee(426))}}else if($e&&l.mode&1){var w=rp(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),ip(w,o,l,s,t),ad(qi(a,l));break e}}s=a=qi(a,l),at!==4&&(at=2),$s===null?$s=[s]:$s.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var _=_v(s,a,t);Gf(s,_);break e;case 1:l=a;var v=s.type,y=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Rr===null||!Rr.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t;var E=vv(s,l,t);Gf(s,E);break e}}s=s.return}while(s!==null)}zv(n)}catch(R){t=R,rt===n&&n!==null&&(rt=n=n.return);continue}break}while(!0)}function Bv(){var e=Gl.current;return Gl.current=Xl,e===null?Xl:e}function Rd(){(at===0||at===3||at===2)&&(at=4),gt===null||!(oi&268435455)&&!(xa&268435455)||vr(gt,St)}function Jl(e,t){var n=Ie;Ie|=2;var r=Bv();(gt!==e||St!==t)&&(qn=null,Jr(e,t));do try{Rw();break}catch(i){Av(e,i)}while(!0);if(ud(),Ie=n,Gl.current=r,rt!==null)throw Error(ee(261));return gt=null,St=0,at}function Rw(){for(;rt!==null;)Nv(rt)}function Iw(){for(;rt!==null&&!eS();)Nv(rt)}function Nv(e){var t=jv(e.alternate,e,Xt);e.memoizedProps=e.pendingProps,t===null?zv(e):rt=t,bd.current=null}function zv(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=xw(n,t),n!==null){n.flags&=32767,rt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{at=6,rt=null;return}}else if(n=ww(n,t,Xt),n!==null){rt=n;return}if(t=t.sibling,t!==null){rt=t;return}rt=t=e}while(t!==null);at===0&&(at=5)}function Hr(e,t,n){var r=Le,i=fn.transition;try{fn.transition=null,Le=1,Lw(e,t,n,r)}finally{fn.transition=i,Le=r}return null}function Lw(e,t,n,r){do Fi();while(Sr!==null);if(Ie&6)throw Error(ee(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ee(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(uS(e,s),e===gt&&(rt=gt=null,St=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xo||(Xo=!0,Fv(Al,function(){return Fi(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=fn.transition,fn.transition=null;var o=Le;Le=1;var l=Ie;Ie|=4,bd.current=null,kw(e,n),Pv(n,e),GS(gu),Nl=!!pu,gu=pu=null,e.current=n,Cw(n),tS(),Ie=l,Le=o,fn.transition=s}else e.current=n;if(Xo&&(Xo=!1,Sr=e,Zl=i),s=e.pendingLanes,s===0&&(Rr=null),iS(n.stateNode),Ut(e,Je()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ql)throw Ql=!1,e=Bu,Bu=null,e;return Zl&1&&e.tag!==0&&Fi(),s=e.pendingLanes,s&1?e===Nu?Ws++:(Ws=0,Nu=e):Ws=0,Nr(),null}function Fi(){if(Sr!==null){var e=__(Zl),t=fn.transition,n=Le;try{if(fn.transition=null,Le=16>e?16:e,Sr===null)var r=!1;else{if(e=Sr,Sr=null,Zl=0,Ie&6)throw Error(ee(331));var i=Ie;for(Ie|=4,de=e.current;de!==null;){var s=de,o=s.child;if(de.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(de=c;de!==null;){var h=de;switch(h.tag){case 0:case 11:case 15:Fs(8,h,s)}var u=h.child;if(u!==null)u.return=h,de=u;else for(;de!==null;){h=de;var d=h.sibling,f=h.return;if(Rv(h),h===c){de=null;break}if(d!==null){d.return=f,de=d;break}de=f}}}var g=s.alternate;if(g!==null){var m=g.child;if(m!==null){g.child=null;do{var w=m.sibling;m.sibling=null,m=w}while(m!==null)}}de=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,de=o;else e:for(;de!==null;){if(s=de,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Fs(9,s,s.return)}var _=s.sibling;if(_!==null){_.return=s.return,de=_;break e}de=s.return}}var v=e.current;for(de=v;de!==null;){o=de;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,de=y;else e:for(o=v;de!==null;){if(l=de,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:wa(9,l)}}catch(R){Xe(l,l.return,R)}if(l===o){de=null;break e}var E=l.sibling;if(E!==null){E.return=l.return,de=E;break e}de=l.return}}if(Ie=i,Nr(),On&&typeof On.onPostCommitFiberRoot=="function")try{On.onPostCommitFiberRoot(fa,e)}catch{}r=!0}return r}finally{Le=n,fn.transition=t}}return!1}function _p(e,t,n){t=qi(n,t),t=_v(e,t,1),e=Tr(e,t,1),t=Mt(),e!==null&&(yo(e,1,t),Ut(e,t))}function Xe(e,t,n){if(e.tag===3)_p(e,e,n);else for(;t!==null;){if(t.tag===3){_p(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Rr===null||!Rr.has(r))){e=qi(n,e),e=vv(t,e,1),t=Tr(t,e,1),e=Mt(),t!==null&&(yo(t,1,e),Ut(t,e));break}}t=t.return}}function Pw(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Mt(),e.pingedLanes|=e.suspendedLanes&n,gt===e&&(St&n)===n&&(at===4||at===3&&(St&130023424)===St&&500>Je()-Cd?Jr(e,0):kd|=n),Ut(e,t)}function Ov(e,t){t===0&&(e.mode&1?(t=jo,jo<<=1,!(jo&130023424)&&(jo=4194304)):t=1);var n=Mt();e=nr(e,t),e!==null&&(yo(e,t,n),Ut(e,n))}function Dw(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ov(e,n)}function Mw(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ee(314))}r!==null&&r.delete(t),Ov(e,n)}var jv;jv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Wt.current)$t=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return $t=!1,Sw(e,t,n);$t=!!(e.flags&131072)}else $t=!1,$e&&t.flags&1048576&&H_(t,Hl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;gl(e,t),e=t.pendingProps;var i=Hi(t,Rt.current);ji(t,n),i=vd(null,t,r,e,i,n);var s=yd();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,Ht(r)?(s=!0,$l(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,fd(t),i.updater=Sa,t.stateNode=i,i._reactInternals=t,ku(t,r,e,n),t=Tu(null,t,r,!0,s,n)):(t.tag=0,$e&&s&&od(t),Pt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(gl(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Bw(r),e=Sn(r,e),i){case 0:t=Eu(null,t,r,e,n);break e;case 1:t=lp(null,t,r,e,n);break e;case 11:t=sp(null,t,r,e,n);break e;case 14:t=op(null,t,r,Sn(r.type,e),n);break e}throw Error(ee(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Sn(r,i),Eu(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Sn(r,i),lp(e,t,r,i,n);case 3:e:{if(xv(t),e===null)throw Error(ee(387));r=t.pendingProps,s=t.memoizedState,i=s.element,X_(e,t),Vl(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=qi(Error(ee(423)),t),t=ap(e,t,r,n,i);break e}else if(r!==i){i=qi(Error(ee(424)),t),t=ap(e,t,r,n,i);break e}else for(Qt=Er(t.stateNode.containerInfo.firstChild),Zt=t,$e=!0,xn=null,n=q_(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ui(),r===i){t=rr(e,t,n);break e}Pt(e,t,r,n)}t=t.child}return t;case 5:return G_(t),e===null&&wu(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,mu(r,i)?o=null:s!==null&&mu(r,s)&&(t.flags|=32),wv(e,t),Pt(e,t,o,n),t.child;case 6:return e===null&&wu(t),null;case 13:return bv(e,t,n);case 4:return pd(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ki(t,null,r,n):Pt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Sn(r,i),sp(e,t,r,i,n);case 7:return Pt(e,t,t.pendingProps,n),t.child;case 8:return Pt(e,t,t.pendingProps.children,n),t.child;case 12:return Pt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Ne(Ul,r._currentValue),r._currentValue=o,s!==null)if(Tn(s.value,o)){if(s.children===i.children&&!Wt.current){t=rr(e,t,n);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===r){if(s.tag===1){a=Jn(-1,n&-n),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|=n,a=s.alternate,a!==null&&(a.lanes|=n),xu(s.return,n,t),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),xu(o,n,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}Pt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ji(t,n),i=gn(i),r=r(i),t.flags|=1,Pt(e,t,r,n),t.child;case 14:return r=t.type,i=Sn(r,t.pendingProps),i=Sn(r.type,i),op(e,t,r,i,n);case 15:return yv(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Sn(r,i),gl(e,t),t.tag=1,Ht(r)?(e=!0,$l(t)):e=!1,ji(t,n),mv(t,r,i),ku(t,r,i,n),Tu(null,t,r,!0,e,n);case 19:return kv(e,t,n);case 22:return Sv(e,t,n)}throw Error(ee(156,t.tag))};function Fv(e,t){return f_(e,t)}function Aw(e,t,n,r){this.tag=e,this.key=n,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dn(e,t,n,r){return new Aw(e,t,n,r)}function Id(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Bw(e){if(typeof e=="function")return Id(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Yh)return 11;if(e===Xh)return 14}return 2}function Lr(e,t){var n=e.alternate;return n===null?(n=dn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function vl(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Id(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case bi:return ei(n.children,i,s,t);case qh:o=8,i|=8;break;case Yc:return e=dn(12,n,t,i|2),e.elementType=Yc,e.lanes=s,e;case Xc:return e=dn(13,n,t,i),e.elementType=Xc,e.lanes=s,e;case Gc:return e=dn(19,n,t,i),e.elementType=Gc,e.lanes=s,e;case Gm:return ba(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ym:o=10;break e;case Xm:o=9;break e;case Yh:o=11;break e;case Xh:o=14;break e;case pr:o=16,r=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=dn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function ei(e,t,n,r){return e=dn(7,e,r,t),e.lanes=n,e}function ba(e,t,n,r){return e=dn(22,e,r,t),e.elementType=Gm,e.lanes=n,e.stateNode={isHidden:!1},e}function uc(e,t,n){return e=dn(6,e,null,t),e.lanes=n,e}function hc(e,t,n){return t=dn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Nw(e,t,n,r,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=Ka(0),this.expirationTimes=Ka(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ka(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Ld(e,t,n,r,i,s,o,l,a){return e=new Nw(e,t,n,l,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=dn(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},fd(s),e}function zw(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:xi,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function $v(e){if(!e)return Mr;e=e._reactInternals;e:{if(di(e)!==e||e.tag!==1)throw Error(ee(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ht(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ee(171))}if(e.tag===1){var n=e.type;if(Ht(n))return $_(e,n,t)}return t}function Wv(e,t,n,r,i,s,o,l,a){return e=Ld(n,r,!0,e,i,s,o,l,a),e.context=$v(null),n=e.current,r=Mt(),i=Ir(n),s=Jn(r,i),s.callback=t??null,Tr(n,s,i),e.current.lanes=i,yo(e,i,r),Ut(e,r),e}function ka(e,t,n,r){var i=t.current,s=Mt(),o=Ir(i);return n=$v(n),t.context===null?t.context=n:t.pendingContext=n,t=Jn(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Tr(i,t,o),e!==null&&(Cn(e,i,o,s),dl(e,i,o)),o}function ea(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 vp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Pd(e,t){vp(e,t),(e=e.alternate)&&vp(e,t)}function Ow(){return null}var Hv=typeof reportError=="function"?reportError:function(e){console.error(e)};function Dd(e){this._internalRoot=e}Ca.prototype.render=Dd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ee(409));ka(e,t,null,null)};Ca.prototype.unmount=Dd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;li(function(){ka(null,e,null,null)}),t[tr]=null}};function Ca(e){this._internalRoot=e}Ca.prototype.unstable_scheduleHydration=function(e){if(e){var t=S_();e={blockedOn:null,target:e,priority:t};for(var n=0;n<_r.length&&t!==0&&t<_r[n].priority;n++);_r.splice(n,0,e),n===0&&x_(e)}};function Md(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ea(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function yp(){}function jw(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var c=ea(o);s.call(c)}}var o=Wv(t,r,e,0,null,!1,!1,"",yp);return e._reactRootContainer=o,e[tr]=o.current,to(e.nodeType===8?e.parentNode:e),li(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var c=ea(a);l.call(c)}}var a=Ld(e,0,!1,null,null,!1,!1,"",yp);return e._reactRootContainer=a,e[tr]=a.current,to(e.nodeType===8?e.parentNode:e),li(function(){ka(t,a,n,r)}),a}function Ta(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var a=ea(o);l.call(a)}}ka(t,o,e,i)}else o=jw(n,t,e,i,r);return ea(o)}v_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ts(t.pendingLanes);n!==0&&(Zh(t,n|1),Ut(t,Je()),!(Ie&6)&&(Yi=Je()+500,Nr()))}break;case 13:li(function(){var r=nr(e,1);if(r!==null){var i=Mt();Cn(r,e,1,i)}}),Pd(e,1)}};Jh=function(e){if(e.tag===13){var t=nr(e,134217728);if(t!==null){var n=Mt();Cn(t,e,134217728,n)}Pd(e,134217728)}};y_=function(e){if(e.tag===13){var t=Ir(e),n=nr(e,t);if(n!==null){var r=Mt();Cn(n,e,t,r)}Pd(e,t)}};S_=function(){return Le};w_=function(e,t){var n=Le;try{return Le=e,t()}finally{Le=n}};ou=function(e,t,n){switch(t){case"input":if(Jc(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=_a(r);if(!i)throw Error(ee(90));Zm(r),Jc(r,i)}}}break;case"textarea":e_(e,n);break;case"select":t=n.value,t!=null&&Bi(e,!!n.multiple,t,!1)}};l_=Ed;a_=li;var Fw={usingClientEntryPoint:!1,Events:[wo,Ti,_a,s_,o_,Ed]},ps={findFiberByHostInstance:Xr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$w={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:ir.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=h_(e),e===null?null:e.stateNode},findFiberByHostInstance:ps.findFiberByHostInstance||Ow,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 Go=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Go.isDisabled&&Go.supportsFiber)try{fa=Go.inject($w),On=Go}catch{}}tn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Fw;tn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Md(t))throw Error(ee(200));return zw(e,t,null,n)};tn.createRoot=function(e,t){if(!Md(e))throw Error(ee(299));var n=!1,r="",i=Hv;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Ld(e,1,!1,null,null,n,!1,r,i),e[tr]=t.current,to(e.nodeType===8?e.parentNode:e),new Dd(t)};tn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ee(188)):(e=Object.keys(e).join(","),Error(ee(268,e)));return e=h_(t),e=e===null?null:e.stateNode,e};tn.flushSync=function(e){return li(e)};tn.hydrate=function(e,t,n){if(!Ea(t))throw Error(ee(200));return Ta(null,e,t,!0,n)};tn.hydrateRoot=function(e,t,n){if(!Md(e))throw Error(ee(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=Hv;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=Wv(t,null,e,1,n??null,i,!1,s,o),e[tr]=t.current,to(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Ca(t)};tn.render=function(e,t,n){if(!Ea(t))throw Error(ee(200));return Ta(null,e,t,!1,n)};tn.unmountComponentAtNode=function(e){if(!Ea(e))throw Error(ee(40));return e._reactRootContainer?(li(function(){Ta(null,null,e,!1,function(){e._reactRootContainer=null,e[tr]=null})}),!0):!1};tn.unstable_batchedUpdates=Ed;tn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ea(n))throw Error(ee(200));if(e==null||e._reactInternals===void 0)throw Error(ee(38));return Ta(e,t,n,!1,r)};tn.version="18.3.1-next-f1338f8080-20240426";function Uv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Uv)}catch(e){console.error(e)}}Uv(),Um.exports=tn;var Ww=Um.exports,Kv,Sp=Ww;Kv=Sp.createRoot,Sp.hydrateRoot;/**
40
+ `+s.stack}return{value:e,source:t,stack:i,digest:null}}function yc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Nu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Cw=typeof WeakMap=="function"?WeakMap:Map;function Rv(e,t,n){n=lr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){aa||(aa=!0,Vu=r),Nu(e,t)},n}function Iv(e,t,n){n=lr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Nu(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Nu(e,t),typeof r!="function"&&(Br===null?Br=new Set([this]):Br.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function fp(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Cw;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=jw.bind(null,e,t,n),t.then(e,e))}function pp(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 gp(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=lr(-1,1),t.tag=2,Ar(n,t,1))),n.lanes|=1),e)}var Ew=dr.ReactCurrentOwner,Jt=!1;function Ft(e,t,n,r){t.child=e===null?iv(t,null,n,r):Ji(t,e.child,n,r)}function mp(e,t,n,r,i){n=n.render;var s=t.ref;return qi(t,i),r=Id(e,t,n,r,s,i),n=Pd(),e!==null&&!Jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,hr(e,t,i)):(He&&n&&_d(t),t.flags|=1,Ft(e,t,r,i),t.child)}function _p(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!Fd(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,Pv(e,t,s,r,i)):(e=Il(n.type,null,r,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(n=n.compare,n=n!==null?n:ao,n(o,r)&&e.ref===t.ref)return hr(e,t,i)}return t.flags|=1,e=zr(s,r),e.ref=t.ref,e.return=t,t.child=e}function Pv(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(ao(s,r)&&e.ref===t.ref)if(Jt=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(Jt=!0);else return t.lanes=e.lanes,hr(e,t,i)}return zu(e,t,n,r,i)}function Lv(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Oe($i,an),an|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Oe($i,an),an|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,Oe($i,an),an|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,Oe($i,an),an|=r;return Ft(e,t,i,n),t.child}function Dv(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function zu(e,t,n,r,i){var s=tn(n)?hi:Bt.current;return s=Qi(t,s),qi(t,i),n=Id(e,t,n,r,s,i),r=Pd(),e!==null&&!Jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,hr(e,t,i)):(He&&r&&_d(t),t.flags|=1,Ft(e,t,n,i),t.child)}function vp(e,t,n,r,i){if(tn(n)){var s=!0;Zl(t)}else s=!1;if(qi(t,i),t.stateNode===null)El(e,t),Tv(t,n,r),Bu(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var a=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=En(c):(c=tn(n)?hi:Bt.current,c=Qi(t,c));var h=n.getDerivedStateFromProps,u=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||a!==c)&&dp(t,o,r,c),xr=!1;var d=t.memoizedState;o.state=d,ra(t,r,o,i),a=t.memoizedState,l!==r||d!==a||en.current||xr?(typeof h=="function"&&(Au(t,n,h,r),a=t.memoizedState),(l=xr||hp(t,n,l,r,d,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=r,t.memoizedState=a),o.props=r,o.state=a,o.context=c,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,ov(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Pn(t.type,l),o.props=c,u=t.pendingProps,d=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=En(a):(a=tn(n)?hi:Bt.current,a=Qi(t,a));var f=n.getDerivedStateFromProps;(h=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==u||d!==a)&&dp(t,o,r,a),xr=!1,d=t.memoizedState,o.state=d,ra(t,r,o,i);var g=t.memoizedState;l!==u||d!==g||en.current||xr?(typeof f=="function"&&(Au(t,n,f,r),g=t.memoizedState),(c=xr||hp(t,n,c,r,d,g,a)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=a,r=c):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return Ou(e,t,n,r,s,i)}function Ou(e,t,n,r,i,s){Dv(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&rp(t,n,!1),hr(e,t,s);r=t.stateNode,Ew.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ji(t,e.child,null,s),t.child=Ji(t,null,l,s)):Ft(e,t,l,s),t.memoizedState=r.state,i&&rp(t,n,!0),t.child}function Mv(e){var t=e.stateNode;t.pendingContext?np(e,t.pendingContext,t.pendingContext!==t.context):t.context&&np(e,t.context,!1),Cd(e,t.containerInfo)}function yp(e,t,n,r,i){return Zi(),yd(i),t.flags|=256,Ft(e,t,n,r),t.child}var ju={dehydrated:null,treeContext:null,retryLane:0};function Fu(e){return{baseLanes:e,cachePool:null,transitions:null}}function Av(e,t,n){var r=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),Oe(qe,i&1),e===null)return Du(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=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Aa(o,r,0,null),e=ai(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Fu(n),t.memoizedState=ju,e):Md(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return Tw(e,t,o,r,l,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,l=i.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=zr(i,a),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=zr(l,s):(s=ai(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?Fu(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=ju,r}return s=e.child,e=s.sibling,r=zr(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Md(e,t){return t=Aa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function il(e,t,n,r){return r!==null&&yd(r),Ji(t,e.child,null,n),e=Md(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Tw(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=yc(Error(ee(422))),il(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=Aa({mode:"visible",children:r.children},i,0,null),s=ai(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Ji(t,e.child,null,o),t.child.memoizedState=Fu(o),t.memoizedState=ju,s);if(!(t.mode&1))return il(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(ee(419)),r=yc(s,r,void 0),il(e,t,o,r)}if(l=(o&e.childLanes)!==0,Jt||l){if(r=xt,r!==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&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,ur(e,i),Bn(r,e,i,-1))}return jd(),r=yc(Error(ee(421))),il(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Fw.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,un=Mr(i.nextSibling),hn=t,He=!0,Dn=null,e!==null&&(Sn[wn++]=ir,Sn[wn++]=sr,Sn[wn++]=di,ir=e.id,sr=e.overflow,di=t),t=Md(t,r.children),t.flags|=4096,t)}function Sp(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Mu(e.return,t,n)}function Sc(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function Bv(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(Ft(e,t,r.children,n),r=qe.current,r&2)r=r&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&&Sp(e,n,t);else if(e.tag===19)Sp(e,n,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}r&=1}if(Oe(qe,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ia(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sc(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ia(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sc(t,!0,n,null,s);break;case"together":Sc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function El(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function hr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),pi|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ee(153));if(t.child!==null){for(e=t.child,n=zr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=zr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Rw(e,t,n){switch(t.tag){case 3:Mv(t),Zi();break;case 5:lv(t);break;case 1:tn(t.type)&&Zl(t);break;case 4:Cd(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Oe(ta,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Oe(qe,qe.current&1),t.flags|=128,null):n&t.child.childLanes?Av(e,t,n):(Oe(qe,qe.current&1),e=hr(e,t,n),e!==null?e.sibling:null);Oe(qe,qe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Bv(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Oe(qe,qe.current),r)break;return null;case 22:case 23:return t.lanes=0,Lv(e,t,n)}return hr(e,t,n)}var Nv,$u,zv,Ov;Nv=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};$u=function(){};zv=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,si(Xn.current);var s=null;switch(n){case"input":i=cu(e,i),r=cu(e,r),s=[];break;case"select":i=Xe({},i,{value:void 0}),r=Xe({},r,{value:void 0}),s=[];break;case"textarea":i=du(e,i),r=du(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Gl)}pu(n,r);var o;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var l=i[c];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(to.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var a=r[c];if(l=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(s||(s=[]),s.push(c,n)),n=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"&&(to.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&Fe("scroll",e),s||l===a||(s=[])):(s=s||[]).push(c,a))}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};Ov=function(e,t,n,r){n!==r&&(t.flags|=4)};function ws(e,t){if(!He)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Lt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Iw(e,t,n){var r=t.pendingProps;switch(vd(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(t),null;case 1:return tn(t.type)&&Ql(),Lt(t),null;case 3:return r=t.stateNode,es(),We(en),We(Bt),Td(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(nl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Dn!==null&&(Xu(Dn),Dn=null))),$u(e,t),Lt(t),null;case 5:Ed(t);var i=si(po.current);if(n=t.type,e!==null&&t.stateNode!=null)zv(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ee(166));return Lt(t),null}if(e=si(Xn.current),nl(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Vn]=t,r[ho]=s,e=(t.mode&1)!==0,n){case"dialog":Fe("cancel",r),Fe("close",r);break;case"iframe":case"object":case"embed":Fe("load",r);break;case"video":case"audio":for(i=0;i<Ns.length;i++)Fe(Ns[i],r);break;case"source":Fe("error",r);break;case"img":case"image":case"link":Fe("error",r),Fe("load",r);break;case"details":Fe("toggle",r);break;case"input":If(r,s),Fe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Fe("invalid",r);break;case"textarea":Lf(r,s),Fe("invalid",r)}pu(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?r.textContent!==l&&(s.suppressHydrationWarning!==!0&&tl(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&tl(r.textContent,l,e),i=["children",""+l]):to.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Fe("scroll",r)}switch(n){case"input":qo(r),Pf(r,s,!0);break;case"textarea":qo(r),Df(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Gl)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=d_(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Vn]=t,e[ho]=r,Nv(e,t,!1,!1),t.stateNode=e;e:{switch(o=gu(n,r),n){case"dialog":Fe("cancel",e),Fe("close",e),i=r;break;case"iframe":case"object":case"embed":Fe("load",e),i=r;break;case"video":case"audio":for(i=0;i<Ns.length;i++)Fe(Ns[i],e);i=r;break;case"source":Fe("error",e),i=r;break;case"img":case"image":case"link":Fe("error",e),Fe("load",e),i=r;break;case"details":Fe("toggle",e),i=r;break;case"input":If(e,r),i=cu(e,r),Fe("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Xe({},r,{value:void 0}),Fe("invalid",e);break;case"textarea":Lf(e,r),i=du(e,r),Fe("invalid",e);break;default:i=r}pu(n,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?g_(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&f_(e,a)):s==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&no(e,a):typeof a=="number"&&no(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(to.hasOwnProperty(s)?a!=null&&s==="onScroll"&&Fe("scroll",e):a!=null&&rd(e,s,a,o))}switch(n){case"input":qo(e),Pf(e,r,!1);break;case"textarea":qo(e),Df(e);break;case"option":r.value!=null&&e.setAttribute("value",""+jr(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Hi(e,!!r.multiple,s,!1):r.defaultValue!=null&&Hi(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Gl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Lt(t),null;case 6:if(e&&t.stateNode!=null)Ov(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ee(166));if(n=si(po.current),si(Xn.current),nl(t)){if(r=t.stateNode,n=t.memoizedProps,r[Vn]=t,(s=r.nodeValue!==n)&&(e=hn,e!==null))switch(e.tag){case 3:tl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&tl(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Vn]=t,t.stateNode=r}return Lt(t),null;case 13:if(We(qe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(He&&un!==null&&t.mode&1&&!(t.flags&128))nv(),Zi(),t.flags|=98560,s=!1;else if(s=nl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(ee(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ee(317));s[Vn]=t}else Zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lt(t),s=!1}else Dn!==null&&(Xu(Dn),Dn=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||qe.current&1?pt===0&&(pt=3):jd())),t.updateQueue!==null&&(t.flags|=4),Lt(t),null);case 4:return es(),$u(e,t),e===null&&co(t.stateNode.containerInfo),Lt(t),null;case 10:return xd(t.type._context),Lt(t),null;case 17:return tn(t.type)&&Ql(),Lt(t),null;case 19:if(We(qe),s=t.memoizedState,s===null)return Lt(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)ws(s,!1);else{if(pt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ia(e),o!==null){for(t.flags|=128,ws(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,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}),n=n.sibling;return Oe(qe,qe.current&1|2),t.child}e=e.sibling}s.tail!==null&&st()>ns&&(t.flags|=128,r=!0,ws(s,!1),t.lanes=4194304)}else{if(!r)if(e=ia(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ws(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!He)return Lt(t),null}else 2*st()-s.renderingStartTime>ns&&n!==1073741824&&(t.flags|=128,r=!0,ws(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.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,n=qe.current,Oe(qe,r?n&1|2:n&1),t):(Lt(t),null);case 22:case 23:return Od(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?an&1073741824&&(Lt(t),t.subtreeFlags&6&&(t.flags|=8192)):Lt(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function Pw(e,t){switch(vd(t),t.tag){case 1:return tn(t.type)&&Ql(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return es(),We(en),We(Bt),Td(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ed(t),null;case 13:if(We(qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));Zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return We(qe),null;case 4:return es(),null;case 10:return xd(t.type._context),null;case 22:case 23:return Od(),null;case 24:return null;default:return null}}var sl=!1,Mt=!1,Lw=typeof WeakSet=="function"?WeakSet:Set,de=null;function Fi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){et(e,t,r)}else n.current=null}function Wu(e,t,n){try{n()}catch(r){et(e,t,r)}}var wp=!1;function Dw(e,t){if(Cu=ql,e=H_(),md(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,c=0,h=0,u=e,d=null;t:for(;;){for(var f;u!==n||i!==0&&u.nodeType!==3||(l=o+i),u!==s||r!==0&&u.nodeType!==3||(a=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(f=u.firstChild)!==null;)d=u,u=f;for(;;){if(u===e)break t;if(d===n&&++c===i&&(l=o),d===s&&++h===r&&(a=o),(f=u.nextSibling)!==null)break;u=d,d=u.parentNode}u=f}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Eu={focusedElem:e,selectionRange:n},ql=!1,de=t;de!==null;)if(t=de,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,de=e;else for(;de!==null;){t=de;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,w=g.memoizedState,_=t.stateNode,v=_.getSnapshotBeforeUpdate(t.elementType===t.type?m:Pn(t.type,m),w);_.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(E){et(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return g=wp,wp=!1,g}function Ys(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Wu(t,n,s)}i=i.next}while(i!==r)}}function Da(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Hu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function jv(e){var t=e.alternate;t!==null&&(e.alternate=null,jv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Vn],delete t[ho],delete t[Iu],delete t[pw],delete t[gw])),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 Fv(e){return e.tag===5||e.tag===3||e.tag===4}function xp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fv(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 Uu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Gl));else if(r!==4&&(e=e.child,e!==null))for(Uu(e,t,n),e=e.sibling;e!==null;)Uu(e,t,n),e=e.sibling}function Ku(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ku(e,t,n),e=e.sibling;e!==null;)Ku(e,t,n),e=e.sibling}var kt=null,Ln=!1;function mr(e,t,n){for(n=n.child;n!==null;)$v(e,t,n),n=n.sibling}function $v(e,t,n){if(Yn&&typeof Yn.onCommitFiberUnmount=="function")try{Yn.onCommitFiberUnmount(ka,n)}catch{}switch(n.tag){case 5:Mt||Fi(n,t);case 6:var r=kt,i=Ln;kt=null,mr(e,t,n),kt=r,Ln=i,kt!==null&&(Ln?(e=kt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kt.removeChild(n.stateNode));break;case 18:kt!==null&&(Ln?(e=kt,n=n.stateNode,e.nodeType===8?fc(e.parentNode,n):e.nodeType===1&&fc(e,n),oo(e)):fc(kt,n.stateNode));break;case 4:r=kt,i=Ln,kt=n.stateNode.containerInfo,Ln=!0,mr(e,t,n),kt=r,Ln=i;break;case 0:case 11:case 14:case 15:if(!Mt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Wu(n,t,o),i=i.next}while(i!==r)}mr(e,t,n);break;case 1:if(!Mt&&(Fi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){et(n,t,l)}mr(e,t,n);break;case 21:mr(e,t,n);break;case 22:n.mode&1?(Mt=(r=Mt)||n.memoizedState!==null,mr(e,t,n),Mt=r):mr(e,t,n);break;default:mr(e,t,n)}}function bp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Lw),t.forEach(function(r){var i=$w.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Rn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:kt=l.stateNode,Ln=!1;break e;case 3:kt=l.stateNode.containerInfo,Ln=!0;break e;case 4:kt=l.stateNode.containerInfo,Ln=!0;break e}l=l.return}if(kt===null)throw Error(ee(160));$v(s,o,i),kt=null,Ln=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(c){et(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Wv(t,e),t=t.sibling}function Wv(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Rn(t,e),jn(e),r&4){try{Ys(3,e,e.return),Da(3,e)}catch(m){et(e,e.return,m)}try{Ys(5,e,e.return)}catch(m){et(e,e.return,m)}}break;case 1:Rn(t,e),jn(e),r&512&&n!==null&&Fi(n,n.return);break;case 5:if(Rn(t,e),jn(e),r&512&&n!==null&&Fi(n,n.return),e.flags&32){var i=e.stateNode;try{no(i,"")}catch(m){et(e,e.return,m)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&u_(i,s),gu(l,o);var c=gu(l,s);for(o=0;o<a.length;o+=2){var h=a[o],u=a[o+1];h==="style"?g_(i,u):h==="dangerouslySetInnerHTML"?f_(i,u):h==="children"?no(i,u):rd(i,h,u,c)}switch(l){case"input":uu(i,s);break;case"textarea":h_(i,s);break;case"select":var d=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var f=s.value;f!=null?Hi(i,!!s.multiple,f,!1):d!==!!s.multiple&&(s.defaultValue!=null?Hi(i,!!s.multiple,s.defaultValue,!0):Hi(i,!!s.multiple,s.multiple?[]:"",!1))}i[ho]=s}catch(m){et(e,e.return,m)}}break;case 6:if(Rn(t,e),jn(e),r&4){if(e.stateNode===null)throw Error(ee(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(m){et(e,e.return,m)}}break;case 3:if(Rn(t,e),jn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{oo(t.containerInfo)}catch(m){et(e,e.return,m)}break;case 4:Rn(t,e),jn(e);break;case 13:Rn(t,e),jn(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Nd=st())),r&4&&bp(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(Mt=(c=Mt)||h,Rn(t,e),Mt=c):Rn(t,e),jn(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(de=e,h=e.child;h!==null;){for(u=de=h;de!==null;){switch(d=de,f=d.child,d.tag){case 0:case 11:case 14:case 15:Ys(4,d,d.return);break;case 1:Fi(d,d.return);var g=d.stateNode;if(typeof g.componentWillUnmount=="function"){r=d,n=d.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(m){et(r,n,m)}}break;case 5:Fi(d,d.return);break;case 22:if(d.memoizedState!==null){Cp(u);continue}}f!==null?(f.return=d,de=f):Cp(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=p_("display",o))}catch(m){et(e,e.return,m)}}}else if(u.tag===6){if(h===null)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(m){et(e,e.return,m)}}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:Rn(t,e),jn(e),r&4&&bp(e);break;case 21:break;default:Rn(t,e),jn(e)}}function jn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Fv(n)){var r=n;break e}n=n.return}throw Error(ee(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(no(i,""),r.flags&=-33);var s=xp(e);Ku(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,l=xp(e);Uu(e,l,o);break;default:throw Error(ee(161))}}catch(a){et(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Mw(e,t,n){de=e,Hv(e)}function Hv(e,t,n){for(var r=(e.mode&1)!==0;de!==null;){var i=de,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||sl;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||Mt;l=sl;var c=Mt;if(sl=o,(Mt=a)&&!c)for(de=i;de!==null;)o=de,a=o.child,o.tag===22&&o.memoizedState!==null?Ep(i):a!==null?(a.return=o,de=a):Ep(i);for(;s!==null;)de=s,Hv(s),s=s.sibling;de=i,sl=l,Mt=c}kp(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,de=s):kp(e)}}function kp(e){for(;de!==null;){var t=de;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Mt||Da(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Mt)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Pn(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&ap(t,s,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ap(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break;case"img":a.src&&(n.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&&oo(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ee(163))}Mt||t.flags&512&&Hu(t)}catch(d){et(t,t.return,d)}}if(t===e){de=null;break}if(n=t.sibling,n!==null){n.return=t.return,de=n;break}de=t.return}}function Cp(e){for(;de!==null;){var t=de;if(t===e){de=null;break}var n=t.sibling;if(n!==null){n.return=t.return,de=n;break}de=t.return}}function Ep(e){for(;de!==null;){var t=de;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Da(4,t)}catch(a){et(t,n,a)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(a){et(t,i,a)}}var s=t.return;try{Hu(t)}catch(a){et(t,s,a)}break;case 5:var o=t.return;try{Hu(t)}catch(a){et(t,o,a)}}}catch(a){et(t,t.return,a)}if(t===e){de=null;break}var l=t.sibling;if(l!==null){l.return=t.return,de=l;break}de=t.return}}var Aw=Math.ceil,la=dr.ReactCurrentDispatcher,Ad=dr.ReactCurrentOwner,kn=dr.ReactCurrentBatchConfig,Le=0,xt=null,ct=null,Tt=0,an=0,$i=Wr(0),pt=0,vo=null,pi=0,Ma=0,Bd=0,Xs=null,Zt=null,Nd=0,ns=1/0,tr=null,aa=!1,Vu=null,Br=null,ol=!1,Tr=null,ca=0,Gs=0,qu=null,Tl=-1,Rl=0;function Wt(){return Le&6?st():Tl!==-1?Tl:Tl=st()}function Nr(e){return e.mode&1?Le&2&&Tt!==0?Tt&-Tt:_w.transition!==null?(Rl===0&&(Rl=T_()),Rl):(e=Me,e!==0||(e=window.event,e=e===void 0?16:A_(e.type)),e):1}function Bn(e,t,n,r){if(50<Gs)throw Gs=0,qu=null,Error(ee(185));To(e,n,r),(!(Le&2)||e!==xt)&&(e===xt&&(!(Le&2)&&(Ma|=n),pt===4&&Cr(e,Tt)),nn(e,r),n===1&&Le===0&&!(t.mode&1)&&(ns=st()+500,Ia&&Hr()))}function nn(e,t){var n=e.callbackNode;_S(e,t);var r=Vl(e,e===xt?Tt:0);if(r===0)n!==null&&Bf(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Bf(n),t===1)e.tag===0?mw(Tp.bind(null,e)):J_(Tp.bind(null,e)),dw(function(){!(Le&6)&&Hr()}),n=null;else{switch(R_(r)){case 1:n=ad;break;case 4:n=C_;break;case 16:n=Kl;break;case 536870912:n=E_;break;default:n=Kl}n=Qv(n,Uv.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Uv(e,t){if(Tl=-1,Rl=0,Le&6)throw Error(ee(327));var n=e.callbackNode;if(Yi()&&e.callbackNode!==n)return null;var r=Vl(e,e===xt?Tt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ua(e,r);else{t=r;var i=Le;Le|=2;var s=Vv();(xt!==e||Tt!==t)&&(tr=null,ns=st()+500,li(e,t));do try{zw();break}catch(l){Kv(e,l)}while(!0);wd(),la.current=s,Le=i,ct!==null?t=0:(xt=null,Tt=0,t=pt)}if(t!==0){if(t===2&&(i=Su(e),i!==0&&(r=i,t=Yu(e,i))),t===1)throw n=vo,li(e,0),Cr(e,r),nn(e,st()),n;if(t===6)Cr(e,r);else{if(i=e.current.alternate,!(r&30)&&!Bw(i)&&(t=ua(e,r),t===2&&(s=Su(e),s!==0&&(r=s,t=Yu(e,s))),t===1))throw n=vo,li(e,0),Cr(e,r),nn(e,st()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(ee(345));case 2:Qr(e,Zt,tr);break;case 3:if(Cr(e,r),(r&130023424)===r&&(t=Nd+500-st(),10<t)){if(Vl(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Wt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Ru(Qr.bind(null,e,Zt,tr),t);break}Qr(e,Zt,tr);break;case 4:if(Cr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-An(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=st()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Aw(r/1960))-r,10<r){e.timeoutHandle=Ru(Qr.bind(null,e,Zt,tr),r);break}Qr(e,Zt,tr);break;case 5:Qr(e,Zt,tr);break;default:throw Error(ee(329))}}}return nn(e,st()),e.callbackNode===n?Uv.bind(null,e):null}function Yu(e,t){var n=Xs;return e.current.memoizedState.isDehydrated&&(li(e,t).flags|=256),e=ua(e,t),e!==2&&(t=Zt,Zt=n,t!==null&&Xu(t)),e}function Xu(e){Zt===null?Zt=e:Zt.push.apply(Zt,e)}function Bw(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!zn(s(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 Cr(e,t){for(t&=~Bd,t&=~Ma,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-An(t),r=1<<n;e[n]=-1,t&=~r}}function Tp(e){if(Le&6)throw Error(ee(327));Yi();var t=Vl(e,0);if(!(t&1))return nn(e,st()),null;var n=ua(e,t);if(e.tag!==0&&n===2){var r=Su(e);r!==0&&(t=r,n=Yu(e,r))}if(n===1)throw n=vo,li(e,0),Cr(e,t),nn(e,st()),n;if(n===6)throw Error(ee(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Qr(e,Zt,tr),nn(e,st()),null}function zd(e,t){var n=Le;Le|=1;try{return e(t)}finally{Le=n,Le===0&&(ns=st()+500,Ia&&Hr())}}function gi(e){Tr!==null&&Tr.tag===0&&!(Le&6)&&Yi();var t=Le;Le|=1;var n=kn.transition,r=Me;try{if(kn.transition=null,Me=1,e)return e()}finally{Me=r,kn.transition=n,Le=t,!(Le&6)&&Hr()}}function Od(){an=$i.current,We($i)}function li(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,hw(n)),ct!==null)for(n=ct.return;n!==null;){var r=n;switch(vd(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ql();break;case 3:es(),We(en),We(Bt),Td();break;case 5:Ed(r);break;case 4:es();break;case 13:We(qe);break;case 19:We(qe);break;case 10:xd(r.type._context);break;case 22:case 23:Od()}n=n.return}if(xt=e,ct=e=zr(e.current,null),Tt=an=t,pt=0,vo=null,Bd=Ma=pi=0,Zt=Xs=null,ii!==null){for(t=0;t<ii.length;t++)if(n=ii[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}ii=null}return e}function Kv(e,t){do{var n=ct;try{if(wd(),kl.current=oa,sa){for(var r=Ye.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}sa=!1}if(fi=0,vt=ft=Ye=null,qs=!1,go=0,Ad.current=null,n===null||n.return===null){pt=1,vo=t,ct=null;break}e:{var s=e,o=n.return,l=n,a=t;if(t=Tt,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 d=h.alternate;d?(h.updateQueue=d.updateQueue,h.memoizedState=d.memoizedState,h.lanes=d.lanes):(h.updateQueue=null,h.memoizedState=null)}var f=pp(o);if(f!==null){f.flags&=-257,gp(f,o,l,s,t),f.mode&1&&fp(s,c,t),t=f,a=c;var g=t.updateQueue;if(g===null){var m=new Set;m.add(a),t.updateQueue=m}else g.add(a);break e}else{if(!(t&1)){fp(s,c,t),jd();break e}a=Error(ee(426))}}else if(He&&l.mode&1){var w=pp(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),gp(w,o,l,s,t),yd(ts(a,l));break e}}s=a=ts(a,l),pt!==4&&(pt=2),Xs===null?Xs=[s]:Xs.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var _=Rv(s,a,t);lp(s,_);break e;case 1:l=a;var v=s.type,y=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Br===null||!Br.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t;var E=Iv(s,l,t);lp(s,E);break e}}s=s.return}while(s!==null)}Yv(n)}catch(R){t=R,ct===n&&n!==null&&(ct=n=n.return);continue}break}while(!0)}function Vv(){var e=la.current;return la.current=oa,e===null?oa:e}function jd(){(pt===0||pt===3||pt===2)&&(pt=4),xt===null||!(pi&268435455)&&!(Ma&268435455)||Cr(xt,Tt)}function ua(e,t){var n=Le;Le|=2;var r=Vv();(xt!==e||Tt!==t)&&(tr=null,li(e,t));do try{Nw();break}catch(i){Kv(e,i)}while(!0);if(wd(),Le=n,la.current=r,ct!==null)throw Error(ee(261));return xt=null,Tt=0,pt}function Nw(){for(;ct!==null;)qv(ct)}function zw(){for(;ct!==null&&!aS();)qv(ct)}function qv(e){var t=Gv(e.alternate,e,an);e.memoizedProps=e.pendingProps,t===null?Yv(e):ct=t,Ad.current=null}function Yv(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Pw(n,t),n!==null){n.flags&=32767,ct=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{pt=6,ct=null;return}}else if(n=Iw(n,t,an),n!==null){ct=n;return}if(t=t.sibling,t!==null){ct=t;return}ct=t=e}while(t!==null);pt===0&&(pt=5)}function Qr(e,t,n){var r=Me,i=kn.transition;try{kn.transition=null,Me=1,Ow(e,t,n,r)}finally{kn.transition=i,Me=r}return null}function Ow(e,t,n,r){do Yi();while(Tr!==null);if(Le&6)throw Error(ee(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ee(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(vS(e,s),e===xt&&(ct=xt=null,Tt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ol||(ol=!0,Qv(Kl,function(){return Yi(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=kn.transition,kn.transition=null;var o=Me;Me=1;var l=Le;Le|=4,Ad.current=null,Dw(e,n),Wv(n,e),iw(Eu),ql=!!Cu,Eu=Cu=null,e.current=n,Mw(n),cS(),Le=l,Me=o,kn.transition=s}else e.current=n;if(ol&&(ol=!1,Tr=e,ca=i),s=e.pendingLanes,s===0&&(Br=null),dS(n.stateNode),nn(e,st()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(aa)throw aa=!1,e=Vu,Vu=null,e;return ca&1&&e.tag!==0&&Yi(),s=e.pendingLanes,s&1?e===qu?Gs++:(Gs=0,qu=e):Gs=0,Hr(),null}function Yi(){if(Tr!==null){var e=R_(ca),t=kn.transition,n=Me;try{if(kn.transition=null,Me=16>e?16:e,Tr===null)var r=!1;else{if(e=Tr,Tr=null,ca=0,Le&6)throw Error(ee(331));var i=Le;for(Le|=4,de=e.current;de!==null;){var s=de,o=s.child;if(de.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(de=c;de!==null;){var h=de;switch(h.tag){case 0:case 11:case 15:Ys(8,h,s)}var u=h.child;if(u!==null)u.return=h,de=u;else for(;de!==null;){h=de;var d=h.sibling,f=h.return;if(jv(h),h===c){de=null;break}if(d!==null){d.return=f,de=d;break}de=f}}}var g=s.alternate;if(g!==null){var m=g.child;if(m!==null){g.child=null;do{var w=m.sibling;m.sibling=null,m=w}while(m!==null)}}de=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,de=o;else e:for(;de!==null;){if(s=de,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Ys(9,s,s.return)}var _=s.sibling;if(_!==null){_.return=s.return,de=_;break e}de=s.return}}var v=e.current;for(de=v;de!==null;){o=de;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,de=y;else e:for(o=v;de!==null;){if(l=de,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Da(9,l)}}catch(R){et(l,l.return,R)}if(l===o){de=null;break e}var E=l.sibling;if(E!==null){E.return=l.return,de=E;break e}de=l.return}}if(Le=i,Hr(),Yn&&typeof Yn.onPostCommitFiberRoot=="function")try{Yn.onPostCommitFiberRoot(ka,e)}catch{}r=!0}return r}finally{Me=n,kn.transition=t}}return!1}function Rp(e,t,n){t=ts(n,t),t=Rv(e,t,1),e=Ar(e,t,1),t=Wt(),e!==null&&(To(e,1,t),nn(e,t))}function et(e,t,n){if(e.tag===3)Rp(e,e,n);else for(;t!==null;){if(t.tag===3){Rp(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Br===null||!Br.has(r))){e=ts(n,e),e=Iv(t,e,1),t=Ar(t,e,1),e=Wt(),t!==null&&(To(t,1,e),nn(t,e));break}}t=t.return}}function jw(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Wt(),e.pingedLanes|=e.suspendedLanes&n,xt===e&&(Tt&n)===n&&(pt===4||pt===3&&(Tt&130023424)===Tt&&500>st()-Nd?li(e,0):Bd|=n),nn(e,t)}function Xv(e,t){t===0&&(e.mode&1?(t=Go,Go<<=1,!(Go&130023424)&&(Go=4194304)):t=1);var n=Wt();e=ur(e,t),e!==null&&(To(e,t,n),nn(e,n))}function Fw(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xv(e,n)}function $w(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ee(314))}r!==null&&r.delete(t),Xv(e,n)}var Gv;Gv=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||en.current)Jt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Jt=!1,Rw(e,t,n);Jt=!!(e.flags&131072)}else Jt=!1,He&&t.flags&1048576&&ev(t,ea,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;El(e,t),e=t.pendingProps;var i=Qi(t,Bt.current);qi(t,n),i=Id(null,t,r,e,i,n);var s=Pd();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,tn(r)?(s=!0,Zl(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,kd(t),i.updater=La,t.stateNode=i,i._reactInternals=t,Bu(t,r,e,n),t=Ou(null,t,r,!0,s,n)):(t.tag=0,He&&s&&_d(t),Ft(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(El(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Hw(r),e=Pn(r,e),i){case 0:t=zu(null,t,r,e,n);break e;case 1:t=vp(null,t,r,e,n);break e;case 11:t=mp(null,t,r,e,n);break e;case 14:t=_p(null,t,r,Pn(r.type,e),n);break e}throw Error(ee(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Pn(r,i),zu(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Pn(r,i),vp(e,t,r,i,n);case 3:e:{if(Mv(t),e===null)throw Error(ee(387));r=t.pendingProps,s=t.memoizedState,i=s.element,ov(e,t),ra(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=ts(Error(ee(423)),t),t=yp(e,t,r,n,i);break e}else if(r!==i){i=ts(Error(ee(424)),t),t=yp(e,t,r,n,i);break e}else for(un=Mr(t.stateNode.containerInfo.firstChild),hn=t,He=!0,Dn=null,n=iv(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Zi(),r===i){t=hr(e,t,n);break e}Ft(e,t,r,n)}t=t.child}return t;case 5:return lv(t),e===null&&Du(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Tu(r,i)?o=null:s!==null&&Tu(r,s)&&(t.flags|=32),Dv(e,t),Ft(e,t,o,n),t.child;case 6:return e===null&&Du(t),null;case 13:return Av(e,t,n);case 4:return Cd(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ji(t,null,r,n):Ft(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Pn(r,i),mp(e,t,r,i,n);case 7:return Ft(e,t,t.pendingProps,n),t.child;case 8:return Ft(e,t,t.pendingProps.children,n),t.child;case 12:return Ft(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Oe(ta,r._currentValue),r._currentValue=o,s!==null)if(zn(s.value,o)){if(s.children===i.children&&!en.current){t=hr(e,t,n);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===r){if(s.tag===1){a=lr(-1,n&-n),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|=n,a=s.alternate,a!==null&&(a.lanes|=n),Mu(s.return,n,t),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Mu(o,n,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,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,qi(t,n),i=En(i),r=r(i),t.flags|=1,Ft(e,t,r,n),t.child;case 14:return r=t.type,i=Pn(r,t.pendingProps),i=Pn(r.type,i),_p(e,t,r,i,n);case 15:return Pv(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Pn(r,i),El(e,t),t.tag=1,tn(r)?(e=!0,Zl(t)):e=!1,qi(t,n),Tv(t,r,i),Bu(t,r,i,n),Ou(null,t,r,!0,e,n);case 19:return Bv(e,t,n);case 22:return Lv(e,t,n)}throw Error(ee(156,t.tag))};function Qv(e,t){return k_(e,t)}function Ww(e,t,n,r){this.tag=e,this.key=n,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bn(e,t,n,r){return new Ww(e,t,n,r)}function Fd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hw(e){if(typeof e=="function")return Fd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===sd)return 11;if(e===od)return 14}return 2}function zr(e,t){var n=e.alternate;return n===null?(n=bn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Il(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Fd(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Li:return ai(n.children,i,s,t);case id:o=8,i|=8;break;case su:return e=bn(12,n,t,i|2),e.elementType=su,e.lanes=s,e;case ou:return e=bn(13,n,t,i),e.elementType=ou,e.lanes=s,e;case lu:return e=bn(19,n,t,i),e.elementType=lu,e.lanes=s,e;case l_:return Aa(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case s_:o=10;break e;case o_:o=9;break e;case sd:o=11;break e;case od:o=14;break e;case wr:o=16,r=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=bn(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function ai(e,t,n,r){return e=bn(7,e,r,t),e.lanes=n,e}function Aa(e,t,n,r){return e=bn(22,e,r,t),e.elementType=l_,e.lanes=n,e.stateNode={isHidden:!1},e}function wc(e,t,n){return e=bn(6,e,null,t),e.lanes=n,e}function xc(e,t,n){return t=bn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Uw(e,t,n,r,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=nc(0),this.expirationTimes=nc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nc(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function $d(e,t,n,r,i,s,o,l,a){return e=new Uw(e,t,n,l,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=bn(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},kd(s),e}function Kw(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Pi,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Zv(e){if(!e)return Fr;e=e._reactInternals;e:{if(Si(e)!==e||e.tag!==1)throw Error(ee(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(tn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ee(171))}if(e.tag===1){var n=e.type;if(tn(n))return Z_(e,n,t)}return t}function Jv(e,t,n,r,i,s,o,l,a){return e=$d(n,r,!0,e,i,s,o,l,a),e.context=Zv(null),n=e.current,r=Wt(),i=Nr(n),s=lr(r,i),s.callback=t??null,Ar(n,s,i),e.current.lanes=i,To(e,i,r),nn(e,r),e}function Ba(e,t,n,r){var i=t.current,s=Wt(),o=Nr(i);return n=Zv(n),t.context===null?t.context=n:t.pendingContext=n,t=lr(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ar(i,t,o),e!==null&&(Bn(e,i,o,s),bl(e,i,o)),o}function ha(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 Ip(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Wd(e,t){Ip(e,t),(e=e.alternate)&&Ip(e,t)}function Vw(){return null}var ey=typeof reportError=="function"?reportError:function(e){console.error(e)};function Hd(e){this._internalRoot=e}Na.prototype.render=Hd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ee(409));Ba(e,t,null,null)};Na.prototype.unmount=Hd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;gi(function(){Ba(null,e,null,null)}),t[cr]=null}};function Na(e){this._internalRoot=e}Na.prototype.unstable_scheduleHydration=function(e){if(e){var t=L_();e={blockedOn:null,target:e,priority:t};for(var n=0;n<kr.length&&t!==0&&t<kr[n].priority;n++);kr.splice(n,0,e),n===0&&M_(e)}};function Ud(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function za(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Pp(){}function qw(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var c=ha(o);s.call(c)}}var o=Jv(t,r,e,0,null,!1,!1,"",Pp);return e._reactRootContainer=o,e[cr]=o.current,co(e.nodeType===8?e.parentNode:e),gi(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var c=ha(a);l.call(c)}}var a=$d(e,0,!1,null,null,!1,!1,"",Pp);return e._reactRootContainer=a,e[cr]=a.current,co(e.nodeType===8?e.parentNode:e),gi(function(){Ba(t,a,n,r)}),a}function Oa(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var a=ha(o);l.call(a)}}Ba(t,o,e,i)}else o=qw(n,t,e,i,r);return ha(o)}I_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Bs(t.pendingLanes);n!==0&&(cd(t,n|1),nn(t,st()),!(Le&6)&&(ns=st()+500,Hr()))}break;case 13:gi(function(){var r=ur(e,1);if(r!==null){var i=Wt();Bn(r,e,1,i)}}),Wd(e,1)}};ud=function(e){if(e.tag===13){var t=ur(e,134217728);if(t!==null){var n=Wt();Bn(t,e,134217728,n)}Wd(e,134217728)}};P_=function(e){if(e.tag===13){var t=Nr(e),n=ur(e,t);if(n!==null){var r=Wt();Bn(n,e,t,r)}Wd(e,t)}};L_=function(){return Me};D_=function(e,t){var n=Me;try{return Me=e,t()}finally{Me=n}};_u=function(e,t,n){switch(t){case"input":if(uu(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=Ra(r);if(!i)throw Error(ee(90));c_(r),uu(r,i)}}}break;case"textarea":h_(e,n);break;case"select":t=n.value,t!=null&&Hi(e,!!n.multiple,t,!1)}};v_=zd;y_=gi;var Yw={usingClientEntryPoint:!1,Events:[Io,Bi,Ra,m_,__,zd]},xs={findFiberByHostInstance:ri,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Xw={bundleType:xs.bundleType,version:xs.version,rendererPackageName:xs.rendererPackageName,rendererConfig:xs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:dr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=x_(e),e===null?null:e.stateNode},findFiberByHostInstance:xs.findFiberByHostInstance||Vw,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 ll=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ll.isDisabled&&ll.supportsFiber)try{ka=ll.inject(Xw),Yn=ll}catch{}}pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Yw;pn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ud(t))throw Error(ee(200));return Kw(e,t,null,n)};pn.createRoot=function(e,t){if(!Ud(e))throw Error(ee(299));var n=!1,r="",i=ey;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=$d(e,1,!1,null,null,n,!1,r,i),e[cr]=t.current,co(e.nodeType===8?e.parentNode:e),new Hd(t)};pn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ee(188)):(e=Object.keys(e).join(","),Error(ee(268,e)));return e=x_(t),e=e===null?null:e.stateNode,e};pn.flushSync=function(e){return gi(e)};pn.hydrate=function(e,t,n){if(!za(t))throw Error(ee(200));return Oa(null,e,t,!0,n)};pn.hydrateRoot=function(e,t,n){if(!Ud(e))throw Error(ee(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=ey;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=Jv(t,null,e,1,n??null,i,!1,s,o),e[cr]=t.current,co(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Na(t)};pn.render=function(e,t,n){if(!za(t))throw Error(ee(200));return Oa(null,e,t,!1,n)};pn.unmountComponentAtNode=function(e){if(!za(e))throw Error(ee(40));return e._reactRootContainer?(gi(function(){Oa(null,null,e,!1,function(){e._reactRootContainer=null,e[cr]=null})}),!0):!1};pn.unstable_batchedUpdates=zd;pn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!za(n))throw Error(ee(200));if(e==null||e._reactInternals===void 0)throw Error(ee(38));return Oa(e,t,n,!1,r)};pn.version="18.3.1-next-f1338f8080-20240426";function ty(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ty)}catch(e){console.error(e)}}ty(),t_.exports=pn;var Gw=t_.exports,ny,Lp=Gw;ny=Lp.createRoot,Lp.hydrateRoot;/**
41
41
  * @remix-run/router v1.23.2
42
42
  *
43
43
  * Copyright (c) Remix Software Inc.
@@ -46,7 +46,7 @@ Error generating stack: `+s.message+`
46
46
  * LICENSE.md file in the root directory of this source tree.
47
47
  *
48
48
  * @license MIT
49
- */function uo(){return uo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uo.apply(this,arguments)}var wr;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(wr||(wr={}));const wp="popstate";function Hw(e){e===void 0&&(e={});function t(r,i){let{pathname:s,search:o,hash:l}=r.location;return ju("",{pathname:s,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:Vv(i)}return Kw(t,n,null,e)}function it(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ad(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Uw(){return Math.random().toString(36).substr(2,8)}function xp(e,t){return{usr:e.state,key:e.key,idx:t}}function ju(e,t,n,r){return n===void 0&&(n=null),uo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?es(t):t,{state:n,key:t&&t.key||r||Uw()})}function Vv(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function es(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Kw(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,l=wr.Pop,a=null,c=h();c==null&&(c=0,o.replaceState(uo({},o.state,{idx:c}),""));function h(){return(o.state||{idx:null}).idx}function u(){l=wr.Pop;let w=h(),_=w==null?null:w-c;c=w,a&&a({action:l,location:m.location,delta:_})}function d(w,_){l=wr.Push;let v=ju(m.location,w,_);c=h()+1;let y=xp(v,c),E=m.createHref(v);try{o.pushState(y,"",E)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;i.location.assign(E)}s&&a&&a({action:l,location:m.location,delta:1})}function f(w,_){l=wr.Replace;let v=ju(m.location,w,_);c=h();let y=xp(v,c),E=m.createHref(v);o.replaceState(y,"",E),s&&a&&a({action:l,location:m.location,delta:0})}function g(w){let _=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof w=="string"?w:Vv(w);return v=v.replace(/ $/,"%20"),it(_,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,_)}let m={get action(){return l},get location(){return e(i,o)},listen(w){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(wp,u),a=w,()=>{i.removeEventListener(wp,u),a=null}},createHref(w){return t(i,w)},createURL:g,encodeLocation(w){let _=g(w);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:d,replace:f,go(w){return o.go(w)}};return m}var bp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(bp||(bp={}));function Vw(e,t,n){return n===void 0&&(n="/"),qw(e,t,n)}function qw(e,t,n,r){let i=typeof t=="string"?es(t):t,s=Xv(i.pathname||"/",n);if(s==null)return null;let o=qv(e);Yw(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let c=ox(s);l=rx(o[a],c)}return l}function qv(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");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("/")&&(it(a.relativePath.startsWith(r),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(r.length));let c=ti([r,a.relativePath]),h=n.concat(a);s.children&&s.children.length>0&&(it(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),qv(s.children,t,h,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:tx(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 Yv(s.path))i(s,o,a)}),t}function Yv(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=Yv(r.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 Yw(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:nx(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Xw=/^:[\w-]+$/,Gw=3,Qw=2,Zw=1,Jw=10,ex=-2,kp=e=>e==="*";function tx(e,t){let n=e.split("/"),r=n.length;return n.some(kp)&&(r+=ex),t&&(r+=Qw),n.filter(i=>!kp(i)).reduce((i,s)=>i+(Xw.test(s)?Gw:s===""?Zw:Jw),r)}function nx(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function rx(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let l=0;l<r.length;++l){let a=r[l],c=l===r.length-1,h=s==="/"?t:t.slice(s.length)||"/",u=ix({path:a.relativePath,caseSensitive:a.caseSensitive,end:c},h),d=a.route;if(!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:ti([s,u.pathname]),pathnameBase:hx(ti([s,u.pathnameBase])),route:d}),u.pathnameBase!=="/"&&(s=ti([s,u.pathnameBase]))}return o}function ix(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=sx(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:r.reduce((c,h,u)=>{let{paramName:d,isOptional:f}=h;if(d==="*"){let m=l[u]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[u];return f&&!g?c[d]=void 0:c[d]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function sx(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Ad(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 r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(r.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function ox(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ad(!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 Xv(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const lx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ax=e=>lx.test(e);function cx(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?es(e):e,s;if(n)if(ax(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Ad(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=Cp(n.substring(1),"/"):s=Cp(n,t)}else s=t;return{pathname:s,search:dx(r),hash:fx(i)}}function Cp(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function dc(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function ux(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Gv(e,t){let n=ux(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Qv(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=es(e):(i=uo({},e),it(!i.pathname||!i.pathname.includes("?"),dc("?","pathname","search",i)),it(!i.pathname||!i.pathname.includes("#"),dc("#","pathname","hash",i)),it(!i.search||!i.search.includes("#"),dc("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=n;else{let u=t.length-1;if(!r&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),u-=1;i.pathname=d.join("/")}l=u>=0?t[u]:"/"}let a=cx(i,l),c=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(c||h)&&(a.pathname+="/"),a}const ti=e=>e.join("/").replace(/\/\/+/g,"/"),hx=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),dx=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,fx=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function px(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Zv=["post","put","patch","delete"];new Set(Zv);const gx=["get",...Zv];new Set(gx);/**
49
+ */function yo(){return yo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yo.apply(this,arguments)}var Rr;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Rr||(Rr={}));const Dp="popstate";function Qw(e){e===void 0&&(e={});function t(r,i){let{pathname:s,search:o,hash:l}=r.location;return Gu("",{pathname:s,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:ry(i)}return Jw(t,n,null,e)}function ut(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Kd(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Zw(){return Math.random().toString(36).substr(2,8)}function Mp(e,t){return{usr:e.state,key:e.key,idx:t}}function Gu(e,t,n,r){return n===void 0&&(n=null),yo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?as(t):t,{state:n,key:t&&t.key||r||Zw()})}function ry(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function as(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Jw(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,l=Rr.Pop,a=null,c=h();c==null&&(c=0,o.replaceState(yo({},o.state,{idx:c}),""));function h(){return(o.state||{idx:null}).idx}function u(){l=Rr.Pop;let w=h(),_=w==null?null:w-c;c=w,a&&a({action:l,location:m.location,delta:_})}function d(w,_){l=Rr.Push;let v=Gu(m.location,w,_);c=h()+1;let y=Mp(v,c),E=m.createHref(v);try{o.pushState(y,"",E)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;i.location.assign(E)}s&&a&&a({action:l,location:m.location,delta:1})}function f(w,_){l=Rr.Replace;let v=Gu(m.location,w,_);c=h();let y=Mp(v,c),E=m.createHref(v);o.replaceState(y,"",E),s&&a&&a({action:l,location:m.location,delta:0})}function g(w){let _=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof w=="string"?w:ry(w);return v=v.replace(/ $/,"%20"),ut(_,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,_)}let m={get action(){return l},get location(){return e(i,o)},listen(w){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Dp,u),a=w,()=>{i.removeEventListener(Dp,u),a=null}},createHref(w){return t(i,w)},createURL:g,encodeLocation(w){let _=g(w);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:d,replace:f,go(w){return o.go(w)}};return m}var Ap;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ap||(Ap={}));function ex(e,t,n){return n===void 0&&(n="/"),tx(e,t,n)}function tx(e,t,n,r){let i=typeof t=="string"?as(t):t,s=oy(i.pathname||"/",n);if(s==null)return null;let o=iy(e);nx(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let c=px(s);l=hx(o[a],c)}return l}function iy(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");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(r),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(r.length));let c=ci([r,a.relativePath]),h=n.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+'".')),iy(s.children,t,h,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:cx(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 sy(s.path))i(s,o,a)}),t}function sy(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=sy(r.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 nx(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ux(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const rx=/^:[\w-]+$/,ix=3,sx=2,ox=1,lx=10,ax=-2,Bp=e=>e==="*";function cx(e,t){let n=e.split("/"),r=n.length;return n.some(Bp)&&(r+=ax),t&&(r+=sx),n.filter(i=>!Bp(i)).reduce((i,s)=>i+(rx.test(s)?ix:s===""?ox:lx),r)}function ux(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function hx(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let l=0;l<r.length;++l){let a=r[l],c=l===r.length-1,h=s==="/"?t:t.slice(s.length)||"/",u=dx({path:a.relativePath,caseSensitive:a.caseSensitive,end:c},h),d=a.route;if(!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:ci([s,u.pathname]),pathnameBase:yx(ci([s,u.pathnameBase])),route:d}),u.pathnameBase!=="/"&&(s=ci([s,u.pathnameBase]))}return o}function dx(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=fx(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:r.reduce((c,h,u)=>{let{paramName:d,isOptional:f}=h;if(d==="*"){let m=l[u]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[u];return f&&!g?c[d]=void 0:c[d]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function fx(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Kd(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 r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(r.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function px(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Kd(!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 oy(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const gx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mx=e=>gx.test(e);function _x(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?as(e):e,s;if(n)if(mx(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Kd(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=Np(n.substring(1),"/"):s=Np(n,t)}else s=t;return{pathname:s,search:Sx(r),hash:wx(i)}}function Np(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function bc(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function vx(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ly(e,t){let n=vx(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function ay(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=as(e):(i=yo({},e),ut(!i.pathname||!i.pathname.includes("?"),bc("?","pathname","search",i)),ut(!i.pathname||!i.pathname.includes("#"),bc("#","pathname","hash",i)),ut(!i.search||!i.search.includes("#"),bc("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=n;else{let u=t.length-1;if(!r&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),u-=1;i.pathname=d.join("/")}l=u>=0?t[u]:"/"}let a=_x(i,l),c=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(c||h)&&(a.pathname+="/"),a}const ci=e=>e.join("/").replace(/\/\/+/g,"/"),yx=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Sx=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wx=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function xx(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const cy=["post","put","patch","delete"];new Set(cy);const bx=["get",...cy];new Set(bx);/**
50
50
  * React Router v6.30.3
51
51
  *
52
52
  * Copyright (c) Remix Software Inc.
@@ -55,7 +55,7 @@ Error generating stack: `+s.message+`
55
55
  * LICENSE.md file in the root directory of this source tree.
56
56
  *
57
57
  * @license MIT
58
- */function ho(){return ho=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ho.apply(this,arguments)}const Bd=x.createContext(null),mx=x.createContext(null),bo=x.createContext(null),Ra=x.createContext(null),zr=x.createContext({outlet:null,matches:[],isDataRoute:!1}),Jv=x.createContext(null);function ko(){return x.useContext(Ra)!=null}function Co(){return ko()||it(!1),x.useContext(Ra).location}function ey(e){x.useContext(bo).static||x.useLayoutEffect(e)}function ts(){let{isDataRoute:e}=x.useContext(zr);return e?Ix():_x()}function _x(){ko()||it(!1);let e=x.useContext(Bd),{basename:t,future:n,navigator:r}=x.useContext(bo),{matches:i}=x.useContext(zr),{pathname:s}=Co(),o=JSON.stringify(Gv(i,n.v7_relativeSplatPath)),l=x.useRef(!1);return ey(()=>{l.current=!0}),x.useCallback(function(c,h){if(h===void 0&&(h={}),!l.current)return;if(typeof c=="number"){r.go(c);return}let u=Qv(c,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:ti([t,u.pathname])),(h.replace?r.replace:r.push)(u,h.state,h)},[t,r,o,s,e])}function ty(){let{matches:e}=x.useContext(zr),t=e[e.length-1];return t?t.params:{}}function vx(e,t){return yx(e,t)}function yx(e,t,n,r){ko()||it(!1);let{navigator:i}=x.useContext(bo),{matches:s}=x.useContext(zr),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let c=Co(),h;if(t){var u;let w=typeof t=="string"?es(t):t;a==="/"||(u=w.pathname)!=null&&u.startsWith(a)||it(!1),h=w}else h=c;let d=h.pathname||"/",f=d;if(a!=="/"){let w=a.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(w.length).join("/")}let g=Vw(e,{pathname:f}),m=kx(g&&g.map(w=>Object.assign({},w,{params:Object.assign({},l,w.params),pathname:ti([a,i.encodeLocation?i.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?a:ti([a,i.encodeLocation?i.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),s,n,r);return t&&m?x.createElement(Ra.Provider,{value:{location:ho({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:wr.Pop}},m):m}function Sx(){let e=Rx(),t=px(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:i},n):null,null)}const wx=x.createElement(Sx,null);class xx extends x.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,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?x.createElement(zr.Provider,{value:this.props.routeContext},x.createElement(Jv.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function bx(e){let{routeContext:t,match:n,children:r}=e,i=x.useContext(Bd);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(zr.Provider,{value:t},r)}function kx(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==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||it(!1),o=o.slice(0,Math.min(o.length,h+1))}let a=!1,c=-1;if(n&&r&&r.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:d,errors:f}=n,g=u.route.loader&&d[u.route.id]===void 0&&(!f||f[u.route.id]===void 0);if(u.route.lazy||g){a=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((h,u,d)=>{let f,g=!1,m=null,w=null;n&&(f=l&&u.route.id?l[u.route.id]:void 0,m=u.route.errorElement||wx,a&&(c<0&&d===0?(Lx("route-fallback"),g=!0,w=null):c===d&&(g=!0,w=u.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,d+1)),v=()=>{let y;return f?y=m:g?y=w:u.route.Component?y=x.createElement(u.route.Component,null):u.route.element?y=u.route.element:y=h,x.createElement(bx,{match:u,routeContext:{outlet:h,matches:_,isDataRoute:n!=null},children:y})};return n&&(u.route.ErrorBoundary||u.route.errorElement||d===0)?x.createElement(xx,{location:n.location,revalidation:n.revalidation,component:m,error:f,children:v(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):v()},null)}var ny=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ny||{}),ry=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}(ry||{});function Cx(e){let t=x.useContext(Bd);return t||it(!1),t}function Ex(e){let t=x.useContext(mx);return t||it(!1),t}function Tx(e){let t=x.useContext(zr);return t||it(!1),t}function iy(e){let t=Tx(),n=t.matches[t.matches.length-1];return n.route.id||it(!1),n.route.id}function Rx(){var e;let t=x.useContext(Jv),n=Ex(),r=iy();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Ix(){let{router:e}=Cx(ny.UseNavigateStable),t=iy(ry.UseNavigateStable),n=x.useRef(!1);return ey(()=>{n.current=!0}),x.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,ho({fromRouteId:t},s)))},[e,t])}const Ep={};function Lx(e,t,n){Ep[e]||(Ep[e]=!0)}function Px(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function yl(e){let{to:t,replace:n,state:r,relative:i}=e;ko()||it(!1);let{future:s,static:o}=x.useContext(bo),{matches:l}=x.useContext(zr),{pathname:a}=Co(),c=ts(),h=Qv(t,Gv(l,s.v7_relativeSplatPath),a,i==="path"),u=JSON.stringify(h);return x.useEffect(()=>c(JSON.parse(u),{replace:n,state:r,relative:i}),[c,u,i,n,r]),null}function Ur(e){it(!1)}function Dx(e){let{basename:t="/",children:n=null,location:r,navigationType:i=wr.Pop,navigator:s,static:o=!1,future:l}=e;ko()&&it(!1);let a=t.replace(/^\/*/,"/"),c=x.useMemo(()=>({basename:a,navigator:s,static:o,future:ho({v7_relativeSplatPath:!1},l)}),[a,l,s,o]);typeof r=="string"&&(r=es(r));let{pathname:h="/",search:u="",hash:d="",state:f=null,key:g="default"}=r,m=x.useMemo(()=>{let w=Xv(h,a);return w==null?null:{location:{pathname:w,search:u,hash:d,state:f,key:g},navigationType:i}},[a,h,u,d,f,g,i]);return m==null?null:x.createElement(bo.Provider,{value:c},x.createElement(Ra.Provider,{children:n,value:m}))}function Mx(e){let{children:t,location:n}=e;return vx(Fu(t),n)}new Promise(()=>{});function Fu(e,t){t===void 0&&(t=[]);let n=[];return x.Children.forEach(e,(r,i)=>{if(!x.isValidElement(r))return;let s=[...t,i];if(r.type===x.Fragment){n.push.apply(n,Fu(r.props.children,s));return}r.type!==Ur&&it(!1),!r.props.index||!r.props.children||it(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Fu(r.props.children,s)),n.push(o)}),n}/**
58
+ */function So(){return So=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},So.apply(this,arguments)}const Vd=x.createContext(null),kx=x.createContext(null),Lo=x.createContext(null),ja=x.createContext(null),Ur=x.createContext({outlet:null,matches:[],isDataRoute:!1}),uy=x.createContext(null);function Do(){return x.useContext(ja)!=null}function Mo(){return Do()||ut(!1),x.useContext(ja).location}function hy(e){x.useContext(Lo).static||x.useLayoutEffect(e)}function cs(){let{isDataRoute:e}=x.useContext(Ur);return e?zx():Cx()}function Cx(){Do()||ut(!1);let e=x.useContext(Vd),{basename:t,future:n,navigator:r}=x.useContext(Lo),{matches:i}=x.useContext(Ur),{pathname:s}=Mo(),o=JSON.stringify(ly(i,n.v7_relativeSplatPath)),l=x.useRef(!1);return hy(()=>{l.current=!0}),x.useCallback(function(c,h){if(h===void 0&&(h={}),!l.current)return;if(typeof c=="number"){r.go(c);return}let u=ay(c,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:ci([t,u.pathname])),(h.replace?r.replace:r.push)(u,h.state,h)},[t,r,o,s,e])}function dy(){let{matches:e}=x.useContext(Ur),t=e[e.length-1];return t?t.params:{}}function Ex(e,t){return Tx(e,t)}function Tx(e,t,n,r){Do()||ut(!1);let{navigator:i}=x.useContext(Lo),{matches:s}=x.useContext(Ur),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let c=Mo(),h;if(t){var u;let w=typeof t=="string"?as(t):t;a==="/"||(u=w.pathname)!=null&&u.startsWith(a)||ut(!1),h=w}else h=c;let d=h.pathname||"/",f=d;if(a!=="/"){let w=a.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(w.length).join("/")}let g=ex(e,{pathname:f}),m=Dx(g&&g.map(w=>Object.assign({},w,{params:Object.assign({},l,w.params),pathname:ci([a,i.encodeLocation?i.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?a:ci([a,i.encodeLocation?i.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),s,n,r);return t&&m?x.createElement(ja.Provider,{value:{location:So({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:Rr.Pop}},m):m}function Rx(){let e=Nx(),t=xx(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:i},n):null,null)}const Ix=x.createElement(Rx,null);class Px extends x.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,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?x.createElement(Ur.Provider,{value:this.props.routeContext},x.createElement(uy.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Lx(e){let{routeContext:t,match:n,children:r}=e,i=x.useContext(Vd);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(Ur.Provider,{value:t},r)}function Dx(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==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(n&&r&&r.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:d,errors:f}=n,g=u.route.loader&&d[u.route.id]===void 0&&(!f||f[u.route.id]===void 0);if(u.route.lazy||g){a=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((h,u,d)=>{let f,g=!1,m=null,w=null;n&&(f=l&&u.route.id?l[u.route.id]:void 0,m=u.route.errorElement||Ix,a&&(c<0&&d===0?(Ox("route-fallback"),g=!0,w=null):c===d&&(g=!0,w=u.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,d+1)),v=()=>{let y;return f?y=m:g?y=w:u.route.Component?y=x.createElement(u.route.Component,null):u.route.element?y=u.route.element:y=h,x.createElement(Lx,{match:u,routeContext:{outlet:h,matches:_,isDataRoute:n!=null},children:y})};return n&&(u.route.ErrorBoundary||u.route.errorElement||d===0)?x.createElement(Px,{location:n.location,revalidation:n.revalidation,component:m,error:f,children:v(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):v()},null)}var fy=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(fy||{}),py=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}(py||{});function Mx(e){let t=x.useContext(Vd);return t||ut(!1),t}function Ax(e){let t=x.useContext(kx);return t||ut(!1),t}function Bx(e){let t=x.useContext(Ur);return t||ut(!1),t}function gy(e){let t=Bx(),n=t.matches[t.matches.length-1];return n.route.id||ut(!1),n.route.id}function Nx(){var e;let t=x.useContext(uy),n=Ax(),r=gy();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function zx(){let{router:e}=Mx(fy.UseNavigateStable),t=gy(py.UseNavigateStable),n=x.useRef(!1);return hy(()=>{n.current=!0}),x.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,So({fromRouteId:t},s)))},[e,t])}const zp={};function Ox(e,t,n){zp[e]||(zp[e]=!0)}function jx(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Pl(e){let{to:t,replace:n,state:r,relative:i}=e;Do()||ut(!1);let{future:s,static:o}=x.useContext(Lo),{matches:l}=x.useContext(Ur),{pathname:a}=Mo(),c=cs(),h=ay(t,ly(l,s.v7_relativeSplatPath),a,i==="path"),u=JSON.stringify(h);return x.useEffect(()=>c(JSON.parse(u),{replace:n,state:r,relative:i}),[c,u,i,n,r]),null}function Zr(e){ut(!1)}function Fx(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Rr.Pop,navigator:s,static:o=!1,future:l}=e;Do()&&ut(!1);let a=t.replace(/^\/*/,"/"),c=x.useMemo(()=>({basename:a,navigator:s,static:o,future:So({v7_relativeSplatPath:!1},l)}),[a,l,s,o]);typeof r=="string"&&(r=as(r));let{pathname:h="/",search:u="",hash:d="",state:f=null,key:g="default"}=r,m=x.useMemo(()=>{let w=oy(h,a);return w==null?null:{location:{pathname:w,search:u,hash:d,state:f,key:g},navigationType:i}},[a,h,u,d,f,g,i]);return m==null?null:x.createElement(Lo.Provider,{value:c},x.createElement(ja.Provider,{children:n,value:m}))}function $x(e){let{children:t,location:n}=e;return Ex(Qu(t),n)}new Promise(()=>{});function Qu(e,t){t===void 0&&(t=[]);let n=[];return x.Children.forEach(e,(r,i)=>{if(!x.isValidElement(r))return;let s=[...t,i];if(r.type===x.Fragment){n.push.apply(n,Qu(r.props.children,s));return}r.type!==Zr&&ut(!1),!r.props.index||!r.props.children||ut(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Qu(r.props.children,s)),n.push(o)}),n}/**
59
59
  * React Router DOM v6.30.3
60
60
  *
61
61
  * Copyright (c) Remix Software Inc.
@@ -64,44 +64,44 @@ Error generating stack: `+s.message+`
64
64
  * LICENSE.md file in the root directory of this source tree.
65
65
  *
66
66
  * @license MIT
67
- */function $u(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function Ax(e,t){let n=$u(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const Bx="6";try{window.__reactRouterVersion=Bx}catch{}const Nx="startTransition",Tp=P1[Nx];function zx(e){let{basename:t,children:n,future:r,window:i}=e,s=x.useRef();s.current==null&&(s.current=Hw({window:i,v5Compat:!0}));let o=s.current,[l,a]=x.useState({action:o.action,location:o.location}),{v7_startTransition:c}=r||{},h=x.useCallback(u=>{c&&Tp?Tp(()=>a(u)):a(u)},[a,c]);return x.useLayoutEffect(()=>o.listen(h),[o,h]),x.useEffect(()=>Px(r),[r]),x.createElement(Dx,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}var Rp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Rp||(Rp={}));var Ip;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Ip||(Ip={}));function Ox(e){let t=x.useRef($u(e)),n=x.useRef(!1),r=Co(),i=x.useMemo(()=>Ax(r.search,n.current?null:t.current),[r.search]),s=ts(),o=x.useCallback((l,a)=>{const c=$u(typeof l=="function"?l(i):l);n.current=!0,s("?"+c,a)},[s,i]);return[i,o]}const sy=x.createContext({ides:[],updateIdeChats:()=>{},screenshotMap:{},setScreenshotMap:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{}}),oy=x.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function jx(e,t){var o,l,a,c;const n=Date.now();if(t.length===0)return e.map(h=>({...h,_lastUpdate:n}));const r=new Map;for(const h of t)r.set(h.id,h);for(const h of e){const u=r.get(h.id);if(!u){r.set(h.id,{...h,_lastUpdate:n});continue}const d=h.timestamp||n,f=u._lastUpdate||u.timestamp||0;if(d>=f){const g=(o=h.chats)!=null&&o.length?h.chats:u.chats;r.set(h.id,{...u,...h,chats:g,_lastUpdate:n})}else(l=h.chats)!=null&&l.length&&!((a=u.chats)!=null&&a.length)&&r.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 r){const d=u.daemonId||h.split(":")[0];if(!s.has(d))continue;const f=n-(u._lastUpdate||u.timestamp||0);(h.includes(":cli:")&&!i.has(h)&&f>1e4||h.includes(":acp:")&&!i.has(h)&&f>1e4||h.includes(":ide:")&&!i.has(h)&&f>3e4)&&r.delete(h)}for(const[h,u]of r)n-(u._lastUpdate||u.timestamp||0)>3e5&&u.status!=="online"&&r.delete(h);return Array.from(r.values())}function Fx({children:e}){const[t,n]=x.useState([]),[r,i]=x.useState({}),[s,o]=x.useState(!1),[l,a]=x.useState([]),c=x.useCallback((u,d)=>{n(f=>f.map(g=>g.id===u?{...g,chats:d}:g))},[]),h={injectEntries:u=>{n(d=>d.length===0?u:jx(u,d))},markLoaded:()=>o(!0),getIdes:()=>t};return p.jsx(oy.Provider,{value:h,children:p.jsx(sy.Provider,{value:{ides:t,updateIdeChats:c,screenshotMap:r,setScreenshotMap:i,initialLoaded:s,toasts:l,setToasts:a},children:e})})}function ly(){return x.useContext(sy)}function Lp(){return x.useContext(oy)}function $x(e){const{baseUrl:t,getToken:n,onUnauthorized:r}=e;async function i(s,o={}){const l={"Content-Type":"application/json",...o.headers||{}},a=n==null?void 0:n();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 r==null||r(),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 Wx=$x({baseUrl:"http://localhost:3847"});x.createContext(Wx);const Hx={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},ay=x.createContext(Hx);function Ux({value:e,children:t}){return p.jsx(ay.Provider,{value:e,children:t})}function fi(){return x.useContext(ay)}function Kx(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Vx=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qx=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Yx={};function Pp(e,t){return(Yx.jsx?qx:Vx).test(e)}const Xx=/[ \t\n\f\r]/g;function Gx(e){return typeof e=="object"?e.type==="text"?Dp(e.value):!1:Dp(e)}function Dp(e){return e.replace(Xx,"")===""}class Eo{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Eo.prototype.normal={};Eo.prototype.property={};Eo.prototype.space=void 0;function cy(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Eo(n,r,t)}function Wu(e){return e.toLowerCase()}class Kt{constructor(t,n){this.attribute=n,this.property=t}}Kt.prototype.attribute="";Kt.prototype.booleanish=!1;Kt.prototype.boolean=!1;Kt.prototype.commaOrSpaceSeparated=!1;Kt.prototype.commaSeparated=!1;Kt.prototype.defined=!1;Kt.prototype.mustUseProperty=!1;Kt.prototype.number=!1;Kt.prototype.overloadedBoolean=!1;Kt.prototype.property="";Kt.prototype.spaceSeparated=!1;Kt.prototype.space=void 0;let Qx=0;const we=pi(),et=pi(),Hu=pi(),re=pi(),Be=pi(),$i=pi(),Yt=pi();function pi(){return 2**++Qx}const Uu=Object.freeze(Object.defineProperty({__proto__:null,boolean:we,booleanish:et,commaOrSpaceSeparated:Yt,commaSeparated:$i,number:re,overloadedBoolean:Hu,spaceSeparated:Be},Symbol.toStringTag,{value:"Module"})),fc=Object.keys(Uu);class Nd extends Kt{constructor(t,n,r,i){let s=-1;if(super(t,n),Mp(this,"space",i),typeof r=="number")for(;++s<fc.length;){const o=fc[s];Mp(this,fc[s],(r&Uu[o])===Uu[o])}}}Nd.prototype.defined=!0;function Mp(e,t,n){n&&(e[t]=n)}function ns(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Nd(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Wu(r)]=r,n[Wu(s.attribute)]=r}return new Eo(t,n,e.space)}const uy=ns({properties:{ariaActiveDescendant:null,ariaAtomic:et,ariaAutoComplete:null,ariaBusy:et,ariaChecked:et,ariaColCount:re,ariaColIndex:re,ariaColSpan:re,ariaControls:Be,ariaCurrent:null,ariaDescribedBy:Be,ariaDetails:null,ariaDisabled:et,ariaDropEffect:Be,ariaErrorMessage:null,ariaExpanded:et,ariaFlowTo:Be,ariaGrabbed:et,ariaHasPopup:null,ariaHidden:et,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Be,ariaLevel:re,ariaLive:null,ariaModal:et,ariaMultiLine:et,ariaMultiSelectable:et,ariaOrientation:null,ariaOwns:Be,ariaPlaceholder:null,ariaPosInSet:re,ariaPressed:et,ariaReadOnly:et,ariaRelevant:null,ariaRequired:et,ariaRoleDescription:Be,ariaRowCount:re,ariaRowIndex:re,ariaRowSpan:re,ariaSelected:et,ariaSetSize:re,ariaSort:null,ariaValueMax:re,ariaValueMin:re,ariaValueNow:re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function hy(e,t){return t in e?e[t]:t}function dy(e,t){return hy(e,t.toLowerCase())}const Zx=ns({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$i,acceptCharset:Be,accessKey:Be,action:null,allow:null,allowFullScreen:we,allowPaymentRequest:we,allowUserMedia:we,alt:null,as:null,async:we,autoCapitalize:null,autoComplete:Be,autoFocus:we,autoPlay:we,blocking:Be,capture:null,charSet:null,checked:we,cite:null,className:Be,cols:re,colSpan:null,content:null,contentEditable:et,controls:we,controlsList:Be,coords:re|$i,crossOrigin:null,data:null,dateTime:null,decoding:null,default:we,defer:we,dir:null,dirName:null,disabled:we,download:Hu,draggable:et,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:we,formTarget:null,headers:Be,height:re,hidden:Hu,high:re,href:null,hrefLang:null,htmlFor:Be,httpEquiv:Be,id:null,imageSizes:null,imageSrcSet:null,inert:we,inputMode:null,integrity:null,is:null,isMap:we,itemId:null,itemProp:Be,itemRef:Be,itemScope:we,itemType:Be,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:we,low:re,manifest:null,max:null,maxLength:re,media:null,method:null,min:null,minLength:re,multiple:we,muted:we,name:null,nonce:null,noModule:we,noValidate:we,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:we,optimum:re,pattern:null,ping:Be,placeholder:null,playsInline:we,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:we,referrerPolicy:null,rel:Be,required:we,reversed:we,rows:re,rowSpan:re,sandbox:Be,scope:null,scoped:we,seamless:we,selected:we,shadowRootClonable:we,shadowRootDelegatesFocus:we,shadowRootMode:null,shape:null,size:re,sizes:null,slot:null,span:re,spellCheck:et,src:null,srcDoc:null,srcLang:null,srcSet:null,start:re,step:null,style:null,tabIndex:re,target:null,title:null,translate:null,type:null,typeMustMatch:we,useMap:null,value:et,width:re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Be,axis:null,background:null,bgColor:null,border:re,borderColor:null,bottomMargin:re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:we,declare:we,event:null,face:null,frame:null,frameBorder:null,hSpace:re,leftMargin:re,link:null,longDesc:null,lowSrc:null,marginHeight:re,marginWidth:re,noResize:we,noHref:we,noShade:we,noWrap:we,object:null,profile:null,prompt:null,rev:null,rightMargin:re,rules:null,scheme:null,scrolling:et,standby:null,summary:null,text:null,topMargin:re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:we,disableRemotePlayback:we,prefix:null,property:null,results:re,security:null,unselectable:null},space:"html",transform:dy}),Jx=ns({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:Yt,accentHeight:re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:re,amplitude:re,arabicForm:null,ascent:re,attributeName:null,attributeType:null,azimuth:re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:re,by:null,calcMode:null,capHeight:re,className:Be,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:re,diffuseConstant:re,direction:null,display:null,dur:null,divisor:re,dominantBaseline:null,download:we,dx:null,dy:null,edgeMode:null,editable:null,elevation:re,enableBackground:null,end:null,event:null,exponent:re,externalResourcesRequired:null,fill:null,fillOpacity:re,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:$i,g2:$i,glyphName:$i,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:re,horizOriginX:re,horizOriginY:re,id:null,ideographic:re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:re,k:re,k1:re,k2:re,k3:re,k4:re,kernelMatrix:Yt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:re,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:re,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:re,overlineThickness:re,paintOrder:null,panose1:null,path:null,pathLength:re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Be,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:re,pointsAtY:re,pointsAtZ:re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yt,rev:Yt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yt,requiredFeatures:Yt,requiredFonts:Yt,requiredFormats:Yt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:re,specularExponent:re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:re,strikethroughThickness:re,string:null,stroke:null,strokeDashArray:Yt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:re,strokeOpacity:re,strokeWidth:null,style:null,surfaceScale:re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yt,tabIndex:re,tableValues:null,target:null,targetX:re,targetY:re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:re,underlineThickness:re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:re,values:null,vAlphabetic:re,vMathematical:re,vectorEffect:null,vHanging:re,vIdeographic:re,version:null,vertAdvY:re,vertOriginX:re,vertOriginY:re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:hy}),fy=ns({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()}}),py=ns({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:dy}),gy=ns({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),eb={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"},tb=/[A-Z]/g,Ap=/-[a-z]/g,nb=/^data[-\w.:]+$/i;function rb(e,t){const n=Wu(t);let r=t,i=Kt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&nb.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ap,sb);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ap.test(s)){let o=s.replace(tb,ib);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Nd}return new i(r,t)}function ib(e){return"-"+e.toLowerCase()}function sb(e){return e.charAt(1).toUpperCase()}const ob=cy([uy,Zx,fy,py,gy],"html"),zd=cy([uy,Jx,fy,py,gy],"svg");function lb(e){return e.join(" ").trim()}var Od={},Bp=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ab=/\n/g,cb=/^\s*/,ub=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,hb=/^:\s*/,db=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,fb=/^[;\s]*/,pb=/^\s+|\s+$/g,gb=`
68
- `,Np="/",zp="*",Yr="",mb="comment",_b="declaration";function vb(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(g){var m=g.match(ab);m&&(n+=m.length);var w=g.lastIndexOf(gb);r=~w?g.length-w:r+g.length}function s(){var g={line:n,column:r};return function(m){return m.position=new o(g),c(),m}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(g){var m=new Error(t.source+":"+n+":"+r+": "+g);if(m.reason=g,m.filename=t.source,m.line=n,m.column=r,m.source=e,!t.silent)throw m}function a(g){var m=g.exec(e);if(m){var w=m[0];return i(w),e=e.slice(w.length),m}}function c(){a(cb)}function h(g){var m;for(g=g||[];m=u();)m!==!1&&g.push(m);return g}function u(){var g=s();if(!(Np!=e.charAt(0)||zp!=e.charAt(1))){for(var m=2;Yr!=e.charAt(m)&&(zp!=e.charAt(m)||Np!=e.charAt(m+1));)++m;if(m+=2,Yr===e.charAt(m-1))return l("End of comment missing");var w=e.slice(2,m-2);return r+=2,i(w),e=e.slice(m),r+=2,g({type:mb,comment:w})}}function d(){var g=s(),m=a(ub);if(m){if(u(),!a(hb))return l("property missing ':'");var w=a(db),_=g({type:_b,property:Op(m[0].replace(Bp,Yr)),value:w?Op(w[0].replace(Bp,Yr)):Yr});return a(fb),_}}function f(){var g=[];h(g);for(var m;m=d();)m!==!1&&(g.push(m),h(g));return g}return c(),f()}function Op(e){return e?e.replace(pb,Yr):Yr}var yb=vb,Sb=Ll&&Ll.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Od,"__esModule",{value:!0});Od.default=xb;const wb=Sb(yb);function xb(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,wb.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(n=n||{},n[o]=l)}),n}var Ia={};Object.defineProperty(Ia,"__esModule",{value:!0});Ia.camelCase=void 0;var bb=/^--[a-zA-Z0-9_-]+$/,kb=/-([a-z])/g,Cb=/^[^-]+$/,Eb=/^-(webkit|moz|ms|o|khtml)-/,Tb=/^-(ms)-/,Rb=function(e){return!e||Cb.test(e)||bb.test(e)},Ib=function(e,t){return t.toUpperCase()},jp=function(e,t){return"".concat(t,"-")},Lb=function(e,t){return t===void 0&&(t={}),Rb(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Tb,jp):e=e.replace(Eb,jp),e.replace(kb,Ib))};Ia.camelCase=Lb;var Pb=Ll&&Ll.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Db=Pb(Od),Mb=Ia;function Ku(e,t){var n={};return!e||typeof e!="string"||(0,Db.default)(e,function(r,i){r&&i&&(n[(0,Mb.camelCase)(r,t)]=i)}),n}Ku.default=Ku;var Ab=Ku;const Bb=jh(Ab),my=_y("end"),jd=_y("start");function _y(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Nb(e){const t=jd(e),n=my(e);if(t&&n)return{start:t,end:n}}function Hs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Fp(e.position):"start"in e||"end"in e?Fp(e):"line"in e||"column"in e?Vu(e):""}function Vu(e){return $p(e&&e.line)+":"+$p(e&&e.column)}function Fp(e){return Vu(e&&e.start)+"-"+Vu(e&&e.end)}function $p(e){return e&&typeof e=="number"?e:1}class It extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const a=r.indexOf(":");a===-1?s.ruleId=r:(s.source=r.slice(0,a),s.ruleId=r.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=Hs(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}}It.prototype.file="";It.prototype.name="";It.prototype.reason="";It.prototype.message="";It.prototype.stack="";It.prototype.column=void 0;It.prototype.line=void 0;It.prototype.ancestors=void 0;It.prototype.cause=void 0;It.prototype.fatal=void 0;It.prototype.place=void 0;It.prototype.ruleId=void 0;It.prototype.source=void 0;const Fd={}.hasOwnProperty,zb=new Map,Ob=/[A-Z]/g,jb=new Set(["table","tbody","thead","tfoot","tr"]),Fb=new Set(["td","th"]),vy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function $b(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Xb(n,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");r=Yb(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?zd:ob,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=yy(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function yy(e,t,n){if(t.type==="element")return Wb(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Hb(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Kb(e,t,n);if(t.type==="mdxjsEsm")return Ub(e,t);if(t.type==="root")return Vb(e,t,n);if(t.type==="text")return qb(e,t)}function Wb(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=zd,e.schema=i),e.ancestors.push(t);const s=wy(e,t.tagName,!1),o=Gb(e,t);let l=Wd(e,t);return jb.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!Gx(a):!0})),Sy(e,o,s,t),$d(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Hb(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}fo(e,t.position)}function Ub(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);fo(e,t.position)}function Kb(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=zd,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:wy(e,t.name,!0),o=Qb(e,t),l=Wd(e,t);return Sy(e,o,s,t),$d(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Vb(e,t,n){const r={};return $d(r,Wd(e,t)),e.create(t,e.Fragment,r,n)}function qb(e,t){return t.value}function Sy(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $d(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Yb(e,t,n){return r;function r(i,s,o,l){const c=Array.isArray(o.children)?n:t;return l?c(s,o,l):c(s,o)}}function Xb(e,t){return n;function n(r,i,s,o){const l=Array.isArray(s.children),a=jd(r);return t(i,s,o,l,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function Gb(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Fd.call(t.properties,i)){const s=Zb(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Fb.has(t.tagName)?r=l:n[o]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Qb(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else fo(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else fo(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Wd(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:zb;for(;++r<t.children.length;){const s=t.children[r];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=yy(e,s,o);l!==void 0&&n.push(l)}return n}function Zb(e,t,n){const r=rb(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Kx(n):lb(n)),r.property==="style"){let i=typeof n=="object"?n:Jb(e,String(n));return e.stylePropertyNameCase==="css"&&(i=ek(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?eb[r.property]||r.property:r.attribute,n]}}function Jb(e,t){try{return Bb(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new It("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=vy+"#cannot-parse-style-attribute",i}}function wy(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=Pp(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}r=o}else r=Pp(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Fd.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);fo(e)}function fo(e,t){const n=new It("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=vy+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ek(e){const t={};let n;for(n in e)Fd.call(e,n)&&(t[tk(n)]=e[n]);return t}function tk(e){let t=e.replace(Ob,nk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function nk(e){return"-"+e.toLowerCase()}const pc={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"]},rk={};function Hd(e,t){const n=rk,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return xy(e,r,i)}function xy(e,t,n){if(ik(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Wp(e.children,t,n)}return Array.isArray(e)?Wp(e,t,n):""}function Wp(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=xy(e[i],t,n);return r.join("")}function ik(e){return!!(e&&typeof e=="object")}const Hp=document.createElement("i");function Ud(e){const t="&"+e+";";Hp.innerHTML=t;const n=Hp.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Jt(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function hn(e,t){return e.length>0?(Jt(e,e.length,0,t),e):t}const Up={}.hasOwnProperty;function by(e){const t={};let n=-1;for(;++n<e.length;)sk(t,e[n]);return t}function sk(e,t){let n;for(n in t){const i=(Up.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){Up.call(i,o)||(i[o]=[]);const l=s[o];ok(i[o],Array.isArray(l)?l:l?[l]:[])}}}function ok(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Jt(e,0,0,r)}function ky(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function En(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dt=Or(/[A-Za-z]/),Tt=Or(/[\dA-Za-z]/),lk=Or(/[#-'*+\--9=?A-Z^-~]/);function ta(e){return e!==null&&(e<32||e===127)}const qu=Or(/\d/),ak=Or(/[\dA-Fa-f]/),ck=Or(/[!-/:-@[-`{-~]/);function me(e){return e!==null&&e<-2}function Me(e){return e!==null&&(e<0||e===32)}function Ce(e){return e===-2||e===-1||e===32}const La=Or(new RegExp("\\p{P}|\\p{S}","u")),ai=Or(/\s/);function Or(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function rs(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&Tt(e.charCodeAt(n+1))&&Tt(e.charCodeAt(n+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(n+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(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Re(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return Ce(a)?(e.enter(n),l(a)):t(a)}function l(a){return Ce(a)&&s++<i?(e.consume(a),l):(e.exit(n),t(a))}}const uk={tokenize:hk};function hk(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Re(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const a=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=a),n=a,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return me(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const dk={tokenize:fk},Kp={tokenize:pk};function fk(e){const t=this,n=[];let r=0,i,s,o;return l;function l(y){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,a,c)(y)}return c(y)}function a(y){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const E=t.events.length;let R=E,C;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){C=t.events[R][1].end;break}_(r);let M=E;for(;M<t.events.length;)t.events[M][1].end={...C},M++;return Jt(t.events,R+1,0,t.events.slice(E)),t.events.length=M,c(y)}return l(y)}function c(y){if(r===n.length){if(!i)return d(y);if(i.currentConstruct&&i.currentConstruct.concrete)return g(y);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Kp,h,u)(y)}function h(y){return i&&v(),_(r),d(y)}function u(y){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(y)}function d(y){return t.containerState={},e.attempt(Kp,f,g)(y)}function f(y){return r++,n.push([t.currentConstruct,t.containerState]),d(y)}function g(y){if(y===null){i&&v(),_(0),e.consume(y);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),m(y)}function m(y){if(y===null){w(e.exit("chunkFlow"),!0),_(0),e.consume(y);return}return me(y)?(e.consume(y),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(y),m)}function w(y,E){const R=t.sliceStream(y);if(E&&R.push(null),y.previous=s,s&&(s.next=y),s=y,i.defineSkip(y.start),i.write(R),t.parser.lazy[y.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 M=t.events.length;let $=M,G,T;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(G){T=t.events[$][1].end;break}G=!0}for(_(r),C=M;C<t.events.length;)t.events[C][1].end={...T},C++;Jt(t.events,$+1,0,t.events.slice(M)),t.events.length=C}}function _(y){let E=n.length;for(;E-- >y;){const R=n[E];t.containerState=R[1],R[0].exit.call(t,e)}n.length=y}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function pk(e,t,n){return Re(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xi(e){if(e===null||Me(e)||ai(e))return 1;if(La(e))return 2}function Pa(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Yu={name:"attention",resolveAll:gk,tokenize:mk};function gk(e,t){let n=-1,r,i,s,o,l,a,c,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;a=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const u={...e[r][1].end},d={...e[n][1].start};Vp(u,-a),Vp(d,a),o={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...e[r][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:d},s={type:a>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:a>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=hn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=hn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=hn(c,Pa(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=hn(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,c=hn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,Jt(e,r-1,n-r+3,c),n=r+c.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function mk(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Xi(r);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=Xi(a),u=!h||h===2&&i||n.includes(a),d=!i||i===2&&h||n.includes(r);return c._open=!!(s===42?u:u&&(i||!d)),c._close=!!(s===42?d:d&&(h||!u)),t(a)}}function Vp(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const _k={name:"autolink",tokenize:vk};function vk(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return Dt(f)?(e.consume(f),o):f===64?n(f):c(f)}function o(f){return f===43||f===45||f===46||Tt(f)?(r=1,l(f)):c(f)}function l(f){return f===58?(e.consume(f),r=0,a):(f===43||f===45||f===46||Tt(f))&&r++<32?(e.consume(f),l):(r=0,c(f))}function a(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||ta(f)?n(f):(e.consume(f),a)}function c(f){return f===64?(e.consume(f),h):lk(f)?(e.consume(f),c):n(f)}function h(f){return Tt(f)?u(f):n(f)}function u(f){return f===46?(e.consume(f),r=0,h):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):d(f)}function d(f){if((f===45||Tt(f))&&r++<63){const g=f===45?d:u;return e.consume(f),g}return n(f)}}const To={partial:!0,tokenize:yk};function yk(e,t,n){return r;function r(s){return Ce(s)?Re(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||me(s)?t(s):n(s)}}const Cy={continuation:{tokenize:wk},exit:xk,name:"blockQuote",tokenize:Sk};function Sk(e,t,n){const r=this;return i;function i(o){if(o===62){const l=r.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 n(o)}function s(o){return Ce(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function wk(e,t,n){const r=this;return i;function i(o){return Ce(o)?Re(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(Cy,t,n)(o)}}function xk(e){e.exit("blockQuote")}const Ey={name:"characterEscape",tokenize:bk};function bk(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return ck(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Ty={name:"characterReference",tokenize:kk};function kk(e,t,n){const r=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=Tt,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=ak,h):(e.enter("characterReferenceValue"),s=7,o=qu,h(u))}function h(u){if(u===59&&i){const d=e.exit("characterReferenceValue");return o===Tt&&!Ud(r.sliceSerialize(d))?n(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(u)&&i++<s?(e.consume(u),h):n(u)}}const qp={partial:!0,tokenize:Ek},Yp={concrete:!0,name:"codeFenced",tokenize:Ck};function Ck(e,t,n){const r=this,i={partial:!0,tokenize:R};let s=0,o=0,l;return a;function a(C){return c(C)}function c(C){const M=r.events[r.events.length-1];return s=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[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?n(C):(e.exit("codeFencedFenceSequence"),Ce(C)?Re(e,u,"whitespace")(C):u(C))}function u(C){return C===null||me(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(qp,m,E)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(C))}function d(C){return C===null||me(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(C)):Ce(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Re(e,f,"whitespace")(C)):C===96&&C===l?n(C):(e.consume(C),d)}function f(C){return C===null||me(C)?u(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||me(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(C)):C===96&&C===l?n(C):(e.consume(C),g)}function m(C){return e.attempt(i,E,w)(C)}function w(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),_}function _(C){return s>0&&Ce(C)?Re(e,v,"linePrefix",s+1)(C):v(C)}function v(C){return C===null||me(C)?e.check(qp,m,E)(C):(e.enter("codeFlowValue"),y(C))}function y(C){return C===null||me(C)?(e.exit("codeFlowValue"),v(C)):(e.consume(C),y)}function E(C){return e.exit("codeFenced"),t(C)}function R(C,M,$){let G=0;return T;function T(B){return C.enter("lineEnding"),C.consume(B),C.exit("lineEnding"),I}function I(B){return C.enter("codeFencedFence"),Ce(B)?Re(C,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):A(B)}function A(B){return B===l?(C.enter("codeFencedFenceSequence"),P(B)):$(B)}function P(B){return B===l?(G++,C.consume(B),P):G>=o?(C.exit("codeFencedFenceSequence"),Ce(B)?Re(C,U,"whitespace")(B):U(B)):$(B)}function U(B){return B===null||me(B)?(C.exit("codeFencedFence"),M(B)):$(B)}}}function Ek(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const gc={name:"codeIndented",tokenize:Rk},Tk={partial:!0,tokenize:Ik};function Rk(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Re(e,s,"linePrefix",5)(c)}function s(c){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?a(c):me(c)?e.attempt(Tk,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||me(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function Ik(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):me(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Re(e,s,"linePrefix",5)(o)}function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):me(o)?i(o):n(o)}}const Lk={name:"codeText",previous:Dk,resolve:Pk,tokenize:Mk};function Pk(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Dk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Mk(e,t,n){let r=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),r++,l):(e.exit("codeTextSequence"),a(u))}function a(u){return u===null?n(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),a):u===96?(s=e.enter("codeTextSequence"),i=0,h(u)):me(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||me(u)?(e.exit("codeTextData"),a(u)):(e.consume(u),c)}function h(u){return u===96?(e.consume(u),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(s.type="codeTextData",c(u))}}class Ak{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,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&gs(this.left,r),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),gs(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),gs(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 n=this.left.splice(t,Number.POSITIVE_INFINITY);gs(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);gs(this.left,n.reverse())}}}function gs(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Ry(e){const t={};let n=-1,r,i,s,o,l,a,c;const h=new Ak(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(a=r[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(r[0]==="enter")r[1].contentType&&(Object.assign(t,Bk(h,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,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&&(r[1].end={...h.get(i)[1].start},l=h.slice(i,n),l.unshift(r),h.splice(i,n-i+1,l))}}return Jt(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function Bk(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,a=[],c={};let h,u,d=-1,f=n,g=0,m=0;const w=[m];for(;f;){for(;e.get(++i)[1]!==f;);s.push(i),f._tokenizer||(h=r.sliceStream(f),f.next||h.push(null),u&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),u=f,f=f.next}for(f=n;++d<l.length;)l[d][0]==="exit"&&l[d-1][0]==="enter"&&l[d][1].type===l[d-1][1].type&&l[d][1].start.line!==l[d][1].end.line&&(m=d+1,w.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):w.pop(),d=w.length;d--;){const _=l.slice(w[d],w[d+1]),v=s.pop();a.push([v,v+_.length-1]),e.splice(v,2,_)}for(a.reverse(),d=-1;++d<a.length;)c[g+a[d][0]]=g+a[d][1],g+=a[d][1]-a[d][0]-1;return c}const Nk={resolve:Ok,tokenize:jk},zk={partial:!0,tokenize:Fk};function Ok(e){return Ry(e),e}function jk(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):me(l)?e.check(zk,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"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Fk(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Re(e,s,"linePrefix")}function s(o){if(o===null||me(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Iy(e,t,n,r,i,s,o,l,a){const c=a||Number.POSITIVE_INFINITY;let h=0;return u;function u(_){return _===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(_),e.exit(s),d):_===null||_===32||_===41||ta(_)?n(_):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),m(_))}function d(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(_))}function f(_){return _===62?(e.exit("chunkString"),e.exit(l),d(_)):_===null||_===60||me(_)?n(_):(e.consume(_),_===92?g:f)}function g(_){return _===60||_===62||_===92?(e.consume(_),f):f(_)}function m(_){return!h&&(_===null||_===41||Me(_))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(_)):h<c&&_===40?(e.consume(_),h++,m):_===41?(e.consume(_),h--,m):_===null||_===32||_===40||ta(_)?n(_):(e.consume(_),_===92?w:m)}function w(_){return _===40||_===41||_===92?(e.consume(_),m):m(_)}}function Ly(e,t,n,r,i,s){const o=this;let l=0,a;return c;function c(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(s),h}function h(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):me(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===null||f===91||f===93||me(f)||l++>999?(e.exit("chunkString"),h(f)):(e.consume(f),a||(a=!Ce(f)),f===92?d:u)}function d(f){return f===91||f===92||f===93?(e.consume(f),l++,u):u(f)}}function Py(e,t,n,r,i,s){let o;return l;function l(d){return d===34||d===39||d===40?(e.enter(r),e.enter(i),e.consume(d),e.exit(i),o=d===40?41:d,a):n(d)}function a(d){return d===o?(e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):(e.enter(s),c(d))}function c(d){return d===o?(e.exit(s),a(o)):d===null?n(d):me(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Re(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===o||d===null||me(d)?(e.exit("chunkString"),c(d)):(e.consume(d),d===92?u:h)}function u(d){return d===o||d===92?(e.consume(d),h):h(d)}}function Us(e,t){let n;return r;function r(i){return me(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ce(i)?Re(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const $k={name:"definition",tokenize:Hk},Wk={partial:!0,tokenize:Uk};function Hk(e,t,n){const r=this;let i;return s;function s(f){return e.enter("definition"),o(f)}function o(f){return Ly.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return i=En(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),a):n(f)}function a(f){return Me(f)?Us(e,c)(f):c(f)}function c(f){return Iy(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function h(f){return e.attempt(Wk,u,u)(f)}function u(f){return Ce(f)?Re(e,d,"whitespace")(f):d(f)}function d(f){return f===null||me(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function Uk(e,t,n){return r;function r(l){return Me(l)?Us(e,i)(l):n(l)}function i(l){return Py(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Ce(l)?Re(e,o,"whitespace")(l):o(l)}function o(l){return l===null||me(l)?t(l):n(l)}}const Kk={name:"hardBreakEscape",tokenize:Vk};function Vk(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return me(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const qk={name:"headingAtx",resolve:Yk,tokenize:Xk};function Yk(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Jt(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Xk(e,t,n){let r=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&&r++<6?(e.consume(h),o):h===null||Me(h)?(e.exit("atxHeadingSequence"),l(h)):n(h)}function l(h){return h===35?(e.enter("atxHeadingSequence"),a(h)):h===null||me(h)?(e.exit("atxHeading"),t(h)):Ce(h)?Re(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||Me(h)?(e.exit("atxHeadingText"),l(h)):(e.consume(h),c)}}const Gk=["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"],Xp=["pre","script","style","textarea"],Qk={concrete:!0,name:"htmlFlow",resolveTo:eC,tokenize:tC},Zk={partial:!0,tokenize:rC},Jk={partial:!0,tokenize:nC};function eC(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 tC(e,t,n){const r=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),d):k===47?(e.consume(k),s=!0,m):k===63?(e.consume(k),i=3,r.interrupt?t:S):Dt(k)?(e.consume(k),o=String.fromCharCode(k),w):n(k)}function d(k){return k===45?(e.consume(k),i=2,f):k===91?(e.consume(k),i=5,l=0,g):Dt(k)?(e.consume(k),i=4,r.interrupt?t:S):n(k)}function f(k){return k===45?(e.consume(k),r.interrupt?t:S):n(k)}function g(k){const ge="CDATA[";return k===ge.charCodeAt(l++)?(e.consume(k),l===ge.length?r.interrupt?t:A:g):n(k)}function m(k){return Dt(k)?(e.consume(k),o=String.fromCharCode(k),w):n(k)}function w(k){if(k===null||k===47||k===62||Me(k)){const ge=k===47,ie=o.toLowerCase();return!ge&&!s&&Xp.includes(ie)?(i=1,r.interrupt?t(k):A(k)):Gk.includes(o.toLowerCase())?(i=6,ge?(e.consume(k),_):r.interrupt?t(k):A(k)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):s?v(k):y(k))}return k===45||Tt(k)?(e.consume(k),o+=String.fromCharCode(k),w):n(k)}function _(k){return k===62?(e.consume(k),r.interrupt?t:A):n(k)}function v(k){return Ce(k)?(e.consume(k),v):T(k)}function y(k){return k===47?(e.consume(k),T):k===58||k===95||Dt(k)?(e.consume(k),E):Ce(k)?(e.consume(k),y):T(k)}function E(k){return k===45||k===46||k===58||k===95||Tt(k)?(e.consume(k),E):R(k)}function R(k){return k===61?(e.consume(k),C):Ce(k)?(e.consume(k),R):y(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),a=k,M):Ce(k)?(e.consume(k),C):$(k)}function M(k){return k===a?(e.consume(k),a=null,G):k===null||me(k)?n(k):(e.consume(k),M)}function $(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Me(k)?R(k):(e.consume(k),$)}function G(k){return k===47||k===62||Ce(k)?y(k):n(k)}function T(k){return k===62?(e.consume(k),I):n(k)}function I(k){return k===null||me(k)?A(k):Ce(k)?(e.consume(k),I):n(k)}function A(k){return k===45&&i===2?(e.consume(k),j):k===60&&i===1?(e.consume(k),H):k===62&&i===4?(e.consume(k),Q):k===63&&i===3?(e.consume(k),S):k===93&&i===5?(e.consume(k),W):me(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Zk,le,P)(k)):k===null||me(k)?(e.exit("htmlFlowData"),P(k)):(e.consume(k),A)}function P(k){return e.check(Jk,U,le)(k)}function U(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),B}function B(k){return k===null||me(k)?P(k):(e.enter("htmlFlowData"),A(k))}function j(k){return k===45?(e.consume(k),S):A(k)}function H(k){return k===47?(e.consume(k),o="",L):A(k)}function L(k){if(k===62){const ge=o.toLowerCase();return Xp.includes(ge)?(e.consume(k),Q):A(k)}return Dt(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),L):A(k)}function W(k){return k===93?(e.consume(k),S):A(k)}function S(k){return k===62?(e.consume(k),Q):k===45&&i===2?(e.consume(k),S):A(k)}function Q(k){return k===null||me(k)?(e.exit("htmlFlowData"),le(k)):(e.consume(k),Q)}function le(k){return e.exit("htmlFlow"),t(k)}}function nC(e,t,n){const r=this;return i;function i(o){return me(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function rC(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(To,t,n)}}const iC={name:"htmlText",tokenize:sC};function sC(e,t,n){const r=this;let i,s,o;return l;function l(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),a}function a(S){return S===33?(e.consume(S),c):S===47?(e.consume(S),R):S===63?(e.consume(S),y):Dt(S)?(e.consume(S),$):n(S)}function c(S){return S===45?(e.consume(S),h):S===91?(e.consume(S),s=0,g):Dt(S)?(e.consume(S),v):n(S)}function h(S){return S===45?(e.consume(S),f):n(S)}function u(S){return S===null?n(S):S===45?(e.consume(S),d):me(S)?(o=u,H(S)):(e.consume(S),u)}function d(S){return S===45?(e.consume(S),f):u(S)}function f(S){return S===62?j(S):S===45?d(S):u(S)}function g(S){const Q="CDATA[";return S===Q.charCodeAt(s++)?(e.consume(S),s===Q.length?m:g):n(S)}function m(S){return S===null?n(S):S===93?(e.consume(S),w):me(S)?(o=m,H(S)):(e.consume(S),m)}function w(S){return S===93?(e.consume(S),_):m(S)}function _(S){return S===62?j(S):S===93?(e.consume(S),_):m(S)}function v(S){return S===null||S===62?j(S):me(S)?(o=v,H(S)):(e.consume(S),v)}function y(S){return S===null?n(S):S===63?(e.consume(S),E):me(S)?(o=y,H(S)):(e.consume(S),y)}function E(S){return S===62?j(S):y(S)}function R(S){return Dt(S)?(e.consume(S),C):n(S)}function C(S){return S===45||Tt(S)?(e.consume(S),C):M(S)}function M(S){return me(S)?(o=M,H(S)):Ce(S)?(e.consume(S),M):j(S)}function $(S){return S===45||Tt(S)?(e.consume(S),$):S===47||S===62||Me(S)?G(S):n(S)}function G(S){return S===47?(e.consume(S),j):S===58||S===95||Dt(S)?(e.consume(S),T):me(S)?(o=G,H(S)):Ce(S)?(e.consume(S),G):j(S)}function T(S){return S===45||S===46||S===58||S===95||Tt(S)?(e.consume(S),T):I(S)}function I(S){return S===61?(e.consume(S),A):me(S)?(o=I,H(S)):Ce(S)?(e.consume(S),I):G(S)}function A(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),i=S,P):me(S)?(o=A,H(S)):Ce(S)?(e.consume(S),A):(e.consume(S),U)}function P(S){return S===i?(e.consume(S),i=void 0,B):S===null?n(S):me(S)?(o=P,H(S)):(e.consume(S),P)}function U(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||Me(S)?G(S):(e.consume(S),U)}function B(S){return S===47||S===62||Me(S)?G(S):n(S)}function j(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function H(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),L}function L(S){return Ce(S)?Re(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):W(S)}function W(S){return e.enter("htmlTextData"),o(S)}}const Kd={name:"labelEnd",resolveAll:cC,resolveTo:uC,tokenize:hC},oC={tokenize:dC},lC={tokenize:fC},aC={tokenize:pC};function cC(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Jt(e,0,e.length,n),e}function uC(e,t){let n=e.length,r=0,i,s,o,l;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);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+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",a,t],["enter",c,t]],l=hn(l,e.slice(s+1,s+r+3)),l=hn(l,[["enter",h,t]]),l=hn(l,Pa(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),l=hn(l,[["exit",h,t],e[o-2],e[o-1],["exit",c,t]]),l=hn(l,e.slice(o+1)),l=hn(l,[["exit",a,t]]),Jt(e,s,e.length,l),e}function hC(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return l;function l(d){return s?s._inactive?u(d):(o=r.parser.defined.includes(En(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelEnd"),a):n(d)}function a(d){return d===40?e.attempt(oC,h,o?h:u)(d):d===91?e.attempt(lC,h,o?c:u)(d):o?h(d):u(d)}function c(d){return e.attempt(aC,h,u)(d)}function h(d){return t(d)}function u(d){return s._balanced=!0,n(d)}}function dC(e,t,n){return r;function r(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),i}function i(u){return Me(u)?Us(e,s)(u):s(u)}function s(u){return u===41?h(u):Iy(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function o(u){return Me(u)?Us(e,a)(u):h(u)}function l(u){return n(u)}function a(u){return u===34||u===39||u===40?Py(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):h(u)}function c(u){return Me(u)?Us(e,h)(u):h(u)}function h(u){return u===41?(e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),e.exit("resource"),t):n(u)}}function fC(e,t,n){const r=this;return i;function i(l){return Ly.call(r,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return r.parser.defined.includes(En(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function pC(e,t,n){return r;function r(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):n(s)}}const gC={name:"labelStartImage",resolveAll:Kd.resolveAll,tokenize:mC};function mC(e,t,n){const r=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):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const _C={name:"labelStartLink",resolveAll:Kd.resolveAll,tokenize:vC};function vC(e,t,n){const r=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 r.parser.constructs?n(o):t(o)}}const mc={name:"lineEnding",tokenize:yC};function yC(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Re(e,t,"linePrefix")}}const Sl={name:"thematicBreak",tokenize:SC};function SC(e,t,n){let r=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)):r>=3&&(c===null||me(c))?(e.exit("thematicBreak"),t(c)):n(c)}function a(c){return c===i?(e.consume(c),r++,a):(e.exit("thematicBreakSequence"),Ce(c)?Re(e,l,"whitespace")(c):l(c))}}const jt={continuation:{tokenize:kC},exit:EC,name:"list",tokenize:bC},wC={partial:!0,tokenize:TC},xC={partial:!0,tokenize:CC};function bC(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(f){const g=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:qu(f)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Sl,n,c)(f):c(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(f)}return n(f)}function a(f){return qu(f)&&++o<10?(e.consume(f),a):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(To,r.interrupt?n:h,e.attempt(wC,d,u))}function h(f){return r.containerState.initialBlankLine=!0,s++,d(f)}function u(f){return Ce(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),d):n(f)}function d(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function kC(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(To,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Re(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!Ce(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xC,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Re(e,e.attempt(jt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function CC(e,t,n){const r=this;return Re(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function EC(e){e.exit(this.containerState.type)}function TC(e,t,n){const r=this;return Re(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ce(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Gp={name:"setextUnderline",resolveTo:RC,tokenize:IC};function RC(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][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[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function IC(e,t,n){const r=this;let i;return s;function s(c){let h=r.events.length,u;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){u=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||u)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),Ce(c)?Re(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||me(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const LC={tokenize:PC};function PC(e){const t=this,n=e.attempt(To,r,e.attempt(this.parser.constructs.flowInitial,i,Re(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Nk,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const DC={resolveAll:My()},MC=Dy("string"),AC=Dy("text");function Dy(e){return{resolveAll:My(e==="text"?BC:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,l);return o;function o(h){return c(h)?s(h):l(h)}function l(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),a}function a(h){return c(h)?(n.exit("data"),s(h)):(n.consume(h),a)}function c(h){if(h===null)return!0;const u=i[h];let d=-1;if(u)for(;++d<u.length;){const f=u[d];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function My(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function BC(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);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&&n===e.length&&(l=0),l){const c={type:n===e.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const NC={42:jt,43:jt,45:jt,48:jt,49:jt,50:jt,51:jt,52:jt,53:jt,54:jt,55:jt,56:jt,57:jt,62:Cy},zC={91:$k},OC={[-2]:gc,[-1]:gc,32:gc},jC={35:qk,42:Sl,45:[Gp,Sl],60:Qk,61:Gp,95:Sl,96:Yp,126:Yp},FC={38:Ty,92:Ey},$C={[-5]:mc,[-4]:mc,[-3]:mc,33:gC,38:Ty,42:Yu,60:[_k,iC],91:_C,92:[Kk,Ey],93:Kd,95:Yu,96:Lk},WC={null:[Yu,DC]},HC={null:[42,95]},UC={null:[]},KC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:HC,contentInitial:zC,disable:UC,document:NC,flow:jC,flowInitial:OC,insideSpan:WC,string:FC,text:$C},Symbol.toStringTag,{value:"Module"}));function VC(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],l=[];const a={attempt:M(R),check:M(C),consume:v,enter:y,exit:E,interrupt:M(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:e,previous:null,sliceSerialize:d,sliceStream:f,write:u};let h=t.tokenize.call(c,a);return t.resolveAll&&s.push(t),c;function u(I){return o=hn(o,I),w(),o[o.length-1]!==null?[]:($(t,0),c.events=Pa(s,c.events,c),c.events)}function d(I,A){return YC(f(I),A)}function f(I){return qC(o,I)}function g(){const{_bufferIndex:I,_index:A,line:P,column:U,offset:B}=r;return{_bufferIndex:I,_index:A,line:P,column:U,offset:B}}function m(I){i[I.line]=I.column,T()}function w(){let I;for(;r._index<o.length;){const A=o[r._index];if(typeof A=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<A.length;)_(A.charCodeAt(r._bufferIndex));else _(A)}}function _(I){h=h(I)}function v(I){me(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,T()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=I}function y(I,A){const P=A||{};return P.type=I,P.start=g(),c.events.push(["enter",P,c]),l.push(P),P}function E(I){const A=l.pop();return A.end=g(),c.events.push(["exit",A,c]),A}function R(I,A){$(I,A.from)}function C(I,A){A.restore()}function M(I,A){return P;function P(U,B,j){let H,L,W,S;return Array.isArray(U)?le(U):"tokenize"in U?le([U]):Q(U);function Q(z){return q;function q(te){const ue=te!==null&&z[te],_e=te!==null&&z.null,O=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(_e)?_e:_e?[_e]:[]];return le(O)(te)}}function le(z){return H=z,L=0,z.length===0?j:k(z[L])}function k(z){return q;function q(te){return S=G(),W=z,z.partial||(c.currentConstruct=z),z.name&&c.parser.constructs.disable.null.includes(z.name)?ie():z.tokenize.call(A?Object.assign(Object.create(c),A):c,a,ge,ie)(te)}}function ge(z){return I(W,S),B}function ie(z){return S.restore(),++L<H.length?k(H[L]):j}}}function $(I,A){I.resolveAll&&!s.includes(I)&&s.push(I),I.resolve&&Jt(c.events,A,c.events.length-A,I.resolve(c.events.slice(A),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function G(){const I=g(),A=c.previous,P=c.currentConstruct,U=c.events.length,B=Array.from(l);return{from:U,restore:j};function j(){r=I,c.previous=A,c.currentConstruct=P,c.events.length=U,l=B,T()}}function T(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function qC(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function YC(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
67
+ */function Zu(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function Wx(e,t){let n=Zu(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const Hx="6";try{window.__reactRouterVersion=Hx}catch{}const Ux="startTransition",Op=j1[Ux];function Kx(e){let{basename:t,children:n,future:r,window:i}=e,s=x.useRef();s.current==null&&(s.current=Qw({window:i,v5Compat:!0}));let o=s.current,[l,a]=x.useState({action:o.action,location:o.location}),{v7_startTransition:c}=r||{},h=x.useCallback(u=>{c&&Op?Op(()=>a(u)):a(u)},[a,c]);return x.useLayoutEffect(()=>o.listen(h),[o,h]),x.useEffect(()=>jx(r),[r]),x.createElement(Fx,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}var jp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(jp||(jp={}));var Fp;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Fp||(Fp={}));function Vx(e){let t=x.useRef(Zu(e)),n=x.useRef(!1),r=Mo(),i=x.useMemo(()=>Wx(r.search,n.current?null:t.current),[r.search]),s=cs(),o=x.useCallback((l,a)=>{const c=Zu(typeof l=="function"?l(i):l);n.current=!0,s("?"+c,a)},[s,i]);return[i,o]}const my=x.createContext({ides:[],updateIdeChats:()=>{},screenshotMap:{},setScreenshotMap:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{}}),_y=x.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function qx(e,t){var o,l,a,c;const n=Date.now();if(t.length===0)return e.map(h=>({...h,_lastUpdate:n}));const r=new Map;for(const h of t)r.set(h.id,h);for(const h of e){const u=r.get(h.id);if(!u){r.set(h.id,{...h,_lastUpdate:n});continue}const d=h.timestamp||n,f=u._lastUpdate||u.timestamp||0;if(d>=f){const g=(o=h.chats)!=null&&o.length?h.chats:u.chats;r.set(h.id,{...u,...h,chats:g,_lastUpdate:n})}else(l=h.chats)!=null&&l.length&&!((a=u.chats)!=null&&a.length)&&r.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 r){const d=u.daemonId||h.split(":")[0];if(!s.has(d))continue;const f=n-(u._lastUpdate||u.timestamp||0);(h.includes(":cli:")&&!i.has(h)&&f>1e4||h.includes(":acp:")&&!i.has(h)&&f>1e4||h.includes(":ide:")&&!i.has(h)&&f>3e4)&&r.delete(h)}for(const[h,u]of r)n-(u._lastUpdate||u.timestamp||0)>3e5&&u.status!=="online"&&r.delete(h);return Array.from(r.values())}function Yx({children:e}){const[t,n]=x.useState([]),[r,i]=x.useState({}),[s,o]=x.useState(!1),[l,a]=x.useState([]),c=x.useCallback((u,d)=>{n(f=>f.map(g=>g.id===u?{...g,chats:d}:g))},[]),h={injectEntries:u=>{n(d=>d.length===0?u:qx(u,d))},markLoaded:()=>o(!0),getIdes:()=>t};return p.jsx(_y.Provider,{value:h,children:p.jsx(my.Provider,{value:{ides:t,updateIdeChats:c,screenshotMap:r,setScreenshotMap:i,initialLoaded:s,toasts:l,setToasts:a},children:e})})}function vy(){return x.useContext(my)}function $p(){return x.useContext(_y)}function Xx(e){const{baseUrl:t,getToken:n,onUnauthorized:r}=e;async function i(s,o={}){const l={"Content-Type":"application/json",...o.headers||{}},a=n==null?void 0:n();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 r==null||r(),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 Gx=Xx({baseUrl:"http://localhost:3847"});x.createContext(Gx);const Qx={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},yy=x.createContext(Qx);function Zx({value:e,children:t}){return p.jsx(yy.Provider,{value:e,children:t})}function wi(){return x.useContext(yy)}function Jx(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const eb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nb={};function Wp(e,t){return(nb.jsx?tb:eb).test(e)}const rb=/[ \t\n\f\r]/g;function ib(e){return typeof e=="object"?e.type==="text"?Hp(e.value):!1:Hp(e)}function Hp(e){return e.replace(rb,"")===""}class Ao{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ao.prototype.normal={};Ao.prototype.property={};Ao.prototype.space=void 0;function Sy(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ao(n,r,t)}function Ju(e){return e.toLowerCase()}class rn{constructor(t,n){this.attribute=n,this.property=t}}rn.prototype.attribute="";rn.prototype.booleanish=!1;rn.prototype.boolean=!1;rn.prototype.commaOrSpaceSeparated=!1;rn.prototype.commaSeparated=!1;rn.prototype.defined=!1;rn.prototype.mustUseProperty=!1;rn.prototype.number=!1;rn.prototype.overloadedBoolean=!1;rn.prototype.property="";rn.prototype.spaceSeparated=!1;rn.prototype.space=void 0;let sb=0;const be=xi(),ot=xi(),eh=xi(),re=xi(),ze=xi(),Xi=xi(),ln=xi();function xi(){return 2**++sb}const th=Object.freeze(Object.defineProperty({__proto__:null,boolean:be,booleanish:ot,commaOrSpaceSeparated:ln,commaSeparated:Xi,number:re,overloadedBoolean:eh,spaceSeparated:ze},Symbol.toStringTag,{value:"Module"})),kc=Object.keys(th);class qd extends rn{constructor(t,n,r,i){let s=-1;if(super(t,n),Up(this,"space",i),typeof r=="number")for(;++s<kc.length;){const o=kc[s];Up(this,kc[s],(r&th[o])===th[o])}}}qd.prototype.defined=!0;function Up(e,t,n){n&&(e[t]=n)}function us(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new qd(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Ju(r)]=r,n[Ju(s.attribute)]=r}return new Ao(t,n,e.space)}const wy=us({properties:{ariaActiveDescendant:null,ariaAtomic:ot,ariaAutoComplete:null,ariaBusy:ot,ariaChecked:ot,ariaColCount:re,ariaColIndex:re,ariaColSpan:re,ariaControls:ze,ariaCurrent:null,ariaDescribedBy:ze,ariaDetails:null,ariaDisabled:ot,ariaDropEffect:ze,ariaErrorMessage:null,ariaExpanded:ot,ariaFlowTo:ze,ariaGrabbed:ot,ariaHasPopup:null,ariaHidden:ot,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ze,ariaLevel:re,ariaLive:null,ariaModal:ot,ariaMultiLine:ot,ariaMultiSelectable:ot,ariaOrientation:null,ariaOwns:ze,ariaPlaceholder:null,ariaPosInSet:re,ariaPressed:ot,ariaReadOnly:ot,ariaRelevant:null,ariaRequired:ot,ariaRoleDescription:ze,ariaRowCount:re,ariaRowIndex:re,ariaRowSpan:re,ariaSelected:ot,ariaSetSize:re,ariaSort:null,ariaValueMax:re,ariaValueMin:re,ariaValueNow:re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function xy(e,t){return t in e?e[t]:t}function by(e,t){return xy(e,t.toLowerCase())}const ob=us({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Xi,acceptCharset:ze,accessKey:ze,action:null,allow:null,allowFullScreen:be,allowPaymentRequest:be,allowUserMedia:be,alt:null,as:null,async:be,autoCapitalize:null,autoComplete:ze,autoFocus:be,autoPlay:be,blocking:ze,capture:null,charSet:null,checked:be,cite:null,className:ze,cols:re,colSpan:null,content:null,contentEditable:ot,controls:be,controlsList:ze,coords:re|Xi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:be,defer:be,dir:null,dirName:null,disabled:be,download:eh,draggable:ot,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:be,formTarget:null,headers:ze,height:re,hidden:eh,high:re,href:null,hrefLang:null,htmlFor:ze,httpEquiv:ze,id:null,imageSizes:null,imageSrcSet:null,inert:be,inputMode:null,integrity:null,is:null,isMap:be,itemId:null,itemProp:ze,itemRef:ze,itemScope:be,itemType:ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:be,low:re,manifest:null,max:null,maxLength:re,media:null,method:null,min:null,minLength:re,multiple:be,muted:be,name:null,nonce:null,noModule:be,noValidate:be,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:be,optimum:re,pattern:null,ping:ze,placeholder:null,playsInline:be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:be,referrerPolicy:null,rel:ze,required:be,reversed:be,rows:re,rowSpan:re,sandbox:ze,scope:null,scoped:be,seamless:be,selected:be,shadowRootClonable:be,shadowRootDelegatesFocus:be,shadowRootMode:null,shape:null,size:re,sizes:null,slot:null,span:re,spellCheck:ot,src:null,srcDoc:null,srcLang:null,srcSet:null,start:re,step:null,style:null,tabIndex:re,target:null,title:null,translate:null,type:null,typeMustMatch:be,useMap:null,value:ot,width:re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ze,axis:null,background:null,bgColor:null,border:re,borderColor:null,bottomMargin:re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:be,declare:be,event:null,face:null,frame:null,frameBorder:null,hSpace:re,leftMargin:re,link:null,longDesc:null,lowSrc:null,marginHeight:re,marginWidth:re,noResize:be,noHref:be,noShade:be,noWrap:be,object:null,profile:null,prompt:null,rev:null,rightMargin:re,rules:null,scheme:null,scrolling:ot,standby:null,summary:null,text:null,topMargin:re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:be,disableRemotePlayback:be,prefix:null,property:null,results:re,security:null,unselectable:null},space:"html",transform:by}),lb=us({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:ln,accentHeight:re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:re,amplitude:re,arabicForm:null,ascent:re,attributeName:null,attributeType:null,azimuth:re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:re,by:null,calcMode:null,capHeight:re,className:ze,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:re,diffuseConstant:re,direction:null,display:null,dur:null,divisor:re,dominantBaseline:null,download:be,dx:null,dy:null,edgeMode:null,editable:null,elevation:re,enableBackground:null,end:null,event:null,exponent:re,externalResourcesRequired:null,fill:null,fillOpacity:re,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Xi,g2:Xi,glyphName:Xi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:re,horizOriginX:re,horizOriginY:re,id:null,ideographic:re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:re,k:re,k1:re,k2:re,k3:re,k4:re,kernelMatrix:ln,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:re,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:re,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:re,overlineThickness:re,paintOrder:null,panose1:null,path:null,pathLength:re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:re,pointsAtY:re,pointsAtZ:re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ln,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ln,rev:ln,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ln,requiredFeatures:ln,requiredFonts:ln,requiredFormats:ln,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:re,specularExponent:re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:re,strikethroughThickness:re,string:null,stroke:null,strokeDashArray:ln,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:re,strokeOpacity:re,strokeWidth:null,style:null,surfaceScale:re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ln,tabIndex:re,tableValues:null,target:null,targetX:re,targetY:re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ln,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:re,underlineThickness:re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:re,values:null,vAlphabetic:re,vMathematical:re,vectorEffect:null,vHanging:re,vIdeographic:re,version:null,vertAdvY:re,vertOriginX:re,vertOriginY:re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:xy}),ky=us({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()}}),Cy=us({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:by}),Ey=us({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),ab={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"},cb=/[A-Z]/g,Kp=/-[a-z]/g,ub=/^data[-\w.:]+$/i;function hb(e,t){const n=Ju(t);let r=t,i=rn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ub.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Kp,fb);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Kp.test(s)){let o=s.replace(cb,db);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=qd}return new i(r,t)}function db(e){return"-"+e.toLowerCase()}function fb(e){return e.charAt(1).toUpperCase()}const pb=Sy([wy,ob,ky,Cy,Ey],"html"),Yd=Sy([wy,lb,ky,Cy,Ey],"svg");function gb(e){return e.join(" ").trim()}var Xd={},Vp=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,mb=/\n/g,_b=/^\s*/,vb=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,yb=/^:\s*/,Sb=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,wb=/^[;\s]*/,xb=/^\s+|\s+$/g,bb=`
68
+ `,qp="/",Yp="*",ni="",kb="comment",Cb="declaration";function Eb(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(g){var m=g.match(mb);m&&(n+=m.length);var w=g.lastIndexOf(bb);r=~w?g.length-w:r+g.length}function s(){var g={line:n,column:r};return function(m){return m.position=new o(g),c(),m}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(g){var m=new Error(t.source+":"+n+":"+r+": "+g);if(m.reason=g,m.filename=t.source,m.line=n,m.column=r,m.source=e,!t.silent)throw m}function a(g){var m=g.exec(e);if(m){var w=m[0];return i(w),e=e.slice(w.length),m}}function c(){a(_b)}function h(g){var m;for(g=g||[];m=u();)m!==!1&&g.push(m);return g}function u(){var g=s();if(!(qp!=e.charAt(0)||Yp!=e.charAt(1))){for(var m=2;ni!=e.charAt(m)&&(Yp!=e.charAt(m)||qp!=e.charAt(m+1));)++m;if(m+=2,ni===e.charAt(m-1))return l("End of comment missing");var w=e.slice(2,m-2);return r+=2,i(w),e=e.slice(m),r+=2,g({type:kb,comment:w})}}function d(){var g=s(),m=a(vb);if(m){if(u(),!a(yb))return l("property missing ':'");var w=a(Sb),_=g({type:Cb,property:Xp(m[0].replace(Vp,ni)),value:w?Xp(w[0].replace(Vp,ni)):ni});return a(wb),_}}function f(){var g=[];h(g);for(var m;m=d();)m!==!1&&(g.push(m),h(g));return g}return c(),f()}function Xp(e){return e?e.replace(xb,ni):ni}var Tb=Eb,Rb=$l&&$l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Xd,"__esModule",{value:!0});Xd.default=Pb;const Ib=Rb(Tb);function Pb(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,Ib.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(n=n||{},n[o]=l)}),n}var Fa={};Object.defineProperty(Fa,"__esModule",{value:!0});Fa.camelCase=void 0;var Lb=/^--[a-zA-Z0-9_-]+$/,Db=/-([a-z])/g,Mb=/^[^-]+$/,Ab=/^-(webkit|moz|ms|o|khtml)-/,Bb=/^-(ms)-/,Nb=function(e){return!e||Mb.test(e)||Lb.test(e)},zb=function(e,t){return t.toUpperCase()},Gp=function(e,t){return"".concat(t,"-")},Ob=function(e,t){return t===void 0&&(t={}),Nb(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Bb,Gp):e=e.replace(Ab,Gp),e.replace(Db,zb))};Fa.camelCase=Ob;var jb=$l&&$l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Fb=jb(Xd),$b=Fa;function nh(e,t){var n={};return!e||typeof e!="string"||(0,Fb.default)(e,function(r,i){r&&i&&(n[(0,$b.camelCase)(r,t)]=i)}),n}nh.default=nh;var Wb=nh;const Hb=Gh(Wb),Ty=Ry("end"),Gd=Ry("start");function Ry(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Ub(e){const t=Gd(e),n=Ty(e);if(t&&n)return{start:t,end:n}}function Qs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Qp(e.position):"start"in e||"end"in e?Qp(e):"line"in e||"column"in e?rh(e):""}function rh(e){return Zp(e&&e.line)+":"+Zp(e&&e.column)}function Qp(e){return rh(e&&e.start)+"-"+rh(e&&e.end)}function Zp(e){return e&&typeof e=="number"?e:1}class Nt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const a=r.indexOf(":");a===-1?s.ruleId=r:(s.source=r.slice(0,a),s.ruleId=r.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=Qs(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}}Nt.prototype.file="";Nt.prototype.name="";Nt.prototype.reason="";Nt.prototype.message="";Nt.prototype.stack="";Nt.prototype.column=void 0;Nt.prototype.line=void 0;Nt.prototype.ancestors=void 0;Nt.prototype.cause=void 0;Nt.prototype.fatal=void 0;Nt.prototype.place=void 0;Nt.prototype.ruleId=void 0;Nt.prototype.source=void 0;const Qd={}.hasOwnProperty,Kb=new Map,Vb=/[A-Z]/g,qb=new Set(["table","tbody","thead","tfoot","tr"]),Yb=new Set(["td","th"]),Iy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Xb(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=rk(n,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");r=nk(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Yd:pb,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Py(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function Py(e,t,n){if(t.type==="element")return Gb(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Qb(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Jb(e,t,n);if(t.type==="mdxjsEsm")return Zb(e,t);if(t.type==="root")return ek(e,t,n);if(t.type==="text")return tk(e,t)}function Gb(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Yd,e.schema=i),e.ancestors.push(t);const s=Dy(e,t.tagName,!1),o=ik(e,t);let l=Jd(e,t);return qb.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!ib(a):!0})),Ly(e,o,s,t),Zd(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Qb(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}wo(e,t.position)}function Zb(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wo(e,t.position)}function Jb(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Yd,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:Dy(e,t.name,!0),o=sk(e,t),l=Jd(e,t);return Ly(e,o,s,t),Zd(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function ek(e,t,n){const r={};return Zd(r,Jd(e,t)),e.create(t,e.Fragment,r,n)}function tk(e,t){return t.value}function Ly(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Zd(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function nk(e,t,n){return r;function r(i,s,o,l){const c=Array.isArray(o.children)?n:t;return l?c(s,o,l):c(s,o)}}function rk(e,t){return n;function n(r,i,s,o){const l=Array.isArray(s.children),a=Gd(r);return t(i,s,o,l,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function ik(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Qd.call(t.properties,i)){const s=ok(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Yb.has(t.tagName)?r=l:n[o]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function sk(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else wo(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else wo(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Jd(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Kb;for(;++r<t.children.length;){const s=t.children[r];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=Py(e,s,o);l!==void 0&&n.push(l)}return n}function ok(e,t,n){const r=hb(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Jx(n):gb(n)),r.property==="style"){let i=typeof n=="object"?n:lk(e,String(n));return e.stylePropertyNameCase==="css"&&(i=ak(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?ab[r.property]||r.property:r.attribute,n]}}function lk(e,t){try{return Hb(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Nt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Iy+"#cannot-parse-style-attribute",i}}function Dy(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=Wp(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}r=o}else r=Wp(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Qd.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);wo(e)}function wo(e,t){const n=new Nt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Iy+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ak(e){const t={};let n;for(n in e)Qd.call(e,n)&&(t[ck(n)]=e[n]);return t}function ck(e){let t=e.replace(Vb,uk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function uk(e){return"-"+e.toLowerCase()}const Cc={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"]},hk={};function ef(e,t){const n=hk,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return My(e,r,i)}function My(e,t,n){if(dk(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Jp(e.children,t,n)}return Array.isArray(e)?Jp(e,t,n):""}function Jp(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=My(e[i],t,n);return r.join("")}function dk(e){return!!(e&&typeof e=="object")}const eg=document.createElement("i");function tf(e){const t="&"+e+";";eg.innerHTML=t;const n=eg.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function dn(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function xn(e,t){return e.length>0?(dn(e,e.length,0,t),e):t}const tg={}.hasOwnProperty;function Ay(e){const t={};let n=-1;for(;++n<e.length;)fk(t,e[n]);return t}function fk(e,t){let n;for(n in t){const i=(tg.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){tg.call(i,o)||(i[o]=[]);const l=s[o];pk(i[o],Array.isArray(l)?l:l?[l]:[])}}}function pk(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);dn(e,0,0,r)}function By(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Nn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $t=Kr(/[A-Za-z]/),At=Kr(/[\dA-Za-z]/),gk=Kr(/[#-'*+\--9=?A-Z^-~]/);function da(e){return e!==null&&(e<32||e===127)}const ih=Kr(/\d/),mk=Kr(/[\dA-Fa-f]/),_k=Kr(/[!-/:-@[-`{-~]/);function me(e){return e!==null&&e<-2}function Ne(e){return e!==null&&(e<0||e===32)}function Re(e){return e===-2||e===-1||e===32}const $a=Kr(new RegExp("\\p{P}|\\p{S}","u")),mi=Kr(/\s/);function Kr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function hs(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&At(e.charCodeAt(n+1))&&At(e.charCodeAt(n+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(n+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(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Pe(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return Re(a)?(e.enter(n),l(a)):t(a)}function l(a){return Re(a)&&s++<i?(e.consume(a),l):(e.exit(n),t(a))}}const vk={tokenize:yk};function yk(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Pe(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const a=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=a),n=a,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return me(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const Sk={tokenize:wk},ng={tokenize:xk};function wk(e){const t=this,n=[];let r=0,i,s,o;return l;function l(y){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,a,c)(y)}return c(y)}function a(y){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const E=t.events.length;let R=E,C;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){C=t.events[R][1].end;break}_(r);let M=E;for(;M<t.events.length;)t.events[M][1].end={...C},M++;return dn(t.events,R+1,0,t.events.slice(E)),t.events.length=M,c(y)}return l(y)}function c(y){if(r===n.length){if(!i)return d(y);if(i.currentConstruct&&i.currentConstruct.concrete)return g(y);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ng,h,u)(y)}function h(y){return i&&v(),_(r),d(y)}function u(y){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(y)}function d(y){return t.containerState={},e.attempt(ng,f,g)(y)}function f(y){return r++,n.push([t.currentConstruct,t.containerState]),d(y)}function g(y){if(y===null){i&&v(),_(0),e.consume(y);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),m(y)}function m(y){if(y===null){w(e.exit("chunkFlow"),!0),_(0),e.consume(y);return}return me(y)?(e.consume(y),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(y),m)}function w(y,E){const R=t.sliceStream(y);if(E&&R.push(null),y.previous=s,s&&(s.next=y),s=y,i.defineSkip(y.start),i.write(R),t.parser.lazy[y.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 M=t.events.length;let $=M,G,T;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(G){T=t.events[$][1].end;break}G=!0}for(_(r),C=M;C<t.events.length;)t.events[C][1].end={...T},C++;dn(t.events,$+1,0,t.events.slice(M)),t.events.length=C}}function _(y){let E=n.length;for(;E-- >y;){const R=n[E];t.containerState=R[1],R[0].exit.call(t,e)}n.length=y}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function xk(e,t,n){return Pe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function rs(e){if(e===null||Ne(e)||mi(e))return 1;if($a(e))return 2}function Wa(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const sh={name:"attention",resolveAll:bk,tokenize:kk};function bk(e,t){let n=-1,r,i,s,o,l,a,c,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;a=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const u={...e[r][1].end},d={...e[n][1].start};rg(u,-a),rg(d,a),o={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...e[r][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:d},s={type:a>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:a>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=xn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=xn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=xn(c,Wa(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=xn(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,c=xn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,dn(e,r-1,n-r+3,c),n=r+c.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function kk(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=rs(r);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=rs(a),u=!h||h===2&&i||n.includes(a),d=!i||i===2&&h||n.includes(r);return c._open=!!(s===42?u:u&&(i||!d)),c._close=!!(s===42?d:d&&(h||!u)),t(a)}}function rg(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Ck={name:"autolink",tokenize:Ek};function Ek(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return $t(f)?(e.consume(f),o):f===64?n(f):c(f)}function o(f){return f===43||f===45||f===46||At(f)?(r=1,l(f)):c(f)}function l(f){return f===58?(e.consume(f),r=0,a):(f===43||f===45||f===46||At(f))&&r++<32?(e.consume(f),l):(r=0,c(f))}function a(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||da(f)?n(f):(e.consume(f),a)}function c(f){return f===64?(e.consume(f),h):gk(f)?(e.consume(f),c):n(f)}function h(f){return At(f)?u(f):n(f)}function u(f){return f===46?(e.consume(f),r=0,h):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):d(f)}function d(f){if((f===45||At(f))&&r++<63){const g=f===45?d:u;return e.consume(f),g}return n(f)}}const Bo={partial:!0,tokenize:Tk};function Tk(e,t,n){return r;function r(s){return Re(s)?Pe(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||me(s)?t(s):n(s)}}const Ny={continuation:{tokenize:Ik},exit:Pk,name:"blockQuote",tokenize:Rk};function Rk(e,t,n){const r=this;return i;function i(o){if(o===62){const l=r.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 n(o)}function s(o){return Re(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Ik(e,t,n){const r=this;return i;function i(o){return Re(o)?Pe(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(Ny,t,n)(o)}}function Pk(e){e.exit("blockQuote")}const zy={name:"characterEscape",tokenize:Lk};function Lk(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return _k(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Oy={name:"characterReference",tokenize:Dk};function Dk(e,t,n){const r=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=At,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=mk,h):(e.enter("characterReferenceValue"),s=7,o=ih,h(u))}function h(u){if(u===59&&i){const d=e.exit("characterReferenceValue");return o===At&&!tf(r.sliceSerialize(d))?n(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(u)&&i++<s?(e.consume(u),h):n(u)}}const ig={partial:!0,tokenize:Ak},sg={concrete:!0,name:"codeFenced",tokenize:Mk};function Mk(e,t,n){const r=this,i={partial:!0,tokenize:R};let s=0,o=0,l;return a;function a(C){return c(C)}function c(C){const M=r.events[r.events.length-1];return s=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[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?n(C):(e.exit("codeFencedFenceSequence"),Re(C)?Pe(e,u,"whitespace")(C):u(C))}function u(C){return C===null||me(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(ig,m,E)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(C))}function d(C){return C===null||me(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(C)):Re(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Pe(e,f,"whitespace")(C)):C===96&&C===l?n(C):(e.consume(C),d)}function f(C){return C===null||me(C)?u(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||me(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(C)):C===96&&C===l?n(C):(e.consume(C),g)}function m(C){return e.attempt(i,E,w)(C)}function w(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),_}function _(C){return s>0&&Re(C)?Pe(e,v,"linePrefix",s+1)(C):v(C)}function v(C){return C===null||me(C)?e.check(ig,m,E)(C):(e.enter("codeFlowValue"),y(C))}function y(C){return C===null||me(C)?(e.exit("codeFlowValue"),v(C)):(e.consume(C),y)}function E(C){return e.exit("codeFenced"),t(C)}function R(C,M,$){let G=0;return T;function T(A){return C.enter("lineEnding"),C.consume(A),C.exit("lineEnding"),P}function P(A){return C.enter("codeFencedFence"),Re(A)?Pe(C,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):B(A)}function B(A){return A===l?(C.enter("codeFencedFenceSequence"),D(A)):$(A)}function D(A){return A===l?(G++,C.consume(A),D):G>=o?(C.exit("codeFencedFenceSequence"),Re(A)?Pe(C,U,"whitespace")(A):U(A)):$(A)}function U(A){return A===null||me(A)?(C.exit("codeFencedFence"),M(A)):$(A)}}}function Ak(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Ec={name:"codeIndented",tokenize:Nk},Bk={partial:!0,tokenize:zk};function Nk(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Pe(e,s,"linePrefix",5)(c)}function s(c){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?a(c):me(c)?e.attempt(Bk,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||me(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function zk(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):me(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Pe(e,s,"linePrefix",5)(o)}function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):me(o)?i(o):n(o)}}const Ok={name:"codeText",previous:Fk,resolve:jk,tokenize:$k};function jk(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Fk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function $k(e,t,n){let r=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),r++,l):(e.exit("codeTextSequence"),a(u))}function a(u){return u===null?n(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),a):u===96?(s=e.enter("codeTextSequence"),i=0,h(u)):me(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||me(u)?(e.exit("codeTextData"),a(u)):(e.consume(u),c)}function h(u){return u===96?(e.consume(u),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(s.type="codeTextData",c(u))}}class Wk{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,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&bs(this.left,r),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),bs(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),bs(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 n=this.left.splice(t,Number.POSITIVE_INFINITY);bs(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);bs(this.left,n.reverse())}}}function bs(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function jy(e){const t={};let n=-1,r,i,s,o,l,a,c;const h=new Wk(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(a=r[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(r[0]==="enter")r[1].contentType&&(Object.assign(t,Hk(h,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,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&&(r[1].end={...h.get(i)[1].start},l=h.slice(i,n),l.unshift(r),h.splice(i,n-i+1,l))}}return dn(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function Hk(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,a=[],c={};let h,u,d=-1,f=n,g=0,m=0;const w=[m];for(;f;){for(;e.get(++i)[1]!==f;);s.push(i),f._tokenizer||(h=r.sliceStream(f),f.next||h.push(null),u&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),u=f,f=f.next}for(f=n;++d<l.length;)l[d][0]==="exit"&&l[d-1][0]==="enter"&&l[d][1].type===l[d-1][1].type&&l[d][1].start.line!==l[d][1].end.line&&(m=d+1,w.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):w.pop(),d=w.length;d--;){const _=l.slice(w[d],w[d+1]),v=s.pop();a.push([v,v+_.length-1]),e.splice(v,2,_)}for(a.reverse(),d=-1;++d<a.length;)c[g+a[d][0]]=g+a[d][1],g+=a[d][1]-a[d][0]-1;return c}const Uk={resolve:Vk,tokenize:qk},Kk={partial:!0,tokenize:Yk};function Vk(e){return jy(e),e}function qk(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):me(l)?e.check(Kk,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"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Yk(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Pe(e,s,"linePrefix")}function s(o){if(o===null||me(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Fy(e,t,n,r,i,s,o,l,a){const c=a||Number.POSITIVE_INFINITY;let h=0;return u;function u(_){return _===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(_),e.exit(s),d):_===null||_===32||_===41||da(_)?n(_):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),m(_))}function d(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(_))}function f(_){return _===62?(e.exit("chunkString"),e.exit(l),d(_)):_===null||_===60||me(_)?n(_):(e.consume(_),_===92?g:f)}function g(_){return _===60||_===62||_===92?(e.consume(_),f):f(_)}function m(_){return!h&&(_===null||_===41||Ne(_))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(_)):h<c&&_===40?(e.consume(_),h++,m):_===41?(e.consume(_),h--,m):_===null||_===32||_===40||da(_)?n(_):(e.consume(_),_===92?w:m)}function w(_){return _===40||_===41||_===92?(e.consume(_),m):m(_)}}function $y(e,t,n,r,i,s){const o=this;let l=0,a;return c;function c(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(s),h}function h(f){return l>999||f===null||f===91||f===93&&!a||f===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):me(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===null||f===91||f===93||me(f)||l++>999?(e.exit("chunkString"),h(f)):(e.consume(f),a||(a=!Re(f)),f===92?d:u)}function d(f){return f===91||f===92||f===93?(e.consume(f),l++,u):u(f)}}function Wy(e,t,n,r,i,s){let o;return l;function l(d){return d===34||d===39||d===40?(e.enter(r),e.enter(i),e.consume(d),e.exit(i),o=d===40?41:d,a):n(d)}function a(d){return d===o?(e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):(e.enter(s),c(d))}function c(d){return d===o?(e.exit(s),a(o)):d===null?n(d):me(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Pe(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===o||d===null||me(d)?(e.exit("chunkString"),c(d)):(e.consume(d),d===92?u:h)}function u(d){return d===o||d===92?(e.consume(d),h):h(d)}}function Zs(e,t){let n;return r;function r(i){return me(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Re(i)?Pe(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Xk={name:"definition",tokenize:Qk},Gk={partial:!0,tokenize:Zk};function Qk(e,t,n){const r=this;let i;return s;function s(f){return e.enter("definition"),o(f)}function o(f){return $y.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return i=Nn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),a):n(f)}function a(f){return Ne(f)?Zs(e,c)(f):c(f)}function c(f){return Fy(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function h(f){return e.attempt(Gk,u,u)(f)}function u(f){return Re(f)?Pe(e,d,"whitespace")(f):d(f)}function d(f){return f===null||me(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function Zk(e,t,n){return r;function r(l){return Ne(l)?Zs(e,i)(l):n(l)}function i(l){return Wy(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Re(l)?Pe(e,o,"whitespace")(l):o(l)}function o(l){return l===null||me(l)?t(l):n(l)}}const Jk={name:"hardBreakEscape",tokenize:eC};function eC(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return me(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const tC={name:"headingAtx",resolve:nC,tokenize:rC};function nC(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},dn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function rC(e,t,n){let r=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&&r++<6?(e.consume(h),o):h===null||Ne(h)?(e.exit("atxHeadingSequence"),l(h)):n(h)}function l(h){return h===35?(e.enter("atxHeadingSequence"),a(h)):h===null||me(h)?(e.exit("atxHeading"),t(h)):Re(h)?Pe(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||Ne(h)?(e.exit("atxHeadingText"),l(h)):(e.consume(h),c)}}const iC=["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"],og=["pre","script","style","textarea"],sC={concrete:!0,name:"htmlFlow",resolveTo:aC,tokenize:cC},oC={partial:!0,tokenize:hC},lC={partial:!0,tokenize:uC};function aC(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 cC(e,t,n){const r=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),d):k===47?(e.consume(k),s=!0,m):k===63?(e.consume(k),i=3,r.interrupt?t:S):$t(k)?(e.consume(k),o=String.fromCharCode(k),w):n(k)}function d(k){return k===45?(e.consume(k),i=2,f):k===91?(e.consume(k),i=5,l=0,g):$t(k)?(e.consume(k),i=4,r.interrupt?t:S):n(k)}function f(k){return k===45?(e.consume(k),r.interrupt?t:S):n(k)}function g(k){const ge="CDATA[";return k===ge.charCodeAt(l++)?(e.consume(k),l===ge.length?r.interrupt?t:B:g):n(k)}function m(k){return $t(k)?(e.consume(k),o=String.fromCharCode(k),w):n(k)}function w(k){if(k===null||k===47||k===62||Ne(k)){const ge=k===47,te=o.toLowerCase();return!ge&&!s&&og.includes(te)?(i=1,r.interrupt?t(k):B(k)):iC.includes(o.toLowerCase())?(i=6,ge?(e.consume(k),_):r.interrupt?t(k):B(k)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):s?v(k):y(k))}return k===45||At(k)?(e.consume(k),o+=String.fromCharCode(k),w):n(k)}function _(k){return k===62?(e.consume(k),r.interrupt?t:B):n(k)}function v(k){return Re(k)?(e.consume(k),v):T(k)}function y(k){return k===47?(e.consume(k),T):k===58||k===95||$t(k)?(e.consume(k),E):Re(k)?(e.consume(k),y):T(k)}function E(k){return k===45||k===46||k===58||k===95||At(k)?(e.consume(k),E):R(k)}function R(k){return k===61?(e.consume(k),C):Re(k)?(e.consume(k),R):y(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),a=k,M):Re(k)?(e.consume(k),C):$(k)}function M(k){return k===a?(e.consume(k),a=null,G):k===null||me(k)?n(k):(e.consume(k),M)}function $(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Ne(k)?R(k):(e.consume(k),$)}function G(k){return k===47||k===62||Re(k)?y(k):n(k)}function T(k){return k===62?(e.consume(k),P):n(k)}function P(k){return k===null||me(k)?B(k):Re(k)?(e.consume(k),P):n(k)}function B(k){return k===45&&i===2?(e.consume(k),O):k===60&&i===1?(e.consume(k),H):k===62&&i===4?(e.consume(k),Q):k===63&&i===3?(e.consume(k),S):k===93&&i===5?(e.consume(k),W):me(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(oC,le,D)(k)):k===null||me(k)?(e.exit("htmlFlowData"),D(k)):(e.consume(k),B)}function D(k){return e.check(lC,U,le)(k)}function U(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),A}function A(k){return k===null||me(k)?D(k):(e.enter("htmlFlowData"),B(k))}function O(k){return k===45?(e.consume(k),S):B(k)}function H(k){return k===47?(e.consume(k),o="",L):B(k)}function L(k){if(k===62){const ge=o.toLowerCase();return og.includes(ge)?(e.consume(k),Q):B(k)}return $t(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),L):B(k)}function W(k){return k===93?(e.consume(k),S):B(k)}function S(k){return k===62?(e.consume(k),Q):k===45&&i===2?(e.consume(k),S):B(k)}function Q(k){return k===null||me(k)?(e.exit("htmlFlowData"),le(k)):(e.consume(k),Q)}function le(k){return e.exit("htmlFlow"),t(k)}}function uC(e,t,n){const r=this;return i;function i(o){return me(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function hC(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Bo,t,n)}}const dC={name:"htmlText",tokenize:fC};function fC(e,t,n){const r=this;let i,s,o;return l;function l(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),a}function a(S){return S===33?(e.consume(S),c):S===47?(e.consume(S),R):S===63?(e.consume(S),y):$t(S)?(e.consume(S),$):n(S)}function c(S){return S===45?(e.consume(S),h):S===91?(e.consume(S),s=0,g):$t(S)?(e.consume(S),v):n(S)}function h(S){return S===45?(e.consume(S),f):n(S)}function u(S){return S===null?n(S):S===45?(e.consume(S),d):me(S)?(o=u,H(S)):(e.consume(S),u)}function d(S){return S===45?(e.consume(S),f):u(S)}function f(S){return S===62?O(S):S===45?d(S):u(S)}function g(S){const Q="CDATA[";return S===Q.charCodeAt(s++)?(e.consume(S),s===Q.length?m:g):n(S)}function m(S){return S===null?n(S):S===93?(e.consume(S),w):me(S)?(o=m,H(S)):(e.consume(S),m)}function w(S){return S===93?(e.consume(S),_):m(S)}function _(S){return S===62?O(S):S===93?(e.consume(S),_):m(S)}function v(S){return S===null||S===62?O(S):me(S)?(o=v,H(S)):(e.consume(S),v)}function y(S){return S===null?n(S):S===63?(e.consume(S),E):me(S)?(o=y,H(S)):(e.consume(S),y)}function E(S){return S===62?O(S):y(S)}function R(S){return $t(S)?(e.consume(S),C):n(S)}function C(S){return S===45||At(S)?(e.consume(S),C):M(S)}function M(S){return me(S)?(o=M,H(S)):Re(S)?(e.consume(S),M):O(S)}function $(S){return S===45||At(S)?(e.consume(S),$):S===47||S===62||Ne(S)?G(S):n(S)}function G(S){return S===47?(e.consume(S),O):S===58||S===95||$t(S)?(e.consume(S),T):me(S)?(o=G,H(S)):Re(S)?(e.consume(S),G):O(S)}function T(S){return S===45||S===46||S===58||S===95||At(S)?(e.consume(S),T):P(S)}function P(S){return S===61?(e.consume(S),B):me(S)?(o=P,H(S)):Re(S)?(e.consume(S),P):G(S)}function B(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),i=S,D):me(S)?(o=B,H(S)):Re(S)?(e.consume(S),B):(e.consume(S),U)}function D(S){return S===i?(e.consume(S),i=void 0,A):S===null?n(S):me(S)?(o=D,H(S)):(e.consume(S),D)}function U(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||Ne(S)?G(S):(e.consume(S),U)}function A(S){return S===47||S===62||Ne(S)?G(S):n(S)}function O(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function H(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),L}function L(S){return Re(S)?Pe(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):W(S)}function W(S){return e.enter("htmlTextData"),o(S)}}const nf={name:"labelEnd",resolveAll:_C,resolveTo:vC,tokenize:yC},pC={tokenize:SC},gC={tokenize:wC},mC={tokenize:xC};function _C(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&dn(e,0,e.length,n),e}function vC(e,t){let n=e.length,r=0,i,s,o,l;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);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+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",a,t],["enter",c,t]],l=xn(l,e.slice(s+1,s+r+3)),l=xn(l,[["enter",h,t]]),l=xn(l,Wa(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),l=xn(l,[["exit",h,t],e[o-2],e[o-1],["exit",c,t]]),l=xn(l,e.slice(o+1)),l=xn(l,[["exit",a,t]]),dn(e,s,e.length,l),e}function yC(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return l;function l(d){return s?s._inactive?u(d):(o=r.parser.defined.includes(Nn(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelEnd"),a):n(d)}function a(d){return d===40?e.attempt(pC,h,o?h:u)(d):d===91?e.attempt(gC,h,o?c:u)(d):o?h(d):u(d)}function c(d){return e.attempt(mC,h,u)(d)}function h(d){return t(d)}function u(d){return s._balanced=!0,n(d)}}function SC(e,t,n){return r;function r(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),i}function i(u){return Ne(u)?Zs(e,s)(u):s(u)}function s(u){return u===41?h(u):Fy(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function o(u){return Ne(u)?Zs(e,a)(u):h(u)}function l(u){return n(u)}function a(u){return u===34||u===39||u===40?Wy(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):h(u)}function c(u){return Ne(u)?Zs(e,h)(u):h(u)}function h(u){return u===41?(e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),e.exit("resource"),t):n(u)}}function wC(e,t,n){const r=this;return i;function i(l){return $y.call(r,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return r.parser.defined.includes(Nn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function xC(e,t,n){return r;function r(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):n(s)}}const bC={name:"labelStartImage",resolveAll:nf.resolveAll,tokenize:kC};function kC(e,t,n){const r=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):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const CC={name:"labelStartLink",resolveAll:nf.resolveAll,tokenize:EC};function EC(e,t,n){const r=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 r.parser.constructs?n(o):t(o)}}const Tc={name:"lineEnding",tokenize:TC};function TC(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Pe(e,t,"linePrefix")}}const Ll={name:"thematicBreak",tokenize:RC};function RC(e,t,n){let r=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)):r>=3&&(c===null||me(c))?(e.exit("thematicBreak"),t(c)):n(c)}function a(c){return c===i?(e.consume(c),r++,a):(e.exit("thematicBreakSequence"),Re(c)?Pe(e,l,"whitespace")(c):l(c))}}const Qt={continuation:{tokenize:DC},exit:AC,name:"list",tokenize:LC},IC={partial:!0,tokenize:BC},PC={partial:!0,tokenize:MC};function LC(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(f){const g=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:ih(f)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Ll,n,c)(f):c(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(f)}return n(f)}function a(f){return ih(f)&&++o<10?(e.consume(f),a):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(Bo,r.interrupt?n:h,e.attempt(IC,d,u))}function h(f){return r.containerState.initialBlankLine=!0,s++,d(f)}function u(f){return Re(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),d):n(f)}function d(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function DC(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Bo,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Pe(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!Re(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(PC,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Pe(e,e.attempt(Qt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function MC(e,t,n){const r=this;return Pe(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function AC(e){e.exit(this.containerState.type)}function BC(e,t,n){const r=this;return Pe(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Re(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const lg={name:"setextUnderline",resolveTo:NC,tokenize:zC};function NC(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][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[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function zC(e,t,n){const r=this;let i;return s;function s(c){let h=r.events.length,u;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){u=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||u)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),Re(c)?Pe(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||me(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const OC={tokenize:jC};function jC(e){const t=this,n=e.attempt(Bo,r,e.attempt(this.parser.constructs.flowInitial,i,Pe(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Uk,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const FC={resolveAll:Uy()},$C=Hy("string"),WC=Hy("text");function Hy(e){return{resolveAll:Uy(e==="text"?HC:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,l);return o;function o(h){return c(h)?s(h):l(h)}function l(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),a}function a(h){return c(h)?(n.exit("data"),s(h)):(n.consume(h),a)}function c(h){if(h===null)return!0;const u=i[h];let d=-1;if(u)for(;++d<u.length;){const f=u[d];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function Uy(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function HC(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);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&&n===e.length&&(l=0),l){const c={type:n===e.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const UC={42:Qt,43:Qt,45:Qt,48:Qt,49:Qt,50:Qt,51:Qt,52:Qt,53:Qt,54:Qt,55:Qt,56:Qt,57:Qt,62:Ny},KC={91:Xk},VC={[-2]:Ec,[-1]:Ec,32:Ec},qC={35:tC,42:Ll,45:[lg,Ll],60:sC,61:lg,95:Ll,96:sg,126:sg},YC={38:Oy,92:zy},XC={[-5]:Tc,[-4]:Tc,[-3]:Tc,33:bC,38:Oy,42:sh,60:[Ck,dC],91:CC,92:[Jk,zy],93:nf,95:sh,96:Ok},GC={null:[sh,FC]},QC={null:[42,95]},ZC={null:[]},JC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:QC,contentInitial:KC,disable:ZC,document:UC,flow:qC,flowInitial:VC,insideSpan:GC,string:YC,text:XC},Symbol.toStringTag,{value:"Module"}));function e2(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],l=[];const a={attempt:M(R),check:M(C),consume:v,enter:y,exit:E,interrupt:M(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:e,previous:null,sliceSerialize:d,sliceStream:f,write:u};let h=t.tokenize.call(c,a);return t.resolveAll&&s.push(t),c;function u(P){return o=xn(o,P),w(),o[o.length-1]!==null?[]:($(t,0),c.events=Wa(s,c.events,c),c.events)}function d(P,B){return n2(f(P),B)}function f(P){return t2(o,P)}function g(){const{_bufferIndex:P,_index:B,line:D,column:U,offset:A}=r;return{_bufferIndex:P,_index:B,line:D,column:U,offset:A}}function m(P){i[P.line]=P.column,T()}function w(){let P;for(;r._index<o.length;){const B=o[r._index];if(typeof B=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<B.length;)_(B.charCodeAt(r._bufferIndex));else _(B)}}function _(P){h=h(P)}function v(P){me(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,T()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=P}function y(P,B){const D=B||{};return D.type=P,D.start=g(),c.events.push(["enter",D,c]),l.push(D),D}function E(P){const B=l.pop();return B.end=g(),c.events.push(["exit",B,c]),B}function R(P,B){$(P,B.from)}function C(P,B){B.restore()}function M(P,B){return D;function D(U,A,O){let H,L,W,S;return Array.isArray(U)?le(U):"tokenize"in U?le([U]):Q(U);function Q(F){return ie;function ie(ne){const ue=ne!==null&&F[ne],Se=ne!==null&&F.null,z=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(Se)?Se:Se?[Se]:[]];return le(z)(ne)}}function le(F){return H=F,L=0,F.length===0?O:k(F[L])}function k(F){return ie;function ie(ne){return S=G(),W=F,F.partial||(c.currentConstruct=F),F.name&&c.parser.constructs.disable.null.includes(F.name)?te():F.tokenize.call(B?Object.assign(Object.create(c),B):c,a,ge,te)(ne)}}function ge(F){return P(W,S),A}function te(F){return S.restore(),++L<H.length?k(H[L]):O}}}function $(P,B){P.resolveAll&&!s.includes(P)&&s.push(P),P.resolve&&dn(c.events,B,c.events.length-B,P.resolve(c.events.slice(B),c)),P.resolveTo&&(c.events=P.resolveTo(c.events,c))}function G(){const P=g(),B=c.previous,D=c.currentConstruct,U=c.events.length,A=Array.from(l);return{from:U,restore:O};function O(){r=P,c.previous=B,c.currentConstruct=D,c.events.length=U,l=A,T()}}function T(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function t2(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function n2(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
69
69
  `;break}case-3:{o=`\r
70
- `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function XC(e){const r={constructs:by([KC,...(e||{}).extensions||[]]),content:i(uk),defined:[],document:i(dk),flow:i(LC),lazy:{},string:i(MC),text:i(AC)};return r;function i(s){return o;function o(l){return VC(r,s,l)}}}function GC(e){for(;!Ry(e););return e}const Qp=/[\0\t\n\r]/g;function QC(){let e=1,t="",n=!0,r;return i;function i(s,o,l){const a=[];let c,h,u,d,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),u=0,t="",n&&(s.charCodeAt(0)===65279&&u++,n=void 0);u<s.length;){if(Qp.lastIndex=u,c=Qp.exec(s),d=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(d),!c){t=s.slice(u);break}if(f===10&&u===d&&r)a.push(-3),r=void 0;else switch(r&&(a.push(-5),r=void 0),u<d&&(a.push(s.slice(u,d)),e+=d-u),f){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:r=!0,e=1}u=d+1}return l&&(r&&a.push(-5),t&&a.push(t),a.push(null)),a}}const ZC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JC(e){return e.replace(ZC,e2)}function e2(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return ky(n.slice(s?2:1),s?16:10)}return Ud(n)||e}const Ay={}.hasOwnProperty;function t2(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),n2(n)(GC(XC(n).document().write(QC()(e,t,!0))))}function n2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ar),autolinkProtocol:G,autolinkEmail:G,atxHeading:s(Pe),blockQuote:s(_e),characterEscape:G,characterReference:G,codeFenced:s(O),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(O,o),codeText:s(Te,o),codeTextData:G,data:G,codeFlowValue:G,definition:s(ye),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Qe),hardBreakEscape:s(_n),hardBreakTrailing:s(_n),htmlFlow:s(rn,o),htmlFlowData:G,htmlText:s(rn,o),htmlTextData:G,image:s(Hn),label:o,link:s(ar),listItem:s(Rn),listItemValue:d,listOrdered:s(Un,u),listUnordered:s(Un),paragraph:s(Kn),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Pe),strong:s(xt),thematicBreak:s(pe)},exit:{atxHeading:a(),atxHeadingSequence:R,autolink:a(),autolinkEmail:ue,autolinkProtocol:te,blockQuote:a(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:z,characterReference:q,codeFenced:a(w),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:T,codeIndented:a(_),codeText:a(B),codeTextData:T,data:T,definition:a(),definitionDestinationString:E,definitionLabelString:v,definitionTitleString:y,emphasis:a(),hardBreakEscape:a(A),hardBreakTrailing:a(A),htmlFlow:a(P),htmlFlowData:T,htmlText:a(U),htmlTextData:T,image:a(H),label:W,labelText:L,lineEnding:I,link:a(j),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:ge,resourceDestinationString:S,resourceTitleString:Q,resource:le,setextHeading:a($),setextHeadingLineSequence:M,setextHeadingText:C,strong:a(),thematicBreak:a()}};By(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(D){let X={type:"root",children:[]};const N={stack:[X],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:h,data:n},F=[];let K=-1;for(;++K<D.length;)if(D[K][1].type==="listOrdered"||D[K][1].type==="listUnordered")if(D[K][0]==="enter")F.push(K);else{const Y=F.pop();K=i(D,Y,K)}for(K=-1;++K<D.length;){const Y=t[D[K][0]];Ay.call(Y,D[K][1].type)&&Y[D[K][1].type].call(Object.assign({sliceSerialize:D[K][2].sliceSerialize},N),D[K][1])}if(N.tokenStack.length>0){const Y=N.tokenStack[N.tokenStack.length-1];(Y[1]||Zp).call(N,void 0,Y[0])}for(X.position={start:ur(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:ur(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},K=-1;++K<t.transforms.length;)X=t.transforms[K](X)||X;return X}function i(D,X,N){let F=X-1,K=-1,Y=!1,J,oe,ae,fe;for(;++F<=N;){const ce=D[F];switch(ce[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ce[0]==="enter"?K++:K--,fe=void 0;break}case"lineEndingBlank":{ce[0]==="enter"&&(J&&!fe&&!K&&!ae&&(ae=F),fe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:fe=void 0}if(!K&&ce[0]==="enter"&&ce[1].type==="listItemPrefix"||K===-1&&ce[0]==="exit"&&(ce[1].type==="listUnordered"||ce[1].type==="listOrdered")){if(J){let b=F;for(oe=void 0;b--;){const Z=D[b];if(Z[1].type==="lineEnding"||Z[1].type==="lineEndingBlank"){if(Z[0]==="exit")continue;oe&&(D[oe][1].type="lineEndingBlank",Y=!0),Z[1].type="lineEnding",oe=b}else if(!(Z[1].type==="linePrefix"||Z[1].type==="blockQuotePrefix"||Z[1].type==="blockQuotePrefixWhitespace"||Z[1].type==="blockQuoteMarker"||Z[1].type==="listItemIndent"))break}ae&&(!oe||ae<oe)&&(J._spread=!0),J.end=Object.assign({},oe?D[oe][1].start:ce[1].end),D.splice(oe||F,0,["exit",J,ce[2]]),F++,N++}if(ce[1].type==="listItemPrefix"){const b={type:"listItem",_spread:!1,start:Object.assign({},ce[1].start),end:void 0};J=b,D.splice(F,0,["enter",b,ce[2]]),F++,N++,ae=void 0,fe=!0}}}return D[X][1]._spread=Y,N}function s(D,X){return N;function N(F){l.call(this,D(F),F),X&&X.call(this,F)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(D,X,N){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([X,N||void 0]),D.position={start:ur(X.start),end:void 0}}function a(D){return X;function X(N){D&&D.call(this,N),c.call(this,N)}}function c(D,X){const N=this.stack.pop(),F=this.tokenStack.pop();if(F)F[0].type!==D.type&&(X?X.call(this,D,F[0]):(F[1]||Zp).call(this,D,F[0]));else throw new Error("Cannot close `"+D.type+"` ("+Hs({start:D.start,end:D.end})+"): it’s not open");N.position.end=ur(D.end)}function h(){return Hd(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function d(D){if(this.data.expectingFirstListItemValue){const X=this.stack[this.stack.length-2];X.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function f(){const D=this.resume(),X=this.stack[this.stack.length-1];X.lang=D}function g(){const D=this.resume(),X=this.stack[this.stack.length-1];X.meta=D}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const D=this.resume(),X=this.stack[this.stack.length-1];X.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const D=this.resume(),X=this.stack[this.stack.length-1];X.value=D.replace(/(\r?\n|\r)$/g,"")}function v(D){const X=this.resume(),N=this.stack[this.stack.length-1];N.label=X,N.identifier=En(this.sliceSerialize(D)).toLowerCase()}function y(){const D=this.resume(),X=this.stack[this.stack.length-1];X.title=D}function E(){const D=this.resume(),X=this.stack[this.stack.length-1];X.url=D}function R(D){const X=this.stack[this.stack.length-1];if(!X.depth){const N=this.sliceSerialize(D).length;X.depth=N}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function M(D){const X=this.stack[this.stack.length-1];X.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function G(D){const N=this.stack[this.stack.length-1].children;let F=N[N.length-1];(!F||F.type!=="text")&&(F=ne(),F.position={start:ur(D.start),end:void 0},N.push(F)),this.stack.push(F)}function T(D){const X=this.stack.pop();X.value+=this.sliceSerialize(D),X.position.end=ur(D.end)}function I(D){const X=this.stack[this.stack.length-1];if(this.data.atHardBreak){const N=X.children[X.children.length-1];N.position.end=ur(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(X.type)&&(G.call(this,D),T.call(this,D))}function A(){this.data.atHardBreak=!0}function P(){const D=this.resume(),X=this.stack[this.stack.length-1];X.value=D}function U(){const D=this.resume(),X=this.stack[this.stack.length-1];X.value=D}function B(){const D=this.resume(),X=this.stack[this.stack.length-1];X.value=D}function j(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=X,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function H(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=X,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function L(D){const X=this.sliceSerialize(D),N=this.stack[this.stack.length-2];N.label=JC(X),N.identifier=En(X).toLowerCase()}function W(){const D=this.stack[this.stack.length-1],X=this.resume(),N=this.stack[this.stack.length-1];if(this.data.inReference=!0,N.type==="link"){const F=D.children;N.children=F}else N.alt=X}function S(){const D=this.resume(),X=this.stack[this.stack.length-1];X.url=D}function Q(){const D=this.resume(),X=this.stack[this.stack.length-1];X.title=D}function le(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function ge(D){const X=this.resume(),N=this.stack[this.stack.length-1];N.label=X,N.identifier=En(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function ie(D){this.data.characterReferenceType=D.type}function z(D){const X=this.sliceSerialize(D),N=this.data.characterReferenceType;let F;N?(F=ky(X,N==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):F=Ud(X);const K=this.stack[this.stack.length-1];K.value+=F}function q(D){const X=this.stack.pop();X.position.end=ur(D.end)}function te(D){T.call(this,D);const X=this.stack[this.stack.length-1];X.url=this.sliceSerialize(D)}function ue(D){T.call(this,D);const X=this.stack[this.stack.length-1];X.url="mailto:"+this.sliceSerialize(D)}function _e(){return{type:"blockquote",children:[]}}function O(){return{type:"code",lang:null,meta:null,value:""}}function Te(){return{type:"inlineCode",value:""}}function ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Qe(){return{type:"emphasis",children:[]}}function Pe(){return{type:"heading",depth:0,children:[]}}function _n(){return{type:"break"}}function rn(){return{type:"html",value:""}}function Hn(){return{type:"image",title:null,url:"",alt:null}}function ar(){return{type:"link",title:null,url:"",children:[]}}function Un(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function Rn(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function Kn(){return{type:"paragraph",children:[]}}function xt(){return{type:"strong",children:[]}}function ne(){return{type:"text",value:""}}function pe(){return{type:"thematicBreak"}}}function ur(e){return{line:e.line,column:e.column,offset:e.offset}}function By(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?By(e,r):r2(e,r)}}function r2(e,t){let n;for(n in t)if(Ay.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Zp(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Hs({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Hs({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Hs({start:t.start,end:t.end})+") is still open")}function i2(e){const t=this;t.parser=n;function n(r){return t2(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function s2(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function o2(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
71
- `}]}function l2(e,t){const n=t.value?t.value+`
72
- `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};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 a2(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function c2(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function u2(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=rs(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(r,l);const a={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"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 h2(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function d2(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ny(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];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+=r:i.push({type:"text",value:r}),i}function f2(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ny(e,t);const i={src:rs(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function p2(e,t){const n={src:rs(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function g2(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function m2(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ny(e,t);const i={href:rs(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function _2(e,t){const n={href:rs(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function v2(e,t,n){const r=e.all(t),i=n?y2(n):zy(t),s={},o=[];if(typeof t.checked=="boolean"){const h=r[0];let u;h&&h.type==="element"&&h.tagName==="p"?u=h:(u={type:"element",tagName:"p",properties:{},children:[]},r.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<r.length;){const h=r[l];(i||l!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
70
+ `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function r2(e){const r={constructs:Ay([JC,...(e||{}).extensions||[]]),content:i(vk),defined:[],document:i(Sk),flow:i(OC),lazy:{},string:i($C),text:i(WC)};return r;function i(s){return o;function o(l){return e2(r,s,l)}}}function i2(e){for(;!jy(e););return e}const ag=/[\0\t\n\r]/g;function s2(){let e=1,t="",n=!0,r;return i;function i(s,o,l){const a=[];let c,h,u,d,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),u=0,t="",n&&(s.charCodeAt(0)===65279&&u++,n=void 0);u<s.length;){if(ag.lastIndex=u,c=ag.exec(s),d=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(d),!c){t=s.slice(u);break}if(f===10&&u===d&&r)a.push(-3),r=void 0;else switch(r&&(a.push(-5),r=void 0),u<d&&(a.push(s.slice(u,d)),e+=d-u),f){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:r=!0,e=1}u=d+1}return l&&(r&&a.push(-5),t&&a.push(t),a.push(null)),a}}const o2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function l2(e){return e.replace(o2,a2)}function a2(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return By(n.slice(s?2:1),s?16:10)}return tf(n)||e}const Ky={}.hasOwnProperty;function c2(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),u2(n)(i2(r2(n).document().write(s2()(e,t,!0))))}function u2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(On),autolinkProtocol:G,autolinkEmail:G,atxHeading:s(zt),blockQuote:s(Se),characterEscape:G,characterReference:G,codeFenced:s(z),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(z,o),codeText:s(Be,o),codeTextData:G,data:G,codeFlowValue:G,definition:s(xe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(nt),hardBreakEscape:s(qt),hardBreakTrailing:s(qt),htmlFlow:s(De,o),htmlFlowData:G,htmlText:s(De,o),htmlTextData:G,image:s(Ce),label:o,link:s(On),listItem:s(It),listItemValue:d,listOrdered:s(Jn,u),listUnordered:s(Jn),paragraph:s(Yt),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(zt),strong:s(Ge),thematicBreak:s(pe)},exit:{atxHeading:a(),atxHeadingSequence:R,autolink:a(),autolinkEmail:ue,autolinkProtocol:ne,blockQuote:a(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:F,characterReference:ie,codeFenced:a(w),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:T,codeIndented:a(_),codeText:a(A),codeTextData:T,data:T,definition:a(),definitionDestinationString:E,definitionLabelString:v,definitionTitleString:y,emphasis:a(),hardBreakEscape:a(B),hardBreakTrailing:a(B),htmlFlow:a(D),htmlFlowData:T,htmlText:a(U),htmlTextData:T,image:a(H),label:W,labelText:L,lineEnding:P,link:a(O),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:ge,resourceDestinationString:S,resourceTitleString:Q,resource:le,setextHeading:a($),setextHeadingLineSequence:M,setextHeadingText:C,strong:a(),thematicBreak:a()}};Vy(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(I){let Y={type:"root",children:[]};const N={stack:[Y],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:h,data:n},j=[];let K=-1;for(;++K<I.length;)if(I[K][1].type==="listOrdered"||I[K][1].type==="listUnordered")if(I[K][0]==="enter")j.push(K);else{const q=j.pop();K=i(I,q,K)}for(K=-1;++K<I.length;){const q=t[I[K][0]];Ky.call(q,I[K][1].type)&&q[I[K][1].type].call(Object.assign({sliceSerialize:I[K][2].sliceSerialize},N),I[K][1])}if(N.tokenStack.length>0){const q=N.tokenStack[N.tokenStack.length-1];(q[1]||cg).call(N,void 0,q[0])}for(Y.position={start:_r(I.length>0?I[0][1].start:{line:1,column:1,offset:0}),end:_r(I.length>0?I[I.length-2][1].end:{line:1,column:1,offset:0})},K=-1;++K<t.transforms.length;)Y=t.transforms[K](Y)||Y;return Y}function i(I,Y,N){let j=Y-1,K=-1,q=!1,J,oe,ae,fe;for(;++j<=N;){const ce=I[j];switch(ce[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ce[0]==="enter"?K++:K--,fe=void 0;break}case"lineEndingBlank":{ce[0]==="enter"&&(J&&!fe&&!K&&!ae&&(ae=j),fe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:fe=void 0}if(!K&&ce[0]==="enter"&&ce[1].type==="listItemPrefix"||K===-1&&ce[0]==="exit"&&(ce[1].type==="listUnordered"||ce[1].type==="listOrdered")){if(J){let ve=j;for(oe=void 0;ve--;){const we=I[ve];if(we[1].type==="lineEnding"||we[1].type==="lineEndingBlank"){if(we[0]==="exit")continue;oe&&(I[oe][1].type="lineEndingBlank",q=!0),we[1].type="lineEnding",oe=ve}else if(!(we[1].type==="linePrefix"||we[1].type==="blockQuotePrefix"||we[1].type==="blockQuotePrefixWhitespace"||we[1].type==="blockQuoteMarker"||we[1].type==="listItemIndent"))break}ae&&(!oe||ae<oe)&&(J._spread=!0),J.end=Object.assign({},oe?I[oe][1].start:ce[1].end),I.splice(oe||j,0,["exit",J,ce[2]]),j++,N++}if(ce[1].type==="listItemPrefix"){const ve={type:"listItem",_spread:!1,start:Object.assign({},ce[1].start),end:void 0};J=ve,I.splice(j,0,["enter",ve,ce[2]]),j++,N++,ae=void 0,fe=!0}}}return I[Y][1]._spread=q,N}function s(I,Y){return N;function N(j){l.call(this,I(j),j),Y&&Y.call(this,j)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(I,Y,N){this.stack[this.stack.length-1].children.push(I),this.stack.push(I),this.tokenStack.push([Y,N||void 0]),I.position={start:_r(Y.start),end:void 0}}function a(I){return Y;function Y(N){I&&I.call(this,N),c.call(this,N)}}function c(I,Y){const N=this.stack.pop(),j=this.tokenStack.pop();if(j)j[0].type!==I.type&&(Y?Y.call(this,I,j[0]):(j[1]||cg).call(this,I,j[0]));else throw new Error("Cannot close `"+I.type+"` ("+Qs({start:I.start,end:I.end})+"): it’s not open");N.position.end=_r(I.end)}function h(){return ef(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function d(I){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(I),10),this.data.expectingFirstListItemValue=void 0}}function f(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=I}function g(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=I}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.value=I.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.value=I.replace(/(\r?\n|\r)$/g,"")}function v(I){const Y=this.resume(),N=this.stack[this.stack.length-1];N.label=Y,N.identifier=Nn(this.sliceSerialize(I)).toLowerCase()}function y(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.title=I}function E(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.url=I}function R(I){const Y=this.stack[this.stack.length-1];if(!Y.depth){const N=this.sliceSerialize(I).length;Y.depth=N}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function M(I){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(I).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function G(I){const N=this.stack[this.stack.length-1].children;let j=N[N.length-1];(!j||j.type!=="text")&&(j=Z(),j.position={start:_r(I.start),end:void 0},N.push(j)),this.stack.push(j)}function T(I){const Y=this.stack.pop();Y.value+=this.sliceSerialize(I),Y.position.end=_r(I.end)}function P(I){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const N=Y.children[Y.children.length-1];N.position.end=_r(I.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(G.call(this,I),T.call(this,I))}function B(){this.data.atHardBreak=!0}function D(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.value=I}function U(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.value=I}function A(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.value=I}function O(){const I=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";I.type+="Reference",I.referenceType=Y,delete I.url,delete I.title}else delete I.identifier,delete I.label;this.data.referenceType=void 0}function H(){const I=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";I.type+="Reference",I.referenceType=Y,delete I.url,delete I.title}else delete I.identifier,delete I.label;this.data.referenceType=void 0}function L(I){const Y=this.sliceSerialize(I),N=this.stack[this.stack.length-2];N.label=l2(Y),N.identifier=Nn(Y).toLowerCase()}function W(){const I=this.stack[this.stack.length-1],Y=this.resume(),N=this.stack[this.stack.length-1];if(this.data.inReference=!0,N.type==="link"){const j=I.children;N.children=j}else N.alt=Y}function S(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.url=I}function Q(){const I=this.resume(),Y=this.stack[this.stack.length-1];Y.title=I}function le(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function ge(I){const Y=this.resume(),N=this.stack[this.stack.length-1];N.label=Y,N.identifier=Nn(this.sliceSerialize(I)).toLowerCase(),this.data.referenceType="full"}function te(I){this.data.characterReferenceType=I.type}function F(I){const Y=this.sliceSerialize(I),N=this.data.characterReferenceType;let j;N?(j=By(Y,N==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):j=tf(Y);const K=this.stack[this.stack.length-1];K.value+=j}function ie(I){const Y=this.stack.pop();Y.position.end=_r(I.end)}function ne(I){T.call(this,I);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(I)}function ue(I){T.call(this,I);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(I)}function Se(){return{type:"blockquote",children:[]}}function z(){return{type:"code",lang:null,meta:null,value:""}}function Be(){return{type:"inlineCode",value:""}}function xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function nt(){return{type:"emphasis",children:[]}}function zt(){return{type:"heading",depth:0,children:[]}}function qt(){return{type:"break"}}function De(){return{type:"html",value:""}}function Ce(){return{type:"image",title:null,url:"",alt:null}}function On(){return{type:"link",title:null,url:"",children:[]}}function Jn(I){return{type:"list",ordered:I.type==="listOrdered",start:null,spread:I._spread,children:[]}}function It(I){return{type:"listItem",spread:I._spread,checked:null,children:[]}}function Yt(){return{type:"paragraph",children:[]}}function Ge(){return{type:"strong",children:[]}}function Z(){return{type:"text",value:""}}function pe(){return{type:"thematicBreak"}}}function _r(e){return{line:e.line,column:e.column,offset:e.offset}}function Vy(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Vy(e,r):h2(e,r)}}function h2(e,t){let n;for(n in t)if(Ky.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function cg(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Qs({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Qs({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Qs({start:t.start,end:t.end})+") is still open")}function d2(e){const t=this;t.parser=n;function n(r){return c2(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function f2(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function p2(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
71
+ `}]}function g2(e,t){const n=t.value?t.value+`
72
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};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 m2(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _2(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function v2(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=hs(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(r,l);const a={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"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 y2(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function S2(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function qy(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];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+=r:i.push({type:"text",value:r}),i}function w2(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return qy(e,t);const i={src:hs(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function x2(e,t){const n={src:hs(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function b2(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function k2(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return qy(e,t);const i={href:hs(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function C2(e,t){const n={href:hs(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function E2(e,t,n){const r=e.all(t),i=n?T2(n):Yy(t),s={},o=[];if(typeof t.checked=="boolean"){const h=r[0];let u;h&&h.type==="element"&&h.tagName==="p"?u=h:(u={type:"element",tagName:"p",properties:{},children:[]},r.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<r.length;){const h=r[l];(i||l!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
73
73
  `}),h.type==="element"&&h.tagName==="p"&&!i?o.push(...h.children):o.push(h)}const a=r[r.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 y2(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=zy(n[r])}return t}function zy(e){const t=e.spread;return t??e.children.length>1}function S2(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function w2(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x2(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function b2(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function k2(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=jd(t.children[1]),a=my(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 C2(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let a=-1;const c=[];for(;++a<l;){const u=t.children[a],d={},f=o?o[a]:void 0;f&&(d.align=f);let g={type:"element",tagName:s,properties:d,children:[]};u&&(g.children=e.all(u),e.patch(u,g),g=e.applyData(u,g)),c.push(g)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function E2(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Jp=9,eg=32;function T2(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(tg(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(tg(t.slice(i),i>0,!1)),s.join("")}function tg(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Jp||s===eg;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Jp||s===eg;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function R2(e,t){const n={type:"text",value:T2(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function I2(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const L2={blockquote:s2,break:o2,code:l2,delete:a2,emphasis:c2,footnoteReference:u2,heading:h2,html:d2,imageReference:f2,image:p2,inlineCode:g2,linkReference:m2,link:_2,listItem:v2,list:S2,paragraph:w2,root:x2,strong:b2,table:k2,tableCell:E2,tableRow:C2,text:R2,thematicBreak:I2,toml:Qo,yaml:Qo,definition:Qo,footnoteDefinition:Qo};function Qo(){}const Oy=-1,Da=0,Ks=1,na=2,Vd=3,qd=4,Yd=5,Xd=6,jy=7,Fy=8,ng=typeof self=="object"?self:globalThis,P2=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case Da:case Oy:return n(o,i);case Ks:{const l=n([],i);for(const a of o)l.push(r(a));return l}case na:{const l=n({},i);for(const[a,c]of o)l[r(a)]=r(c);return l}case Vd:return n(new Date(o),i);case qd:{const{source:l,flags:a}=o;return n(new RegExp(l,a),i)}case Yd:{const l=n(new Map,i);for(const[a,c]of o)l.set(r(a),r(c));return l}case Xd:{const l=n(new Set,i);for(const a of o)l.add(r(a));return l}case jy:{const{name:l,message:a}=o;return n(new ng[l](a),i)}case Fy:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new ng[s](o),i)};return r},rg=e=>P2(new Map,e)(0),vi="",{toString:D2}={},{keys:M2}=Object,ms=e=>{const t=typeof e;if(t!=="object"||!e)return[Da,t];const n=D2.call(e).slice(8,-1);switch(n){case"Array":return[Ks,vi];case"Object":return[na,vi];case"Date":return[Vd,vi];case"RegExp":return[qd,vi];case"Map":return[Yd,vi];case"Set":return[Xd,vi];case"DataView":return[Ks,n]}return n.includes("Array")?[Ks,n]:n.includes("Error")?[jy,n]:[na,n]},Zo=([e,t])=>e===Da&&(t==="function"||t==="symbol"),A2=(e,t,n,r)=>{const i=(o,l)=>{const a=r.push(o)-1;return n.set(l,a),a},s=o=>{if(n.has(o))return n.get(o);let[l,a]=ms(o);switch(l){case Da:{let h=o;switch(a){case"bigint":l=Fy,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);h=null;break;case"undefined":return i([Oy],o)}return i([l,h],o)}case Ks:{if(a){let d=o;return a==="DataView"?d=new Uint8Array(o.buffer):a==="ArrayBuffer"&&(d=new Uint8Array(o)),i([a,[...d]],o)}const h=[],u=i([l,h],o);for(const d of o)h.push(s(d));return u}case na:{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 d of M2(o))(e||!Zo(ms(o[d])))&&h.push([s(d),s(o[d])]);return u}case Vd:return i([l,o.toISOString()],o);case qd:{const{source:h,flags:u}=o;return i([l,{source:h,flags:u}],o)}case Yd:{const h=[],u=i([l,h],o);for(const[d,f]of o)(e||!(Zo(ms(d))||Zo(ms(f))))&&h.push([s(d),s(f)]);return u}case Xd:{const h=[],u=i([l,h],o);for(const d of o)(e||!Zo(ms(d)))&&h.push(s(d));return u}}const{message:c}=o;return i([l,{name:a,message:c}],o)};return s},ig=(e,{json:t,lossy:n}={})=>{const r=[];return A2(!(t||n),!!t,new Map,r)(e),r},ra=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?rg(ig(e,t)):structuredClone(e):(e,t)=>rg(ig(e,t));function B2(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function N2(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function z2(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||B2,r=e.options.footnoteBackLabel||N2,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(),d=rs(u.toLowerCase());let f=0;const g=[],m=e.footnoteCounts.get(u);for(;m!==void 0&&++f<=m;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(a,f);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(a,f),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const v=w.children[w.children.length-1];v&&v.type==="text"?v.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...g)}else h.push(...g);const _={type:"element",tagName:"li",properties:{id:t+"fn-"+d},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:{...ra(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
74
+ `});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function T2(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Yy(n[r])}return t}function Yy(e){const t=e.spread;return t??e.children.length>1}function R2(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function I2(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function P2(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function L2(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function D2(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Gd(t.children[1]),a=Ty(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 M2(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let a=-1;const c=[];for(;++a<l;){const u=t.children[a],d={},f=o?o[a]:void 0;f&&(d.align=f);let g={type:"element",tagName:s,properties:d,children:[]};u&&(g.children=e.all(u),e.patch(u,g),g=e.applyData(u,g)),c.push(g)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function A2(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ug=9,hg=32;function B2(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(dg(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(dg(t.slice(i),i>0,!1)),s.join("")}function dg(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===ug||s===hg;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===ug||s===hg;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function N2(e,t){const n={type:"text",value:B2(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function z2(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const O2={blockquote:f2,break:p2,code:g2,delete:m2,emphasis:_2,footnoteReference:v2,heading:y2,html:S2,imageReference:w2,image:x2,inlineCode:b2,linkReference:k2,link:C2,listItem:E2,list:R2,paragraph:I2,root:P2,strong:L2,table:D2,tableCell:A2,tableRow:M2,text:N2,thematicBreak:z2,toml:al,yaml:al,definition:al,footnoteDefinition:al};function al(){}const Xy=-1,Ha=0,Js=1,fa=2,rf=3,sf=4,of=5,lf=6,Gy=7,Qy=8,fg=typeof self=="object"?self:globalThis,j2=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case Ha:case Xy:return n(o,i);case Js:{const l=n([],i);for(const a of o)l.push(r(a));return l}case fa:{const l=n({},i);for(const[a,c]of o)l[r(a)]=r(c);return l}case rf:return n(new Date(o),i);case sf:{const{source:l,flags:a}=o;return n(new RegExp(l,a),i)}case of:{const l=n(new Map,i);for(const[a,c]of o)l.set(r(a),r(c));return l}case lf:{const l=n(new Set,i);for(const a of o)l.add(r(a));return l}case Gy:{const{name:l,message:a}=o;return n(new fg[l](a),i)}case Qy:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new fg[s](o),i)};return r},pg=e=>j2(new Map,e)(0),Ei="",{toString:F2}={},{keys:$2}=Object,ks=e=>{const t=typeof e;if(t!=="object"||!e)return[Ha,t];const n=F2.call(e).slice(8,-1);switch(n){case"Array":return[Js,Ei];case"Object":return[fa,Ei];case"Date":return[rf,Ei];case"RegExp":return[sf,Ei];case"Map":return[of,Ei];case"Set":return[lf,Ei];case"DataView":return[Js,n]}return n.includes("Array")?[Js,n]:n.includes("Error")?[Gy,n]:[fa,n]},cl=([e,t])=>e===Ha&&(t==="function"||t==="symbol"),W2=(e,t,n,r)=>{const i=(o,l)=>{const a=r.push(o)-1;return n.set(l,a),a},s=o=>{if(n.has(o))return n.get(o);let[l,a]=ks(o);switch(l){case Ha:{let h=o;switch(a){case"bigint":l=Qy,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);h=null;break;case"undefined":return i([Xy],o)}return i([l,h],o)}case Js:{if(a){let d=o;return a==="DataView"?d=new Uint8Array(o.buffer):a==="ArrayBuffer"&&(d=new Uint8Array(o)),i([a,[...d]],o)}const h=[],u=i([l,h],o);for(const d of o)h.push(s(d));return u}case fa:{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 d of $2(o))(e||!cl(ks(o[d])))&&h.push([s(d),s(o[d])]);return u}case rf:return i([l,o.toISOString()],o);case sf:{const{source:h,flags:u}=o;return i([l,{source:h,flags:u}],o)}case of:{const h=[],u=i([l,h],o);for(const[d,f]of o)(e||!(cl(ks(d))||cl(ks(f))))&&h.push([s(d),s(f)]);return u}case lf:{const h=[],u=i([l,h],o);for(const d of o)(e||!cl(ks(d)))&&h.push(s(d));return u}}const{message:c}=o;return i([l,{name:a,message:c}],o)};return s},gg=(e,{json:t,lossy:n}={})=>{const r=[];return W2(!(t||n),!!t,new Map,r)(e),r},pa=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?pg(gg(e,t)):structuredClone(e):(e,t)=>pg(gg(e,t));function H2(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function U2(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function K2(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||H2,r=e.options.footnoteBackLabel||U2,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(),d=hs(u.toLowerCase());let f=0;const g=[],m=e.footnoteCounts.get(u);for(;m!==void 0&&++f<=m;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(a,f);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(a,f),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const v=w.children[w.children.length-1];v&&v.type==="text"?v.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...g)}else h.push(...g);const _={type:"element",tagName:"li",properties:{id:t+"fn-"+d},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:{...pa(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
75
75
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
76
- `}]}}const Ma=function(e){if(e==null)return $2;if(typeof e=="function")return Aa(e);if(typeof e=="object")return Array.isArray(e)?O2(e):j2(e);if(typeof e=="string")return F2(e);throw new Error("Expected function, string, or object as test")};function O2(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ma(e[n]);return Aa(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function j2(e){const t=e;return Aa(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function F2(e){return Aa(t);function t(n){return n&&n.type===e}}function Aa(e){return t;function t(n,r,i){return!!(W2(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function $2(){return!0}function W2(e){return e!==null&&typeof e=="object"&&"type"in e}const $y=[],H2=!0,Xu=!1,U2="skip";function Wy(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Ma(i),o=r?-1:1;l(e,void 0,[])();function l(a,c,h){const u=a&&typeof a=="object"?a:{};if(typeof u.type=="string"){const f=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(d,"name",{value:"node ("+(a.type+(f?"<"+f+">":""))+")"})}return d;function d(){let f=$y,g,m,w;if((!t||s(a,c,h[h.length-1]||void 0))&&(f=K2(n(a,h)),f[0]===Xu))return f;if("children"in a&&a.children){const _=a;if(_.children&&f[0]!==U2)for(m=(r?_.children.length:-1)+o,w=h.concat(_);m>-1&&m<_.children.length;){const v=_.children[m];if(g=l(v,m,w)(),g[0]===Xu)return g;m=typeof g[1]=="number"?g[1]:m+o}}return f}}}function K2(e){return Array.isArray(e)?e:typeof e=="number"?[H2,e]:e==null?$y:[e]}function Ba(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),Wy(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 Gu={}.hasOwnProperty,V2={};function q2(e,t){const n=t||V2,r=new Map,i=new Map,s=new Map,o={...L2,...n.handlers},l={all:c,applyData:X2,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:a,options:n,patch:Y2,wrap:Q2};return Ba(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const u=h.type==="definition"?r:i,d=String(h.identifier).toUpperCase();u.has(d)||u.set(d,h)}}),l;function a(h,u){const d=h.type,f=l.handlers[d];if(Gu.call(l.handlers,d)&&f)return f(l,h,u);if(l.options.passThrough&&l.options.passThrough.includes(d)){if("children"in h){const{children:m,...w}=h,_=ra(w);return _.children=l.all(h),_}return ra(h)}return(l.options.unknownHandler||G2)(l,h,u)}function c(h){const u=[];if("children"in h){const d=h.children;let f=-1;for(;++f<d.length;){const g=l.one(d[f],h);if(g){if(f&&d[f-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=sg(g.value)),!Array.isArray(g)&&g.type==="element")){const m=g.children[0];m&&m.type==="text"&&(m.value=sg(m.value))}Array.isArray(g)?u.push(...g):u.push(g)}}}return u}}function Y2(e,t){e.position&&(t.position=Nb(e))}function X2(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,ra(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function G2(e,t){const n=t.data||{},r="value"in t&&!(Gu.call(n,"hProperties")||Gu.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Q2(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
76
+ `}]}}const Ua=function(e){if(e==null)return X2;if(typeof e=="function")return Ka(e);if(typeof e=="object")return Array.isArray(e)?V2(e):q2(e);if(typeof e=="string")return Y2(e);throw new Error("Expected function, string, or object as test")};function V2(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ua(e[n]);return Ka(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function q2(e){const t=e;return Ka(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function Y2(e){return Ka(t);function t(n){return n&&n.type===e}}function Ka(e){return t;function t(n,r,i){return!!(G2(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function X2(){return!0}function G2(e){return e!==null&&typeof e=="object"&&"type"in e}const Zy=[],Q2=!0,oh=!1,Z2="skip";function Jy(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Ua(i),o=r?-1:1;l(e,void 0,[])();function l(a,c,h){const u=a&&typeof a=="object"?a:{};if(typeof u.type=="string"){const f=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(d,"name",{value:"node ("+(a.type+(f?"<"+f+">":""))+")"})}return d;function d(){let f=Zy,g,m,w;if((!t||s(a,c,h[h.length-1]||void 0))&&(f=J2(n(a,h)),f[0]===oh))return f;if("children"in a&&a.children){const _=a;if(_.children&&f[0]!==Z2)for(m=(r?_.children.length:-1)+o,w=h.concat(_);m>-1&&m<_.children.length;){const v=_.children[m];if(g=l(v,m,w)(),g[0]===oh)return g;m=typeof g[1]=="number"?g[1]:m+o}}return f}}}function J2(e){return Array.isArray(e)?e:typeof e=="number"?[Q2,e]:e==null?Zy:[e]}function Va(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),Jy(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 lh={}.hasOwnProperty,eE={};function tE(e,t){const n=t||eE,r=new Map,i=new Map,s=new Map,o={...O2,...n.handlers},l={all:c,applyData:rE,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:a,options:n,patch:nE,wrap:sE};return Va(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const u=h.type==="definition"?r:i,d=String(h.identifier).toUpperCase();u.has(d)||u.set(d,h)}}),l;function a(h,u){const d=h.type,f=l.handlers[d];if(lh.call(l.handlers,d)&&f)return f(l,h,u);if(l.options.passThrough&&l.options.passThrough.includes(d)){if("children"in h){const{children:m,...w}=h,_=pa(w);return _.children=l.all(h),_}return pa(h)}return(l.options.unknownHandler||iE)(l,h,u)}function c(h){const u=[];if("children"in h){const d=h.children;let f=-1;for(;++f<d.length;){const g=l.one(d[f],h);if(g){if(f&&d[f-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=mg(g.value)),!Array.isArray(g)&&g.type==="element")){const m=g.children[0];m&&m.type==="text"&&(m.value=mg(m.value))}Array.isArray(g)?u.push(...g):u.push(g)}}}return u}}function nE(e,t){e.position&&(t.position=Ub(e))}function rE(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,pa(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function iE(e,t){const n=t.data||{},r="value"in t&&!(lh.call(n,"hProperties")||lh.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function sE(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
77
77
  `});++r<e.length;)r&&n.push({type:"text",value:`
78
78
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
79
- `}),n}function sg(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function og(e,t){const n=q2(e,t),r=n.one(e,void 0),i=z2(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
80
- `},i),s}function Z2(e,t){return e&&"run"in e?async function(n,r){const i=og(n,{file:r,...t});await e.run(i,r)}:function(n,r){return og(n,{file:r,...e||t})}}function lg(e){if(e)throw e}var wl=Object.prototype.hasOwnProperty,Hy=Object.prototype.toString,ag=Object.defineProperty,cg=Object.getOwnPropertyDescriptor,ug=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Hy.call(t)==="[object Array]"},hg=function(t){if(!t||Hy.call(t)!=="[object Object]")return!1;var n=wl.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&wl.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||wl.call(t,i)},dg=function(t,n){ag&&n.name==="__proto__"?ag(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},fg=function(t,n){if(n==="__proto__")if(wl.call(t,n)){if(cg)return cg(t,n).value}else return;return t[n]},J2=function e(){var t,n,r,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(n in t)r=fg(l,n),i=fg(t,n),l!==i&&(h&&i&&(hg(i)||(s=ug(i)))?(s?(s=!1,o=r&&ug(r)?r:[]):o=r&&hg(r)?r:{},dg(l,{name:n,newValue:e(h,o,i)})):typeof i<"u"&&dg(l,{name:n,newValue:i}));return l};const _c=jh(J2);function Qu(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 eE(){const e=[],t={run:n,use:r};return t;function n(...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?tE(h,l)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function tE(e,t){let n;return r;function r(...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&&n)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){n||(n=!0,t(o,...l))}function s(o){i(null,o)}}const An={basename:nE,dirname:rE,extname:iE,join:sE,sep:"/"};function nE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ro(e);let n=0,r=-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){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function rE(e){if(Ro(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function iE(e){Ro(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function sE(...e){let t=-1,n;for(;++t<e.length;)Ro(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":oE(n)}function oE(e){Ro(e);const t=e.codePointAt(0)===47;let n=lE(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function lE(e,t){let n="",r=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(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(a=n.lastIndexOf("/"),a!==n.length-1){a<0?(n="",r=0):(n=n.slice(0,a),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function Ro(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const aE={cwd:cE};function cE(){return"/"}function Zu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function uE(e){if(typeof e=="string")e=new URL(e);else if(!Zu(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 hE(e)}function hE(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===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 vc=["history","path","basename","stem","extname","dirname"];class Uy{constructor(t){let n;t?Zu(t)?n={path:t}:typeof t=="string"||dE(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":aE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<vc.length;){const s=vc[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)vc.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?An.basename(this.path):void 0}set basename(t){Sc(t,"basename"),yc(t,"basename"),this.path=An.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?An.dirname(this.path):void 0}set dirname(t){pg(this.basename,"dirname"),this.path=An.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?An.extname(this.path):void 0}set extname(t){if(yc(t,"extname"),pg(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=An.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Zu(t)&&(t=uE(t)),Sc(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?An.basename(this.path,this.extname):void 0}set stem(t){Sc(t,"stem"),yc(t,"stem"),this.path=An.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new It(t,n,r);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 yc(e,t){if(e&&e.includes(An.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+An.sep+"`")}function Sc(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function pg(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function dE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const fE=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},pE={}.hasOwnProperty;class Gd extends fE{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=eE()}copy(){const t=new Gd;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(_c(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(bc("data",this.frozen),this.namespace[t]=n,this):pE.call(this.namespace,t)&&this.namespace[t]||void 0:t?(bc("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[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Jo(t),r=this.parser||this.Parser;return wc("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),wc("process",this.parser||this.Parser),xc("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const l=Jo(t),a=r.parse(l);r.run(a,l,function(h,u,d){if(h||!u||!d)return c(h);const f=u,g=r.stringify(f,d);_E(g)?d.value=g:d.result=g,c(h,d)});function c(h,u){h||!u?o(h):s?s(u):n(void 0,u)}}}processSync(t){let n=!1,r;return this.freeze(),wc("processSync",this.parser||this.Parser),xc("processSync",this.compiler||this.Compiler),this.process(t,i),mg("processSync","process",n),r;function i(s,o){n=!0,lg(s),r=o}}run(t,n,r){gg(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,l){const a=Jo(n);i.run(t,a,c);function c(h,u,d){const f=u||t;h?l(h):o?o(f):r(void 0,f,d)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),mg("runSync","run",r),i;function s(o,l){lg(o),i=l,r=!0}}stringify(t,n){this.freeze();const r=Jo(n),i=this.compiler||this.Compiler;return xc("stringify",i),gg(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(bc("use",this.frozen),t!=null)if(typeof t=="function")a(t,n);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=_c(!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,d=-1;for(;++u<r.length;)if(r[u][0]===c){d=u;break}if(d===-1)r.push([c,...h]);else if(h.length>0){let[f,...g]=h;const m=r[d][1];Qu(m)&&Qu(f)&&(f=_c(!0,m,f)),r[d]=[c,f,...g]}}}}const gE=new Gd().freeze();function wc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function xc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function bc(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 gg(e){if(!Qu(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function mg(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Jo(e){return mE(e)?e:new Uy(e)}function mE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _E(e){return typeof e=="string"||vE(e)}function vE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_g=[],vg={allowDangerousHtml:!0},SE=/^(https?|ircs?|mailto|xmpp)$/i,wE=[{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 kc(e){const t=xE(e),n=bE(e);return kE(t.runSync(t.parse(n),n),e)}function xE(e){const t=e.rehypePlugins||_g,n=e.remarkPlugins||_g,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vg}:vg;return gE().use(i2).use(n).use(Z2,r).use(t)}function bE(e){const t=e.children||"",n=new Uy;return typeof t=="string"&&(n.value=t),n}function kE(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||CE;for(const h of wE)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+yE+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Ba(e,c),$b(e,{Fragment:p.Fragment,components:i,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function c(h,u,d){if(h.type==="raw"&&d&&typeof u=="number")return o?d.children.splice(u,1):d.children[u]={type:"text",value:h.value},u;if(h.type==="element"){let f;for(f in pc)if(Object.hasOwn(pc,f)&&Object.hasOwn(h.properties,f)){const g=h.properties[f],m=pc[f];(m===null||m.includes(h.tagName))&&(h.properties[f]=a(String(g||""),f,h))}}if(h.type==="element"){let f=n?!n.includes(h.tagName):s?s.includes(h.tagName):!1;if(!f&&r&&typeof u=="number"&&(f=!r(h,u,d)),f&&d&&typeof u=="number")return l&&h.children?d.children.splice(u,1,...h.children):d.children.splice(u,1),u}}}function CE(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||SE.test(e.slice(0,t))?e:""}function yg(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function EE(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ky(e,t,n){const i=Ma((n||{}).ignore||[]),s=TE(t);let o=-1;for(;++o<s.length;)Wy(e,"text",l);function l(c,h){let u=-1,d;for(;++u<h.length;){const f=h[u],g=d?d.children:void 0;if(i(f,g?g.indexOf(f):void 0,d))return;d=f}if(d)return a(c,h)}function a(c,h){const u=h[h.length-1],d=s[o][0],f=s[o][1];let g=0;const w=u.children.indexOf(c);let _=!1,v=[];d.lastIndex=0;let y=d.exec(c.value);for(;y;){const E=y.index,R={index:y.index,input:y.input,stack:[...h,c]};let C=f(...y,R);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?d.lastIndex=E+1:(g!==E&&v.push({type:"text",value:c.value.slice(g,E)}),Array.isArray(C)?v.push(...C):C&&v.push(C),g=E+y[0].length,_=!0),!d.global)break;y=d.exec(c.value)}return _?(g<c.value.length&&v.push({type:"text",value:c.value.slice(g)}),u.children.splice(w,1,...v)):v=[c],w+v.length}}function TE(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([RE(i[0]),IE(i[1])])}return t}function RE(e){return typeof e=="string"?new RegExp(EE(e),"g"):e}function IE(e){return typeof e=="function"?e:function(){return e}}const Cc="phrasing",Ec=["autolink","link","image","label"];function LE(){return{transforms:[zE],enter:{literalAutolink:DE,literalAutolinkEmail:Tc,literalAutolinkHttp:Tc,literalAutolinkWww:Tc},exit:{literalAutolink:NE,literalAutolinkEmail:BE,literalAutolinkHttp:ME,literalAutolinkWww:AE}}}function PE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Cc,notInConstruct:Ec},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Cc,notInConstruct:Ec},{character:":",before:"[ps]",after:"\\/",inConstruct:Cc,notInConstruct:Ec}]}}function DE(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Tc(e){this.config.enter.autolinkProtocol.call(this,e)}function ME(e){this.config.exit.autolinkProtocol.call(this,e)}function AE(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 BE(e){this.config.exit.autolinkEmail.call(this,e)}function NE(e){this.exit(e)}function zE(e){Ky(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,OE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),jE]],{ignore:["link","linkReference"]})}function OE(e,t,n,r,i){let s="";if(!Vy(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!FE(n)))return!1;const o=$E(n+r);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 jE(e,t,n,r){return!Vy(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function FE(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 $E(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=yg(e,"(");let s=yg(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Vy(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ai(n)||La(n))&&(!t||n!==47)}qy.peek=GE;function WE(){this.buffer()}function HE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function UE(){this.buffer()}function KE(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function VE(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=En(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qE(e){this.exit(e)}function YE(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=En(this.sliceSerialize(e)).toLowerCase(),n.label=t}function XE(e){this.exit(e)}function GE(){return"["}function qy(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function QE(){return{enter:{gfmFootnoteCallString:WE,gfmFootnoteCall:HE,gfmFootnoteDefinitionLabelString:UE,gfmFootnoteDefinition:KE},exit:{gfmFootnoteCallString:VE,gfmFootnoteCall:qE,gfmFootnoteDefinitionLabelString:YE,gfmFootnoteDefinition:XE}}}function ZE(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:qy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,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(r),{before:a,after:"]"})),h(),a+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),a+=l.move((t?`
81
- `:" ")+s.indentLines(s.containerFlow(r,l.current()),t?Yy:JE))),c(),a}}function JE(e,t,n){return t===0?e:Yy(e,t,n)}function Yy(e,t,n){return(n?"":" ")+e}const e5=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Xy.peek=s5;function t5(){return{canContainEols:["delete"],enter:{strikethrough:r5},exit:{strikethrough:i5}}}function n5(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:e5}],handlers:{delete:Xy}}}function r5(e){this.enter({type:"delete",children:[]},e)}function i5(e){this.exit(e)}function Xy(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function s5(){return"~"}function o5(e){return e.length}function l5(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||o5,s=[],o=[],l=[],a=[];let c=0,h=-1;for(;++h<e.length;){const m=[],w=[];let _=-1;for(e[h].length>c&&(c=e[h].length);++_<e[h].length;){const v=a5(e[h][_]);if(n.alignDelimiters!==!1){const y=i(v);w[_]=y,(a[_]===void 0||y>a[_])&&(a[_]=y)}m.push(v)}o[h]=m,l[h]=w}let u=-1;if(typeof r=="object"&&"length"in r)for(;++u<c;)s[u]=Sg(r[u]);else{const m=Sg(r);for(;++u<c;)s[u]=m}u=-1;const d=[],f=[];for(;++u<c;){const m=s[u];let w="",_="";m===99?(w=":",_=":"):m===108?w=":":m===114&&(_=":");let v=n.alignDelimiters===!1?1:Math.max(1,a[u]-w.length-_.length);const y=w+"-".repeat(v)+_;n.alignDelimiters!==!1&&(v=w.length+v+_.length,v>a[u]&&(a[u]=v),f[u]=v),d[u]=y}o.splice(1,0,d),l.splice(1,0,f),h=-1;const g=[];for(;++h<o.length;){const m=o[h],w=l[h];u=-1;const _=[];for(;++u<c;){const v=m[u]||"";let y="",E="";if(n.alignDelimiters!==!1){const R=a[u]-(w[u]||0),C=s[u];C===114?y=" ".repeat(R):C===99?R%2?(y=" ".repeat(R/2+.5),E=" ".repeat(R/2-.5)):(y=" ".repeat(R/2),E=y):E=" ".repeat(R)}n.delimiterStart!==!1&&!u&&_.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||u)&&_.push(" "),n.alignDelimiters!==!1&&_.push(y),_.push(v),n.alignDelimiters!==!1&&_.push(E),n.padding!==!1&&_.push(" "),(n.delimiterEnd!==!1||u!==c-1)&&_.push("|")}g.push(n.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return g.join(`
82
- `)}function a5(e){return e==null?"":String(e)}function Sg(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 c5(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),u5);return i(),o}function u5(e,t,n){return">"+(n?"":" ")+e}function h5(e,t){return wg(e,t.inConstruct,!0)&&!wg(e,t.notInConstruct,!1)}function wg(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function xg(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
83
- `&&h5(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
84
- `}function d5(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function f5(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 p5(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 g5(e,t,n,r){const i=p5(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(f5(e,n)){const u=n.enter("codeIndented"),d=n.indentLines(s,m5);return u(),d}const l=n.createTracker(r),a=i.repeat(Math.max(d5(s,i)+1,3)),c=n.enter("codeFenced");let h=l.move(a);if(e.lang){const u=n.enter(`codeFencedLang${o}`);h+=l.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...l.current()})),u()}if(e.lang&&e.meta){const u=n.enter(`codeFencedMeta${o}`);h+=l.move(" "),h+=l.move(n.safe(e.meta,{before:h,after:`
79
+ `}),n}function mg(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function _g(e,t){const n=tE(e,t),r=n.one(e,void 0),i=K2(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
80
+ `},i),s}function oE(e,t){return e&&"run"in e?async function(n,r){const i=_g(n,{file:r,...t});await e.run(i,r)}:function(n,r){return _g(n,{file:r,...e||t})}}function vg(e){if(e)throw e}var Dl=Object.prototype.hasOwnProperty,e0=Object.prototype.toString,yg=Object.defineProperty,Sg=Object.getOwnPropertyDescriptor,wg=function(t){return typeof Array.isArray=="function"?Array.isArray(t):e0.call(t)==="[object Array]"},xg=function(t){if(!t||e0.call(t)!=="[object Object]")return!1;var n=Dl.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Dl.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Dl.call(t,i)},bg=function(t,n){yg&&n.name==="__proto__"?yg(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},kg=function(t,n){if(n==="__proto__")if(Dl.call(t,n)){if(Sg)return Sg(t,n).value}else return;return t[n]},lE=function e(){var t,n,r,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(n in t)r=kg(l,n),i=kg(t,n),l!==i&&(h&&i&&(xg(i)||(s=wg(i)))?(s?(s=!1,o=r&&wg(r)?r:[]):o=r&&xg(r)?r:{},bg(l,{name:n,newValue:e(h,o,i)})):typeof i<"u"&&bg(l,{name:n,newValue:i}));return l};const Rc=Gh(lE);function ah(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 aE(){const e=[],t={run:n,use:r};return t;function n(...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?cE(h,l)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function cE(e,t){let n;return r;function r(...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&&n)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){n||(n=!0,t(o,...l))}function s(o){i(null,o)}}const Un={basename:uE,dirname:hE,extname:dE,join:fE,sep:"/"};function uE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');No(e);let n=0,r=-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){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function hE(e){if(No(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function dE(e){No(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function fE(...e){let t=-1,n;for(;++t<e.length;)No(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":pE(n)}function pE(e){No(e);const t=e.codePointAt(0)===47;let n=gE(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function gE(e,t){let n="",r=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(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(a=n.lastIndexOf("/"),a!==n.length-1){a<0?(n="",r=0):(n=n.slice(0,a),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function No(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const mE={cwd:_E};function _E(){return"/"}function ch(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function vE(e){if(typeof e=="string")e=new URL(e);else if(!ch(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 yE(e)}function yE(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===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 Ic=["history","path","basename","stem","extname","dirname"];class t0{constructor(t){let n;t?ch(t)?n={path:t}:typeof t=="string"||SE(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":mE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ic.length;){const s=Ic[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Ic.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Un.basename(this.path):void 0}set basename(t){Lc(t,"basename"),Pc(t,"basename"),this.path=Un.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Un.dirname(this.path):void 0}set dirname(t){Cg(this.basename,"dirname"),this.path=Un.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Un.extname(this.path):void 0}set extname(t){if(Pc(t,"extname"),Cg(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=Un.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ch(t)&&(t=vE(t)),Lc(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Un.basename(this.path,this.extname):void 0}set stem(t){Lc(t,"stem"),Pc(t,"stem"),this.path=Un.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Nt(t,n,r);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 Pc(e,t){if(e&&e.includes(Un.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Un.sep+"`")}function Lc(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Cg(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function SE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wE=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},xE={}.hasOwnProperty;class af extends wE{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=aE()}copy(){const t=new af;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Rc(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ac("data",this.frozen),this.namespace[t]=n,this):xE.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ac("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[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ul(t),r=this.parser||this.Parser;return Dc("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Dc("process",this.parser||this.Parser),Mc("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const l=ul(t),a=r.parse(l);r.run(a,l,function(h,u,d){if(h||!u||!d)return c(h);const f=u,g=r.stringify(f,d);CE(g)?d.value=g:d.result=g,c(h,d)});function c(h,u){h||!u?o(h):s?s(u):n(void 0,u)}}}processSync(t){let n=!1,r;return this.freeze(),Dc("processSync",this.parser||this.Parser),Mc("processSync",this.compiler||this.Compiler),this.process(t,i),Tg("processSync","process",n),r;function i(s,o){n=!0,vg(s),r=o}}run(t,n,r){Eg(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,l){const a=ul(n);i.run(t,a,c);function c(h,u,d){const f=u||t;h?l(h):o?o(f):r(void 0,f,d)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),Tg("runSync","run",r),i;function s(o,l){vg(o),i=l,r=!0}}stringify(t,n){this.freeze();const r=ul(n),i=this.compiler||this.Compiler;return Mc("stringify",i),Eg(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Ac("use",this.frozen),t!=null)if(typeof t=="function")a(t,n);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=Rc(!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,d=-1;for(;++u<r.length;)if(r[u][0]===c){d=u;break}if(d===-1)r.push([c,...h]);else if(h.length>0){let[f,...g]=h;const m=r[d][1];ah(m)&&ah(f)&&(f=Rc(!0,m,f)),r[d]=[c,f,...g]}}}}const bE=new af().freeze();function Dc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Mc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ac(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 Eg(e){if(!ah(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Tg(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ul(e){return kE(e)?e:new t0(e)}function kE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function CE(e){return typeof e=="string"||EE(e)}function EE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const TE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Rg=[],Ig={allowDangerousHtml:!0},RE=/^(https?|ircs?|mailto|xmpp)$/i,IE=[{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 Bc(e){const t=PE(e),n=LE(e);return DE(t.runSync(t.parse(n),n),e)}function PE(e){const t=e.rehypePlugins||Rg,n=e.remarkPlugins||Rg,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ig}:Ig;return bE().use(d2).use(n).use(oE,r).use(t)}function LE(e){const t=e.children||"",n=new t0;return typeof t=="string"&&(n.value=t),n}function DE(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||ME;for(const h of IE)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+TE+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Va(e,c),Xb(e,{Fragment:p.Fragment,components:i,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function c(h,u,d){if(h.type==="raw"&&d&&typeof u=="number")return o?d.children.splice(u,1):d.children[u]={type:"text",value:h.value},u;if(h.type==="element"){let f;for(f in Cc)if(Object.hasOwn(Cc,f)&&Object.hasOwn(h.properties,f)){const g=h.properties[f],m=Cc[f];(m===null||m.includes(h.tagName))&&(h.properties[f]=a(String(g||""),f,h))}}if(h.type==="element"){let f=n?!n.includes(h.tagName):s?s.includes(h.tagName):!1;if(!f&&r&&typeof u=="number"&&(f=!r(h,u,d)),f&&d&&typeof u=="number")return l&&h.children?d.children.splice(u,1,...h.children):d.children.splice(u,1),u}}}function ME(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||RE.test(e.slice(0,t))?e:""}function Pg(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function AE(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function n0(e,t,n){const i=Ua((n||{}).ignore||[]),s=BE(t);let o=-1;for(;++o<s.length;)Jy(e,"text",l);function l(c,h){let u=-1,d;for(;++u<h.length;){const f=h[u],g=d?d.children:void 0;if(i(f,g?g.indexOf(f):void 0,d))return;d=f}if(d)return a(c,h)}function a(c,h){const u=h[h.length-1],d=s[o][0],f=s[o][1];let g=0;const w=u.children.indexOf(c);let _=!1,v=[];d.lastIndex=0;let y=d.exec(c.value);for(;y;){const E=y.index,R={index:y.index,input:y.input,stack:[...h,c]};let C=f(...y,R);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?d.lastIndex=E+1:(g!==E&&v.push({type:"text",value:c.value.slice(g,E)}),Array.isArray(C)?v.push(...C):C&&v.push(C),g=E+y[0].length,_=!0),!d.global)break;y=d.exec(c.value)}return _?(g<c.value.length&&v.push({type:"text",value:c.value.slice(g)}),u.children.splice(w,1,...v)):v=[c],w+v.length}}function BE(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([NE(i[0]),zE(i[1])])}return t}function NE(e){return typeof e=="string"?new RegExp(AE(e),"g"):e}function zE(e){return typeof e=="function"?e:function(){return e}}const Nc="phrasing",zc=["autolink","link","image","label"];function OE(){return{transforms:[KE],enter:{literalAutolink:FE,literalAutolinkEmail:Oc,literalAutolinkHttp:Oc,literalAutolinkWww:Oc},exit:{literalAutolink:UE,literalAutolinkEmail:HE,literalAutolinkHttp:$E,literalAutolinkWww:WE}}}function jE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Nc,notInConstruct:zc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Nc,notInConstruct:zc},{character:":",before:"[ps]",after:"\\/",inConstruct:Nc,notInConstruct:zc}]}}function FE(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Oc(e){this.config.enter.autolinkProtocol.call(this,e)}function $E(e){this.config.exit.autolinkProtocol.call(this,e)}function WE(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 HE(e){this.config.exit.autolinkEmail.call(this,e)}function UE(e){this.exit(e)}function KE(e){n0(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,VE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),qE]],{ignore:["link","linkReference"]})}function VE(e,t,n,r,i){let s="";if(!r0(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!YE(n)))return!1;const o=XE(n+r);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 qE(e,t,n,r){return!r0(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function YE(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 XE(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=Pg(e,"(");let s=Pg(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function r0(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||mi(n)||$a(n))&&(!t||n!==47)}i0.peek=i5;function GE(){this.buffer()}function QE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ZE(){this.buffer()}function JE(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function e5(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Nn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function t5(e){this.exit(e)}function n5(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Nn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function r5(e){this.exit(e)}function i5(){return"["}function i0(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function s5(){return{enter:{gfmFootnoteCallString:GE,gfmFootnoteCall:QE,gfmFootnoteDefinitionLabelString:ZE,gfmFootnoteDefinition:JE},exit:{gfmFootnoteCallString:e5,gfmFootnoteCall:t5,gfmFootnoteDefinitionLabelString:n5,gfmFootnoteDefinition:r5}}}function o5(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:i0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,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(r),{before:a,after:"]"})),h(),a+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),a+=l.move((t?`
81
+ `:" ")+s.indentLines(s.containerFlow(r,l.current()),t?s0:l5))),c(),a}}function l5(e,t,n){return t===0?e:s0(e,t,n)}function s0(e,t,n){return(n?"":" ")+e}const a5=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];o0.peek=f5;function c5(){return{canContainEols:["delete"],enter:{strikethrough:h5},exit:{strikethrough:d5}}}function u5(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:a5}],handlers:{delete:o0}}}function h5(e){this.enter({type:"delete",children:[]},e)}function d5(e){this.exit(e)}function o0(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function f5(){return"~"}function p5(e){return e.length}function g5(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||p5,s=[],o=[],l=[],a=[];let c=0,h=-1;for(;++h<e.length;){const m=[],w=[];let _=-1;for(e[h].length>c&&(c=e[h].length);++_<e[h].length;){const v=m5(e[h][_]);if(n.alignDelimiters!==!1){const y=i(v);w[_]=y,(a[_]===void 0||y>a[_])&&(a[_]=y)}m.push(v)}o[h]=m,l[h]=w}let u=-1;if(typeof r=="object"&&"length"in r)for(;++u<c;)s[u]=Lg(r[u]);else{const m=Lg(r);for(;++u<c;)s[u]=m}u=-1;const d=[],f=[];for(;++u<c;){const m=s[u];let w="",_="";m===99?(w=":",_=":"):m===108?w=":":m===114&&(_=":");let v=n.alignDelimiters===!1?1:Math.max(1,a[u]-w.length-_.length);const y=w+"-".repeat(v)+_;n.alignDelimiters!==!1&&(v=w.length+v+_.length,v>a[u]&&(a[u]=v),f[u]=v),d[u]=y}o.splice(1,0,d),l.splice(1,0,f),h=-1;const g=[];for(;++h<o.length;){const m=o[h],w=l[h];u=-1;const _=[];for(;++u<c;){const v=m[u]||"";let y="",E="";if(n.alignDelimiters!==!1){const R=a[u]-(w[u]||0),C=s[u];C===114?y=" ".repeat(R):C===99?R%2?(y=" ".repeat(R/2+.5),E=" ".repeat(R/2-.5)):(y=" ".repeat(R/2),E=y):E=" ".repeat(R)}n.delimiterStart!==!1&&!u&&_.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||u)&&_.push(" "),n.alignDelimiters!==!1&&_.push(y),_.push(v),n.alignDelimiters!==!1&&_.push(E),n.padding!==!1&&_.push(" "),(n.delimiterEnd!==!1||u!==c-1)&&_.push("|")}g.push(n.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return g.join(`
82
+ `)}function m5(e){return e==null?"":String(e)}function Lg(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 _5(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),v5);return i(),o}function v5(e,t,n){return">"+(n?"":" ")+e}function y5(e,t){return Dg(e,t.inConstruct,!0)&&!Dg(e,t.notInConstruct,!1)}function Dg(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Mg(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
83
+ `&&y5(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
84
+ `}function S5(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function w5(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 x5(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 b5(e,t,n,r){const i=x5(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(w5(e,n)){const u=n.enter("codeIndented"),d=n.indentLines(s,k5);return u(),d}const l=n.createTracker(r),a=i.repeat(Math.max(S5(s,i)+1,3)),c=n.enter("codeFenced");let h=l.move(a);if(e.lang){const u=n.enter(`codeFencedLang${o}`);h+=l.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...l.current()})),u()}if(e.lang&&e.meta){const u=n.enter(`codeFencedMeta${o}`);h+=l.move(" "),h+=l.move(n.safe(e.meta,{before:h,after:`
85
85
  `,encode:["`"],...l.current()})),u()}return h+=l.move(`
86
86
  `),s&&(h+=l.move(s+`
87
- `)),h+=l.move(a),c(),h}function m5(e,t,n){return(n?"":" ")+e}function Qd(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 _5(e,t,n,r){const i=Qd(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const a=n.createTracker(r);let c=a.move("[");return c+=a.move(n.safe(n.associationId(e),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":`
88
- `,...a.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(n.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),o(),c}function v5(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 ia(e,t,n){const r=Xi(e),i=Xi(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===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}}Gy.peek=y5;function Gy(e,t,n,r){const i=v5(n),s=n.enter("emphasis"),o=n.createTracker(r),l=o.move(i);let a=o.move(n.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),h=ia(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(a=po(c)+a.slice(1));const u=a.charCodeAt(a.length-1),d=ia(r.after.charCodeAt(0),u,i);d.inside&&(a=a.slice(0,-1)+po(u));const f=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},l+a+f}function y5(e,t,n){return n.options.emphasis||"*"}function S5(e,t){let n=!1;return Ba(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Xu}),!!((!e.depth||e.depth<3)&&Hd(e)&&(t.options.setext||n))}function w5(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(S5(e,n)){const h=n.enter("headingSetext"),u=n.enter("phrasing"),d=n.containerPhrasing(e,{...s.current(),before:`
87
+ `)),h+=l.move(a),c(),h}function k5(e,t,n){return(n?"":" ")+e}function cf(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 C5(e,t,n,r){const i=cf(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const a=n.createTracker(r);let c=a.move("[");return c+=a.move(n.safe(n.associationId(e),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":`
88
+ `,...a.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(n.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),o(),c}function E5(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 xo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ga(e,t,n){const r=rs(e),i=rs(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===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}}l0.peek=T5;function l0(e,t,n,r){const i=E5(n),s=n.enter("emphasis"),o=n.createTracker(r),l=o.move(i);let a=o.move(n.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),h=ga(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(a=xo(c)+a.slice(1));const u=a.charCodeAt(a.length-1),d=ga(r.after.charCodeAt(0),u,i);d.inside&&(a=a.slice(0,-1)+xo(u));const f=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},l+a+f}function T5(e,t,n){return n.options.emphasis||"*"}function R5(e,t){let n=!1;return Va(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,oh}),!!((!e.depth||e.depth<3)&&ef(e)&&(t.options.setext||n))}function I5(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(R5(e,n)){const h=n.enter("headingSetext"),u=n.enter("phrasing"),d=n.containerPhrasing(e,{...s.current(),before:`
89
89
  `,after:`
90
90
  `});return u(),h(),d+`
91
91
  `+(i===1?"=":"-").repeat(d.length-(Math.max(d.lastIndexOf("\r"),d.lastIndexOf(`
92
92
  `))+1))}const o="#".repeat(i),l=n.enter("headingAtx"),a=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
93
- `,...s.current()});return/^[\t ]/.test(c)&&(c=po(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),a(),l(),c}Qy.peek=x5;function Qy(e){return e.value||""}function x5(){return"<"}Zy.peek=b5;function Zy(e,t,n,r){const i=Qd(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const a=n.createTracker(r);let c=a.move("![");return c+=a.move(n.safe(e.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(n.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),o(),c}function b5(){return"!"}Jy.peek=k5;function Jy(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let a=l.move("![");const c=n.safe(e.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const u=n.safe(n.associationId(e),{before:a,after:"]",...l.current()});return o(),n.stack=h,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function k5(){return"!"}e0.peek=C5;function e0(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],l=n.compilePattern(o);let a;if(o.atBreak)for(;a=l.exec(r);){let c=a.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(a.index+1)}}return i+r+i}function C5(){return"`"}function t0(e,t){const n=Hd(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}n0.peek=E5;function n0(e,t,n,r){const i=Qd(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,a;if(t0(e,n)){const h=n.stack;n.stack=[],l=n.enter("autolink");let u=o.move("<");return u+=o.move(n.containerPhrasing(e,{before:u,after:">",...o.current()})),u+=o.move(">"),l(),n.stack=h,u}l=n.enter("link"),a=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(a=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),a(),e.title&&(a=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),a()),c+=o.move(")"),l(),c}function E5(e,t,n){return t0(e,n)?"<":"["}r0.peek=T5;function r0(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let a=l.move("[");const c=n.containerPhrasing(e,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const u=n.safe(n.associationId(e),{before:a,after:"]",...l.current()});return o(),n.stack=h,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function T5(){return"["}function Zd(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 R5(e){const t=Zd(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function I5(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 i0(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 L5(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?I5(n):Zd(n);const l=e.ordered?o==="."?")":".":R5(n);let a=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(a=!0),i0(n)===o&&h){let u=-1;for(;++u<e.children.length;){const d=e.children[u];if(d&&d.type==="listItem"&&d.children&&d.children[0]&&d.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(o=l),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),c}function P5(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 D5(e,t,n,r){const i=P5(n);let s=n.bulletCurrent||Zd(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.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=n.createTracker(r);l.move(s+" ".repeat(o-s.length)),l.shift(o);const a=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,l.current()),h);return a(),c;function h(u,d,f){return d?(f?"":" ".repeat(o))+u:(f?s:s+" ".repeat(o-s.length))+u}}function M5(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const A5=Ma(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function B5(e,t,n,r){return(e.children.some(function(o){return A5(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function N5(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}s0.peek=z5;function s0(e,t,n,r){const i=N5(n),s=n.enter("strong"),o=n.createTracker(r),l=o.move(i+i);let a=o.move(n.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),h=ia(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(a=po(c)+a.slice(1));const u=a.charCodeAt(a.length-1),d=ia(r.after.charCodeAt(0),u,i);d.inside&&(a=a.slice(0,-1)+po(u));const f=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},l+a+f}function z5(e,t,n){return n.options.strong||"*"}function O5(e,t,n,r){return n.safe(e.value,r)}function j5(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 F5(e,t,n){const r=(i0(n)+(n.options.ruleSpaces?" ":"")).repeat(j5(n));return n.options.ruleSpaces?r.slice(0,-1):r}const o0={blockquote:c5,break:xg,code:g5,definition:_5,emphasis:Gy,hardBreak:xg,heading:w5,html:Qy,image:Zy,imageReference:Jy,inlineCode:e0,link:n0,linkReference:r0,list:L5,listItem:D5,paragraph:M5,root:B5,strong:s0,text:O5,thematicBreak:F5};function $5(){return{enter:{table:W5,tableData:bg,tableHeader:bg,tableRow:U5},exit:{codeText:K5,table:H5,tableData:Rc,tableHeader:Rc,tableRow:Rc}}}function W5(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function H5(e){this.exit(e),this.data.inTable=void 0}function U5(e){this.enter({type:"tableRow",children:[]},e)}function Rc(e){this.exit(e)}function bg(e){this.enter({type:"tableCell",children:[]},e)}function K5(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,V5));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function V5(e,t){return t==="|"?t:e}function q5(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
93
+ `,...s.current()});return/^[\t ]/.test(c)&&(c=xo(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),a(),l(),c}a0.peek=P5;function a0(e){return e.value||""}function P5(){return"<"}c0.peek=L5;function c0(e,t,n,r){const i=cf(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const a=n.createTracker(r);let c=a.move("![");return c+=a.move(n.safe(e.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(n.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),o(),c}function L5(){return"!"}u0.peek=D5;function u0(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let a=l.move("![");const c=n.safe(e.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const u=n.safe(n.associationId(e),{before:a,after:"]",...l.current()});return o(),n.stack=h,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function D5(){return"!"}h0.peek=M5;function h0(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],l=n.compilePattern(o);let a;if(o.atBreak)for(;a=l.exec(r);){let c=a.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(a.index+1)}}return i+r+i}function M5(){return"`"}function d0(e,t){const n=ef(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}f0.peek=A5;function f0(e,t,n,r){const i=cf(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,a;if(d0(e,n)){const h=n.stack;n.stack=[],l=n.enter("autolink");let u=o.move("<");return u+=o.move(n.containerPhrasing(e,{before:u,after:">",...o.current()})),u+=o.move(">"),l(),n.stack=h,u}l=n.enter("link"),a=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(a=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),a(),e.title&&(a=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),a()),c+=o.move(")"),l(),c}function A5(e,t,n){return d0(e,n)?"<":"["}p0.peek=B5;function p0(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let a=l.move("[");const c=n.containerPhrasing(e,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const u=n.safe(n.associationId(e),{before:a,after:"]",...l.current()});return o(),n.stack=h,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function B5(){return"["}function uf(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 N5(e){const t=uf(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function z5(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 g0(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 O5(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?z5(n):uf(n);const l=e.ordered?o==="."?")":".":N5(n);let a=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(a=!0),g0(n)===o&&h){let u=-1;for(;++u<e.children.length;){const d=e.children[u];if(d&&d.type==="listItem"&&d.children&&d.children[0]&&d.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(o=l),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),c}function j5(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 F5(e,t,n,r){const i=j5(n);let s=n.bulletCurrent||uf(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.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=n.createTracker(r);l.move(s+" ".repeat(o-s.length)),l.shift(o);const a=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,l.current()),h);return a(),c;function h(u,d,f){return d?(f?"":" ".repeat(o))+u:(f?s:s+" ".repeat(o-s.length))+u}}function $5(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const W5=Ua(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function H5(e,t,n,r){return(e.children.some(function(o){return W5(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function U5(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}m0.peek=K5;function m0(e,t,n,r){const i=U5(n),s=n.enter("strong"),o=n.createTracker(r),l=o.move(i+i);let a=o.move(n.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),h=ga(r.before.charCodeAt(r.before.length-1),c,i);h.inside&&(a=xo(c)+a.slice(1));const u=a.charCodeAt(a.length-1),d=ga(r.after.charCodeAt(0),u,i);d.inside&&(a=a.slice(0,-1)+xo(u));const f=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},l+a+f}function K5(e,t,n){return n.options.strong||"*"}function V5(e,t,n,r){return n.safe(e.value,r)}function q5(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 Y5(e,t,n){const r=(g0(n)+(n.options.ruleSpaces?" ":"")).repeat(q5(n));return n.options.ruleSpaces?r.slice(0,-1):r}const _0={blockquote:_5,break:Mg,code:b5,definition:C5,emphasis:l0,hardBreak:Mg,heading:I5,html:a0,image:c0,imageReference:u0,inlineCode:h0,link:f0,linkReference:p0,list:O5,listItem:F5,paragraph:$5,root:H5,strong:m0,text:V5,thematicBreak:Y5};function X5(){return{enter:{table:G5,tableData:Ag,tableHeader:Ag,tableRow:Z5},exit:{codeText:J5,table:Q5,tableData:jc,tableHeader:jc,tableRow:jc}}}function G5(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Q5(e){this.exit(e),this.data.inTable=void 0}function Z5(e){this.enter({type:"tableRow",children:[]},e)}function jc(e){this.exit(e)}function Ag(e){this.enter({type:"tableCell",children:[]},e)}function J5(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,e4));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function e4(e,t){return t==="|"?t:e}function t4(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
94
94
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:d,table:o,tableCell:a,tableRow:l}};function o(f,g,m,w){return c(h(f,m,w),f.align)}function l(f,g,m,w){const _=u(f,m,w),v=c([_]);return v.slice(0,v.indexOf(`
95
- `))}function a(f,g,m,w){const _=m.enter("tableCell"),v=m.enter("phrasing"),y=m.containerPhrasing(f,{...w,before:s,after:s});return v(),_(),y}function c(f,g){return l5(f,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function h(f,g,m){const w=f.children;let _=-1;const v=[],y=g.enter("table");for(;++_<w.length;)v[_]=u(w[_],g,m);return y(),v}function u(f,g,m){const w=f.children;let _=-1;const v=[],y=g.enter("tableRow");for(;++_<w.length;)v[_]=a(w[_],f,g,m);return y(),v}function d(f,g,m){let w=o0.inlineCode(f,g,m);return m.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function Y5(){return{exit:{taskListCheckValueChecked:kg,taskListCheckValueUnchecked:kg,paragraph:G5}}}function X5(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Q5}}}function kg(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function G5(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.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===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Q5(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);s&&l.move(o);let a=o0.listItem(e,t,n,{...r,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(h){return h+o}}function Z5(){return[LE(),QE(),t5(),$5(),Y5()]}function J5(e){return{extensions:[PE(),ZE(e),n5(),q5(e),X5()]}}const e4={tokenize:o4,partial:!0},l0={tokenize:l4,partial:!0},a0={tokenize:a4,partial:!0},c0={tokenize:c4,partial:!0},t4={tokenize:u4,partial:!0},u0={name:"wwwAutolink",tokenize:i4,previous:d0},h0={name:"protocolAutolink",tokenize:s4,previous:f0},sr={name:"emailAutolink",tokenize:r4,previous:p0},Wn={};function n4(){return{text:Wn}}let jr=48;for(;jr<123;)Wn[jr]=sr,jr++,jr===58?jr=65:jr===91&&(jr=97);Wn[43]=sr;Wn[45]=sr;Wn[46]=sr;Wn[95]=sr;Wn[72]=[sr,h0];Wn[104]=[sr,h0];Wn[87]=[sr,u0];Wn[119]=[sr,u0];function r4(e,t,n){const r=this;let i,s;return o;function o(u){return!Ju(u)||!p0.call(r,r.previous)||Jd(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(u))}function l(u){return Ju(u)?(e.consume(u),l):u===64?(e.consume(u),a):n(u)}function a(u){return u===46?e.check(t4,h,c)(u):u===45||u===95||Tt(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&&Dt(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(u)):n(u)}}function i4(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!d0.call(r,r.previous)||Jd(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(e4,e.attempt(l0,e.attempt(a0,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function s4(e,t,n){const r=this;let i="",s=!1;return o;function o(u){return(u===72||u===104)&&f0.call(r,r.previous)&&!Jd(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(u),e.consume(u),l):n(u)}function l(u){if(Dt(u)&&i.length<5)return i+=String.fromCodePoint(u),e.consume(u),l;if(u===58){const d=i.toLowerCase();if(d==="http"||d==="https")return e.consume(u),a}return n(u)}function a(u){return u===47?(e.consume(u),s?c:(s=!0,a)):n(u)}function c(u){return u===null||ta(u)||Me(u)||ai(u)||La(u)?n(u):e.attempt(l0,e.attempt(a0,h),n)(u)}function h(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(u)}}function o4(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function l4(e,t,n){let r,i,s;return o;function o(c){return c===46||c===95?e.check(c0,a,l)(c):c===null||Me(c)||ai(c)||c!==45&&La(c)?a(c):(s=!0,e.consume(c),o)}function l(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),o}function a(c){return i||r||!s?n(c):t(c)}}function a4(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?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(c0,t,s)(o):o===null||Me(o)||ai(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function c4(e,t,n){return r;function r(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),r):l===38?(e.consume(l),s):l===93?(e.consume(l),i):l===60||l===null||Me(l)||ai(l)?t(l):n(l)}function i(l){return l===null||l===40||l===91||Me(l)||ai(l)?t(l):r(l)}function s(l){return Dt(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):Dt(l)?(e.consume(l),o):n(l)}}function u4(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return Tt(s)?n(s):t(s)}}function d0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Me(e)}function f0(e){return!Dt(e)}function p0(e){return!(e===47||Ju(e))}function Ju(e){return e===43||e===45||e===46||e===95||Tt(e)}function Jd(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const h4={tokenize:y4,partial:!0};function d4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:m4,continuation:{tokenize:_4},exit:v4}},text:{91:{name:"gfmFootnoteCall",tokenize:g4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:f4,resolveTo:p4}}}}function f4(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const a=r.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 n(a);const c=En(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function p4(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+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[n+1],e[n+2],["enter",r,t],e[n+3],e[n+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",r,t]];return e.splice(n,e.length-n+1,...l),e}function g4(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.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?n(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||Me(u))return n(u);if(u===93){e.exit("chunkString");const d=e.exit("gfmFootnoteCallString");return i.includes(En(r.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(u)}return Me(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 m4(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,l;return a;function a(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(g)}function h(g){if(o>999||g===93&&!l||g===null||g===91||Me(g))return n(g);if(g===93){e.exit("chunkString");const m=e.exit("gfmFootnoteDefinitionLabelString");return s=En(r.sliceSerialize(m)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return Me(g)||(l=!0),o++,e.consume(g),g===92?u:h}function u(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}function d(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(s)||i.push(s),Re(e,f,"gfmFootnoteDefinitionWhitespace")):n(g)}function f(g){return t(g)}}function _4(e,t,n){return e.check(To,t,e.attempt(h4,t,n))}function v4(e){e.exit("gfmFootnoteDefinition")}function y4(e,t,n){const r=this;return Re(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function S4(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},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)},d=[["enter",h,l],["enter",o[c][1],l],["exit",o[c][1],l],["enter",u,l]],f=l.parser.constructs.insideSpan.null;f&&Jt(d,d.length,0,Pa(f,o.slice(c+1,a),l)),Jt(d,d.length,0,[["exit",u,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",h,l]]),Jt(o,c-1,a-c+3,d),a=c+d.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 d;function d(g){return c===126&&h[h.length-1][1].type!=="characterEscape"?a(g):(o.enter("strikethroughSequenceTemporary"),f(g))}function f(g){const m=Xi(c);if(g===126)return u>1?a(g):(o.consume(g),u++,f);if(u<2&&!n)return a(g);const w=o.exit("strikethroughSequenceTemporary"),_=Xi(g);return w._open=!_||_===2&&!!m,w._close=!m||m===2&&!!_,l(g)}}}class w4{constructor(){this.map=[]}add(t,n,r){x4(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function x4(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function b4(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function k4(){return{flow:{null:{name:"table",tokenize:C4,resolveAll:E4}}}}function C4(e,t,n){const r=this;let i=0,s=0,o;return l;function l(T){let I=r.events.length-1;for(;I>-1;){const U=r.events[I][1].type;if(U==="lineEnding"||U==="linePrefix")I--;else break}const A=I>-1?r.events[I][1].type:null,P=A==="tableHead"||A==="tableRow"?C:a;return P===C&&r.parser.lazy[r.now().line]?n(T):P(T)}function a(T){return e.enter("tableHead"),e.enter("tableRow"),c(T)}function c(T){return T===124||(o=!0,s+=1),h(T)}function h(T){return T===null?n(T):me(T)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),f):n(T):Ce(T)?Re(e,h,"whitespace")(T):(s+=1,o&&(o=!1,i+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),u(T)))}function u(T){return T===null||T===124||Me(T)?(e.exit("data"),h(T)):(e.consume(T),T===92?d:u)}function d(T){return T===92||T===124?(e.consume(T),u):u(T)}function f(T){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(T):(e.enter("tableDelimiterRow"),o=!1,Ce(T)?Re(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):g(T))}function g(T){return T===45||T===58?w(T):T===124?(o=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),m):R(T)}function m(T){return Ce(T)?Re(e,w,"whitespace")(T):w(T)}function w(T){return T===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),_):T===45?(s+=1,_(T)):T===null||me(T)?E(T):R(T)}function _(T){return T===45?(e.enter("tableDelimiterFiller"),v(T)):R(T)}function v(T){return T===45?(e.consume(T),v):T===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(T))}function y(T){return Ce(T)?Re(e,E,"whitespace")(T):E(T)}function E(T){return T===124?g(T):T===null||me(T)?!o||i!==s?R(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):R(T)}function R(T){return n(T)}function C(T){return e.enter("tableRow"),M(T)}function M(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),M):T===null||me(T)?(e.exit("tableRow"),t(T)):Ce(T)?Re(e,M,"whitespace")(T):(e.enter("data"),$(T))}function $(T){return T===null||T===124||Me(T)?(e.exit("data"),M(T)):(e.consume(T),T===92?G:$)}function G(T){return T===92||T===124?(e.consume(T),$):$(T)}}function E4(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,a=0,c,h,u;const d=new w4;for(;++n<e.length;){const f=e[n],g=f[1];f[0]==="enter"?g.type==="tableHead"?(l=!1,a!==0&&(Cg(d,t,a,c,h),h=void 0,a=0),c={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},d.add(n,0,[["enter",c,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,u=void 0,s=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},d.add(n,0,[["enter",h,t]])),i=g.type==="tableDelimiterRow"?2:h?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],u=el(d,t,s,i,void 0,u),s=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],u=el(d,t,s,i,void 0,u)),s=o,o=[s[1],n,0,0])):g.type==="tableHead"?(l=!0,a=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(a=n,s[1]!==0?(o[0]=o[1],u=el(d,t,s,i,n,u)):o[1]!==0&&(u=el(d,t,o,i,n,u)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(a!==0&&Cg(d,t,a,c,h),d.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=b4(t.events,n))}return e}function el(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(s.end=Object.assign({},wi(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const a=wi(t.events,n[1]);if(s={type:o,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const c=wi(t.events,n[2]),h=wi(t.events,n[3]),u={type:l,start:Object.assign({},c),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",u,t]]),r!==2){const d=t.events[n[2]],f=t.events[n[3]];if(d[1].end=Object.assign({},f[1].end),d[1].type="chunkText",d[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,m=n[3]-n[2]-1;e.add(g,m,[])}}e.add(n[3]+1,0,[["exit",u,t]])}return i!==void 0&&(s.end=Object.assign({},wi(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Cg(e,t,n,r,i){const s=[],o=wi(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function wi(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const T4={name:"tasklistCheck",tokenize:I4};function R4(){return{text:{91:T4}}}function I4(e,t,n){const r=this;return i;function i(a){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),s)}function s(a){return Me(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):n(a)}function o(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(a)}function l(a){return me(a)?t(a):Ce(a)?e.check({tokenize:L4},t,n)(a):n(a)}}function L4(e,t,n){return Re(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function P4(e){return by([n4(),d4(),S4(e),k4(),R4()])}const D4={};function Ic(e){const t=this,n=e||D4,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(P4(n)),s.push(Z5()),o.push(J5(n))}const M4=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,A4=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,Eg=({legacyTitle:e=!1,tagName:t="div"}={})=>n=>{Ba(n,"blockquote",(r,i,s)=>{let o="",l="",a=!0,c=r.children.map(h=>{if(a&&h.type==="paragraph"){const u=h.children[0],d=u.type==="text"?u.value:"",f=e?A4:M4,g=d.match(f);if(g&&(a=!1,o=g[1].toLocaleLowerCase(),l=e&&g[2]||o.toLocaleUpperCase(),d.includes(`
95
+ `))}function a(f,g,m,w){const _=m.enter("tableCell"),v=m.enter("phrasing"),y=m.containerPhrasing(f,{...w,before:s,after:s});return v(),_(),y}function c(f,g){return g5(f,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function h(f,g,m){const w=f.children;let _=-1;const v=[],y=g.enter("table");for(;++_<w.length;)v[_]=u(w[_],g,m);return y(),v}function u(f,g,m){const w=f.children;let _=-1;const v=[],y=g.enter("tableRow");for(;++_<w.length;)v[_]=a(w[_],f,g,m);return y(),v}function d(f,g,m){let w=_0.inlineCode(f,g,m);return m.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function n4(){return{exit:{taskListCheckValueChecked:Bg,taskListCheckValueUnchecked:Bg,paragraph:i4}}}function r4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:s4}}}function Bg(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function i4(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.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===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function s4(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);s&&l.move(o);let a=_0.listItem(e,t,n,{...r,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(h){return h+o}}function o4(){return[OE(),s5(),c5(),X5(),n4()]}function l4(e){return{extensions:[jE(),o5(e),u5(),t4(e),r4()]}}const a4={tokenize:p4,partial:!0},v0={tokenize:g4,partial:!0},y0={tokenize:m4,partial:!0},S0={tokenize:_4,partial:!0},c4={tokenize:v4,partial:!0},w0={name:"wwwAutolink",tokenize:d4,previous:b0},x0={name:"protocolAutolink",tokenize:f4,previous:k0},fr={name:"emailAutolink",tokenize:h4,previous:C0},Zn={};function u4(){return{text:Zn}}let qr=48;for(;qr<123;)Zn[qr]=fr,qr++,qr===58?qr=65:qr===91&&(qr=97);Zn[43]=fr;Zn[45]=fr;Zn[46]=fr;Zn[95]=fr;Zn[72]=[fr,x0];Zn[104]=[fr,x0];Zn[87]=[fr,w0];Zn[119]=[fr,w0];function h4(e,t,n){const r=this;let i,s;return o;function o(u){return!uh(u)||!C0.call(r,r.previous)||hf(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(u))}function l(u){return uh(u)?(e.consume(u),l):u===64?(e.consume(u),a):n(u)}function a(u){return u===46?e.check(c4,h,c)(u):u===45||u===95||At(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(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(u)):n(u)}}function d4(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!b0.call(r,r.previous)||hf(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(a4,e.attempt(v0,e.attempt(y0,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function f4(e,t,n){const r=this;let i="",s=!1;return o;function o(u){return(u===72||u===104)&&k0.call(r,r.previous)&&!hf(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(u),e.consume(u),l):n(u)}function l(u){if($t(u)&&i.length<5)return i+=String.fromCodePoint(u),e.consume(u),l;if(u===58){const d=i.toLowerCase();if(d==="http"||d==="https")return e.consume(u),a}return n(u)}function a(u){return u===47?(e.consume(u),s?c:(s=!0,a)):n(u)}function c(u){return u===null||da(u)||Ne(u)||mi(u)||$a(u)?n(u):e.attempt(v0,e.attempt(y0,h),n)(u)}function h(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(u)}}function p4(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function g4(e,t,n){let r,i,s;return o;function o(c){return c===46||c===95?e.check(S0,a,l)(c):c===null||Ne(c)||mi(c)||c!==45&&$a(c)?a(c):(s=!0,e.consume(c),o)}function l(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),o}function a(c){return i||r||!s?n(c):t(c)}}function m4(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?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(S0,t,s)(o):o===null||Ne(o)||mi(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function _4(e,t,n){return r;function r(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),r):l===38?(e.consume(l),s):l===93?(e.consume(l),i):l===60||l===null||Ne(l)||mi(l)?t(l):n(l)}function i(l){return l===null||l===40||l===91||Ne(l)||mi(l)?t(l):r(l)}function s(l){return $t(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):$t(l)?(e.consume(l),o):n(l)}}function v4(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return At(s)?n(s):t(s)}}function b0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ne(e)}function k0(e){return!$t(e)}function C0(e){return!(e===47||uh(e))}function uh(e){return e===43||e===45||e===46||e===95||At(e)}function hf(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const y4={tokenize:T4,partial:!0};function S4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:k4,continuation:{tokenize:C4},exit:E4}},text:{91:{name:"gfmFootnoteCall",tokenize:b4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:w4,resolveTo:x4}}}}function w4(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const a=r.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 n(a);const c=Nn(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function x4(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+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[n+1],e[n+2],["enter",r,t],e[n+3],e[n+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",r,t]];return e.splice(n,e.length-n+1,...l),e}function b4(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.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?n(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||Ne(u))return n(u);if(u===93){e.exit("chunkString");const d=e.exit("gfmFootnoteCallString");return i.includes(Nn(r.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(u)}return Ne(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 k4(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,l;return a;function a(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(g)}function h(g){if(o>999||g===93&&!l||g===null||g===91||Ne(g))return n(g);if(g===93){e.exit("chunkString");const m=e.exit("gfmFootnoteDefinitionLabelString");return s=Nn(r.sliceSerialize(m)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return Ne(g)||(l=!0),o++,e.consume(g),g===92?u:h}function u(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}function d(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(s)||i.push(s),Pe(e,f,"gfmFootnoteDefinitionWhitespace")):n(g)}function f(g){return t(g)}}function C4(e,t,n){return e.check(Bo,t,e.attempt(y4,t,n))}function E4(e){e.exit("gfmFootnoteDefinition")}function T4(e,t,n){const r=this;return Pe(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function R4(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},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)},d=[["enter",h,l],["enter",o[c][1],l],["exit",o[c][1],l],["enter",u,l]],f=l.parser.constructs.insideSpan.null;f&&dn(d,d.length,0,Wa(f,o.slice(c+1,a),l)),dn(d,d.length,0,[["exit",u,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",h,l]]),dn(o,c-1,a-c+3,d),a=c+d.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 d;function d(g){return c===126&&h[h.length-1][1].type!=="characterEscape"?a(g):(o.enter("strikethroughSequenceTemporary"),f(g))}function f(g){const m=rs(c);if(g===126)return u>1?a(g):(o.consume(g),u++,f);if(u<2&&!n)return a(g);const w=o.exit("strikethroughSequenceTemporary"),_=rs(g);return w._open=!_||_===2&&!!m,w._close=!m||m===2&&!!_,l(g)}}}class I4{constructor(){this.map=[]}add(t,n,r){P4(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function P4(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function L4(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function D4(){return{flow:{null:{name:"table",tokenize:M4,resolveAll:A4}}}}function M4(e,t,n){const r=this;let i=0,s=0,o;return l;function l(T){let P=r.events.length-1;for(;P>-1;){const U=r.events[P][1].type;if(U==="lineEnding"||U==="linePrefix")P--;else break}const B=P>-1?r.events[P][1].type:null,D=B==="tableHead"||B==="tableRow"?C:a;return D===C&&r.parser.lazy[r.now().line]?n(T):D(T)}function a(T){return e.enter("tableHead"),e.enter("tableRow"),c(T)}function c(T){return T===124||(o=!0,s+=1),h(T)}function h(T){return T===null?n(T):me(T)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),f):n(T):Re(T)?Pe(e,h,"whitespace")(T):(s+=1,o&&(o=!1,i+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),u(T)))}function u(T){return T===null||T===124||Ne(T)?(e.exit("data"),h(T)):(e.consume(T),T===92?d:u)}function d(T){return T===92||T===124?(e.consume(T),u):u(T)}function f(T){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(T):(e.enter("tableDelimiterRow"),o=!1,Re(T)?Pe(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):g(T))}function g(T){return T===45||T===58?w(T):T===124?(o=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),m):R(T)}function m(T){return Re(T)?Pe(e,w,"whitespace")(T):w(T)}function w(T){return T===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),_):T===45?(s+=1,_(T)):T===null||me(T)?E(T):R(T)}function _(T){return T===45?(e.enter("tableDelimiterFiller"),v(T)):R(T)}function v(T){return T===45?(e.consume(T),v):T===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(T))}function y(T){return Re(T)?Pe(e,E,"whitespace")(T):E(T)}function E(T){return T===124?g(T):T===null||me(T)?!o||i!==s?R(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):R(T)}function R(T){return n(T)}function C(T){return e.enter("tableRow"),M(T)}function M(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),M):T===null||me(T)?(e.exit("tableRow"),t(T)):Re(T)?Pe(e,M,"whitespace")(T):(e.enter("data"),$(T))}function $(T){return T===null||T===124||Ne(T)?(e.exit("data"),M(T)):(e.consume(T),T===92?G:$)}function G(T){return T===92||T===124?(e.consume(T),$):$(T)}}function A4(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,a=0,c,h,u;const d=new I4;for(;++n<e.length;){const f=e[n],g=f[1];f[0]==="enter"?g.type==="tableHead"?(l=!1,a!==0&&(Ng(d,t,a,c,h),h=void 0,a=0),c={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},d.add(n,0,[["enter",c,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,u=void 0,s=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},d.add(n,0,[["enter",h,t]])),i=g.type==="tableDelimiterRow"?2:h?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],u=hl(d,t,s,i,void 0,u),s=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],u=hl(d,t,s,i,void 0,u)),s=o,o=[s[1],n,0,0])):g.type==="tableHead"?(l=!0,a=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(a=n,s[1]!==0?(o[0]=o[1],u=hl(d,t,s,i,n,u)):o[1]!==0&&(u=hl(d,t,o,i,n,u)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(a!==0&&Ng(d,t,a,c,h),d.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=L4(t.events,n))}return e}function hl(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(s.end=Object.assign({},Ii(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const a=Ii(t.events,n[1]);if(s={type:o,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const c=Ii(t.events,n[2]),h=Ii(t.events,n[3]),u={type:l,start:Object.assign({},c),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",u,t]]),r!==2){const d=t.events[n[2]],f=t.events[n[3]];if(d[1].end=Object.assign({},f[1].end),d[1].type="chunkText",d[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,m=n[3]-n[2]-1;e.add(g,m,[])}}e.add(n[3]+1,0,[["exit",u,t]])}return i!==void 0&&(s.end=Object.assign({},Ii(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Ng(e,t,n,r,i){const s=[],o=Ii(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function Ii(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const B4={name:"tasklistCheck",tokenize:z4};function N4(){return{text:{91:B4}}}function z4(e,t,n){const r=this;return i;function i(a){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),s)}function s(a){return Ne(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):n(a)}function o(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(a)}function l(a){return me(a)?t(a):Re(a)?e.check({tokenize:O4},t,n)(a):n(a)}}function O4(e,t,n){return Pe(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function j4(e){return Ay([u4(),S4(),R4(e),D4(),N4()])}const F4={};function Fc(e){const t=this,n=e||F4,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(j4(n)),s.push(o4()),o.push(l4(n))}const $4=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,W4=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,zg=({legacyTitle:e=!1,tagName:t="div"}={})=>n=>{Va(n,"blockquote",(r,i,s)=>{let o="",l="",a=!0,c=r.children.map(h=>{if(a&&h.type==="paragraph"){const u=h.children[0],d=u.type==="text"?u.value:"",f=e?W4:$4,g=d.match(f);if(g&&(a=!1,o=g[1].toLocaleLowerCase(),l=e&&g[2]||o.toLocaleUpperCase(),d.includes(`
96
96
  `)&&(h.children[0]={type:"text",value:d.replace(f,"").replace(/^\n+/,"")}),!d.includes(`
97
- `))){const m=[];h.children.forEach((w,_)=>{_!=0&&(_==1&&w.type==="break"||m.push(w))}),h.children=[...m]}}return h});o&&(r.data={hName:t,hProperties:{className:["markdown-alert",`markdown-alert-${o}`],dir:"auto"}},c.unshift({type:"paragraph",children:[B4(o),{type:"text",value:l.replace(/^\//,"")}],data:{hProperties:{className:"markdown-alert-title",dir:"auto"}}})),r.children=[...c]})};function B4(e){let t=N4[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 N4={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 z4(e){Ky(e,[/\r?\n|\r/g,O4])}function O4(){return{type:"break"}}function j4(){return function(e){z4(e)}}function F4(e){const n=e.split(`
97
+ `))){const m=[];h.children.forEach((w,_)=>{_!=0&&(_==1&&w.type==="break"||m.push(w))}),h.children=[...m]}}return h});o&&(r.data={hName:t,hProperties:{className:["markdown-alert",`markdown-alert-${o}`],dir:"auto"}},c.unshift({type:"paragraph",children:[H4(o),{type:"text",value:l.replace(/^\//,"")}],data:{hProperties:{className:"markdown-alert-title",dir:"auto"}}})),r.children=[...c]})};function H4(e){let t=U4[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 U4={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 K4(e){n0(e,[/\r?\n|\r/g,V4])}function V4(){return{type:"break"}}function q4(){return function(e){K4(e)}}function Y4(e){const n=e.split(`
98
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
99
  `).split(`
100
100
  `),r={},i=[];let s=!1;for(const l of n){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)r[h[1]]=(r[h[1]]||0)+1;else{const u=l.replace(/^[⏺●·⏵]\s*/,"").trim().slice(0,40);u&&(r[u]=(r[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
101
  `).replace(/\n{3,}/g,`
102
102
 
103
- `).trim();return{toolCounts:r,textContent:o,hasTools:Object.keys(r).length>0}}function Lc(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const g0=x.forwardRef(function({messages:t,actionLogs:n,agentName:r="Agent",isCliMode:i=!1,isWorking:s=!1,contextKey:o="",receivedAtMap:l={},emptyState:a,onLoadMore:c,isLoadingMore:h,hasMoreHistory:u},d){var U;const f=x.useRef(null),g=x.useRef(null),m=x.useRef(0),w=x.useRef(""),_=x.useRef(!1),[v,y]=x.useState(new Set),[E,R]=x.useState(new Set),C=x.useRef(!1),M=()=>{const B=f.current;return B?B.scrollHeight-B.scrollTop-B.clientHeight<200:!0},$=t.length>0?`${t.length}:${(((U=t[t.length-1])==null?void 0:U.content)||"").length}`:"0:0";x.useEffect(()=>{var L,W;const B=!_.current,j=w.current!==o;if(w.current=o,B||j){_.current=!0,C.current=!1;const S=()=>{var Q;(Q=g.current)==null||Q.scrollIntoView({behavior:"instant"})};requestAnimationFrame(()=>requestAnimationFrame(S)),setTimeout(S,100),setTimeout(S,300),m.current=t.length;return}t.length>m.current?C.current||(L=g.current)==null||L.scrollIntoView({behavior:"instant"}):M()&&!C.current&&((W=g.current)==null||W.scrollIntoView({behavior:"instant"})),m.current=t.length},[$,o,s]),x.useImperativeHandle(d,()=>({scrollToBottom:(B="smooth")=>{var j;(j=g.current)==null||j.scrollIntoView({behavior:B})}})),x.useEffect(()=>{const B=f.current;if(!B)return;let j;const H=()=>{clearTimeout(j),j=setTimeout(()=>{C.current=!M()},50)};return B.addEventListener("scroll",H,{passive:!0}),()=>{B.removeEventListener("scroll",H),clearTimeout(j)}},[]);const G=x.useRef(!1),T=x.useRef(0),I=x.useRef(!1);x.useEffect(()=>{const B=f.current;if(!B||!I.current||T.current===0)return;const H=B.scrollHeight-T.current;H>0&&(B.scrollTop=H),T.current=0,I.current=!1},[t.length]),x.useEffect(()=>{const B=f.current;if(!B||!c)return;const j=()=>{B.scrollTop<60&&u&&!h&&!G.current&&(G.current=!0,T.current=B.scrollHeight,c(),setTimeout(()=>{G.current=!1},1500))};return B.addEventListener("scroll",j,{passive:!0}),()=>B.removeEventListener("scroll",j)},[c,u,h]);const A=(()=>{const B=t.map((W,S)=>({type:"message",data:W,index:S,ts:W.receivedAt||l[W.id??`i-${S}`]||0}));if(!n||n.length===0)return B;const j=[...n].sort((W,S)=>W.timestamp-S.timestamp).map((W,S)=>({type:"action",data:W,index:S,ts:W.timestamp})),H=[];let L=0;for(const W of B){for(;L<j.length&&W.ts>0&&j[L].ts<W.ts;)H.push(j[L++]);H.push(W)}for(;L<j.length;)H.push(j[L++]);return H})(),P=700;return p.jsxs("div",{ref:f,"data-chat-scroll":!0,style:{flex:1,minHeight:0,overflowY:"auto",padding:"24px 20px",display:"flex",flexDirection:"column",gap:16,background:"var(--bg-primary)"},children:[h&&p.jsx("div",{style:{textAlign:"center",padding:"12px 0",color:"var(--text-muted)",fontSize:12,opacity:.6},children:"⏳ Loading older messages..."}),u&&!h&&p.jsx("div",{style:{textAlign:"center",padding:"8px 0"},children:p.jsx("button",{onClick:c,style:{background:"none",border:"1px solid var(--border-subtle)",color:"var(--text-muted)",fontSize:11,borderRadius:12,padding:"4px 16px",cursor:"pointer",opacity:.7},children:"↑ Load older messages"})}),A.length===0&&!u&&(a||p.jsx("div",{style:{textAlign:"center",marginTop:60,opacity:.2,fontSize:13},children:"Waiting for messages..."})),A.map(B=>{if(B.type==="action"){const _e=B.data;return p.jsxs("div",{style:{alignSelf:"center",maxWidth:"80%",background:"rgba(99, 102, 241, 0.08)",color:"var(--accent-primary)",padding:"6px 14px",borderRadius:20,fontSize:12,textAlign:"center",border:"1px solid rgba(99, 102, 241, 0.15)",opacity:.85},children:[p.jsx(kc,{remarkPlugins:[Ic],children:_e.text}),p.jsx("span",{style:{fontSize:10,opacity:.5,marginLeft:8},children:Lc(_e.timestamp)})]},`action-${B.index}`)}const j=B.data,H=B.index,L=(j.role||"").toLowerCase(),W=L==="user"||L==="human",S=j.kind||"standard",Q=j.receivedAt||l[j.id??`i-${H}`],le=`${o}-${H}`,k=v.has(le),ge=E.has(le);if(S==="thought")return p.jsx("div",{style:{alignSelf:"flex-start",maxWidth:"88%",borderLeft:"2px solid rgba(99,102,241,0.35)",paddingLeft:12,color:"var(--text-muted)",fontSize:12,fontStyle:"italic",lineHeight:1.6,opacity:.75},children:p.jsx("div",{className:"chat-markdown",children:p.jsx(kc,{remarkPlugins:[Ic,Eg],children:j.content||""})})},`msg-${H}`);if(S==="tool")return p.jsxs("div",{style:{alignSelf:"flex-start",display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-muted)",padding:"3px 10px 3px 8px",background:"rgba(16,185,129,0.05)",border:"1px solid rgba(16,185,129,0.12)",borderRadius:6,fontFamily:"ui-monospace, monospace"},children:[p.jsx("span",{style:{color:"#10b981",fontSize:10},children:"⏺"}),p.jsx("span",{style:{color:"#10b981",opacity:.8},children:(j.content||"").split(`
104
- `)[0].slice(0,80)})]},`msg-${H}`);if(S==="system")return p.jsx("div",{style:{alignSelf:"center",fontSize:11,color:"var(--text-muted)",opacity:.6,padding:"2px 12px",borderRadius:20,border:"1px solid var(--border-subtle)"},children:(j.content||"").slice(0,100)},`msg-${H}`);const ie=!W&&i?F4(j.content||""):null,z=ie?ie.textContent:j.content||"",q=ie?Object.entries(ie.toolCounts):[],te=i&&!W&&!k&&z.length>P,ue=k?j.content||"":te&&!ge?z.slice(0,P):z;return p.jsxs("div",{style:{alignSelf:W?"flex-end":"flex-start",maxWidth:"88%",display:"flex",flexDirection:"column",gap:4},children:[q.length>0&&p.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center",marginBottom:2},children:[q.map(([_e,O])=>p.jsxs("span",{style:{fontSize:10,fontFamily:"ui-monospace, monospace",color:"#10b981",background:"rgba(16,185,129,0.07)",border:"1px solid rgba(16,185,129,0.18)",borderRadius:4,padding:"2px 7px"},children:["⏺ ",_e,O>1?` ×${O}`:""]},_e)),(ie==null?void 0:ie.hasTools)&&p.jsx("button",{onClick:()=>y(_e=>{const O=new Set(_e);return k?O.delete(le):O.add(le),O}),style:{fontSize:10,color:"var(--text-muted)",background:"none",border:"none",cursor:"pointer",padding:"1px 4px",opacity:.5},children:k?"Collapse":"Original"}),!z&&Q!=null&&p.jsx("span",{style:{fontSize:10,opacity:.35,marginLeft:2},children:Lc(Q)})]}),(z||W)&&p.jsxs("div",{style:{background:W?"var(--accent-primary)":"var(--bg-secondary)",color:W?"#fff":"var(--text-primary)",padding:"10px 14px",borderRadius:W?"14px 14px 4px 14px":"14px 14px 14px 4px",fontSize:13,lineHeight:1.6,border:W?"none":"1px solid var(--border-subtle)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8,marginBottom:z?5:0},children:[p.jsx("span",{style:{fontSize:10,fontWeight:700,opacity:.6,letterSpacing:"0.05em",textTransform:"uppercase"},children:W?"You":r}),Q!=null&&p.jsx("span",{style:{fontSize:10,opacity:.45},children:Lc(Q)})]}),z&&p.jsx("div",{className:"chat-markdown",children:p.jsx(kc,{remarkPlugins:[Ic,Eg,j4],children:ue})}),te&&p.jsx("button",{onClick:()=>R(_e=>{const O=new Set(_e);return ge?O.delete(le):O.add(le),O}),style:{marginTop:6,fontSize:11,fontWeight:600,color:"var(--accent-primary)",background:"none",border:"none",cursor:"pointer",padding:0,opacity:.8},children:ge?"Collapse ↑":`Show more (${Math.round(z.length/100)*100} chars) ↓`})]})]},`msg-${H}`)}),s&&p.jsx("div",{style:{alignSelf:"flex-start",maxWidth:"90%",background:"var(--bg-secondary)",borderRadius:"16px 16px 16px 4px",border:"1px solid var(--border-subtle)"},children:p.jsxs("div",{className:"typing-indicator",children:[p.jsx("div",{className:"dot"}),p.jsx("div",{className:"dot"}),p.jsx("div",{className:"dot"}),p.jsx("span",{style:{fontSize:11,color:"var(--text-muted)",marginLeft:4},children:"Agent working..."})]})}),p.jsx("div",{style:{minHeight:40},ref:g})]})}),_s={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"}},Pc={cline:"#22d3ee","roo-code":"#a78bfa",continue:"#34d399",copilot:"#60a5fa"};function $4({agentStreams:e,sendCommand:t}){var d,f,g;const[n,r]=x.useState(null),[i,s]=x.useState(""),[o,l]=x.useState(!1);x.useEffect(()=>{!n&&e.length>0&&r(e[0].agentType)},[e,n]);const a=e.find(m=>m.agentType===n),c=x.useCallback(async()=>{if(!(!i.trim()||!n||o)){l(!0);try{await t("agent_stream_send",{agentType:n,text:i.trim()}),s("")}catch(m){console.error("Failed to send agent message",m)}finally{l(!1)}}},[i,n,o,t]),h=x.useCallback(async m=>{if(n)try{await t("agent_stream_resolve",{agentType:n,action:m})}catch(w){console.error("Failed to resolve agent action",w)}},[n,t]),u=x.useCallback(async()=>{if(n)try{await t("agent_stream_new_session",{agentType:n})}catch(m){console.error("Failed to start new session",m)}},[n,t]);return e.length===0?null:p.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"#0c0e14",borderRadius:12,overflow:"hidden",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2,padding:"8px 12px 0",borderBottom:"1px solid rgba(255,255,255,0.06)",background:"rgba(255,255,255,0.02)",overflowX:"auto"},children:[e.map(m=>{const w=m.agentType===n,_=Pc[m.agentType]||"#94a3b8",v=_s[m.status]||_s.idle;return p.jsxs("button",{onClick:()=>r(m.agentType),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",border:"none",borderBottom:w?`2px solid ${_}`:"2px solid transparent",background:w?"rgba(255,255,255,0.05)":"transparent",color:w?"#f1f5f9":"#64748b",cursor:"pointer",fontSize:13,fontWeight:w?600:400,borderRadius:"8px 8px 0 0",transition:"all 0.15s ease",whiteSpace:"nowrap"},children:[p.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:v.dot,boxShadow:m.status==="streaming"?`0 0 6px ${v.dot}`:"none",animation:m.status==="streaming"?"pulse 1.5s infinite":"none"}}),m.agentName,m.status==="waiting_approval"&&p.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:4,background:"rgba(245,158,11,0.2)",color:"#fbbf24",fontWeight:600},children:"APPROVE"})]},m.agentType)}),p.jsx("div",{style:{flex:1}}),p.jsx("button",{onClick:u,title:"New Chat Session",style:{padding:"4px 8px",marginBottom:4,border:"none",background:"rgba(255,255,255,0.06)",color:"#94a3b8",borderRadius:6,cursor:"pointer",fontSize:13},children:"+ New"})]}),a?p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 14px",fontSize:11,color:"#64748b",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[p.jsx("span",{style:{padding:"2px 8px",borderRadius:4,background:(d=_s[a.status])==null?void 0:d.bg,color:(f=_s[a.status])==null?void 0:f.text,fontWeight:600,fontSize:10,letterSpacing:.5,textTransform:"uppercase"},children:((g=_s[a.status])==null?void 0:g.label)||a.status}),a.model&&p.jsxs("span",{style:{color:"#475569"},children:["Model: ",p.jsx("span",{style:{color:"#94a3b8"},children:a.model})]}),p.jsx("span",{style:{color:"#334155"},children:"|"}),p.jsxs("span",{children:[a.messages.length," messages"]})]}),a.activeModal&&p.jsxs("div",{style:{padding:"10px 14px",background:"linear-gradient(135deg, rgba(245,158,11,0.1), rgba(234,88,12,0.08))",borderBottom:"1px solid rgba(245,158,11,0.2)",display:"flex",alignItems:"center",gap:10},children:[p.jsx("span",{style:{fontSize:16},children:"⚠️"}),p.jsx("span",{style:{flex:1,fontSize:13,color:"#fbbf24",lineHeight:"1.4"},children:a.activeModal.message||"Action requires approval"}),p.jsx("button",{onClick:()=>h("approve"),style:{padding:"5px 14px",border:"none",borderRadius:6,background:"#22c55e",color:"#fff",fontSize:12,fontWeight:600,cursor:"pointer"},children:"Approve"}),p.jsx("button",{onClick:()=>h("reject"),style:{padding:"5px 14px",border:"none",borderRadius:6,background:"rgba(239,68,68,0.2)",color:"#f87171",fontSize:12,fontWeight:600,cursor:"pointer"},children:"Reject"})]}),p.jsx(g0,{messages:a.messages.map((m,w)=>({role:m.role,content:m.content,kind:m.kind,id:`${a.agentType}-${w}`,receivedAt:m.timestamp})),agentName:a.agentName,isWorking:a.status==="streaming",contextKey:`agent-${a.agentType}`,emptyState:p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--text-muted)",fontSize:13},children:["No messages yet. Start a conversation with ",a.agentName,"."]})}),p.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid rgba(255,255,255,0.06)",display:"flex",gap:8},children:[p.jsx("input",{type:"text",value:i,onChange:m=>s(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),c())},placeholder:`Message ${a.agentName}...`,disabled:o,style:{flex:1,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,padding:"8px 14px",color:"#e2e8f0",fontSize:13,outline:"none"}}),p.jsx("button",{onClick:c,disabled:o||!i.trim(),style:{padding:"8px 18px",border:"none",borderRadius:8,background:i.trim()?`linear-gradient(135deg, ${Pc[a.agentType]||"#3b82f6"}, ${Pc[a.agentType]||"#3b82f6"}cc)`:"rgba(255,255,255,0.04)",color:i.trim()?"#fff":"#475569",fontSize:13,fontWeight:600,cursor:i.trim()?"pointer":"default",transition:"all 0.15s"},children:o?"…":"Send"})]})]}):p.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#334155",fontSize:13},children:"Select an agent tab to view its chat stream."}),p.jsx("style",{children:`
103
+ `).trim();return{toolCounts:r,textContent:o,hasTools:Object.keys(r).length>0}}function $c(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const E0=x.forwardRef(function({messages:t,actionLogs:n,agentName:r="Agent",isCliMode:i=!1,isWorking:s=!1,contextKey:o="",receivedAtMap:l={},emptyState:a,onLoadMore:c,isLoadingMore:h,hasMoreHistory:u},d){var U;const f=x.useRef(null),g=x.useRef(null),m=x.useRef(0),w=x.useRef(""),_=x.useRef(!1),[v,y]=x.useState(new Set),[E,R]=x.useState(new Set),C=x.useRef(!1),M=()=>{const A=f.current;return A?A.scrollHeight-A.scrollTop-A.clientHeight<200:!0},$=t.length>0?`${t.length}:${(((U=t[t.length-1])==null?void 0:U.content)||"").length}`:"0:0";x.useEffect(()=>{var L,W;const A=!_.current,O=w.current!==o;if(w.current=o,A||O){_.current=!0,C.current=!1;const S=()=>{var Q;(Q=g.current)==null||Q.scrollIntoView({behavior:"instant"})};requestAnimationFrame(()=>requestAnimationFrame(S)),setTimeout(S,100),setTimeout(S,300),m.current=t.length;return}t.length>m.current?C.current||(L=g.current)==null||L.scrollIntoView({behavior:"instant"}):M()&&!C.current&&((W=g.current)==null||W.scrollIntoView({behavior:"instant"})),m.current=t.length},[$,o,s]),x.useImperativeHandle(d,()=>({scrollToBottom:(A="smooth")=>{var O;(O=g.current)==null||O.scrollIntoView({behavior:A})}})),x.useEffect(()=>{const A=f.current;if(!A)return;let O;const H=()=>{clearTimeout(O),O=setTimeout(()=>{C.current=!M()},50)};return A.addEventListener("scroll",H,{passive:!0}),()=>{A.removeEventListener("scroll",H),clearTimeout(O)}},[]);const G=x.useRef(!1),T=x.useRef(0),P=x.useRef(!1);x.useEffect(()=>{const A=f.current;if(!A||!P.current||T.current===0)return;const H=A.scrollHeight-T.current;H>0&&(A.scrollTop=H),T.current=0,P.current=!1},[t.length]),x.useEffect(()=>{const A=f.current;if(!A||!c)return;const O=()=>{A.scrollTop<60&&u&&!h&&!G.current&&(G.current=!0,T.current=A.scrollHeight,c(),setTimeout(()=>{G.current=!1},1500))};return A.addEventListener("scroll",O,{passive:!0}),()=>A.removeEventListener("scroll",O)},[c,u,h]);const B=(()=>{const A=t.map((W,S)=>({type:"message",data:W,index:S,ts:W.receivedAt||l[W.id??`i-${S}`]||0}));if(!n||n.length===0)return A;const O=[...n].sort((W,S)=>W.timestamp-S.timestamp).map((W,S)=>({type:"action",data:W,index:S,ts:W.timestamp})),H=[];let L=0;for(const W of A){for(;L<O.length&&W.ts>0&&O[L].ts<W.ts;)H.push(O[L++]);H.push(W)}for(;L<O.length;)H.push(O[L++]);return H})(),D=700;return p.jsxs("div",{ref:f,"data-chat-scroll":!0,style:{flex:1,minHeight:0,overflowY:"auto",padding:"24px 20px",display:"flex",flexDirection:"column",gap:16,background:"var(--bg-primary)"},children:[h&&p.jsx("div",{style:{textAlign:"center",padding:"12px 0",color:"var(--text-muted)",fontSize:12,opacity:.6},children:"⏳ Loading older messages..."}),u&&!h&&p.jsx("div",{style:{textAlign:"center",padding:"8px 0"},children:p.jsx("button",{onClick:c,style:{background:"none",border:"1px solid var(--border-subtle)",color:"var(--text-muted)",fontSize:11,borderRadius:12,padding:"4px 16px",cursor:"pointer",opacity:.7},children:"↑ Load older messages"})}),B.length===0&&!u&&(a||p.jsx("div",{style:{textAlign:"center",marginTop:60,opacity:.2,fontSize:13},children:"Waiting for messages..."})),B.map(A=>{if(A.type==="action"){const Se=A.data;return p.jsxs("div",{style:{alignSelf:"center",maxWidth:"80%",background:"rgba(99, 102, 241, 0.08)",color:"var(--accent-primary)",padding:"6px 14px",borderRadius:20,fontSize:12,textAlign:"center",border:"1px solid rgba(99, 102, 241, 0.15)",opacity:.85},children:[p.jsx(Bc,{remarkPlugins:[Fc],children:Se.text}),p.jsx("span",{style:{fontSize:10,opacity:.5,marginLeft:8},children:$c(Se.timestamp)})]},`action-${A.index}`)}const O=A.data,H=A.index,L=(O.role||"").toLowerCase(),W=L==="user"||L==="human",S=O.kind||"standard",Q=O.receivedAt||l[O.id??`i-${H}`],le=`${o}-${H}`,k=v.has(le),ge=E.has(le);if(S==="thought")return p.jsx("div",{style:{alignSelf:"flex-start",maxWidth:"88%",borderLeft:"2px solid rgba(99,102,241,0.35)",paddingLeft:12,color:"var(--text-muted)",fontSize:12,fontStyle:"italic",lineHeight:1.6,opacity:.75},children:p.jsx("div",{className:"chat-markdown",children:p.jsx(Bc,{remarkPlugins:[Fc,zg],children:O.content||""})})},`msg-${H}`);if(S==="tool")return p.jsxs("div",{style:{alignSelf:"flex-start",display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-muted)",padding:"3px 10px 3px 8px",background:"rgba(16,185,129,0.05)",border:"1px solid rgba(16,185,129,0.12)",borderRadius:6,fontFamily:"ui-monospace, monospace"},children:[p.jsx("span",{style:{color:"#10b981",fontSize:10},children:"⏺"}),p.jsx("span",{style:{color:"#10b981",opacity:.8},children:(O.content||"").split(`
104
+ `)[0].slice(0,80)})]},`msg-${H}`);if(S==="system")return p.jsx("div",{style:{alignSelf:"center",fontSize:11,color:"var(--text-muted)",opacity:.6,padding:"2px 12px",borderRadius:20,border:"1px solid var(--border-subtle)"},children:(O.content||"").slice(0,100)},`msg-${H}`);const te=!W&&i?Y4(O.content||""):null,F=te?te.textContent:O.content||"",ie=te?Object.entries(te.toolCounts):[],ne=i&&!W&&!k&&F.length>D,ue=k?O.content||"":ne&&!ge?F.slice(0,D):F;return p.jsxs("div",{style:{alignSelf:W?"flex-end":"flex-start",maxWidth:"88%",display:"flex",flexDirection:"column",gap:4},children:[ie.length>0&&p.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center",marginBottom:2},children:[ie.map(([Se,z])=>p.jsxs("span",{style:{fontSize:10,fontFamily:"ui-monospace, monospace",color:"#10b981",background:"rgba(16,185,129,0.07)",border:"1px solid rgba(16,185,129,0.18)",borderRadius:4,padding:"2px 7px"},children:["⏺ ",Se,z>1?` ×${z}`:""]},Se)),(te==null?void 0:te.hasTools)&&p.jsx("button",{onClick:()=>y(Se=>{const z=new Set(Se);return k?z.delete(le):z.add(le),z}),style:{fontSize:10,color:"var(--text-muted)",background:"none",border:"none",cursor:"pointer",padding:"1px 4px",opacity:.5},children:k?"Collapse":"Original"}),!F&&Q!=null&&p.jsx("span",{style:{fontSize:10,opacity:.35,marginLeft:2},children:$c(Q)})]}),(F||W)&&p.jsxs("div",{style:{background:W?"var(--accent-primary)":"var(--bg-secondary)",color:W?"#fff":"var(--text-primary)",padding:"10px 14px",borderRadius:W?"14px 14px 4px 14px":"14px 14px 14px 4px",fontSize:13,lineHeight:1.6,border:W?"none":"1px solid var(--border-subtle)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8,marginBottom:F?5:0},children:[p.jsx("span",{style:{fontSize:10,fontWeight:700,opacity:.6,letterSpacing:"0.05em",textTransform:"uppercase"},children:W?"You":r}),Q!=null&&p.jsx("span",{style:{fontSize:10,opacity:.45},children:$c(Q)})]}),F&&p.jsx("div",{className:"chat-markdown",children:p.jsx(Bc,{remarkPlugins:[Fc,zg,q4],children:ue})}),ne&&p.jsx("button",{onClick:()=>R(Se=>{const z=new Set(Se);return ge?z.delete(le):z.add(le),z}),style:{marginTop:6,fontSize:11,fontWeight:600,color:"var(--accent-primary)",background:"none",border:"none",cursor:"pointer",padding:0,opacity:.8},children:ge?"Collapse ↑":`Show more (${Math.round(F.length/100)*100} chars) ↓`})]})]},`msg-${H}`)}),s&&p.jsx("div",{style:{alignSelf:"flex-start",maxWidth:"90%",background:"var(--bg-secondary)",borderRadius:"16px 16px 16px 4px",border:"1px solid var(--border-subtle)"},children:p.jsxs("div",{className:"typing-indicator",children:[p.jsx("div",{className:"dot"}),p.jsx("div",{className:"dot"}),p.jsx("div",{className:"dot"}),p.jsx("span",{style:{fontSize:11,color:"var(--text-muted)",marginLeft:4},children:"Agent working..."})]})}),p.jsx("div",{style:{minHeight:40},ref:g})]})}),Cs={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"}},Wc={cline:"#22d3ee","roo-code":"#a78bfa",continue:"#34d399",copilot:"#60a5fa"};function X4({agentStreams:e,sendCommand:t}){var d,f,g;const[n,r]=x.useState(null),[i,s]=x.useState(""),[o,l]=x.useState(!1);x.useEffect(()=>{!n&&e.length>0&&r(e[0].agentType)},[e,n]);const a=e.find(m=>m.agentType===n),c=x.useCallback(async()=>{if(!(!i.trim()||!n||o)){l(!0);try{await t("agent_stream_send",{agentType:n,text:i.trim()}),s("")}catch(m){console.error("Failed to send agent message",m)}finally{l(!1)}}},[i,n,o,t]),h=x.useCallback(async m=>{if(n)try{await t("agent_stream_resolve",{agentType:n,action:m})}catch(w){console.error("Failed to resolve agent action",w)}},[n,t]),u=x.useCallback(async()=>{if(n)try{await t("agent_stream_new_session",{agentType:n})}catch(m){console.error("Failed to start new session",m)}},[n,t]);return e.length===0?null:p.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"#0c0e14",borderRadius:12,overflow:"hidden",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2,padding:"8px 12px 0",borderBottom:"1px solid rgba(255,255,255,0.06)",background:"rgba(255,255,255,0.02)",overflowX:"auto"},children:[e.map(m=>{const w=m.agentType===n,_=Wc[m.agentType]||"#94a3b8",v=Cs[m.status]||Cs.idle;return p.jsxs("button",{onClick:()=>r(m.agentType),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",border:"none",borderBottom:w?`2px solid ${_}`:"2px solid transparent",background:w?"rgba(255,255,255,0.05)":"transparent",color:w?"#f1f5f9":"#64748b",cursor:"pointer",fontSize:13,fontWeight:w?600:400,borderRadius:"8px 8px 0 0",transition:"all 0.15s ease",whiteSpace:"nowrap"},children:[p.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:v.dot,boxShadow:m.status==="streaming"?`0 0 6px ${v.dot}`:"none",animation:m.status==="streaming"?"pulse 1.5s infinite":"none"}}),m.agentName,m.status==="waiting_approval"&&p.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:4,background:"rgba(245,158,11,0.2)",color:"#fbbf24",fontWeight:600},children:"APPROVE"})]},m.agentType)}),p.jsx("div",{style:{flex:1}}),p.jsx("button",{onClick:u,title:"New Chat Session",style:{padding:"4px 8px",marginBottom:4,border:"none",background:"rgba(255,255,255,0.06)",color:"#94a3b8",borderRadius:6,cursor:"pointer",fontSize:13},children:"+ New"})]}),a?p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 14px",fontSize:11,color:"#64748b",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[p.jsx("span",{style:{padding:"2px 8px",borderRadius:4,background:(d=Cs[a.status])==null?void 0:d.bg,color:(f=Cs[a.status])==null?void 0:f.text,fontWeight:600,fontSize:10,letterSpacing:.5,textTransform:"uppercase"},children:((g=Cs[a.status])==null?void 0:g.label)||a.status}),a.model&&p.jsxs("span",{style:{color:"#475569"},children:["Model: ",p.jsx("span",{style:{color:"#94a3b8"},children:a.model})]}),p.jsx("span",{style:{color:"#334155"},children:"|"}),p.jsxs("span",{children:[a.messages.length," messages"]})]}),a.activeModal&&p.jsxs("div",{style:{padding:"10px 14px",background:"linear-gradient(135deg, rgba(245,158,11,0.1), rgba(234,88,12,0.08))",borderBottom:"1px solid rgba(245,158,11,0.2)",display:"flex",alignItems:"center",gap:10},children:[p.jsx("span",{style:{fontSize:16},children:"⚠️"}),p.jsx("span",{style:{flex:1,fontSize:13,color:"#fbbf24",lineHeight:"1.4"},children:a.activeModal.message||"Action requires approval"}),p.jsx("button",{onClick:()=>h("approve"),style:{padding:"5px 14px",border:"none",borderRadius:6,background:"#22c55e",color:"#fff",fontSize:12,fontWeight:600,cursor:"pointer"},children:"Approve"}),p.jsx("button",{onClick:()=>h("reject"),style:{padding:"5px 14px",border:"none",borderRadius:6,background:"rgba(239,68,68,0.2)",color:"#f87171",fontSize:12,fontWeight:600,cursor:"pointer"},children:"Reject"})]}),p.jsx(E0,{messages:a.messages.map((m,w)=>({role:m.role,content:m.content,kind:m.kind,id:`${a.agentType}-${w}`,receivedAt:m.timestamp})),agentName:a.agentName,isWorking:a.status==="streaming",contextKey:`agent-${a.agentType}`,emptyState:p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--text-muted)",fontSize:13},children:["No messages yet. Start a conversation with ",a.agentName,"."]})}),p.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid rgba(255,255,255,0.06)",display:"flex",gap:8},children:[p.jsx("input",{type:"text",value:i,onChange:m=>s(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),c())},placeholder:`Message ${a.agentName}...`,disabled:o,style:{flex:1,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,padding:"8px 14px",color:"#e2e8f0",fontSize:13,outline:"none"}}),p.jsx("button",{onClick:c,disabled:o||!i.trim(),style:{padding:"8px 18px",border:"none",borderRadius:8,background:i.trim()?`linear-gradient(135deg, ${Wc[a.agentType]||"#3b82f6"}, ${Wc[a.agentType]||"#3b82f6"}cc)`:"rgba(255,255,255,0.04)",color:i.trim()?"#fff":"#475569",fontSize:13,fontWeight:600,cursor:i.trim()?"pointer":"default",transition:"all 0.15s"},children:o?"…":"Send"})]})]}):p.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#334155",fontSize:13},children:"Select an agent tab to view its chat stream."}),p.jsx("style",{children:`
105
105
  @keyframes pulse {
106
106
  0%, 100% { opacity: 1; }
107
107
  50% { opacity: 0.4; }
@@ -117,22 +117,22 @@ Error generating stack: `+s.message+`
117
117
  * Fabrice Bellard's javascript vt100 for jslinux:
118
118
  * http://bellard.org/jslinux/
119
119
  * Copyright (c) 2011 Fabrice Bellard
120
- */var m0=Object.defineProperty,W4=Object.getOwnPropertyDescriptor,H4=(e,t)=>{for(var n in t)m0(e,n,{get:t[n],enumerable:!0})},Ge=(e,t,n,r)=>{for(var i=r>1?void 0:r?W4(t,n):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&m0(t,n,i),i},he=(e,t)=>(n,r)=>t(n,r,e),Tg="Terminal input",eh={get:()=>Tg,set:e=>Tg=e},Rg="Too much output to announce, navigate to rows manually to read",th={get:()=>Rg,set:e=>Rg=e};function U4(e){return e.replace(/\r?\n/g,"\r")}function K4(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function V4(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function q4(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");_0(i,t,n,r)}}function _0(e,t,n,r){e=U4(e),e=K4(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function v0(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,s=e.clientY-r.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 Ig(e,t,n,r,i){v0(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function mr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Na(e,t=0,n=e.length){let r="";for(let i=t;i<n;++i){let s=e[i];s>65535?(s-=65536,r+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):r+=String.fromCharCode(s)}return r}var Y4=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[r++]=(this._interim-55296)*1024+s-56320+65536:(t[r++]=this._interim,t[r++]=s),this._interim=0}for(let s=i;s<n;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=n)return this._interim=o,r;let l=e.charCodeAt(s);56320<=l&&l<=57343?t[r++]=(o-55296)*1024+l-56320+65536:(t[r++]=o,t[r++]=l);continue}o!==65279&&(t[r++]=o)}return r}},X4=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,s,o,l,a=0,c=0;if(this.interim[0]){let d=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let g=0,m;for(;(m=this.interim[++g]&63)&&g<4;)f<<=6,f|=m;let w=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,_=w-g;for(;c<_;){if(c>=n)return 0;if(m=e[c++],(m&192)!==128){c--,d=!0;break}else this.interim[g++]=m,f<<=6,f|=m&63}d||(w===2?f<128?c--:t[r++]=f:w===3?f<2048||f>=55296&&f<=57343||f===65279||(t[r++]=f):f<65536||f>1114111||(t[r++]=f)),this.interim.fill(0)}let h=n-4,u=c;for(;u<n;){for(;u<h&&!((i=e[u])&128)&&!((s=e[u+1])&128)&&!((o=e[u+2])&128)&&!((l=e[u+3])&128);)t[r++]=i,t[r++]=s,t[r++]=o,t[r++]=l,u+=4;if(i=e[u++],i<128)t[r++]=i;else if((i&224)===192){if(u>=n)return this.interim[0]=i,r;if(s=e[u++],(s&192)!==128){u--;continue}if(a=(i&31)<<6|s&63,a<128){u--;continue}t[r++]=a}else if((i&240)===224){if(u>=n)return this.interim[0]=i,r;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=n)return this.interim[0]=i,this.interim[1]=s,r;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[r++]=a}else if((i&248)===240){if(u>=n)return this.interim[0]=i,r;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=n)return this.interim[0]=i,this.interim[1]=s,r;if(o=e[u++],(o&192)!==128){u--;continue}if(u>=n)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,r;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[r++]=a}}return r}},y0="",xr=" ",Io=class S0{constructor(){this.fg=0,this.bg=0,this.extended=new sa}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 S0;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}},sa=class w0{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}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 w0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},pn=class x0 extends Io{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new sa,this.combinedData=""}static fromCharData(t){let n=new x0;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?mr(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 n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(r-55296)*1024+i-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Lg="di$target",nh="di$dependencies",Dc=new Map;function G4(e){return e[nh]||[]}function mt(e){if(Dc.has(e))return Dc.get(e);let t=function(n,r,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Q4(t,n,i)};return t._id=e,Dc.set(e,t),t}function Q4(e,t,n){t[Lg]===t?t[nh].push({id:e,index:n}):(t[nh]=[{id:e,index:n}],t[Lg]=t)}var Nt=mt("BufferService"),b0=mt("CoreMouseService"),gi=mt("CoreService"),Z4=mt("CharsetService"),ef=mt("InstantiationService"),k0=mt("LogService"),zt=mt("OptionsService"),C0=mt("OscLinkService"),J4=mt("UnicodeService"),Lo=mt("DecorationService"),rh=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var h;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,s=new pn,o=n.getTrimmedLength(),l=-1,a=-1,c=!1;for(let u=0;u<o;u++)if(!(a===-1&&!n.hasContent(u))){if(n.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 d=(h=this._oscLinkService.getLinkData(l))==null?void 0:h.uri;if(d){let f={start:{x:a+1,y:e},end:{x:u+(!c&&u===o-1?1:0),y:e}},g=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let m=new URL(d);["http:","https:"].includes(m.protocol)||(g=!0)}catch{g=!0}g||r.push({text:d,range:f,activate:(m,w)=>i?i.activate(m,w,f):eT(m,w),hover:(m,w)=>{var _;return(_=i==null?void 0:i.hover)==null?void 0:_.call(i,m,w,f)},leave:(m,w)=>{var _;return(_=i==null?void 0:i.leave)==null?void 0:_.call(i,m,w,f)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(a=u,l=s.extended.urlId):(a=-1,l=-1)}}t(r)}};rh=Ge([he(0,Nt),he(1,zt),he(2,C0)],rh);function eT(e,t){if(confirm(`Do you want to navigate to ${t}?
120
+ */var T0=Object.defineProperty,G4=Object.getOwnPropertyDescriptor,Q4=(e,t)=>{for(var n in t)T0(e,n,{get:t[n],enumerable:!0})},tt=(e,t,n,r)=>{for(var i=r>1?void 0:r?G4(t,n):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&T0(t,n,i),i},he=(e,t)=>(n,r)=>t(n,r,e),Og="Terminal input",hh={get:()=>Og,set:e=>Og=e},jg="Too much output to announce, navigate to rows manually to read",dh={get:()=>jg,set:e=>jg=e};function Z4(e){return e.replace(/\r?\n/g,"\r")}function J4(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function eT(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function tT(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");R0(i,t,n,r)}}function R0(e,t,n,r){e=Z4(e),e=J4(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function I0(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,s=e.clientY-r.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 Fg(e,t,n,r,i){I0(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function br(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function qa(e,t=0,n=e.length){let r="";for(let i=t;i<n;++i){let s=e[i];s>65535?(s-=65536,r+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):r+=String.fromCharCode(s)}return r}var nT=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[r++]=(this._interim-55296)*1024+s-56320+65536:(t[r++]=this._interim,t[r++]=s),this._interim=0}for(let s=i;s<n;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=n)return this._interim=o,r;let l=e.charCodeAt(s);56320<=l&&l<=57343?t[r++]=(o-55296)*1024+l-56320+65536:(t[r++]=o,t[r++]=l);continue}o!==65279&&(t[r++]=o)}return r}},rT=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,s,o,l,a=0,c=0;if(this.interim[0]){let d=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let g=0,m;for(;(m=this.interim[++g]&63)&&g<4;)f<<=6,f|=m;let w=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,_=w-g;for(;c<_;){if(c>=n)return 0;if(m=e[c++],(m&192)!==128){c--,d=!0;break}else this.interim[g++]=m,f<<=6,f|=m&63}d||(w===2?f<128?c--:t[r++]=f:w===3?f<2048||f>=55296&&f<=57343||f===65279||(t[r++]=f):f<65536||f>1114111||(t[r++]=f)),this.interim.fill(0)}let h=n-4,u=c;for(;u<n;){for(;u<h&&!((i=e[u])&128)&&!((s=e[u+1])&128)&&!((o=e[u+2])&128)&&!((l=e[u+3])&128);)t[r++]=i,t[r++]=s,t[r++]=o,t[r++]=l,u+=4;if(i=e[u++],i<128)t[r++]=i;else if((i&224)===192){if(u>=n)return this.interim[0]=i,r;if(s=e[u++],(s&192)!==128){u--;continue}if(a=(i&31)<<6|s&63,a<128){u--;continue}t[r++]=a}else if((i&240)===224){if(u>=n)return this.interim[0]=i,r;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=n)return this.interim[0]=i,this.interim[1]=s,r;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[r++]=a}else if((i&248)===240){if(u>=n)return this.interim[0]=i,r;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=n)return this.interim[0]=i,this.interim[1]=s,r;if(o=e[u++],(o&192)!==128){u--;continue}if(u>=n)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,r;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[r++]=a}}return r}},P0="",Ir=" ",zo=class L0{constructor(){this.fg=0,this.bg=0,this.extended=new ma}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 L0;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}},ma=class D0{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}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 D0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Cn=class M0 extends zo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ma,this.combinedData=""}static fromCharData(t){let n=new M0;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?br(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 n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(r-55296)*1024+i-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},$g="di$target",fh="di$dependencies",Hc=new Map;function iT(e){return e[fh]||[]}function bt(e){if(Hc.has(e))return Hc.get(e);let t=function(n,r,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");sT(t,n,i)};return t._id=e,Hc.set(e,t),t}function sT(e,t,n){t[$g]===t?t[fh].push({id:e,index:n}):(t[fh]=[{id:e,index:n}],t[$g]=t)}var Kt=bt("BufferService"),A0=bt("CoreMouseService"),bi=bt("CoreService"),oT=bt("CharsetService"),df=bt("InstantiationService"),B0=bt("LogService"),Vt=bt("OptionsService"),N0=bt("OscLinkService"),lT=bt("UnicodeService"),Oo=bt("DecorationService"),ph=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var h;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,s=new Cn,o=n.getTrimmedLength(),l=-1,a=-1,c=!1;for(let u=0;u<o;u++)if(!(a===-1&&!n.hasContent(u))){if(n.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 d=(h=this._oscLinkService.getLinkData(l))==null?void 0:h.uri;if(d){let f={start:{x:a+1,y:e},end:{x:u+(!c&&u===o-1?1:0),y:e}},g=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let m=new URL(d);["http:","https:"].includes(m.protocol)||(g=!0)}catch{g=!0}g||r.push({text:d,range:f,activate:(m,w)=>i?i.activate(m,w,f):aT(m,w),hover:(m,w)=>{var _;return(_=i==null?void 0:i.hover)==null?void 0:_.call(i,m,w,f)},leave:(m,w)=>{var _;return(_=i==null?void 0:i.leave)==null?void 0:_.call(i,m,w,f)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(a=u,l=s.extended.urlId):(a=-1,l=-1)}}t(r)}};ph=tt([he(0,Kt),he(1,Vt),he(2,N0)],ph);function aT(e,t){if(confirm(`Do you want to navigate to ${t}?
121
121
 
122
- WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var za=mt("CharSizeService"),or=mt("CoreBrowserService"),tf=mt("MouseService"),lr=mt("RenderService"),tT=mt("SelectionService"),E0=mt("CharacterJoinerService"),is=mt("ThemeService"),T0=mt("LinkProviderService"),nT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Pg.isErrorNoTelemetry(e)?new Pg(e.message+`
122
+ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Ya=bt("CharSizeService"),pr=bt("CoreBrowserService"),ff=bt("MouseService"),gr=bt("RenderService"),cT=bt("SelectionService"),z0=bt("CharacterJoinerService"),ds=bt("ThemeService"),O0=bt("LinkProviderService"),uT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Wg.isErrorNoTelemetry(e)?new Wg(e.message+`
123
123
 
124
124
  `+e.stack):new Error(e.message+`
125
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)}},rT=new nT;function xl(e){iT(e)||rT.onUnexpectedError(e)}var ih="Canceled";function iT(e){return e instanceof sT?!0:e instanceof Error&&e.name===ih&&e.message===ih}var sT=class extends Error{constructor(){super(ih),this.name=this.message}};function oT(e){return new Error(`Illegal argument: ${e}`)}var Pg=class sh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof sh)return t;let n=new sh;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},oh=class R0 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,R0.prototype)}};function Vt(e,t=0){return e[e.length-(1+t)]}var lT;(e=>{function t(s){return s<0}e.isLessThan=t;function n(s){return s<=0}e.isLessThanOrEqual=n;function r(s){return s>0}e.isGreaterThan=r;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(lT||(lT={}));function aT(e,t){let n=this,r=!1,i;return function(){return r||(r=!0,t||(i=e.apply(n,arguments))),i}}var I0;(e=>{function t(E){return E&&typeof E=="object"&&typeof E[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(E){yield E}e.single=i;function s(E){return t(E)?E:i(E)}e.wrap=s;function o(E){return E||n}e.from=o;function*l(E){for(let R=E.length-1;R>=0;R--)yield E[R]}e.reverse=l;function a(E){return!E||E[Symbol.iterator]().next().done===!0}e.isEmpty=a;function c(E){return E[Symbol.iterator]().next().value}e.first=c;function h(E,R){let C=0;for(let M of E)if(R(M,C++))return!0;return!1}e.some=h;function u(E,R){for(let C of E)if(R(C))return C}e.find=u;function*d(E,R){for(let C of E)R(C)&&(yield C)}e.filter=d;function*f(E,R){let C=0;for(let M of E)yield R(M,C++)}e.map=f;function*g(E,R){let C=0;for(let M of E)yield*R(M,C++)}e.flatMap=g;function*m(...E){for(let R of E)yield*R}e.concat=m;function w(E,R,C){let M=C;for(let $ of E)M=R(M,$);return M}e.reduce=w;function*_(E,R,C=E.length){for(R<0&&(R+=E.length),C<0?C+=E.length:C>E.length&&(C=E.length);R<C;R++)yield E[R]}e.slice=_;function v(E,R=Number.POSITIVE_INFINITY){let C=[];if(R===0)return[C,E];let M=E[Symbol.iterator]();for(let $=0;$<R;$++){let G=M.next();if(G.done)return[C,e.empty()];C.push(G.value)}return[C,{[Symbol.iterator](){return M}}]}e.consume=v;async function y(E){let R=[];for await(let C of E)R.push(C);return Promise.resolve(R)}e.asyncToArray=y})(I0||(I0={}));function ci(e){if(I0.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}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 cT(...e){return We(()=>ci(e))}function We(e){return{dispose:aT(()=>{e()})}}var L0=class P0{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{ci(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?P0.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)}};L0.DISABLE_DISPOSED_WARNING=!1;var Pr=L0,ke=class{constructor(){this._store=new Pr,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)}};ke.None=Object.freeze({dispose(){}});var Gi=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}},Zn=typeof window=="object"?window:globalThis,lh=class ah{constructor(t){this.element=t,this.next=ah.Undefined,this.prev=ah.Undefined}};lh.Undefined=new lh(void 0);var He=lh,Dg=class{constructor(){this._first=He.Undefined,this._last=He.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===He.Undefined}clear(){let e=this._first;for(;e!==He.Undefined;){let t=e.next;e.prev=He.Undefined,e.next=He.Undefined,e=t}this._first=He.Undefined,this._last=He.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new He(e);if(this._first===He.Undefined)this._first=n,this._last=n;else if(t){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==He.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==He.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==He.Undefined&&e.next!==He.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===He.Undefined&&e.next===He.Undefined?(this._first=He.Undefined,this._last=He.Undefined):e.next===He.Undefined?(this._last=this._last.prev,this._last.next=He.Undefined):e.prev===He.Undefined&&(this._first=this._first.next,this._first.prev=He.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==He.Undefined;)yield e.element,e=e.next}},uT=globalThis.performance&&typeof globalThis.performance.now=="function",hT=class D0{static create(t){return new D0(t)}constructor(t){this._now=uT&&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}},yt;(e=>{e.None=()=>ke.None;function t(A,P){return u(A,()=>{},0,void 0,!0,void 0,P)}e.defer=t;function n(A){return(P,U=null,B)=>{let j=!1,H;return H=A(L=>{if(!j)return H?H.dispose():j=!0,P.call(U,L)},null,B),j&&H.dispose(),H}}e.once=n;function r(A,P,U){return c((B,j=null,H)=>A(L=>B.call(j,P(L)),null,H),U)}e.map=r;function i(A,P,U){return c((B,j=null,H)=>A(L=>{P(L),B.call(j,L)},null,H),U)}e.forEach=i;function s(A,P,U){return c((B,j=null,H)=>A(L=>P(L)&&B.call(j,L),null,H),U)}e.filter=s;function o(A){return A}e.signal=o;function l(...A){return(P,U=null,B)=>{let j=cT(...A.map(H=>H(L=>P.call(U,L))));return h(j,B)}}e.any=l;function a(A,P,U,B){let j=U;return r(A,H=>(j=P(j,H),j),B)}e.reduce=a;function c(A,P){let U,B={onWillAddFirstListener(){U=A(j.fire,j)},onDidRemoveLastListener(){U==null||U.dispose()}},j=new se(B);return P==null||P.add(j),j.event}function h(A,P){return P instanceof Array?P.push(A):P&&P.add(A),A}function u(A,P,U=100,B=!1,j=!1,H,L){let W,S,Q,le=0,k,ge={leakWarningThreshold:H,onWillAddFirstListener(){W=A(z=>{le++,S=P(S,z),B&&!Q&&(ie.fire(S),S=void 0),k=()=>{let q=S;S=void 0,Q=void 0,(!B||le>1)&&ie.fire(q),le=0},typeof U=="number"?(clearTimeout(Q),Q=setTimeout(k,U)):Q===void 0&&(Q=0,queueMicrotask(k))})},onWillRemoveListener(){j&&le>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,W.dispose()}},ie=new se(ge);return L==null||L.add(ie),ie.event}e.debounce=u;function d(A,P=0,U){return e.debounce(A,(B,j)=>B?(B.push(j),B):[j],P,void 0,!0,void 0,U)}e.accumulate=d;function f(A,P=(B,j)=>B===j,U){let B=!0,j;return s(A,H=>{let L=B||!P(H,j);return B=!1,j=H,L},U)}e.latch=f;function g(A,P,U){return[e.filter(A,P,U),e.filter(A,B=>!P(B),U)]}e.split=g;function m(A,P=!1,U=[],B){let j=U.slice(),H=A(S=>{j?j.push(S):W.fire(S)});B&&B.add(H);let L=()=>{j==null||j.forEach(S=>W.fire(S)),j=null},W=new se({onWillAddFirstListener(){H||(H=A(S=>W.fire(S)),B&&B.add(H))},onDidAddFirstListener(){j&&(P?setTimeout(L):L())},onDidRemoveLastListener(){H&&H.dispose(),H=null}});return B&&B.add(W),W.event}e.buffer=m;function w(A,P){return(U,B,j)=>{let H=P(new v);return A(function(L){let W=H.evaluate(L);W!==_&&U.call(B,W)},void 0,j)}}e.chain=w;let _=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(P){return this.steps.push(P),this}forEach(P){return this.steps.push(U=>(P(U),U)),this}filter(P){return this.steps.push(U=>P(U)?U:_),this}reduce(P,U){let B=U;return this.steps.push(j=>(B=P(B,j),B)),this}latch(P=(U,B)=>U===B){let U=!0,B;return this.steps.push(j=>{let H=U||!P(j,B);return U=!1,B=j,H?j:_}),this}evaluate(P){for(let U of this.steps)if(P=U(P),P===_)break;return P}}function y(A,P,U=B=>B){let B=(...W)=>L.fire(U(...W)),j=()=>A.on(P,B),H=()=>A.removeListener(P,B),L=new se({onWillAddFirstListener:j,onDidRemoveLastListener:H});return L.event}e.fromNodeEventEmitter=y;function E(A,P,U=B=>B){let B=(...W)=>L.fire(U(...W)),j=()=>A.addEventListener(P,B),H=()=>A.removeEventListener(P,B),L=new se({onWillAddFirstListener:j,onDidRemoveLastListener:H});return L.event}e.fromDOMEventEmitter=E;function R(A){return new Promise(P=>n(A)(P))}e.toPromise=R;function C(A){let P=new se;return A.then(U=>{P.fire(U)},()=>{P.fire(void 0)}).finally(()=>{P.dispose()}),P.event}e.fromPromise=C;function M(A,P){return A(U=>P.fire(U))}e.forward=M;function $(A,P,U){return P(U),A(B=>P(B))}e.runAndSubscribe=$;class G{constructor(P,U){this._observable=P,this._counter=0,this._hasChanged=!1;let B={onWillAddFirstListener:()=>{P.addObserver(this)},onDidRemoveLastListener:()=>{P.removeObserver(this)}};this.emitter=new se(B),U&&U.add(this.emitter)}beginUpdate(P){this._counter++}handlePossibleChange(P){}handleChange(P,U){this._hasChanged=!0}endUpdate(P){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(A,P){return new G(A,P).emitter.event}e.fromObservable=T;function I(A){return(P,U,B)=>{let j=0,H=!1,L={beginUpdate(){j++},endUpdate(){j--,j===0&&(A.reportChanges(),H&&(H=!1,P.call(U)))},handlePossibleChange(){},handleChange(){H=!0}};A.addObserver(L),A.reportChanges();let W={dispose(){A.removeObserver(L)}};return B instanceof Pr?B.add(W):Array.isArray(B)&&B.push(W),W}}e.fromObservableLight=I})(yt||(yt={}));var ch=class uh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${uh._idPool++}`,uh.all.add(this)}start(t){this._stopWatch=new hT,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}}};ch.all=new Set,ch._idPool=0;var dT=ch,fT=-1,M0=class A0{constructor(t,n,r=(A0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)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=r*.5;let[s,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(s);let a=new mT(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,n=0;for(let[r,i]of this._stacks)(!t||n<i)&&(t=[r,i],n=i);return t}};M0._idPool=1;var pT=M0,gT=class B0{constructor(t){this.value=t}static create(){let t=new Error;return new B0(t.stack??"")}print(){console.warn(this.value.split(`
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)}},hT=new uT;function Ml(e){dT(e)||hT.onUnexpectedError(e)}var gh="Canceled";function dT(e){return e instanceof fT?!0:e instanceof Error&&e.name===gh&&e.message===gh}var fT=class extends Error{constructor(){super(gh),this.name=this.message}};function pT(e){return new Error(`Illegal argument: ${e}`)}var Wg=class mh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof mh)return t;let n=new mh;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},_h=class j0 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,j0.prototype)}};function sn(e,t=0){return e[e.length-(1+t)]}var gT;(e=>{function t(s){return s<0}e.isLessThan=t;function n(s){return s<=0}e.isLessThanOrEqual=n;function r(s){return s>0}e.isGreaterThan=r;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(gT||(gT={}));function mT(e,t){let n=this,r=!1,i;return function(){return r||(r=!0,t||(i=e.apply(n,arguments))),i}}var F0;(e=>{function t(E){return E&&typeof E=="object"&&typeof E[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(E){yield E}e.single=i;function s(E){return t(E)?E:i(E)}e.wrap=s;function o(E){return E||n}e.from=o;function*l(E){for(let R=E.length-1;R>=0;R--)yield E[R]}e.reverse=l;function a(E){return!E||E[Symbol.iterator]().next().done===!0}e.isEmpty=a;function c(E){return E[Symbol.iterator]().next().value}e.first=c;function h(E,R){let C=0;for(let M of E)if(R(M,C++))return!0;return!1}e.some=h;function u(E,R){for(let C of E)if(R(C))return C}e.find=u;function*d(E,R){for(let C of E)R(C)&&(yield C)}e.filter=d;function*f(E,R){let C=0;for(let M of E)yield R(M,C++)}e.map=f;function*g(E,R){let C=0;for(let M of E)yield*R(M,C++)}e.flatMap=g;function*m(...E){for(let R of E)yield*R}e.concat=m;function w(E,R,C){let M=C;for(let $ of E)M=R(M,$);return M}e.reduce=w;function*_(E,R,C=E.length){for(R<0&&(R+=E.length),C<0?C+=E.length:C>E.length&&(C=E.length);R<C;R++)yield E[R]}e.slice=_;function v(E,R=Number.POSITIVE_INFINITY){let C=[];if(R===0)return[C,E];let M=E[Symbol.iterator]();for(let $=0;$<R;$++){let G=M.next();if(G.done)return[C,e.empty()];C.push(G.value)}return[C,{[Symbol.iterator](){return M}}]}e.consume=v;async function y(E){let R=[];for await(let C of E)R.push(C);return Promise.resolve(R)}e.asyncToArray=y})(F0||(F0={}));function _i(e){if(F0.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}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 _T(...e){return Ue(()=>_i(e))}function Ue(e){return{dispose:mT(()=>{e()})}}var $0=class W0{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{_i(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?W0.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)}};$0.DISABLE_DISPOSED_WARNING=!1;var Or=$0,Te=class{constructor(){this._store=new Or,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)}};Te.None=Object.freeze({dispose(){}});var is=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},or=typeof window=="object"?window:globalThis,vh=class yh{constructor(t){this.element=t,this.next=yh.Undefined,this.prev=yh.Undefined}};vh.Undefined=new vh(void 0);var Ke=vh,Hg=class{constructor(){this._first=Ke.Undefined,this._last=Ke.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ke.Undefined}clear(){let e=this._first;for(;e!==Ke.Undefined;){let t=e.next;e.prev=Ke.Undefined,e.next=Ke.Undefined,e=t}this._first=Ke.Undefined,this._last=Ke.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Ke(e);if(this._first===Ke.Undefined)this._first=n,this._last=n;else if(t){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Ke.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ke.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ke.Undefined&&e.next!==Ke.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ke.Undefined&&e.next===Ke.Undefined?(this._first=Ke.Undefined,this._last=Ke.Undefined):e.next===Ke.Undefined?(this._last=this._last.prev,this._last.next=Ke.Undefined):e.prev===Ke.Undefined&&(this._first=this._first.next,this._first.prev=Ke.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ke.Undefined;)yield e.element,e=e.next}},vT=globalThis.performance&&typeof globalThis.performance.now=="function",yT=class H0{static create(t){return new H0(t)}constructor(t){this._now=vT&&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}},Et;(e=>{e.None=()=>Te.None;function t(B,D){return u(B,()=>{},0,void 0,!0,void 0,D)}e.defer=t;function n(B){return(D,U=null,A)=>{let O=!1,H;return H=B(L=>{if(!O)return H?H.dispose():O=!0,D.call(U,L)},null,A),O&&H.dispose(),H}}e.once=n;function r(B,D,U){return c((A,O=null,H)=>B(L=>A.call(O,D(L)),null,H),U)}e.map=r;function i(B,D,U){return c((A,O=null,H)=>B(L=>{D(L),A.call(O,L)},null,H),U)}e.forEach=i;function s(B,D,U){return c((A,O=null,H)=>B(L=>D(L)&&A.call(O,L),null,H),U)}e.filter=s;function o(B){return B}e.signal=o;function l(...B){return(D,U=null,A)=>{let O=_T(...B.map(H=>H(L=>D.call(U,L))));return h(O,A)}}e.any=l;function a(B,D,U,A){let O=U;return r(B,H=>(O=D(O,H),O),A)}e.reduce=a;function c(B,D){let U,A={onWillAddFirstListener(){U=B(O.fire,O)},onDidRemoveLastListener(){U==null||U.dispose()}},O=new se(A);return D==null||D.add(O),O.event}function h(B,D){return D instanceof Array?D.push(B):D&&D.add(B),B}function u(B,D,U=100,A=!1,O=!1,H,L){let W,S,Q,le=0,k,ge={leakWarningThreshold:H,onWillAddFirstListener(){W=B(F=>{le++,S=D(S,F),A&&!Q&&(te.fire(S),S=void 0),k=()=>{let ie=S;S=void 0,Q=void 0,(!A||le>1)&&te.fire(ie),le=0},typeof U=="number"?(clearTimeout(Q),Q=setTimeout(k,U)):Q===void 0&&(Q=0,queueMicrotask(k))})},onWillRemoveListener(){O&&le>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,W.dispose()}},te=new se(ge);return L==null||L.add(te),te.event}e.debounce=u;function d(B,D=0,U){return e.debounce(B,(A,O)=>A?(A.push(O),A):[O],D,void 0,!0,void 0,U)}e.accumulate=d;function f(B,D=(A,O)=>A===O,U){let A=!0,O;return s(B,H=>{let L=A||!D(H,O);return A=!1,O=H,L},U)}e.latch=f;function g(B,D,U){return[e.filter(B,D,U),e.filter(B,A=>!D(A),U)]}e.split=g;function m(B,D=!1,U=[],A){let O=U.slice(),H=B(S=>{O?O.push(S):W.fire(S)});A&&A.add(H);let L=()=>{O==null||O.forEach(S=>W.fire(S)),O=null},W=new se({onWillAddFirstListener(){H||(H=B(S=>W.fire(S)),A&&A.add(H))},onDidAddFirstListener(){O&&(D?setTimeout(L):L())},onDidRemoveLastListener(){H&&H.dispose(),H=null}});return A&&A.add(W),W.event}e.buffer=m;function w(B,D){return(U,A,O)=>{let H=D(new v);return B(function(L){let W=H.evaluate(L);W!==_&&U.call(A,W)},void 0,O)}}e.chain=w;let _=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(U=>(D(U),U)),this}filter(D){return this.steps.push(U=>D(U)?U:_),this}reduce(D,U){let A=U;return this.steps.push(O=>(A=D(A,O),A)),this}latch(D=(U,A)=>U===A){let U=!0,A;return this.steps.push(O=>{let H=U||!D(O,A);return U=!1,A=O,H?O:_}),this}evaluate(D){for(let U of this.steps)if(D=U(D),D===_)break;return D}}function y(B,D,U=A=>A){let A=(...W)=>L.fire(U(...W)),O=()=>B.on(D,A),H=()=>B.removeListener(D,A),L=new se({onWillAddFirstListener:O,onDidRemoveLastListener:H});return L.event}e.fromNodeEventEmitter=y;function E(B,D,U=A=>A){let A=(...W)=>L.fire(U(...W)),O=()=>B.addEventListener(D,A),H=()=>B.removeEventListener(D,A),L=new se({onWillAddFirstListener:O,onDidRemoveLastListener:H});return L.event}e.fromDOMEventEmitter=E;function R(B){return new Promise(D=>n(B)(D))}e.toPromise=R;function C(B){let D=new se;return B.then(U=>{D.fire(U)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=C;function M(B,D){return B(U=>D.fire(U))}e.forward=M;function $(B,D,U){return D(U),B(A=>D(A))}e.runAndSubscribe=$;class G{constructor(D,U){this._observable=D,this._counter=0,this._hasChanged=!1;let A={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};this.emitter=new se(A),U&&U.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,U){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(B,D){return new G(B,D).emitter.event}e.fromObservable=T;function P(B){return(D,U,A)=>{let O=0,H=!1,L={beginUpdate(){O++},endUpdate(){O--,O===0&&(B.reportChanges(),H&&(H=!1,D.call(U)))},handlePossibleChange(){},handleChange(){H=!0}};B.addObserver(L),B.reportChanges();let W={dispose(){B.removeObserver(L)}};return A instanceof Or?A.add(W):Array.isArray(A)&&A.push(W),W}}e.fromObservableLight=P})(Et||(Et={}));var Sh=class wh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${wh._idPool++}`,wh.all.add(this)}start(t){this._stopWatch=new yT,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}}};Sh.all=new Set,Sh._idPool=0;var ST=Sh,wT=-1,U0=class K0{constructor(t,n,r=(K0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)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=r*.5;let[s,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(s);let a=new kT(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,n=0;for(let[r,i]of this._stacks)(!t||n<i)&&(t=[r,i],n=i);return t}};U0._idPool=1;var xT=U0,bT=class V0{constructor(t){this.value=t}static create(){let t=new Error;return new V0(t.stack??"")}print(){console.warn(this.value.split(`
127
127
  `).slice(2).join(`
128
- `))}},mT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},_T=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},vT=0,Mc=class{constructor(e){this.value=e,this.id=vT++}},yT=2,ST,se=class{constructor(t){var n,r,i,s;this._size=0,this._options=t,this._leakageMon=(n=this._options)!=null&&n.leakWarningThreshold?new pT((t==null?void 0:t.onListenerError)??xl,((r=this._options)==null?void 0:r.leakWarningThreshold)??fT):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new dT(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,n,r,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),(r=(n=this._options)==null?void 0:n.onDidRemoveLastListener)==null||r.call(n),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(t,n,r)=>{var l,a,c,h,u;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],g=new _T(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((l=this._options)==null?void 0:l.onListenerError)||xl)(g),ke.None}if(this._disposed)return ke.None;n&&(t=t.bind(n));let i=new Mc(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=gT.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Mc?(this._deliveryQueue??(this._deliveryQueue=new wT),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=We(()=>{s==null||s(),this._removeListener(i)});return r instanceof Pr?r.add(o):Array.isArray(r)&&r.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 n=this._listeners,r=n.indexOf(t);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*yT<=n.length){let c=0;for(let h=0;h<n.length;h++)n[h]?n[c++]=n[h]:i&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=c}}_deliver(t,n){var i;if(!t)return;let r=((i=this._options)==null?void 0:i.onListenerError)||xl;if(!r){t.value(n);return}try{t.value(n)}catch(s){r(s)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){var n,r,i,s;if((n=this._deliveryQueue)!=null&&n.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof Mc)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}},wT=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},hh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new se,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new se,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};hh.INSTANCE=new hh;var nf=hh;function xT(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}nf.INSTANCE.onDidChangeZoomLevel;function bT(e){return nf.INSTANCE.getZoomFactor(e)}nf.INSTANCE.onDidChangeFullscreen;var ss=typeof navigator=="object"?navigator.userAgent:"",dh=ss.indexOf("Firefox")>=0,kT=ss.indexOf("AppleWebKit")>=0,rf=ss.indexOf("Chrome")>=0,CT=!rf&&ss.indexOf("Safari")>=0;ss.indexOf("Electron/")>=0;ss.indexOf("Android")>=0;var Ac=!1;if(typeof Zn.matchMedia=="function"){let e=Zn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Zn.matchMedia("(display-mode: fullscreen)");Ac=e.matches,xT(Zn,e,({matches:n})=>{Ac&&t.matches||(Ac=n)})}var Ai="en",fh=!1,ph=!1,bl=!1,N0=!1,tl,kl=Ai,Mg=Ai,ET,yn,ni=globalThis,vt,Lm;typeof ni.vscode<"u"&&typeof ni.vscode.process<"u"?vt=ni.vscode.process:typeof process<"u"&&typeof((Lm=process==null?void 0:process.versions)==null?void 0:Lm.node)=="string"&&(vt=process);var Pm,TT=typeof((Pm=vt==null?void 0:vt.versions)==null?void 0:Pm.electron)=="string",RT=TT&&(vt==null?void 0:vt.type)==="renderer",Dm;if(typeof vt=="object"){fh=vt.platform==="win32",ph=vt.platform==="darwin",bl=vt.platform==="linux",bl&&vt.env.SNAP&&vt.env.SNAP_REVISION,vt.env.CI||vt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,tl=Ai,kl=Ai;let e=vt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);tl=t.userLocale,Mg=t.osLocale,kl=t.resolvedLanguage||Ai,ET=(Dm=t.languagePack)==null?void 0:Dm.translationsConfigFile}catch{}N0=!0}else typeof navigator=="object"&&!RT?(yn=navigator.userAgent,fh=yn.indexOf("Windows")>=0,ph=yn.indexOf("Macintosh")>=0,(yn.indexOf("Macintosh")>=0||yn.indexOf("iPad")>=0||yn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,bl=yn.indexOf("Linux")>=0,(yn==null?void 0:yn.indexOf("Mobi"))>=0,kl=globalThis._VSCODE_NLS_LANGUAGE||Ai,tl=navigator.language.toLowerCase(),Mg=tl):console.error("Unable to resolve platform.");var z0=fh,Fn=ph,IT=bl,Ag=N0,$n=yn,hr=kl,LT;(e=>{function t(){return hr}e.value=t;function n(){return hr.length===2?hr==="en":hr.length>=3?hr[0]==="e"&&hr[1]==="n"&&hr[2]==="-":!1}e.isDefaultVariant=n;function r(){return hr==="en"}e.isDefault=r})(LT||(LT={}));var PT=typeof ni.postMessage=="function"&&!ni.importScripts;(()=>{if(PT){let e=[];ni.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,i=e.length;r<i;r++){let s=e[r];if(s.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),s.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),ni.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var DT=!!($n&&$n.indexOf("Chrome")>=0);$n&&$n.indexOf("Firefox")>=0;!DT&&$n&&$n.indexOf("Safari")>=0;$n&&$n.indexOf("Edg/")>=0;$n&&$n.indexOf("Android")>=0;var yi=typeof navigator=="object"?navigator:{};Ag||document.queryCommandSupported&&document.queryCommandSupported("copy")||yi&&yi.clipboard&&yi.clipboard.writeText,Ag||yi&&yi.clipboard&&yi.clipboard.readText;var sf=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Bc=new sf,Bg=new sf,Ng=new sf,MT=new Array(230),O0;(e=>{function t(l){return Bc.keyCodeToStr(l)}e.toString=t;function n(l){return Bc.strToKeyCode(l)}e.fromString=n;function r(l){return Bg.keyCodeToStr(l)}e.toUserSettingsUS=r;function i(l){return Ng.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return Bg.strToKeyCode(l)||Ng.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 Bc.keyCodeToStr(l)}e.toElectronAccelerator=o})(O0||(O0={}));var AT=class j0{constructor(t,n,r,i,s){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof j0&&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",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${n}${r}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new BT([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},BT=class{constructor(e){if(e.length===0)throw oT("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;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 NT(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return O0.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(dh)switch(t){case 59:return 85;case 60:if(IT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Fn)return 57;break}else if(kT&&(Fn&&t===93||!Fn&&t===92))return 57;return MT[t]||0}var zT=Fn?256:2048,OT=512,jT=1024,FT=Fn?2048:256,zg=class{constructor(e){var n;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=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=NT(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|=zT),this.altKey&&(t|=OT),this.shiftKey&&(t|=jT),this.metaKey&&(t|=FT),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new AT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Og=new WeakMap;function $T(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var WT=class{static getSameOriginWindowChain(e){let t=Og.get(e);if(!t){t=[],Og.set(e,t);let n=e,r;do r=$T(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let l=s.iframeElement.getBoundingClientRect();n+=l.top,r+=l.left}return{top:n,left:r}}},nl=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 n=WT.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},jg=class{constructor(e,t=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(rf){let s=navigator.userAgent.match(/Chrome\/(\d+)/);r=(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")r?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?dh&&!Fn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")CT&&z0?this.deltaX=-(s.wheelDeltaX/120):r?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?dh&&!Fn?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?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()}},F0=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),HT;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof UT?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:yt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:F0})})(HT||(HT={}));var UT=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?F0:(this._emitter||(this._emitter=new se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},of=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 oh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new oh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},KT=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,n=globalThis){if(this.isDisposed)throw new oh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=We(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},VT;(e=>{async function t(r){let i,s=await Promise.all(r.map(o=>o.then(l=>l,l=>{i||(i=l)})));if(typeof i<"u")throw i;return s}e.settled=t;function n(r){return new Promise(async(i,s)=>{try{await r(i,s)}catch(o){s(o)}})}e.withAsyncBody=n})(VT||(VT={}));var Fg=class ln{static fromArray(t){return new ln(n=>{n.emitMany(t)})}static fromPromise(t){return new ln(async n=>{n.emitMany(await t)})}static fromPromises(t){return new ln(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new ln(async n=>{await Promise.all(t.map(async r=>{for await(let i of r)n.emitOne(i)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new se,queueMicrotask(async()=>{let r={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(r)),this.resolve()}catch(i){this.reject(i)}finally{r.emitOne=void 0,r.emitMany=void 0,r.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 yt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new ln(async r=>{for await(let i of t)r.emitOne(n(i))})}map(t){return ln.map(this,t)}static filter(t,n){return new ln(async r=>{for await(let i of t)n(i)&&r.emitOne(i)})}filter(t){return ln.filter(this,t)}static coalesce(t){return ln.filter(t,n=>!!n)}coalesce(){return ln.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return ln.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())}};Fg.EMPTY=Fg.fromArray([]);var{getWindow:zn,getWindowId:qT,onDidRegisterWindow:YT}=function(){let e=new Map,t={window:Zn,disposables:new Pr};e.set(Zn.vscodeWindowId,t);let n=new se,r=new se,i=new se;function s(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return ke.None;let l=new Pr,a={window:o,disposables:l.add(new Pr)};return e.set(o.vscodeWindowId,a),l.add(We(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),l.add(Se(o,ut.BEFORE_UNLOAD,()=>{i.fire(o)})),n.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:Zn},getDocument(o){return zn(o).document}}}(),XT=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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 Se(e,t,n,r){return new XT(e,t,n,r)}var $g=function(e,t,n,r){return Se(e,t,n,r)},lf,GT=class extends KT{constructor(e){super(),this.defaultTarget=e&&zn(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Wg=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){xl(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=s=>{n.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),r.set(s,!0);o.length>0;)o.sort(Wg.sort),o.shift().execute();r.set(s,!1)};lf=(s,o,l=0)=>{let a=qT(s),c=new Wg(o,l),h=e.get(a);return h||(h=[],e.set(a,h)),h.push(c),n.get(a)||(n.set(a,!0),s.requestAnimationFrame(()=>i(a))),c}})();function QT(e){let t=e.getBoundingClientRect(),n=zn(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var ut={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"},ZT=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=Ot(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ot(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ot(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ot(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ot(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ot(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ot(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ot(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ot(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ot(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ot(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=Ot(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=Ot(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ot(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 Ot(e){return typeof e=="number"?`${e}px`:e}function Vs(e){return new ZT(e)}var $0=class{constructor(){this._hooks=new Pr,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 n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(We(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=zn(e)}this._hooks.add(Se(s,ut.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Se(s,ut.POINTER_UP,o=>this.stopMonitoring(!0)))}};function JT(e,t,n){let r=null,i=null;if(typeof n.value=="function"?(r="value",i=n.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",i=n.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;n[r]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var Dn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Dn||(Dn={}));var Is=class Ct extends ke{constructor(){super(),this.dispatched=!1,this.targets=new Dg,this.ignoreTargets=new Dg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(yt.runAndSubscribe(YT,({window:t,disposables:n})=>{n.add(Se(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(Se(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(Se(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Zn,disposables:this._store}))}static addTarget(t){if(!Ct.isTouchDevice())return ke.None;Ct.INSTANCE||(Ct.INSTANCE=new Ct);let n=Ct.INSTANCE.targets.push(t);return We(n)}static ignoreTarget(t){if(!Ct.isTouchDevice())return ke.None;Ct.INSTANCE||(Ct.INSTANCE=new Ct);let n=Ct.INSTANCE.ignoreTargets.push(t);return We(n)}static isTouchDevice(){return"ontouchstart"in Zn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,i=t.targetTouches.length;r<i;r++){let s=t.targetTouches.item(r);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:n,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[n],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(Dn.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,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=n.changedTouches.length;s<o;s++){let l=n.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<Ct.HOLD_DELAY&&Math.abs(a.initialPageX-Vt(a.rollingPageX))<30&&Math.abs(a.initialPageY-Vt(a.rollingPageY))<30){let h=this.newGestureEvent(Dn.Tap,a.initialTarget);h.pageX=Vt(a.rollingPageX),h.pageY=Vt(a.rollingPageY),this.dispatchEvent(h)}else if(c>=Ct.HOLD_DELAY&&Math.abs(a.initialPageX-Vt(a.rollingPageX))<30&&Math.abs(a.initialPageY-Vt(a.rollingPageY))<30){let h=this.newGestureEvent(Dn.Contextmenu,a.initialTarget);h.pageX=Vt(a.rollingPageX),h.pageY=Vt(a.rollingPageY),this.dispatchEvent(h)}else if(i===1){let h=Vt(a.rollingPageX),u=Vt(a.rollingPageY),d=Vt(a.rollingTimestamps)-a.rollingTimestamps[0],f=h-a.rollingPageX[0],g=u-a.rollingPageY[0],m=[...this.targets].filter(w=>a.initialTarget instanceof Node&&w.contains(a.initialTarget));this.inertia(t,m,r,Math.abs(f)/d,f>0?1:-1,h,Math.abs(g)/d,g>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(Dn.End,a.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===Dn.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>Ct.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Dn.Change||t.type===Dn.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==r;)i++,s=s.parentElement;n.push([i,r])}n.sort((r,i)=>r[0]-i[0]);for(let[r,i]of n)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,s,o,l,a,c){this.handle=lf(t,()=>{let h=Date.now(),u=h-r,d=0,f=0,g=!0;i+=Ct.SCROLL_FRICTION*u,l+=Ct.SCROLL_FRICTION*u,i>0&&(g=!1,d=s*i*u),l>0&&(g=!1,f=a*l*u);let m=this.newGestureEvent(Dn.Change);m.translationX=d,m.translationY=f,n.forEach(w=>w.dispatchEvent(m)),g||this.inertia(t,n,h,i,s,o+d,l,a,c+f)})}onTouchMove(t){let n=Date.now();for(let r=0,i=t.changedTouches.length;r<i;r++){let s=t.changedTouches.item(r);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(Dn.Change,o.initialTarget);l.translationX=s.pageX-Vt(o.rollingPageX),l.translationY=s.pageY-Vt(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(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Is.SCROLL_FRICTION=-.005,Is.HOLD_DELAY=700,Is.CLEAR_TAP_COUNT_TIME=400,Ge([JT],Is,"isTouchDevice",1);var eR=Is,af=class extends ke{onclick(e,t){this._register(Se(e,ut.CLICK,n=>t(new nl(zn(e),n))))}onmousedown(e,t){this._register(Se(e,ut.MOUSE_DOWN,n=>t(new nl(zn(e),n))))}onmouseover(e,t){this._register(Se(e,ut.MOUSE_OVER,n=>t(new nl(zn(e),n))))}onmouseleave(e,t){this._register(Se(e,ut.MOUSE_LEAVE,n=>t(new nl(zn(e),n))))}onkeydown(e,t){this._register(Se(e,ut.KEY_DOWN,n=>t(new zg(n))))}onkeyup(e,t){this._register(Se(e,ut.KEY_UP,n=>t(new zg(n))))}oninput(e,t){this._register(Se(e,ut.INPUT,t))}onblur(e,t){this._register(Se(e,ut.BLUR,t))}onfocus(e,t){this._register(Se(e,ut.FOCUS,t))}onchange(e,t){this._register(Se(e,ut.CHANGE,t))}ignoreGesture(e){return eR.ignoreTarget(e)}},Hg=11,tR=class extends af{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=Hg+"px",this.domNode.style.height=Hg+"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 $0),this._register($g(this.bgDomNode,ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register($g(this.domNode,ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new GT),this._pointerdownScheduleRepeatTimer=this._register(new of)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,zn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},nR=class gh{constructor(t,n,r,i,s,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,i=i|0,s=s|0,o=o|0,l=l|0),this.rawScrollLeft=i,this.rawScrollTop=l,n<0&&(n=0),i+n>r&&(i=r-n),i<0&&(i=0),s<0&&(s=0),l+s>o&&(l=o-s),l<0&&(l=0),this.width=n,this.scrollWidth=r,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,n){return new gh(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new gh(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,n){let r=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:n,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:r,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},rR=class extends ke{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new nR(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 r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.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 n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new Kg(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=Kg.start(this._state,n,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 n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Ug=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Nc(e,t){let n=t-e;return function(r){return e+n*oR(r)}}function iR(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Kg=class mh{constructor(t,n,r,i){this.from=t,this.to=n,this.duration=i,this.startTime=r,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,n,r){if(Math.abs(t-n)>2.5*r){let i,s;return t<n?(i=t+.75*r,s=n-.75*r):(i=t-.75*r,s=n+.75*r),iR(Nc(t,i),Nc(s,n),.33)}return Nc(t,n)}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 n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),i=this.scrollTop(n);return new Ug(r,i,!1)}return new Ug(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return mh.start(t,n,r)}static start(t,n,r){r=r+10;let i=Date.now()-10;return new mh(t,n,i,r)}};function sR(e){return Math.pow(e,3)}function oR(e){return 1-sR(1-e)}var lR=class extends ke{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new of)}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":"")))}},aR=140,W0=class extends af{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 lR(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new $0),this._shouldRender=!0,this.domNode=Vs(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(Se(this.domNode.domNode,ut.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new tR(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Vs(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Se(this.slider.domNode,ut.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,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let i=QT(this.domNode.domNode);t=e.pageX-i.left,n=e.pageY-i.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=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-n);if(z0&&o>aR){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let l=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(r.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()}},H0=class _h{constructor(t,n,r,i,s,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),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 _h(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,i,s){let o=Math.max(0,r-t),l=Math.max(0,o-2*n),a=i>0&&i>r;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(r*l/i))),h=(l-c)/(i-r),u=s*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=_h._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 n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},cR=class extends W0{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new H0(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.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}},uR=class extends W0{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new H0(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.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}},hR=500,Vg=50,dR=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},vh=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,n=0,r=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-r);if(t-=s,n+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(rf){let n=zn(t.browserEvent),r=bT(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let i=null,s=new dR(t,n,r);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,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(n.deltaX),l=Math.abs(n.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&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};vh.INSTANCE=new vh;var fR=vh,pR=class extends af{constructor(e,t,n){super(),this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new se),this.onWillScroll=this._onWillScroll.event,this._options=mR(t),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let r={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new uR(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new cR(this._scrollable,this._options,r)),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=Vs(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Vs(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Vs(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 of),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ci(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,Fn&&(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 jg(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ci(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new jg(n))};this._mouseWheelToDispose.push(Se(this._listenOnDomNode,ut.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=fR.INSTANCE;t.acceptStandardWheelEvent(e);let n=!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=!Fn&&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=Vg*s,u=a.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(c,u)}if(o){let h=Vg*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),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(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,n=e.scrollLeft>0,r=n?" left":"",i=t?" top":"",s=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${r}`)}}_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(),hR)}},gR=class extends pR{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function mR(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,Fn&&(t.className+=" mac"),t}var yh=class extends ke{constructor(e,t,n,r,i,s,o,l){super(),this._bufferService=n,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new rR({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>lf(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new gR(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(yt.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(We(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(We(()=>this._styleElement.remove())),this._register(yt.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),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};yh=Ge([he(2,Nt),he(3,or),he(4,b0),he(5,is),he(6,zt),he(7,lr)],yh);var Sh=class extends ke{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,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(We(()=>{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 r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.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 n=e.options.x??0;return n&&n>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 n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*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()}};Sh=Ge([he(1,Nt),he(2,or),he(3,Lo),he(4,lr)],Sh);var _R=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,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Ln={full:0,left:0,center:0,right:0},dr={full:0,left:0,center:0,right:0},vs={full:0,left:0,center:0,right:0},oa=class extends ke{constructor(e,t,n,r,i,s,o,l){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new _R,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(We(()=>{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);dr.full=this._canvas.width,dr.left=e,dr.center=t,dr.right=e,this._refreshDrawHeightConstants(),vs.full=1,vs.left=1,vs.center=1+dr.left,vs.right=1+dr.left+dr.center}_refreshDrawHeightConstants(){Ln.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);Ln.left=t,Ln.center=t,Ln.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ln.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ln.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ln.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ln.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(vs[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ln[e.position||"full"]/2),dr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ln[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}))}};oa=Ge([he(2,Nt),he(3,Lo),he(4,lr),he(5,zt),he(6,is),he(7,or)],oa);var V;(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=""))(V||(V={}));var Cl;(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="Ÿ"))(Cl||(Cl={}));var U0;(e=>e.ST=`${V.ESC}\\`)(U0||(U0={}));var wh=class{constructor(e,t,n,r,i,s){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,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 n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!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,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${V.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),n=this._renderService.dimensions.css.cell.height,r=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=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"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=r+"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)}}};wh=Ge([he(2,Nt),he(3,zt),he(4,gi),he(5,lr)],wh);var dt=0,ft=0,pt=0,Ye=0,qg={css:"#00000000",rgba:0},nt;(e=>{function t(i,s,o,l){return l!==void 0?`#${Fr(i)}${Fr(s)}${Fr(o)}${Fr(l)}`:`#${Fr(i)}${Fr(s)}${Fr(o)}`}e.toCss=t;function n(i,s,o,l=255){return(i<<24|s<<16|o<<8|l)>>>0}e.toRgba=n;function r(i,s,o,l){return{css:e.toCss(i,s,o,l),rgba:e.toRgba(i,s,o,l)}}e.toColor=r})(nt||(nt={}));var je;(e=>{function t(a,c){if(Ye=(c.rgba&255)/255,Ye===1)return{css:c.css,rgba:c.rgba};let h=c.rgba>>24&255,u=c.rgba>>16&255,d=c.rgba>>8&255,f=a.rgba>>24&255,g=a.rgba>>16&255,m=a.rgba>>8&255;dt=f+Math.round((h-f)*Ye),ft=g+Math.round((u-g)*Ye),pt=m+Math.round((d-m)*Ye);let w=nt.toCss(dt,ft,pt),_=nt.toRgba(dt,ft,pt);return{css:w,rgba:_}}e.blend=t;function n(a){return(a.rgba&255)===255}e.isOpaque=n;function r(a,c,h){let u=El.ensureContrastRatio(a.rgba,c.rgba,h);if(u)return nt.toColor(u>>24&255,u>>16&255,u>>8&255)}e.ensureContrastRatio=r;function i(a){let c=(a.rgba|255)>>>0;return[dt,ft,pt]=El.toChannels(c),{css:nt.toCss(dt,ft,pt),rgba:c}}e.opaque=i;function s(a,c){return Ye=Math.round(c*255),[dt,ft,pt]=El.toChannels(a.rgba),{css:nt.toCss(dt,ft,pt,Ye),rgba:nt.toRgba(dt,ft,pt,Ye)}}e.opacity=s;function o(a,c){return Ye=a.rgba&255,s(a,Ye*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})(je||(je={}));var Ue;(e=>{let t,n;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",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return dt=parseInt(i.slice(1,2).repeat(2),16),ft=parseInt(i.slice(2,3).repeat(2),16),pt=parseInt(i.slice(3,4).repeat(2),16),nt.toColor(dt,ft,pt);case 5:return dt=parseInt(i.slice(1,2).repeat(2),16),ft=parseInt(i.slice(2,3).repeat(2),16),pt=parseInt(i.slice(3,4).repeat(2),16),Ye=parseInt(i.slice(4,5).repeat(2),16),nt.toColor(dt,ft,pt,Ye);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 dt=parseInt(s[1]),ft=parseInt(s[2]),pt=parseInt(s[3]),Ye=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),nt.toColor(dt,ft,pt,Ye);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[dt,ft,pt,Ye]=t.getImageData(0,0,1,1).data,Ye!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:nt.toRgba(dt,ft,pt,Ye),css:i}}e.toColor=r})(Ue||(Ue={}));var Lt;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,s){let o=r/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=n})(Lt||(Lt={}));var El;(e=>{function t(o,l){if(Ye=(l&255)/255,Ye===1)return l;let a=l>>24&255,c=l>>16&255,h=l>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return dt=u+Math.round((a-u)*Ye),ft=d+Math.round((c-d)*Ye),pt=f+Math.round((h-f)*Ye),nt.toRgba(dt,ft,pt)}e.blend=t;function n(o,l,a){let c=Lt.relativeLuminance(o>>8),h=Lt.relativeLuminance(l>>8);if(Vn(c,h)<a){if(h<c){let f=r(o,l,a),g=Vn(c,Lt.relativeLuminance(f>>8));if(g<a){let m=i(o,l,a),w=Vn(c,Lt.relativeLuminance(m>>8));return g>w?f:m}return f}let u=i(o,l,a),d=Vn(c,Lt.relativeLuminance(u>>8));if(d<a){let f=r(o,l,a),g=Vn(c,Lt.relativeLuminance(f>>8));return d>g?u:f}return u}}e.ensureContrastRatio=n;function r(o,l,a){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,g=l>>8&255,m=Vn(Lt.relativeLuminance2(d,f,g),Lt.relativeLuminance2(c,h,u));for(;m<a&&(d>0||f>0||g>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),g-=Math.max(0,Math.ceil(g*.1)),m=Vn(Lt.relativeLuminance2(d,f,g),Lt.relativeLuminance2(c,h,u));return(d<<24|f<<16|g<<8|255)>>>0}e.reduceLuminance=r;function i(o,l,a){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,g=l>>8&255,m=Vn(Lt.relativeLuminance2(d,f,g),Lt.relativeLuminance2(c,h,u));for(;m<a&&(d<255||f<255||g<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),m=Vn(Lt.relativeLuminance2(d,f,g),Lt.relativeLuminance2(c,h,u));return(d<<24|f<<16|g<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(El||(El={}));function Fr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Vn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var vR=class extends Io{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}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()]}},la=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new pn}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 n=[],r=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(r,o,s,t,i);for(let u=0;u<h.length;u++)n.push(h[u])}i=c,o=s,l=this._workCell.fg,a=this._workCell.bg}s+=this._workCell.getChars().length||xr.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(r,o,s,t,i);for(let h=0;h<c.length;h++)n.push(c[h])}return n}_getJoinedRanges(e,t,n,r,i){let s=e.substring(t,n),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++)la._mergeRanges(o,a[c])}catch(a){console.error(a)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,s=0,o=e[r];if(o){for(let l=n;l<this._bufferService.cols;l++){let a=t.getWidth(l),c=t.getString(l).length||xr.length;if(a!==0){if(!i&&o[0]<=s&&(o[0]=l,i=!0),o[1]<=s){if(o[1]=l,o=e[++r],!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 n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,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]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};la=Ge([he(0,Nt)],la);function yR(e){return 57508<=e&&e<=57558}function SR(e){return 9472<=e&&e<=9631}function wR(e){return yR(e)||SR(e)}function xR(){return{css:{canvas:rl(),cell:rl()},device:{canvas:rl(),cell:rl(),char:{width:0,height:0,left:0,top:0}}}}function rl(){return{width:0,height:0}}var xh=class{constructor(e,t,n,r,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new pn,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,o,l,a,c,h){let u=[],d=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,g=e.getNoBgTrimmedLength();n&&g<s+1&&(g=s+1);let m,w=0,_="",v=0,y=0,E=0,R=0,C=!1,M=0,$=!1,G=0,T=0,I=[],A=c!==-1&&h!==-1;for(let P=0;P<g;P++){e.loadCell(P,this._workCell);let U=this._workCell.getWidth();if(U===0)continue;let B=!1,j=P>=T,H=P,L=this._workCell;if(d.length>0&&P===d[0][0]&&j){let ye=d.shift(),Qe=this._isCellInSelection(ye[0],t);for(v=ye[0]+1;v<ye[1];v++)j&&(j=Qe===this._isCellInSelection(v,t));j&&(j=!n||s<ye[0]||s>=ye[1]),j?(B=!0,L=new vR(this._workCell,e.translateToString(!0,ye[0],ye[1]),ye[1]-ye[0]),H=ye[1]-1,U=L.getWidth()):T=ye[1]}let W=this._isCellInSelection(P,t),S=n&&P===s,Q=A&&P>=c&&P<=h,le=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,ye=>{le=!0});let k=L.getChars()||xr;if(k===" "&&(L.isUnderline()||L.isOverline())&&(k=" "),G=U*l-a.get(k,L.isBold(),L.isItalic()),!m)m=this._document.createElement("span");else if(w&&(W&&$||!W&&!$&&L.bg===y)&&(W&&$&&f.selectionForeground||L.fg===E)&&L.extended.ext===R&&Q===C&&G===M&&!S&&!B&&!le&&j){L.isInvisible()?_+=xr:_+=k,w++;continue}else w&&(m.textContent=_),m=this._document.createElement("span"),w=0,_="";if(y=L.bg,E=L.fg,R=L.extended.ext,C=Q,M=G,$=W,B&&s>=P&&s<=H&&(s=P),!this._coreService.isCursorHidden&&S&&this._coreService.isCursorInitialized){if(I.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&I.push("xterm-cursor-blink"),I.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":I.push("xterm-cursor-outline");break;case"block":I.push("xterm-cursor-block");break;case"bar":I.push("xterm-cursor-bar");break;case"underline":I.push("xterm-cursor-underline");break}}if(L.isBold()&&I.push("xterm-bold"),L.isItalic()&&I.push("xterm-italic"),L.isDim()&&I.push("xterm-dim"),L.isInvisible()?_=xr:_=L.getChars()||xr,L.isUnderline()&&(I.push(`xterm-underline-${L.extended.underlineStyle}`),_===" "&&(_=" "),!L.isUnderlineColorDefault()))if(L.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${Io.toColorRGB(L.getUnderlineColor()).join(",")})`;else{let ye=L.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&L.isBold()&&ye<8&&(ye+=8),m.style.textDecorationColor=f.ansi[ye].css}L.isOverline()&&(I.push("xterm-overline"),_===" "&&(_=" ")),L.isStrikethrough()&&I.push("xterm-strikethrough"),Q&&(m.style.textDecoration="underline");let ge=L.getFgColor(),ie=L.getFgColorMode(),z=L.getBgColor(),q=L.getBgColorMode(),te=!!L.isInverse();if(te){let ye=ge;ge=z,z=ye;let Qe=ie;ie=q,q=Qe}let ue,_e,O=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,ye=>{ye.options.layer!=="top"&&O||(ye.backgroundColorRGB&&(q=50331648,z=ye.backgroundColorRGB.rgba>>8&16777215,ue=ye.backgroundColorRGB),ye.foregroundColorRGB&&(ie=50331648,ge=ye.foregroundColorRGB.rgba>>8&16777215,_e=ye.foregroundColorRGB),O=ye.options.layer==="top")}),!O&&W&&(ue=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,z=ue.rgba>>8&16777215,q=50331648,O=!0,f.selectionForeground&&(ie=50331648,ge=f.selectionForeground.rgba>>8&16777215,_e=f.selectionForeground)),O&&I.push("xterm-decoration-top");let Te;switch(q){case 16777216:case 33554432:Te=f.ansi[z],I.push(`xterm-bg-${z}`);break;case 50331648:Te=nt.toColor(z>>16,z>>8&255,z&255),this._addStyle(m,`background-color:#${Yg((z>>>0).toString(16),"0",6)}`);break;case 0:default:te?(Te=f.foreground,I.push("xterm-bg-257")):Te=f.background}switch(ue||L.isDim()&&(ue=je.multiplyOpacity(Te,.5)),ie){case 16777216:case 33554432:L.isBold()&&ge<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ge+=8),this._applyMinimumContrast(m,Te,f.ansi[ge],L,ue,void 0)||I.push(`xterm-fg-${ge}`);break;case 50331648:let ye=nt.toColor(ge>>16&255,ge>>8&255,ge&255);this._applyMinimumContrast(m,Te,ye,L,ue,_e)||this._addStyle(m,`color:#${Yg(ge.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(m,Te,f.foreground,L,ue,_e)||te&&I.push("xterm-fg-257")}I.length&&(m.className=I.join(" "),I.length=0),!S&&!B&&!le&&j?w++:m.textContent=_,G!==this.defaultSpacing&&(m.style.letterSpacing=`${G}px`),u.push(m),P=H}return m&&w&&(m.textContent=_),u}_applyMinimumContrast(e,t,n,r,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||wR(r.getCode()))return!1;let o=this._getContrastCache(r),l;if(!i&&!s&&(l=o.getColor(t.rgba,n.rgba)),l===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=je.ensureContrastRatio(i||t,s||n,a),o.setColor((i||t).rgba,(s||n).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 n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};xh=Ge([he(1,E0),he(2,zt),he(3,or),he(4,gi),he(5,Lo),he(6,is)],xh);function Yg(e,t,n){for(;e.length<n;)e=t+e;return e}var bR=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 n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.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=[n,r,i,s],this._container.appendChild(n),this._container.appendChild(r),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,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let i=e;t&&(i+="B"),n&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),n&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},kR=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,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=n[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=r,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=a,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function CR(){return new kR}var zc="xterm-dom-renderer-owner-",sn="xterm-rows",il="xterm-fg-",Xg="xterm-bg-",ys="xterm-focus",sl="xterm-selection",ER=1,bh=class extends ke{constructor(e,t,n,r,i,s,o,l,a,c,h,u,d,f){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=a,this._optionsService=c,this._bufferService=h,this._coreService=u,this._coreBrowserService=d,this._themeService=f,this._terminalClass=ER++,this._rowElements=[],this._selectionRenderModel=CR(),this.onRequestRedraw=this._register(new se).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(sn),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(sl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=xR(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(g=>this._injectCss(g))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(xh,document),this._element.classList.add(zc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(g=>this._handleLinkHover(g))),this._register(this._linkifier2.onHideLinkUnderline(g=>this._handleLinkLeave(g))),this._register(We(()=>{this._element.classList.remove(zc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new bR(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${sn} 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} .${sn} { 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} .${sn} .xterm-dim { color: ${je.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 n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 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} .${sn}.${ys} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${sn}.${ys} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${sn}.${ys} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${sn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${sn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${sn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${sn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${sn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${sl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${sl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${sl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${il}${s} { color: ${o.css}; }${this._terminalSelector} .${il}${s}.xterm-dim { color: ${je.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Xg}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${il}257 { color: ${je.opaque(e.background).css}; }${this._terminalSelector} .${il}257.xterm-dim { color: ${je.multiplyOpacity(je.opaque(e.background),.5).css}; }${this._terminalSelector} .${Xg}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 n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(ys),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ys),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(n){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=r===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,n,r=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${r*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 n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.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+n.ydisp,h=this._rowElements[a],u=n.lines.get(c);if(!h||!u)break;h.replaceChildren(...this._rowFactory.createRow(u,c,c===r,o,l,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${zc}${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,n,r,i,s){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,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,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=n;f<=r;++f){let g=f+l.ydisp,m=this._rowElements[f],w=l.lines.get(g);if(!m||!w)break;m.replaceChildren(...this._rowFactory.createRow(w,g,g===a,u,d,c,h,this.dimensions.css.cell.width,this._widthCache,s?f===n?e:0:-1,s?(f===r?t:i)-1:-1))}}};bh=Ge([he(7,ef),he(8,za),he(9,zt),he(10,Nt),he(11,gi),he(12,or),he(13,is)],bh);var kh=class extends ke{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new se),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new RR(this._optionsService))}catch{this._measureStrategy=this._register(new TR(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())}};kh=Ge([he(2,zt)],kh);var K0=class extends ke{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)}},TR=class extends K0{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},RR=class extends K0{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}},IR=class extends ke{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new LR(this._window)),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new se),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(yt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Se(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Se(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}},LR=class extends ke{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Gi),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(We(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Se(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)}},PR=class extends ke{constructor(){super(),this.linkProviders=[],this._register(We(()=>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,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-s,t.clientY-r.top-o]}function DR(e,t,n,r,i,s,o,l,a){if(!s)return;let c=cf(e,t,n);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),r+(a?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var Ch=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return DR(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=cf(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Ch=Ge([he(0,lr),he(1,za)],Ch);var MR=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,n){this._rowCount=n,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=[]}},V0={};H4(V0,{getSafariVersion:()=>BR,isChromeOS:()=>G0,isFirefox:()=>q0,isIpad:()=>NR,isIphone:()=>zR,isLegacyEdge:()=>AR,isLinux:()=>uf,isMac:()=>aa,isNode:()=>Oa,isSafari:()=>Y0,isWindows:()=>X0});var Oa=typeof process<"u"&&"title"in process,Po=Oa?"node":navigator.userAgent,Do=Oa?"node":navigator.platform,q0=Po.includes("Firefox"),AR=Po.includes("Edge"),Y0=/^((?!chrome|android).)*safari/i.test(Po);function BR(){if(!Y0)return 0;let e=Po.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var aa=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Do),NR=Do==="iPad",zR=Do==="iPhone",X0=["Windows","Win16","Win32","WinCE"].includes(Do),uf=Do.indexOf("Linux")>=0,G0=/\bCrOS\b/.test(Po),Q0=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,n=0,r=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),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},OR=class extends Q0{_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())}}},jR=class extends Q0{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ca=!Oa&&"requestIdleCallback"in window?jR:OR,FR=class{constructor(){this._queue=new ca}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Eh=class extends ke{constructor(e,t,n,r,i,s,o,l,a){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=l,this._renderer=this._register(new Gi),this._pausedResizeTask=new FR,this._observerDisposable=this._register(new Gi),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new se),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new se),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new se),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new MR((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new $R(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(We(()=>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 n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=We(()=>n.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,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(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 n;return(n=this._renderer.value)==null?void 0:n.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,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Eh=Ge([he(2,zt),he(3,za),he(4,gi),he(5,Lo),he(6,Nt),he(7,or),he(8,is)],Eh);var $R=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,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 WR(e,t,n,r){let i=n.buffer.x,s=n.buffer.y;if(!n.buffer.hasScrollback)return KR(i,s,e,t,n,r)+ja(s,t,n,r)+VR(i,s,e,t,n,r);let o;if(s===t)return o=i>e?"D":"C",mo(Math.abs(i-e),go(o,r));o=s>t?"D":"C";let l=Math.abs(s-t),a=UR(s>t?e:i,n)+(l-1)*n.cols+1+HR(s>t?i:e);return mo(a,go(o,r))}function HR(e,t){return e-1}function UR(e,t){return t.cols-e}function KR(e,t,n,r,i,s){return ja(t,r,i,s).length===0?"":mo(J0(e,t,e,t-ui(t,i),!1,i).length,go("D",s))}function ja(e,t,n,r){let i=e-ui(e,n),s=t-ui(t,n),o=Math.abs(i-s)-qR(e,t,n);return mo(o,go(Z0(e,t),r))}function VR(e,t,n,r,i,s){let o;ja(t,r,i,s).length>0?o=r-ui(r,i):o=t;let l=r,a=YR(e,t,n,r,i,s);return mo(J0(e,o,n,l,a==="C",i).length,go(a,s))}function qR(e,t,n){var o;let r=0,i=e-ui(e,n),s=t-ui(t,n);for(let l=0;l<Math.abs(i-s);l++){let a=Z0(e,t)==="A"?-1:1;(o=n.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&r++}return r}function ui(e,t){let n=0,r=t.buffer.lines.get(e),i=r==null?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r==null?void 0:r.isWrapped;return n}function YR(e,t,n,r,i,s){let o;return ja(n,r,i,s).length>0?o=r-ui(r,i):o=t,e<n&&o<=r||e>=n&&o<r?"C":"D"}function Z0(e,t){return e>t?"A":"B"}function J0(e,t,n,r,i,s){let o=e,l=t,a="";for(;(o!==n||l!==r)&&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 go(e,t){let n=t?"O":"[";return V.ESC+n+e}function mo(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var XR=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 Gg(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 Oc=50,GR=15,QR=50,ZR=500,JR=" ",e3=new RegExp(JR,"g"),Th=class extends ke{constructor(e,t,n,r,i,s,o,l,a){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=l,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new pn,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new se),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new se),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new XR(this._bufferService),this._activeSelectionMode=0,this._register(We(()=>{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 n=this._bufferService.buffer,r=[];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=n.translateBufferLineToString(o,!0,i,s);r.push(l)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=n.lines.get(s),l=n.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?r[r.length-1]+=l:r.push(l)}if(e[1]!==t[1]){let s=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(i=>i.replace(e3," ")).join(X0?`\r
128
+ `))}},kT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},CT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},ET=0,Uc=class{constructor(e){this.value=e,this.id=ET++}},TT=2,RT,se=class{constructor(t){var n,r,i,s;this._size=0,this._options=t,this._leakageMon=(n=this._options)!=null&&n.leakWarningThreshold?new xT((t==null?void 0:t.onListenerError)??Ml,((r=this._options)==null?void 0:r.leakWarningThreshold)??wT):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new ST(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,n,r,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),(r=(n=this._options)==null?void 0:n.onDidRemoveLastListener)==null||r.call(n),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(t,n,r)=>{var l,a,c,h,u;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],g=new CT(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Ml)(g),Te.None}if(this._disposed)return Te.None;n&&(t=t.bind(n));let i=new Uc(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=bT.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Uc?(this._deliveryQueue??(this._deliveryQueue=new IT),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=Ue(()=>{s==null||s(),this._removeListener(i)});return r instanceof Or?r.add(o):Array.isArray(r)&&r.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 n=this._listeners,r=n.indexOf(t);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*TT<=n.length){let c=0;for(let h=0;h<n.length;h++)n[h]?n[c++]=n[h]:i&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=c}}_deliver(t,n){var i;if(!t)return;let r=((i=this._options)==null?void 0:i.onListenerError)||Ml;if(!r){t.value(n);return}try{t.value(n)}catch(s){r(s)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){var n,r,i,s;if((n=this._deliveryQueue)!=null&&n.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof Uc)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}},IT=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},xh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new se,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new se,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};xh.INSTANCE=new xh;var pf=xh;function PT(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}pf.INSTANCE.onDidChangeZoomLevel;function LT(e){return pf.INSTANCE.getZoomFactor(e)}pf.INSTANCE.onDidChangeFullscreen;var fs=typeof navigator=="object"?navigator.userAgent:"",bh=fs.indexOf("Firefox")>=0,DT=fs.indexOf("AppleWebKit")>=0,gf=fs.indexOf("Chrome")>=0,MT=!gf&&fs.indexOf("Safari")>=0;fs.indexOf("Electron/")>=0;fs.indexOf("Android")>=0;var Kc=!1;if(typeof or.matchMedia=="function"){let e=or.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=or.matchMedia("(display-mode: fullscreen)");Kc=e.matches,PT(or,e,({matches:n})=>{Kc&&t.matches||(Kc=n)})}var Wi="en",kh=!1,Ch=!1,Al=!1,q0=!1,dl,Bl=Wi,Ug=Wi,AT,In,ui=globalThis,Ct,$m;typeof ui.vscode<"u"&&typeof ui.vscode.process<"u"?Ct=ui.vscode.process:typeof process<"u"&&typeof(($m=process==null?void 0:process.versions)==null?void 0:$m.node)=="string"&&(Ct=process);var Wm,BT=typeof((Wm=Ct==null?void 0:Ct.versions)==null?void 0:Wm.electron)=="string",NT=BT&&(Ct==null?void 0:Ct.type)==="renderer",Hm;if(typeof Ct=="object"){kh=Ct.platform==="win32",Ch=Ct.platform==="darwin",Al=Ct.platform==="linux",Al&&Ct.env.SNAP&&Ct.env.SNAP_REVISION,Ct.env.CI||Ct.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dl=Wi,Bl=Wi;let e=Ct.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);dl=t.userLocale,Ug=t.osLocale,Bl=t.resolvedLanguage||Wi,AT=(Hm=t.languagePack)==null?void 0:Hm.translationsConfigFile}catch{}q0=!0}else typeof navigator=="object"&&!NT?(In=navigator.userAgent,kh=In.indexOf("Windows")>=0,Ch=In.indexOf("Macintosh")>=0,(In.indexOf("Macintosh")>=0||In.indexOf("iPad")>=0||In.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Al=In.indexOf("Linux")>=0,(In==null?void 0:In.indexOf("Mobi"))>=0,Bl=globalThis._VSCODE_NLS_LANGUAGE||Wi,dl=navigator.language.toLowerCase(),Ug=dl):console.error("Unable to resolve platform.");var Y0=kh,Gn=Ch,zT=Al,Kg=q0,Qn=In,vr=Bl,OT;(e=>{function t(){return vr}e.value=t;function n(){return vr.length===2?vr==="en":vr.length>=3?vr[0]==="e"&&vr[1]==="n"&&vr[2]==="-":!1}e.isDefaultVariant=n;function r(){return vr==="en"}e.isDefault=r})(OT||(OT={}));var jT=typeof ui.postMessage=="function"&&!ui.importScripts;(()=>{if(jT){let e=[];ui.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,i=e.length;r<i;r++){let s=e[r];if(s.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),s.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),ui.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var FT=!!(Qn&&Qn.indexOf("Chrome")>=0);Qn&&Qn.indexOf("Firefox")>=0;!FT&&Qn&&Qn.indexOf("Safari")>=0;Qn&&Qn.indexOf("Edg/")>=0;Qn&&Qn.indexOf("Android")>=0;var Ti=typeof navigator=="object"?navigator:{};Kg||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ti&&Ti.clipboard&&Ti.clipboard.writeText,Kg||Ti&&Ti.clipboard&&Ti.clipboard.readText;var mf=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}},Vc=new mf,Vg=new mf,qg=new mf,$T=new Array(230),X0;(e=>{function t(l){return Vc.keyCodeToStr(l)}e.toString=t;function n(l){return Vc.strToKeyCode(l)}e.fromString=n;function r(l){return Vg.keyCodeToStr(l)}e.toUserSettingsUS=r;function i(l){return qg.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return Vg.strToKeyCode(l)||qg.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 Vc.keyCodeToStr(l)}e.toElectronAccelerator=o})(X0||(X0={}));var WT=class G0{constructor(t,n,r,i,s){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof G0&&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",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${n}${r}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new HT([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},HT=class{constructor(e){if(e.length===0)throw pT("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;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 UT(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return X0.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(bh)switch(t){case 59:return 85;case 60:if(zT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Gn)return 57;break}else if(DT&&(Gn&&t===93||!Gn&&t===92))return 57;return $T[t]||0}var KT=Gn?256:2048,VT=512,qT=1024,YT=Gn?2048:256,Yg=class{constructor(e){var n;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=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=UT(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|=KT),this.altKey&&(t|=VT),this.shiftKey&&(t|=qT),this.metaKey&&(t|=YT),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new WT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Xg=new WeakMap;function XT(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var GT=class{static getSameOriginWindowChain(e){let t=Xg.get(e);if(!t){t=[],Xg.set(e,t);let n=e,r;do r=XT(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let l=s.iframeElement.getBoundingClientRect();n+=l.top,r+=l.left}return{top:n,left:r}}},fl=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 n=GT.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Gg=class{constructor(e,t=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(gf){let s=navigator.userAgent.match(/Chrome\/(\d+)/);r=(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")r?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?bh&&!Gn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")MT&&Y0?this.deltaX=-(s.wheelDeltaX/120):r?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?bh&&!Gn?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?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()}},Q0=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),QT;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof ZT?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Et.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Q0})})(QT||(QT={}));var ZT=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?Q0:(this._emitter||(this._emitter=new se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},_f=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 _h("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new _h("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},JT=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,n=globalThis){if(this.isDisposed)throw new _h("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Ue(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},eR;(e=>{async function t(r){let i,s=await Promise.all(r.map(o=>o.then(l=>l,l=>{i||(i=l)})));if(typeof i<"u")throw i;return s}e.settled=t;function n(r){return new Promise(async(i,s)=>{try{await r(i,s)}catch(o){s(o)}})}e.withAsyncBody=n})(eR||(eR={}));var Qg=class vn{static fromArray(t){return new vn(n=>{n.emitMany(t)})}static fromPromise(t){return new vn(async n=>{n.emitMany(await t)})}static fromPromises(t){return new vn(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new vn(async n=>{await Promise.all(t.map(async r=>{for await(let i of r)n.emitOne(i)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new se,queueMicrotask(async()=>{let r={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(r)),this.resolve()}catch(i){this.reject(i)}finally{r.emitOne=void 0,r.emitMany=void 0,r.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 Et.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new vn(async r=>{for await(let i of t)r.emitOne(n(i))})}map(t){return vn.map(this,t)}static filter(t,n){return new vn(async r=>{for await(let i of t)n(i)&&r.emitOne(i)})}filter(t){return vn.filter(this,t)}static coalesce(t){return vn.filter(t,n=>!!n)}coalesce(){return vn.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return vn.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())}};Qg.EMPTY=Qg.fromArray([]);var{getWindow:qn,getWindowId:tR,onDidRegisterWindow:nR}=function(){let e=new Map,t={window:or,disposables:new Or};e.set(or.vscodeWindowId,t);let n=new se,r=new se,i=new se;function s(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Te.None;let l=new Or,a={window:o,disposables:l.add(new Or)};return e.set(o.vscodeWindowId,a),l.add(Ue(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),l.add(ye(o,_t.BEFORE_UNLOAD,()=>{i.fire(o)})),n.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:or},getDocument(o){return qn(o).document}}}(),rR=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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 ye(e,t,n,r){return new rR(e,t,n,r)}var Zg=function(e,t,n,r){return ye(e,t,n,r)},vf,iR=class extends JT{constructor(e){super(),this.defaultTarget=e&&qn(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Jg=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){Ml(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=s=>{n.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),r.set(s,!0);o.length>0;)o.sort(Jg.sort),o.shift().execute();r.set(s,!1)};vf=(s,o,l=0)=>{let a=tR(s),c=new Jg(o,l),h=e.get(a);return h||(h=[],e.set(a,h)),h.push(c),n.get(a)||(n.set(a,!0),s.requestAnimationFrame(()=>i(a))),c}})();function sR(e){let t=e.getBoundingClientRect(),n=qn(e);return{left:t.left+n.scrollX,top:t.top+n.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"},oR=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=Gt(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Gt(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Gt(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Gt(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Gt(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Gt(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Gt(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Gt(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Gt(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Gt(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Gt(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=Gt(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=Gt(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Gt(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 Gt(e){return typeof e=="number"?`${e}px`:e}function eo(e){return new oR(e)}var Z0=class{constructor(){this._hooks=new Or,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 n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(Ue(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=qn(e)}this._hooks.add(ye(s,_t.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(ye(s,_t.POINTER_UP,o=>this.stopMonitoring(!0)))}};function lR(e,t,n){let r=null,i=null;if(typeof n.value=="function"?(r="value",i=n.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",i=n.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;n[r]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var Wn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Wn||(Wn={}));var zs=class Dt extends Te{constructor(){super(),this.dispatched=!1,this.targets=new Hg,this.ignoreTargets=new Hg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Et.runAndSubscribe(nR,({window:t,disposables:n})=>{n.add(ye(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(ye(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(ye(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:or,disposables:this._store}))}static addTarget(t){if(!Dt.isTouchDevice())return Te.None;Dt.INSTANCE||(Dt.INSTANCE=new Dt);let n=Dt.INSTANCE.targets.push(t);return Ue(n)}static ignoreTarget(t){if(!Dt.isTouchDevice())return Te.None;Dt.INSTANCE||(Dt.INSTANCE=new Dt);let n=Dt.INSTANCE.ignoreTargets.push(t);return Ue(n)}static isTouchDevice(){return"ontouchstart"in or||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,i=t.targetTouches.length;r<i;r++){let s=t.targetTouches.item(r);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:n,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[n],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(Wn.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,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=n.changedTouches.length;s<o;s++){let l=n.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<Dt.HOLD_DELAY&&Math.abs(a.initialPageX-sn(a.rollingPageX))<30&&Math.abs(a.initialPageY-sn(a.rollingPageY))<30){let h=this.newGestureEvent(Wn.Tap,a.initialTarget);h.pageX=sn(a.rollingPageX),h.pageY=sn(a.rollingPageY),this.dispatchEvent(h)}else if(c>=Dt.HOLD_DELAY&&Math.abs(a.initialPageX-sn(a.rollingPageX))<30&&Math.abs(a.initialPageY-sn(a.rollingPageY))<30){let h=this.newGestureEvent(Wn.Contextmenu,a.initialTarget);h.pageX=sn(a.rollingPageX),h.pageY=sn(a.rollingPageY),this.dispatchEvent(h)}else if(i===1){let h=sn(a.rollingPageX),u=sn(a.rollingPageY),d=sn(a.rollingTimestamps)-a.rollingTimestamps[0],f=h-a.rollingPageX[0],g=u-a.rollingPageY[0],m=[...this.targets].filter(w=>a.initialTarget instanceof Node&&w.contains(a.initialTarget));this.inertia(t,m,r,Math.abs(f)/d,f>0?1:-1,h,Math.abs(g)/d,g>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(Wn.End,a.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===Wn.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>Dt.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Wn.Change||t.type===Wn.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==r;)i++,s=s.parentElement;n.push([i,r])}n.sort((r,i)=>r[0]-i[0]);for(let[r,i]of n)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,s,o,l,a,c){this.handle=vf(t,()=>{let h=Date.now(),u=h-r,d=0,f=0,g=!0;i+=Dt.SCROLL_FRICTION*u,l+=Dt.SCROLL_FRICTION*u,i>0&&(g=!1,d=s*i*u),l>0&&(g=!1,f=a*l*u);let m=this.newGestureEvent(Wn.Change);m.translationX=d,m.translationY=f,n.forEach(w=>w.dispatchEvent(m)),g||this.inertia(t,n,h,i,s,o+d,l,a,c+f)})}onTouchMove(t){let n=Date.now();for(let r=0,i=t.changedTouches.length;r<i;r++){let s=t.changedTouches.item(r);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(Wn.Change,o.initialTarget);l.translationX=s.pageX-sn(o.rollingPageX),l.translationY=s.pageY-sn(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(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};zs.SCROLL_FRICTION=-.005,zs.HOLD_DELAY=700,zs.CLEAR_TAP_COUNT_TIME=400,tt([lR],zs,"isTouchDevice",1);var aR=zs,yf=class extends Te{onclick(e,t){this._register(ye(e,_t.CLICK,n=>t(new fl(qn(e),n))))}onmousedown(e,t){this._register(ye(e,_t.MOUSE_DOWN,n=>t(new fl(qn(e),n))))}onmouseover(e,t){this._register(ye(e,_t.MOUSE_OVER,n=>t(new fl(qn(e),n))))}onmouseleave(e,t){this._register(ye(e,_t.MOUSE_LEAVE,n=>t(new fl(qn(e),n))))}onkeydown(e,t){this._register(ye(e,_t.KEY_DOWN,n=>t(new Yg(n))))}onkeyup(e,t){this._register(ye(e,_t.KEY_UP,n=>t(new Yg(n))))}oninput(e,t){this._register(ye(e,_t.INPUT,t))}onblur(e,t){this._register(ye(e,_t.BLUR,t))}onfocus(e,t){this._register(ye(e,_t.FOCUS,t))}onchange(e,t){this._register(ye(e,_t.CHANGE,t))}ignoreGesture(e){return aR.ignoreTarget(e)}},em=11,cR=class extends yf{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=em+"px",this.domNode.style.height=em+"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 Z0),this._register(Zg(this.bgDomNode,_t.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Zg(this.domNode,_t.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new iR),this._pointerdownScheduleRepeatTimer=this._register(new _f)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,qn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},uR=class Eh{constructor(t,n,r,i,s,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,i=i|0,s=s|0,o=o|0,l=l|0),this.rawScrollLeft=i,this.rawScrollTop=l,n<0&&(n=0),i+n>r&&(i=r-n),i<0&&(i=0),s<0&&(s=0),l+s>o&&(l=o-s),l<0&&(l=0),this.width=n,this.scrollWidth=r,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,n){return new Eh(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Eh(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,n){let r=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:n,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:r,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},hR=class extends Te{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new uR(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 r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.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 n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new nm(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=nm.start(this._state,n,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 n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},tm=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function qc(e,t){let n=t-e;return function(r){return e+n*pR(r)}}function dR(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var nm=class Th{constructor(t,n,r,i){this.from=t,this.to=n,this.duration=i,this.startTime=r,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,n,r){if(Math.abs(t-n)>2.5*r){let i,s;return t<n?(i=t+.75*r,s=n-.75*r):(i=t-.75*r,s=n+.75*r),dR(qc(t,i),qc(s,n),.33)}return qc(t,n)}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 n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),i=this.scrollTop(n);return new tm(r,i,!1)}return new tm(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Th.start(t,n,r)}static start(t,n,r){r=r+10;let i=Date.now()-10;return new Th(t,n,i,r)}};function fR(e){return Math.pow(e,3)}function pR(e){return 1-fR(1-e)}var gR=class extends Te{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new _f)}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":"")))}},mR=140,J0=class extends yf{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 gR(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Z0),this._shouldRender=!0,this.domNode=eo(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(ye(this.domNode.domNode,_t.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new cR(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=eo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(ye(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,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let i=sR(this.domNode.domNode);t=e.pageX-i.left,n=e.pageY-i.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=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-n);if(Y0&&o>mR){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let l=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(r.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()}},e1=class Rh{constructor(t,n,r,i,s,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),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 Rh(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,i,s){let o=Math.max(0,r-t),l=Math.max(0,o-2*n),a=i>0&&i>r;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(r*l/i))),h=(l-c)/(i-r),u=s*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=Rh._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 n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},_R=class extends J0{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new e1(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.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}},vR=class extends J0{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new e1(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.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}},yR=500,rm=50,SR=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Ih=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,n=0,r=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-r);if(t-=s,n+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(gf){let n=qn(t.browserEvent),r=LT(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let i=null,s=new SR(t,n,r);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,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(n.deltaX),l=Math.abs(n.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&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Ih.INSTANCE=new Ih;var wR=Ih,xR=class extends yf{constructor(e,t,n){super(),this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new se),this.onWillScroll=this._onWillScroll.event,this._options=kR(t),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let r={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new vR(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new _R(this._scrollable,this._options,r)),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=eo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=eo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=eo(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 _f),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=_i(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,Gn&&(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=_i(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new Gg(n))};this._mouseWheelToDispose.push(ye(this._listenOnDomNode,_t.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=wR.INSTANCE;t.acceptStandardWheelEvent(e);let n=!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=!Gn&&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=rm*s,u=a.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(c,u)}if(o){let h=rm*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),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(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,n=e.scrollLeft>0,r=n?" left":"",i=t?" top":"",s=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${r}`)}}_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(),yR)}},bR=class extends xR{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function kR(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,Gn&&(t.className+=" mac"),t}var Ph=class extends Te{constructor(e,t,n,r,i,s,o,l){super(),this._bufferService=n,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new hR({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>vf(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new bR(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(Et.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ue(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ue(()=>this._styleElement.remove())),this._register(Et.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),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Ph=tt([he(2,Kt),he(3,pr),he(4,A0),he(5,ds),he(6,Vt),he(7,gr)],Ph);var Lh=class extends Te{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,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(Ue(()=>{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 r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.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 n=e.options.x??0;return n&&n>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 n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*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()}};Lh=tt([he(1,Kt),he(2,pr),he(3,Oo),he(4,gr)],Lh);var CR=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,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Fn={full:0,left:0,center:0,right:0},yr={full:0,left:0,center:0,right:0},Es={full:0,left:0,center:0,right:0},_a=class extends Te{constructor(e,t,n,r,i,s,o,l){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new CR,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(Ue(()=>{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);yr.full=this._canvas.width,yr.left=e,yr.center=t,yr.right=e,this._refreshDrawHeightConstants(),Es.full=1,Es.left=1,Es.center=1+yr.left,Es.right=1+yr.left+yr.center}_refreshDrawHeightConstants(){Fn.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);Fn.left=t,Fn.center=t,Fn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fn.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(Es[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Fn[e.position||"full"]/2),yr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Fn[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}))}};_a=tt([he(2,Kt),he(3,Oo),he(4,gr),he(5,Vt),he(6,ds),he(7,pr)],_a);var V;(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=""))(V||(V={}));var Nl;(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="Ÿ"))(Nl||(Nl={}));var t1;(e=>e.ST=`${V.ESC}\\`)(t1||(t1={}));var Dh=class{constructor(e,t,n,r,i,s){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,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 n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!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,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${V.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),n=this._renderService.dimensions.css.cell.height,r=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=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"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=r+"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)}}};Dh=tt([he(2,Kt),he(3,Vt),he(4,bi),he(5,gr)],Dh);var yt=0,St=0,wt=0,Je=0,im={css:"#00000000",rgba:0},at;(e=>{function t(i,s,o,l){return l!==void 0?`#${Yr(i)}${Yr(s)}${Yr(o)}${Yr(l)}`:`#${Yr(i)}${Yr(s)}${Yr(o)}`}e.toCss=t;function n(i,s,o,l=255){return(i<<24|s<<16|o<<8|l)>>>0}e.toRgba=n;function r(i,s,o,l){return{css:e.toCss(i,s,o,l),rgba:e.toRgba(i,s,o,l)}}e.toColor=r})(at||(at={}));var $e;(e=>{function t(a,c){if(Je=(c.rgba&255)/255,Je===1)return{css:c.css,rgba:c.rgba};let h=c.rgba>>24&255,u=c.rgba>>16&255,d=c.rgba>>8&255,f=a.rgba>>24&255,g=a.rgba>>16&255,m=a.rgba>>8&255;yt=f+Math.round((h-f)*Je),St=g+Math.round((u-g)*Je),wt=m+Math.round((d-m)*Je);let w=at.toCss(yt,St,wt),_=at.toRgba(yt,St,wt);return{css:w,rgba:_}}e.blend=t;function n(a){return(a.rgba&255)===255}e.isOpaque=n;function r(a,c,h){let u=zl.ensureContrastRatio(a.rgba,c.rgba,h);if(u)return at.toColor(u>>24&255,u>>16&255,u>>8&255)}e.ensureContrastRatio=r;function i(a){let c=(a.rgba|255)>>>0;return[yt,St,wt]=zl.toChannels(c),{css:at.toCss(yt,St,wt),rgba:c}}e.opaque=i;function s(a,c){return Je=Math.round(c*255),[yt,St,wt]=zl.toChannels(a.rgba),{css:at.toCss(yt,St,wt,Je),rgba:at.toRgba(yt,St,wt,Je)}}e.opacity=s;function o(a,c){return Je=a.rgba&255,s(a,Je*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})($e||($e={}));var Ve;(e=>{let t,n;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",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return yt=parseInt(i.slice(1,2).repeat(2),16),St=parseInt(i.slice(2,3).repeat(2),16),wt=parseInt(i.slice(3,4).repeat(2),16),at.toColor(yt,St,wt);case 5:return yt=parseInt(i.slice(1,2).repeat(2),16),St=parseInt(i.slice(2,3).repeat(2),16),wt=parseInt(i.slice(3,4).repeat(2),16),Je=parseInt(i.slice(4,5).repeat(2),16),at.toColor(yt,St,wt,Je);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]),St=parseInt(s[2]),wt=parseInt(s[3]),Je=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),at.toColor(yt,St,wt,Je);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[yt,St,wt,Je]=t.getImageData(0,0,1,1).data,Je!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:at.toRgba(yt,St,wt,Je),css:i}}e.toColor=r})(Ve||(Ve={}));var jt;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,s){let o=r/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=n})(jt||(jt={}));var zl;(e=>{function t(o,l){if(Je=(l&255)/255,Je===1)return l;let a=l>>24&255,c=l>>16&255,h=l>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return yt=u+Math.round((a-u)*Je),St=d+Math.round((c-d)*Je),wt=f+Math.round((h-f)*Je),at.toRgba(yt,St,wt)}e.blend=t;function n(o,l,a){let c=jt.relativeLuminance(o>>8),h=jt.relativeLuminance(l>>8);if(er(c,h)<a){if(h<c){let f=r(o,l,a),g=er(c,jt.relativeLuminance(f>>8));if(g<a){let m=i(o,l,a),w=er(c,jt.relativeLuminance(m>>8));return g>w?f:m}return f}let u=i(o,l,a),d=er(c,jt.relativeLuminance(u>>8));if(d<a){let f=r(o,l,a),g=er(c,jt.relativeLuminance(f>>8));return d>g?u:f}return u}}e.ensureContrastRatio=n;function r(o,l,a){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,g=l>>8&255,m=er(jt.relativeLuminance2(d,f,g),jt.relativeLuminance2(c,h,u));for(;m<a&&(d>0||f>0||g>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),g-=Math.max(0,Math.ceil(g*.1)),m=er(jt.relativeLuminance2(d,f,g),jt.relativeLuminance2(c,h,u));return(d<<24|f<<16|g<<8|255)>>>0}e.reduceLuminance=r;function i(o,l,a){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,g=l>>8&255,m=er(jt.relativeLuminance2(d,f,g),jt.relativeLuminance2(c,h,u));for(;m<a&&(d<255||f<255||g<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),m=er(jt.relativeLuminance2(d,f,g),jt.relativeLuminance2(c,h,u));return(d<<24|f<<16|g<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(zl||(zl={}));function Yr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function er(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var ER=class extends zo{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}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()]}},va=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Cn}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 n=[],r=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(r,o,s,t,i);for(let u=0;u<h.length;u++)n.push(h[u])}i=c,o=s,l=this._workCell.fg,a=this._workCell.bg}s+=this._workCell.getChars().length||Ir.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(r,o,s,t,i);for(let h=0;h<c.length;h++)n.push(c[h])}return n}_getJoinedRanges(e,t,n,r,i){let s=e.substring(t,n),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++)va._mergeRanges(o,a[c])}catch(a){console.error(a)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,s=0,o=e[r];if(o){for(let l=n;l<this._bufferService.cols;l++){let a=t.getWidth(l),c=t.getString(l).length||Ir.length;if(a!==0){if(!i&&o[0]<=s&&(o[0]=l,i=!0),o[1]<=s){if(o[1]=l,o=e[++r],!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 n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,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]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};va=tt([he(0,Kt)],va);function TR(e){return 57508<=e&&e<=57558}function RR(e){return 9472<=e&&e<=9631}function IR(e){return TR(e)||RR(e)}function PR(){return{css:{canvas:pl(),cell:pl()},device:{canvas:pl(),cell:pl(),char:{width:0,height:0,left:0,top:0}}}}function pl(){return{width:0,height:0}}var Mh=class{constructor(e,t,n,r,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new Cn,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,o,l,a,c,h){let u=[],d=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,g=e.getNoBgTrimmedLength();n&&g<s+1&&(g=s+1);let m,w=0,_="",v=0,y=0,E=0,R=0,C=!1,M=0,$=!1,G=0,T=0,P=[],B=c!==-1&&h!==-1;for(let D=0;D<g;D++){e.loadCell(D,this._workCell);let U=this._workCell.getWidth();if(U===0)continue;let A=!1,O=D>=T,H=D,L=this._workCell;if(d.length>0&&D===d[0][0]&&O){let xe=d.shift(),nt=this._isCellInSelection(xe[0],t);for(v=xe[0]+1;v<xe[1];v++)O&&(O=nt===this._isCellInSelection(v,t));O&&(O=!n||s<xe[0]||s>=xe[1]),O?(A=!0,L=new ER(this._workCell,e.translateToString(!0,xe[0],xe[1]),xe[1]-xe[0]),H=xe[1]-1,U=L.getWidth()):T=xe[1]}let W=this._isCellInSelection(D,t),S=n&&D===s,Q=B&&D>=c&&D<=h,le=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,xe=>{le=!0});let k=L.getChars()||Ir;if(k===" "&&(L.isUnderline()||L.isOverline())&&(k=" "),G=U*l-a.get(k,L.isBold(),L.isItalic()),!m)m=this._document.createElement("span");else if(w&&(W&&$||!W&&!$&&L.bg===y)&&(W&&$&&f.selectionForeground||L.fg===E)&&L.extended.ext===R&&Q===C&&G===M&&!S&&!A&&!le&&O){L.isInvisible()?_+=Ir:_+=k,w++;continue}else w&&(m.textContent=_),m=this._document.createElement("span"),w=0,_="";if(y=L.bg,E=L.fg,R=L.extended.ext,C=Q,M=G,$=W,A&&s>=D&&s<=H&&(s=D),!this._coreService.isCursorHidden&&S&&this._coreService.isCursorInitialized){if(P.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&P.push("xterm-cursor-blink"),P.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":P.push("xterm-cursor-outline");break;case"block":P.push("xterm-cursor-block");break;case"bar":P.push("xterm-cursor-bar");break;case"underline":P.push("xterm-cursor-underline");break}}if(L.isBold()&&P.push("xterm-bold"),L.isItalic()&&P.push("xterm-italic"),L.isDim()&&P.push("xterm-dim"),L.isInvisible()?_=Ir:_=L.getChars()||Ir,L.isUnderline()&&(P.push(`xterm-underline-${L.extended.underlineStyle}`),_===" "&&(_=" "),!L.isUnderlineColorDefault()))if(L.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${zo.toColorRGB(L.getUnderlineColor()).join(",")})`;else{let xe=L.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&L.isBold()&&xe<8&&(xe+=8),m.style.textDecorationColor=f.ansi[xe].css}L.isOverline()&&(P.push("xterm-overline"),_===" "&&(_=" ")),L.isStrikethrough()&&P.push("xterm-strikethrough"),Q&&(m.style.textDecoration="underline");let ge=L.getFgColor(),te=L.getFgColorMode(),F=L.getBgColor(),ie=L.getBgColorMode(),ne=!!L.isInverse();if(ne){let xe=ge;ge=F,F=xe;let nt=te;te=ie,ie=nt}let ue,Se,z=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,xe=>{xe.options.layer!=="top"&&z||(xe.backgroundColorRGB&&(ie=50331648,F=xe.backgroundColorRGB.rgba>>8&16777215,ue=xe.backgroundColorRGB),xe.foregroundColorRGB&&(te=50331648,ge=xe.foregroundColorRGB.rgba>>8&16777215,Se=xe.foregroundColorRGB),z=xe.options.layer==="top")}),!z&&W&&(ue=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,F=ue.rgba>>8&16777215,ie=50331648,z=!0,f.selectionForeground&&(te=50331648,ge=f.selectionForeground.rgba>>8&16777215,Se=f.selectionForeground)),z&&P.push("xterm-decoration-top");let Be;switch(ie){case 16777216:case 33554432:Be=f.ansi[F],P.push(`xterm-bg-${F}`);break;case 50331648:Be=at.toColor(F>>16,F>>8&255,F&255),this._addStyle(m,`background-color:#${sm((F>>>0).toString(16),"0",6)}`);break;case 0:default:ne?(Be=f.foreground,P.push("xterm-bg-257")):Be=f.background}switch(ue||L.isDim()&&(ue=$e.multiplyOpacity(Be,.5)),te){case 16777216:case 33554432:L.isBold()&&ge<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ge+=8),this._applyMinimumContrast(m,Be,f.ansi[ge],L,ue,void 0)||P.push(`xterm-fg-${ge}`);break;case 50331648:let xe=at.toColor(ge>>16&255,ge>>8&255,ge&255);this._applyMinimumContrast(m,Be,xe,L,ue,Se)||this._addStyle(m,`color:#${sm(ge.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(m,Be,f.foreground,L,ue,Se)||ne&&P.push("xterm-fg-257")}P.length&&(m.className=P.join(" "),P.length=0),!S&&!A&&!le&&O?w++:m.textContent=_,G!==this.defaultSpacing&&(m.style.letterSpacing=`${G}px`),u.push(m),D=H}return m&&w&&(m.textContent=_),u}_applyMinimumContrast(e,t,n,r,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||IR(r.getCode()))return!1;let o=this._getContrastCache(r),l;if(!i&&!s&&(l=o.getColor(t.rgba,n.rgba)),l===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=$e.ensureContrastRatio(i||t,s||n,a),o.setColor((i||t).rgba,(s||n).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 n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};Mh=tt([he(1,z0),he(2,Vt),he(3,pr),he(4,bi),he(5,Oo),he(6,ds)],Mh);function sm(e,t,n){for(;e.length<n;)e=t+e;return e}var LR=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 n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.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=[n,r,i,s],this._container.appendChild(n),this._container.appendChild(r),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,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let i=e;t&&(i+="B"),n&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),n&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},DR=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,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=n[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=r,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=a,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function MR(){return new DR}var Yc="xterm-dom-renderer-owner-",mn="xterm-rows",gl="xterm-fg-",om="xterm-bg-",Ts="xterm-focus",ml="xterm-selection",AR=1,Ah=class extends Te{constructor(e,t,n,r,i,s,o,l,a,c,h,u,d,f){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=a,this._optionsService=c,this._bufferService=h,this._coreService=u,this._coreBrowserService=d,this._themeService=f,this._terminalClass=AR++,this._rowElements=[],this._selectionRenderModel=MR(),this.onRequestRedraw=this._register(new se).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(mn),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(ml),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=PR(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(g=>this._injectCss(g))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(Mh,document),this._element.classList.add(Yc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(g=>this._handleLinkHover(g))),this._register(this._linkifier2.onHideLinkUnderline(g=>this._handleLinkLeave(g))),this._register(Ue(()=>{this._element.classList.remove(Yc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new LR(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${mn} 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} .${mn} { 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} .${mn} .xterm-dim { color: ${$e.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 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} .${mn}.${Ts} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${mn}.${Ts} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${mn}.${Ts} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${mn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${mn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${mn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${mn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${mn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ml} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ml} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ml} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${gl}${s} { color: ${o.css}; }${this._terminalSelector} .${gl}${s}.xterm-dim { color: ${$e.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${om}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${gl}257 { color: ${$e.opaque(e.background).css}; }${this._terminalSelector} .${gl}257.xterm-dim { color: ${$e.multiplyOpacity($e.opaque(e.background),.5).css}; }${this._terminalSelector} .${om}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 n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(Ts),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ts),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(n){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=r===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,n,r=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${r*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 n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.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+n.ydisp,h=this._rowElements[a],u=n.lines.get(c);if(!h||!u)break;h.replaceChildren(...this._rowFactory.createRow(u,c,c===r,o,l,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Yc}${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,n,r,i,s){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,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,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=n;f<=r;++f){let g=f+l.ydisp,m=this._rowElements[f],w=l.lines.get(g);if(!m||!w)break;m.replaceChildren(...this._rowFactory.createRow(w,g,g===a,u,d,c,h,this.dimensions.css.cell.width,this._widthCache,s?f===n?e:0:-1,s?(f===r?t:i)-1:-1))}}};Ah=tt([he(7,df),he(8,Ya),he(9,Vt),he(10,Kt),he(11,bi),he(12,pr),he(13,ds)],Ah);var Bh=class extends Te{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new se),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new NR(this._optionsService))}catch{this._measureStrategy=this._register(new BR(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())}};Bh=tt([he(2,Vt)],Bh);var n1=class extends Te{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)}},BR=class extends n1{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},NR=class extends n1{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}},zR=class extends Te{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new OR(this._window)),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new se),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Et.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ye(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ye(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}},OR=class extends Te{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new is),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ue(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ye(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)}},jR=class extends Te{constructor(){super(),this.linkProviders=[],this._register(Ue(()=>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 Sf(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-s,t.clientY-r.top-o]}function FR(e,t,n,r,i,s,o,l,a){if(!s)return;let c=Sf(e,t,n);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),r+(a?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var Nh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return FR(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Sf(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Nh=tt([he(0,gr),he(1,Ya)],Nh);var $R=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,n){this._rowCount=n,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=[]}},r1={};Q4(r1,{getSafariVersion:()=>HR,isChromeOS:()=>l1,isFirefox:()=>i1,isIpad:()=>UR,isIphone:()=>KR,isLegacyEdge:()=>WR,isLinux:()=>wf,isMac:()=>ya,isNode:()=>Xa,isSafari:()=>s1,isWindows:()=>o1});var Xa=typeof process<"u"&&"title"in process,jo=Xa?"node":navigator.userAgent,Fo=Xa?"node":navigator.platform,i1=jo.includes("Firefox"),WR=jo.includes("Edge"),s1=/^((?!chrome|android).)*safari/i.test(jo);function HR(){if(!s1)return 0;let e=jo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ya=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Fo),UR=Fo==="iPad",KR=Fo==="iPhone",o1=["Windows","Win16","Win32","WinCE"].includes(Fo),wf=Fo.indexOf("Linux")>=0,l1=/\bCrOS\b/.test(jo),a1=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,n=0,r=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),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},VR=class extends a1{_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())}}},qR=class extends a1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Sa=!Xa&&"requestIdleCallback"in window?qR:VR,YR=class{constructor(){this._queue=new Sa}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},zh=class extends Te{constructor(e,t,n,r,i,s,o,l,a){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=l,this._renderer=this._register(new is),this._pausedResizeTask=new YR,this._observerDisposable=this._register(new is),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new se),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new se),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new se),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new $R((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new XR(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ue(()=>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 n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Ue(()=>n.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,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(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 n;return(n=this._renderer.value)==null?void 0:n.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,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};zh=tt([he(2,Vt),he(3,Ya),he(4,bi),he(5,Oo),he(6,Kt),he(7,pr),he(8,ds)],zh);var XR=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,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 GR(e,t,n,r){let i=n.buffer.x,s=n.buffer.y;if(!n.buffer.hasScrollback)return JR(i,s,e,t,n,r)+Ga(s,t,n,r)+e3(i,s,e,t,n,r);let o;if(s===t)return o=i>e?"D":"C",ko(Math.abs(i-e),bo(o,r));o=s>t?"D":"C";let l=Math.abs(s-t),a=ZR(s>t?e:i,n)+(l-1)*n.cols+1+QR(s>t?i:e);return ko(a,bo(o,r))}function QR(e,t){return e-1}function ZR(e,t){return t.cols-e}function JR(e,t,n,r,i,s){return Ga(t,r,i,s).length===0?"":ko(u1(e,t,e,t-vi(t,i),!1,i).length,bo("D",s))}function Ga(e,t,n,r){let i=e-vi(e,n),s=t-vi(t,n),o=Math.abs(i-s)-t3(e,t,n);return ko(o,bo(c1(e,t),r))}function e3(e,t,n,r,i,s){let o;Ga(t,r,i,s).length>0?o=r-vi(r,i):o=t;let l=r,a=n3(e,t,n,r,i,s);return ko(u1(e,o,n,l,a==="C",i).length,bo(a,s))}function t3(e,t,n){var o;let r=0,i=e-vi(e,n),s=t-vi(t,n);for(let l=0;l<Math.abs(i-s);l++){let a=c1(e,t)==="A"?-1:1;(o=n.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&r++}return r}function vi(e,t){let n=0,r=t.buffer.lines.get(e),i=r==null?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r==null?void 0:r.isWrapped;return n}function n3(e,t,n,r,i,s){let o;return Ga(n,r,i,s).length>0?o=r-vi(r,i):o=t,e<n&&o<=r||e>=n&&o<r?"C":"D"}function c1(e,t){return e>t?"A":"B"}function u1(e,t,n,r,i,s){let o=e,l=t,a="";for(;(o!==n||l!==r)&&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 bo(e,t){let n=t?"O":"[";return V.ESC+n+e}function ko(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var r3=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 lm(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 Xc=50,i3=15,s3=50,o3=500,l3=" ",a3=new RegExp(l3,"g"),Oh=class extends Te{constructor(e,t,n,r,i,s,o,l,a){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=l,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Cn,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new se),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new se),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new r3(this._bufferService),this._activeSelectionMode=0,this._register(Ue(()=>{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 n=this._bufferService.buffer,r=[];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=n.translateBufferLineToString(o,!0,i,s);r.push(l)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=n.lines.get(s),l=n.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?r[r.length-1]+=l:r.push(l)}if(e[1]!==t[1]){let s=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(i=>i.replace(a3," ")).join(o1?`\r
131
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())),uf&&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),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let n=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Gg(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,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],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Oc),Oc),t/=Oc,t/Math.abs(t)+Math.round(t*(GR-1)))}shouldForceSelection(e){return aa?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(),QR)}_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&&!(aa&&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 n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.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<ZR&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=WR(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);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,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!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,d=0,f=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;a<o.length&&o.charAt(a+1)===" ";)a++}else{let w=e[0],_=e[0];s.getWidth(w)===0&&(h++,w--),s.getWidth(_)===2&&(u++,_++);let v=s.getString(_).length;for(v>1&&(f+=v-1,a+=v-1);w>0&&l>0&&!this._isCharWordSeparator(s.loadCell(w-1,this._workCell));){s.loadCell(w-1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,w--):y>1&&(d+=y-1,l-=y-1),l--,w--}for(;_<s.length&&a+1<o.length&&!this._isCharWordSeparator(s.loadCell(_+1,this._workCell));){s.loadCell(_+1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===2?(u++,_++):y>1&&(f+=y-1,a+=y-1),a++,_++}}a++;let g=l+c-h+d,m=Math.min(this._bufferService.cols,a-l+h+u-d-f);if(!(!t&&o.slice(l,a).trim()==="")){if(n&&g===0&&s.getCodePoint(0)!==32){let w=i.lines.get(e[1]-1);if(w&&s.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let _=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(_){let v=this._bufferService.cols-_.start;g-=v,m+=v}}}if(r&&g+m===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let w=i.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let _=this._getWordAt([0,e[1]+1],!1,!1,!0);_&&(m+=_.length)}}return{start:g,length:m}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={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=Gg(n,this._bufferService.cols)}};Th=Ge([he(3,Nt),he(4,gi),he(5,tf),he(6,zt),he(7,lr),he(8,or)],Th);var Qg=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Zg=class{constructor(){this._color=new Qg,this._css=new Qg}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},st=Object.freeze((()=>{let e=[Ue.toColor("#2e3436"),Ue.toColor("#cc0000"),Ue.toColor("#4e9a06"),Ue.toColor("#c4a000"),Ue.toColor("#3465a4"),Ue.toColor("#75507b"),Ue.toColor("#06989a"),Ue.toColor("#d3d7cf"),Ue.toColor("#555753"),Ue.toColor("#ef2929"),Ue.toColor("#8ae234"),Ue.toColor("#fce94f"),Ue.toColor("#729fcf"),Ue.toColor("#ad7fa8"),Ue.toColor("#34e2e2"),Ue.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],s=t[n%6];e.push({css:nt.toCss(r,i,s),rgba:nt.toRgba(r,i,s)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:nt.toCss(r,r,r),rgba:nt.toRgba(r,r,r)})}return e})()),Kr=Ue.toColor("#ffffff"),Ls=Ue.toColor("#000000"),Jg=Ue.toColor("#ffffff"),em=Ls,Ss={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},t3=Kr,Rh=class extends ke{constructor(e){super(),this._optionsService=e,this._contrastCache=new Zg,this._halfContrastCache=new Zg,this._onChangeColors=this._register(new se),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Kr,background:Ls,cursor:Jg,cursorAccent:em,selectionForeground:void 0,selectionBackgroundTransparent:Ss,selectionBackgroundOpaque:je.blend(Ls,Ss),selectionInactiveBackgroundTransparent:Ss,selectionInactiveBackgroundOpaque:je.blend(Ls,Ss),scrollbarSliderBackground:je.opacity(Kr,.2),scrollbarSliderHoverBackground:je.opacity(Kr,.4),scrollbarSliderActiveBackground:je.opacity(Kr,.5),overviewRulerBorder:Kr,ansi:st.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=De(e.foreground,Kr),t.background=De(e.background,Ls),t.cursor=je.blend(t.background,De(e.cursor,Jg)),t.cursorAccent=je.blend(t.background,De(e.cursorAccent,em)),t.selectionBackgroundTransparent=De(e.selectionBackground,Ss),t.selectionBackgroundOpaque=je.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=De(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=je.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?De(e.selectionForeground,qg):void 0,t.selectionForeground===qg&&(t.selectionForeground=void 0),je.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=je.opacity(t.selectionBackgroundTransparent,.3)),je.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=je.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=De(e.scrollbarSliderBackground,je.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=De(e.scrollbarSliderHoverBackground,je.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=De(e.scrollbarSliderActiveBackground,je.opacity(t.foreground,.5)),t.overviewRulerBorder=De(e.overviewRulerBorder,t3),t.ansi=st.slice(),t.ansi[0]=De(e.black,st[0]),t.ansi[1]=De(e.red,st[1]),t.ansi[2]=De(e.green,st[2]),t.ansi[3]=De(e.yellow,st[3]),t.ansi[4]=De(e.blue,st[4]),t.ansi[5]=De(e.magenta,st[5]),t.ansi[6]=De(e.cyan,st[6]),t.ansi[7]=De(e.white,st[7]),t.ansi[8]=De(e.brightBlack,st[8]),t.ansi[9]=De(e.brightRed,st[9]),t.ansi[10]=De(e.brightGreen,st[10]),t.ansi[11]=De(e.brightYellow,st[11]),t.ansi[12]=De(e.brightBlue,st[12]),t.ansi[13]=De(e.brightMagenta,st[13]),t.ansi[14]=De(e.brightCyan,st[14]),t.ansi[15]=De(e.brightWhite,st[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=De(e.extendedAnsi[r],st[r+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()}}};Rh=Ge([he(0,zt)],Rh);function De(e,t){if(e!==void 0)try{return Ue.toColor(e)}catch{}return t}var n3=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},r3=class{constructor(){this._services=new n3,this._services.set(ef,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=G4(e).sort((s,o)=>s.index-o.index),r=[];for(let s of n){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);r.push(o)}let i=n.length>0?n[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,...r)}},i3={trace:0,debug:1,info:2,warn:3,error:4,off:5},s3="xterm.js: ",Ih=class extends ke{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=i3[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":s3)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Ih=Ge([he(0,zt)],Ih);var tm=class extends ke{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new se),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new se),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new se),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];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,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},be=3,tt=Object.freeze(new Io),ol=0,jc=2,Ps=class e1{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*be);let i=n||pn.fromCharData([0,y0,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let n=this._data[t*be+0],r=n&2097151;return[this._data[t*be+1],n&2097152?this._combined[t]:r?mr(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*be+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*be+0]=t|2097152|n[2]<<22):this._data[t*be+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*be+0]>>22}hasWidth(t){return this._data[t*be+0]&12582912}getFg(t){return this._data[t*be+1]}getBg(t){return this._data[t*be+2]}hasContent(t){return this._data[t*be+0]&4194303}getCodePoint(t){let n=this._data[t*be+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*be+0]&2097152}getString(t){let n=this._data[t*be+0];return n&2097152?this._combined[t]:n&2097151?mr(n&2097151):""}isProtected(t){return this._data[t*be+2]&536870912}loadCell(t,n){return ol=t*be,n.content=this._data[ol+0],n.fg=this._data[ol+1],n.bg=this._data[ol+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*be+0]=n.content,this._data[t*be+1]=n.fg,this._data[t*be+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*be+0]=n|r<<22,this._data[t*be+1]=i.fg,this._data[t*be+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*be+0];i&2097152?this._combined[t]+=mr(n):i&2097151?(this._combined[t]=mr(i&2097151)+mr(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*be+0]=i}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let i=new pn;for(let s=this.length-t-n-1;s>=0;--s)this.setCell(t+n+s,this.loadCell(t+s,i));for(let s=0;s<n;++s)this.setCell(t+s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let i=new pn;for(let s=0;s<this.length-t-n;++s)this.setCell(t+s,this.loadCell(t+n+s,i));for(let s=this.length-n;s<this.length;++s)this.setCell(s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*jc<this._data.buffer.byteLength;let r=t*be;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);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,r*4*jc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*jc<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,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 n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new e1(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*be+0]&4194303)return t+(this._data[t*be+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*be+0]&4194303||this._data[t*be+2]&50331648)return t+(this._data[t*be+0]>>22);return 0}copyCellsFrom(t,n,r,i,s){let o=t._data;if(s)for(let a=i-1;a>=0;a--){for(let c=0;c<be;c++)this._data[(r+a)*be+c]=o[(n+a)*be+c];o[(n+a)*be+2]&268435456&&(this._extendedAttrs[r+a]=t._extendedAttrs[n+a])}else for(let a=0;a<i;a++){for(let c=0;c<be;c++)this._data[(r+a)*be+c]=o[(n+a)*be+c];o[(n+a)*be+2]&268435456&&(this._extendedAttrs[r+a]=t._extendedAttrs[n+a])}let l=Object.keys(t._combined);for(let a=0;a<l.length;a++){let c=parseInt(l[a],10);c>=n&&(this._combined[c-n+r]=t._combined[c])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;n<r;){let o=this._data[n*be+0],l=o&2097151,a=o&2097152?this._combined[n]:l?mr(l):xr;if(s+=a,i)for(let c=0;c<a.length;++c)i.push(n);n+=o>>22||1}return i&&i.push(n),s}};function o3(e,t,n,r,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&&r>=l&&r<a){l+=h.length-1;continue}let u=0,d=_o(h,u,t),f=1,g=0;for(;f<h.length;){let w=_o(h,f,t),_=w-g,v=n-d,y=Math.min(_,v);h[u].copyCellsFrom(h[f],g,d,y,!1),d+=y,d===n&&(u++,d=0),g+=y,g===w&&(f++,g=0),d===0&&u!==0&&h[u-1].getWidth(n-1)===2&&(h[u].copyCellsFrom(h[u-1],n-1,d++,1,!1),h[u-1].setCell(n-1,i))}h[u].replaceCells(d,n,i);let m=0;for(let w=h.length-1;w>0&&(w>u||h[w].getTrimmedLength()===0);w--)m++;m>0&&(o.push(l+h.length-m),o.push(m)),l+=h.length-1}return o}function l3(e,t){let n=[],r=0,i=t[r],s=0;for(let o=0;o<e.length;o++)if(i===o){let l=t[++r];e.onDeleteEmitter.fire({index:o-s,amount:l}),o+=l-1,s+=l,i=t[++r]}else n.push(o);return{layout:n,countRemoved:s}}function a3(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function c3(e,t,n){let r=[],i=e.map((a,c)=>_o(e,c,t)).reduce((a,c)=>a+c),s=0,o=0,l=0;for(;l<i;){if(i-l<n){r.push(i-l);break}s+=n;let a=_o(e,o,t);s>a&&(s-=a,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let h=c?n-1:n;r.push(h),l+=h}return r}function _o(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var t1=class n1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=n1._nextId++,this._onDispose=this.register(new se),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ci(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};t1._nextId=1;var u3=t1,ct={},Vr=ct.B;ct[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ct.A={"#":"£"};ct.B=void 0;ct[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ct.C=ct[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ct.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ct.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ct.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ct.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ct.E=ct[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ct.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ct.H=ct[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ct["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var nm=4294967295,rm=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=tt.clone(),this.savedCharset=Vr,this.markers=[],this._nullCell=pn.fromCharData([0,y0,1,0]),this._whitespaceCell=pn.fromCharData([0,xr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ca,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new tm(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 sa),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 sa),this._whitespaceCell}getBlankLine(e,t){return new Ps(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>nm?nm:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=tt);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 tm(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(tt),r=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++)r+=+this.lines.get(o).resize(e,n);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 Ps(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new Ps(e,n)));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++)r+=+this.lines.get(s).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.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 n=this._optionsService.rawOptions.reflowCursorLine,r=o3(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(tt),n);if(r.length>0){let i=l3(this.lines,r);a3(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(tt),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ps(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(tt),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(!n){let y=this.ybase+this.y;if(y>=o&&y<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),h=c3(a,this._cols,e),u=h.length-a.length,d;this.ybase===0&&this.y!==this.lines.length-1?d=Math.max(0,this.y-this.lines.maxLength+u):d=Math.max(0,this.lines.length-this.lines.maxLength+u);let f=[];for(let y=0;y<u;y++){let E=this.getBlankLine(tt,!0);f.push(E)}f.length>0&&(i.push({start:o+a.length+s,newLines:f}),s+=f.length),a.push(...f);let g=h.length-1,m=h[g];m===0&&(g--,m=h[g]);let w=a.length-u-1,_=c;for(;w>=0;){let y=Math.min(_,m);if(a[g]===void 0)break;if(a[g].copyCellsFrom(a[w],_-y,m-y,y,!0),m-=y,m===0&&(g--,m=h[g]),_-=y,_===0){w--;let E=Math.max(w,0);_=_o(a,E,this._cols)}}for(let y=0;y<a.length;y++)h[y]<e&&a[y].setCell(h[y],r);let v=u-d;for(;v-- >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 m=0;m<this.lines.length;m++)l.push(this.lines.get(m));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 d=0;for(let m=Math.min(this.lines.maxLength-1,a+s-1);m>=0;m--)if(u&&u.start>c+d){for(let w=u.newLines.length-1;w>=0;w--)this.lines.set(m--,u.newLines[w]);m++,o.push({index:c+1,amount:u.newLines.length}),d+=u.newLines.length,u=i[++h]}else this.lines.set(m,l[c--]);let f=0;for(let m=o.length-1;m>=0;m--)o[m].index+=f,this.lines.onInsertEmitter.fire(o[m]),f+=o[m].amount;let g=Math.max(0,a+s-this.lines.maxLength);g>0&&this.lines.onTrimEmitter.fire(g)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}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 u3(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},h3=class extends ke{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new se),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new rm(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new rm(!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)}},r1=2,i1=1,Lh=class extends ke{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,r1),this.rows=Math.max(e.rawOptions.rows||0,i1),this.buffers=this._register(new h3(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,s=n.ybase+n.scrollBottom;if(n.scrollTop===0){let o=n.lines.isFull;s===n.lines.length-1?o?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(s+1,0,r.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=s-i+1;n.lines.shiftElements(i+1,o-1,-1),n.lines.set(s,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Lh=Ge([he(0,zt)],Lh);var Si={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:aa,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},d3=["normal","bold","100","200","300","400","500","600","700","800","900"],f3=class extends ke{constructor(e){super(),this._onOptionChange=this._register(new se),this.onOptionChange=this._onOptionChange.event;let t={...Si};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(We(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Si))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Si))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Si[e]),!p3(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Si[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=d3.includes(t)?t:Si[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 p3(e){return e==="block"||e==="underline"||e==="bar"}function Ds(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Ds(e[r],t-1);return n}var im=Object.freeze({insertMode:!1}),sm=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Ph=class extends ke{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new se),this.onData=this._onData.event,this._onUserInput=this._register(new se),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new se),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ds(im),this.decPrivateModes=Ds(sm)}reset(){this.modes=Ds(im),this.decPrivateModes=Ds(sm)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.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))}};Ph=Ge([he(0,Nt),he(1,k0),he(2,zt)],Ph);var om={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 Fc(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var $c=String.fromCharCode,lm={DEFAULT:e=>{let t=[Fc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${$c(t[0])}${$c(t[1])}${$c(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Fc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Fc(e,!0)};${e.x};${e.y}${t}`}},Dh=class extends ke{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new se),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(om))this.addProtocol(r,om[r]);for(let r of Object.keys(lm))this.addEncoding(r,lm[r]);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,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+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,n){if(n){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)}};Dh=Ge([he(0,Nt),he(1,gi),he(2,zt)],Dh);var Wc=[[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]],g3=[[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]],ot;function m3(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var _3=class{constructor(){if(this.version="6",!ot){ot=new Uint8Array(65536),ot.fill(1),ot[0]=0,ot.fill(0,1,32),ot.fill(0,127,160),ot.fill(2,4352,4448),ot[9001]=2,ot[9002]=2,ot.fill(2,11904,42192),ot[12351]=1,ot.fill(2,44032,55204),ot.fill(2,63744,64256),ot.fill(2,65040,65050),ot.fill(2,65072,65136),ot.fill(2,65280,65377),ot.fill(2,65504,65511);for(let e=0;e<Wc.length;++e)ot.fill(0,Wc[e][0],Wc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ot[e]:m3(e,g3)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let i=Zr.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return Zr.createPropertyValue(0,n,r)}},Zr=class Tl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new se,this.onChange=this._onChange.event;let t=new _3;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,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?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 n=0,r=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 n+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:n+=this.wcwidth(c)}let l=this.charProperties(o,r),a=Tl.extractWidth(l);Tl.extractShouldJoin(l)&&(a-=Tl.extractWidth(r)),n+=a,r=l}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},v3=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 am(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var ws=2147483647,y3=256,s1=class Mh{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>y3)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new Mh;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let s=0;s<i.length;++s)n.addSubParam(i[s]);else n.addParam(i)}return n}clone(){let t=new Mh(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 n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,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>ws?ws: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>ws?ws:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,ws):t}},xs=[],S3=class{constructor(){this._state=0,this._active=xs,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 n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=xs}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=xs,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||xs,!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,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Na(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}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 n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=xs,this._id=-1,this._state=0}}},qt=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Na(e,t,n),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(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},bs=[],w3=class{constructor(){this._handlers=Object.create(null),this._active=bs,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=bs}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=bs,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||bs,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Na(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=bs,this._ident=0}},Ms=new s1;Ms.addParam(0);var cm=class{constructor(e){this._handler=e,this._data="",this._params=Ms,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ms,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Na(e,t,n),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(n=>(this._params=Ms,this._data="",this._hitLimit=!1,n));return this._params=Ms,this._data="",this._hitLimit=!1,t}},x3=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},an=160,b3=function(){let e=new x3(4095),t=Array.apply(null,Array(256)).map((l,a)=>a),n=(l,a)=>t.slice(l,a),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let s=n(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(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(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,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(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(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(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(an,0,2,0),e.add(an,8,5,8),e.add(an,6,0,6),e.add(an,11,0,11),e.add(an,13,13,13),e}(),k3=class extends ke{constructor(e=b3){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 s1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},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(We(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new S3),this._dcsParser=this._register(new w3),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>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");n<<=8,n|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}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 n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.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 n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.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,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=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(n===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(n===!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(n===!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(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===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(r=e[l],i=this._transitions.table[this.currentState<<8|(r<160?r:an)],i>>4){case 2:for(let d=l+1;;++d){if(d>=t||(r=e[d])<32||r>126&&r<an){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(r=e[d])<32||r>126&&r<an){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(r=e[d])<32||r>126&&r<an){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(r=e[d])<32||r>126&&r<an){this._printHandler(e,l,d),l=d-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],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|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++l<t&&(r=e[l])>47&&r<60);l--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let h=this._escHandlers[this._collect<<8|r],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|r),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|r,this._params);break;case 13:for(let d=l+1;;++d)if(d>=t||(r=e[d])===24||r===26||r===27||r>127&&r<an){this._dcsParser.put(e,l,d),l=d-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,l),o;r===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 d=l+1;;d++)if(d>=t||(r=e[d])<32||r>127&&r<an){this._oscParser.put(e,l,d),l=d-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,l),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},C3=/^([\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})$/,E3=/^[\da-f]+$/;function um(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=C3.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),E3.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?s<<4:n===2?s:n===3?s>>4:s>>8}return r}}function Hc(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function T3(e,t=16){let[n,r,i]=e;return`rgb:${Hc(n,t)}/${Hc(r,t)}/${Hc(i,t)}`}var R3={"(":0,")":1,"*":2,"+":3,"-":1,".":2},fr=131072,hm=10;function dm(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 fm=5e3,pm=0,I3=class extends ke{constructor(e,t,n,r,i,s,o,l,a=new k3){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=l,this._parser=a,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Y4,this._utf8Decoder=new X4,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=tt.clone(),this._eraseAttrDataInternal=tt.clone(),this._onRequestBell=this._register(new se),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new se),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new se),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new se),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new se),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new se),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new se),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new se),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new se),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Ah(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(V.BEL,()=>this.bell()),this._parser.setExecuteHandler(V.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(V.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(V.BS,()=>this.backspace()),this._parser.setExecuteHandler(V.HT,()=>this.tab()),this._parser.setExecuteHandler(V.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(V.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Cl.IND,()=>this.index()),this._parser.setExecuteHandler(Cl.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Cl.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new qt(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new qt(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new qt(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new qt(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new qt(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new qt(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new qt(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new qt(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new qt(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new qt(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new qt(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new qt(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 ct)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 cm((c,h)=>this.requestStatusString(c,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),fm))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${fm} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>fr&&(s=this._parseStack.position+fr)}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<fr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,fr))),o||this._dirtyRowTracker.clearRange(),e.length>fr)for(let c=s;c<e.length;c+=fr){let h=c+fr<e.length?c+fr: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(n=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,i,u,c),this._logSlowResolvingAsync(n),n}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,i,c,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||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,n){let r,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&&n-t>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let d=this._parser.precedingJoinState;for(let f=t;f<n;++f){if(r=e[f],r<127&&s){let _=s[String.fromCharCode(r)];_&&(r=_.charCodeAt(0))}let g=this._unicodeService.charProperties(r,d);i=Zr.extractWidth(g);let m=Zr.extractShouldJoin(g),w=m?Zr.extractWidth(d):0;if(d=g,o&&this._onA11yChar.fire(mr(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-w>l){if(a){let _=u,v=this._activeBuffer.x-w;for(this._activeBuffer.x=w,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),w>0&&u instanceof Ps&&u.copyCellsFrom(_,v,0,w,!1);v<l;)_.setCellFromCodepoint(v++,0,1,h)}else if(this._activeBuffer.x=l-1,i===2)continue}if(m&&this._activeBuffer.x){let _=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-_,r,i);for(let v=i-w;--v>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,i-w,this._activeBuffer.getNullCell(h)),u.getWidth(l-1)===2&&u.setCellFromCodepoint(l-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,r,i,h),i>0)for(;--i;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<l&&n-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,n=>dm(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new cm(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new qt(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,n,r=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,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 n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,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}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 n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,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}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(tt));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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=e.params[0]||1,r=Zr.extractWidth(t),i=this._activeBuffer.x-r,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*n),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<n;++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(V.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(V.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(V.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(V.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(V.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,Vr),this._charsetService.setgCharset(1,Vr),this._charsetService.setgCharset(2,Vr),this._charsetService.setgCharset(3,Vr);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){(m=>(m[m.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",m[m.SET=1]="SET",m[m.RESET=2]="RESET",m[m.PERMANENTLY_SET=3]="PERMANENTLY_SET",m[m.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=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,d=(m,w)=>(o.triggerDataEvent(`${V.ESC}[${t?"":"?"}${m};${w}$y`),!0),f=m=>m?1:2,g=e.params[0];return t?g===2?d(g,4):g===4?d(g,f(o.modes.insertMode)):g===12?d(g,3):g===20?d(g,f(u.convertEol)):d(g,0):g===1?d(g,f(r.applicationCursorKeys)):g===3?d(g,u.windowOptions.setWinLines?a===80?2:a===132?1:0:0):g===6?d(g,f(r.origin)):g===7?d(g,f(r.wraparound)):g===8?d(g,3):g===9?d(g,f(i==="X10")):g===12?d(g,f(u.cursorBlink)):g===25?d(g,f(!o.isCursorHidden)):g===45?d(g,f(r.reverseWraparound)):g===66?d(g,f(r.applicationKeypad)):g===67?d(g,4):g===1e3?d(g,f(i==="VT200")):g===1002?d(g,f(i==="DRAG")):g===1003?d(g,f(i==="ANY")):g===1004?d(g,f(r.sendFocus)):g===1005?d(g,4):g===1006?d(g,f(s==="SGR")):g===1015?d(g,4):g===1016?d(g,f(s==="SGR_PIXELS")):g===1048?d(g,1):g===47||g===1047||g===1049?d(g,f(c===h)):g===2004?d(g,f(r.bracketedPasteMode)):g===2026?d(g,f(r.synchronizedOutput)):d(g,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Io.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,s=0;do{if(r[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),l=0;do r[1]===5&&(i=1),r[s+l+1+i]=o[l];while(++l<o.length&&l+s+1+i<r.length);break}if(r[1]===5&&s+i>=2||r[1]===2&&s+i>=5)break;r[1]&&(i=1)}while(++s+t<e.length&&s+i<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[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=tt.fg,e.bg=tt.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,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=tt.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=tt.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=tt.fg&16777215,r.bg&=-67108864,r.bg|=tt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${V.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[?${t};${n}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=tt.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 n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!dm(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(`${V.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>hm&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>hm&&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=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),i=n.shift();if(/^\d+$/.exec(r)){let s=parseInt(r);if(gm(s))if(i==="?")t.push({type:0,index:s});else{let o=um(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 n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,i=n.findIndex(s=>s.startsWith("id="));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,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 n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=um(n[r]);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=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let i=parseInt(n[r]);gm(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,Vr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(R3[e[0]],ct[e[1]]||Vr),!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=tt.clone(),this._eraseAttrDataInternal=tt.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 pn;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 n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=o=>(this._coreService.triggerDataEvent(`${V.ESC}${o}${V.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.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)}},Ah=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&&(pm=e,e=t,t=pm),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Ah=Ge([he(0,Nt)],Ah);function gm(e){return 0<=e&&e<256}var L3=5e7,mm=12,P3=50,D3=class extends ke{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new se),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>L3)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 n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],i=this._action(r,t);if(i){let o=l=>performance.now()-n>=mm?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(n,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-=r.length,performance.now()-n>=mm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>P3&&(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()}},Bh=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 n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);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(n),data:n,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 n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}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 n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Bh=Ge([he(0,Nt)],Bh);var _m=!1,M3=class extends ke{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Gi),this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onData=this._register(new se),this.onData=this._onData.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new se),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new se),this._instantiationService=new r3,this.optionsService=this._register(new f3(e)),this._instantiationService.setService(zt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Lh)),this._instantiationService.setService(Nt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Ih)),this._instantiationService.setService(k0,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Ph)),this._instantiationService.setService(gi,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Dh)),this._instantiationService.setService(b0,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Zr)),this._instantiationService.setService(J4,this.unicodeService),this._charsetService=this._instantiationService.createInstance(v3),this._instantiationService.setService(Z4,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Bh),this._instantiationService.setService(C0,this._oscLinkService),this._inputHandler=this._register(new I3(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(yt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(yt.forward(this._bufferService.onResize,this._onResize)),this._register(yt.forward(this.coreService.onData,this._onData)),this._register(yt.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 D3((t,n)=>this._inputHandler.parse(t,n))),this._register(yt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new se),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!_m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),_m=!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,r1),t=Math.max(t,i1),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(am.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(am(this._bufferService),!1))),this._windowsWrappingHeuristics.value=We(()=>{for(let t of e)t.dispose()})}}},A3={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 B3(e,t,n,r){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=V.ESC+"OA":i.key=V.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=V.ESC+"OD":i.key=V.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=V.ESC+"OC":i.key=V.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=V.ESC+"OB":i.key=V.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":V.DEL,e.altKey&&(i.key=V.ESC+i.key);break;case 9:if(e.shiftKey){i.key=V.ESC+"[Z";break}i.key=V.HT,i.cancel=!0;break;case 13:i.key=e.altKey?V.ESC+V.CR:V.CR,i.cancel=!0;break;case 27:i.key=V.ESC,e.altKey&&(i.key=V.ESC+V.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"D":t?i.key=V.ESC+"OD":i.key=V.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"C":t?i.key=V.ESC+"OC":i.key=V.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"A":t?i.key=V.ESC+"OA":i.key=V.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"B":t?i.key=V.ESC+"OB":i.key=V.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=V.ESC+"[2~");break;case 46:s?i.key=V.ESC+"[3;"+(s+1)+"~":i.key=V.ESC+"[3~";break;case 36:s?i.key=V.ESC+"[1;"+(s+1)+"H":t?i.key=V.ESC+"OH":i.key=V.ESC+"[H";break;case 35:s?i.key=V.ESC+"[1;"+(s+1)+"F":t?i.key=V.ESC+"OF":i.key=V.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=V.ESC+"[5;"+(s+1)+"~":i.key=V.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=V.ESC+"[6;"+(s+1)+"~":i.key=V.ESC+"[6~";break;case 112:s?i.key=V.ESC+"[1;"+(s+1)+"P":i.key=V.ESC+"OP";break;case 113:s?i.key=V.ESC+"[1;"+(s+1)+"Q":i.key=V.ESC+"OQ";break;case 114:s?i.key=V.ESC+"[1;"+(s+1)+"R":i.key=V.ESC+"OR";break;case 115:s?i.key=V.ESC+"[1;"+(s+1)+"S":i.key=V.ESC+"OS";break;case 116:s?i.key=V.ESC+"[15;"+(s+1)+"~":i.key=V.ESC+"[15~";break;case 117:s?i.key=V.ESC+"[17;"+(s+1)+"~":i.key=V.ESC+"[17~";break;case 118:s?i.key=V.ESC+"[18;"+(s+1)+"~":i.key=V.ESC+"[18~";break;case 119:s?i.key=V.ESC+"[19;"+(s+1)+"~":i.key=V.ESC+"[19~";break;case 120:s?i.key=V.ESC+"[20;"+(s+1)+"~":i.key=V.ESC+"[20~";break;case 121:s?i.key=V.ESC+"[21;"+(s+1)+"~":i.key=V.ESC+"[21~";break;case 122:s?i.key=V.ESC+"[23;"+(s+1)+"~":i.key=V.ESC+"[23~";break;case 123:s?i.key=V.ESC+"[24;"+(s+1)+"~":i.key=V.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=V.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=V.DEL:e.keyCode===219?i.key=V.ESC:e.keyCode===220?i.key=V.FS:e.keyCode===221&&(i.key=V.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let l=(o=A3[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)i.key=V.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=V.ESC+c}else if(e.keyCode===32)i.key=V.ESC+(e.ctrlKey?V.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),i.key=V.ESC+a,i.cancel=!0}}else n&&!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=V.US),e.key==="@"&&(i.key=V.NUL));break}return i}var Ze=0,N3=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ca,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ca,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,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,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||(Ze=this._search(t),Ze===-1)||this._getKey(this._array[Ze])!==t)return!1;do if(this._array[Ze]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ze),!0;while(++Ze<this._array.length&&this._getKey(this._array[Ze])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,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&&(Ze=this._search(e),!(Ze<0||Ze>=this._array.length)&&this._getKey(this._array[Ze])===e))do yield this._array[Ze];while(++Ze<this._array.length&&this._getKey(this._array[Ze])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ze=this._search(e),!(Ze<0||Ze>=this._array.length)&&this._getKey(this._array[Ze])===e))do t(this._array[Ze]);while(++Ze<this._array.length&&this._getKey(this._array[Ze])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Uc=0,vm=0,z3=class extends ke{constructor(){super(),this._decorations=new N3(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new se),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new se),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(We(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new O3(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.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,n){let r=0,i=0;for(let s of this._decorations.getKeyIterator(t))r=s.options.x??0,i=r+(s.options.width??1),e>=r&&e<i&&(!n||(s.options.layer??"bottom")===n)&&(yield s)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{Uc=i.options.x??0,vm=Uc+(i.options.width??1),e>=Uc&&e<vm&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},O3=class extends Pr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new se),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new se),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ue.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ue.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},j3=1e3,F3=class{constructor(e,t=j3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,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 r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=r-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)}},ym=20,ua=class extends ke{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,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 F3(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(Se(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(We(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<ym+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
134
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===ym+1&&(this._liveRegion.textContent+=th.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 n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let s=n.lines.get(n.ydisp+i),o=[],l=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",a=(n.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",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==r)return;let o,l;if(t===0?(o=n,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=n,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},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,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 r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((l=r.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(n.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 d=this._rowColumns.get(h);if(!d)return console.warn("columns is null. Race condition?"),null;let f=c<d.length?d[c]:d.slice(-1)[0]+1;return f>=this._terminal.cols&&(++u,f=0),{row:u,column:f}},s=i(t),o=i(n);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,n=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};ua=Ge([he(1,ef),he(2,or),he(3,lr)],ua);var Nh=class extends ke{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new se),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new se),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(We(()=>{var s;ci(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(Se(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Se(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Se(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Se(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 n=e.composedPath();for(let r=0;r<n.length;r++){let i=n[r];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 r,i;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(n=this._checkLinkProviderResult(s,e,n)):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),n=this._checkLinkProviderResult(s,e,n),((h=this._activeProviderReplies)==null?void 0:h.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);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(n.has(c)){i.splice(s--,1);break}n.add(c)}}}}_checkLinkProviderResult(e,t,n){var s;if(!this._activeProviderReplies)return n;let r=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&&r){let o=r.find(l=>this._linkAtPosition(l.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)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){n=!0,this._handleNewLink(l);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&$3(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,ci(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 n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,i,s;(r=this._currentLink)!=null&&r.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.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(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.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(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Nh=Ge([he(1,tf),he(2,lr),he(3,Nt),he(4,T0)],Nh);function $3(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 W3=class extends M3{constructor(e={}){super(e),this._linkifier=this._register(new Gi),this.browser=V0,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Gi),this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new se),this.onKey=this._onKey.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new se),this.onBell=this._onBell.event,this._onFocus=this._register(new se),this._onBlur=this._register(new se),this._onA11yCharEmitter=this._register(new se),this._onA11yTabEmitter=this._register(new se),this._onWillOpen=this._register(new se),this._setup(),this._decorationService=this._instantiationService.createInstance(z3),this._instantiationService.setService(Lo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(PR),this._instantiationService.setService(T0,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(rh)),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(yt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(yt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(yt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(yt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(We(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.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 n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let i=je.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${V.ESC}]${r};${T3(i)}${U0.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=nt.toColor(...t.color));else{let s=n;this._themeService.modifyColors(o=>o[s]=nt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ua,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.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(V.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 n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=n*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=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Se(this.element,"copy",t=>{this.hasSelection()&&V4(t,this._selectionService)}));let e=t=>q4(t,this.textarea,this.coreService,this.optionsService);this._register(Se(this.textarea,"paste",e)),this._register(Se(this.element,"paste",e)),q0?this._register(Se(this.element,"mousedown",t=>{t.button===2&&Ig(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Se(this.element,"contextmenu",t=>{Ig(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),uf&&this._register(Se(this.element,"auxclick",t=>{t.button===1&&v0(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Se(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Se(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Se(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Se(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Se(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Se(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Se(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(Se(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 n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",eh.get()),G0||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",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(IR,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(or,this._coreBrowserService),this._register(Se(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(Se(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(kh,this._document,this._helperContainer),this._instantiationService.setService(za,this._charSizeService),this._themeService=this._instantiationService.createInstance(Rh),this._instantiationService.setService(is,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(la),this._instantiationService.setService(E0,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Eh,this.rows,this.screenElement)),this._instantiationService.setService(lr,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(wh,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ch),this._instantiationService.setService(tf,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Nh,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(yh,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(Th,this.element,this.screenElement,r)),this._instantiationService.setService(tT,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(yt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(Sh,this.screenElement)),this._register(Se(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(ua,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(oa,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(oa,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(bh,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(s){var c,h,u,d,f;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 g=s.deltaY;if(g===0||e.coreMouseService.consumeWheelEvent(s,(d=(u=(h=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:h.device)==null?void 0:u.cell)==null?void 0:d.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;a=g<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 r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(n(s),s.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(s)),wheel:s=>(n(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&n(s)},mousemove:s=>{s.buttons||n(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?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),s&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),s&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),s&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Se(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return n(s),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(s)})),this._register(Se(t,"wheel",s=>{var o,l,a,c,h;if(!r.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=V.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 n;(n=this._renderService)==null||n.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){_0(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,n){this._selectionService.setSelection(e,t,n)}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 n;(n=this._selectionService)==null||n.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 n=B3(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===V.ETX||n.key===V.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=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"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(H3(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 n;(n=this._charSizeService)==null||n.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(tt));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(V.ESC+"[I"):this.coreService.triggerDataEvent(V.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function H3(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var U3=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;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)}},K3=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 pn)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Sm=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 K3(t)}getNullCell(){return new pn}},V3=class extends ke{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new se),this.onBufferChange=this._onBufferChange.event,this._normal=new Sm(this._core.buffers.normal,"normal"),this._alternate=new Sm(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)}},q3=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.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)}},Y3=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}},X3=["cols","rows"],Pn=0,G3=class extends ke{constructor(e){super(),this._core=this._register(new W3(e)),this._addonManager=this._register(new U3),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(X3.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 q3(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Y3(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 V3(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,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}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 eh.get()},set promptLabel(e){eh.set(e)},get tooMuchOutput(){return th.get()},set tooMuchOutput(e){th.set(e)}}}_verifyIntegers(...e){for(Pn of e)if(Pn===1/0||isNaN(Pn)||Pn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Pn of e)if(Pn&&(Pn===1/0||isNaN(Pn)||Pn%1!==0||Pn<0))throw new Error("This API only accepts positive integers")}};/**
132
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),wf&&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),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let n=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=lm(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,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=Sf(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Xc),Xc),t/=Xc,t/Math.abs(t)+Math.round(t*(i3-1)))}shouldForceSelection(e){return ya?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(),s3)}_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&&!(ya&&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 n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.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<o3&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=GR(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);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,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!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,d=0,f=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;a<o.length&&o.charAt(a+1)===" ";)a++}else{let w=e[0],_=e[0];s.getWidth(w)===0&&(h++,w--),s.getWidth(_)===2&&(u++,_++);let v=s.getString(_).length;for(v>1&&(f+=v-1,a+=v-1);w>0&&l>0&&!this._isCharWordSeparator(s.loadCell(w-1,this._workCell));){s.loadCell(w-1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,w--):y>1&&(d+=y-1,l-=y-1),l--,w--}for(;_<s.length&&a+1<o.length&&!this._isCharWordSeparator(s.loadCell(_+1,this._workCell));){s.loadCell(_+1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===2?(u++,_++):y>1&&(f+=y-1,a+=y-1),a++,_++}}a++;let g=l+c-h+d,m=Math.min(this._bufferService.cols,a-l+h+u-d-f);if(!(!t&&o.slice(l,a).trim()==="")){if(n&&g===0&&s.getCodePoint(0)!==32){let w=i.lines.get(e[1]-1);if(w&&s.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let _=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(_){let v=this._bufferService.cols-_.start;g-=v,m+=v}}}if(r&&g+m===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let w=i.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let _=this._getWordAt([0,e[1]+1],!1,!1,!0);_&&(m+=_.length)}}return{start:g,length:m}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={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=lm(n,this._bufferService.cols)}};Oh=tt([he(3,Kt),he(4,bi),he(5,ff),he(6,Vt),he(7,gr),he(8,pr)],Oh);var am=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},cm=class{constructor(){this._color=new am,this._css=new am}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ht=Object.freeze((()=>{let e=[Ve.toColor("#2e3436"),Ve.toColor("#cc0000"),Ve.toColor("#4e9a06"),Ve.toColor("#c4a000"),Ve.toColor("#3465a4"),Ve.toColor("#75507b"),Ve.toColor("#06989a"),Ve.toColor("#d3d7cf"),Ve.toColor("#555753"),Ve.toColor("#ef2929"),Ve.toColor("#8ae234"),Ve.toColor("#fce94f"),Ve.toColor("#729fcf"),Ve.toColor("#ad7fa8"),Ve.toColor("#34e2e2"),Ve.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],s=t[n%6];e.push({css:at.toCss(r,i,s),rgba:at.toRgba(r,i,s)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:at.toCss(r,r,r),rgba:at.toRgba(r,r,r)})}return e})()),Jr=Ve.toColor("#ffffff"),Os=Ve.toColor("#000000"),um=Ve.toColor("#ffffff"),hm=Os,Rs={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},c3=Jr,jh=class extends Te{constructor(e){super(),this._optionsService=e,this._contrastCache=new cm,this._halfContrastCache=new cm,this._onChangeColors=this._register(new se),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Jr,background:Os,cursor:um,cursorAccent:hm,selectionForeground:void 0,selectionBackgroundTransparent:Rs,selectionBackgroundOpaque:$e.blend(Os,Rs),selectionInactiveBackgroundTransparent:Rs,selectionInactiveBackgroundOpaque:$e.blend(Os,Rs),scrollbarSliderBackground:$e.opacity(Jr,.2),scrollbarSliderHoverBackground:$e.opacity(Jr,.4),scrollbarSliderActiveBackground:$e.opacity(Jr,.5),overviewRulerBorder:Jr,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=Ae(e.foreground,Jr),t.background=Ae(e.background,Os),t.cursor=$e.blend(t.background,Ae(e.cursor,um)),t.cursorAccent=$e.blend(t.background,Ae(e.cursorAccent,hm)),t.selectionBackgroundTransparent=Ae(e.selectionBackground,Rs),t.selectionBackgroundOpaque=$e.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ae(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=$e.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ae(e.selectionForeground,im):void 0,t.selectionForeground===im&&(t.selectionForeground=void 0),$e.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=$e.opacity(t.selectionBackgroundTransparent,.3)),$e.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=$e.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ae(e.scrollbarSliderBackground,$e.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ae(e.scrollbarSliderHoverBackground,$e.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ae(e.scrollbarSliderActiveBackground,$e.opacity(t.foreground,.5)),t.overviewRulerBorder=Ae(e.overviewRulerBorder,c3),t.ansi=ht.slice(),t.ansi[0]=Ae(e.black,ht[0]),t.ansi[1]=Ae(e.red,ht[1]),t.ansi[2]=Ae(e.green,ht[2]),t.ansi[3]=Ae(e.yellow,ht[3]),t.ansi[4]=Ae(e.blue,ht[4]),t.ansi[5]=Ae(e.magenta,ht[5]),t.ansi[6]=Ae(e.cyan,ht[6]),t.ansi[7]=Ae(e.white,ht[7]),t.ansi[8]=Ae(e.brightBlack,ht[8]),t.ansi[9]=Ae(e.brightRed,ht[9]),t.ansi[10]=Ae(e.brightGreen,ht[10]),t.ansi[11]=Ae(e.brightYellow,ht[11]),t.ansi[12]=Ae(e.brightBlue,ht[12]),t.ansi[13]=Ae(e.brightMagenta,ht[13]),t.ansi[14]=Ae(e.brightCyan,ht[14]),t.ansi[15]=Ae(e.brightWhite,ht[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Ae(e.extendedAnsi[r],ht[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};jh=tt([he(0,Vt)],jh);function Ae(e,t){if(e!==void 0)try{return Ve.toColor(e)}catch{}return t}var u3=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},h3=class{constructor(){this._services=new u3,this._services.set(df,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=iT(e).sort((s,o)=>s.index-o.index),r=[];for(let s of n){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);r.push(o)}let i=n.length>0?n[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,...r)}},d3={trace:0,debug:1,info:2,warn:3,error:4,off:5},f3="xterm.js: ",Fh=class extends Te{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=d3[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":f3)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Fh=tt([he(0,Vt)],Fh);var dm=class extends Te{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new se),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new se),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new se),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];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,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ee=3,lt=Object.freeze(new zo),_l=0,Gc=2,js=class h1{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ee);let i=n||Cn.fromCharData([0,P0,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let n=this._data[t*Ee+0],r=n&2097151;return[this._data[t*Ee+1],n&2097152?this._combined[t]:r?br(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*Ee+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Ee+0]=t|2097152|n[2]<<22):this._data[t*Ee+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Ee+0]>>22}hasWidth(t){return this._data[t*Ee+0]&12582912}getFg(t){return this._data[t*Ee+1]}getBg(t){return this._data[t*Ee+2]}hasContent(t){return this._data[t*Ee+0]&4194303}getCodePoint(t){let n=this._data[t*Ee+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Ee+0]&2097152}getString(t){let n=this._data[t*Ee+0];return n&2097152?this._combined[t]:n&2097151?br(n&2097151):""}isProtected(t){return this._data[t*Ee+2]&536870912}loadCell(t,n){return _l=t*Ee,n.content=this._data[_l+0],n.fg=this._data[_l+1],n.bg=this._data[_l+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Ee+0]=n.content,this._data[t*Ee+1]=n.fg,this._data[t*Ee+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Ee+0]=n|r<<22,this._data[t*Ee+1]=i.fg,this._data[t*Ee+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*Ee+0];i&2097152?this._combined[t]+=br(n):i&2097151?(this._combined[t]=br(i&2097151)+br(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*Ee+0]=i}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let i=new Cn;for(let s=this.length-t-n-1;s>=0;--s)this.setCell(t+n+s,this.loadCell(t+s,i));for(let s=0;s<n;++s)this.setCell(t+s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let i=new Cn;for(let s=0;s<this.length-t-n;++s)this.setCell(t+s,this.loadCell(t+n+s,i));for(let s=this.length-n;s<this.length;++s)this.setCell(s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Gc<this._data.buffer.byteLength;let r=t*Ee;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);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,r*4*Gc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Gc<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,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 n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new h1(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ee+0]&4194303)return t+(this._data[t*Ee+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ee+0]&4194303||this._data[t*Ee+2]&50331648)return t+(this._data[t*Ee+0]>>22);return 0}copyCellsFrom(t,n,r,i,s){let o=t._data;if(s)for(let a=i-1;a>=0;a--){for(let c=0;c<Ee;c++)this._data[(r+a)*Ee+c]=o[(n+a)*Ee+c];o[(n+a)*Ee+2]&268435456&&(this._extendedAttrs[r+a]=t._extendedAttrs[n+a])}else for(let a=0;a<i;a++){for(let c=0;c<Ee;c++)this._data[(r+a)*Ee+c]=o[(n+a)*Ee+c];o[(n+a)*Ee+2]&268435456&&(this._extendedAttrs[r+a]=t._extendedAttrs[n+a])}let l=Object.keys(t._combined);for(let a=0;a<l.length;a++){let c=parseInt(l[a],10);c>=n&&(this._combined[c-n+r]=t._combined[c])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;n<r;){let o=this._data[n*Ee+0],l=o&2097151,a=o&2097152?this._combined[n]:l?br(l):Ir;if(s+=a,i)for(let c=0;c<a.length;++c)i.push(n);n+=o>>22||1}return i&&i.push(n),s}};function p3(e,t,n,r,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&&r>=l&&r<a){l+=h.length-1;continue}let u=0,d=Co(h,u,t),f=1,g=0;for(;f<h.length;){let w=Co(h,f,t),_=w-g,v=n-d,y=Math.min(_,v);h[u].copyCellsFrom(h[f],g,d,y,!1),d+=y,d===n&&(u++,d=0),g+=y,g===w&&(f++,g=0),d===0&&u!==0&&h[u-1].getWidth(n-1)===2&&(h[u].copyCellsFrom(h[u-1],n-1,d++,1,!1),h[u-1].setCell(n-1,i))}h[u].replaceCells(d,n,i);let m=0;for(let w=h.length-1;w>0&&(w>u||h[w].getTrimmedLength()===0);w--)m++;m>0&&(o.push(l+h.length-m),o.push(m)),l+=h.length-1}return o}function g3(e,t){let n=[],r=0,i=t[r],s=0;for(let o=0;o<e.length;o++)if(i===o){let l=t[++r];e.onDeleteEmitter.fire({index:o-s,amount:l}),o+=l-1,s+=l,i=t[++r]}else n.push(o);return{layout:n,countRemoved:s}}function m3(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function _3(e,t,n){let r=[],i=e.map((a,c)=>Co(e,c,t)).reduce((a,c)=>a+c),s=0,o=0,l=0;for(;l<i;){if(i-l<n){r.push(i-l);break}s+=n;let a=Co(e,o,t);s>a&&(s-=a,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let h=c?n-1:n;r.push(h),l+=h}return r}function Co(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var d1=class f1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=f1._nextId++,this._onDispose=this.register(new se),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),_i(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};d1._nextId=1;var v3=d1,gt={},ei=gt.B;gt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};gt.A={"#":"£"};gt.B=void 0;gt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};gt.C=gt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};gt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};gt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};gt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};gt.E=gt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};gt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};gt.H=gt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var fm=4294967295,pm=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,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=ei,this.markers=[],this._nullCell=Cn.fromCharData([0,P0,1,0]),this._whitespaceCell=Cn.fromCharData([0,Ir,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Sa,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new dm(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 ma),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 ma),this._whitespaceCell}getBlankLine(e,t){return new js(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>fm?fm: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 dm(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(lt),r=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++)r+=+this.lines.get(o).resize(e,n);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 js(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new js(e,n)));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++)r+=+this.lines.get(s).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.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 n=this._optionsService.rawOptions.reflowCursorLine,r=p3(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(lt),n);if(r.length>0){let i=g3(this.lines,r);m3(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(lt),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new js(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=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(!n){let y=this.ybase+this.y;if(y>=o&&y<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),h=_3(a,this._cols,e),u=h.length-a.length,d;this.ybase===0&&this.y!==this.lines.length-1?d=Math.max(0,this.y-this.lines.maxLength+u):d=Math.max(0,this.lines.length-this.lines.maxLength+u);let f=[];for(let y=0;y<u;y++){let E=this.getBlankLine(lt,!0);f.push(E)}f.length>0&&(i.push({start:o+a.length+s,newLines:f}),s+=f.length),a.push(...f);let g=h.length-1,m=h[g];m===0&&(g--,m=h[g]);let w=a.length-u-1,_=c;for(;w>=0;){let y=Math.min(_,m);if(a[g]===void 0)break;if(a[g].copyCellsFrom(a[w],_-y,m-y,y,!0),m-=y,m===0&&(g--,m=h[g]),_-=y,_===0){w--;let E=Math.max(w,0);_=Co(a,E,this._cols)}}for(let y=0;y<a.length;y++)h[y]<e&&a[y].setCell(h[y],r);let v=u-d;for(;v-- >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 m=0;m<this.lines.length;m++)l.push(this.lines.get(m));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 d=0;for(let m=Math.min(this.lines.maxLength-1,a+s-1);m>=0;m--)if(u&&u.start>c+d){for(let w=u.newLines.length-1;w>=0;w--)this.lines.set(m--,u.newLines[w]);m++,o.push({index:c+1,amount:u.newLines.length}),d+=u.newLines.length,u=i[++h]}else this.lines.set(m,l[c--]);let f=0;for(let m=o.length-1;m>=0;m--)o[m].index+=f,this.lines.onInsertEmitter.fire(o[m]),f+=o[m].amount;let g=Math.max(0,a+s-this.lines.maxLength);g>0&&this.lines.onTrimEmitter.fire(g)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}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 v3(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},y3=class extends Te{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new se),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new pm(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new pm(!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)}},p1=2,g1=1,$h=class extends Te{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,p1),this.rows=Math.max(e.rawOptions.rows||0,g1),this.buffers=this._register(new y3(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,s=n.ybase+n.scrollBottom;if(n.scrollTop===0){let o=n.lines.isFull;s===n.lines.length-1?o?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(s+1,0,r.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=s-i+1;n.lines.shiftElements(i+1,o-1,-1),n.lines.set(s,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};$h=tt([he(0,Vt)],$h);var Ri={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:ya,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},S3=["normal","bold","100","200","300","400","500","600","700","800","900"],w3=class extends Te{constructor(e){super(),this._onOptionChange=this._register(new se),this.onOptionChange=this._onOptionChange.event;let t={...Ri};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ue(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Ri))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Ri))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Ri[e]),!x3(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ri[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=S3.includes(t)?t:Ri[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 x3(e){return e==="block"||e==="underline"||e==="bar"}function Fs(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Fs(e[r],t-1);return n}var gm=Object.freeze({insertMode:!1}),mm=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Wh=class extends Te{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new se),this.onData=this._onData.event,this._onUserInput=this._register(new se),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new se),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Fs(gm),this.decPrivateModes=Fs(mm)}reset(){this.modes=Fs(gm),this.decPrivateModes=Fs(mm)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.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))}};Wh=tt([he(0,Kt),he(1,B0),he(2,Vt)],Wh);var _m={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 Qc(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Zc=String.fromCharCode,vm={DEFAULT:e=>{let t=[Qc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Zc(t[0])}${Zc(t[1])}${Zc(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Qc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Qc(e,!0)};${e.x};${e.y}${t}`}},Hh=class extends Te{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new se),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(_m))this.addProtocol(r,_m[r]);for(let r of Object.keys(vm))this.addEncoding(r,vm[r]);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,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+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,n){if(n){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)}};Hh=tt([he(0,Kt),he(1,bi),he(2,Vt)],Hh);var Jc=[[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]],b3=[[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 k3(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var C3=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<Jc.length;++e)dt.fill(0,Jc[e][0],Jc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?dt[e]:k3(e,b3)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let i=oi.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return oi.createPropertyValue(0,n,r)}},oi=class Ol{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new se,this.onChange=this._onChange.event;let t=new C3;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,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?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 n=0,r=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 n+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:n+=this.wcwidth(c)}let l=this.charProperties(o,r),a=Ol.extractWidth(l);Ol.extractShouldJoin(l)&&(a-=Ol.extractWidth(r)),n+=a,r=l}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},E3=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 ym(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Is=2147483647,T3=256,m1=class Uh{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>T3)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new Uh;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let s=0;s<i.length;++s)n.addSubParam(i[s]);else n.addParam(i)}return n}clone(){let t=new Uh(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 n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,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>Is?Is: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>Is?Is:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,Is):t}},Ps=[],R3=class{constructor(){this._state=0,this._active=Ps,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 n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=Ps}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=Ps,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ps,!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,n){if(!this._active.length)this._handlerFb(this._id,"PUT",qa(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}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 n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Ps,this._id=-1,this._state=0}}},on=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=qa(e,t,n),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(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Ls=[],I3=class{constructor(){this._handlers=Object.create(null),this._active=Ls,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ls}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,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=Ls,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ls,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",qa(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Ls,this._ident=0}},$s=new m1;$s.addParam(0);var Sm=class{constructor(e){this._handler=e,this._data="",this._params=$s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():$s,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=qa(e,t,n),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(n=>(this._params=$s,this._data="",this._hitLimit=!1,n));return this._params=$s,this._data="",this._hitLimit=!1,t}},P3=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},yn=160,L3=function(){let e=new P3(4095),t=Array.apply(null,Array(256)).map((l,a)=>a),n=(l,a)=>t.slice(l,a),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let s=n(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(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(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,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(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(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(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(yn,0,2,0),e.add(yn,8,5,8),e.add(yn,6,0,6),e.add(yn,11,0,11),e.add(yn,13,13,13),e}(),D3=class extends Te{constructor(e=L3){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 m1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},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(Ue(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new R3),this._dcsParser=this._register(new I3),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>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");n<<=8,n|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}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 n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.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 n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.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,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=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(n===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(n===!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(n===!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(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===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(r=e[l],i=this._transitions.table[this.currentState<<8|(r<160?r:yn)],i>>4){case 2:for(let d=l+1;;++d){if(d>=t||(r=e[d])<32||r>126&&r<yn){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(r=e[d])<32||r>126&&r<yn){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(r=e[d])<32||r>126&&r<yn){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(r=e[d])<32||r>126&&r<yn){this._printHandler(e,l,d),l=d-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],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|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++l<t&&(r=e[l])>47&&r<60);l--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let h=this._escHandlers[this._collect<<8|r],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|r),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|r,this._params);break;case 13:for(let d=l+1;;++d)if(d>=t||(r=e[d])===24||r===26||r===27||r>127&&r<yn){this._dcsParser.put(e,l,d),l=d-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,l),o;r===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 d=l+1;;d++)if(d>=t||(r=e[d])<32||r>127&&r<yn){this._oscParser.put(e,l,d),l=d-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,l),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},M3=/^([\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})$/,A3=/^[\da-f]+$/;function wm(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=M3.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),A3.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?s<<4:n===2?s:n===3?s>>4:s>>8}return r}}function eu(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function B3(e,t=16){let[n,r,i]=e;return`rgb:${eu(n,t)}/${eu(r,t)}/${eu(i,t)}`}var N3={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Sr=131072,xm=10;function bm(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 km=5e3,Cm=0,z3=class extends Te{constructor(e,t,n,r,i,s,o,l,a=new D3){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=l,this._parser=a,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new nT,this._utf8Decoder=new rT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=lt.clone(),this._eraseAttrDataInternal=lt.clone(),this._onRequestBell=this._register(new se),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new se),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new se),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new se),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new se),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new se),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new se),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new se),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new se),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Kh(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(V.BEL,()=>this.bell()),this._parser.setExecuteHandler(V.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(V.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(V.BS,()=>this.backspace()),this._parser.setExecuteHandler(V.HT,()=>this.tab()),this._parser.setExecuteHandler(V.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(V.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Nl.IND,()=>this.index()),this._parser.setExecuteHandler(Nl.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Nl.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new on(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new on(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new on(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new on(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new on(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new on(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new on(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new on(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new on(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new on(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new on(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new on(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 gt)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 Sm((c,h)=>this.requestStatusString(c,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),km))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${km} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Sr&&(s=this._parseStack.position+Sr)}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<Sr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Sr))),o||this._dirtyRowTracker.clearRange(),e.length>Sr)for(let c=s;c<e.length;c+=Sr){let h=c+Sr<e.length?c+Sr: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(n=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,i,u,c),this._logSlowResolvingAsync(n),n}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,i,c,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||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,n){let r,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&&n-t>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let d=this._parser.precedingJoinState;for(let f=t;f<n;++f){if(r=e[f],r<127&&s){let _=s[String.fromCharCode(r)];_&&(r=_.charCodeAt(0))}let g=this._unicodeService.charProperties(r,d);i=oi.extractWidth(g);let m=oi.extractShouldJoin(g),w=m?oi.extractWidth(d):0;if(d=g,o&&this._onA11yChar.fire(br(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-w>l){if(a){let _=u,v=this._activeBuffer.x-w;for(this._activeBuffer.x=w,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),w>0&&u instanceof js&&u.copyCellsFrom(_,v,0,w,!1);v<l;)_.setCellFromCodepoint(v++,0,1,h)}else if(this._activeBuffer.x=l-1,i===2)continue}if(m&&this._activeBuffer.x){let _=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-_,r,i);for(let v=i-w;--v>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,i-w,this._activeBuffer.getNullCell(h)),u.getWidth(l-1)===2&&u.setCellFromCodepoint(l-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,r,i,h),i>0)for(;--i;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<l&&n-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,n=>bm(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Sm(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new on(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,n,r=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,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 n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,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}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 n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,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}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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=e.params[0]||1,r=oi.extractWidth(t),i=this._activeBuffer.x-r,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*n),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<n;++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(V.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(V.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(V.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(V.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(V.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,ei),this._charsetService.setgCharset(1,ei),this._charsetService.setgCharset(2,ei),this._charsetService.setgCharset(3,ei);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){(m=>(m[m.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",m[m.SET=1]="SET",m[m.RESET=2]="RESET",m[m.PERMANENTLY_SET=3]="PERMANENTLY_SET",m[m.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=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,d=(m,w)=>(o.triggerDataEvent(`${V.ESC}[${t?"":"?"}${m};${w}$y`),!0),f=m=>m?1:2,g=e.params[0];return t?g===2?d(g,4):g===4?d(g,f(o.modes.insertMode)):g===12?d(g,3):g===20?d(g,f(u.convertEol)):d(g,0):g===1?d(g,f(r.applicationCursorKeys)):g===3?d(g,u.windowOptions.setWinLines?a===80?2:a===132?1:0:0):g===6?d(g,f(r.origin)):g===7?d(g,f(r.wraparound)):g===8?d(g,3):g===9?d(g,f(i==="X10")):g===12?d(g,f(u.cursorBlink)):g===25?d(g,f(!o.isCursorHidden)):g===45?d(g,f(r.reverseWraparound)):g===66?d(g,f(r.applicationKeypad)):g===67?d(g,4):g===1e3?d(g,f(i==="VT200")):g===1002?d(g,f(i==="DRAG")):g===1003?d(g,f(i==="ANY")):g===1004?d(g,f(r.sendFocus)):g===1005?d(g,4):g===1006?d(g,f(s==="SGR")):g===1015?d(g,4):g===1016?d(g,f(s==="SGR_PIXELS")):g===1048?d(g,1):g===47||g===1047||g===1049?d(g,f(c===h)):g===2004?d(g,f(r.bracketedPasteMode)):g===2026?d(g,f(r.synchronizedOutput)):d(g,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=zo.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,s=0;do{if(r[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),l=0;do r[1]===5&&(i=1),r[s+l+1+i]=o[l];while(++l<o.length&&l+s+1+i<r.length);break}if(r[1]===5&&s+i>=2||r[1]===2&&s+i>=5)break;r[1]&&(i=1)}while(++s+t<e.length&&s+i<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[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,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=lt.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=lt.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=lt.fg&16777215,r.bg&=-67108864,r.bg|=lt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${V.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[?${t};${n}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 n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!bm(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(`${V.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>xm&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>xm&&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=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),i=n.shift();if(/^\d+$/.exec(r)){let s=parseInt(r);if(Em(s))if(i==="?")t.push({type:0,index:s});else{let o=wm(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 n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,i=n.findIndex(s=>s.startsWith("id="));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,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 n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=wm(n[r]);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=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let i=parseInt(n[r]);Em(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,ei),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(N3[e[0]],gt[e[1]]||ei),!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 Cn;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 n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=o=>(this._coreService.triggerDataEvent(`${V.ESC}${o}${V.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.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)}},Kh=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&&(Cm=e,e=t,t=Cm),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Kh=tt([he(0,Kt)],Kh);function Em(e){return 0<=e&&e<256}var O3=5e7,Tm=12,j3=50,F3=class extends Te{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new se),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>O3)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 n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],i=this._action(r,t);if(i){let o=l=>performance.now()-n>=Tm?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(n,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-=r.length,performance.now()-n>=Tm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>j3&&(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()}},Vh=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 n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);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(n),data:n,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 n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}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 n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Vh=tt([he(0,Kt)],Vh);var Rm=!1,$3=class extends Te{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new is),this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onData=this._register(new se),this.onData=this._onData.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new se),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new se),this._instantiationService=new h3,this.optionsService=this._register(new w3(e)),this._instantiationService.setService(Vt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance($h)),this._instantiationService.setService(Kt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Fh)),this._instantiationService.setService(B0,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Wh)),this._instantiationService.setService(bi,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Hh)),this._instantiationService.setService(A0,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(oi)),this._instantiationService.setService(lT,this.unicodeService),this._charsetService=this._instantiationService.createInstance(E3),this._instantiationService.setService(oT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Vh),this._instantiationService.setService(N0,this._oscLinkService),this._inputHandler=this._register(new z3(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Et.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Et.forward(this._bufferService.onResize,this._onResize)),this._register(Et.forward(this.coreService.onData,this._onData)),this._register(Et.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 F3((t,n)=>this._inputHandler.parse(t,n))),this._register(Et.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new se),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Rm&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Rm=!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,p1),t=Math.max(t,g1),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(ym.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(ym(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ue(()=>{for(let t of e)t.dispose()})}}},W3={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 H3(e,t,n,r){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=V.ESC+"OA":i.key=V.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=V.ESC+"OD":i.key=V.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=V.ESC+"OC":i.key=V.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=V.ESC+"OB":i.key=V.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":V.DEL,e.altKey&&(i.key=V.ESC+i.key);break;case 9:if(e.shiftKey){i.key=V.ESC+"[Z";break}i.key=V.HT,i.cancel=!0;break;case 13:i.key=e.altKey?V.ESC+V.CR:V.CR,i.cancel=!0;break;case 27:i.key=V.ESC,e.altKey&&(i.key=V.ESC+V.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"D":t?i.key=V.ESC+"OD":i.key=V.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"C":t?i.key=V.ESC+"OC":i.key=V.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"A":t?i.key=V.ESC+"OA":i.key=V.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"B":t?i.key=V.ESC+"OB":i.key=V.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=V.ESC+"[2~");break;case 46:s?i.key=V.ESC+"[3;"+(s+1)+"~":i.key=V.ESC+"[3~";break;case 36:s?i.key=V.ESC+"[1;"+(s+1)+"H":t?i.key=V.ESC+"OH":i.key=V.ESC+"[H";break;case 35:s?i.key=V.ESC+"[1;"+(s+1)+"F":t?i.key=V.ESC+"OF":i.key=V.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=V.ESC+"[5;"+(s+1)+"~":i.key=V.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=V.ESC+"[6;"+(s+1)+"~":i.key=V.ESC+"[6~";break;case 112:s?i.key=V.ESC+"[1;"+(s+1)+"P":i.key=V.ESC+"OP";break;case 113:s?i.key=V.ESC+"[1;"+(s+1)+"Q":i.key=V.ESC+"OQ";break;case 114:s?i.key=V.ESC+"[1;"+(s+1)+"R":i.key=V.ESC+"OR";break;case 115:s?i.key=V.ESC+"[1;"+(s+1)+"S":i.key=V.ESC+"OS";break;case 116:s?i.key=V.ESC+"[15;"+(s+1)+"~":i.key=V.ESC+"[15~";break;case 117:s?i.key=V.ESC+"[17;"+(s+1)+"~":i.key=V.ESC+"[17~";break;case 118:s?i.key=V.ESC+"[18;"+(s+1)+"~":i.key=V.ESC+"[18~";break;case 119:s?i.key=V.ESC+"[19;"+(s+1)+"~":i.key=V.ESC+"[19~";break;case 120:s?i.key=V.ESC+"[20;"+(s+1)+"~":i.key=V.ESC+"[20~";break;case 121:s?i.key=V.ESC+"[21;"+(s+1)+"~":i.key=V.ESC+"[21~";break;case 122:s?i.key=V.ESC+"[23;"+(s+1)+"~":i.key=V.ESC+"[23~";break;case 123:s?i.key=V.ESC+"[24;"+(s+1)+"~":i.key=V.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=V.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=V.DEL:e.keyCode===219?i.key=V.ESC:e.keyCode===220?i.key=V.FS:e.keyCode===221&&(i.key=V.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let l=(o=W3[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)i.key=V.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=V.ESC+c}else if(e.keyCode===32)i.key=V.ESC+(e.ctrlKey?V.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),i.key=V.ESC+a,i.cancel=!0}}else n&&!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=V.US),e.key==="@"&&(i.key=V.NUL));break}return i}var it=0,U3=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Sa,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Sa,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,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,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,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,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,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},tu=0,Im=0,K3=class extends Te{constructor(){super(),this._decorations=new U3(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new se),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new se),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ue(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new V3(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.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,n){let r=0,i=0;for(let s of this._decorations.getKeyIterator(t))r=s.options.x??0,i=r+(s.options.width??1),e>=r&&e<i&&(!n||(s.options.layer??"bottom")===n)&&(yield s)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{tu=i.options.x??0,Im=tu+(i.options.width??1),e>=tu&&e<Im&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},V3=class extends Or{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new se),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new se),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ve.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ve.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},q3=1e3,Y3=class{constructor(e,t=q3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,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 r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=r-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)}},Pm=20,wa=class extends Te{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,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 Y3(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(ye(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ue(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Pm+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
134
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Pm+1&&(this._liveRegion.textContent+=dh.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 n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let s=n.lines.get(n.ydisp+i),o=[],l=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",a=(n.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",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==r)return;let o,l;if(t===0?(o=n,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=n,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},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,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 r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((l=r.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(n.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 d=this._rowColumns.get(h);if(!d)return console.warn("columns is null. Race condition?"),null;let f=c<d.length?d[c]:d.slice(-1)[0]+1;return f>=this._terminal.cols&&(++u,f=0),{row:u,column:f}},s=i(t),o=i(n);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,n=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};wa=tt([he(1,df),he(2,pr),he(3,gr)],wa);var qh=class extends Te{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new se),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new se),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ue(()=>{var s;_i(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(ye(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ye(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ye(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ye(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 n=e.composedPath();for(let r=0;r<n.length;r++){let i=n[r];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 r,i;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(n=this._checkLinkProviderResult(s,e,n)):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),n=this._checkLinkProviderResult(s,e,n),((h=this._activeProviderReplies)==null?void 0:h.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);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(n.has(c)){i.splice(s--,1);break}n.add(c)}}}}_checkLinkProviderResult(e,t,n){var s;if(!this._activeProviderReplies)return n;let r=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&&r){let o=r.find(l=>this._linkAtPosition(l.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)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){n=!0,this._handleNewLink(l);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&X3(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,_i(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 n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,i,s;(r=this._currentLink)!=null&&r.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.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(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.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(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};qh=tt([he(1,ff),he(2,gr),he(3,Kt),he(4,O0)],qh);function X3(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 G3=class extends $3{constructor(e={}){super(e),this._linkifier=this._register(new is),this.browser=r1,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new is),this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new se),this.onKey=this._onKey.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new se),this.onBell=this._onBell.event,this._onFocus=this._register(new se),this._onBlur=this._register(new se),this._onA11yCharEmitter=this._register(new se),this._onA11yTabEmitter=this._register(new se),this._onWillOpen=this._register(new se),this._setup(),this._decorationService=this._instantiationService.createInstance(K3),this._instantiationService.setService(Oo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(jR),this._instantiationService.setService(O0,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(ph)),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(Et.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Et.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Et.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Et.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ue(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.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 n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let i=$e.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${V.ESC}]${r};${B3(i)}${t1.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=at.toColor(...t.color));else{let s=n;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(wa,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.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(V.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 n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=n*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=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(ye(this.element,"copy",t=>{this.hasSelection()&&eT(t,this._selectionService)}));let e=t=>tT(t,this.textarea,this.coreService,this.optionsService);this._register(ye(this.textarea,"paste",e)),this._register(ye(this.element,"paste",e)),i1?this._register(ye(this.element,"mousedown",t=>{t.button===2&&Fg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ye(this.element,"contextmenu",t=>{Fg(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),wf&&this._register(ye(this.element,"auxclick",t=>{t.button===1&&I0(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ye(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ye(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ye(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ye(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ye(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ye(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ye(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(ye(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 n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",hh.get()),l1||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(zR,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(pr,this._coreBrowserService),this._register(ye(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(ye(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Bh,this._document,this._helperContainer),this._instantiationService.setService(Ya,this._charSizeService),this._themeService=this._instantiationService.createInstance(jh),this._instantiationService.setService(ds,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(va),this._instantiationService.setService(z0,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(zh,this.rows,this.screenElement)),this._instantiationService.setService(gr,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(Dh,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Nh),this._instantiationService.setService(ff,this._mouseService);let r=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(Ph,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(Oh,this.element,this.screenElement,r)),this._instantiationService.setService(cT,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(Et.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(Lh,this.screenElement)),this._register(ye(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(wa,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(_a,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(_a,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Ah,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(s){var c,h,u,d,f;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 g=s.deltaY;if(g===0||e.coreMouseService.consumeWheelEvent(s,(d=(u=(h=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:h.device)==null?void 0:u.cell)==null?void 0:d.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;a=g<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 r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(n(s),s.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(s)),wheel:s=>(n(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&n(s)},mousemove:s=>{s.buttons||n(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?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),s&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),s&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),s&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(ye(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return n(s),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(s)})),this._register(ye(t,"wheel",s=>{var o,l,a,c,h;if(!r.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=V.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 n;(n=this._renderService)==null||n.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){R0(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,n){this._selectionService.setSelection(e,t,n)}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 n;(n=this._selectionService)==null||n.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 n=H3(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===V.ETX||n.key===V.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=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"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Q3(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 n;(n=this._charSizeService)==null||n.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(V.ESC+"[I"):this.coreService.triggerDataEvent(V.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Q3(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Z3=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;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)}},J3=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 Cn)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Lm=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 J3(t)}getNullCell(){return new Cn}},eI=class extends Te{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new se),this.onBufferChange=this._onBufferChange.event,this._normal=new Lm(this._core.buffers.normal,"normal"),this._alternate=new Lm(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)}},tI=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.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)}},nI=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}},rI=["cols","rows"],$n=0,iI=class extends Te{constructor(e){super(),this._core=this._register(new G3(e)),this._addonManager=this._register(new Z3),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(rI.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 tI(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new nI(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 eI(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,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}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 hh.get()},set promptLabel(e){hh.set(e)},get tooMuchOutput(){return dh.get()},set tooMuchOutput(e){dh.set(e)}}}_verifyIntegers(...e){for($n of e)if($n===1/0||isNaN($n)||$n%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for($n of e)if($n&&($n===1/0||isNaN($n)||$n%1!==0||$n<0))throw new Error("This API only accepts positive integers")}};/**
136
136
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
137
137
  * @license MIT
138
138
  *
@@ -143,7 +143,7 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
143
143
  * Fabrice Bellard's javascript vt100 for jslinux:
144
144
  * http://bellard.org/jslinux/
145
145
  * Copyright (c) 2011 Fabrice Bellard
146
- */var Q3=2,Z3=1,J3=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,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),i=Math.max(0,parseInt(n.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=r-l,h=i-a-t;return{cols:Math.max(Q3,Math.floor(h/e.css.cell.width)),rows:Math.max(Z3,Math.floor(c/e.css.cell.height))}}};/**
146
+ */var sI=2,oI=1,lI=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,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),i=Math.max(0,parseInt(n.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=r-l,h=i-a-t;return{cols:Math.max(sI,Math.floor(h/e.css.cell.width)),rows:Math.max(oI,Math.floor(c/e.css.cell.height))}}};/**
147
147
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
148
148
  * @license MIT
149
149
  *
@@ -154,7 +154,7 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
154
154
  * Fabrice Bellard's javascript vt100 for jslinux:
155
155
  * http://bellard.org/jslinux/
156
156
  * Copyright (c) 2011 Fabrice Bellard
157
- */var eI=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=nI.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(n,r)=>{if(this._options.hover){let{range:i}=t;this._options.hover(n,r,i)}},t))}};function tI(e){try{let t=new URL(e),n=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(n.toLocaleLowerCase())}catch{return!1}}var nI=class Rl{static computeLink(t,n,r,i){let s=new RegExp(n.source,(n.flags||"")+"g"),[o,l]=Rl._getWindowedLineStrings(t-1,r),a=o.join(""),c,h=[];for(;c=s.exec(a);){let u=c[0];if(!tI(u))continue;let[d,f]=Rl._mapStrIdx(r,l,0,c.index),[g,m]=Rl._mapStrIdx(r,d,f,u.length);if(d===-1||f===-1||g===-1||m===-1)continue;let w={start:{x:f+1,y:d+1},end:{x:m,y:g+1}};h.push({range:w,text:u,activate:i})}return h}static _getWindowedLineStrings(t,n){let r,i=t,s=t,o=0,l="",a=[];if(r=n.buffer.active.getLine(t)){let c=r.translateToString(!0);if(r.isWrapped&&c[0]!==" "){for(o=0;(r=n.buffer.active.getLine(--i))&&o<2048&&(l=r.translateToString(!0),o+=l.length,a.push(l),!(!r.isWrapped||l.indexOf(" ")!==-1)););a.reverse()}for(a.push(c),o=0;(r=n.buffer.active.getLine(++s))&&r.isWrapped&&o<2048&&(l=r.translateToString(!0),o+=l.length,a.push(l),l.indexOf(" ")===-1););}return[a,i]}static _mapStrIdx(t,n,r,i){let s=t.buffer.active,o=s.getNullCell(),l=r;for(;i;){let a=s.getLine(n);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(n+1);u&&u.isWrapped&&(u.getCell(0,o),o.getWidth()===2&&(i+=1))}if(i<0)return[n,c]}n++,l=0}return[n,l]}},rI=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function iI(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var sI=class{constructor(e=iI,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||rI;this._linkProvider=this._terminal.registerLinkProvider(new eI(this._terminal,n,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const wm={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"},o1=x.forwardRef(({onInput:e,onResize:t,fontSize:n=13},r)=>{const i=x.useRef(null),s=x.useRef(null),o=x.useRef(null),[l,a]=x.useState(!1);return x.useImperativeHandle(r,()=>({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,d=h.rows;t==null||t(u+5,d),setTimeout(()=>{t==null||t(u,d)},100)}catch{}}})),x.useEffect(()=>{if(!i.current)return;const c=new G3({cursorBlink:!0,cursorStyle:"bar",fontSize:n,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:wm,allowTransparency:!0,scrollback:5e3,convertEol:!1}),h=new J3,u=new sI;c.loadAddon(h),c.loadAddon(u),c.open(i.current),requestAnimationFrame(()=>{h.fit(),t==null||t(c.cols,c.rows),a(!0)});const d=c.onData(g=>{e(g)}),f=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{h.fit(),t==null||t(c.cols,c.rows)}catch{}})});return f.observe(i.current),s.current=c,o.current=h,()=>{d.dispose(),f.disconnect(),c.dispose(),s.current=null,o.current=null}},[n]),p.jsx("div",{ref:i,style:{width:"100%",height:"100%",background:wm.background,borderRadius:8,overflow:"hidden",opacity:l?1:0,transition:"opacity 0.2s ease"}})});o1.displayName="CliTerminal";function xm({label:e,value:t,sub:n,icon:r}){return p.jsxs("div",{style:{padding:"14px 16px",borderRadius:12,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[p.jsx("span",{style:{fontSize:16},children:r}),p.jsx("span",{style:{fontSize:10,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.5px",fontWeight:600},children:e})]}),p.jsx("div",{style:{fontSize:22,fontWeight:700,color:"#f1f5f9",letterSpacing:"-0.02em"},children:t}),n&&p.jsx("div",{style:{fontSize:11,color:"#64748b",marginTop:2},children:n})]})}function bm({value:e,max:t,label:n,color:r="#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":r;return s?p.jsxs("div",{style:{flex:1},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:3},children:[p.jsx("span",{style:{fontSize:9,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.5px",fontWeight:600},children:n}),p.jsxs("span",{style:{fontSize:10,color:"#94a3b8",fontWeight:600},children:[o,"%"]})]}),p.jsx("div",{style:{height:4,background:"rgba(255,255,255,0.04)",borderRadius:2,overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",width:`${o}%`,borderRadius:2,background:l,transition:"width 0.5s ease"}})})]}):p.jsxs("div",{style:{flex:1},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:6},children:[p.jsx("span",{style:{fontSize:11,color:"#94a3b8",fontWeight:500},children:n}),p.jsxs("span",{style:{fontSize:13,color:"#e2e8f0",fontWeight:700},children:[o,"%"]})]}),p.jsx("div",{style:{height:6,background:"rgba(255,255,255,0.04)",borderRadius:3,overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",width:`${o}%`,borderRadius:3,background:`linear-gradient(90deg, ${l}, ${l}cc)`,transition:"width 0.6s ease"}})}),i&&p.jsx("div",{style:{fontSize:10,color:"#64748b",marginTop:3},children:i})]})}function oI({screenshot:e,isCapturing:t,onRefresh:n,onAction:r,addLog:i,connState:s,connScreenshot:o}){const l=x.useRef(null),a=x.useRef(null),c=x.useRef(null),[h,u]=x.useState(!0),[d,f]=x.useState(2e3),[g,m]=x.useState(null),[w,_]=x.useState(""),[,v]=x.useState(!1),[y,E]=x.useState(!1),[R,C]=x.useState(!1),M=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[$,G]=x.useState(M?"mouse":"touch"),[T,I]=x.useState(1),[A,P]=x.useState(0),[U,B]=x.useState(0),j=x.useRef(0),H=x.useRef(t),L=x.useRef(n),W=x.useRef(r),S=x.useRef(null),Q=x.useRef(null),le=x.useRef(!1),k=x.useRef(null),ge=x.useRef(0),ie=x.useRef(null),z=x.useRef(1),q=x.useRef({x:0,y:0}),te=x.useRef(T),ue=x.useRef(A),_e=x.useRef(U),O=x.useRef($);x.useEffect(()=>{H.current=t},[t]),x.useEffect(()=>{L.current=n},[n]),x.useEffect(()=>{te.current=T},[T]),x.useEffect(()=>{ue.current=A},[A]),x.useEffect(()=>{_e.current=U},[U]),x.useEffect(()=>{W.current=r},[r]),x.useEffect(()=>{O.current=$},[$]),x.useEffect(()=>{var ne;(ne=l.current)==null||ne.focus()},[]);const Te=s==="connected",ye=s!=="connected"&&s!=="connecting",Qe=Te&&o?o:e;x.useEffect(()=>{T<=1&&(P(0),B(0))},[T]);const Pe=(ne,pe,D)=>{if(D<=1)return{x:0,y:0};const X=(D-1)/(2*D)*100,N=(D-1)/(2*D)*100;return{x:Math.max(-X,Math.min(X,ne)),y:Math.max(-N,Math.min(N,pe))}};x.useEffect(()=>{if(!h||!ye)return;let ne=null;const pe=()=>{ne&&clearInterval(ne),!document.hidden&&(ne=setInterval(()=>{var X;if(!H.current){const N=((X=l.current)==null?void 0:X.clientWidth)||0,F=Math.max(400,Math.ceil(N/100)*100);L.current(F)}},d))},D=()=>{document.hidden?(ne&&clearInterval(ne),ne=null):pe()};return pe(),document.addEventListener("visibilitychange",D),()=>{ne&&clearInterval(ne),document.removeEventListener("visibilitychange",D)}},[h,ye,d]);const _n=(ne,pe)=>{if(!c.current)return null;const D=c.current.getBoundingClientRect();return!D.width||!D.height?null:{nx:Math.max(0,Math.min(1,(ne-D.left)/D.width)),ny:Math.max(0,Math.min(1,(pe-D.top)/D.height))}},rn=async ne=>{var D;const pe=_n(ne.clientX,ne.clientY);if(pe){m(`Click: ${Math.round(pe.nx*100)}%, ${Math.round(pe.ny*100)}%`),(D=l.current)==null||D.focus();try{const X=await r("input_click",{nx:pe.nx,ny:pe.ny});X!=null&&X.success||i(`❌ Click failed: ${X==null?void 0:X.error}`)}catch(X){i(`❌ Click error: ${X.message||X}`)}}},Hn=async(ne,pe,D,X=0)=>{try{await r("input_key",{type:D?"char":"keyDown",key:ne,code:pe,text:D?ne:void 0,unmodifiedText:D?ne:void 0,modifiers:X})}catch(N){i(`❌ Key error: ${N.message||N}`)}},ar=async ne=>{if(ne.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(ne.key)&&ne.preventDefault();let D=0;ne.altKey&&(D|=1),ne.ctrlKey&&(D|=2),ne.metaKey&&(D|=4),ne.shiftKey&&(D|=8),m(`Key: ${ne.key}`),await Hn(ne.key,ne.code,ne.key.length===1,D)},Un=async ne=>{if(ne.key==="Enter"){if(ne.nativeEvent.isComposing)return;if(w){const pe=w;_(""),m(`IME Sent: ${pe}`);try{const D=await r("input_type",{text:pe});D!=null&&D.success||i(`❌ IME error: ${D==null?void 0:D.error}`)}catch(D){i(`❌ IME error: ${D.message}`)}}else m("Key: Enter"),await Hn("Enter","Enter",!1)}};x.useEffect(()=>{const ne=l.current;if(!ne)return;const pe=D=>{var X;if((X=c.current)!=null&&X.contains(D.target)){D.preventDefault();const N=Date.now();if(N-j.current<40)return;j.current=N;const F=_n(D.clientX,D.clientY);if(!F)return;m(`Scroll: ${Math.round(D.deltaY)}`),r("input_wheel",{nx:F.nx,ny:F.ny,deltaX:Math.round(D.deltaX),deltaY:Math.round(D.deltaY)}).catch(()=>{})}};return ne.addEventListener("wheel",pe,{passive:!1}),()=>ne.removeEventListener("wheel",pe)},[r]);const[Rn,Kn]=x.useState(null),xt=x.useRef(null);return x.useEffect(()=>{if($==="mouse"&&!xt.current){const ne={nx:.5,ny:.5};xt.current=ne,Kn(ne)}},[$]),x.useEffect(()=>{const ne=l.current;if(!ne)return;const pe=Y=>{if(!c.current)return null;const J=c.current.getBoundingClientRect();return!J.width||!J.height?null:{nx:Math.max(0,Math.min(1,(Y.clientX-J.left)/J.width)),ny:Math.max(0,Math.min(1,(Y.clientY-J.top)/J.height))}},D=(Y,J)=>{if(!c.current)return{dnx:0,dny:0};const oe=c.current,ae=oe.getBoundingClientRect(),fe=oe.naturalWidth||ae.width,ce=oe.naturalHeight||ae.height,b=fe/ce,Z=ae.width/ae.height;let ve,xe;return b>Z?(ve=ae.width,xe=ae.width/b):(xe=ae.height,ve=ae.height*b),{dnx:Y/ve,dny:J/xe}},X=(Y,J,oe)=>{if(oe<=1.05)return;const ae=-(Y-.5)*100,fe=-(J-.5)*100,ce=Pe(ae,fe,oe);(Math.abs(ce.x-ue.current)>.1||Math.abs(ce.y-_e.current)>.1)&&(P(ce.x),B(ce.y),ue.current=ce.x,_e.current=ce.y)},N=Y=>{if(Y.preventDefault(),Y.touches.length===1){const J=Y.touches[0];S.current={x:J.clientX,y:J.clientY,time:Date.now()},Q.current={x:J.clientX,y:J.clientY},le.current=!1,k.current=setTimeout(()=>{if(!le.current)if(le.current=!0,O.current==="mouse"){const oe=xt.current||{nx:.5,ny:.5};m("Right Click"),W.current("input_click",{...oe,button:"right"}).catch(()=>{})}else{const oe=pe(J);oe&&(m("Right Click"),W.current("input_click",{...oe,button:"right"}).catch(()=>{}))}},500)}else if(Y.touches.length===2){clearTimeout(k.current),le.current=!0;const J=Y.touches[1].clientX-Y.touches[0].clientX,oe=Y.touches[1].clientY-Y.touches[0].clientY;ie.current=Math.sqrt(J*J+oe*oe),z.current=te.current,q.current={x:(Y.touches[0].clientX+Y.touches[1].clientX)/2,y:(Y.touches[0].clientY+Y.touches[1].clientY)/2}}},F=Y=>{if(Y.preventDefault(),Y.touches.length===1&&Q.current){const J=Y.touches[0],oe=J.clientX-Q.current.x,ae=J.clientY-Q.current.y;if(!le.current&&(Math.abs(oe)>10||Math.abs(ae)>10)&&(le.current=!0,clearTimeout(k.current)),le.current)if(O.current==="mouse"){const fe=D(oe,ae),ce=xt.current||{nx:.5,ny:.5},b=Math.max(0,Math.min(1,ce.nx+fe.dnx)),Z=Math.max(0,Math.min(1,ce.ny+fe.dny));xt.current={nx:b,ny:Z},Kn({nx:b,ny:Z}),m(`Cursor: ${Math.round(b*100)}%, ${Math.round(Z*100)}%`),X(b,Z,te.current);const ve=Date.now();ve-j.current>=30&&(j.current=ve,W.current("input_mouseMoved",{nx:b,ny:Z}).catch(()=>{}))}else if(te.current>1){const fe=a.current;if(fe){const ce=fe.clientWidth,b=fe.clientHeight,Z=ue.current+oe/ce*100,ve=_e.current+ae/b*100,xe=Pe(Z,ve,te.current);P(xe.x),B(xe.y),ue.current=xe.x,_e.current=xe.y}}else{const fe=pe(J);if(fe){const ce=Date.now();ce-j.current>=40&&(j.current=ce,m("Scroll"),W.current("input_wheel",{nx:fe.nx,ny:fe.ny,deltaX:Math.round(-oe*2.5),deltaY:Math.round(-ae*2.5)}).catch(()=>{}))}}Q.current={x:J.clientX,y:J.clientY}}else if(Y.touches.length===2&&ie.current!==null){const J=Y.touches[1].clientX-Y.touches[0].clientX,oe=Y.touches[1].clientY-Y.touches[0].clientY,fe=Math.sqrt(J*J+oe*oe)/ie.current,ce=(Y.touches[0].clientX+Y.touches[1].clientX)/2,b=(Y.touches[0].clientY+Y.touches[1].clientY)/2,Z=ce-q.current.x,ve=b-q.current.y,xe=Math.abs(fe-1)>.03;if(O.current==="mouse"){if(xe){const Ae=Math.max(.5,Math.min(5,z.current*fe));I(Ae),te.current=Ae}else if(Math.abs(Z)>2||Math.abs(ve)>2){const Ae=xt.current||{nx:.5,ny:.5},ze=Date.now();ze-j.current>=30&&(j.current=ze,m("Scroll"),W.current("input_wheel",{nx:Ae.nx,ny:Ae.ny,deltaX:Math.round(-Z*3),deltaY:Math.round(-ve*3)}).catch(()=>{}))}}else{const Ae=Math.max(.5,Math.min(5,z.current*fe));I(Ae),te.current=Ae;const ze=a.current;if(ze&&Ae>1){const mi=ze.clientWidth,c1=ze.clientHeight,u1=ue.current+Z/mi*100,h1=_e.current+ve/c1*100,Mo=Pe(u1,h1,Ae);P(Mo.x),B(Mo.y),ue.current=Mo.x,_e.current=Mo.y}}q.current={x:ce,y:b}}},K=Y=>{var J;if(clearTimeout(k.current),ie.current=null,Y.touches.length===0&&Y.changedTouches.length===1&&!le.current){const oe=Y.changedTouches[0],ae=Date.now();if(ae-(((J=S.current)==null?void 0:J.time)||0)<40)return;if(O.current==="mouse"){const ce=xt.current||pe(oe);ce&&(m(`Click: ${Math.round(ce.nx*100)}%, ${Math.round(ce.ny*100)}%`),W.current("input_click",{...ce}).catch(()=>{}))}else{const ce=pe(oe);if(!ce)return;ae-ge.current<300?(m("Double tap"),W.current("input_click",{...ce,clickCount:2}).catch(()=>{}),ge.current=0):(m(`Tap: ${Math.round(ce.nx*100)}%, ${Math.round(ce.ny*100)}%`),W.current("input_click",{...ce}).catch(()=>{}),ge.current=ae)}}le.current=!1};return ne.addEventListener("touchstart",N,{passive:!1}),ne.addEventListener("touchmove",F,{passive:!1}),ne.addEventListener("touchend",K,{passive:!1}),()=>{ne.removeEventListener("touchstart",N),ne.removeEventListener("touchmove",F),ne.removeEventListener("touchend",K),clearTimeout(k.current)}},[]),p.jsxs("div",{ref:l,style:{flex:1,display:"flex",flexDirection:"column",background:"#000",position:"relative",overflow:"hidden",outline:"none",touchAction:"none"},onKeyDown:ar,onContextMenu:ne=>ne.preventDefault(),onFocus:()=>v(!0),onBlur:()=>v(!1),tabIndex:0,children:[p.jsxs("div",{ref:a,style:{flex:1,position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",background:"#000"},children:[Qe?p.jsx("img",{ref:c,src:Qe,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${T}) translate(${A}%, ${U}%)`,transformOrigin:"center center",cursor:$==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:rn,onContextMenu:ne=>ne.preventDefault(),onDragStart:ne=>ne.preventDefault()}):p.jsxs("div",{style:{color:"#333",textAlign:"center"},children:[p.jsx("div",{style:{fontSize:48,marginBottom:12},children:"🌑"}),p.jsx("div",{style:{fontSize:13,fontWeight:600},children:"Connecting to Host..."})]}),$==="mouse"&&Rn&&Qe&&c.current&&(()=>{var ve;const ne=c.current,pe=ne.getBoundingClientRect(),D=(ve=a.current)==null?void 0:ve.getBoundingClientRect();if(!D)return null;const X=ne.naturalWidth||pe.width,N=ne.naturalHeight||pe.height,F=X/N,K=pe.width/pe.height;let Y,J,oe,ae;F>K?(Y=pe.width,J=pe.width/F,oe=0,ae=(pe.height-J)/2):(J=pe.height,Y=pe.height*F,oe=(pe.width-Y)/2,ae=0);const fe=pe.left-D.left+oe+Y*Rn.nx,ce=pe.top-D.top+ae+J*Rn.ny,b=Math.max(8,Math.min(D.width-8,fe)),Z=Math.max(8,Math.min(D.height-8,ce));return p.jsxs("div",{style:{position:"absolute",left:b-8,top:Z-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[p.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),p.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),p.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)"}})]})})()]}),p.jsxs("div",{onTouchStart:ne=>ne.stopPropagation(),style:{position:"absolute",bottom:0,left:0,right:0,zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 12px",background:"rgba(0,0,0,0.75)",backdropFilter:"blur(16px)",borderTop:"1px solid rgba(255,255,255,0.08)",touchAction:"none"},children:[p.jsxs("div",{onClick:()=>{G(ne=>{const pe=ne==="touch"?"mouse":"touch";if(pe==="mouse"&&!xt.current){const D={nx:.5,ny:.5};xt.current=D,Kn(D)}return pe})},style:{height:32,padding:"0 10px",background:$==="mouse"?"rgba(59,130,246,0.25)":"rgba(255,255,255,0.08)",borderRadius:8,display:"flex",alignItems:"center",gap:5,cursor:"pointer",border:$==="mouse"?"1px solid rgba(59,130,246,0.4)":"1px solid rgba(255,255,255,0.1)"},children:[p.jsx("span",{style:{fontSize:14},children:$==="mouse"?"🖱️":"👆"}),p.jsx("span",{style:{fontSize:10,fontWeight:700,color:$==="mouse"?"#60a5fa":"#94a3b8"},children:$==="mouse"?"Mouse":"Touch"})]}),p.jsxs("div",{style:{position:"relative"},children:[p.jsx("div",{onClick:()=>{C(!R),E(!1)},style:{width:32,height:32,background:R?"rgba(16,185,129,0.25)":"rgba(255,255,255,0.08)",borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:R?"1px solid rgba(16,185,129,0.4)":"1px solid rgba(255,255,255,0.1)"},children:p.jsx("span",{style:{fontSize:14},children:"⌨️"})}),R&&p.jsx("div",{style:{position:"absolute",bottom:40,left:"50%",transform:"translateX(-50%)",width:220,background:"rgba(23,23,23,0.98)",backdropFilter:"blur(30px)",borderRadius:12,border:"1px solid rgba(255,255,255,0.2)",padding:"10px 12px",boxShadow:"0 10px 30px rgba(0,0,0,0.8)",display:"flex",flexDirection:"column",gap:8,animation:"slideUp 0.15s ease-out",zIndex:2e3},children:p.jsx("input",{type:"text",placeholder:"Type & Enter...",value:w,autoFocus:!0,onTouchStart:ne=>ne.stopPropagation(),onChange:ne=>_(ne.target.value),onKeyDown:Un,style:{width:"100%",background:"rgba(0,0,0,0.6)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:8,padding:"8px 10px",color:"#fff",fontSize:13,outline:"none"}})})]}),p.jsx("div",{style:{position:"relative"},children:p.jsx("div",{onClick:()=>{E(!y),C(!1)},style:{width:32,height:32,background:y?"rgba(59,130,246,0.25)":"rgba(255,255,255,0.08)",borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:y?"1px solid rgba(59,130,246,0.4)":"1px solid rgba(255,255,255,0.1)"},children:p.jsx("span",{style:{fontSize:14},children:"⚙️"})})}),p.jsx("div",{style:{width:1,height:18,background:"rgba(255,255,255,0.1)"}}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:3,padding:"2px 6px",borderRadius:6,background:Te?"rgba(16,185,129,0.12)":"rgba(251,191,36,0.12)"},children:[p.jsx("div",{style:{width:4,height:4,borderRadius:"50%",background:Te?"#10b981":"#fbbf24"}}),p.jsx("span",{style:{fontSize:8,fontWeight:800,color:Te?"#10b981":"#fbbf24"},children:Te?"Connected":"WS"})]}),T>1&&p.jsxs("span",{style:{fontSize:8,fontWeight:700,color:"#6366f1"},children:[Math.round(T*100),"%"]}),g&&p.jsx("span",{style:{fontSize:8,color:"#888",fontWeight:600,maxWidth:100,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g})]})]}),y&&p.jsxs("div",{onTouchStart:ne=>ne.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:[p.jsx("div",{style:{fontSize:9,fontWeight:900,color:"#3b82f6",letterSpacing:1.5},children:"SETTINGS"}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[p.jsxs("div",{style:{fontSize:10,color:"#888",fontWeight:700},children:["ZOOM: ",T===1?"FIT":`${Math.round(T*100)}%`]}),p.jsxs("div",{style:{display:"flex",gap:4},children:[p.jsx("button",{onClick:ne=>{ne.stopPropagation(),I(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:"−"}),p.jsx("button",{onClick:ne=>{ne.stopPropagation(),I(1),P(0),B(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"}),p.jsx("button",{onClick:ne=>{ne.stopPropagation(),I(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:"+"})]})]}),p.jsx("button",{onClick:ne=>{var X;ne.stopPropagation();const pe=((X=l.current)==null?void 0:X.clientWidth)||0,D=pe>0?Math.max(400,Math.ceil(pe/100)*100):void 0;n(D)},style:{width:"100%",background:"#3b82f6",color:"#fff",border:"none",padding:"8px",borderRadius:6,fontSize:11,fontWeight:800,cursor:"pointer"},children:"FORCE SYNC"}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(255,255,255,0.05)",padding:"6px 10px",borderRadius:6},children:[p.jsx("span",{style:{fontSize:10,color:"#888",fontWeight:700},children:"AUTO REF."}),p.jsx("input",{type:"checkbox",checked:h,onChange:ne=>u(ne.target.checked)})]}),p.jsxs("select",{value:d,onChange:ne=>f(Number(ne.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:[p.jsx("option",{value:500,children:"0.5s Interval"}),p.jsx("option",{value:1e3,children:"1.0s Interval"}),p.jsx("option",{value:2e3,children:"2.0s Interval"}),p.jsx("option",{value:4e3,children:"4.0s Interval"})]})]}),p.jsx("style",{children:`
157
+ */var aI=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=uI.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(n,r)=>{if(this._options.hover){let{range:i}=t;this._options.hover(n,r,i)}},t))}};function cI(e){try{let t=new URL(e),n=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(n.toLocaleLowerCase())}catch{return!1}}var uI=class jl{static computeLink(t,n,r,i){let s=new RegExp(n.source,(n.flags||"")+"g"),[o,l]=jl._getWindowedLineStrings(t-1,r),a=o.join(""),c,h=[];for(;c=s.exec(a);){let u=c[0];if(!cI(u))continue;let[d,f]=jl._mapStrIdx(r,l,0,c.index),[g,m]=jl._mapStrIdx(r,d,f,u.length);if(d===-1||f===-1||g===-1||m===-1)continue;let w={start:{x:f+1,y:d+1},end:{x:m,y:g+1}};h.push({range:w,text:u,activate:i})}return h}static _getWindowedLineStrings(t,n){let r,i=t,s=t,o=0,l="",a=[];if(r=n.buffer.active.getLine(t)){let c=r.translateToString(!0);if(r.isWrapped&&c[0]!==" "){for(o=0;(r=n.buffer.active.getLine(--i))&&o<2048&&(l=r.translateToString(!0),o+=l.length,a.push(l),!(!r.isWrapped||l.indexOf(" ")!==-1)););a.reverse()}for(a.push(c),o=0;(r=n.buffer.active.getLine(++s))&&r.isWrapped&&o<2048&&(l=r.translateToString(!0),o+=l.length,a.push(l),l.indexOf(" ")===-1););}return[a,i]}static _mapStrIdx(t,n,r,i){let s=t.buffer.active,o=s.getNullCell(),l=r;for(;i;){let a=s.getLine(n);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(n+1);u&&u.isWrapped&&(u.getCell(0,o),o.getWidth()===2&&(i+=1))}if(i<0)return[n,c]}n++,l=0}return[n,l]}},hI=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function dI(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var fI=class{constructor(e=dI,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||hI;this._linkProvider=this._terminal.registerLinkProvider(new aI(this._terminal,n,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const Dm={background:"#0f1117",foreground:"#cdd6f4",cursor:"#f38ba8",cursorAccent:"#0f1117",selectionBackground:"rgba(166, 227, 161, 0.3)",selectionForeground:"#cdd6f4",black:"#45475a",red:"#f38ba8",green:"#a6e3a1",yellow:"#f9e2af",blue:"#89b4fa",magenta:"#cba6f7",cyan:"#94e2d5",white:"#bac2de",brightBlack:"#585b70",brightRed:"#f38ba8",brightGreen:"#a6e3a1",brightYellow:"#f9e2af",brightBlue:"#89b4fa",brightMagenta:"#cba6f7",brightCyan:"#94e2d5",brightWhite:"#a6adc8"},_1=x.forwardRef(({onInput:e,onResize:t,fontSize:n=13},r)=>{const i=x.useRef(null),s=x.useRef(null),o=x.useRef(null),[l,a]=x.useState(!1);return x.useImperativeHandle(r,()=>({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,d=h.rows;t==null||t(u+5,d),setTimeout(()=>{t==null||t(u,d)},100)}catch{}}})),x.useEffect(()=>{if(!i.current)return;const c=new iI({cursorBlink:!0,cursorStyle:"bar",fontSize:n,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:Dm,allowTransparency:!0,scrollback:5e3,convertEol:!1}),h=new lI,u=new fI;c.loadAddon(h),c.loadAddon(u),c.open(i.current),requestAnimationFrame(()=>{h.fit(),t==null||t(c.cols,c.rows),a(!0)});const d=c.onData(g=>{e(g)}),f=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{h.fit(),t==null||t(c.cols,c.rows)}catch{}})});return f.observe(i.current),s.current=c,o.current=h,()=>{d.dispose(),f.disconnect(),c.dispose(),s.current=null,o.current=null}},[n]),p.jsx("div",{ref:i,style:{width:"100%",height:"100%",background:Dm.background,borderRadius:8,overflow:"hidden",opacity:l?1:0,transition:"opacity 0.2s ease"}})});_1.displayName="CliTerminal";function Mm({label:e,value:t,sub:n,icon:r}){return p.jsxs("div",{style:{padding:"14px 16px",borderRadius:12,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[p.jsx("span",{style:{fontSize:16},children:r}),p.jsx("span",{style:{fontSize:10,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.5px",fontWeight:600},children:e})]}),p.jsx("div",{style:{fontSize:22,fontWeight:700,color:"#f1f5f9",letterSpacing:"-0.02em"},children:t}),n&&p.jsx("div",{style:{fontSize:11,color:"#64748b",marginTop:2},children:n})]})}function Am({value:e,max:t,label:n,color:r="#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":r;return s?p.jsxs("div",{style:{flex:1},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:3},children:[p.jsx("span",{style:{fontSize:9,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.5px",fontWeight:600},children:n}),p.jsxs("span",{style:{fontSize:10,color:"#94a3b8",fontWeight:600},children:[o,"%"]})]}),p.jsx("div",{style:{height:4,background:"rgba(255,255,255,0.04)",borderRadius:2,overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",width:`${o}%`,borderRadius:2,background:l,transition:"width 0.5s ease"}})})]}):p.jsxs("div",{style:{flex:1},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:6},children:[p.jsx("span",{style:{fontSize:11,color:"#94a3b8",fontWeight:500},children:n}),p.jsxs("span",{style:{fontSize:13,color:"#e2e8f0",fontWeight:700},children:[o,"%"]})]}),p.jsx("div",{style:{height:6,background:"rgba(255,255,255,0.04)",borderRadius:3,overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",width:`${o}%`,borderRadius:3,background:`linear-gradient(90deg, ${l}, ${l}cc)`,transition:"width 0.6s ease"}})}),i&&p.jsx("div",{style:{fontSize:10,color:"#64748b",marginTop:3},children:i})]})}function pI({screenshot:e,isCapturing:t,onRefresh:n,onAction:r,addLog:i,connState:s,connScreenshot:o}){const l=x.useRef(null),a=x.useRef(null),c=x.useRef(null),[h,u]=x.useState(!0),[d,f]=x.useState(2e3),[g,m]=x.useState(null),[w,_]=x.useState(""),[,v]=x.useState(!1),[y,E]=x.useState(!1),[R,C]=x.useState(!1),M=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[$,G]=x.useState(M?"mouse":"touch"),[T,P]=x.useState(1),[B,D]=x.useState(0),[U,A]=x.useState(0),O=x.useRef(0),H=x.useRef(t),L=x.useRef(n),W=x.useRef(r),S=x.useRef(null),Q=x.useRef(null),le=x.useRef(!1),k=x.useRef(null),ge=x.useRef(0),te=x.useRef(null),F=x.useRef(1),ie=x.useRef({x:0,y:0}),ne=x.useRef(T),ue=x.useRef(B),Se=x.useRef(U),z=x.useRef($);x.useEffect(()=>{H.current=t},[t]),x.useEffect(()=>{L.current=n},[n]),x.useEffect(()=>{ne.current=T},[T]),x.useEffect(()=>{ue.current=B},[B]),x.useEffect(()=>{Se.current=U},[U]),x.useEffect(()=>{W.current=r},[r]),x.useEffect(()=>{z.current=$},[$]),x.useEffect(()=>{var Z;(Z=l.current)==null||Z.focus()},[]);const Be=s==="connected",xe=s!=="connected"&&s!=="connecting",nt=Be&&o?o:e;x.useEffect(()=>{T<=1&&(D(0),A(0))},[T]);const zt=(Z,pe,I)=>{if(I<=1)return{x:0,y:0};const Y=(I-1)/(2*I)*100,N=(I-1)/(2*I)*100;return{x:Math.max(-Y,Math.min(Y,Z)),y:Math.max(-N,Math.min(N,pe))}};x.useEffect(()=>{if(!h||!xe)return;let Z=null;const pe=()=>{Z&&clearInterval(Z),!document.hidden&&(Z=setInterval(()=>{var Y;if(!H.current){const N=((Y=l.current)==null?void 0:Y.clientWidth)||0,j=Math.max(400,Math.ceil(N/100)*100);L.current(j)}},d))},I=()=>{document.hidden?(Z&&clearInterval(Z),Z=null):pe()};return pe(),document.addEventListener("visibilitychange",I),()=>{Z&&clearInterval(Z),document.removeEventListener("visibilitychange",I)}},[h,xe,d]);const qt=(Z,pe)=>{if(!c.current)return null;const I=c.current.getBoundingClientRect();return!I.width||!I.height?null:{nx:Math.max(0,Math.min(1,(Z-I.left)/I.width)),ny:Math.max(0,Math.min(1,(pe-I.top)/I.height))}},De=async Z=>{var I;const pe=qt(Z.clientX,Z.clientY);if(pe){m(`Click: ${Math.round(pe.nx*100)}%, ${Math.round(pe.ny*100)}%`),(I=l.current)==null||I.focus();try{const Y=await r("input_click",{nx:pe.nx,ny:pe.ny});Y!=null&&Y.success||i(`❌ Click failed: ${Y==null?void 0:Y.error}`)}catch(Y){i(`❌ Click error: ${Y.message||Y}`)}}},Ce=async(Z,pe,I,Y=0)=>{try{await r("input_key",{type:I?"char":"keyDown",key:Z,code:pe,text:I?Z:void 0,unmodifiedText:I?Z:void 0,modifiers:Y})}catch(N){i(`❌ Key error: ${N.message||N}`)}},On=async Z=>{if(Z.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(Z.key)&&Z.preventDefault();let I=0;Z.altKey&&(I|=1),Z.ctrlKey&&(I|=2),Z.metaKey&&(I|=4),Z.shiftKey&&(I|=8),m(`Key: ${Z.key}`),await Ce(Z.key,Z.code,Z.key.length===1,I)},Jn=async Z=>{if(Z.key==="Enter"){if(Z.nativeEvent.isComposing)return;if(w){const pe=w;_(""),m(`IME Sent: ${pe}`);try{const I=await r("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 m("Key: Enter"),await Ce("Enter","Enter",!1)}};x.useEffect(()=>{const Z=l.current;if(!Z)return;const pe=I=>{var Y;if((Y=c.current)!=null&&Y.contains(I.target)){I.preventDefault();const N=Date.now();if(N-O.current<40)return;O.current=N;const j=qt(I.clientX,I.clientY);if(!j)return;m(`Scroll: ${Math.round(I.deltaY)}`),r("input_wheel",{nx:j.nx,ny:j.ny,deltaX:Math.round(I.deltaX),deltaY:Math.round(I.deltaY)}).catch(()=>{})}};return Z.addEventListener("wheel",pe,{passive:!1}),()=>Z.removeEventListener("wheel",pe)},[r]);const[It,Yt]=x.useState(null),Ge=x.useRef(null);return x.useEffect(()=>{if($==="mouse"&&!Ge.current){const Z={nx:.5,ny:.5};Ge.current=Z,Yt(Z)}},[$]),x.useEffect(()=>{const Z=l.current;if(!Z)return;const pe=q=>{if(!c.current)return null;const J=c.current.getBoundingClientRect();return!J.width||!J.height?null:{nx:Math.max(0,Math.min(1,(q.clientX-J.left)/J.width)),ny:Math.max(0,Math.min(1,(q.clientY-J.top)/J.height))}},I=(q,J)=>{if(!c.current)return{dnx:0,dny:0};const oe=c.current,ae=oe.getBoundingClientRect(),fe=oe.naturalWidth||ae.width,ce=oe.naturalHeight||ae.height,ve=fe/ce,we=ae.width/ae.height;let Qe,rt;return ve>we?(Qe=ae.width,rt=ae.width/ve):(rt=ae.height,Qe=ae.height*ve),{dnx:q/Qe,dny:J/rt}},Y=(q,J,oe)=>{if(oe<=1.05)return;const ae=-(q-.5)*100,fe=-(J-.5)*100,ce=zt(ae,fe,oe);(Math.abs(ce.x-ue.current)>.1||Math.abs(ce.y-Se.current)>.1)&&(D(ce.x),A(ce.y),ue.current=ce.x,Se.current=ce.y)},N=q=>{if(q.preventDefault(),q.touches.length===1){const J=q.touches[0];S.current={x:J.clientX,y:J.clientY,time:Date.now()},Q.current={x:J.clientX,y:J.clientY},le.current=!1,k.current=setTimeout(()=>{if(!le.current)if(le.current=!0,z.current==="mouse"){const oe=Ge.current||{nx:.5,ny:.5};m("Right Click"),W.current("input_click",{...oe,button:"right"}).catch(()=>{})}else{const oe=pe(J);oe&&(m("Right Click"),W.current("input_click",{...oe,button:"right"}).catch(()=>{}))}},500)}else if(q.touches.length===2){clearTimeout(k.current),le.current=!0;const J=q.touches[1].clientX-q.touches[0].clientX,oe=q.touches[1].clientY-q.touches[0].clientY;te.current=Math.sqrt(J*J+oe*oe),F.current=ne.current,ie.current={x:(q.touches[0].clientX+q.touches[1].clientX)/2,y:(q.touches[0].clientY+q.touches[1].clientY)/2}}},j=q=>{if(q.preventDefault(),q.touches.length===1&&Q.current){const J=q.touches[0],oe=J.clientX-Q.current.x,ae=J.clientY-Q.current.y;if(!le.current&&(Math.abs(oe)>10||Math.abs(ae)>10)&&(le.current=!0,clearTimeout(k.current)),le.current)if(z.current==="mouse"){const fe=I(oe,ae),ce=Ge.current||{nx:.5,ny:.5},ve=Math.max(0,Math.min(1,ce.nx+fe.dnx)),we=Math.max(0,Math.min(1,ce.ny+fe.dny));Ge.current={nx:ve,ny:we},Yt({nx:ve,ny:we}),m(`Cursor: ${Math.round(ve*100)}%, ${Math.round(we*100)}%`),Y(ve,we,ne.current);const Qe=Date.now();Qe-O.current>=30&&(O.current=Qe,W.current("input_mouseMoved",{nx:ve,ny:we}).catch(()=>{}))}else if(ne.current>1){const fe=a.current;if(fe){const ce=fe.clientWidth,ve=fe.clientHeight,we=ue.current+oe/ce*100,Qe=Se.current+ae/ve*100,rt=zt(we,Qe,ne.current);D(rt.x),A(rt.y),ue.current=rt.x,Se.current=rt.y}}else{const fe=pe(J);if(fe){const ce=Date.now();ce-O.current>=40&&(O.current=ce,m("Scroll"),W.current("input_wheel",{nx:fe.nx,ny:fe.ny,deltaX:Math.round(-oe*2.5),deltaY:Math.round(-ae*2.5)}).catch(()=>{}))}}Q.current={x:J.clientX,y:J.clientY}}else if(q.touches.length===2&&te.current!==null){const J=q.touches[1].clientX-q.touches[0].clientX,oe=q.touches[1].clientY-q.touches[0].clientY,fe=Math.sqrt(J*J+oe*oe)/te.current,ce=(q.touches[0].clientX+q.touches[1].clientX)/2,ve=(q.touches[0].clientY+q.touches[1].clientY)/2,we=ce-ie.current.x,Qe=ve-ie.current.y,rt=Math.abs(fe-1)>.03;if(z.current==="mouse"){if(rt){const Xt=Math.max(.5,Math.min(5,F.current*fe));P(Xt),ne.current=Xt}else if(Math.abs(we)>2||Math.abs(Qe)>2){const Xt=Ge.current||{nx:.5,ny:.5},Ot=Date.now();Ot-O.current>=30&&(O.current=Ot,m("Scroll"),W.current("input_wheel",{nx:Xt.nx,ny:Xt.ny,deltaX:Math.round(-we*3),deltaY:Math.round(-Qe*3)}).catch(()=>{}))}}else{const Xt=Math.max(.5,Math.min(5,F.current*fe));P(Xt),ne.current=Xt;const Ot=a.current;if(Ot&&Xt>1){const $o=Ot.clientWidth,Wo=Ot.clientHeight,Ho=ue.current+we/$o*100,Uo=Se.current+Qe/Wo*100,Vr=zt(Ho,Uo,Xt);D(Vr.x),A(Vr.y),ue.current=Vr.x,Se.current=Vr.y}}ie.current={x:ce,y:ve}}},K=q=>{var J;if(clearTimeout(k.current),te.current=null,q.touches.length===0&&q.changedTouches.length===1&&!le.current){const oe=q.changedTouches[0],ae=Date.now();if(ae-(((J=S.current)==null?void 0:J.time)||0)<40)return;if(z.current==="mouse"){const ce=Ge.current||pe(oe);ce&&(m(`Click: ${Math.round(ce.nx*100)}%, ${Math.round(ce.ny*100)}%`),W.current("input_click",{...ce}).catch(()=>{}))}else{const ce=pe(oe);if(!ce)return;ae-ge.current<300?(m("Double tap"),W.current("input_click",{...ce,clickCount:2}).catch(()=>{}),ge.current=0):(m(`Tap: ${Math.round(ce.nx*100)}%, ${Math.round(ce.ny*100)}%`),W.current("input_click",{...ce}).catch(()=>{}),ge.current=ae)}}le.current=!1};return Z.addEventListener("touchstart",N,{passive:!1}),Z.addEventListener("touchmove",j,{passive:!1}),Z.addEventListener("touchend",K,{passive:!1}),()=>{Z.removeEventListener("touchstart",N),Z.removeEventListener("touchmove",j),Z.removeEventListener("touchend",K),clearTimeout(k.current)}},[]),p.jsxs("div",{ref:l,style:{flex:1,display:"flex",flexDirection:"column",background:"#000",position:"relative",overflow:"hidden",outline:"none",touchAction:"none"},onKeyDown:On,onContextMenu:Z=>Z.preventDefault(),onFocus:()=>v(!0),onBlur:()=>v(!1),tabIndex:0,children:[p.jsxs("div",{ref:a,style:{flex:1,position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",background:"#000"},children:[nt?p.jsx("img",{ref:c,src:nt,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${T}) translate(${B}%, ${U}%)`,transformOrigin:"center center",cursor:$==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:De,onContextMenu:Z=>Z.preventDefault(),onDragStart:Z=>Z.preventDefault()}):p.jsxs("div",{style:{color:"#333",textAlign:"center"},children:[p.jsx("div",{style:{fontSize:48,marginBottom:12},children:"🌑"}),p.jsx("div",{style:{fontSize:13,fontWeight:600},children:"Connecting to Host..."})]}),$==="mouse"&&It&&nt&&c.current&&(()=>{var Qe;const Z=c.current,pe=Z.getBoundingClientRect(),I=(Qe=a.current)==null?void 0:Qe.getBoundingClientRect();if(!I)return null;const Y=Z.naturalWidth||pe.width,N=Z.naturalHeight||pe.height,j=Y/N,K=pe.width/pe.height;let q,J,oe,ae;j>K?(q=pe.width,J=pe.width/j,oe=0,ae=(pe.height-J)/2):(J=pe.height,q=pe.height*j,oe=(pe.width-q)/2,ae=0);const fe=pe.left-I.left+oe+q*It.nx,ce=pe.top-I.top+ae+J*It.ny,ve=Math.max(8,Math.min(I.width-8,fe)),we=Math.max(8,Math.min(I.height-8,ce));return p.jsxs("div",{style:{position:"absolute",left:ve-8,top:we-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[p.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),p.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),p.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)"}})]})})()]}),p.jsxs("div",{onTouchStart:Z=>Z.stopPropagation(),style:{position:"absolute",bottom:0,left:0,right:0,zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 12px",background:"rgba(0,0,0,0.75)",backdropFilter:"blur(16px)",borderTop:"1px solid rgba(255,255,255,0.08)",touchAction:"none"},children:[p.jsxs("div",{onClick:()=>{G(Z=>{const pe=Z==="touch"?"mouse":"touch";if(pe==="mouse"&&!Ge.current){const I={nx:.5,ny:.5};Ge.current=I,Yt(I)}return pe})},style:{height:32,padding:"0 10px",background:$==="mouse"?"rgba(59,130,246,0.25)":"rgba(255,255,255,0.08)",borderRadius:8,display:"flex",alignItems:"center",gap:5,cursor:"pointer",border:$==="mouse"?"1px solid rgba(59,130,246,0.4)":"1px solid rgba(255,255,255,0.1)"},children:[p.jsx("span",{style:{fontSize:14},children:$==="mouse"?"🖱️":"👆"}),p.jsx("span",{style:{fontSize:10,fontWeight:700,color:$==="mouse"?"#60a5fa":"#94a3b8"},children:$==="mouse"?"Mouse":"Touch"})]}),p.jsxs("div",{style:{position:"relative"},children:[p.jsx("div",{onClick:()=>{C(!R),E(!1)},style:{width:32,height:32,background:R?"rgba(16,185,129,0.25)":"rgba(255,255,255,0.08)",borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:R?"1px solid rgba(16,185,129,0.4)":"1px solid rgba(255,255,255,0.1)"},children:p.jsx("span",{style:{fontSize:14},children:"⌨️"})}),R&&p.jsx("div",{style:{position:"absolute",bottom:40,left:"50%",transform:"translateX(-50%)",width:220,background:"rgba(23,23,23,0.98)",backdropFilter:"blur(30px)",borderRadius:12,border:"1px solid rgba(255,255,255,0.2)",padding:"10px 12px",boxShadow:"0 10px 30px rgba(0,0,0,0.8)",display:"flex",flexDirection:"column",gap:8,animation:"slideUp 0.15s ease-out",zIndex:2e3},children:p.jsx("input",{type:"text",placeholder:"Type & Enter...",value:w,autoFocus:!0,onTouchStart:Z=>Z.stopPropagation(),onChange:Z=>_(Z.target.value),onKeyDown:Jn,style:{width:"100%",background:"rgba(0,0,0,0.6)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:8,padding:"8px 10px",color:"#fff",fontSize:13,outline:"none"}})})]}),p.jsx("div",{style:{position:"relative"},children:p.jsx("div",{onClick:()=>{E(!y),C(!1)},style:{width:32,height:32,background:y?"rgba(59,130,246,0.25)":"rgba(255,255,255,0.08)",borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:y?"1px solid rgba(59,130,246,0.4)":"1px solid rgba(255,255,255,0.1)"},children:p.jsx("span",{style:{fontSize:14},children:"⚙️"})})}),p.jsx("div",{style:{width:1,height:18,background:"rgba(255,255,255,0.1)"}}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:3,padding:"2px 6px",borderRadius:6,background:Be?"rgba(16,185,129,0.12)":"rgba(251,191,36,0.12)"},children:[p.jsx("div",{style:{width:4,height:4,borderRadius:"50%",background:Be?"#10b981":"#fbbf24"}}),p.jsx("span",{style:{fontSize:8,fontWeight:800,color:Be?"#10b981":"#fbbf24"},children:Be?"Connected":"WS"})]}),T>1&&p.jsxs("span",{style:{fontSize:8,fontWeight:700,color:"#6366f1"},children:[Math.round(T*100),"%"]}),g&&p.jsx("span",{style:{fontSize:8,color:"#888",fontWeight:600,maxWidth:100,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g})]})]}),y&&p.jsxs("div",{onTouchStart:Z=>Z.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:[p.jsx("div",{style:{fontSize:9,fontWeight:900,color:"#3b82f6",letterSpacing:1.5},children:"SETTINGS"}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[p.jsxs("div",{style:{fontSize:10,color:"#888",fontWeight:700},children:["ZOOM: ",T===1?"FIT":`${Math.round(T*100)}%`]}),p.jsxs("div",{style:{display:"flex",gap:4},children:[p.jsx("button",{onClick:Z=>{Z.stopPropagation(),P(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:"−"}),p.jsx("button",{onClick:Z=>{Z.stopPropagation(),P(1),D(0),A(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"}),p.jsx("button",{onClick:Z=>{Z.stopPropagation(),P(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:"+"})]})]}),p.jsx("button",{onClick:Z=>{var Y;Z.stopPropagation();const pe=((Y=l.current)==null?void 0:Y.clientWidth)||0,I=pe>0?Math.max(400,Math.ceil(pe/100)*100):void 0;n(I)},style:{width:"100%",background:"#3b82f6",color:"#fff",border:"none",padding:"8px",borderRadius:6,fontSize:11,fontWeight:800,cursor:"pointer"},children:"FORCE SYNC"}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(255,255,255,0.05)",padding:"6px 10px",borderRadius:6},children:[p.jsx("span",{style:{fontSize:10,color:"#888",fontWeight:700},children:"AUTO REF."}),p.jsx("input",{type:"checkbox",checked:h,onChange:Z=>u(Z.target.checked)})]}),p.jsxs("select",{value:d,onChange:Z=>f(Number(Z.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:[p.jsx("option",{value:500,children:"0.5s Interval"}),p.jsx("option",{value:1e3,children:"1.0s Interval"}),p.jsx("option",{value:2e3,children:"2.0s Interval"}),p.jsx("option",{value:4e3,children:"4.0s Interval"})]})]}),p.jsx("style",{children:`
158
158
  @keyframes slideUp {
159
159
  from { opacity: 0; transform: translateY(6px); }
160
160
  to { opacity: 1; transform: translateY(0); }
@@ -163,9 +163,9 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
163
163
  from { opacity: 0; transform: translateY(6px); }
164
164
  to { opacity: 1; transform: translateY(0); }
165
165
  }
166
- `})]})}function l1({activeConv:e,onModalButton:t}){const[n,r]=x.useState(null);if(x.useEffect(()=>{r(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=s=>{n||(r(s),t(s))};return p.jsxs("div",{style:{background:"linear-gradient(135deg, #d97706, #b45309)",color:"white",padding:"10px 16px",flexShrink:0,zIndex:5},children:[e.modalMessage&&p.jsx("div",{style:{fontSize:11,opacity:.85,marginBottom:6,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:e.modalMessage.replace(/[\n\r]+/g," ").slice(0,120)}),p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[p.jsxs("div",{style:{fontWeight:900,fontSize:12,display:"flex",alignItems:"center",gap:8},children:[p.jsx("span",{children:"⚠️"})," ",n?"PROCESSING...":"ACTION REQUIRED"]}),p.jsx("div",{style:{display:"flex",gap:8,flexWrap:"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=n===s,u=n!==null;return p.jsx("button",{onClick:()=>i(s),disabled:u,className:"btn btn-sm",style:{background:a?"white":c?"rgba(239,68,68,0.3)":"rgba(255,255,255,0.15)",color:a?"#b45309":"white",border:"none",fontWeight:a?800:600,borderRadius:6,fontSize:12,padding:"4px 12px",opacity:u&&!h?.4:1,cursor:u?"not-allowed":"pointer"},children:h?"⏳ ...":s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim()},o)})})]})]})}const on=new Map;function lI({ideId:e,ideType:t,agentType:n,agentName:r,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var ie;const{sendCommand:a}=fi(),c=!!(o||l),h=`${e}:${n}`,u=on.get(h),[d,f]=x.useState(!1),[g,m]=x.useState(!1),[w,_]=x.useState((u==null?void 0:u.models)||[]),[v,y]=x.useState((u==null?void 0:u.modes)||[]),[E,R]=x.useState(i||""),[C,M]=x.useState(s||""),[$,G]=x.useState(!1),[T,I]=x.useState(!1),A=x.useRef(0);x.useEffect(()=>{if(o){const z=o.find(q=>q.category==="model");if(z){const q=z.options.map(ue=>ue.value);_(q),z.currentValue&&R(z.currentValue);const te=on.get(h)||{models:[],modes:[]};on.set(h,{...te,models:q})}}if(l&&l.length>0){const z=l.map(te=>te.id);y(z);const q=on.get(h)||{models:[],modes:[]};on.set(h,{...q,modes:z})}else if(o){const z=o.find(q=>q.category!=="model");if(z){const q=z.options.map(ue=>ue.value);y(q),z.currentValue&&M(z.currentValue);const te=on.get(h)||{models:[],modes:[]};on.set(h,{...te,modes:q})}}},[o,l,h]),x.useEffect(()=>{f(!1),m(!1),R(i||""),M(s||"");const z=on.get(h);z?(_(z.models),y(z.modes)):(_([]),y([]))},[e,n]),x.useEffect(()=>{i&&Date.now()>A.current&&R(i)},[i]),x.useEffect(()=>{s&&Date.now()>A.current&&M(s)},[s]);const P=x.useCallback(async(z,q={})=>{const te={...q},ue=e.split(":");return ue.length>=3&&(ue[1]==="ide"||ue[1]==="cli"||ue[1]==="acp")&&(te._targetInstance=ue.slice(2).join(":"),te._targetType=ue[1]),await a(e,z,te)},[e]),U=async()=>{var z,q;if(w.length>0){f(!d);return}if(c){f(!0);return}G(!0);try{const te=await P("list_extension_models",{agentType:n,ideType:t}),ue=(te==null?void 0:te.models)||((z=te==null?void 0:te.result)==null?void 0:z.models)||[];_(ue),te!=null&&te.current&&R(te.current),(q=te==null?void 0:te.result)!=null&&q.current&&R(te.result.current);const _e=on.get(h)||{models:[],modes:[]};on.set(h,{..._e,models:ue}),f(!0)}catch{}finally{G(!1)}},B=async()=>{var z,q;if(v.length>0){m(!g);return}if(c){m(!0);return}I(!0);try{const te=await P("list_extension_modes",{agentType:n,ideType:t}),ue=(te==null?void 0:te.modes)||((z=te==null?void 0:te.result)==null?void 0:z.modes)||[];y(ue),te!=null&&te.current&&M(te.current),(q=te==null?void 0:te.result)!=null&&q.current&&M(te.result.current);const _e=on.get(h)||{models:[],modes:[]};on.set(h,{..._e,modes:ue}),m(!0)}catch{}finally{I(!1)}},j=async z=>{f(!1),R(z),A.current=Date.now()+5e3;try{c?await P("change_model",{agentType:n,ideType:t,model:z}):await P("set_extension_model",{agentType:n,ideType:t,model:z})}catch{}},H=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(z=>z.category!=="model")),L=H?(ie=o==null?void 0:o.find(z=>z.category!=="model"))==null?void 0:ie.configId:void 0,W=async z=>{m(!1),M(z),A.current=Date.now()+5e3;try{c&&H&&L?await P("set_thought_level",{agentType:n,ideType:t,configId:L,value:z}):c?await P("set_mode",{agentType:n,ideType:t,mode:z}):await P("set_extension_mode",{agentType:n,ideType:t,mode:z})}catch{}},Q={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[n]||"#94a3b8",le={display:"inline-flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:12,fontSize:10,fontWeight:500,cursor:"pointer",border:"1px solid transparent",transition:"all 0.15s",background:"var(--surface-tertiary)",color:"var(--text-secondary)",whiteSpace:"nowrap",maxWidth:160,overflow:"hidden",textOverflow:"ellipsis"},k={position:"absolute",bottom:"100%",left:0,zIndex:60,background:"var(--surface-primary)",border:"1px solid var(--border-subtle)",borderRadius:8,marginBottom:4,maxHeight:220,overflowY:"auto",minWidth:160,boxShadow:"0 -4px 16px rgba(0,0,0,0.3)"},ge=z=>({padding:"7px 12px",fontSize:11,cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",background:z?`${Q}18`:"transparent",color:z?Q:"var(--text-secondary)",fontWeight:z?600:400,borderLeft:z?`2px solid ${Q}`:"2px solid transparent"});return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",flexWrap:"wrap",fontSize:10,borderTop:"1px solid var(--border-subtle)",background:"var(--surface-primary)"},children:[p.jsx("span",{style:{fontSize:9,fontWeight:700,color:Q,letterSpacing:"0.03em",textTransform:"uppercase",opacity:.7},children:r}),p.jsx("span",{style:{color:"var(--border-subtle)",fontSize:10},children:"│"}),p.jsxs("div",{style:{position:"relative"},children:[p.jsxs("span",{style:{...le,borderColor:d?`${Q}55`:"transparent",color:E?"var(--text-primary)":"var(--text-muted)"},onClick:U,children:[p.jsx("span",{style:{fontSize:9,opacity:.6},children:"🤖"}),$?"...":E||"Model",p.jsx("span",{style:{fontSize:7,opacity:.5},children:"▼"})]}),d&&w.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{style:{position:"fixed",inset:0,zIndex:59},onClick:()=>f(!1)}),p.jsxs("div",{style:k,children:[p.jsx("div",{style:{padding:"6px 12px",fontSize:9,fontWeight:700,color:"var(--text-muted)",letterSpacing:"0.05em",borderBottom:"1px solid var(--border-subtle)"},children:"SELECT MODEL"}),w.map(z=>p.jsx("div",{style:ge(z===E),onMouseEnter:q=>{q.currentTarget.style.background=`${Q}12`},onMouseLeave:q=>{q.currentTarget.style.background=z===E?`${Q}18`:"transparent"},onClick:()=>j(z),children:z},z))]})]})]}),p.jsxs("div",{style:{position:"relative"},children:[p.jsxs("span",{style:{...le,borderColor:g?`${Q}55`:"transparent",color:C?"var(--text-primary)":"var(--text-muted)"},onClick:B,children:[p.jsx("span",{style:{fontSize:9,opacity:.6},children:H?"🧠":"⚡"}),T?"...":C||(H?"Thinking":"Mode"),p.jsx("span",{style:{fontSize:7,opacity:.5},children:"▼"})]}),g&&v.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{style:{position:"fixed",inset:0,zIndex:59},onClick:()=>m(!1)}),p.jsxs("div",{style:k,children:[p.jsx("div",{style:{padding:"6px 12px",fontSize:9,fontWeight:700,color:"var(--text-muted)",letterSpacing:"0.05em",borderBottom:"1px solid var(--border-subtle)"},children:H?"SELECT THINKING LEVEL":"SELECT MODE"}),v.map(z=>p.jsx("div",{style:ge(z===C),onMouseEnter:q=>{q.currentTarget.style.background=`${Q}12`},onMouseLeave:q=>{q.currentTarget.style.background=z===C?`${Q}18`:"transparent"},onClick:()=>W(z),children:z},z))]})]})]})]})}const Gt=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),bn=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function a1({activeConv:e,ides:t,agentInput:n,setAgentInput:r,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a}){const c=x.useRef(null),{sendCommand:h}=fi(),[u,d]=x.useState([]),[f,g]=x.useState(0),[m,w]=x.useState(!0),[_,v]=x.useState(!1),y=x.useRef("");e.tabKey!==y.current&&(y.current=e.tabKey,d([]),g(0),w(!0));const E=x.useCallback(async()=>{var M,$,G,T,I;if(!(_||!m)){v(!0);try{const A=t.find(L=>L.id===e.ideId),P=(A==null?void 0:A.daemonId)||((M=e.ideId)==null?void 0:M.split(":")[0])||"";if(!P){w(!1);return}const U=e.ideType||e.agentType||"",B=(e.ideId||"").split(":"),j=B.length>=3?B.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:P,agentType:U,instanceId:j,offset:f});const H=await h(P,"chat_history",{agentType:U,offset:f,limit:30,instanceId:j});console.log("[ChatPane] got result:",{count:(($=H.messages)==null?void 0:$.length)||0,hasMore:H.hasMore}),((G=H.messages)==null?void 0:G.length)>0&&(d(L=>[...H.messages,...L]),g(L=>L+H.messages.length)),w(H.hasMore)}catch(A){console.warn("[ChatPane] Failed to load history:",A),!((T=A==null?void 0:A.message)!=null&&T.includes("P2P not available"))&&!((I=A==null?void 0:A.message)!=null&&I.includes("channel not open"))&&w(!1)}finally{v(!1)}}},[_,m,f,t,e]),R=x.useRef(0);x.useEffect(()=>{if(e.messages.length<10&&m&&!_&&u.length===0){const M=R.current;if(M>5)return;const G=setTimeout(()=>{R.current=M+1,E()},M===0?0:2e3);return()=>clearTimeout(G)}else u.length>0&&(R.current=0)},[e.tabKey,e.messages.length,m,_,u.length,E]);const C=(()=>{const M=e.messages.map((T,I)=>{const A=`${e.ideId}-${T.id??`i-${I}`}`;return{...T,receivedAt:T.receivedAt||l[A]||0}});if(u.length===0)return M;const $=new Set(M.map(T=>`${T.role}:${(T.content||"").slice(0,100)}`));return[...u.filter(T=>!$.has(`${T.role}:${(T.content||"").slice(0,100)}`)),...M]})();return p.jsxs(p.Fragment,{children:[p.jsx(g0,{messages:C,actionLogs:a.filter(M=>M.ideId===e.tabKey).sort((M,$)=>M.timestamp-$.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",isCliMode:Gt(e)||bn(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:E,isLoadingMore:_,hasMoreHistory:m,emptyState:e.messages.length===0?e.status==="not_monitored"?p.jsxs("div",{style:{textAlign:"center",marginTop:60,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[p.jsx("div",{style:{fontSize:28,opacity:.6},children:"🔌"}),p.jsx("div",{style:{fontSize:13,opacity:.5},children:"Agent not monitored"}),p.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm",style:{background:"var(--accent-primary)",color:"white",border:"none",borderRadius:10,padding:"8px 20px",fontWeight:700,fontSize:13,cursor:"pointer",transition:"all 0.2s"},children:o?"⌛ Switching...":`📂 Open ${e.displayPrimary} Panel`}),p.jsx("div",{style:{fontSize:11,opacity:.35,maxWidth:280},children:"Click to switch monitoring to this agent"})]}):e.status==="panel_hidden"?p.jsxs("div",{style:{textAlign:"center",marginTop:60,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[p.jsx("div",{style:{fontSize:28,opacity:.6},children:"👁️‍🗨️"}),p.jsx("div",{style:{fontSize:13,opacity:.5},children:"Panel is not visible in IDE"}),p.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm",style:{background:"var(--accent-primary)",color:"white",border:"none",borderRadius:10,padding:"8px 20px",fontWeight:700,fontSize:13,cursor:"pointer",transition:"all 0.2s"},children:o?"⌛ Opening...":`📂 Open ${e.displayPrimary} Panel`}),p.jsx("div",{style:{fontSize:11,opacity:.35,maxWidth:280},children:"Open the agent sidebar in your IDE to start viewing messages"})]}):void 0:void 0}),!Gt(e)&&(()=>{const M=t.find($=>$.id===e.ideId);return p.jsx(lI,{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:(M==null?void 0:M.currentModel)||void 0,serverMode:(M==null?void 0:M.currentPlan)||void 0,acpConfigOptions:bn(e)?M==null?void 0:M.acpConfigOptions:void 0,acpModes:bn(e)?M==null?void 0:M.acpModes:void 0})})(),p.jsx("div",{className:"dashboard-input-area",style:{padding:"10px 12px",background:"var(--surface-primary)",borderTop:"1px solid var(--border-subtle)",flexShrink:0},children:p.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[p.jsx("div",{style:{flex:1,position:"relative"},children:p.jsx("input",{ref:c,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:n,onChange:M=>r(M.target.value),onPaste:M=>{const $=M.clipboardData.getData("text");$&&r(G=>G+$),M.preventDefault()},onKeyDown:M=>{if(M.key==="Enter"){if(M.nativeEvent.isComposing){M.preventDefault();return}M.preventDefault(),i()}},onBlur:()=>{window.innerWidth<768&&setTimeout(()=>{document.documentElement.scrollTop=0},100)},style:{width:"100%",height:40,borderRadius:20,padding:"0 16px",background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",fontSize:14,color:"var(--text-primary)"}})}),p.jsx("button",{onClick:i,disabled:!n.trim(),style:{width:40,height:40,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:n.trim()?"var(--accent-primary)":"var(--bg-secondary)",cursor:n.trim()?"pointer":"default",flexShrink:0,transition:"all 0.3s ease"},children:p.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:n.trim()?"white":"var(--text-muted)"},children:p.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function aI({activeConv:e,ptyBuffers:t,terminalRef:n,agentInput:r,setAgentInput:i,handleSendChat:s,handleModalButton:o}){const l=x.useRef(null),{sendCommand:a,sendData:c}=fi();return p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",background:"var(--surface-primary)",borderBottom:"1px solid var(--border-subtle)",flexShrink:0},children:[p.jsx("div",{style:{display:"flex",gap:4},children:p.jsx("div",{style:{padding:"4px 12px",borderRadius:6,fontSize:11,fontWeight:600,background:"var(--accent)",color:"#fff"},children:"⬛ Terminal"})}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)"},children:[e.agentName," — Terminal"]}),p.jsx("button",{onClick:()=>{if(!n.current||!e)return;const h=t.current.get(e.tabKey);if(h&&h.length>0)for(const u of h)n.current.write(u);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var u;(u=n.current)==null||u.bumpResize()})})},title:"Refresh terminal (replay buffer + TUI redraw)",style:{padding:"3px 8px",borderRadius:5,fontSize:11,background:"var(--bg-secondary)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",cursor:"pointer",lineHeight:1},children:"↺"}),p.jsx("button",{onClick:async()=>{var d;const h=(d=e.ideId)!=null&&d.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(f){console.error("Stop CLI failed:",f)}},title:"Stop CLI process",style:{padding:"3px 8px",borderRadius:5,fontSize:11,background:"rgba(239,68,68,0.08)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.3)",cursor:"pointer",lineHeight:1,fontWeight:600},children:"■ Stop"})]})]}),p.jsx(l1,{activeConv:e,onModalButton:o}),p.jsx("div",{style:{flex:1,minHeight:0,padding:8,background:"#0f1117"},children:p.jsx(o1,{ref:n,onInput:h=>{var f;const u=e.ideId||e.daemonId||"",d=(f=e.ideId)!=null&&f.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(u,{type:"pty_input",cliType:d,data:h})||a(u,"pty_input",{cliType:d,data:h}).catch(console.error)},onResize:(h,u)=>{var g;const d=e.ideId||e.daemonId||"",f=(g=e.ideId)!=null&&g.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(d,{type:"pty_resize",cliType:f,cols:h,rows:u})||a(d,"pty_resize",{cliType:f,cols:h,rows:u,force:!0}).catch(()=>{})}},e.tabKey)}),p.jsx("div",{style:{padding:"8px 12px",background:"var(--surface-primary)",borderTop:"1px solid var(--border-subtle)",flexShrink:0},children:p.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[p.jsx("div",{style:{flex:1,position:"relative"},children:p.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:h=>i(h.target.value),onPaste:h=>{const u=h.clipboardData.getData("text");u&&i(d=>d+u),h.preventDefault()},onKeyDown:h=>{if(h.key==="Enter"){if(h.nativeEvent.isComposing){h.preventDefault();return}h.preventDefault(),s()}},style:{width:"100%",height:36,borderRadius:18,padding:"0 16px",background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",fontSize:13,color:"var(--text-primary)"}})}),p.jsx("button",{onClick:s,disabled:!r.trim(),style:{width:36,height:36,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:r.trim()?"var(--accent-primary)":"var(--bg-secondary)",cursor:r.trim()?"pointer":"default",flexShrink:0,transition:"all 0.3s ease"},children:p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:r.trim()?"white":"var(--text-muted)"},children:p.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function cI({wsStatus:e,showReconnected:t,loginUrl:n}){const r=e==="disconnected"||e==="reconnecting"||e==="offline"||e==="auth_failed";return p.jsxs(p.Fragment,{children:[r&&p.jsxs("div",{style:{padding:"10px 20px",fontSize:13,fontWeight:600,display:"flex",alignItems:"center",gap:10,justifyContent:"center",background:e==="auth_failed"?"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))":e==="offline"?"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))":"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))",borderBottom:e==="auth_failed"?"1px solid rgba(239,68,68,0.2)":e==="offline"?"1px solid rgba(255,107,53,0.2)":"1px solid rgba(139,92,246,0.2)",color:e==="auth_failed"?"#ef4444":e==="offline"?"#ff6b35":"#a78bfa"},children:[p.jsx("img",{src:"/otter-logo.png",alt:"",style:{width:20,height:20,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"&&(n?p.jsxs(p.Fragment,{children:["Session expired."," ",p.jsx("a",{href:n,style:{color:"inherit",textDecoration:"underline"},children:"Log in again"})]}):"Connection failed — please restart the server.")]}),t&&e==="connected"&&p.jsxs("div",{style:{padding:"8px 16px",fontSize:12,fontWeight:600,display:"flex",alignItems:"center",gap:8,justifyContent:"center",background:"linear-gradient(90deg, rgba(34,197,94,0.12), rgba(34,197,94,0.04))",color:"#22c55e",borderBottom:"1px solid rgba(34,197,94,0.15)",animation:"fadeIn 0.3s ease"},children:[p.jsx("img",{src:"/otter-logo.png",alt:"",style:{width:16,height:16}}),"Connected"]})]})}const Kc=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),Vc=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function uI({activeConv:e,agentCount:t,wsStatus:n,isP2PActive:r,onOpenHistory:i}){const s=ts();return p.jsxs("div",{className:"dashboard-header",children:[p.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:p.jsxs("div",{style:{lineHeight:1.25},children:[p.jsxs("h1",{className:"header-title",style:{margin:0},children:["DASHBOARD",p.jsxs("span",{className:"header-count-mobile",style:{fontSize:10,fontWeight:600,opacity:.6,marginLeft:8,letterSpacing:"0.02em"},children:[t," Active",p.jsx("span",{style:{display:"inline-block",width:5,height:5,borderRadius:"50%",marginLeft:4,verticalAlign:"middle",background:r?"#22c55e":n==="connected"?"#eab308":"#ef4444"}})]})]}),p.jsxs("div",{className:"header-subtitle",style:{fontSize:11,alignItems:"center",gap:4},children:[t," AGENTS ACTIVE",p.jsx("span",{title:r?"P2P Direct":n==="connected"?"WebSocket":"Disconnected",style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:r?"#22c55e":n==="connected"?"#eab308":"#ef4444",boxShadow:r?"0 0 4px #22c55e80":n==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480",flexShrink:0}})]})]})}),p.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e&&!Kc(e)&&!Vc(e)&&p.jsx("button",{onClick:()=>s(`/ide/${e.ideId}`),className:"btn btn-primary btn-sm",style:{border:"none",padding:"6px 12px",fontSize:12},children:"IDE"}),e&&!Kc(e)&&!Vc(e)&&p.jsx("button",{onClick:i,className:"btn btn-secondary btn-sm",style:{border:"none",background:"var(--bg-secondary)",padding:"6px 10px",display:"flex",alignItems:"center",gap:4},title:"Chat History",children:"📜"}),e&&!Kc(e)&&!Vc(e)&&p.jsx("button",{onClick:()=>s(`/ide/${e.ideId}?view=remote`),className:"btn btn-secondary btn-sm",style:{border:"none",background:"var(--bg-secondary)",padding:"6px 10px"},title:"Remote Control",children:"🖥️"})]})]})}function Bn(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function hI(e){if(e<60)return`${Math.round(e)}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const n=Math.floor(t/60),r=t%60;if(n<24)return r>0?`${n}h ${r}m`:`${n}h`;const i=Math.floor(n/24),s=n%24;return`${i}d ${s}h`}function km(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Cm(e){return(e.id||"").includes(":cli:")}function zh(e,t){return Bn(e)}function dI(e){if(!Array.isArray(e)||e.length<=1)return e;const t=new Map,n=["generating","streaming","active","connected","idle","panel_hidden"];for(const r of e){const i=(r.name||r.id||"").toLowerCase().replace(/\s+/g,"-"),s=t.get(i);if(!s){t.set(i,r);continue}const o=n.indexOf(s.status||"idle"),l=n.indexOf(r.status||"idle");l>=0&&(o<0||l<o)&&t.set(i,r)}return Array.from(t.values())}function fI({activeConv:e,ides:t,isCreatingChat:n,isRefreshingHistory:r,onClose:i,onNewChat:s,onSwitchSession:o,onRefreshHistory:l}){var u;const a=t.find(d=>d.id===e.ideId),c=(a==null?void 0:a.chats)||[],h=(u=a==null?void 0:a.activeChat)==null?void 0:u.id;return p.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"},children:[p.jsx("div",{onClick:i,style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}),p.jsxs("div",{className:"card fade-in",style:{position:"relative",width:"90%",maxWidth:500,maxHeight:"80vh",display:"flex",flexDirection:"column",padding:0,overflow:"hidden",boxShadow:"0 20px 40px rgba(0,0,0,0.4)",borderRadius:20},children:[p.jsxs("div",{style:{padding:"20px 24px",borderBottom:"1px solid var(--border-subtle)",display:"flex",justifyContent:"space-between",alignItems:"center",background:"var(--surface-primary)"},children:[p.jsxs("div",{children:[p.jsx("h3",{style:{margin:0,fontSize:18,fontWeight:800},children:"Chat History"}),p.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:2},children:[e.displayPrimary," — ",Bn(e.ideType)]})]}),p.jsx("button",{onClick:i,style:{background:"none",border:"none",fontSize:20,color:"var(--text-muted)",cursor:"pointer"},children:"✕"})]}),p.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,background:"var(--bg-primary)"},children:[p.jsx("button",{onClick:s,disabled:n,style:{width:"100%",padding:"14px",borderRadius:12,marginBottom:12,background:"rgba(99,102,241,0.1)",border:"1px dashed var(--accent-primary)",color:"var(--accent-primary)",fontWeight:700,fontSize:14,cursor:"pointer"},children:n?"⌛ Creating...":"+ Start New Chat Session"}),c.map(d=>p.jsxs("div",{onClick:()=>{o(e.ideId,d.id),i()},style:{padding:"16px",borderRadius:12,marginBottom:8,cursor:"pointer",background:h===d.id?"var(--bg-glass-hover)":"var(--surface-secondary)",border:"1px solid",borderColor:h===d.id?"var(--accent-primary)":"var(--border-subtle)",transition:"all 0.2s"},children:[p.jsx("div",{style:{fontWeight:700,fontSize:14,marginBottom:4,color:h===d.id?"var(--accent-primary-light)":"var(--text-primary)"},children:d.title||"Untitled Session"}),p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[p.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",fontFamily:"monospace"},children:[d.id.substring(0,12),"..."]}),h===d.id&&p.jsx("span",{style:{fontSize:10,background:"var(--accent-primary)",color:"white",padding:"2px 8px",borderRadius:10,fontWeight:800},children:"ACTIVE"})]})]},d.id)),c.length===0&&p.jsxs("div",{style:{padding:"40px 20px",textAlign:"center",color:"var(--text-muted)"},children:[p.jsx("div",{style:{fontSize:32,marginBottom:12},children:"🕯️"}),p.jsx("div",{style:{fontSize:13},children:"No recent chat sessions found."})]})]}),p.jsx("div",{style:{padding:"16px 20px",background:"var(--surface-tertiary)",borderTop:"1px solid var(--border-subtle)",textAlign:"right"},children:p.jsx("button",{onClick:l,disabled:r,className:"btn btn-secondary btn-sm",style:{borderRadius:10},children:r?"⌛ Refreshing...":"🔄 Refresh History"})})]})]})}function pI({sortedConversations:e,activeTabId:t,tabsOverflow:n,tabsContainerRef:r,terminalRef:i,onSelectTab:s,onReorder:o,pinTab:l,clearTabPinTimers:a,retryP2P:c}){const{sendCommand:h}=fi(),u=x.useRef(null),d=x.useRef(null),f=x.useRef(null),g=x.useRef(null),[m,w]=x.useState(!1),_=x.useCallback((I,A)=>{const P=A.touches[0];f.current={x:P.clientX,y:P.clientY},d.current=I,g.current=setTimeout(()=>{w(!0)},400)},[]),v=x.useCallback(I=>{if(!m||!d.current){g.current&&(clearTimeout(g.current),g.current=null);return}I.preventDefault();const A=I.touches[0],P=r.current;if(!P)return;const U=Array.from(P.querySelectorAll("[data-tabkey]"));for(const B of U){const j=B.getBoundingClientRect();if(A.clientX>=j.left&&A.clientX<=j.right){const H=B.getAttribute("data-tabkey");if(H&&H!==d.current){const L=e.map(Q=>Q.tabKey),W=L.indexOf(d.current),S=L.indexOf(H);if(W!==-1&&S!==-1){const Q=[...L];Q.splice(W,1),Q.splice(S,0,d.current),o(Q)}}break}}},[m,e,r,o]),y=x.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null),w(!1),d.current=null,f.current=null},[]),E=()=>{const I=r.current;I&&I.scrollBy({left:-150,behavior:"smooth"})},R=()=>{const I=r.current;I&&I.scrollBy({left:150,behavior:"smooth"})},[C,M]=x.useState(!1),[$,G]=x.useState(!1),T=x.useCallback(()=>{const I=r.current;I&&(M(I.scrollLeft>4),G(I.scrollLeft+I.clientWidth<I.scrollWidth-4))},[r]);return x.useEffect(()=>{const I=r.current;if(!I)return;T(),I.addEventListener("scroll",T,{passive:!0});const A=new ResizeObserver(T);return A.observe(I),()=>{I.removeEventListener("scroll",T),A.disconnect()}},[r,T,e.length]),p.jsxs("div",{style:{position:"relative",flexShrink:0},children:[n&&p.jsx("button",{onClick:E,style:{position:"absolute",left:0,top:0,bottom:0,zIndex:5,width:32,background:"linear-gradient(to right, var(--bg-secondary) 60%, transparent)",border:"none",color:"var(--text-muted)",cursor:C?"pointer":"default",fontSize:12,display:"flex",alignItems:"center",justifyContent:"center",opacity:C?.7:0,pointerEvents:C?"auto":"none",transition:"opacity 0.15s"},onMouseEnter:I=>{C&&(I.currentTarget.style.opacity="1")},onMouseLeave:I=>{I.currentTarget.style.opacity=C?"0.7":"0"},children:"◀"}),n&&p.jsx("button",{onClick:R,style:{position:"absolute",right:0,top:0,bottom:0,zIndex:5,width:32,background:"linear-gradient(to left, var(--bg-secondary) 60%, transparent)",border:"none",color:"var(--text-muted)",cursor:$?"pointer":"default",fontSize:12,display:"flex",alignItems:"center",justifyContent:"center",opacity:$?.7:0,pointerEvents:$?"auto":"none",transition:"opacity 0.15s"},onMouseEnter:I=>{$&&(I.currentTarget.style.opacity="1")},onMouseLeave:I=>{I.currentTarget.style.opacity=$?"0.7":"0"},children:"▶"}),p.jsxs("div",{ref:r,className:"dashboard-agent-tabs",onWheel:I=>{const A=r.current;A&&Math.abs(I.deltaY)>Math.abs(I.deltaX)&&(I.preventDefault(),A.scrollLeft+=I.deltaY)},style:{display:"flex",overflowX:"auto",overflowY:"visible",flexShrink:0,background:"var(--bg-secondary)",borderBottom:"1px solid var(--border-subtle)",paddingTop:6,paddingBottom:0,paddingLeft:n?36:8,paddingRight:n?36:8,gap:4,scrollbarWidth:"none",WebkitOverflowScrolling:"touch",userSelect:"none",WebkitUserSelect:"none"},children:[e.map((I,A)=>{const P=t===I.tabKey,U=I.status==="working"?"agent-tab-working":I.status==="waiting_approval"?"agent-tab-waiting":"",B=A<9?String(A+1):null;return p.jsxs("div",{"data-tabkey":I.tabKey,className:U,draggable:!0,onDragStart:()=>{u.current=I.tabKey},onDragOver:j=>{j.preventDefault(),j.currentTarget.style.borderLeft="2px solid var(--accent-primary)"},onDragLeave:j=>{j.currentTarget.style.borderLeft=P?"1px solid var(--border-subtle)":"1px solid transparent"},onDrop:j=>{if(j.preventDefault(),j.currentTarget.style.borderLeft=P?"1px solid var(--border-subtle)":"1px solid transparent",!u.current||u.current===I.tabKey)return;const H=e.map(Q=>Q.tabKey),L=H.indexOf(u.current),W=H.indexOf(I.tabKey);if(L===-1||W===-1)return;const S=[...H];S.splice(L,1),S.splice(W,0,u.current),o(S),u.current=null},onDragEnd:()=>{u.current=null},onTouchStart:j=>_(I.tabKey,j),onTouchMove:v,onTouchEnd:y,onClick:()=>{a(),s(I.tabKey),I.streamSource==="agent-stream"&&I.agentType&&(h(I.ideId,"agent_stream_focus",{agentType:I.agentType}).catch(()=>{}),l(I.tabKey,[200,1500])),Gt(I)&&setTimeout(()=>{var j,H;(H=(j=i.current)==null?void 0:j.bumpResize)==null||H.call(j)},100)},style:{flexShrink:0,padding:"6px 10px",background:P?"var(--bg-primary)":"rgba(255,255,255,0.03)",borderRadius:"8px 8px 0 0",borderTop:P?"1px solid var(--border-subtle)":"1px solid transparent",borderLeft:P?"1px solid var(--border-subtle)":"1px solid transparent",borderRight:P?"1px solid var(--border-subtle)":"1px solid transparent",borderBottom:"none",cursor:"grab",display:"flex",alignItems:"center",gap:8,transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",opacity:m&&d.current===I.tabKey?.3:P?1:.5,...I.p2pState==="gave_up"&&{opacity:m&&d.current===I.tabKey?.15:P?.6:.3}},children:[I.status==="working"?p.jsx("div",{className:"tab-spinner"}):I.status==="waiting_approval"?p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"#f59e0b"},children:"▲"}):I.p2pState==="gave_up"?p.jsx("span",{onClick:j=>{var L;j.stopPropagation();const H=I.daemonId||((L=I.ideId)==null?void 0:L.split(":")[0])||"";c==null||c(H)},title:"P2P disconnected — click to reconnect",style:{fontSize:8,padding:"1px 5px",color:"#f59e0b",cursor:"pointer"},children:"●"}):I.p2pState==="connecting"?p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"#60a5fa"},children:"○"}):I.p2pState==="connected"?p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"#22c55e"},children:"●"}):p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"var(--text-muted)"},children:"●"}),p.jsxs("div",{style:{minWidth:0},children:[p.jsx("div",{style:{fontSize:12,fontWeight:700,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:I.displayPrimary}),p.jsxs("div",{style:{fontSize:8,opacity:.5,display:"flex",gap:4,alignItems:"center"},children:[I.displaySecondary,I.machineName&&p.jsxs(p.Fragment,{children:[p.jsx("span",{style:{opacity:.4},children:"·"}),p.jsxs("span",{style:{opacity:.7},children:["🖥 ",I.machineName]})]})]})]}),B&&p.jsx("span",{style:{fontSize:9,opacity:.35,fontFamily:"monospace",marginLeft:2,flexShrink:0},children:B})]},I.tabKey)}),e.length===0&&p.jsx("div",{style:{padding:"8px",fontSize:12,opacity:.4},children:"No active agents online."})]})]})}function gI({toasts:e,onDismiss:t,onClickToast:n}){return p.jsx("div",{style:{position:"fixed",top:16,right:16,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:e.map(r=>p.jsx("div",{className:"fade-in",style:{background:r.type==="success"?"rgba(16, 185, 129, 0.95)":r.type==="warning"?"rgba(245, 158, 11, 0.95)":"rgba(99, 102, 241, 0.95)",color:"white",padding:"12px 20px",borderRadius:12,fontSize:13,fontWeight:600,boxShadow:"0 8px 32px rgba(0,0,0,0.3)",backdropFilter:"blur(8px)",pointerEvents:"auto",cursor:"pointer",animation:"toast-in 0.3s ease-out",maxWidth:360},onClick:()=>{n&&n(r),t(r.id)},children:r.message},r.id))})}const mI=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function _I(e){var r;const t=(r=e.workspaceFolders)==null?void 0:r[0];return t!=null&&t.name?t.name:((t==null?void 0:t.path)??"").split("/").filter(Boolean).pop()||"Workspace"}function vI(e,t,n,r){var s;const i={};if(n)for(const o of n){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 w,_,v,y,E;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((w=o.id)==null?void 0:w.split(":")[0])||o.id,h=r?r[c]||"new":void 0,u=_I(o),d=Bn(o.type),f=o.agentStreams,g=Array.isArray(f)?f:[],m=mI(o);if(m){const R=zh(o.type),C=(_=o.agents)==null?void 0:_[0],M=(v=o.activeChat)==null?void 0:v.activeModal,$=M&&Array.isArray(M.buttons)&&M.buttons.length>0,G=(y=o.activeChat)==null?void 0:y.status,T=G==="generating"||G==="loading"||G&&G.toLowerCase()==="thinking",A=$||G==="waiting_approval"?"waiting_approval":T?"working":(C==null?void 0:C.status)||"idle",P=o.activeChat||{title:"",messages:[]};let U=P.title&&String(P.title).trim()?String(P.title).trim():"";const B=(E=o.activeChat)==null?void 0:E.id,j=o.chats;if(B&&Array.isArray(j)&&j.length>0){const Q=j.find(le=>le.id===B||le.id&&String(le.id)===String(B));Q!=null&&Q.title&&String(Q.title).trim()&&(U=String(Q.title).trim())}const H=P.messages||[],L=t[o.id]||[],W=new Map;H.filter(Q=>Q.role==="user").forEach(Q=>{W.set(Q.content,(W.get(Q.content)||0)+1)});const S=L.filter(Q=>{const le=W.get(Q.content)||0;return le>0?(W.set(Q.content,le-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:R,agentType:Gt(o)||bn(o)?o.type:(C==null?void 0:C.type)||"ide-native",status:A,title:U,messages:[...H,...S],ideType:o.type,workspaceName:u,displayPrimary:U||R||u,displaySecondary:d,cdpconnected:o.cdpconnected,modalButtons:$?M.buttons:void 0,modalMessage:$?M.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,p2pState:h})}if(m&&(Gt(o)||bn(o)))return l;for(const R of g){const C=R.activeModal&&Array.isArray(R.activeModal.buttons)&&R.activeModal.buttons.length>0,M=C?"waiting_approval":R.status==="streaming"?"working":R.status,$=`${o.id}:${R.agentType}`,G=R.messages||[],T=t[$]||[],I=new Map;G.filter(P=>P.role==="user").forEach(P=>{I.set(P.content,(I.get(P.content)||0)+1)});const A=T.filter(P=>{const U=I.get(P.content)||0;return U>0?(I.set(P.content,U-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:R.agentName,agentType:R.agentType,status:M,title:"",messages:[...G,...A],ideType:o.type,workspaceName:u,displayPrimary:R.agentName,displaySecondary:d,cdpconnected:o.cdpconnected,modalButtons:C?R.activeModal.buttons:void 0,modalMessage:C?R.activeModal.message:void 0,streamSource:"agent-stream",tabKey:$,machineName:a,p2pState: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||d,displaySecondary:d,cdpconnected:o.cdpconnected,streamSource:"native",tabKey:o.id,p2pState:h}),l})}function hf(){return ly()}class yI{constructor(){os(this,"listeners",new Map)}send(t){}isConnected(){return!1}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>{var r;(r=this.listeners.get(t))==null||r.delete(n)}}emit(t,...n){var r;(r=this.listeners.get(t))==null||r.forEach(i=>i(...n))}}const SI=new yI;class wI{constructor(){os(this,"ptyCallbacks",new Set)}sendPtyInput(t,n,r){return!1}sendPtyResize(t,n,r,i){return!1}async requestChatHistory(t,n,r,i,s){return{messages:[],hasMore:!1}}retryConnection(t){}getState(t){return"disconnected"}sendData(t,n){return!1}get(t){}onScreenshot(t,n){return()=>{}}onStatusEvent(t){return()=>{}}onPtyOutput(t){return this.ptyCallbacks.add(t),()=>{this.ptyCallbacks.delete(t)}}emitPtyOutput(t,n){this.ptyCallbacks.forEach(r=>r(t,n))}}const qr=new wI,Em=qr;function xI(){const{sendCommand:e}=fi(),t=hf(),{updateIdeChats:n,screenshotMap:r,setScreenshotMap:i}=t,s=t.ides||[],o=t.toasts||[],l=t.setToasts||(()=>{}),a=t.wsStatus||"connected",c=t.isP2PActive||!1,h=t.p2pStates||{},u=t.retryP2P||(()=>{}),d=t.showReconnected||!1,[f,g]=x.useState(()=>{try{const F=new URLSearchParams(window.location.search).get("activeTab");return F||sessionStorage.getItem("adhdev_dashboard_activeTab")}catch{return null}}),m=x.useCallback(N=>{g(N);try{N?sessionStorage.setItem("adhdev_dashboard_activeTab",N):sessionStorage.removeItem("adhdev_dashboard_activeTab")}catch{}},[]),w=x.useRef([]),[_,v]=x.useState(""),[y,E]=x.useState({}),[R,C]=x.useState(!1),[M,$]=x.useState(!1),[G,T]=x.useState(!1),[I,A]=x.useState([]),[P,U]=x.useState({}),[B,j]=x.useState({}),H=x.useRef(null),L=x.useRef(null),W=x.useRef(null),[S,Q]=x.useState(!1),le=s.find(N=>N.type==="adhdev-daemon"),k=(le==null?void 0:le.detectedIdes)||[],ge=!!le,ie=x.useMemo(()=>{var K,Y;const N=s.filter(J=>J.type!=="adhdev-daemon"),F=new Map;for(const J of N){const oe=F.get(J.id);if(!oe)F.set(J.id,J);else{const ae=(((K=oe.workspaceFolders)==null?void 0:K.length)||0)+(oe.activeChat?1:0);((((Y=J.workspaceFolders)==null?void 0:Y.length)||0)+(J.activeChat?1:0)>ae||(J.timestamp||0)>(oe.timestamp||0))&&F.set(J.id,J)}}return Array.from(F.values())},[s]),z=x.useMemo(()=>{const N=vI(ie,P,s,h),F=Date.now();return N.map(K=>{const Y=B[K.tabKey];return Y&&F-Y<5e3?{...K,messages:[],title:""}:K})},[ie,P,B,s]),[q,te]=x.useState(()=>{try{return JSON.parse(sessionStorage.getItem("adhdev_tabOrder")||"[]")}catch{return[]}}),ue=x.useMemo(()=>{if(q.length===0)return z;const N=new Map(q.map((F,K)=>[F,K]));return[...z].sort((F,K)=>{const Y=N.get(F.tabKey)??9999,J=N.get(K.tabKey)??9999;return Y-J})},[z,q]);x.useEffect(()=>{const N=W.current;if(!N)return;const F=()=>Q(N.scrollWidth>N.clientWidth+2);F();const K=new ResizeObserver(F);return K.observe(N),N.addEventListener("scroll",F),()=>{K.disconnect(),N.removeEventListener("scroll",F)}},[ue.length]);const _e=x.useCallback(N=>{te(N);try{sessionStorage.setItem("adhdev_tabOrder",JSON.stringify(N))}catch{}},[]);x.useEffect(()=>{if(Object.keys(B).length===0)return;const F=setTimeout(()=>{j(K=>{const Y=Date.now(),J={};for(const[oe,ae]of Object.entries(K))Y-ae<5e3&&(J[oe]=ae);return Object.keys(J).length===Object.keys(K).length?K:J})},5500);return()=>clearTimeout(F)},[B]);const O=ue.find(N=>N.tabKey===f),Te=ue.map(N=>N.tabKey).join(","),ye=x.useRef(!1);x.useEffect(()=>{if(ue.length===0||ye.current&&f&&ue.some(F=>F.tabKey===f))return;const N=ue.find(F=>F.cdpconnected===!0);N?m(N.tabKey):(!f||!ue.some(F=>F.tabKey===f))&&m(ue[0].tabKey)},[Te]);const Qe=x.useCallback(()=>{w.current.forEach(N=>clearTimeout(N)),w.current=[]},[]),Pe=x.useCallback((N,F)=>{Qe();for(const K of F)w.current.push(setTimeout(()=>m(N),K))},[Qe]);x.useEffect(()=>{var K;if(!((K=O==null?void 0:O.messages)!=null&&K.length))return;const N=O.ideId,F=Date.now();E(Y=>{let J=!1;const oe={...Y};return O.messages.forEach((ae,fe)=>{const ce=`${N}-${ae.id??`i-${fe}`}`;oe[ce]==null&&(oe[ce]=F,J=!0)}),J?oe:Y})},[O==null?void 0:O.ideId,O==null?void 0:O.messages]);const _n=x.useRef(!1);x.useEffect(()=>{if(!R){_n.current=!1;return}if(!O||_n.current||M)return;const N=s.find(F=>F.id===O.ideId);N&&(!N.chats||N.chats.length===0)&&(_n.current=!0,X())},[R,O==null?void 0:O.ideId]),x.useEffect(()=>{const N=setInterval(()=>{const F=Date.now()-3e5;A(K=>{const Y=K.filter(J=>J.timestamp>F).slice(-100);return Y.length===K.length?K:Y})},6e4);return()=>clearInterval(N)},[]);const rn=x.useRef(new Map);x.useEffect(()=>{const N=(K,Y)=>{var fe,ce,b;if(!Y)return;for(const Z of z){if(!Gt(Z))continue;const xe=(fe=Z.ideId)!=null&&fe.includes(":cli:")?Z.ideId.split(":cli:")[1]:"";if(K===xe||K===Z.agentType||K===Z.ideType){const ze=rn.current.get(Z.tabKey)||[];ze.push(Y),ze.length>1e4&&ze.splice(0,ze.length-5e3),rn.current.set(Z.tabKey,ze)}}const J=O&&Gt(O),oe=(ce=O==null?void 0:O.ideId)!=null&&ce.includes(":cli:")?O.ideId.split(":cli:")[1]:"",ae=K===oe||K===(O==null?void 0:O.agentType)||K===(O==null?void 0:O.ideType);J&&ae&&((b=H.current)==null||b.write(Y))},F=Em.onPtyOutput(N);return()=>{F()}},[O==null?void 0:O.agentType,O==null?void 0:O.ideType,O==null?void 0:O.tabKey,z]),x.useEffect(()=>{if(!O||!Gt(O))return;const F=setTimeout(()=>{if(H.current){const K=rn.current.get(O.tabKey);if(K&&K.length>0)for(const Y of K)H.current.write(Y);H.current.bumpResize()}},200);return()=>clearTimeout(F)},[O==null?void 0:O.tabKey]),x.useEffect(()=>{if(!O)return;const N=setTimeout(()=>{var F;(F=L.current)==null||F.focus()},150);return()=>clearTimeout(N)},[O==null?void 0:O.tabKey]),x.useEffect(()=>{const N=F=>{var ae,fe,ce,b,Z,ve;const K=parseInt(F.key);if(isNaN(K)||K<1||K>9)return;if(F.ctrlKey){F.preventDefault();const xe=ue[K-1];xe&&(Qe(),m(xe.tabKey));return}const Y=(ae=document.activeElement)==null?void 0:ae.tagName,J=Y==="INPUT"||Y==="TEXTAREA"||((fe=document.activeElement)==null?void 0:fe.isContentEditable),oe=((b=(ce=document.activeElement)==null?void 0:ce.closest)==null?void 0:b.call(ce,".xterm-helper-textarea"))!=null||((ve=(Z=document.activeElement)==null?void 0:Z.classList)==null?void 0:ve.contains("xterm-helper-textarea"));if(!J&&!oe){F.preventDefault();const xe=ue[K-1];xe&&(Qe(),m(xe.tabKey))}};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[ue,Qe,m]),x.useEffect(()=>{const N=SI.on("status_event",F=>{var oe;const K=Bn(F.ideType||"");let Y="",J="info";if(F.event==="agent:generating_completed"){const ae=F.duration?` (${F.duration}s)`:"";Y=`✅ ${K} agent task completed${ae}`,J="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}if(F.ideId){const fe={role:"system",timestamp:Date.now(),content:`✅ Task completed${ae}`,_localId:`sys_complete_${Date.now()}`};U(ce=>{for(const b of Object.keys(ce))if(b.includes(F.ideId))return{...ce,[b]:[...ce[b]||[],fe]};return ce})}}else if(F.event==="agent:generating_started")F.ideId&&U(ae=>{const fe={...ae};for(const ce of Object.keys(fe))ce.includes(F.ideId)&&(fe[ce]=(fe[ce]||[]).filter(b=>{var Z;return!(b.role==="system"&&((Z=b._localId)!=null&&Z.startsWith("sys_complete_")))}));return fe});else if((F.event==="agent:waiting_approval"||F.event==="agent:approval_needed")&&(Y=`⚡ ${K} approval needed`,J="warning",F.ideId)){const ae=F.modalMessage||"Approval requested",fe=(oe=F.modalButtons)!=null&&oe.length?F.modalButtons.map(b=>`[${b}]`).join(" "):"[Approve] [Reject]",ce={role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${ae}
168
- ${fe}`,_localId:`sys_approval_${Date.now()}`};U(b=>{for(const Z of Object.keys(b))if(Z.includes(F.ideId))return{...b,[Z]:[...b[Z]||[],ce]};return b})}if(Y){const ae=Date.now();l(fe=>[...fe.slice(-4),{id:ae,message:Y,type:J,timestamp:ae,ideId:F.ideId}]),setTimeout(()=>l(fe=>fe.filter(ce=>ce.id!==ae)),5e3)}});return()=>N()},[]),x.useEffect(()=>{var F;const N=K=>{const Y=K.data;(Y==null?void 0:Y.type)==="notification_action"&&Y.action==="approve"&&Y.ideId&&e(Y.ideId,"resolve_action",{action:"approve",button:"Approve"}).catch(J=>console.error("[SW Action] approve failed:",J))};return(F=navigator.serviceWorker)==null||F.addEventListener("message",N),()=>{var K;return(K=navigator.serviceWorker)==null?void 0:K.removeEventListener("message",N)}},[]);const Hn=async()=>{if(!O)return;const N=_.trim();if(!N)return;const F=O.ideId,K=O.tabKey;v(""),Pe(K,[100,500,1500,3e3]);const Y=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,J={role:"user",content:N,timestamp:Date.now(),_localId:Y};U(oe=>({...oe,[K]:[...oe[K]||[],J]}));try{if(Gt(O)&&!bn(O)){const oe=F||O.daemonId||"";if(!oe)return;const ae=O.ideType||O.agentType||"";await e(oe,"agent_command",{agentType:ae,cliType:ae,action:"send_chat",message:N,text:N})}else if(bn(O)){const oe=F||O.daemonId||"";if(!oe)return;await e(oe,"send_chat",{message:N,text:N,agentType:O.agentType})}else{const oe=F||O.daemonId||"";if(!oe)return;await e(oe,"send_chat",{message:N,text:N,...O.streamSource==="agent-stream"&&{agentType:O.agentType}})}setTimeout(()=>{const oe=Date.now()-6e4;U(ae=>{const fe=ae[K];if(!fe)return ae;const ce=fe.filter(b=>b.timestamp>oe);return ce.length===fe.length?ae:{...ae,[K]:ce}})},6e4)}catch(oe){console.error("Send failed",oe),v(N),U(ae=>({...ae,[K]:(ae[K]||[]).filter(fe=>fe._localId!==Y)}))}},ar=async()=>{if(O)try{ge?await e(O.ideId,"launch_ide",{ideType:O.ideType,enableCdp:!0}):await e(O.ideId,"vscode_command_exec",{commandId:"adhdev.relaunchWithCdp",args:[{force:!0}]})}catch(N){console.error("Relaunch failed",N)}},Un=async N=>{try{await e("standalone","launch_ide",{ideType:N,enableCdp:!0})}catch(F){console.error("Launch failed",F)}},Rn=async N=>{if(O){console.log("[ModalButton] ideId:",O.ideId,"button:",N,"agentType:",O.agentType,"source:",O.streamSource),A(F=>[...F,{ideId:O.tabKey,text:`🖱️ **${N}** clicked`,timestamp:Date.now()}]);try{let F;if(Gt(O)&&!bn(O)){const Y=(O.modalButtons||[]).indexOf(N),J=N.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase();let oe;Y>=0?oe=`${Y+1}\r`:/^(deny|no|reject|cancel)/.test(J)?oe="3\r":/always/.test(J)?oe="2\r":oe="1\r";const ae=O.daemonId||O.ideId,fe=O.ideType||O.agentType||"";Em.sendPtyInput(ae,fe,oe)||await e(ae,"pty_input",{cliType:fe,data:oe}),F={success:!0}}else{const K=N.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),Y=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(K),J=O.ideId||O.daemonId||"";F=await e(J,"resolve_action",{button:N,action:Y?"approve":"reject",...O.streamSource==="agent-stream"&&{agentType:O.agentType}})}console.log("[ModalButton] result:",F),F.success||A(K=>[...K,{ideId:O.tabKey,text:`⚠️ **${N}** failed — button not found`,timestamp:Date.now()}])}catch(F){console.error("[ModalButton] Error:",F),A(K=>[...K,{ideId:O.tabKey,text:`❌ **${N}** error`,timestamp:Date.now()}])}}},Kn=async(N,F)=>{try{const K=N||(O==null?void 0:O.daemonId)||"",Y=await e(K,"switch_chat",{id:F,sessionId:F,...(O==null?void 0:O.streamSource)==="agent-stream"&&{agentType:O==null?void 0:O.agentType}}),J=Y==null?void 0:Y.result;(Y==null?void 0:Y.success)===!0||J==="switched"||J==="switched-by-title"||(J===!1||J==="not_found"?l(ae=>[...ae,{id:Date.now(),message:"⚠️ Session tab not found — try refreshing history",type:"warning",timestamp:Date.now()}]):typeof J=="string"&&J.startsWith("error:")?l(ae=>[...ae,{id:Date.now(),message:`⚠️ Switch error: ${J}`,type:"warning",timestamp:Date.now()}]):l(ae=>[...ae,{id:Date.now(),message:"⚠️ Session switch failed",type:"warning",timestamp:Date.now()}]))}catch(K){console.error("Switch failed",K),l(Y=>[...Y,{id:Date.now(),message:`❌ Switch failed: ${K.message||"connection error"}`,type:"warning",timestamp:Date.now()}])}},xt=async()=>{if(!(!O||G)){T(!0);try{const N=O.ideId||O.daemonId||"";await e(N,"new_chat",{...O.streamSource==="agent-stream"&&{agentType:O.agentType}}),j(F=>({...F,[O.tabKey]:Date.now()})),U(F=>({...F,[O.tabKey]:[]}))}catch(N){console.error("New chat failed",N)}finally{T(!1)}}},[ne,pe]=x.useState(!1),D=async()=>{if(!O||ne)return;pe(!0);const N=O.tabKey;try{await e(O.ideId,"agent_stream_focus",{agentType:O.agentType}),Pe(N,[200,1500,3e3])}catch(F){console.error("Focus agent failed",F)}finally{pe(!1)}},X=async()=>{var N;if(!(!O||M)){$(!0);try{const F=O.ideId||O.daemonId||"",K=await e(F,"list_chats",{forceExpand:!0,...O.streamSource==="agent-stream"&&{agentType:O.agentType}}),Y=(K==null?void 0:K.chats)||((N=K==null?void 0:K.result)==null?void 0:N.chats);K!=null&&K.success&&Array.isArray(Y)&&n(O.ideId,Y)}catch(F){console.error("Refresh history failed",F)}finally{$(!1)}}};return p.jsxs("div",{className:"page-dashboard",style:{flex:1,minHeight:0,background:"var(--bg-primary)",color:"var(--text-primary)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[p.jsx(cI,{wsStatus:a,showReconnected:d}),p.jsx(uI,{activeConv:O,agentCount:ie.length,wsStatus:a,isP2PActive:c,onOpenHistory:()=>C(!0)}),p.jsx(pI,{sortedConversations:ue,activeTabId:f,tabsOverflow:S,tabsContainerRef:W,terminalRef:H,onSelectTab:N=>{ye.current=!0,m(N)},onReorder:_e,pinTab:Pe,clearTabPinTimers:Qe,retryP2P:u}),p.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},children:O?p.jsxs(p.Fragment,{children:[p.jsx(l1,{activeConv:O,onModalButton:Rn}),p.jsx("div",{className:"desktop-only",style:{padding:"4px 12px 8px"},children:!Gt(O)&&!bn(O)&&r[O.ideId]?p.jsxs("div",{style:{position:"relative",borderRadius:12,overflow:"hidden",border:"1px solid var(--border-subtle)",background:"var(--bg-secondary)",aspectRatio:"16/9"},children:[p.jsx("img",{src:r[O.ideId],style:{width:"100%",height:"100%",objectFit:"cover"}}),p.jsx("button",{onClick:()=>{const N={...r};delete N[O.ideId],i(N)},style:{position:"absolute",top:10,right:10,background:"rgba(0,0,0,0.5)",border:"none",color:"white",width:20,height:20,borderRadius:"50%",fontSize:10,zIndex:10},children:"✕"})]}):!Gt(O)&&!bn(O)&&O.cdpconnected===!1?p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 14px",background:"rgba(234,179,8,0.08)",border:"1px solid rgba(234,179,8,0.2)",borderRadius:8,fontSize:12,color:"var(--text-secondary)"},children:[p.jsx("span",{style:{fontSize:14},children:"⚠️"}),p.jsx("span",{style:{flex:1},children:"CDP not connected — chat history & screenshots unavailable for this IDE."}),p.jsx("button",{className:"btn btn-sm",onClick:ar,style:{background:"rgba(234,179,8,0.15)",color:"#eab308",border:"1px solid rgba(234,179,8,0.3)",fontSize:10,whiteSpace:"nowrap",flexShrink:0},children:"Relaunch with CDP"})]}):null}),Gt(O)&&!bn(O)?p.jsx(aI,{activeConv:O,ptyBuffers:rn,terminalRef:H,agentInput:_,setAgentInput:v,handleSendChat:Hn,handleModalButton:Rn}):p.jsx(a1,{activeConv:O,ides:s,agentInput:_,setAgentInput:v,handleSendChat:Hn,handleFocusAgent:D,isFocusingAgent:ne,messageReceivedAt:y,actionLogs:I})]}):p.jsxs("div",{className:"empty-dashboard",children:[p.jsx("div",{className:"glow-orb",children:p.jsx("img",{src:"/otter-logo.png",alt:"",style:{width:48,height:48}})}),p.jsxs("div",{style:{textAlign:"center"},children:[p.jsx("div",{style:{fontWeight:700,fontSize:18,marginBottom:6},children:"No IDE connected"}),p.jsx("div",{style:{fontSize:13,color:"var(--text-muted)",marginBottom:ge&&k.length>0?16:0},children:ge?"Launch an IDE with CDP to start monitoring":"Launch your IDE with the ADHDev extension to start"}),ge&&k.length>0&&p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"},children:k.filter(N=>N.running||!0).map(N=>p.jsxs("button",{className:"btn btn-sm",onClick:()=>Un(N.type),style:{background:"rgba(139,92,246,0.1)",border:"1px solid rgba(139,92,246,0.25)",color:"#a78bfa",fontSize:12,fontWeight:600,padding:"8px 16px",borderRadius:8,cursor:"pointer",display:"flex",alignItems:"center",gap:6,transition:"all 0.2s"},onMouseEnter:F=>F.currentTarget.style.background="rgba(139,92,246,0.2)",onMouseLeave:F=>F.currentTarget.style.background="rgba(139,92,246,0.1)",children:["🚀 Launch ",N.name]},N.type))})]})]})}),R&&O&&p.jsx(fI,{activeConv:O,ides:s,isCreatingChat:G,isRefreshingHistory:M,onClose:()=>C(!1),onNewChat:xt,onSwitchSession:Kn,onRefreshHistory:X}),p.jsx("style",{children:`
166
+ `})]})}function v1({activeConv:e,onModalButton:t}){const[n,r]=x.useState(null);if(x.useEffect(()=>{r(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=s=>{n||(r(s),t(s))};return p.jsxs("div",{style:{background:"linear-gradient(135deg, #d97706, #b45309)",color:"white",padding:"10px 16px",flexShrink:0,zIndex:5},children:[e.modalMessage&&p.jsx("div",{style:{fontSize:11,opacity:.85,marginBottom:6,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:e.modalMessage.replace(/[\n\r]+/g," ").slice(0,120)}),p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[p.jsxs("div",{style:{fontWeight:900,fontSize:12,display:"flex",alignItems:"center",gap:8},children:[p.jsx("span",{children:"⚠️"})," ",n?"PROCESSING...":"ACTION REQUIRED"]}),p.jsx("div",{style:{display:"flex",gap:8,flexWrap:"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=n===s,u=n!==null;return p.jsx("button",{onClick:()=>i(s),disabled:u,className:"btn btn-sm",style:{background:a?"white":c?"rgba(239,68,68,0.3)":"rgba(255,255,255,0.15)",color:a?"#b45309":"white",border:"none",fontWeight:a?800:600,borderRadius:6,fontSize:12,padding:"4px 12px",opacity:u&&!h?.4:1,cursor:u?"not-allowed":"pointer"},children:h?"⏳ ...":s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim()},o)})})]})]})}const _n=new Map;function gI({ideId:e,ideType:t,agentType:n,agentName:r,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var te;const{sendCommand:a}=wi(),c=!!(o||l),h=`${e}:${n}`,u=_n.get(h),[d,f]=x.useState(!1),[g,m]=x.useState(!1),[w,_]=x.useState((u==null?void 0:u.models)||[]),[v,y]=x.useState((u==null?void 0:u.modes)||[]),[E,R]=x.useState(i||""),[C,M]=x.useState(s||""),[$,G]=x.useState(!1),[T,P]=x.useState(!1),B=x.useRef(0);x.useEffect(()=>{if(o){const F=o.find(ie=>ie.category==="model");if(F){const ie=F.options.map(ue=>ue.value);_(ie),F.currentValue&&R(F.currentValue);const ne=_n.get(h)||{models:[],modes:[]};_n.set(h,{...ne,models:ie})}}if(l&&l.length>0){const F=l.map(ne=>ne.id);y(F);const ie=_n.get(h)||{models:[],modes:[]};_n.set(h,{...ie,modes:F})}else if(o){const F=o.find(ie=>ie.category!=="model");if(F){const ie=F.options.map(ue=>ue.value);y(ie),F.currentValue&&M(F.currentValue);const ne=_n.get(h)||{models:[],modes:[]};_n.set(h,{...ne,modes:ie})}}},[o,l,h]),x.useEffect(()=>{f(!1),m(!1),R(i||""),M(s||"");const F=_n.get(h);F?(_(F.models),y(F.modes)):(_([]),y([]))},[e,n]),x.useEffect(()=>{i&&Date.now()>B.current&&R(i)},[i]),x.useEffect(()=>{s&&Date.now()>B.current&&M(s)},[s]);const D=x.useCallback(async(F,ie={})=>{const ne={...ie},ue=e.split(":");return ue.length>=3&&(ue[1]==="ide"||ue[1]==="cli"||ue[1]==="acp")&&(ne._targetInstance=ue.slice(2).join(":"),ne._targetType=ue[1]),await a(e,F,ne)},[e]),U=async()=>{var F,ie;if(w.length>0){f(!d);return}if(c){f(!0);return}G(!0);try{const ne=await D("list_extension_models",{agentType:n,ideType:t}),ue=(ne==null?void 0:ne.models)||((F=ne==null?void 0:ne.result)==null?void 0:F.models)||[];_(ue),ne!=null&&ne.current&&R(ne.current),(ie=ne==null?void 0:ne.result)!=null&&ie.current&&R(ne.result.current);const Se=_n.get(h)||{models:[],modes:[]};_n.set(h,{...Se,models:ue}),f(!0)}catch{}finally{G(!1)}},A=async()=>{var F,ie;if(v.length>0){m(!g);return}if(c){m(!0);return}P(!0);try{const ne=await D("list_extension_modes",{agentType:n,ideType:t}),ue=(ne==null?void 0:ne.modes)||((F=ne==null?void 0:ne.result)==null?void 0:F.modes)||[];y(ue),ne!=null&&ne.current&&M(ne.current),(ie=ne==null?void 0:ne.result)!=null&&ie.current&&M(ne.result.current);const Se=_n.get(h)||{models:[],modes:[]};_n.set(h,{...Se,modes:ue}),m(!0)}catch{}finally{P(!1)}},O=async F=>{f(!1),R(F),B.current=Date.now()+5e3;try{c?await D("change_model",{agentType:n,ideType:t,model:F}):await D("set_extension_model",{agentType:n,ideType:t,model:F})}catch{}},H=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(F=>F.category!=="model")),L=H?(te=o==null?void 0:o.find(F=>F.category!=="model"))==null?void 0:te.configId:void 0,W=async F=>{m(!1),M(F),B.current=Date.now()+5e3;try{c&&H&&L?await D("set_thought_level",{agentType:n,ideType:t,configId:L,value:F}):c?await D("set_mode",{agentType:n,ideType:t,mode:F}):await D("set_extension_mode",{agentType:n,ideType:t,mode:F})}catch{}},Q={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[n]||"#94a3b8",le={display:"inline-flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:12,fontSize:10,fontWeight:500,cursor:"pointer",border:"1px solid transparent",transition:"all 0.15s",background:"var(--surface-tertiary)",color:"var(--text-secondary)",whiteSpace:"nowrap",maxWidth:160,overflow:"hidden",textOverflow:"ellipsis"},k={position:"absolute",bottom:"100%",left:0,zIndex:60,background:"var(--surface-primary)",border:"1px solid var(--border-subtle)",borderRadius:8,marginBottom:4,maxHeight:220,overflowY:"auto",minWidth:160,boxShadow:"0 -4px 16px rgba(0,0,0,0.3)"},ge=F=>({padding:"7px 12px",fontSize:11,cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",background:F?`${Q}18`:"transparent",color:F?Q:"var(--text-secondary)",fontWeight:F?600:400,borderLeft:F?`2px solid ${Q}`:"2px solid transparent"});return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",flexWrap:"wrap",fontSize:10,borderTop:"1px solid var(--border-subtle)",background:"var(--surface-primary)"},children:[p.jsx("span",{style:{fontSize:9,fontWeight:700,color:Q,letterSpacing:"0.03em",textTransform:"uppercase",opacity:.7},children:r}),p.jsx("span",{style:{color:"var(--border-subtle)",fontSize:10},children:"│"}),p.jsxs("div",{style:{position:"relative"},children:[p.jsxs("span",{style:{...le,borderColor:d?`${Q}55`:"transparent",color:E?"var(--text-primary)":"var(--text-muted)"},onClick:U,children:[p.jsx("span",{style:{fontSize:9,opacity:.6},children:"🤖"}),$?"...":E||"Model",p.jsx("span",{style:{fontSize:7,opacity:.5},children:"▼"})]}),d&&w.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{style:{position:"fixed",inset:0,zIndex:59},onClick:()=>f(!1)}),p.jsxs("div",{style:k,children:[p.jsx("div",{style:{padding:"6px 12px",fontSize:9,fontWeight:700,color:"var(--text-muted)",letterSpacing:"0.05em",borderBottom:"1px solid var(--border-subtle)"},children:"SELECT MODEL"}),w.map(F=>p.jsx("div",{style:ge(F===E),onMouseEnter:ie=>{ie.currentTarget.style.background=`${Q}12`},onMouseLeave:ie=>{ie.currentTarget.style.background=F===E?`${Q}18`:"transparent"},onClick:()=>O(F),children:F},F))]})]})]}),p.jsxs("div",{style:{position:"relative"},children:[p.jsxs("span",{style:{...le,borderColor:g?`${Q}55`:"transparent",color:C?"var(--text-primary)":"var(--text-muted)"},onClick:A,children:[p.jsx("span",{style:{fontSize:9,opacity:.6},children:H?"🧠":"⚡"}),T?"...":C||(H?"Thinking":"Mode"),p.jsx("span",{style:{fontSize:7,opacity:.5},children:"▼"})]}),g&&v.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{style:{position:"fixed",inset:0,zIndex:59},onClick:()=>m(!1)}),p.jsxs("div",{style:k,children:[p.jsx("div",{style:{padding:"6px 12px",fontSize:9,fontWeight:700,color:"var(--text-muted)",letterSpacing:"0.05em",borderBottom:"1px solid var(--border-subtle)"},children:H?"SELECT THINKING LEVEL":"SELECT MODE"}),v.map(F=>p.jsx("div",{style:ge(F===C),onMouseEnter:ie=>{ie.currentTarget.style.background=`${Q}12`},onMouseLeave:ie=>{ie.currentTarget.style.background=F===C?`${Q}18`:"transparent"},onClick:()=>W(F),children:F},F))]})]})]})]})}const cn=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),Mn=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function y1({activeConv:e,ides:t,agentInput:n,setAgentInput:r,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a}){const c=x.useRef(null),{sendCommand:h}=wi(),[u,d]=x.useState([]),[f,g]=x.useState(0),[m,w]=x.useState(!0),[_,v]=x.useState(!1),y=x.useRef("");e.tabKey!==y.current&&(y.current=e.tabKey,d([]),g(0),w(!0));const E=x.useCallback(async()=>{var M,$,G,T,P;if(!(_||!m)){v(!0);try{const B=t.find(L=>L.id===e.ideId),D=(B==null?void 0:B.daemonId)||((M=e.ideId)==null?void 0:M.split(":")[0])||"";if(!D){w(!1);return}const U=e.ideType||e.agentType||"",A=(e.ideId||"").split(":"),O=A.length>=3?A.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:D,agentType:U,instanceId:O,offset:f});const H=await h(D,"chat_history",{agentType:U,offset:f,limit:30,instanceId:O});console.log("[ChatPane] got result:",{count:(($=H.messages)==null?void 0:$.length)||0,hasMore:H.hasMore}),((G=H.messages)==null?void 0:G.length)>0&&(d(L=>[...H.messages,...L]),g(L=>L+H.messages.length)),w(H.hasMore)}catch(B){console.warn("[ChatPane] Failed to load history:",B),!((T=B==null?void 0:B.message)!=null&&T.includes("P2P not available"))&&!((P=B==null?void 0:B.message)!=null&&P.includes("channel not open"))&&w(!1)}finally{v(!1)}}},[_,m,f,t,e]),R=x.useRef(0);x.useEffect(()=>{if(e.messages.length<10&&m&&!_&&u.length===0){const M=R.current;if(M>5)return;const G=setTimeout(()=>{R.current=M+1,E()},M===0?0:2e3);return()=>clearTimeout(G)}else u.length>0&&(R.current=0)},[e.tabKey,e.messages.length,m,_,u.length,E]);const C=(()=>{const M=e.messages.map((T,P)=>{const B=`${e.ideId}-${T.id??`i-${P}`}`;return{...T,receivedAt:T.receivedAt||l[B]||0}});if(u.length===0)return M;const $=new Set(M.map(T=>`${T.role}:${(T.content||"").slice(0,100)}`));return[...u.filter(T=>!$.has(`${T.role}:${(T.content||"").slice(0,100)}`)),...M]})();return p.jsxs(p.Fragment,{children:[p.jsx(E0,{messages:C,actionLogs:a.filter(M=>M.ideId===e.tabKey).sort((M,$)=>M.timestamp-$.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",isCliMode:cn(e)||Mn(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:E,isLoadingMore:_,hasMoreHistory:m,emptyState:e.messages.length===0?e.status==="not_monitored"?p.jsxs("div",{style:{textAlign:"center",marginTop:60,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[p.jsx("div",{style:{fontSize:28,opacity:.6},children:"🔌"}),p.jsx("div",{style:{fontSize:13,opacity:.5},children:"Agent not monitored"}),p.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm",style:{background:"var(--accent-primary)",color:"white",border:"none",borderRadius:10,padding:"8px 20px",fontWeight:700,fontSize:13,cursor:"pointer",transition:"all 0.2s"},children:o?"⌛ Switching...":`📂 Open ${e.displayPrimary} Panel`}),p.jsx("div",{style:{fontSize:11,opacity:.35,maxWidth:280},children:"Click to switch monitoring to this agent"})]}):e.status==="panel_hidden"?p.jsxs("div",{style:{textAlign:"center",marginTop:60,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[p.jsx("div",{style:{fontSize:28,opacity:.6},children:"👁️‍🗨️"}),p.jsx("div",{style:{fontSize:13,opacity:.5},children:"Panel is not visible in IDE"}),p.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm",style:{background:"var(--accent-primary)",color:"white",border:"none",borderRadius:10,padding:"8px 20px",fontWeight:700,fontSize:13,cursor:"pointer",transition:"all 0.2s"},children:o?"⌛ Opening...":`📂 Open ${e.displayPrimary} Panel`}),p.jsx("div",{style:{fontSize:11,opacity:.35,maxWidth:280},children:"Open the agent sidebar in your IDE to start viewing messages"})]}):void 0:void 0}),!cn(e)&&(()=>{const M=t.find($=>$.id===e.ideId);return p.jsx(gI,{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:(M==null?void 0:M.currentModel)||void 0,serverMode:(M==null?void 0:M.currentPlan)||void 0,acpConfigOptions:Mn(e)?M==null?void 0:M.acpConfigOptions:void 0,acpModes:Mn(e)?M==null?void 0:M.acpModes:void 0})})(),p.jsx("div",{className:"dashboard-input-area",style:{padding:"10px 12px",background:"var(--surface-primary)",borderTop:"1px solid var(--border-subtle)",flexShrink:0},children:p.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[p.jsx("div",{style:{flex:1,position:"relative"},children:p.jsx("input",{ref:c,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:n,onChange:M=>r(M.target.value),onPaste:M=>{const $=M.clipboardData.getData("text");$&&r(G=>G+$),M.preventDefault()},onKeyDown:M=>{if(M.key==="Enter"){if(M.nativeEvent.isComposing){M.preventDefault();return}M.preventDefault(),i()}},onBlur:()=>{window.innerWidth<768&&setTimeout(()=>{document.documentElement.scrollTop=0},100)},style:{width:"100%",height:40,borderRadius:20,padding:"0 16px",background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",fontSize:14,color:"var(--text-primary)"}})}),p.jsx("button",{onClick:i,disabled:!n.trim(),style:{width:40,height:40,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:n.trim()?"var(--accent-primary)":"var(--bg-secondary)",cursor:n.trim()?"pointer":"default",flexShrink:0,transition:"all 0.3s ease"},children:p.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:n.trim()?"white":"var(--text-muted)"},children:p.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function mI({activeConv:e,ptyBuffers:t,terminalRef:n,agentInput:r,setAgentInput:i,handleSendChat:s,handleModalButton:o}){const l=x.useRef(null),{sendCommand:a,sendData:c}=wi();return p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",background:"var(--surface-primary)",borderBottom:"1px solid var(--border-subtle)",flexShrink:0},children:[p.jsx("div",{style:{display:"flex",gap:4},children:p.jsx("div",{style:{padding:"4px 12px",borderRadius:6,fontSize:11,fontWeight:600,background:"var(--accent)",color:"#fff"},children:"⬛ Terminal"})}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)"},children:[e.agentName," — Terminal"]}),p.jsx("button",{onClick:()=>{if(!n.current||!e)return;const h=t.current.get(e.tabKey);if(h&&h.length>0)for(const u of h)n.current.write(u);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var u;(u=n.current)==null||u.bumpResize()})})},title:"Refresh terminal (replay buffer + TUI redraw)",style:{padding:"3px 8px",borderRadius:5,fontSize:11,background:"var(--bg-secondary)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",cursor:"pointer",lineHeight:1},children:"↺"}),p.jsx("button",{onClick:async()=>{var d;const h=(d=e.ideId)!=null&&d.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(f){console.error("Stop CLI failed:",f)}},title:"Stop CLI process",style:{padding:"3px 8px",borderRadius:5,fontSize:11,background:"rgba(239,68,68,0.08)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.3)",cursor:"pointer",lineHeight:1,fontWeight:600},children:"■ Stop"})]})]}),p.jsx(v1,{activeConv:e,onModalButton:o}),p.jsx("div",{style:{flex:1,minHeight:0,padding:8,background:"#0f1117"},children:p.jsx(_1,{ref:n,onInput:h=>{var f;const u=e.ideId||e.daemonId||"",d=(f=e.ideId)!=null&&f.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(u,{type:"pty_input",cliType:d,data:h})||a(u,"pty_input",{cliType:d,data:h}).catch(console.error)},onResize:(h,u)=>{var g;const d=e.ideId||e.daemonId||"",f=(g=e.ideId)!=null&&g.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(d,{type:"pty_resize",cliType:f,cols:h,rows:u})||a(d,"pty_resize",{cliType:f,cols:h,rows:u,force:!0}).catch(()=>{})}},e.tabKey)}),p.jsx("div",{style:{padding:"8px 12px",background:"var(--surface-primary)",borderTop:"1px solid var(--border-subtle)",flexShrink:0},children:p.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[p.jsx("div",{style:{flex:1,position:"relative"},children:p.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:h=>i(h.target.value),onPaste:h=>{const u=h.clipboardData.getData("text");u&&i(d=>d+u),h.preventDefault()},onKeyDown:h=>{if(h.key==="Enter"){if(h.nativeEvent.isComposing){h.preventDefault();return}h.preventDefault(),s()}},style:{width:"100%",height:36,borderRadius:18,padding:"0 16px",background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",fontSize:13,color:"var(--text-primary)"}})}),p.jsx("button",{onClick:s,disabled:!r.trim(),style:{width:36,height:36,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:r.trim()?"var(--accent-primary)":"var(--bg-secondary)",cursor:r.trim()?"pointer":"default",flexShrink:0,transition:"all 0.3s ease"},children:p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:r.trim()?"white":"var(--text-muted)"},children:p.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function _I({wsStatus:e,showReconnected:t,loginUrl:n}){const r=e==="disconnected"||e==="reconnecting"||e==="offline"||e==="auth_failed";return p.jsxs(p.Fragment,{children:[r&&p.jsxs("div",{style:{padding:"10px 20px",fontSize:13,fontWeight:600,display:"flex",alignItems:"center",gap:10,justifyContent:"center",background:e==="auth_failed"?"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))":e==="offline"?"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))":"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))",borderBottom:e==="auth_failed"?"1px solid rgba(239,68,68,0.2)":e==="offline"?"1px solid rgba(255,107,53,0.2)":"1px solid rgba(139,92,246,0.2)",color:e==="auth_failed"?"#ef4444":e==="offline"?"#ff6b35":"#a78bfa"},children:[p.jsx("img",{src:"/otter-logo.png",alt:"",style:{width:20,height:20,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"&&(n?p.jsxs(p.Fragment,{children:["Session expired."," ",p.jsx("a",{href:n,style:{color:"inherit",textDecoration:"underline"},children:"Log in again"})]}):"Connection failed — please restart the server.")]}),t&&e==="connected"&&p.jsxs("div",{style:{padding:"8px 16px",fontSize:12,fontWeight:600,display:"flex",alignItems:"center",gap:8,justifyContent:"center",background:"linear-gradient(90deg, rgba(34,197,94,0.12), rgba(34,197,94,0.04))",color:"#22c55e",borderBottom:"1px solid rgba(34,197,94,0.15)",animation:"fadeIn 0.3s ease"},children:[p.jsx("img",{src:"/otter-logo.png",alt:"",style:{width:16,height:16}}),"Connected"]})]})}const nu=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),ru=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function vI({activeConv:e,agentCount:t,wsStatus:n,isP2PActive:r,onOpenHistory:i}){const s=cs();return p.jsxs("div",{className:"dashboard-header",children:[p.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:p.jsxs("div",{style:{lineHeight:1.25},children:[p.jsxs("h1",{className:"header-title",style:{margin:0},children:["DASHBOARD",p.jsxs("span",{className:"header-count-mobile",style:{fontSize:10,fontWeight:600,opacity:.6,marginLeft:8,letterSpacing:"0.02em"},children:[t," Active",p.jsx("span",{style:{display:"inline-block",width:5,height:5,borderRadius:"50%",marginLeft:4,verticalAlign:"middle",background:r?"#22c55e":n==="connected"?"#eab308":"#ef4444"}})]})]}),p.jsxs("div",{className:"header-subtitle",style:{fontSize:11,alignItems:"center",gap:4},children:[t," AGENTS ACTIVE",p.jsx("span",{title:r?"P2P Direct":n==="connected"?"WebSocket":"Disconnected",style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:r?"#22c55e":n==="connected"?"#eab308":"#ef4444",boxShadow:r?"0 0 4px #22c55e80":n==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480",flexShrink:0}})]})]})}),p.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e&&!nu(e)&&!ru(e)&&p.jsx("button",{onClick:()=>s(`/ide/${e.ideId}`),className:"btn btn-primary btn-sm",style:{border:"none",padding:"6px 12px",fontSize:12},children:"IDE"}),e&&!nu(e)&&!ru(e)&&p.jsx("button",{onClick:i,className:"btn btn-secondary btn-sm",style:{border:"none",background:"var(--bg-secondary)",padding:"6px 10px",display:"flex",alignItems:"center",gap:4},title:"Chat History",children:"📜"}),e&&!nu(e)&&!ru(e)&&p.jsx("button",{onClick:()=>s(`/ide/${e.ideId}?view=remote`),className:"btn btn-secondary btn-sm",style:{border:"none",background:"var(--bg-secondary)",padding:"6px 10px"},title:"Remote Control",children:"🖥️"})]})]})}function Kn(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function yI(e){if(e<60)return`${Math.round(e)}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const n=Math.floor(t/60),r=t%60;if(n<24)return r>0?`${n}h ${r}m`:`${n}h`;const i=Math.floor(n/24),s=n%24;return`${i}d ${s}h`}function Bm(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Nm(e){return(e.id||"").includes(":cli:")}function Yh(e,t){return Kn(e)}function SI(e){if(!Array.isArray(e)||e.length<=1)return e;const t=new Map,n=["generating","streaming","active","connected","idle","panel_hidden"];for(const r of e){const i=(r.name||r.id||"").toLowerCase().replace(/\s+/g,"-"),s=t.get(i);if(!s){t.set(i,r);continue}const o=n.indexOf(s.status||"idle"),l=n.indexOf(r.status||"idle");l>=0&&(o<0||l<o)&&t.set(i,r)}return Array.from(t.values())}function wI({activeConv:e,ides:t,isCreatingChat:n,isRefreshingHistory:r,onClose:i,onNewChat:s,onSwitchSession:o,onRefreshHistory:l}){var u;const a=t.find(d=>d.id===e.ideId),c=(a==null?void 0:a.chats)||[],h=(u=a==null?void 0:a.activeChat)==null?void 0:u.id;return p.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"},children:[p.jsx("div",{onClick:i,style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}),p.jsxs("div",{className:"card fade-in",style:{position:"relative",width:"90%",maxWidth:500,maxHeight:"80vh",display:"flex",flexDirection:"column",padding:0,overflow:"hidden",boxShadow:"0 20px 40px rgba(0,0,0,0.4)",borderRadius:20},children:[p.jsxs("div",{style:{padding:"20px 24px",borderBottom:"1px solid var(--border-subtle)",display:"flex",justifyContent:"space-between",alignItems:"center",background:"var(--surface-primary)"},children:[p.jsxs("div",{children:[p.jsx("h3",{style:{margin:0,fontSize:18,fontWeight:800},children:"Chat History"}),p.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:2},children:[e.displayPrimary," — ",Kn(e.ideType)]})]}),p.jsx("button",{onClick:i,style:{background:"none",border:"none",fontSize:20,color:"var(--text-muted)",cursor:"pointer"},children:"✕"})]}),p.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,background:"var(--bg-primary)"},children:[p.jsx("button",{onClick:s,disabled:n,style:{width:"100%",padding:"14px",borderRadius:12,marginBottom:12,background:"rgba(99,102,241,0.1)",border:"1px dashed var(--accent-primary)",color:"var(--accent-primary)",fontWeight:700,fontSize:14,cursor:"pointer"},children:n?"⌛ Creating...":"+ Start New Chat Session"}),c.map(d=>p.jsxs("div",{onClick:()=>{o(e.ideId,d.id),i()},style:{padding:"16px",borderRadius:12,marginBottom:8,cursor:"pointer",background:h===d.id?"var(--bg-glass-hover)":"var(--surface-secondary)",border:"1px solid",borderColor:h===d.id?"var(--accent-primary)":"var(--border-subtle)",transition:"all 0.2s"},children:[p.jsx("div",{style:{fontWeight:700,fontSize:14,marginBottom:4,color:h===d.id?"var(--accent-primary-light)":"var(--text-primary)"},children:d.title||"Untitled Session"}),p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[p.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",fontFamily:"monospace"},children:[d.id.substring(0,12),"..."]}),h===d.id&&p.jsx("span",{style:{fontSize:10,background:"var(--accent-primary)",color:"white",padding:"2px 8px",borderRadius:10,fontWeight:800},children:"ACTIVE"})]})]},d.id)),c.length===0&&p.jsxs("div",{style:{padding:"40px 20px",textAlign:"center",color:"var(--text-muted)"},children:[p.jsx("div",{style:{fontSize:32,marginBottom:12},children:"🕯️"}),p.jsx("div",{style:{fontSize:13},children:"No recent chat sessions found."})]})]}),p.jsx("div",{style:{padding:"16px 20px",background:"var(--surface-tertiary)",borderTop:"1px solid var(--border-subtle)",textAlign:"right"},children:p.jsx("button",{onClick:l,disabled:r,className:"btn btn-secondary btn-sm",style:{borderRadius:10},children:r?"⌛ Refreshing...":"🔄 Refresh History"})})]})]})}function xI({sortedConversations:e,activeTabId:t,tabsOverflow:n,tabsContainerRef:r,terminalRef:i,onSelectTab:s,onReorder:o,pinTab:l,clearTabPinTimers:a,retryP2P:c}){const{sendCommand:h}=wi(),u=x.useRef(null),d=x.useRef(null),f=x.useRef(null),g=x.useRef(null),[m,w]=x.useState(!1),_=x.useCallback((P,B)=>{const D=B.touches[0];f.current={x:D.clientX,y:D.clientY},d.current=P,g.current=setTimeout(()=>{w(!0)},400)},[]),v=x.useCallback(P=>{if(!m||!d.current){g.current&&(clearTimeout(g.current),g.current=null);return}P.preventDefault();const B=P.touches[0],D=r.current;if(!D)return;const U=Array.from(D.querySelectorAll("[data-tabkey]"));for(const A of U){const O=A.getBoundingClientRect();if(B.clientX>=O.left&&B.clientX<=O.right){const H=A.getAttribute("data-tabkey");if(H&&H!==d.current){const L=e.map(Q=>Q.tabKey),W=L.indexOf(d.current),S=L.indexOf(H);if(W!==-1&&S!==-1){const Q=[...L];Q.splice(W,1),Q.splice(S,0,d.current),o(Q)}}break}}},[m,e,r,o]),y=x.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null),w(!1),d.current=null,f.current=null},[]),E=()=>{const P=r.current;P&&P.scrollBy({left:-150,behavior:"smooth"})},R=()=>{const P=r.current;P&&P.scrollBy({left:150,behavior:"smooth"})},[C,M]=x.useState(!1),[$,G]=x.useState(!1),T=x.useCallback(()=>{const P=r.current;P&&(M(P.scrollLeft>4),G(P.scrollLeft+P.clientWidth<P.scrollWidth-4))},[r]);return x.useEffect(()=>{const P=r.current;if(!P)return;T(),P.addEventListener("scroll",T,{passive:!0});const B=new ResizeObserver(T);return B.observe(P),()=>{P.removeEventListener("scroll",T),B.disconnect()}},[r,T,e.length]),p.jsxs("div",{style:{position:"relative",flexShrink:0},children:[n&&p.jsx("button",{onClick:E,style:{position:"absolute",left:0,top:0,bottom:0,zIndex:5,width:32,background:"linear-gradient(to right, var(--bg-secondary) 60%, transparent)",border:"none",color:"var(--text-muted)",cursor:C?"pointer":"default",fontSize:12,display:"flex",alignItems:"center",justifyContent:"center",opacity:C?.7:0,pointerEvents:C?"auto":"none",transition:"opacity 0.15s"},onMouseEnter:P=>{C&&(P.currentTarget.style.opacity="1")},onMouseLeave:P=>{P.currentTarget.style.opacity=C?"0.7":"0"},children:"◀"}),n&&p.jsx("button",{onClick:R,style:{position:"absolute",right:0,top:0,bottom:0,zIndex:5,width:32,background:"linear-gradient(to left, var(--bg-secondary) 60%, transparent)",border:"none",color:"var(--text-muted)",cursor:$?"pointer":"default",fontSize:12,display:"flex",alignItems:"center",justifyContent:"center",opacity:$?.7:0,pointerEvents:$?"auto":"none",transition:"opacity 0.15s"},onMouseEnter:P=>{$&&(P.currentTarget.style.opacity="1")},onMouseLeave:P=>{P.currentTarget.style.opacity=$?"0.7":"0"},children:"▶"}),p.jsxs("div",{ref:r,className:"dashboard-agent-tabs",onWheel:P=>{const B=r.current;B&&Math.abs(P.deltaY)>Math.abs(P.deltaX)&&(P.preventDefault(),B.scrollLeft+=P.deltaY)},style:{display:"flex",overflowX:"auto",overflowY:"visible",flexShrink:0,background:"var(--bg-secondary)",borderBottom:"1px solid var(--border-subtle)",paddingTop:6,paddingBottom:0,paddingLeft:n?36:8,paddingRight:n?36:8,gap:4,scrollbarWidth:"none",WebkitOverflowScrolling:"touch",userSelect:"none",WebkitUserSelect:"none"},children:[e.map((P,B)=>{const D=t===P.tabKey,U=P.status==="working"?"agent-tab-working":P.status==="waiting_approval"?"agent-tab-waiting":"",A=B<9?String(B+1):null;return p.jsxs("div",{"data-tabkey":P.tabKey,className:U,draggable:!0,onDragStart:()=>{u.current=P.tabKey},onDragOver:O=>{O.preventDefault(),O.currentTarget.style.borderLeft="2px solid var(--accent-primary)"},onDragLeave:O=>{O.currentTarget.style.borderLeft=D?"1px solid var(--border-subtle)":"1px solid transparent"},onDrop:O=>{if(O.preventDefault(),O.currentTarget.style.borderLeft=D?"1px solid var(--border-subtle)":"1px solid transparent",!u.current||u.current===P.tabKey)return;const H=e.map(Q=>Q.tabKey),L=H.indexOf(u.current),W=H.indexOf(P.tabKey);if(L===-1||W===-1)return;const S=[...H];S.splice(L,1),S.splice(W,0,u.current),o(S),u.current=null},onDragEnd:()=>{u.current=null},onTouchStart:O=>_(P.tabKey,O),onTouchMove:v,onTouchEnd:y,onClick:()=>{a(),s(P.tabKey),P.streamSource==="agent-stream"&&P.agentType&&(h(P.ideId,"agent_stream_focus",{agentType:P.agentType}).catch(()=>{}),l(P.tabKey,[200,1500])),cn(P)&&setTimeout(()=>{var O,H;(H=(O=i.current)==null?void 0:O.bumpResize)==null||H.call(O)},100)},style:{flexShrink:0,padding:"6px 10px",background:D?"var(--bg-primary)":"rgba(255,255,255,0.03)",borderRadius:"8px 8px 0 0",borderTop:D?"1px solid var(--border-subtle)":"1px solid transparent",borderLeft:D?"1px solid var(--border-subtle)":"1px solid transparent",borderRight:D?"1px solid var(--border-subtle)":"1px solid transparent",borderBottom:"none",cursor:"grab",display:"flex",alignItems:"center",gap:8,transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",opacity:m&&d.current===P.tabKey?.3:D?1:.5,...P.p2pState==="gave_up"&&{opacity:m&&d.current===P.tabKey?.15:D?.6:.3}},children:[P.status==="working"?p.jsx("div",{className:"tab-spinner"}):P.status==="waiting_approval"?p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"#f59e0b"},children:"▲"}):P.p2pState==="gave_up"?p.jsx("span",{onClick:O=>{var L;O.stopPropagation();const H=P.daemonId||((L=P.ideId)==null?void 0:L.split(":")[0])||"";c==null||c(H)},title:"P2P disconnected — click to reconnect",style:{fontSize:8,padding:"1px 5px",color:"#f59e0b",cursor:"pointer"},children:"●"}):P.p2pState==="connecting"?p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"#60a5fa"},children:"○"}):P.p2pState==="connected"?p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"#22c55e"},children:"●"}):p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"var(--text-muted)"},children:"●"}),p.jsxs("div",{style:{minWidth:0},children:[p.jsx("div",{style:{fontSize:12,fontWeight:700,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:P.displayPrimary}),p.jsxs("div",{style:{fontSize:8,opacity:.5,display:"flex",gap:4,alignItems:"center"},children:[P.displaySecondary,P.machineName&&p.jsxs(p.Fragment,{children:[p.jsx("span",{style:{opacity:.4},children:"·"}),p.jsxs("span",{style:{opacity:.7},children:["🖥 ",P.machineName]})]})]})]}),A&&p.jsx("span",{style:{fontSize:9,opacity:.35,fontFamily:"monospace",marginLeft:2,flexShrink:0},children:A})]},P.tabKey)}),e.length===0&&p.jsx("div",{style:{padding:"8px",fontSize:12,opacity:.4},children:"No active agents online."})]})]})}function bI({toasts:e,onDismiss:t,onClickToast:n}){return p.jsx("div",{style:{position:"fixed",top:16,right:16,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:e.map(r=>p.jsx("div",{className:"fade-in",style:{background:r.type==="success"?"rgba(16, 185, 129, 0.95)":r.type==="warning"?"rgba(245, 158, 11, 0.95)":"rgba(99, 102, 241, 0.95)",color:"white",padding:"12px 20px",borderRadius:12,fontSize:13,fontWeight:600,boxShadow:"0 8px 32px rgba(0,0,0,0.3)",backdropFilter:"blur(8px)",pointerEvents:"auto",cursor:"pointer",animation:"toast-in 0.3s ease-out",maxWidth:360},onClick:()=>{n&&n(r),t(r.id)},children:r.message},r.id))})}const kI=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function CI(e){var r;const t=(r=e.workspaceFolders)==null?void 0:r[0];return t!=null&&t.name?t.name:((t==null?void 0:t.path)??"").split("/").filter(Boolean).pop()||"Workspace"}function EI(e,t,n,r){var s;const i={};if(n)for(const o of n){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 w,_,v,y,E;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((w=o.id)==null?void 0:w.split(":")[0])||o.id,h=r?r[c]||"new":void 0,u=CI(o),d=Kn(o.type),f=o.agentStreams,g=Array.isArray(f)?f:[],m=kI(o);if(m){const R=Yh(o.type),C=(_=o.agents)==null?void 0:_[0],M=(v=o.activeChat)==null?void 0:v.activeModal,$=M&&Array.isArray(M.buttons)&&M.buttons.length>0,G=(y=o.activeChat)==null?void 0:y.status,T=G==="generating"||G==="loading"||G&&G.toLowerCase()==="thinking",B=$||G==="waiting_approval"?"waiting_approval":T?"working":(C==null?void 0:C.status)||"idle",D=o.activeChat||{title:"",messages:[]};let U=D.title&&String(D.title).trim()?String(D.title).trim():"";const A=(E=o.activeChat)==null?void 0:E.id,O=o.chats;if(A&&Array.isArray(O)&&O.length>0){const Q=O.find(le=>le.id===A||le.id&&String(le.id)===String(A));Q!=null&&Q.title&&String(Q.title).trim()&&(U=String(Q.title).trim())}const H=D.messages||[],L=t[o.id]||[],W=new Map;H.filter(Q=>Q.role==="user").forEach(Q=>{W.set(Q.content,(W.get(Q.content)||0)+1)});const S=L.filter(Q=>{const le=W.get(Q.content)||0;return le>0?(W.set(Q.content,le-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:R,agentType:cn(o)||Mn(o)?o.type:(C==null?void 0:C.type)||"ide-native",status:B,title:U,messages:[...H,...S],ideType:o.type,workspaceName:u,displayPrimary:U||R||u,displaySecondary:d,cdpconnected:o.cdpconnected,modalButtons:$?M.buttons:void 0,modalMessage:$?M.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,p2pState:h})}if(m&&(cn(o)||Mn(o)))return l;for(const R of g){const C=R.activeModal&&Array.isArray(R.activeModal.buttons)&&R.activeModal.buttons.length>0,M=C?"waiting_approval":R.status==="streaming"?"working":R.status,$=`${o.id}:${R.agentType}`,G=R.messages||[],T=t[$]||[],P=new Map;G.filter(D=>D.role==="user").forEach(D=>{P.set(D.content,(P.get(D.content)||0)+1)});const B=T.filter(D=>{const U=P.get(D.content)||0;return U>0?(P.set(D.content,U-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:R.agentName,agentType:R.agentType,status:M,title:"",messages:[...G,...B],ideType:o.type,workspaceName:u,displayPrimary:R.agentName,displaySecondary:d,cdpconnected:o.cdpconnected,modalButtons:C?R.activeModal.buttons:void 0,modalMessage:C?R.activeModal.message:void 0,streamSource:"agent-stream",tabKey:$,machineName:a,p2pState:h})}return l.length===0&&l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:Yh(o.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:o.type,workspaceName:u,displayPrimary:u||d,displaySecondary:d,cdpconnected:o.cdpconnected,streamSource:"native",tabKey:o.id,p2pState:h}),l})}let TI=vy;function xf(){return TI()}class RI{constructor(){ps(this,"listeners",new Map)}send(t){}isConnected(){return!1}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>{var r;(r=this.listeners.get(t))==null||r.delete(n)}}emit(t,...n){var r;(r=this.listeners.get(t))==null||r.forEach(i=>i(...n))}}let II=new RI;class PI{constructor(){ps(this,"ptyCallbacks",new Set)}sendPtyInput(t,n,r){return!1}sendPtyResize(t,n,r,i){return!1}async requestChatHistory(t,n,r,i,s){return{messages:[],hasMore:!1}}retryConnection(t){}getState(t){return"disconnected"}sendData(t,n){return!1}get(t){}onScreenshot(t,n){return()=>{}}onStatusEvent(t){return()=>{}}onPtyOutput(t){return this.ptyCallbacks.add(t),()=>{this.ptyCallbacks.delete(t)}}emitPtyOutput(t,n){this.ptyCallbacks.forEach(r=>r(t,n))}}let ti=new PI,zm=ti;function LI(){const{sendCommand:e}=wi(),t=xf(),{updateIdeChats:n,screenshotMap:r,setScreenshotMap:i}=t,s=t.ides||[],o=t.toasts||[],l=t.setToasts||(()=>{}),a=t.wsStatus||"connected",c=t.isP2PActive||!1,h=t.p2pStates||{},u=t.retryP2P||(()=>{}),d=t.showReconnected||!1,[f,g]=x.useState(()=>{try{const j=new URLSearchParams(window.location.search).get("activeTab");return j||sessionStorage.getItem("adhdev_dashboard_activeTab")}catch{return null}}),m=x.useCallback(N=>{g(N);try{N?sessionStorage.setItem("adhdev_dashboard_activeTab",N):sessionStorage.removeItem("adhdev_dashboard_activeTab")}catch{}},[]),w=x.useRef([]),[_,v]=x.useState(""),[y,E]=x.useState({}),[R,C]=x.useState(!1),[M,$]=x.useState(!1),[G,T]=x.useState(!1),[P,B]=x.useState([]),[D,U]=x.useState({}),[A,O]=x.useState({}),H=x.useRef(null),L=x.useRef(null),W=x.useRef(null),[S,Q]=x.useState(!1),le=s.find(N=>N.type==="adhdev-daemon"),k=(le==null?void 0:le.detectedIdes)||[],ge=!!le,te=x.useMemo(()=>{var K,q;const N=s.filter(J=>J.type!=="adhdev-daemon"),j=new Map;for(const J of N){const oe=j.get(J.id);if(!oe)j.set(J.id,J);else{const ae=(((K=oe.workspaceFolders)==null?void 0:K.length)||0)+(oe.activeChat?1:0);((((q=J.workspaceFolders)==null?void 0:q.length)||0)+(J.activeChat?1:0)>ae||(J.timestamp||0)>(oe.timestamp||0))&&j.set(J.id,J)}}return Array.from(j.values())},[s]),F=x.useMemo(()=>{const N=EI(te,D,s,h),j=Date.now();return N.map(K=>{const q=A[K.tabKey];return q&&j-q<5e3?{...K,messages:[],title:""}:K})},[te,D,A,s]),[ie,ne]=x.useState(()=>{try{return JSON.parse(sessionStorage.getItem("adhdev_tabOrder")||"[]")}catch{return[]}}),ue=x.useMemo(()=>{if(ie.length===0)return F;const N=new Map(ie.map((j,K)=>[j,K]));return[...F].sort((j,K)=>{const q=N.get(j.tabKey)??9999,J=N.get(K.tabKey)??9999;return q-J})},[F,ie]);x.useEffect(()=>{const N=W.current;if(!N)return;const j=()=>Q(N.scrollWidth>N.clientWidth+2);j();const K=new ResizeObserver(j);return K.observe(N),N.addEventListener("scroll",j),()=>{K.disconnect(),N.removeEventListener("scroll",j)}},[ue.length]);const Se=x.useCallback(N=>{ne(N);try{sessionStorage.setItem("adhdev_tabOrder",JSON.stringify(N))}catch{}},[]);x.useEffect(()=>{if(Object.keys(A).length===0)return;const j=setTimeout(()=>{O(K=>{const q=Date.now(),J={};for(const[oe,ae]of Object.entries(K))q-ae<5e3&&(J[oe]=ae);return Object.keys(J).length===Object.keys(K).length?K:J})},5500);return()=>clearTimeout(j)},[A]);const z=ue.find(N=>N.tabKey===f),Be=ue.map(N=>N.tabKey).join(","),xe=x.useRef(!1);x.useEffect(()=>{if(ue.length===0||xe.current&&f&&ue.some(j=>j.tabKey===f))return;const N=ue.find(j=>j.cdpconnected===!0);N?m(N.tabKey):(!f||!ue.some(j=>j.tabKey===f))&&m(ue[0].tabKey)},[Be]);const nt=x.useCallback(()=>{w.current.forEach(N=>clearTimeout(N)),w.current=[]},[]),zt=x.useCallback((N,j)=>{nt();for(const K of j)w.current.push(setTimeout(()=>m(N),K))},[nt]);x.useEffect(()=>{var K;if(!((K=z==null?void 0:z.messages)!=null&&K.length))return;const N=z.ideId,j=Date.now();E(q=>{let J=!1;const oe={...q};return z.messages.forEach((ae,fe)=>{const ce=`${N}-${ae.id??`i-${fe}`}`;oe[ce]==null&&(oe[ce]=j,J=!0)}),J?oe:q})},[z==null?void 0:z.ideId,z==null?void 0:z.messages]);const qt=x.useRef(!1);x.useEffect(()=>{if(!R){qt.current=!1;return}if(!z||qt.current||M)return;const N=s.find(j=>j.id===z.ideId);N&&(!N.chats||N.chats.length===0)&&(qt.current=!0,Y())},[R,z==null?void 0:z.ideId]),x.useEffect(()=>{const N=setInterval(()=>{const j=Date.now()-3e5;B(K=>{const q=K.filter(J=>J.timestamp>j).slice(-100);return q.length===K.length?K:q})},6e4);return()=>clearInterval(N)},[]);const De=x.useRef(new Map);x.useEffect(()=>{const N=(K,q)=>{var fe,ce,ve;if(!q)return;for(const we of F){if(!cn(we))continue;const rt=(fe=we.ideId)!=null&&fe.includes(":cli:")?we.ideId.split(":cli:")[1]:"";if(K===rt||K===we.agentType||K===we.ideType){const Ot=De.current.get(we.tabKey)||[];Ot.push(q),Ot.length>1e4&&Ot.splice(0,Ot.length-5e3),De.current.set(we.tabKey,Ot)}}const J=z&&cn(z),oe=(ce=z==null?void 0:z.ideId)!=null&&ce.includes(":cli:")?z.ideId.split(":cli:")[1]:"",ae=K===oe||K===(z==null?void 0:z.agentType)||K===(z==null?void 0:z.ideType);J&&ae&&((ve=H.current)==null||ve.write(q))},j=zm.onPtyOutput(N);return()=>{j()}},[z==null?void 0:z.agentType,z==null?void 0:z.ideType,z==null?void 0:z.tabKey,F]),x.useEffect(()=>{if(!z||!cn(z))return;const j=setTimeout(()=>{if(H.current){const K=De.current.get(z.tabKey);if(K&&K.length>0)for(const q of K)H.current.write(q);H.current.bumpResize()}},200);return()=>clearTimeout(j)},[z==null?void 0:z.tabKey]),x.useEffect(()=>{if(!z)return;const N=setTimeout(()=>{var j;(j=L.current)==null||j.focus()},150);return()=>clearTimeout(N)},[z==null?void 0:z.tabKey]),x.useEffect(()=>{const N=j=>{var ae,fe,ce,ve,we,Qe;const K=parseInt(j.key);if(isNaN(K)||K<1||K>9)return;if(j.ctrlKey){j.preventDefault();const rt=ue[K-1];rt&&(nt(),m(rt.tabKey));return}const q=(ae=document.activeElement)==null?void 0:ae.tagName,J=q==="INPUT"||q==="TEXTAREA"||((fe=document.activeElement)==null?void 0:fe.isContentEditable),oe=((ve=(ce=document.activeElement)==null?void 0:ce.closest)==null?void 0:ve.call(ce,".xterm-helper-textarea"))!=null||((Qe=(we=document.activeElement)==null?void 0:we.classList)==null?void 0:Qe.contains("xterm-helper-textarea"));if(!J&&!oe){j.preventDefault();const rt=ue[K-1];rt&&(nt(),m(rt.tabKey))}};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[ue,nt,m]),x.useEffect(()=>{const N=II.on("status_event",j=>{var oe;const K=Kn(j.ideType||"");let q="",J="info";if(j.event==="agent:generating_completed"){const ae=j.duration?` (${j.duration}s)`:"";q=`✅ ${K} agent task completed${ae}`,J="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}if(j.ideId){const fe={role:"system",timestamp:Date.now(),content:`✅ Task completed${ae}`,_localId:`sys_complete_${Date.now()}`};U(ce=>{for(const ve of Object.keys(ce))if(ve.includes(j.ideId))return{...ce,[ve]:[...ce[ve]||[],fe]};return ce})}}else if(j.event==="agent:generating_started")j.ideId&&U(ae=>{const fe={...ae};for(const ce of Object.keys(fe))ce.includes(j.ideId)&&(fe[ce]=(fe[ce]||[]).filter(ve=>{var we;return!(ve.role==="system"&&((we=ve._localId)!=null&&we.startsWith("sys_complete_")))}));return fe});else if((j.event==="agent:waiting_approval"||j.event==="agent:approval_needed")&&(q=`⚡ ${K} approval needed`,J="warning",j.ideId)){const ae=j.modalMessage||"Approval requested",fe=(oe=j.modalButtons)!=null&&oe.length?j.modalButtons.map(ve=>`[${ve}]`).join(" "):"[Approve] [Reject]",ce={role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${ae}
168
+ ${fe}`,_localId:`sys_approval_${Date.now()}`};U(ve=>{for(const we of Object.keys(ve))if(we.includes(j.ideId))return{...ve,[we]:[...ve[we]||[],ce]};return ve})}if(q){const ae=Date.now();l(fe=>[...fe.slice(-4),{id:ae,message:q,type:J,timestamp:ae,ideId:j.ideId}]),setTimeout(()=>l(fe=>fe.filter(ce=>ce.id!==ae)),5e3)}});return()=>N()},[]),x.useEffect(()=>{var j;const N=K=>{const q=K.data;(q==null?void 0:q.type)==="notification_action"&&q.action==="approve"&&q.ideId&&e(q.ideId,"resolve_action",{action:"approve",button:"Approve"}).catch(J=>console.error("[SW Action] approve failed:",J))};return(j=navigator.serviceWorker)==null||j.addEventListener("message",N),()=>{var K;return(K=navigator.serviceWorker)==null?void 0:K.removeEventListener("message",N)}},[]);const Ce=async()=>{if(!z)return;const N=_.trim();if(!N)return;const j=z.ideId,K=z.tabKey;v(""),zt(K,[100,500,1500,3e3]);const q=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,J={role:"user",content:N,timestamp:Date.now(),_localId:q};U(oe=>({...oe,[K]:[...oe[K]||[],J]}));try{if(cn(z)&&!Mn(z)){const oe=j||z.daemonId||"";if(!oe)return;const ae=z.ideType||z.agentType||"";await e(oe,"agent_command",{agentType:ae,cliType:ae,action:"send_chat",message:N,text:N})}else if(Mn(z)){const oe=j||z.daemonId||"";if(!oe)return;await e(oe,"send_chat",{message:N,text:N,agentType:z.agentType})}else{const oe=j||z.daemonId||"";if(!oe)return;await e(oe,"send_chat",{message:N,text:N,...z.streamSource==="agent-stream"&&{agentType:z.agentType}})}setTimeout(()=>{const oe=Date.now()-6e4;U(ae=>{const fe=ae[K];if(!fe)return ae;const ce=fe.filter(ve=>ve.timestamp>oe);return ce.length===fe.length?ae:{...ae,[K]:ce}})},6e4)}catch(oe){console.error("Send failed",oe),v(N),U(ae=>({...ae,[K]:(ae[K]||[]).filter(fe=>fe._localId!==q)}))}},On=async()=>{if(z)try{ge?await e(z.ideId,"launch_ide",{ideType:z.ideType,enableCdp:!0}):await e(z.ideId,"vscode_command_exec",{commandId:"adhdev.relaunchWithCdp",args:[{force:!0}]})}catch(N){console.error("Relaunch failed",N)}},Jn=async N=>{try{await e("standalone","launch_ide",{ideType:N,enableCdp:!0})}catch(j){console.error("Launch failed",j)}},It=async N=>{if(z){console.log("[ModalButton] ideId:",z.ideId,"button:",N,"agentType:",z.agentType,"source:",z.streamSource),B(j=>[...j,{ideId:z.tabKey,text:`🖱️ **${N}** clicked`,timestamp:Date.now()}]);try{let j;if(cn(z)&&!Mn(z)){const q=(z.modalButtons||[]).indexOf(N),J=N.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase();let oe;q>=0?oe=`${q+1}\r`:/^(deny|no|reject|cancel)/.test(J)?oe="3\r":/always/.test(J)?oe="2\r":oe="1\r";const ae=z.daemonId||z.ideId,fe=z.ideType||z.agentType||"";zm.sendPtyInput(ae,fe,oe)||await e(ae,"pty_input",{cliType:fe,data:oe}),j={success:!0}}else{const K=N.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),q=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(K),J=z.ideId||z.daemonId||"";j=await e(J,"resolve_action",{button:N,action:q?"approve":"reject",...z.streamSource==="agent-stream"&&{agentType:z.agentType}})}console.log("[ModalButton] result:",j),j.success||B(K=>[...K,{ideId:z.tabKey,text:`⚠️ **${N}** failed — button not found`,timestamp:Date.now()}])}catch(j){console.error("[ModalButton] Error:",j),B(K=>[...K,{ideId:z.tabKey,text:`❌ **${N}** error`,timestamp:Date.now()}])}}},Yt=async(N,j)=>{try{const K=N||(z==null?void 0:z.daemonId)||"",q=await e(K,"switch_chat",{id:j,sessionId:j,...(z==null?void 0:z.streamSource)==="agent-stream"&&{agentType:z==null?void 0:z.agentType}}),J=q==null?void 0:q.result;(q==null?void 0:q.success)===!0||J==="switched"||J==="switched-by-title"||(J===!1||J==="not_found"?l(ae=>[...ae,{id:Date.now(),message:"⚠️ Session tab not found — try refreshing history",type:"warning",timestamp:Date.now()}]):typeof J=="string"&&J.startsWith("error:")?l(ae=>[...ae,{id:Date.now(),message:`⚠️ Switch error: ${J}`,type:"warning",timestamp:Date.now()}]):l(ae=>[...ae,{id:Date.now(),message:"⚠️ Session switch failed",type:"warning",timestamp:Date.now()}]))}catch(K){console.error("Switch failed",K),l(q=>[...q,{id:Date.now(),message:`❌ Switch failed: ${K.message||"connection error"}`,type:"warning",timestamp:Date.now()}])}},Ge=async()=>{if(!(!z||G)){T(!0);try{const N=z.ideId||z.daemonId||"";await e(N,"new_chat",{...z.streamSource==="agent-stream"&&{agentType:z.agentType}}),O(j=>({...j,[z.tabKey]:Date.now()})),U(j=>({...j,[z.tabKey]:[]}))}catch(N){console.error("New chat failed",N)}finally{T(!1)}}},[Z,pe]=x.useState(!1),I=async()=>{if(!z||Z)return;pe(!0);const N=z.tabKey;try{await e(z.ideId,"agent_stream_focus",{agentType:z.agentType}),zt(N,[200,1500,3e3])}catch(j){console.error("Focus agent failed",j)}finally{pe(!1)}},Y=async()=>{var N;if(!(!z||M)){$(!0);try{const j=z.ideId||z.daemonId||"",K=await e(j,"list_chats",{forceExpand:!0,...z.streamSource==="agent-stream"&&{agentType:z.agentType}}),q=(K==null?void 0:K.chats)||((N=K==null?void 0:K.result)==null?void 0:N.chats);K!=null&&K.success&&Array.isArray(q)&&n(z.ideId,q)}catch(j){console.error("Refresh history failed",j)}finally{$(!1)}}};return p.jsxs("div",{className:"page-dashboard",style:{flex:1,minHeight:0,background:"var(--bg-primary)",color:"var(--text-primary)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[p.jsx(_I,{wsStatus:a,showReconnected:d}),p.jsx(vI,{activeConv:z,agentCount:te.length,wsStatus:a,isP2PActive:c,onOpenHistory:()=>C(!0)}),p.jsx(xI,{sortedConversations:ue,activeTabId:f,tabsOverflow:S,tabsContainerRef:W,terminalRef:H,onSelectTab:N=>{xe.current=!0,m(N)},onReorder:Se,pinTab:zt,clearTabPinTimers:nt,retryP2P:u}),p.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},children:z?p.jsxs(p.Fragment,{children:[p.jsx(v1,{activeConv:z,onModalButton:It}),p.jsx("div",{className:"desktop-only",style:{padding:"4px 12px 8px"},children:!cn(z)&&!Mn(z)&&r[z.ideId]?p.jsxs("div",{style:{position:"relative",borderRadius:12,overflow:"hidden",border:"1px solid var(--border-subtle)",background:"var(--bg-secondary)",aspectRatio:"16/9"},children:[p.jsx("img",{src:r[z.ideId],style:{width:"100%",height:"100%",objectFit:"cover"}}),p.jsx("button",{onClick:()=>{const N={...r};delete N[z.ideId],i(N)},style:{position:"absolute",top:10,right:10,background:"rgba(0,0,0,0.5)",border:"none",color:"white",width:20,height:20,borderRadius:"50%",fontSize:10,zIndex:10},children:"✕"})]}):!cn(z)&&!Mn(z)&&z.cdpconnected===!1?p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 14px",background:"rgba(234,179,8,0.08)",border:"1px solid rgba(234,179,8,0.2)",borderRadius:8,fontSize:12,color:"var(--text-secondary)"},children:[p.jsx("span",{style:{fontSize:14},children:"⚠️"}),p.jsx("span",{style:{flex:1},children:"CDP not connected — chat history & screenshots unavailable for this IDE."}),p.jsx("button",{className:"btn btn-sm",onClick:On,style:{background:"rgba(234,179,8,0.15)",color:"#eab308",border:"1px solid rgba(234,179,8,0.3)",fontSize:10,whiteSpace:"nowrap",flexShrink:0},children:"Relaunch with CDP"})]}):null}),cn(z)&&!Mn(z)?p.jsx(mI,{activeConv:z,ptyBuffers:De,terminalRef:H,agentInput:_,setAgentInput:v,handleSendChat:Ce,handleModalButton:It}):p.jsx(y1,{activeConv:z,ides:s,agentInput:_,setAgentInput:v,handleSendChat:Ce,handleFocusAgent:I,isFocusingAgent:Z,messageReceivedAt:y,actionLogs:P})]}):p.jsxs("div",{className:"empty-dashboard",children:[p.jsx("div",{className:"glow-orb",children:p.jsx("img",{src:"/otter-logo.png",alt:"",style:{width:48,height:48}})}),p.jsxs("div",{style:{textAlign:"center"},children:[p.jsx("div",{style:{fontWeight:700,fontSize:18,marginBottom:6},children:"No IDE connected"}),p.jsx("div",{style:{fontSize:13,color:"var(--text-muted)",marginBottom:ge&&k.length>0?16:0},children:ge?"Launch an IDE with CDP to start monitoring":"Launch your IDE with the ADHDev extension to start"}),ge&&k.length>0&&p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"},children:k.filter(N=>N.running||!0).map(N=>p.jsxs("button",{className:"btn btn-sm",onClick:()=>Jn(N.type),style:{background:"rgba(139,92,246,0.1)",border:"1px solid rgba(139,92,246,0.25)",color:"#a78bfa",fontSize:12,fontWeight:600,padding:"8px 16px",borderRadius:8,cursor:"pointer",display:"flex",alignItems:"center",gap:6,transition:"all 0.2s"},onMouseEnter:j=>j.currentTarget.style.background="rgba(139,92,246,0.2)",onMouseLeave:j=>j.currentTarget.style.background="rgba(139,92,246,0.1)",children:["🚀 Launch ",N.name]},N.type))})]})]})}),R&&z&&p.jsx(wI,{activeConv:z,ides:s,isCreatingChat:G,isRefreshingHistory:M,onClose:()=>C(!1),onNewChat:Ge,onSwitchSession:Yt,onRefreshHistory:Y}),p.jsx("style",{children:`
169
169
  body { overflow: hidden; overscroll - behavior: none; }
170
170
  .btn { cursor: pointer; border - radius: 8px; font - weight: 600; font - size: 14px; transition: all 0.2s; }
171
171
  .btn - sm { padding: 6px 12px; font - size: 12px; }
@@ -177,10 +177,10 @@ ${fe}`,_localId:`sys_approval_${Date.now()}`};U(b=>{for(const Z of Object.keys(b
177
177
  }
178
178
  100 % { transform: scale(1); box- shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
179
179
  }
180
- `}),p.jsx(gI,{toasts:o,onDismiss:N=>l(F=>F.filter(K=>K.id!==N)),onClickToast:N=>{if(N.ideId){const F=ue.find(K=>K.ideId===N.ideId||K.tabKey===N.ideId);F&&(Qe(),m(F.tabKey))}}}),p.jsx("style",{children:`
180
+ `}),p.jsx(bI,{toasts:o,onDismiss:N=>l(j=>j.filter(K=>K.id!==N)),onClickToast:N=>{if(N.ideId){const j=ue.find(K=>K.ideId===N.ideId||K.tabKey===N.ideId);j&&(nt(),m(j.tabKey))}}}),p.jsx("style",{children:`
181
181
  @keyframes toast -in {
182
182
  from { opacity: 0; transform: translateX(40px); }
183
183
  to { opacity: 1; transform: translateX(0); }
184
184
  }
185
- `})]})}function bI(e){return e.split(":")[0]||""}function kI(){var le,k,ge;const{id:e}=ty(),t=ts(),n=hf(),r=n.ides||[],i=n.connectionStates||n.p2pStates||{},{sendCommand:s}=fi(),o=x.useMemo(()=>bI(e||""),[e]),l=x.useMemo(()=>r.find(ie=>ie.id===e),[r,e]),a=(l==null?void 0:l.type)||void 0,c=a?a.charAt(0).toUpperCase()+a.slice(1):"IDE",h=(l==null?void 0:l.activeChat)||null,u=(l==null?void 0:l.agentStreams)||[],d=i[o]||"new",f=x.useMemo(()=>r.find(ie=>ie.id===o||ie.daemonId===o),[r,o]),g=(f==null?void 0:f.machineNickname)||((le=f==null?void 0:f.machine)==null?void 0:le.hostname)||"",m=((ge=(k=l==null?void 0:l.workspaceFolders)==null?void 0:k[0])==null?void 0:ge.name)||"",[w]=Ox(),_=typeof window<"u"&&window.innerWidth<=768,v=w.get("view")||(_?"chat":"split"),[y,E]=x.useState(v),[R,C]=x.useState("ide"),[M,$]=x.useState(""),[G,T]=x.useState(!1),[I,A]=x.useState(null),[P,U]=x.useState(null),[B,j]=x.useState([]),H=x.useMemo(()=>{var ie,z;return{ideId:e||"",daemonId:o,agentName:zh(a||""),agentType:a||"",status:(h==null?void 0:h.status)||"idle",title:(h==null?void 0:h.title)||"",messages:(h==null?void 0:h.messages)||[],ideType:a||"",workspaceName:(l==null?void 0:l.workspaceName)||"",displayPrimary:c,displaySecondary:(l==null?void 0:l.workspaceName)||"",cdpConnected:!0,modalButtons:(ie=h==null?void 0:h.activeModal)==null?void 0:ie.buttons,modalMessage:(z=h==null?void 0:h.activeModal)==null?void 0:z.message,streamSource:"native",tabKey:`ide-${e}`}},[e,o,a,h,l,c]);x.useEffect(()=>o?qr.onScreenshot("ide-page",(z,q)=>{if(z!==o)return;const te=new FileReader;te.onload=()=>A(te.result),te.readAsDataURL(q)}):void 0,[o]),x.useEffect(()=>o?qr.onStatusEvent((z,q)=>{if(z!==o)return;let te="",ue="info";if(q.event==="agent:generating_completed"?(te=`✅ Task completed${q.duration?` (${q.duration}s)`:""}`,ue="success"):(q.event==="agent:waiting_approval"||q.event==="agent:approval_requested")&&(te="⚡ Approval needed",ue="warning"),te){const _e=Date.now();j(Te=>[...Te.slice(-4),{id:_e,message:te,type:ue}]),setTimeout(()=>j(Te=>Te.filter(ye=>ye.id!==_e)),ue==="warning"?1e4:5e3)}}):void 0,[o]),x.useEffect(()=>{const ie=o?qr.get(o):null;!ie||!(d==="connected")||(y!=="chat"?ie.startScreenshots(a):ie.stopScreenshots(a))},[y,d,a,o]);const L=x.useCallback(async(ie,z={})=>{if(!e)throw new Error("No IDE ID");const q={...z};if(!q._targetInstance&&e){const ue=e.split(":");ue.length>=3&&(ue[1]==="ide"||ue[1]==="cli")&&(q._targetInstance=ue.slice(2).join(":"),q._targetType=ue[1])}const te=o?qr.get(o):null;return te!=null&&te.hasCommandChannel?await te.sendCommand(ie,q):te&&te.connectionState!=="failed"&&te.connectionState!=="closed"&&await new Promise(_e=>{const O=Date.now(),Te=()=>{if(te.hasCommandChannel)return _e(!0);if(Date.now()-O>3e3)return _e(!1);setTimeout(Te,200)};Te()})&&te.hasCommandChannel?await te.sendCommand(ie,q):await s(e,ie,q)},[e,o]),W=async()=>{const ie=M.trim();if(!(!ie||!e||G)){$(""),T(!0);try{await L("send_chat",{message:ie,waitForResponse:!0})}catch(z){console.error("[IDE] Send failed:",z)}finally{T(!1)}}},S=async ie=>{if(e)try{const z=await s(e,"screenshot",{width:ie?Math.min(ie,1280):1280});z!=null&&z.success&&(z!=null&&z.base64)&&U(`data:image/jpeg;base64,${z.base64}`)}catch(z){console.error("[IDE] Screenshot failed:",z)}},Q=u.length>0;return e?p.jsxs("div",{className:"ide-page",children:[p.jsxs("header",{className:"ide-header",children:[p.jsxs("div",{className:"ide-header-left",children:[p.jsxs("div",{className:"ide-title",children:[p.jsx("span",{className:"ide-name",children:c}),m&&p.jsx("span",{className:"ide-workspace",children:m}),p.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),p.jsxs("div",{className:"ide-status-pill",children:[p.jsx("span",{className:`ide-dot ${d==="connected"?"online":"connecting"}`}),p.jsx("span",{className:"ide-status-text",children:d==="connected"?"Connected":d==="connecting"?"Connecting":"WS"})]}),g&&p.jsx("span",{className:"ide-machine-label",children:g})]}),p.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(ie=>p.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:y===ie?"1px solid var(--accent-primary)":"none",background:y===ie?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:y===ie?"var(--accent-primary)":void 0},onClick:()=>E(ie),children:ie==="chat"?"💬":ie==="split"?"⊞":"🖥"},ie)),p.jsx("button",{className:"btn btn-primary btn-sm",style:{border:"none",padding:"6px 12px",fontSize:12},onClick:()=>t("/dashboard"),children:"← Back"})]})]}),p.jsxs("div",{className:"ide-content",children:[p.jsxs("div",{className:`ide-chat-panel ${y==="chat"?"full":""} ${y==="remote"?"hidden":""}`,children:[Q&&p.jsxs("div",{className:"ide-chat-tabs",children:[p.jsx("button",{className:`ide-chat-tab ${R==="ide"?"active":""}`,onClick:()=>C("ide"),children:c}),p.jsxs("button",{className:`ide-chat-tab ext ${R==="extensions"?"active":""}`,onClick:()=>C("extensions"),children:["Extensions ",p.jsx("span",{className:"ide-ext-badge",children:u.length})]})]}),R==="extensions"&&Q?p.jsx($4,{ideId:e,agentStreams:u,sendCommand:async(ie,z)=>{try{const q=o?qr.get(o):null;if(q&&d==="connected"){await Promise.race([q.sendCommand(ie,z),new Promise((te,ue)=>setTimeout(()=>ue(new Error("connection timeout")),3e3))]);return}}catch{}await s(e,ie,z)}}):p.jsx(a1,{activeConv:H,ides:r,agentInput:M,setAgentInput:$,handleSendChat:W,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[]})]}),p.jsx("div",{className:`ide-remote-panel ${y==="remote"?"full":""} ${y==="chat"?"hidden":""}`,children:p.jsx(oI,{screenshot:P,isCapturing:!1,onRefresh:S,addLog:()=>{},connState:d,connScreenshot:I,onAction:async(ie,z)=>{const q=o?qr.get(o):null;if(q&&d==="connected")try{return await q.sendInput(ie,z)}catch(te){console.error("[Connection Input] Failed:",te)}return await s(e,"cdp_remote_action",{action:ie,params:z})}})})]}),B.length>0&&p.jsx("div",{className:"ide-toasts",children:B.map(ie=>p.jsx("div",{className:`ide-toast ${ie.type}`,onClick:()=>j(z=>z.filter(q=>q.id!==ie.id)),children:ie.message},ie.id))})]}):p.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function CI(){var N,F,K,Y,J,oe,ae,fe,ce;const{id:e}=ty(),t=ts(),{sendCommand:n}=fi(),r=n,i=hf(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=x.useState([]),[c,h]=x.useState([]),[u,d]=x.useState(0),[f,g]=x.useState(!0),[m,w]=x.useState("debug"),[_,v]=x.useState(null),[y,E]=x.useState([]),[R,C]=x.useState(!1),[M,$]=x.useState(""),[G,T]=x.useState(""),[I,A]=x.useState(""),[P,U]=x.useState(""),[B,j]=x.useState("overview"),[H,L]=x.useState([]),[W,S]=x.useState(!1),[Q,le]=x.useState(!1),[k,ge]=x.useState(""),ie=x.useRef(null);x.useEffect(()=>{if(!e||B!=="logs"||!f)return;const b=async()=>{try{const ve=await n(e,"get_logs",{count:200,minLevel:m,since:u});if(ve!=null&&ve.success&&Array.isArray(ve.logs)&&ve.logs.length>0){h(Ae=>[...Ae,...ve.logs.map(mi=>({timestamp:mi.ts,level:mi.level,message:`[${mi.category}] ${mi.message}`}))].slice(-300));const xe=Math.max(...ve.logs.map(Ae=>Ae.ts));d(xe)}}catch{}};b();const Z=setInterval(b,3e3);return()=>clearInterval(Z)},[e,B,f,u,m]),x.useEffect(()=>{f&&setTimeout(()=>{var b;return(b=ie.current)==null?void 0:b.scrollIntoView({behavior:"smooth"})},100)},[c.length,l.length,f]);const z=s.find(b=>b.id===e&&b.daemonMode),q=z?{id:z.id,hostname:((N=z.machine)==null?void 0:N.hostname)||z.id,platform:((F=z.machine)==null?void 0:F.platform)||"unknown",arch:((K=z.machine)==null?void 0:K.arch)||"",cpus:((Y=z.machine)==null?void 0:Y.cpus)||0,totalMem:((J=z.machine)==null?void 0:J.totalMem)||0,freeMem:((oe=z.machine)==null?void 0:oe.freeMem)||0,loadavg:((ae=z.machine)==null?void 0:ae.loadavg)||[],uptime:((fe=z.machine)==null?void 0:fe.uptime)||0,release:((ce=z.machine)==null?void 0:ce.release)||"",cdpconnected:z.cdpconnected||!1,machineNickname:z.machineNickname||null,p2p:z.p2p||{available:!1,state:"unavailable",peers:0},detectedIdes:z.detectedIdes||[],managedIdeIds:z.managedIdeIds||[],managedCliIds:z.managedCliIds||[]}:null,te=(z==null?void 0:z.availableProviders)||[],ue={};for(const b of te)ue[b.type]=b.icon;const _e=b=>ue[b]||"💻",O=te.filter(b=>b.category==="cli"||b.category==="acp");x.useEffect(()=>{!I&&O.length>0&&A(O[0].type)},[I,O.length]);const Te=s.filter(b=>b.daemonId===e&&!b.daemonMode).filter(b=>!Cm(b)).map(b=>({id:b.id,type:b.type,version:b.version||"",instanceId:b.instanceId||"",status:b.status,workspaceFolders:b.workspaceFolders||[],activeFile:b.activeFile||null,terminals:b.terminals||0,aiAgents:dI(b.aiAgents||b.agents||[]),activeChat:b.activeChat||null,chats:b.chats||[],agentStreams:b.agentStreams||[],cdpconnected:b.cdpconnected||!1,daemonId:e})),ye=s.filter(b=>b.daemonId===e&&Cm(b)).map(b=>{var Z,ve;return{id:b.id,type:b.type,cliName:b.cliName||b.type,status:b.status,workingDir:b.workingDir||((ve=(Z=b.workspaceFolders)==null?void 0:Z[0])==null?void 0:ve.path)||"",activeChat:b.activeChat||null,daemonId:e}}),Qe=((q==null?void 0:q.detectedIdes)||[]).filter(b=>!b.running&&!Te.some(Z=>(Z.type||"").toLowerCase()===(b.type||"").toLowerCase())),Pe=(b,Z)=>{a(ve=>[...ve.slice(-100),{timestamp:Date.now(),level:b,message:Z}]),setTimeout(()=>{var ve;return(ve=ie.current)==null?void 0:ve.scrollIntoView({behavior:"smooth"})},100)},_n=async b=>{if(!(!e||_)){v(b),Pe("info",`Launching ${Bn(b)}...`);try{const Z=await n(e,"launch_ide",{ideType:b,enableCdp:!0});Pe(Z!=null&&Z.success?"info":"error",Z!=null&&Z.success?`${Bn(b)} launched`:`Failed: ${Z==null?void 0:Z.error}`)}catch(Z){Pe("error",`Launch error: ${Z.message}`)}finally{v(null)}}},rn=async(b,Z,ve,xe)=>{if(e){Pe("info",`Launching ${b}${Z?` in ${Z}`:""}${xe?` (model: ${xe})`:""}...`);try{const Ae=ve?ve.split(/\s+/).filter(Boolean):void 0,ze=await n(e,"launch_cli",{cliType:b,dir:Z||void 0,cliArgs:Ae,initialModel:xe||void 0});ze!=null&&ze.success?(Pe("info",`${b} launched`),ze.defaultedToHome&&Pe("info",`📂 No directory specified — running in home directory (${ze.dir||"~"})`)):Pe("error",`Failed: ${ze==null?void 0:ze.error}`)}catch(Ae){Pe("error",`Launch error: ${Ae.message}`)}}},Hn=async(b,Z)=>{if(e&&window.confirm(`Stop ${b}?
186
- This will terminate the CLI process.`))try{await n(e,"stop_cli",{cliType:b,dir:Z}),Pe("info",`${b} stopped`)}catch(ve){Pe("error",`Stop failed: ${ve.message}`)}},ar=async b=>{try{await n(b.id,"restart_session",{ideType:b.type}),Pe("info",`${Bn(b.type)} restart initiated`)}catch(Z){Pe("error",`Restart failed: ${Z.message}`)}},Un=async()=>{if(e)try{const b=await n(e,"detect_ides",{});Pe("info",`Found ${((b==null?void 0:b.result)||[]).length} IDE(s)`)}catch(b){Pe("error",`Detection failed: ${b.message}`)}},Rn=async()=>{if(e){C(!0);try{const b=await n(e,"get_recent_workspaces",{});b!=null&&b.success&&Array.isArray(b==null?void 0:b.result)&&E(b.result)}catch(b){Pe("error",`Failed: ${b.message}`)}finally{C(!1)}}},Kn=async()=>{var b;if(e){S(!0);try{const Z=await r(e,"get_cli_history");Z.success&&((b=Z.result)!=null&&b.history)&&L(Z.result.history)}catch{}S(!1)}},xt=async()=>{if(e)try{await r(e,"set_machine_nickname",{nickname:k}),Pe("info",`Nickname set to "${k||"(cleared)"}"`),le(!1)}catch(b){Pe("error",`Failed: ${b.message}`)}};if(!q)return o?p.jsxs("div",{style:{padding:40,textAlign:"center",color:"#64748b"},children:[p.jsx("h2",{style:{color:"#f1f5f9"},children:"Machine not found"}),p.jsx("p",{style:{marginTop:12},children:"The machine may be offline or not yet connected."}),p.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):p.jsx("div",{style:{padding:40,textAlign:"center",color:"#64748b"},children:p.jsx("p",{children:"⏳ Loading machine..."})});const ne=q.totalMem>0?Math.round((q.totalMem-q.freeMem)/q.totalMem*100):0,pe=q.loadavg[0]||0,D=q.machineNickname||q.hostname,X=[{id:"overview",label:"📊 Overview"},{id:"ides",label:"💻 IDEs",count:Te.length},{id:"clis",label:"🔌 CLIs",count:ye.length},{id:"logs",label:"📋 Logs",count:l.length>0?l.length:void 0}];return p.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[p.jsxs("div",{style:{padding:"16px 24px",borderBottom:"1px solid rgba(255,255,255,0.06)",background:"var(--surface-primary)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[p.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"←"}),p.jsxs("div",{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[Q?p.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[p.jsx("input",{autoFocus:!0,value:k,onChange:b=>ge(b.target.value),onKeyDown:b=>{b.key==="Enter"&&xt(),b.key==="Escape"&&le(!1)},placeholder:"Machine nickname...",style:{padding:"4px 10px",borderRadius:6,border:"1px solid rgba(139,92,246,0.3)",background:"rgba(15,23,42,0.8)",color:"#f1f5f9",fontSize:14,fontWeight:600,width:200}}),p.jsx("button",{onClick:xt,className:"machine-btn",style:{color:"#22c55e",borderColor:"rgba(34,197,94,0.3)"},children:"✓"}),p.jsx("button",{onClick:()=>le(!1),className:"machine-btn",children:"✕"})]}):p.jsx("h1",{style:{fontSize:18,fontWeight:700,color:"#f1f5f9",margin:0,cursor:"pointer"},onClick:()=>{le(!0),ge(q.machineNickname||"")},title:"Click to set nickname",children:D}),p.jsx("span",{className:"status-dot-md online"})]}),p.jsxs("div",{style:{fontSize:11,color:"#64748b",marginTop:2,display:"flex",gap:8,alignItems:"center"},children:[p.jsxs("span",{children:[q.platform," · ",q.arch," · ",q.cpus," cores"]}),q.p2p.available&&p.jsxs("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:9,fontWeight:600,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&&p.jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:9,fontWeight:600,background:"rgba(34,197,94,0.08)",color:"#22c55e"},children:"CDP ●"}),q.machineNickname&&p.jsxs("span",{style:{color:"#475569"},children:["(",q.hostname,")"]})]})]})]}),p.jsx("button",{onClick:Un,className:"machine-btn-primary",title:"Re-detect installed IDEs",children:"🔍 Scan IDEs"})]}),p.jsx("div",{className:"machine-tabs",children:X.map(b=>p.jsxs("button",{onClick:()=>j(b.id),className:`machine-tab${B===b.id?" active":""}`,children:[b.label,b.count!==void 0&&p.jsx("span",{className:"tab-count",children:b.count})]},b.id))})]}),p.jsxs("div",{className:"page-content",children:[B==="overview"&&p.jsxs("div",{children:[p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:10,marginBottom:20},children:[p.jsx(xm,{icon:"⏱",label:"Uptime",value:hI(q.uptime)}),p.jsx(xm,{icon:"💻",label:"IDEs",value:`${Te.length}`,sub:`${ye.length} CLIs`})]}),p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,marginBottom:20,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsx("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:12},children:"Resource Usage"}),p.jsxs("div",{style:{display:"flex",gap:24},children:[p.jsx(bm,{value:Math.min(Math.round(pe/q.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${pe.toFixed(2)} avg / ${q.cpus} cores`}),p.jsx(bm,{value:ne,max:100,label:"Memory",color:"#3b82f6",detail:`${km(q.totalMem-q.freeMem)} / ${km(q.totalMem)}`})]})]}),p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:12},children:[p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"IDEs"}),p.jsx("button",{onClick:()=>j("ides"),className:"machine-btn",style:{fontSize:10},children:"View All →"})]}),Te.length===0?p.jsx("div",{style:{fontSize:12,color:"#475569",fontStyle:"italic"},children:"No IDEs running"}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:Te.map(b=>{var ve,xe,Ae;const Z=(b.agentStreams||[]).some(ze=>ze.status==="generating"||ze.status==="streaming")||((ve=b.activeChat)==null?void 0:ve.status)==="generating";return p.jsxs("div",{onClick:()=>t(`/ide/${b.id}`),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 10px",borderRadius:8,cursor:"pointer",transition:"background 0.15s",background:Z?"rgba(249,115,22,0.04)":"rgba(255,255,255,0.02)",border:Z?"1px solid rgba(249,115,22,0.1)":"1px solid transparent"},children:[p.jsx("span",{children:_e(b.type)}),p.jsx("span",{style:{fontSize:12,color:"#e2e8f0",fontWeight:500},children:Bn(b.type)}),p.jsx("span",{style:{fontSize:10,color:"#475569",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((Ae=(xe=b.workspaceFolders)==null?void 0:xe[0])==null?void 0:Ae.name)||""}),Z&&p.jsx("span",{style:{fontSize:10,color:"#fb923c",fontWeight:600,marginLeft:"auto"},children:"⚡ Working"}),p.jsx("span",{style:{marginLeft:Z?6:"auto",width:6,height:6,borderRadius:"50%",background:Z?"#fb923c":"#22c55e",boxShadow:Z?"0 0 8px rgba(249,115,22,0.4)":"none",animation:Z?"pulse-dot 1.5s infinite":"none"}})]},b.id)})})]}),p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"CLIs"}),p.jsx("button",{onClick:()=>j("clis"),className:"machine-btn",style:{fontSize:10},children:"View All →"})]}),ye.length===0?p.jsx("div",{style:{fontSize:12,color:"#475569",fontStyle:"italic"},children:"No CLIs running"}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:ye.map(b=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 10px",borderRadius:8,background:"rgba(255,255,255,0.02)"},children:[p.jsx("span",{children:_e(b.type)}),p.jsx("span",{style:{fontSize:12,color:"#e2e8f0",fontWeight:500},children:b.cliName}),p.jsx("span",{style:{fontSize:10,color:"#475569",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.workingDir.split("/").pop()}),p.jsx("span",{style:{marginLeft:"auto",width:6,height:6,borderRadius:"50%",background:b.status==="stopped"?"#ef4444":"#22c55e"}})]},b.id))})]})]}),q.detectedIdes.length>0&&p.jsxs("div",{style:{marginTop:16,padding:"14px 18px",borderRadius:12,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsx("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:8},children:"Detected on this machine"}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:q.detectedIdes.map(b=>p.jsxs("div",{style:{padding:"4px 10px",borderRadius:6,fontSize:11,background:b.running?"rgba(34,197,94,0.06)":"rgba(255,255,255,0.02)",border:`1px solid ${b.running?"rgba(34,197,94,0.12)":"rgba(255,255,255,0.04)"}`,color:b.running?"#86efac":"#64748b",display:"flex",alignItems:"center",gap:4},children:[p.jsx("span",{children:_e(b.type)}),b.name||b.type,p.jsx("span",{style:{width:4,height:4,borderRadius:"50%",background:b.running?"#22c55e":"#475569"}})]},b.type))})]})]}),B==="ides"&&p.jsxs("div",{children:[p.jsxs("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:["Running (",Te.length,")"]}),Te.length===0?p.jsx("div",{style:{padding:"40px 20px",textAlign:"center",borderRadius:12,background:"rgba(15,23,42,0.4)",border:"1px dashed rgba(255,255,255,0.06)",color:"#475569",fontSize:13,marginBottom:20},children:"No IDEs currently running. Launch one below."}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10,marginBottom:20},children:Te.map(b=>{var Z,ve;return p.jsxs("div",{style:{padding:"14px 18px",borderRadius:12,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx("span",{style:{fontSize:18},children:_e(b.type)}),p.jsx("span",{style:{fontWeight:600,fontSize:14,color:"#f1f5f9"},children:Bn(b.type)}),b.version&&p.jsxs("span",{style:{fontSize:10,color:"#475569"},children:["v",b.version]}),p.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#22c55e",boxShadow:"0 0 6px rgba(34,197,94,0.3)"}})]}),p.jsxs("div",{style:{display:"flex",gap:6},children:[p.jsx("button",{onClick:()=>t(`/ide/${b.id}`),className:"machine-btn",children:"🖥 Control"}),p.jsx("button",{onClick:()=>ar(b),className:"machine-btn",style:{color:"#f59e0b",borderColor:"rgba(245,158,11,0.3)"},children:"↻ Restart"})]})]}),p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:6,fontSize:12,color:"#94a3b8"},children:[p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"Workspace:"})," ",((Z=b.workspaceFolders)==null?void 0:Z.map(xe=>xe.name).join(", "))||"—"]}),p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"File:"})," ",((ve=b.activeFile)==null?void 0:ve.split("/").pop())||"—"]}),p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"Terminals:"})," ",b.terminals]}),p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"CDP:"})," ",b.cdpconnected?"● connected":"○ Off"]})]}),b.aiAgents.length>0&&p.jsx("div",{style:{display:"flex",gap:4,marginTop:8,flexWrap:"wrap"},children:b.aiAgents.map(xe=>p.jsxs("span",{style:{padding:"2px 8px",borderRadius:6,fontSize:10,background:xe.status==="generating"||xe.status==="streaming"?"rgba(249,115,22,0.08)":"rgba(99,102,241,0.06)",color:xe.status==="generating"||xe.status==="streaming"?"#fb923c":"#818cf8"},children:[xe.name," · ",xe.status]},xe.id))})]},b.id)})}),p.jsxs("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:["Available to Launch (",Qe.length,")"]}),p.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[Qe.map(b=>p.jsxs("button",{onClick:()=>_n(b.type||b.id||""),disabled:!!_,className:"machine-btn-primary",style:{opacity:_&&_!==b.type?.4:1,display:"flex",alignItems:"center",gap:6},children:[p.jsx("span",{children:_e(b.type)}),_===b.type?"⏳ Launching...":`▶ ${b.name||Bn(b.type)}`]},b.type)),Qe.length===0&&p.jsxs("div",{style:{fontSize:12,color:"#475569",fontStyle:"italic"},children:["All detected IDEs are running, or none detected.",p.jsx("button",{onClick:Un,className:"machine-btn",style:{marginLeft:8},children:"🔍 Scan"})]})]})]}),B==="clis"&&p.jsxs("div",{children:[p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,marginBottom:20,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(139,92,246,0.12)"},children:[p.jsx("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:"Launch New CLI"}),p.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[p.jsx("select",{value:I,onChange:b=>A(b.target.value),className:"machine-input",children:O.length>0?O.map(b=>p.jsxs("option",{value:b.type,children:[b.icon," ",b.displayName]},b.type)):p.jsx("option",{value:"",disabled:!0,children:"No providers available"})}),p.jsx("input",{type:"text",placeholder:"Working directory...",value:M,onChange:b=>$(b.target.value),className:"machine-input",style:{flex:1,minWidth:200}}),p.jsx("input",{type:"text",placeholder:"Args (optional)",value:G,onChange:b=>T(b.target.value),className:"machine-input",style:{minWidth:150}}),(()=>{const b=O.find(Z=>Z.type===I);return(b==null?void 0:b.category)==="acp"?p.jsx("input",{type:"text",placeholder:"Model (default)",value:P,onChange:Z=>U(Z.target.value),className:"machine-input",style:{minWidth:120}}):null})(),p.jsx("button",{onClick:()=>rn(I,M,G||void 0,P||void 0),className:"machine-btn-primary",children:"▶ Launch"})]})]}),p.jsxs("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:["Running (",ye.length,")"]}),ye.length===0?p.jsx("div",{style:{padding:"30px 20px",textAlign:"center",borderRadius:12,background:"rgba(15,23,42,0.4)",border:"1px dashed rgba(255,255,255,0.06)",color:"#475569",fontSize:13,marginBottom:20},children:"No CLIs running"}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:20},children:ye.map(b=>p.jsxs("div",{style:{padding:"12px 16px",borderRadius:10,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[p.jsx("span",{style:{fontSize:18},children:_e(b.type)}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:600,fontSize:13,color:"#f1f5f9"},children:b.cliName}),p.jsx("div",{style:{fontSize:11,color:"#64748b"},children:b.workingDir})]})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx("span",{style:{padding:"2px 8px",borderRadius:6,fontSize:10,fontWeight:600,background:b.status==="stopped"?"rgba(239,68,68,0.08)":"rgba(34,197,94,0.08)",color:b.status==="stopped"?"#ef4444":"#22c55e"},children:b.status}),b.status==="stopped"?p.jsx("button",{onClick:()=>rn(b.type,b.workingDir),className:"machine-btn",style:{color:"#22c55e",borderColor:"rgba(34,197,94,0.3)"},children:"▶"}):p.jsx("button",{onClick:()=>Hn(b.type,b.workingDir),className:"machine-btn",style:{color:"#ef4444",borderColor:"rgba(239,68,68,0.3)"},children:"■"})]})]},b.id))}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"History"}),p.jsx("button",{onClick:Kn,disabled:W,className:"machine-btn",children:W?"⏳":"↻ Load"})]}),H.length>0&&p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,maxHeight:200,overflowY:"auto"},children:H.map((b,Z)=>{var ve,xe;return p.jsxs("div",{onClick:()=>{A(b.cliType),$(b.dir),T((b.cliArgs||[]).join(" "))},style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",borderRadius:6,cursor:"pointer",background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.04)",fontSize:12,transition:"background 0.15s"},onMouseEnter:Ae=>Ae.currentTarget.style.background="rgba(255,255,255,0.06)",onMouseLeave:Ae=>Ae.currentTarget.style.background="rgba(255,255,255,0.02)",children:[p.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",color:"#94a3b8"},children:[p.jsx("span",{children:_e(b.cliType)}),p.jsx("span",{children:((ve=b.dir)==null?void 0:ve.split("/").filter(Boolean).pop())||"root"}),((xe=b.cliArgs)==null?void 0:xe.length)>0&&p.jsx("span",{style:{color:"#475569",fontSize:10},children:b.cliArgs.join(" ")})]}),p.jsx("span",{style:{color:"#475569",fontSize:10},children:b.timestamp?new Date(b.timestamp).toLocaleDateString():""})]},Z)})}),p.jsxs("div",{style:{marginTop:20},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"Recent Workspaces"}),p.jsx("button",{onClick:Rn,disabled:R,className:"machine-btn",children:R?"⏳":"↻ Load"})]}),y.length>0&&p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:y.map((b,Z)=>p.jsxs("button",{onClick:()=>$(b),className:"machine-btn",style:{maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b,children:["📂 ",b.split("/").filter(Boolean).pop()||b]},Z))})]})]}),B==="logs"&&p.jsxs("div",{children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[p.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginRight:8},children:"Level"}),["debug","info","warn","error"].map(b=>p.jsx("button",{onClick:()=>{w(b),h([]),d(0)},className:"machine-btn",style:{fontSize:10,padding:"2px 8px",background:m===b?"rgba(139,92,246,0.15)":void 0,borderColor:m===b?"rgba(139,92,246,0.4)":void 0,color:m===b?"#a78bfa":void 0},children:b.toUpperCase()},b))]}),p.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[p.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[c.length," entries"]}),p.jsx("button",{onClick:()=>g(!f),className:"machine-btn",style:{color:f?"#22c55e":"#64748b",borderColor:f?"rgba(34,197,94,0.3)":void 0},children:f?"⏸ Pause":"▶ Resume"}),p.jsx("button",{onClick:()=>{h([]),d(0)},className:"machine-btn",children:"Clear"})]})]}),p.jsxs("div",{style:{background:"rgba(15, 23, 42, 0.6)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:12,padding:12,minHeight:200,maxHeight:500,overflowY:"auto",fontFamily:"'JetBrains Mono', monospace",fontSize:11,lineHeight:1.6},children:[c.length===0&&p.jsx("div",{style:{padding:40,textAlign:"center",color:"#475569"},children:"Loading daemon logs..."}),c.map((b,Z)=>p.jsxs("div",{style:{display:"flex",gap:8,padding:"2px 0",color:b.level==="error"?"#ef4444":b.level==="warn"?"#f59e0b":b.level==="debug"?"#64748b":"#94a3b8"},children:[p.jsx("span",{style:{color:"#475569",minWidth:75,flexShrink:0},children:new Date(b.timestamp).toLocaleTimeString()}),p.jsx("span",{style:{fontWeight:600,minWidth:32,flexShrink:0,fontSize:9,color:b.level==="error"?"#ef4444":b.level==="warn"?"#f59e0b":b.level==="debug"?"#475569":"#8b5cf6"},children:b.level==="error"?"ERR":b.level==="warn"?"WRN":b.level==="debug"?"DBG":"INF"}),p.jsx("span",{children:b.message})]},Z)),p.jsx("div",{ref:ie})]})]})]})]})}function EI(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,r=new URLSearchParams(window.location.search).get("token");return r?`${t}?token=${encodeURIComponent(r)}`:t}const Tm=EI(),Rm=3e3,TI=3e4;let Xn=null,RI=0;const ha=new Map,Oh=new Set;let ks=null;async function Il(e,t,n){const r=Xn;if(r&&r.readyState===WebSocket.OPEN){const s=`req_${++RI}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{ha.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);ha.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),r.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:n||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:n||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class II{constructor(t){os(this,"daemonId");os(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(Xn==null?void 0:Xn.readyState)===WebSocket.OPEN}get connectionState(){return(Xn==null?void 0:Xn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,n){return Il(this.daemonId,t,n)}async sendInput(t,n){return Il(this.daemonId,"cdp_remote_action",{action:t,params:n})}startScreenshots(t){if(this.screenshotIdeType=t||null,ks)return;const n=async()=>{if(this.hasCommandChannel)try{const r=await Il(this.daemonId,"screenshot",{width:1280});if(r!=null&&r.success&&(r!=null&&r.base64)){const i=await fetch(`data:image/jpeg;base64,${r.base64}`).then(s=>s.blob());Oh.forEach(s=>s(this.daemonId,i))}}catch{}};n(),ks=setInterval(n,2e3)}stopScreenshots(t){ks&&(clearInterval(ks),ks=null)}}let $r=null;function LI(e){(!$r||$r.daemonId!==e)&&($r=new II(e));try{const{connectionManager:t}=require("@adhdev/web-core"),n=t.get.bind(t);t.get=r=>r===e?$r:n(r),t.getState=r=>r===e&&($r==null?void 0:$r.connectionState)||"disconnected",t.onScreenshot=r=>(Oh.add(r),()=>{Oh.delete(r)})}catch{}}function PI({children:e}){const t=x.useRef(Lp()),n=Lp();t.current=n;const[,r]=x.useState("disconnected"),i=x.useRef(null),s=x.useRef(),o=x.useRef(Rm),l=x.useRef(!0);return x.useEffect(()=>{l.current=!0;function a(){var u,d;if(!l.current||((u=i.current)==null?void 0:u.readyState)===WebSocket.OPEN||((d=i.current)==null?void 0:d.readyState)===WebSocket.CONNECTING)return;r("connecting"),console.log(`[Standalone WS] Connecting to ${Tm}...`);let h;try{h=new WebSocket(Tm)}catch(f){console.error("[Standalone WS] Failed to create WebSocket:",f),c();return}i.current=h,h.onopen=()=>{if(!l.current){h.close();return}r("connected"),o.current=Rm,console.log("[Standalone WS] Connected")},Xn=h,h.onmessage=f=>{var g;try{const m=JSON.parse(f.data);if((m.type==="command_result"||m.type==="error")&&m.requestId){const w=ha.get(m.requestId);w&&(ha.delete(m.requestId),m.type==="error"?w.reject(new Error(((g=m.data)==null?void 0:g.message)||"Command failed")):w.resolve(m.data));return}if(m.type==="status"||m.type==="initial_state"){const w=m.data;if(!w)return;const{injectEntries:_,markLoaded:v}=t.current,y=[],E=w.id||"standalone";LI(E),y.push({id:E,type:"adhdev-daemon",status:"online",daemonMode:!0,machine:{hostname:w.hostname,platform:w.platform,...w.system||{}},system:w.system||null,timestamp:w.timestamp,cdpConnected:w.cdpConnected,detectedIdes:w.detectedIdes||[],availableProviders:w.availableProviders||[],managedIdeIds:(w.ides||[]).map(R=>R.id),managedCliIds:(w.clis||[]).map(R=>R.id)});for(const R of w.ides||[])y.push({...R,daemonId:w.id||"standalone",status:R.cdpConnected?"online":"detected"});for(const R of w.clis||[])y.push({...R,daemonId:w.id||"standalone",status:R.isRunning?"running":"stopped"});y.length>0&&_(y),v()}}catch(m){console.error("[Standalone WS] Parse error:",m)}},h.onclose=()=>{l.current&&(r("disconnected"),i.current=null,c())},h.onerror=f=>{console.warn("[Standalone WS] Error, will reconnect:",f)}}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,TI),a()},h)}return a(),()=>{l.current=!1,clearTimeout(s.current),i.current&&(i.current.onclose=null,i.current.close(),i.current=null,Xn=null)}},[]),p.jsx(p.Fragment,{children:e})}function DI({children:e}){return p.jsx(Fx,{children:p.jsx(PI,{children:e})})}const MI=[{id:"dashboard",path:"/dashboard",icon:"🌊",label:"Dashboard"},{id:"machine",path:"/machine",icon:"🐇",label:"Burrow"}];function AI({children:e}){const t=ts(),n=Co(),[r,i]=x.useState(!1),[s,o]=x.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),l=c=>{t(c),i(!1)},a=()=>{o(c=>{const h=!c;try{localStorage.setItem("sidebar-collapsed",h?"1":"0")}catch{}return h})};return p.jsxs("div",{className:`app-layout${r?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[p.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[p.jsx("span",{className:"mobile-menu-icon"}),p.jsx("span",{className:"mobile-menu-icon"}),p.jsx("span",{className:"mobile-menu-icon"})]}),r&&p.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:c=>c.key==="Escape"&&i(!1)}),p.jsxs("aside",{className:`sidebar ${r?"sidebar-open":""}`,children:[p.jsxs("div",{className:"sidebar-header",children:[p.jsxs("div",{className:"sidebar-logo",style:{justifyContent:s?"center":void 0,gap:s?0:void 0},children:[p.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",style:{width:28,height:28}}),!s&&p.jsx("span",{children:"ADHDev"})]}),p.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),p.jsx("nav",{className:"sidebar-nav",children:MI.map(c=>p.jsxs("div",{className:`nav-item${n.pathname===c.path?" active":""}`,id:`nav-${c.id}`,onClick:()=>l(c.path),title:s?c.label:void 0,style:{cursor:"pointer",justifyContent:s?"center":void 0,padding:s?"10px 0":void 0},children:[p.jsx("span",{className:"nav-icon",children:c.icon}),!s&&c.label]},c.id))}),p.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle)",paddingTop:16,marginTop:"auto"},children:[!s&&p.jsx("div",{style:{padding:"8px 12px",fontSize:12,color:"var(--text-muted)"},children:"Selfhost Mode"}),p.jsxs("div",{className:"nav-item",onClick:a,title:s?"Expand sidebar":"Collapse sidebar",style:{cursor:"pointer",justifyContent:s?"center":void 0,padding:s?"10px 0":void 0},children:[p.jsx("span",{className:"nav-icon",style:{fontSize:16},children:s?"›":"‹"}),!s&&p.jsx("span",{style:{fontSize:12},children:"Collapse"})]})]})]}),p.jsx("main",{className:"main-content",style:{position:"relative"},children:p.jsx("div",{className:"main-content-inner",children:e})})]})}function Im(){const{ides:e}=ly(),t=e.find(n=>{var r;return n.daemonMode||((r=n.id)==null?void 0:r.startsWith("standalone"))});return t?p.jsx(yl,{to:`/machines/${t.id}`,replace:!0}):e.length>0?p.jsx(yl,{to:`/machines/${e[0].id}`,replace:!0}):p.jsx(yl,{to:"/dashboard",replace:!0})}function BI(){return p.jsx(zx,{children:p.jsx(DI,{children:p.jsx(Ux,{value:{sendCommand:Il,sendData:()=>!1},children:p.jsx(AI,{children:p.jsxs(Mx,{children:[p.jsx(Ur,{path:"/dashboard",element:p.jsx(xI,{})}),p.jsx(Ur,{path:"/ide/:id",element:p.jsx(kI,{})}),p.jsx(Ur,{path:"/machine",element:p.jsx(Im,{})}),p.jsx(Ur,{path:"/machines/:id",element:p.jsx(CI,{})}),p.jsx(Ur,{path:"/machines",element:p.jsx(Im,{})}),p.jsx(Ur,{path:"*",element:p.jsx(yl,{to:"/dashboard",replace:!0})})]})})})})})}Kv(document.getElementById("root")).render(p.jsx(x.StrictMode,{children:p.jsx(BI,{})}));
185
+ `})]})}function DI(e){return e.split(":")[0]||""}function MI(){var le,k,ge;const{id:e}=dy(),t=cs(),n=xf(),r=n.ides||[],i=n.connectionStates||n.p2pStates||{},{sendCommand:s}=wi(),o=x.useMemo(()=>DI(e||""),[e]),l=x.useMemo(()=>r.find(te=>te.id===e),[r,e]),a=(l==null?void 0:l.type)||void 0,c=a?a.charAt(0).toUpperCase()+a.slice(1):"IDE",h=(l==null?void 0:l.activeChat)||null,u=(l==null?void 0:l.agentStreams)||[],d=i[o]||"new",f=x.useMemo(()=>r.find(te=>te.id===o||te.daemonId===o),[r,o]),g=(f==null?void 0:f.machineNickname)||((le=f==null?void 0:f.machine)==null?void 0:le.hostname)||"",m=((ge=(k=l==null?void 0:l.workspaceFolders)==null?void 0:k[0])==null?void 0:ge.name)||"",[w]=Vx(),_=typeof window<"u"&&window.innerWidth<=768,v=w.get("view")||(_?"chat":"split"),[y,E]=x.useState(v),[R,C]=x.useState("ide"),[M,$]=x.useState(""),[G,T]=x.useState(!1),[P,B]=x.useState(null),[D,U]=x.useState(null),[A,O]=x.useState([]),H=x.useMemo(()=>{var te,F;return{ideId:e||"",daemonId:o,agentName:Yh(a||""),agentType:a||"",status:(h==null?void 0:h.status)||"idle",title:(h==null?void 0:h.title)||"",messages:(h==null?void 0:h.messages)||[],ideType:a||"",workspaceName:(l==null?void 0:l.workspaceName)||"",displayPrimary:c,displaySecondary:(l==null?void 0:l.workspaceName)||"",cdpConnected:!0,modalButtons:(te=h==null?void 0:h.activeModal)==null?void 0:te.buttons,modalMessage:(F=h==null?void 0:h.activeModal)==null?void 0:F.message,streamSource:"native",tabKey:`ide-${e}`}},[e,o,a,h,l,c]);x.useEffect(()=>o?ti.onScreenshot("ide-page",(F,ie)=>{if(F!==o)return;const ne=new FileReader;ne.onload=()=>B(ne.result),ne.readAsDataURL(ie)}):void 0,[o]),x.useEffect(()=>o?ti.onStatusEvent((F,ie)=>{if(F!==o)return;let ne="",ue="info";if(ie.event==="agent:generating_completed"?(ne=`✅ Task completed${ie.duration?` (${ie.duration}s)`:""}`,ue="success"):(ie.event==="agent:waiting_approval"||ie.event==="agent:approval_requested")&&(ne="⚡ Approval needed",ue="warning"),ne){const Se=Date.now();O(Be=>[...Be.slice(-4),{id:Se,message:ne,type:ue}]),setTimeout(()=>O(Be=>Be.filter(xe=>xe.id!==Se)),ue==="warning"?1e4:5e3)}}):void 0,[o]),x.useEffect(()=>{const te=o?ti.get(o):null;!te||!(d==="connected")||(y!=="chat"?te.startScreenshots(a):te.stopScreenshots(a))},[y,d,a,o]);const L=x.useCallback(async(te,F={})=>{if(!e)throw new Error("No IDE ID");const ie={...F};if(!ie._targetInstance&&e){const ue=e.split(":");ue.length>=3&&(ue[1]==="ide"||ue[1]==="cli")&&(ie._targetInstance=ue.slice(2).join(":"),ie._targetType=ue[1])}const ne=o?ti.get(o):null;return ne!=null&&ne.hasCommandChannel?await ne.sendCommand(te,ie):ne&&ne.connectionState!=="failed"&&ne.connectionState!=="closed"&&await new Promise(Se=>{const z=Date.now(),Be=()=>{if(ne.hasCommandChannel)return Se(!0);if(Date.now()-z>3e3)return Se(!1);setTimeout(Be,200)};Be()})&&ne.hasCommandChannel?await ne.sendCommand(te,ie):await s(e,te,ie)},[e,o]),W=async()=>{const te=M.trim();if(!(!te||!e||G)){$(""),T(!0);try{await L("send_chat",{message:te,waitForResponse:!0})}catch(F){console.error("[IDE] Send failed:",F)}finally{T(!1)}}},S=async te=>{if(e)try{const F=await s(e,"screenshot",{width:te?Math.min(te,1280):1280});F!=null&&F.success&&(F!=null&&F.base64)&&U(`data:image/jpeg;base64,${F.base64}`)}catch(F){console.error("[IDE] Screenshot failed:",F)}},Q=u.length>0;return e?p.jsxs("div",{className:"ide-page",children:[p.jsxs("header",{className:"ide-header",children:[p.jsxs("div",{className:"ide-header-left",children:[p.jsxs("div",{className:"ide-title",children:[p.jsx("span",{className:"ide-name",children:c}),m&&p.jsx("span",{className:"ide-workspace",children:m}),p.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),p.jsxs("div",{className:"ide-status-pill",children:[p.jsx("span",{className:`ide-dot ${d==="connected"?"online":"connecting"}`}),p.jsx("span",{className:"ide-status-text",children:d==="connected"?"Connected":d==="connecting"?"Connecting":"WS"})]}),g&&p.jsx("span",{className:"ide-machine-label",children:g})]}),p.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(te=>p.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:y===te?"1px solid var(--accent-primary)":"none",background:y===te?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:y===te?"var(--accent-primary)":void 0},onClick:()=>E(te),children:te==="chat"?"💬":te==="split"?"⊞":"🖥"},te)),p.jsx("button",{className:"btn btn-primary btn-sm",style:{border:"none",padding:"6px 12px",fontSize:12},onClick:()=>t("/dashboard"),children:"← Back"})]})]}),p.jsxs("div",{className:"ide-content",children:[p.jsxs("div",{className:`ide-chat-panel ${y==="chat"?"full":""} ${y==="remote"?"hidden":""}`,children:[Q&&p.jsxs("div",{className:"ide-chat-tabs",children:[p.jsx("button",{className:`ide-chat-tab ${R==="ide"?"active":""}`,onClick:()=>C("ide"),children:c}),p.jsxs("button",{className:`ide-chat-tab ext ${R==="extensions"?"active":""}`,onClick:()=>C("extensions"),children:["Extensions ",p.jsx("span",{className:"ide-ext-badge",children:u.length})]})]}),R==="extensions"&&Q?p.jsx(X4,{ideId:e,agentStreams:u,sendCommand:async(te,F)=>{try{const ie=o?ti.get(o):null;if(ie&&d==="connected"){await Promise.race([ie.sendCommand(te,F),new Promise((ne,ue)=>setTimeout(()=>ue(new Error("connection timeout")),3e3))]);return}}catch{}await s(e,te,F)}}):p.jsx(y1,{activeConv:H,ides:r,agentInput:M,setAgentInput:$,handleSendChat:W,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[]})]}),p.jsx("div",{className:`ide-remote-panel ${y==="remote"?"full":""} ${y==="chat"?"hidden":""}`,children:p.jsx(pI,{screenshot:D,isCapturing:!1,onRefresh:S,addLog:()=>{},connState:d,connScreenshot:P,onAction:async(te,F)=>{const ie=o?ti.get(o):null;if(ie&&d==="connected")try{return await ie.sendInput(te,F)}catch(ne){console.error("[Connection Input] Failed:",ne)}return await s(e,"cdp_remote_action",{action:te,params:F})}})})]}),A.length>0&&p.jsx("div",{className:"ide-toasts",children:A.map(te=>p.jsx("div",{className:`ide-toast ${te.type}`,onClick:()=>O(F=>F.filter(ie=>ie.id!==te.id)),children:te.message},te.id))})]}):p.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function AI(){var Qe,rt,Xt,Ot,$o,Wo,Ho,Uo,Vr;const{id:e}=dy(),t=cs(),{sendCommand:n}=wi(),r=n,i=xf(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=x.useState([]),[c,h]=x.useState([]),[u,d]=x.useState(0),[f,g]=x.useState(!0),[m,w]=x.useState("debug"),[_,v]=x.useState(null),[y,E]=x.useState([]),[R,C]=x.useState(!1),[M,$]=x.useState(""),[G,T]=x.useState(""),[P,B]=x.useState(""),[D,U]=x.useState(""),[A,O]=x.useState("overview"),[H,L]=x.useState([]),[W,S]=x.useState(!1),[Q,le]=x.useState(!1),[k,ge]=x.useState(""),[te,F]=x.useState([]),[ie,ne]=x.useState(!1),[ue,Se]=x.useState(null),[z,Be]=x.useState("all"),xe=x.useRef(null),nt=x.useRef(!1);x.useEffect(()=>{if(!e||A!=="logs"||!f)return;const b=async()=>{try{const _e=await n(e,"get_logs",{count:200,minLevel:m,since:u}),ke=(_e==null?void 0:_e.result)||_e;if(_e!=null&&_e.success&&Array.isArray(ke==null?void 0:ke.logs)&&ke.logs.length>0){h(Ze=>[...Ze,...ke.logs.map(ki=>({timestamp:ki.ts,level:ki.level,message:`[${ki.category}] ${ki.message}`}))].slice(-300));const je=Math.max(...ke.logs.map(Ze=>Ze.ts));d(je)}}catch{}};b();const X=setInterval(b,3e3);return()=>clearInterval(X)},[e,A,f,u,m]),x.useEffect(()=>{if(f&&c.length>0){const b=nt.current?"smooth":"instant";setTimeout(()=>{var X;(X=xe.current)==null||X.scrollIntoView({behavior:b}),nt.current=!0},50)}},[c.length,l.length,f]),x.useEffect(()=>{A!=="logs"&&(nt.current=!1)},[A]);const zt=async()=>{var b;if(e){ne(!0);try{const X=await n(e,"get_provider_settings",{}),_e=(X==null?void 0:X.result)||X;if(X!=null&&X.success&&(_e!=null&&_e.settings)){const ke=[];for(const[je,Ze]of Object.entries(_e.settings)){const mt=On.find(ki=>ki.type===je);ke.push({type:je,displayName:(mt==null?void 0:mt.displayName)||je,icon:(mt==null?void 0:mt.icon)||"🔧",category:(mt==null?void 0:mt.category)||"unknown",schema:Ze,values:((b=_e.values)==null?void 0:b[je])||{}})}ke.sort((je,Ze)=>je.category.localeCompare(Ze.category)||je.displayName.localeCompare(Ze.displayName)),F(ke)}}catch{}ne(!1)}};x.useEffect(()=>{A==="providers"&&te.length===0&&zt()},[A]);const qt=async(b,X,_e)=>{Se(`${b}.${X}`),F(ke=>ke.map(je=>je.type===b?{...je,values:{...je.values,[X]:_e}}:je));try{const ke=await n(e,"set_provider_setting",{providerType:b,key:X,value:_e});ke!=null&&ke.success||zt()}catch{zt()}Se(null)},De=s.find(b=>b.id===e&&b.daemonMode),Ce=De?{id:De.id,hostname:((Qe=De.machine)==null?void 0:Qe.hostname)||De.id,platform:((rt=De.machine)==null?void 0:rt.platform)||"unknown",arch:((Xt=De.machine)==null?void 0:Xt.arch)||"",cpus:((Ot=De.machine)==null?void 0:Ot.cpus)||0,totalMem:(($o=De.machine)==null?void 0:$o.totalMem)||0,freeMem:((Wo=De.machine)==null?void 0:Wo.freeMem)||0,loadavg:((Ho=De.machine)==null?void 0:Ho.loadavg)||[],uptime:((Uo=De.machine)==null?void 0:Uo.uptime)||0,release:((Vr=De.machine)==null?void 0:Vr.release)||"",cdpconnected:De.cdpconnected||!1,machineNickname:De.machineNickname||null,p2p:De.p2p||{available:!1,state:"unavailable",peers:0},detectedIdes:De.detectedIdes||[],managedIdeIds:De.managedIdeIds||[],managedCliIds:De.managedCliIds||[]}:null,On=(De==null?void 0:De.availableProviders)||[],Jn={};for(const b of On)Jn[b.type]=b.icon;const It=b=>Jn[b]||"💻",Yt=On.filter(b=>b.category==="cli"||b.category==="acp");x.useEffect(()=>{!P&&Yt.length>0&&B(Yt[0].type)},[P,Yt.length]);const Ge=s.filter(b=>b.daemonId===e&&!b.daemonMode).filter(b=>!Nm(b)).map(b=>({id:b.id,type:b.type,version:b.version||"",instanceId:b.instanceId||"",status:b.status,workspaceFolders:b.workspaceFolders||[],activeFile:b.activeFile||null,terminals:b.terminals||0,aiAgents:SI(b.aiAgents||b.agents||[]),activeChat:b.activeChat||null,chats:b.chats||[],agentStreams:b.agentStreams||[],cdpconnected:b.cdpconnected||!1,daemonId:e})),Z=s.filter(b=>b.daemonId===e&&Nm(b)).map(b=>{var X,_e;return{id:b.id,type:b.type,cliName:b.cliName||b.type,status:b.status,workingDir:b.workingDir||((_e=(X=b.workspaceFolders)==null?void 0:X[0])==null?void 0:_e.path)||"",activeChat:b.activeChat||null,daemonId:e}}),pe=((Ce==null?void 0:Ce.detectedIdes)||[]).filter(b=>!b.running&&!Ge.some(X=>(X.type||"").toLowerCase()===(b.type||"").toLowerCase())),I=(b,X)=>{a(_e=>[..._e.slice(-100),{timestamp:Date.now(),level:b,message:X}]),setTimeout(()=>{var _e;return(_e=xe.current)==null?void 0:_e.scrollIntoView({behavior:"smooth"})},100)},Y=async b=>{if(!(!e||_)){v(b),I("info",`Launching ${Kn(b)}...`);try{const X=await n(e,"launch_ide",{ideType:b,enableCdp:!0});I(X!=null&&X.success?"info":"error",X!=null&&X.success?`${Kn(b)} launched`:`Failed: ${X==null?void 0:X.error}`)}catch(X){I("error",`Launch error: ${X.message}`)}finally{v(null)}}},N=async(b,X,_e,ke)=>{if(e){I("info",`Launching ${b}${X?` in ${X}`:""}${ke?` (model: ${ke})`:""}...`);try{const je=_e?_e.split(/\s+/).filter(Boolean):void 0,Ze=await n(e,"launch_cli",{cliType:b,dir:X||void 0,cliArgs:je,initialModel:ke||void 0}),mt=(Ze==null?void 0:Ze.result)||Ze;Ze!=null&&Ze.success?(I("info",`${b} launched`),mt!=null&&mt.defaultedToHome&&I("info",`📂 No directory specified — running in home directory (${mt.dir||"~"})`)):I("error",`Failed: ${(Ze==null?void 0:Ze.error)||(mt==null?void 0:mt.error)}`)}catch(je){I("error",`Launch error: ${je.message}`)}}},j=async(b,X)=>{if(e&&window.confirm(`Stop ${b}?
186
+ This will terminate the CLI process.`))try{await n(e,"stop_cli",{cliType:b,dir:X}),I("info",`${b} stopped`)}catch(_e){I("error",`Stop failed: ${_e.message}`)}},K=async b=>{try{await n(b.id,"restart_session",{ideType:b.type}),I("info",`${Kn(b.type)} restart initiated`)}catch(X){I("error",`Restart failed: ${X.message}`)}},q=async()=>{if(e)try{const b=await n(e,"detect_ides",{});I("info",`Found ${((b==null?void 0:b.result)||[]).length} IDE(s)`)}catch(b){I("error",`Detection failed: ${b.message}`)}},J=async()=>{if(e){C(!0);try{const b=await n(e,"get_recent_workspaces",{});b!=null&&b.success&&Array.isArray(b==null?void 0:b.result)&&E(b.result)}catch(b){I("error",`Failed: ${b.message}`)}finally{C(!1)}}},oe=async()=>{var b;if(e){S(!0);try{const X=await r(e,"get_cli_history");X.success&&((b=X.result)!=null&&b.history)&&L(X.result.history)}catch{}S(!1)}},ae=async()=>{if(e)try{await r(e,"set_machine_nickname",{nickname:k}),I("info",`Nickname set to "${k||"(cleared)"}"`),le(!1)}catch(b){I("error",`Failed: ${b.message}`)}};if(!Ce)return o?p.jsxs("div",{style:{padding:40,textAlign:"center",color:"#64748b"},children:[p.jsx("h2",{style:{color:"#f1f5f9"},children:"Machine not found"}),p.jsx("p",{style:{marginTop:12},children:"The machine may be offline or not yet connected."}),p.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):p.jsx("div",{style:{padding:40,textAlign:"center",color:"#64748b"},children:p.jsx("p",{children:"⏳ Loading machine..."})});const fe=Ce.totalMem>0?Math.round((Ce.totalMem-Ce.freeMem)/Ce.totalMem*100):0,ce=Ce.loadavg[0]||0,ve=Ce.machineNickname||Ce.hostname,we=[{id:"overview",label:"📊 Overview"},{id:"ides",label:"💻 IDEs",count:Ge.length},{id:"clis",label:"🔌 CLIs",count:Z.length},{id:"providers",label:"⚙️ Providers",count:te.length>0?te.length:void 0},{id:"logs",label:"📋 Logs",count:l.length>0?l.length:void 0}];return p.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[p.jsxs("div",{style:{padding:"16px 24px",borderBottom:"1px solid rgba(255,255,255,0.06)",background:"var(--surface-primary)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[p.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"←"}),p.jsxs("div",{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[Q?p.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[p.jsx("input",{autoFocus:!0,value:k,onChange:b=>ge(b.target.value),onKeyDown:b=>{b.key==="Enter"&&ae(),b.key==="Escape"&&le(!1)},placeholder:"Machine nickname...",style:{padding:"4px 10px",borderRadius:6,border:"1px solid rgba(139,92,246,0.3)",background:"rgba(15,23,42,0.8)",color:"#f1f5f9",fontSize:14,fontWeight:600,width:200}}),p.jsx("button",{onClick:ae,className:"machine-btn",style:{color:"#22c55e",borderColor:"rgba(34,197,94,0.3)"},children:"✓"}),p.jsx("button",{onClick:()=>le(!1),className:"machine-btn",children:"✕"})]}):p.jsx("h1",{style:{fontSize:18,fontWeight:700,color:"#f1f5f9",margin:0,cursor:"pointer"},onClick:()=>{le(!0),ge(Ce.machineNickname||"")},title:"Click to set nickname",children:ve}),p.jsx("span",{className:"status-dot-md online"})]}),p.jsxs("div",{style:{fontSize:11,color:"#64748b",marginTop:2,display:"flex",gap:8,alignItems:"center"},children:[p.jsxs("span",{children:[Ce.platform," · ",Ce.arch," · ",Ce.cpus," cores"]}),Ce.p2p.available&&p.jsxs("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:9,fontWeight:600,background:Ce.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:Ce.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",Ce.p2p.state==="connected"?`● ${Ce.p2p.peers}`:"○"]}),Ce.cdpconnected&&p.jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:9,fontWeight:600,background:"rgba(34,197,94,0.08)",color:"#22c55e"},children:"CDP ●"}),Ce.machineNickname&&p.jsxs("span",{style:{color:"#475569"},children:["(",Ce.hostname,")"]})]})]})]}),p.jsx("button",{onClick:q,className:"machine-btn-primary",title:"Re-detect installed IDEs",children:"🔍 Scan IDEs"})]}),p.jsx("div",{className:"machine-tabs",children:we.map(b=>p.jsxs("button",{onClick:()=>O(b.id),className:`machine-tab${A===b.id?" active":""}`,children:[b.label,b.count!==void 0&&p.jsx("span",{className:"tab-count",children:b.count})]},b.id))})]}),p.jsxs("div",{className:"page-content",children:[A==="overview"&&p.jsxs("div",{children:[p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:10,marginBottom:20},children:[p.jsx(Mm,{icon:"⏱",label:"Uptime",value:yI(Ce.uptime)}),p.jsx(Mm,{icon:"💻",label:"IDEs",value:`${Ge.length}`,sub:`${Z.length} CLIs`})]}),p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,marginBottom:20,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsx("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:12},children:"Resource Usage"}),p.jsxs("div",{style:{display:"flex",gap:24},children:[p.jsx(Am,{value:Math.min(Math.round(ce/Ce.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${ce.toFixed(2)} avg / ${Ce.cpus} cores`}),p.jsx(Am,{value:fe,max:100,label:"Memory",color:"#3b82f6",detail:`${Bm(Ce.totalMem-Ce.freeMem)} / ${Bm(Ce.totalMem)}`})]})]}),p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:12},children:[p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"IDEs"}),p.jsx("button",{onClick:()=>O("ides"),className:"machine-btn",style:{fontSize:10},children:"View All →"})]}),Ge.length===0?p.jsx("div",{style:{fontSize:12,color:"#475569",fontStyle:"italic"},children:"No IDEs running"}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:Ge.map(b=>{var _e,ke,je;const X=(b.agentStreams||[]).some(Ze=>Ze.status==="generating"||Ze.status==="streaming")||((_e=b.activeChat)==null?void 0:_e.status)==="generating";return p.jsxs("div",{onClick:()=>t(`/ide/${b.id}`),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 10px",borderRadius:8,cursor:"pointer",transition:"background 0.15s",background:X?"rgba(249,115,22,0.04)":"rgba(255,255,255,0.02)",border:X?"1px solid rgba(249,115,22,0.1)":"1px solid transparent"},children:[p.jsx("span",{children:It(b.type)}),p.jsx("span",{style:{fontSize:12,color:"#e2e8f0",fontWeight:500},children:Kn(b.type)}),p.jsx("span",{style:{fontSize:10,color:"#475569",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((je=(ke=b.workspaceFolders)==null?void 0:ke[0])==null?void 0:je.name)||""}),X&&p.jsx("span",{style:{fontSize:10,color:"#fb923c",fontWeight:600,marginLeft:"auto"},children:"⚡ Working"}),p.jsx("span",{style:{marginLeft:X?6:"auto",width:6,height:6,borderRadius:"50%",background:X?"#fb923c":"#22c55e",boxShadow:X?"0 0 8px rgba(249,115,22,0.4)":"none",animation:X?"pulse-dot 1.5s infinite":"none"}})]},b.id)})})]}),p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"CLIs"}),p.jsx("button",{onClick:()=>O("clis"),className:"machine-btn",style:{fontSize:10},children:"View All →"})]}),Z.length===0?p.jsx("div",{style:{fontSize:12,color:"#475569",fontStyle:"italic"},children:"No CLIs running"}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:Z.map(b=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 10px",borderRadius:8,background:"rgba(255,255,255,0.02)"},children:[p.jsx("span",{children:It(b.type)}),p.jsx("span",{style:{fontSize:12,color:"#e2e8f0",fontWeight:500},children:b.cliName}),p.jsx("span",{style:{fontSize:10,color:"#475569",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.workingDir.split("/").pop()}),p.jsx("span",{style:{marginLeft:"auto",width:6,height:6,borderRadius:"50%",background:b.status==="stopped"?"#ef4444":"#22c55e"}})]},b.id))})]})]}),Ce.detectedIdes.length>0&&p.jsxs("div",{style:{marginTop:16,padding:"14px 18px",borderRadius:12,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsx("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:8},children:"Detected on this machine"}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:Ce.detectedIdes.map(b=>p.jsxs("div",{style:{padding:"4px 10px",borderRadius:6,fontSize:11,background:b.running?"rgba(34,197,94,0.06)":"rgba(255,255,255,0.02)",border:`1px solid ${b.running?"rgba(34,197,94,0.12)":"rgba(255,255,255,0.04)"}`,color:b.running?"#86efac":"#64748b",display:"flex",alignItems:"center",gap:4},children:[p.jsx("span",{children:It(b.type)}),b.name||b.type,p.jsx("span",{style:{width:4,height:4,borderRadius:"50%",background:b.running?"#22c55e":"#475569"}})]},b.type))})]})]}),A==="ides"&&p.jsxs("div",{children:[p.jsxs("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:["Running (",Ge.length,")"]}),Ge.length===0?p.jsx("div",{style:{padding:"40px 20px",textAlign:"center",borderRadius:12,background:"rgba(15,23,42,0.4)",border:"1px dashed rgba(255,255,255,0.06)",color:"#475569",fontSize:13,marginBottom:20},children:"No IDEs currently running. Launch one below."}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10,marginBottom:20},children:Ge.map(b=>{var X,_e;return p.jsxs("div",{style:{padding:"14px 18px",borderRadius:12,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx("span",{style:{fontSize:18},children:It(b.type)}),p.jsx("span",{style:{fontWeight:600,fontSize:14,color:"#f1f5f9"},children:Kn(b.type)}),b.version&&p.jsxs("span",{style:{fontSize:10,color:"#475569"},children:["v",b.version]}),p.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#22c55e",boxShadow:"0 0 6px rgba(34,197,94,0.3)"}})]}),p.jsxs("div",{style:{display:"flex",gap:6},children:[p.jsx("button",{onClick:()=>t(`/ide/${b.id}`),className:"machine-btn",children:"🖥 Control"}),p.jsx("button",{onClick:()=>K(b),className:"machine-btn",style:{color:"#f59e0b",borderColor:"rgba(245,158,11,0.3)"},children:"↻ Restart"})]})]}),p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:6,fontSize:12,color:"#94a3b8"},children:[p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"Workspace:"})," ",((X=b.workspaceFolders)==null?void 0:X.map(ke=>ke.name).join(", "))||"—"]}),p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"File:"})," ",((_e=b.activeFile)==null?void 0:_e.split("/").pop())||"—"]}),p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"Terminals:"})," ",b.terminals]}),p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"CDP:"})," ",b.cdpconnected?"● connected":"○ Off"]})]}),b.aiAgents.length>0&&p.jsx("div",{style:{display:"flex",gap:4,marginTop:8,flexWrap:"wrap"},children:b.aiAgents.map(ke=>p.jsxs("span",{style:{padding:"2px 8px",borderRadius:6,fontSize:10,background:ke.status==="generating"||ke.status==="streaming"?"rgba(249,115,22,0.08)":"rgba(99,102,241,0.06)",color:ke.status==="generating"||ke.status==="streaming"?"#fb923c":"#818cf8"},children:[ke.name," · ",ke.status]},ke.id))})]},b.id)})}),p.jsxs("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:["Available to Launch (",pe.length,")"]}),p.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[pe.map(b=>p.jsxs("button",{onClick:()=>Y(b.type||b.id||""),disabled:!!_,className:"machine-btn-primary",style:{opacity:_&&_!==b.type?.4:1,display:"flex",alignItems:"center",gap:6},children:[p.jsx("span",{children:It(b.type)}),_===b.type?"⏳ Launching...":`▶ ${b.name||Kn(b.type)}`]},b.type)),pe.length===0&&p.jsxs("div",{style:{fontSize:12,color:"#475569",fontStyle:"italic"},children:["All detected IDEs are running, or none detected.",p.jsx("button",{onClick:q,className:"machine-btn",style:{marginLeft:8},children:"🔍 Scan"})]})]})]}),A==="clis"&&p.jsxs("div",{children:[p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,marginBottom:20,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(139,92,246,0.12)"},children:[p.jsx("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:"Launch New CLI"}),p.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[p.jsx("select",{value:P,onChange:b=>B(b.target.value),className:"machine-input",children:Yt.length>0?Yt.map(b=>p.jsxs("option",{value:b.type,children:[b.icon," ",b.displayName]},b.type)):p.jsx("option",{value:"",disabled:!0,children:"No providers available"})}),p.jsx("input",{type:"text",placeholder:"Working directory...",value:M,onChange:b=>$(b.target.value),className:"machine-input",style:{flex:1,minWidth:200}}),p.jsx("input",{type:"text",placeholder:"Args (optional)",value:G,onChange:b=>T(b.target.value),className:"machine-input",style:{minWidth:150}}),(()=>{const b=Yt.find(X=>X.type===P);return(b==null?void 0:b.category)==="acp"?p.jsx("input",{type:"text",placeholder:"Model (default)",value:D,onChange:X=>U(X.target.value),className:"machine-input",style:{minWidth:120}}):null})(),p.jsx("button",{onClick:()=>N(P,M,G||void 0,D||void 0),className:"machine-btn-primary",children:"▶ Launch"})]})]}),p.jsxs("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:["Running (",Z.length,")"]}),Z.length===0?p.jsx("div",{style:{padding:"30px 20px",textAlign:"center",borderRadius:12,background:"rgba(15,23,42,0.4)",border:"1px dashed rgba(255,255,255,0.06)",color:"#475569",fontSize:13,marginBottom:20},children:"No CLIs running"}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:20},children:Z.map(b=>p.jsxs("div",{style:{padding:"12px 16px",borderRadius:10,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[p.jsx("span",{style:{fontSize:18},children:It(b.type)}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:600,fontSize:13,color:"#f1f5f9"},children:b.cliName}),p.jsx("div",{style:{fontSize:11,color:"#64748b"},children:b.workingDir})]})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx("span",{style:{padding:"2px 8px",borderRadius:6,fontSize:10,fontWeight:600,background:b.status==="stopped"?"rgba(239,68,68,0.08)":"rgba(34,197,94,0.08)",color:b.status==="stopped"?"#ef4444":"#22c55e"},children:b.status}),b.status==="stopped"?p.jsx("button",{onClick:()=>N(b.type,b.workingDir),className:"machine-btn",style:{color:"#22c55e",borderColor:"rgba(34,197,94,0.3)"},children:"▶"}):p.jsx("button",{onClick:()=>j(b.type,b.workingDir),className:"machine-btn",style:{color:"#ef4444",borderColor:"rgba(239,68,68,0.3)"},children:"■"})]})]},b.id))}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"History"}),p.jsx("button",{onClick:oe,disabled:W,className:"machine-btn",children:W?"⏳":"↻ Load"})]}),H.length>0&&p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,maxHeight:200,overflowY:"auto"},children:H.map((b,X)=>{var _e,ke;return p.jsxs("div",{onClick:()=>{B(b.cliType),$(b.dir),T((b.cliArgs||[]).join(" "))},style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",borderRadius:6,cursor:"pointer",background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.04)",fontSize:12,transition:"background 0.15s"},onMouseEnter:je=>je.currentTarget.style.background="rgba(255,255,255,0.06)",onMouseLeave:je=>je.currentTarget.style.background="rgba(255,255,255,0.02)",children:[p.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",color:"#94a3b8"},children:[p.jsx("span",{children:It(b.cliType)}),p.jsx("span",{children:((_e=b.dir)==null?void 0:_e.split("/").filter(Boolean).pop())||"root"}),((ke=b.cliArgs)==null?void 0:ke.length)>0&&p.jsx("span",{style:{color:"#475569",fontSize:10},children:b.cliArgs.join(" ")})]}),p.jsx("span",{style:{color:"#475569",fontSize:10},children:b.timestamp?new Date(b.timestamp).toLocaleDateString():""})]},X)})}),p.jsxs("div",{style:{marginTop:20},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"Recent Workspaces"}),p.jsx("button",{onClick:J,disabled:R,className:"machine-btn",children:R?"⏳":"↻ Load"})]}),y.length>0&&p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:y.map((b,X)=>p.jsxs("button",{onClick:()=>$(b),className:"machine-btn",style:{maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b,children:["📂 ",b.split("/").filter(Boolean).pop()||b]},X))})]})]}),A==="providers"&&p.jsxs("div",{children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[p.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginRight:8},children:"Filter"}),["all","acp","cli","ide","extension"].map(b=>p.jsx("button",{onClick:()=>Be(b),className:"machine-btn",style:{fontSize:10,padding:"2px 8px",background:z===b?"rgba(139,92,246,0.15)":void 0,borderColor:z===b?"rgba(139,92,246,0.4)":void 0,color:z===b?"#a78bfa":void 0},children:b.toUpperCase()},b))]}),p.jsx("button",{onClick:zt,disabled:ie,className:"machine-btn",children:ie?"⏳ Loading...":"↻ Refresh"})]}),ie&&te.length===0?p.jsx("div",{style:{padding:40,textAlign:"center",color:"#475569"},children:"Loading provider settings..."}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:te.filter(b=>z==="all"||b.category===z).map(b=>p.jsxs("div",{style:{padding:"14px 18px",borderRadius:12,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[p.jsx("span",{style:{fontSize:18},children:b.icon}),p.jsx("span",{style:{fontWeight:600,fontSize:13,color:"#f1f5f9"},children:b.displayName}),p.jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:9,fontWeight:600,background:b.category==="acp"?"rgba(139,92,246,0.08)":b.category==="cli"?"rgba(59,130,246,0.08)":b.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:b.category==="acp"?"#a78bfa":b.category==="cli"?"#60a5fa":b.category==="ide"?"#86efac":"#fbbf24"},children:b.category})]}),p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:b.schema.map(X=>p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsxs("div",{style:{fontSize:12,fontWeight:500,color:"#e2e8f0"},children:[X.label||X.key,ue===`${b.type}.${X.key}`&&p.jsx("span",{style:{marginLeft:6,fontSize:9,color:"#8b5cf6"},children:"saving..."})]}),X.description&&p.jsx("div",{style:{fontSize:10,color:"#64748b",marginTop:1},children:X.description})]}),p.jsx("div",{style:{flexShrink:0},children:X.type==="boolean"?p.jsx("button",{onClick:()=>qt(b.type,X.key,!(b.values[X.key]??X.default)),style:{width:40,height:22,borderRadius:11,border:"none",background:b.values[X.key]??X.default?"#8b5cf6":"rgba(255,255,255,0.08)",position:"relative",cursor:"pointer",transition:"background 0.2s"},children:p.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:"white",position:"absolute",top:3,left:b.values[X.key]??X.default?21:3,transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"}})}):X.type==="number"?p.jsx("input",{type:"number",value:b.values[X.key]??X.default??0,min:X.min,max:X.max,onChange:_e=>{const ke=parseInt(_e.target.value)||0;X.min!==void 0&&ke<X.min||X.max!==void 0&&ke>X.max||qt(b.type,X.key,ke)},className:"machine-input",style:{width:80,textAlign:"center",fontSize:11}}):X.type==="select"&&X.options?p.jsx("select",{value:b.values[X.key]??X.default??"",onChange:_e=>qt(b.type,X.key,_e.target.value),className:"machine-input",style:{fontSize:11},children:X.options.map(_e=>p.jsx("option",{value:_e,children:_e},_e))}):p.jsx("input",{type:"text",value:b.values[X.key]??X.default??"",onBlur:_e=>qt(b.type,X.key,_e.target.value),className:"machine-input",style:{width:120,fontSize:11}})})]},X.key))})]},b.type))})]}),A==="logs"&&p.jsxs("div",{children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[p.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginRight:8},children:"Level"}),["debug","info","warn","error"].map(b=>p.jsx("button",{onClick:()=>{w(b),h([]),d(0)},className:"machine-btn",style:{fontSize:10,padding:"2px 8px",background:m===b?"rgba(139,92,246,0.15)":void 0,borderColor:m===b?"rgba(139,92,246,0.4)":void 0,color:m===b?"#a78bfa":void 0},children:b.toUpperCase()},b))]}),p.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[p.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[c.length," entries"]}),p.jsx("button",{onClick:()=>g(!f),className:"machine-btn",style:{color:f?"#22c55e":"#64748b",borderColor:f?"rgba(34,197,94,0.3)":void 0},children:f?"⏸ Pause":"▶ Resume"}),p.jsx("button",{onClick:()=>{h([]),d(0)},className:"machine-btn",children:"Clear"})]})]}),p.jsxs("div",{style:{background:"rgba(15, 23, 42, 0.6)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:12,padding:12,minHeight:200,maxHeight:500,overflowY:"auto",fontFamily:"'JetBrains Mono', monospace",fontSize:11,lineHeight:1.6},children:[c.length===0&&p.jsx("div",{style:{padding:40,textAlign:"center",color:"#475569"},children:"Loading daemon logs..."}),c.map((b,X)=>p.jsxs("div",{style:{display:"flex",gap:8,padding:"2px 0",color:b.level==="error"?"#ef4444":b.level==="warn"?"#f59e0b":b.level==="debug"?"#64748b":"#94a3b8"},children:[p.jsx("span",{style:{color:"#475569",minWidth:75,flexShrink:0},children:new Date(b.timestamp).toLocaleTimeString()}),p.jsx("span",{style:{fontWeight:600,minWidth:32,flexShrink:0,fontSize:9,color:b.level==="error"?"#ef4444":b.level==="warn"?"#f59e0b":b.level==="debug"?"#475569":"#8b5cf6"},children:b.level==="error"?"ERR":b.level==="warn"?"WRN":b.level==="debug"?"DBG":"INF"}),p.jsx("span",{children:b.message})]},X)),p.jsx("div",{ref:xe})]})]})]})]})}function BI(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,r=new URLSearchParams(window.location.search).get("token");return r?`${t}?token=${encodeURIComponent(r)}`:t}const Om=BI(),jm=3e3,NI=3e4;let rr=null,zI=0;const xa=new Map,Xh=new Set;let Ds=null;async function Fl(e,t,n){const r=rr;if(r&&r.readyState===WebSocket.OPEN){const s=`req_${++zI}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{xa.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);xa.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),r.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:n||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:n||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class OI{constructor(t){ps(this,"daemonId");ps(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(rr==null?void 0:rr.readyState)===WebSocket.OPEN}get connectionState(){return(rr==null?void 0:rr.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,n){return Fl(this.daemonId,t,n)}async sendInput(t,n){return Fl(this.daemonId,"cdp_remote_action",{action:t,params:n})}startScreenshots(t){if(this.screenshotIdeType=t||null,Ds)return;const n=async()=>{if(this.hasCommandChannel)try{const r=await Fl(this.daemonId,"screenshot",{width:1280});if(r!=null&&r.success&&(r!=null&&r.base64)){const i=await fetch(`data:image/jpeg;base64,${r.base64}`).then(s=>s.blob());Xh.forEach(s=>s(this.daemonId,i))}}catch{}};n(),Ds=setInterval(n,2e3)}stopScreenshots(t){Ds&&(clearInterval(Ds),Ds=null)}}let Xr=null;function jI(e){(!Xr||Xr.daemonId!==e)&&(Xr=new OI(e));try{const{connectionManager:t}=require("@adhdev/web-core"),n=t.get.bind(t);t.get=r=>r===e?Xr:n(r),t.getState=r=>r===e&&(Xr==null?void 0:Xr.connectionState)||"disconnected",t.onScreenshot=r=>(Xh.add(r),()=>{Xh.delete(r)})}catch{}}function FI({children:e}){const t=x.useRef($p()),n=$p();t.current=n;const[,r]=x.useState("disconnected"),i=x.useRef(null),s=x.useRef(),o=x.useRef(jm),l=x.useRef(!0);return x.useEffect(()=>{l.current=!0;function a(){var u,d;if(!l.current||((u=i.current)==null?void 0:u.readyState)===WebSocket.OPEN||((d=i.current)==null?void 0:d.readyState)===WebSocket.CONNECTING)return;r("connecting"),console.log(`[Standalone WS] Connecting to ${Om}...`);let h;try{h=new WebSocket(Om)}catch(f){console.error("[Standalone WS] Failed to create WebSocket:",f),c();return}i.current=h,h.onopen=()=>{if(!l.current){h.close();return}r("connected"),o.current=jm,console.log("[Standalone WS] Connected")},rr=h,h.onmessage=f=>{var g;try{const m=JSON.parse(f.data);if((m.type==="command_result"||m.type==="error")&&m.requestId){const w=xa.get(m.requestId);w&&(xa.delete(m.requestId),m.type==="error"?w.reject(new Error(((g=m.data)==null?void 0:g.message)||"Command failed")):w.resolve(m.data));return}if(m.type==="status"||m.type==="initial_state"){const w=m.data;if(!w)return;const{injectEntries:_,markLoaded:v}=t.current,y=[],E=w.id||"standalone";jI(E),y.push({id:E,type:"adhdev-daemon",status:"online",daemonMode:!0,machine:{hostname:w.hostname,platform:w.platform,...w.system||{}},system:w.system||null,timestamp:w.timestamp,cdpConnected:w.cdpConnected,detectedIdes:w.detectedIdes||[],availableProviders:w.availableProviders||[],managedIdeIds:(w.ides||[]).map(R=>R.id),managedCliIds:(w.clis||[]).map(R=>R.id)});for(const R of w.ides||[])y.push({...R,daemonId:w.id||"standalone",status:R.cdpConnected?"online":"detected"});for(const R of w.clis||[])y.push({...R,daemonId:w.id||"standalone",status:R.isRunning?"running":"stopped"});y.length>0&&_(y),v()}}catch(m){console.error("[Standalone WS] Parse error:",m)}},h.onclose=()=>{l.current&&(r("disconnected"),i.current=null,c())},h.onerror=f=>{console.warn("[Standalone WS] Error, will reconnect:",f)}}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,NI),a()},h)}return a(),()=>{l.current=!1,clearTimeout(s.current),i.current&&(i.current.onclose=null,i.current.close(),i.current=null,rr=null)}},[]),p.jsx(p.Fragment,{children:e})}function $I({children:e}){return p.jsx(Yx,{children:p.jsx(FI,{children:e})})}const WI=[{id:"dashboard",path:"/dashboard",icon:"🌊",label:"Dashboard"},{id:"machine",path:"/machine",icon:"🐇",label:"Burrow"}];function HI({children:e}){const t=cs(),n=Mo(),[r,i]=x.useState(!1),[s,o]=x.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),l=c=>{t(c),i(!1)},a=()=>{o(c=>{const h=!c;try{localStorage.setItem("sidebar-collapsed",h?"1":"0")}catch{}return h})};return p.jsxs("div",{className:`app-layout${r?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[p.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[p.jsx("span",{className:"mobile-menu-icon"}),p.jsx("span",{className:"mobile-menu-icon"}),p.jsx("span",{className:"mobile-menu-icon"})]}),r&&p.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:c=>c.key==="Escape"&&i(!1)}),p.jsxs("aside",{className:`sidebar ${r?"sidebar-open":""}`,children:[p.jsxs("div",{className:"sidebar-header",children:[p.jsxs("div",{className:"sidebar-logo",style:{justifyContent:s?"center":void 0,gap:s?0:void 0},children:[p.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",style:{width:28,height:28}}),!s&&p.jsx("span",{children:"ADHDev"})]}),p.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),p.jsx("nav",{className:"sidebar-nav",children:WI.map(c=>p.jsxs("div",{className:`nav-item${n.pathname===c.path?" active":""}`,id:`nav-${c.id}`,onClick:()=>l(c.path),title:s?c.label:void 0,style:{cursor:"pointer",justifyContent:s?"center":void 0,padding:s?"10px 0":void 0},children:[p.jsx("span",{className:"nav-icon",children:c.icon}),!s&&c.label]},c.id))}),p.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle)",paddingTop:16,marginTop:"auto"},children:[!s&&p.jsxs("div",{style:{padding:"8px 12px",fontSize:12,color:"var(--text-muted)"},children:["Selfhost v","0.4.1"]}),p.jsxs("div",{className:"nav-item",onClick:a,title:s?"Expand sidebar":"Collapse sidebar",style:{cursor:"pointer",justifyContent:s?"center":void 0,padding:s?"10px 0":void 0},children:[p.jsx("span",{className:"nav-icon",style:{fontSize:16},children:s?"›":"‹"}),!s&&p.jsx("span",{style:{fontSize:12},children:"Collapse"})]})]})]}),p.jsx("main",{className:"main-content",style:{position:"relative"},children:p.jsx("div",{className:"main-content-inner",children:e})})]})}function Fm(){const{ides:e}=vy(),t=e.find(n=>{var r;return n.daemonMode||((r=n.id)==null?void 0:r.startsWith("standalone"))});return t?p.jsx(Pl,{to:`/machines/${t.id}`,replace:!0}):e.length>0?p.jsx(Pl,{to:`/machines/${e[0].id}`,replace:!0}):p.jsx(Pl,{to:"/dashboard",replace:!0})}function UI(){return p.jsx(Kx,{children:p.jsx($I,{children:p.jsx(Zx,{value:{sendCommand:Fl,sendData:()=>!1},children:p.jsx(HI,{children:p.jsxs($x,{children:[p.jsx(Zr,{path:"/dashboard",element:p.jsx(LI,{})}),p.jsx(Zr,{path:"/ide/:id",element:p.jsx(MI,{})}),p.jsx(Zr,{path:"/machine",element:p.jsx(Fm,{})}),p.jsx(Zr,{path:"/machines/:id",element:p.jsx(AI,{})}),p.jsx(Zr,{path:"/machines",element:p.jsx(Fm,{})}),p.jsx(Zr,{path:"*",element:p.jsx(Pl,{to:"/dashboard",replace:!0})})]})})})})})}ny(document.getElementById("root")).render(p.jsx(x.StrictMode,{children:p.jsx(UI,{})}));