@adhdev/daemon-standalone 0.5.3 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/index.js +13 -5
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/public/assets/index-4qutKUS5.js +186 -0
  5. package/public/assets/index-94oyUw_i.js +186 -0
  6. package/public/assets/{index-68ueYWEL.js → index-96w38vUG.js} +47 -47
  7. package/public/assets/index-B10-caE3.css +32 -0
  8. package/public/assets/index-B2YMaA0y.js +186 -0
  9. package/public/assets/index-BLoxWHbc.css +32 -0
  10. package/public/assets/index-BRaYxriU.js +186 -0
  11. package/public/assets/index-BiGfAi3p.css +32 -0
  12. package/public/assets/index-BoMNLSFo.js +186 -0
  13. package/public/assets/index-Bqd63kEf.js +186 -0
  14. package/public/assets/index-BrRx73WW.css +32 -0
  15. package/public/assets/index-BtFBYt4S.js +186 -0
  16. package/public/assets/index-Buh3CKsZ.css +32 -0
  17. package/public/assets/index-BwTB9bq4.css +32 -0
  18. package/public/assets/index-C3WbW5-9.css +32 -0
  19. package/public/assets/index-C3kQpRwM.js +186 -0
  20. package/public/assets/index-CBPu6684.css +32 -0
  21. package/public/assets/index-CRb5jZSP.js +186 -0
  22. package/public/assets/index-CcwtBh4z.css +32 -0
  23. package/public/assets/index-CiRrLeo4.js +186 -0
  24. package/public/assets/index-CwzgUmt4.css +32 -0
  25. package/public/assets/index-D3r1MeBL.css +32 -0
  26. package/public/assets/index-D41sUK70.js +186 -0
  27. package/public/assets/index-D5ZAG2ed.js +186 -0
  28. package/public/assets/index-DCq6bTMj.css +32 -0
  29. package/public/assets/index-DDN-N8-r.css +32 -0
  30. package/public/assets/index-DE_LrhPD.js +186 -0
  31. package/public/assets/index-DH3JFo3P.js +186 -0
  32. package/public/assets/index-DHu8pF3J.js +186 -0
  33. package/public/assets/index-DJbQi3ra.js +186 -0
  34. package/public/assets/index-DR6VqErb.js +186 -0
  35. package/public/assets/index-DTXVM3Vb.css +32 -0
  36. package/public/assets/index-Ddcbtwg-.js +186 -0
  37. package/public/assets/index-Dg92qUFt.js +186 -0
  38. package/public/assets/index-DhLjcjFc.css +32 -0
  39. package/public/assets/index-DmdYQOWM.js +186 -0
  40. package/public/assets/index-DthOENaz.css +32 -0
  41. package/public/assets/index-DvOOmQ1s.js +186 -0
  42. package/public/assets/index-W2ECenxW.css +32 -0
  43. package/public/assets/index-_0NDaGCi.js +186 -0
  44. package/public/assets/index-_4zVo_k_.css +32 -0
  45. package/public/assets/index-c_ex_bK7.js +186 -0
  46. package/public/assets/index-fQgFNmvM.js +186 -0
  47. package/public/assets/index-j9BGHnc1.js +186 -0
  48. package/public/assets/index-oQ8GgkYr.css +32 -0
  49. package/public/assets/index-qBcMLS7S.js +186 -0
  50. package/public/assets/index-u7iXS4BI.js +186 -0
  51. package/public/assets/index-uCH1wvbu.js +186 -0
  52. package/public/index.html +2 -2
  53. package/public/assets/index-ChXBX3No.css +0 -32
@@ -1,4 +1,4 @@
1
- var S1=Object.defineProperty;var w1=(e,t,r)=>t in e?S1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ps=(e,t,r)=>w1(e,typeof t!="symbol"?t+"":t,r);function b1(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var $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 Kg={exports:{}},ba={},Vg={exports:{}},Pe={};/**
1
+ var R1=Object.defineProperty;var M1=(e,t,r)=>t in e?R1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ps=(e,t,r)=>M1(e,typeof t!="symbol"?t+"":t,r);function I1(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var zl=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 t_={exports:{}},Sa={},r_={exports:{}},Te={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@ var S1=Object.defineProperty;var w1=(e,t,r)=>t in e?S1(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 Eo=Symbol.for("react.element"),k1=Symbol.for("react.portal"),C1=Symbol.for("react.fragment"),E1=Symbol.for("react.strict_mode"),T1=Symbol.for("react.profiler"),N1=Symbol.for("react.provider"),P1=Symbol.for("react.context"),L1=Symbol.for("react.forward_ref"),R1=Symbol.for("react.suspense"),D1=Symbol.for("react.memo"),M1=Symbol.for("react.lazy"),bf=Symbol.iterator;function I1(e){return e===null||typeof e!="object"?null:(e=bf&&e[bf]||e["@@iterator"],typeof e=="function"?e:null)}var qg={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Yg=Object.assign,Xg={};function ss(e,t,r){this.props=e,this.context=t,this.refs=Xg,this.updater=r||qg}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 Gg(){}Gg.prototype=ss.prototype;function Qh(e,t,r){this.props=e,this.context=t,this.refs=Xg,this.updater=r||qg}var Zh=Qh.prototype=new Gg;Zh.constructor=Qh;Yg(Zh,ss.prototype);Zh.isPureReactComponent=!0;var kf=Array.isArray,Qg=Object.prototype.hasOwnProperty,Jh={current:null},Zg={key:!0,ref:!0,__self:!0,__source:!0};function Jg(e,t,r){var n,i={},s=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)Qg.call(t,n)&&!Zg.hasOwnProperty(n)&&(i[n]=t[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){for(var a=Array(l),c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}if(e&&e.defaultProps)for(n in l=e.defaultProps,l)i[n]===void 0&&(i[n]=l[n]);return{$$typeof: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(r){return t[r]})}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,r,n,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Eo:case k1:o=!0}}if(o)return o=e,i=i(o),e=n===""?"."+Qa(o,0):n,kf(i)?(r="",e!=null&&(r=e.replace(Cf,"$&/")+"/"),vl(i,t,r,"",function(c){return c})):i!=null&&(ed(i)&&(i=A1(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Cf,"$&/")+"/")+e)),t.push(i)),1;if(o=0,n=n===""?".":n+":",kf(e))for(var l=0;l<e.length;l++){s=e[l];var a=n+Qa(s,l);o+=vl(s,t,r,a,i)}else if(a=I1(e),typeof a=="function")for(e=a.call(e),l=0;!(s=e.next()).done;)s=s.value,a=n+Qa(s,l++),o+=vl(s,t,r,a,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Ko(e,t,r){if(e==null)return e;var n=[],i=0;return vl(e,n,"","",function(s){return t.call(r,s,i++)}),n}function O1(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Wt={current:null},yl={transition:null},j1={ReactCurrentDispatcher:Wt,ReactCurrentBatchConfig:yl,ReactCurrentOwner:Jh};function e_(){throw Error("act(...) is not supported in production builds of React.")}Pe.Children={map:Ko,forEach:function(e,t,r){Ko(e,function(){t.apply(this,arguments)},r)},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}};Pe.Component=ss;Pe.Fragment=C1;Pe.Profiler=T1;Pe.PureComponent=Qh;Pe.StrictMode=E1;Pe.Suspense=R1;Pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=j1;Pe.act=e_;Pe.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=Yg({},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)Qg.call(t,a)&&!Zg.hasOwnProperty(a)&&(n[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)n.children=r;else if(1<a){l=Array(a);for(var c=0;c<a;c++)l[c]=arguments[c+2];n.children=l}return{$$typeof:Eo,type:e.type,key:i,ref:s,props:n,_owner:o}};Pe.createContext=function(e){return e={$$typeof:P1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:N1,_context:e},e.Consumer=e};Pe.createElement=Jg;Pe.createFactory=function(e){var t=Jg.bind(null,e);return t.type=e,t};Pe.createRef=function(){return{current:null}};Pe.forwardRef=function(e){return{$$typeof:L1,render:e}};Pe.isValidElement=ed;Pe.lazy=function(e){return{$$typeof:M1,_payload:{_status:-1,_result:e},_init:O1}};Pe.memo=function(e,t){return{$$typeof:D1,type:e,compare:t===void 0?null:t}};Pe.startTransition=function(e){var t=yl.transition;yl.transition={};try{e()}finally{yl.transition=t}};Pe.unstable_act=e_;Pe.useCallback=function(e,t){return Wt.current.useCallback(e,t)};Pe.useContext=function(e){return Wt.current.useContext(e)};Pe.useDebugValue=function(){};Pe.useDeferredValue=function(e){return Wt.current.useDeferredValue(e)};Pe.useEffect=function(e,t){return Wt.current.useEffect(e,t)};Pe.useId=function(){return Wt.current.useId()};Pe.useImperativeHandle=function(e,t,r){return Wt.current.useImperativeHandle(e,t,r)};Pe.useInsertionEffect=function(e,t){return Wt.current.useInsertionEffect(e,t)};Pe.useLayoutEffect=function(e,t){return Wt.current.useLayoutEffect(e,t)};Pe.useMemo=function(e,t){return Wt.current.useMemo(e,t)};Pe.useReducer=function(e,t,r){return Wt.current.useReducer(e,t,r)};Pe.useRef=function(e){return Wt.current.useRef(e)};Pe.useState=function(e){return Wt.current.useState(e)};Pe.useSyncExternalStore=function(e,t,r){return Wt.current.useSyncExternalStore(e,t,r)};Pe.useTransition=function(){return Wt.current.useTransition()};Pe.version="18.3.1";Vg.exports=Pe;var w=Vg.exports;const z1=Gh(w),F1=b1({__proto__:null,default:z1},[w]);/**
9
+ */var Eo=Symbol.for("react.element"),A1=Symbol.for("react.portal"),B1=Symbol.for("react.fragment"),O1=Symbol.for("react.strict_mode"),j1=Symbol.for("react.profiler"),z1=Symbol.for("react.provider"),F1=Symbol.for("react.context"),$1=Symbol.for("react.forward_ref"),H1=Symbol.for("react.suspense"),W1=Symbol.for("react.memo"),U1=Symbol.for("react.lazy"),Rf=Symbol.iterator;function K1(e){return e===null||typeof e!="object"?null:(e=Rf&&e[Rf]||e["@@iterator"],typeof e=="function"?e:null)}var n_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},i_=Object.assign,s_={};function ss(e,t,r){this.props=e,this.context=t,this.refs=s_,this.updater=r||n_}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 o_(){}o_.prototype=ss.prototype;function Qh(e,t,r){this.props=e,this.context=t,this.refs=s_,this.updater=r||n_}var Zh=Qh.prototype=new o_;Zh.constructor=Qh;i_(Zh,ss.prototype);Zh.isPureReactComponent=!0;var Mf=Array.isArray,l_=Object.prototype.hasOwnProperty,Jh={current:null},a_={key:!0,ref:!0,__self:!0,__source:!0};function c_(e,t,r){var n,i={},s=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)l_.call(t,n)&&!a_.hasOwnProperty(n)&&(i[n]=t[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){for(var a=Array(l),c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}if(e&&e.defaultProps)for(n in l=e.defaultProps,l)i[n]===void 0&&(i[n]=l[n]);return{$$typeof:Eo,type:e,key:s,ref:o,props:i,_owner:Jh.current}}function V1(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 q1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var If=/\/+/g;function Qa(e,t){return typeof e=="object"&&e!==null&&e.key!=null?q1(""+e.key):t.toString(36)}function gl(e,t,r,n,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Eo:case A1:o=!0}}if(o)return o=e,i=i(o),e=n===""?"."+Qa(o,0):n,Mf(i)?(r="",e!=null&&(r=e.replace(If,"$&/")+"/"),gl(i,t,r,"",function(c){return c})):i!=null&&(ed(i)&&(i=V1(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(If,"$&/")+"/")+e)),t.push(i)),1;if(o=0,n=n===""?".":n+":",Mf(e))for(var l=0;l<e.length;l++){s=e[l];var a=n+Qa(s,l);o+=gl(s,t,r,a,i)}else if(a=K1(e),typeof a=="function")for(e=a.call(e),l=0;!(s=e.next()).done;)s=s.value,a=n+Qa(s,l++),o+=gl(s,t,r,a,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Wo(e,t,r){if(e==null)return e;var n=[],i=0;return gl(e,n,"","",function(s){return t.call(r,s,i++)}),n}function Y1(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ft={current:null},_l={transition:null},X1={ReactCurrentDispatcher:Ft,ReactCurrentBatchConfig:_l,ReactCurrentOwner:Jh};function u_(){throw Error("act(...) is not supported in production builds of React.")}Te.Children={map:Wo,forEach:function(e,t,r){Wo(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Wo(e,function(){t++}),t},toArray:function(e){return Wo(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}};Te.Component=ss;Te.Fragment=B1;Te.Profiler=j1;Te.PureComponent=Qh;Te.StrictMode=O1;Te.Suspense=H1;Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=X1;Te.act=u_;Te.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=i_({},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)l_.call(t,a)&&!a_.hasOwnProperty(a)&&(n[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)n.children=r;else if(1<a){l=Array(a);for(var c=0;c<a;c++)l[c]=arguments[c+2];n.children=l}return{$$typeof:Eo,type:e.type,key:i,ref:s,props:n,_owner:o}};Te.createContext=function(e){return e={$$typeof:F1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:z1,_context:e},e.Consumer=e};Te.createElement=c_;Te.createFactory=function(e){var t=c_.bind(null,e);return t.type=e,t};Te.createRef=function(){return{current:null}};Te.forwardRef=function(e){return{$$typeof:$1,render:e}};Te.isValidElement=ed;Te.lazy=function(e){return{$$typeof:U1,_payload:{_status:-1,_result:e},_init:Y1}};Te.memo=function(e,t){return{$$typeof:W1,type:e,compare:t===void 0?null:t}};Te.startTransition=function(e){var t=_l.transition;_l.transition={};try{e()}finally{_l.transition=t}};Te.unstable_act=u_;Te.useCallback=function(e,t){return Ft.current.useCallback(e,t)};Te.useContext=function(e){return Ft.current.useContext(e)};Te.useDebugValue=function(){};Te.useDeferredValue=function(e){return Ft.current.useDeferredValue(e)};Te.useEffect=function(e,t){return Ft.current.useEffect(e,t)};Te.useId=function(){return Ft.current.useId()};Te.useImperativeHandle=function(e,t,r){return Ft.current.useImperativeHandle(e,t,r)};Te.useInsertionEffect=function(e,t){return Ft.current.useInsertionEffect(e,t)};Te.useLayoutEffect=function(e,t){return Ft.current.useLayoutEffect(e,t)};Te.useMemo=function(e,t){return Ft.current.useMemo(e,t)};Te.useReducer=function(e,t,r){return Ft.current.useReducer(e,t,r)};Te.useRef=function(e){return Ft.current.useRef(e)};Te.useState=function(e){return Ft.current.useState(e)};Te.useSyncExternalStore=function(e,t,r){return Ft.current.useSyncExternalStore(e,t,r)};Te.useTransition=function(){return Ft.current.useTransition()};Te.version="18.3.1";r_.exports=Te;var b=r_.exports;const G1=Gh(b),Q1=I1({__proto__:null,default:G1},[b]);/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@ var S1=Object.defineProperty;var w1=(e,t,r)=>t in e?S1(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 $1=w,H1=Symbol.for("react.element"),W1=Symbol.for("react.fragment"),U1=Object.prototype.hasOwnProperty,K1=$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,V1={key:!0,ref:!0,__self:!0,__source:!0};function t_(e,t,r){var n,i={},s=null,o=null;r!==void 0&&(s=""+r),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)U1.call(t,n)&&!V1.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:H1,type:e,key:s,ref:o,props:i,_owner:K1.current}}ba.Fragment=W1;ba.jsx=t_;ba.jsxs=t_;Kg.exports=ba;var p=Kg.exports,r_={exports:{}},fr={},n_={exports:{}},i_={};/**
17
+ */var Z1=b,J1=Symbol.for("react.element"),ex=Symbol.for("react.fragment"),tx=Object.prototype.hasOwnProperty,rx=Z1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,nx={key:!0,ref:!0,__self:!0,__source:!0};function h_(e,t,r){var n,i={},s=null,o=null;r!==void 0&&(s=""+r),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)tx.call(t,n)&&!nx.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:J1,type:e,key:s,ref:o,props:i,_owner:rx.current}}Sa.Fragment=ex;Sa.jsx=h_;Sa.jsxs=h_;t_.exports=Sa;var p=t_.exports,d_={exports:{}},ar={},f_={exports:{}},p_={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@ var S1=Object.defineProperty;var w1=(e,t,r)=>t in e?S1(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,$){var S=L.length;L.push($);e:for(;0<S;){var ne=S-1>>>1,oe=L[ne];if(0<i(oe,$))L[ne]=$,L[S]=oe,S=ne;else break e}}function r(L){return L.length===0?null:L[0]}function n(L){if(L.length===0)return null;var $=L[0],S=L.pop();if(S!==$){L[0]=S;e:for(var ne=0,oe=L.length,b=oe>>>1;ne<b;){var me=2*(ne+1)-1,V=L[me],H=me+1,G=L[H];if(0>i(V,S))H<oe&&0>i(G,V)?(L[ne]=G,L[H]=S,ne=H):(L[ne]=V,L[me]=S,ne=me);else if(H<oe&&0>i(G,S))L[ne]=G,L[H]=S,ne=H;else break e}}return $}function i(L,$){var S=L.sortIndex-$.sortIndex;return S!==0?S:L.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],c=[],h=1,u=null,d=3,f=!1,m=!1,g=!1,x=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 $=r(c);$!==null;){if($.callback===null)n(c);else if($.startTime<=L)n(c),$.sortIndex=$.expirationTime,t(a,$);else break;$=r(c)}}function E(L){if(g=!1,y(L),!m)if(r(a)!==null)m=!0,F(N);else{var $=r(c);$!==null&&W(E,$.startTime-L)}}function N(L,$){m=!1,g&&(g=!1,_(z),z=-1),f=!0;var S=d;try{for(y($),u=r(a);u!==null&&(!(u.expirationTime>$)||L&&!R());){var ne=u.callback;if(typeof ne=="function"){u.callback=null,d=u.priorityLevel;var oe=ne(u.expirationTime<=$);$=e.unstable_now(),typeof oe=="function"?u.callback=oe:u===r(a)&&n(a),y($)}else n(a);u=r(a)}if(u!==null)var b=!0;else{var me=r(c);me!==null&&W(E,me.startTime-$),b=!1}return b}finally{u=null,d=S,f=!1}}var k=!1,I=null,z=-1,Z=5,T=-1;function R(){return!(e.unstable_now()-T<Z)}function A(){if(I!==null){var L=e.unstable_now();T=L;var $=!0;try{$=I(!0,L)}finally{$?D():(k=!1,I=null)}}else k=!1}var D;if(typeof v=="function")D=function(){v(A)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,M=U.port2;U.port1.onmessage=A,D=function(){M.postMessage(null)}}else D=function(){x(A,0)};function F(L){I=L,k||(k=!0,D())}function W(L,$){z=x(function(){L(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_continueExecution=function(){m||f||(m=!0,F(N))},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"):Z=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return r(a)},e.unstable_next=function(L){switch(d){case 1:case 2:case 3:var $=3;break;default:$=d}var S=d;d=$;try{return L()}finally{d=S}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(L,$){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var S=d;d=L;try{return $()}finally{d=S}},e.unstable_scheduleCallback=function(L,$,S){var ne=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?ne+S:ne):S=ne,L){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=S+oe,L={id:h++,callback:$,priorityLevel:L,startTime:S,expirationTime:oe,sortIndex:-1},S>ne?(L.sortIndex=S,t(c,L),r(a)===null&&L===r(c)&&(g?(_(z),z=-1):g=!0,W(E,S-ne))):(L.sortIndex=oe,t(a,L),m||f||(m=!0,F(N))),L},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(L){var $=d;return function(){var S=d;d=$;try{return L.apply(this,arguments)}finally{d=S}}}})(i_);n_.exports=i_;var q1=n_.exports;/**
25
+ */(function(e){function t(L,$){var S=L.length;L.push($);e:for(;0<S;){var ne=S-1>>>1,ce=L[ne];if(0<i(ce,$))L[ne]=$,L[S]=ce,S=ne;else break e}}function r(L){return L.length===0?null:L[0]}function n(L){if(L.length===0)return null;var $=L[0],S=L.pop();if(S!==$){L[0]=S;e:for(var ne=0,ce=L.length,k=ce>>>1;ne<k;){var ge=2*(ne+1)-1,X=L[ge],Q=ge+1,K=L[Q];if(0>i(X,S))Q<ce&&0>i(K,X)?(L[ne]=K,L[Q]=S,ne=Q):(L[ne]=X,L[ge]=S,ne=ge);else if(Q<ce&&0>i(K,S))L[ne]=K,L[Q]=S,ne=Q;else break e}}return $}function i(L,$){var S=L.sortIndex-$.sortIndex;return S!==0?S:L.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],c=[],h=1,u=null,d=3,f=!1,m=!1,g=!1,x=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 $=r(c);$!==null;){if($.callback===null)n(c);else if($.startTime<=L)n(c),$.sortIndex=$.expirationTime,t(a,$);else break;$=r(c)}}function E(L){if(g=!1,y(L),!m)if(r(a)!==null)m=!0,F(P);else{var $=r(c);$!==null&&H(E,$.startTime-L)}}function P(L,$){m=!1,g&&(g=!1,_(z),z=-1),f=!0;var S=d;try{for(y($),u=r(a);u!==null&&(!(u.expirationTime>$)||L&&!D());){var ne=u.callback;if(typeof ne=="function"){u.callback=null,d=u.priorityLevel;var ce=ne(u.expirationTime<=$);$=e.unstable_now(),typeof ce=="function"?u.callback=ce:u===r(a)&&n(a),y($)}else n(a);u=r(a)}if(u!==null)var k=!0;else{var ge=r(c);ge!==null&&H(E,ge.startTime-$),k=!1}return k}finally{u=null,d=S,f=!1}}var C=!1,M=null,z=-1,J=5,N=-1;function D(){return!(e.unstable_now()-N<J)}function I(){if(M!==null){var L=e.unstable_now();N=L;var $=!0;try{$=M(!0,L)}finally{$?R():(C=!1,M=null)}}else C=!1}var R;if(typeof v=="function")R=function(){v(I)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,A=W.port2;W.port1.onmessage=I,R=function(){A.postMessage(null)}}else R=function(){x(I,0)};function F(L){M=L,C||(C=!0,R())}function H(L,$){z=x(function(){L(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_continueExecution=function(){m||f||(m=!0,F(P))},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"):J=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return r(a)},e.unstable_next=function(L){switch(d){case 1:case 2:case 3:var $=3;break;default:$=d}var S=d;d=$;try{return L()}finally{d=S}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(L,$){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var S=d;d=L;try{return $()}finally{d=S}},e.unstable_scheduleCallback=function(L,$,S){var ne=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?ne+S:ne):S=ne,L){case 1:var ce=-1;break;case 2:ce=250;break;case 5:ce=1073741823;break;case 4:ce=1e4;break;default:ce=5e3}return ce=S+ce,L={id:h++,callback:$,priorityLevel:L,startTime:S,expirationTime:ce,sortIndex:-1},S>ne?(L.sortIndex=S,t(c,L),r(a)===null&&L===r(c)&&(g?(_(z),z=-1):g=!0,H(E,S-ne))):(L.sortIndex=ce,t(a,L),m||f||(m=!0,F(P))),L},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(L){var $=d;return function(){var S=d;d=$;try{return L.apply(this,arguments)}finally{d=S}}}})(p_);f_.exports=p_;var ix=f_.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,14 +30,14 @@ var S1=Object.defineProperty;var w1=(e,t,r)=>t in e?S1(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 Y1=w,dr=q1;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s_=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++)s_.add(t[e])}var an=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),iu=Object.prototype.hasOwnProperty,X1=/^[: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 G1(e){return iu.call(Tf,e)?!0:iu.call(Ef,e)?!1:X1.test(e)?Tf[e]=!0:(Ef[e]=!0,!1)}function Q1(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Z1(e,t,r,n){if(t===null||typeof t>"u"||Q1(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ut(e,t,r,n,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Nt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Nt[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];Nt[t]=new Ut(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Nt[e]=new Ut(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Nt[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){Nt[e]=new Ut(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Nt[e]=new Ut(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Nt[e]=new Ut(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Nt[e]=new Ut(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Nt[e]=new Ut(e,5,!1,e.toLowerCase(),null,!1,!1)});var td=/[\-:]([a-z])/g;function rd(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,rd);Nt[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,rd);Nt[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,rd);Nt[t]=new Ut(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Nt[e]=new Ut(e,1,!1,e.toLowerCase(),null,!1,!1)});Nt.xlinkHref=new Ut("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Nt[e]=new Ut(e,1,!1,e.toLowerCase(),null,!0,!0)});function nd(e,t,r,n){var i=Nt.hasOwnProperty(t)?Nt[t]:null;(i!==null?i.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Z1(t,r,i,n)&&(r=null),n||i===null?G1(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):i.mustUseProperty?e[i.propertyName]=r===null?i.type===3?!1:"":r:(t=i.attributeName,n=i.attributeNamespace,r===null?e.removeAttribute(t):(i=i.type,r=i===3||i===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var dn=Y1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Vo=Symbol.for("react.element"),Li=Symbol.for("react.portal"),Ri=Symbol.for("react.fragment"),id=Symbol.for("react.strict_mode"),su=Symbol.for("react.profiler"),o_=Symbol.for("react.provider"),l_=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"),Sn=Symbol.for("react.lazy"),a_=Symbol.for("react.offscreen"),Nf=Symbol.iterator;function ms(e){return e===null||typeof e!="object"?null:(e=Nf&&e[Nf]||e["@@iterator"],typeof e=="function"?e:null)}var Ge=Object.assign,Za;function Ms(e){if(Za===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Za=t&&t[1]||""}return`
33
+ */var sx=b,lr=ix;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var m_=new Set,to={};function vi(e,t){Gi(e,t),Gi(e+"Capture",t)}function Gi(e,t){for(to[e]=t,e=0;e<t.length;e++)m_.add(t[e])}var ln=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),iu=Object.prototype.hasOwnProperty,ox=/^[: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]*$/,Af={},Bf={};function lx(e){return iu.call(Bf,e)?!0:iu.call(Af,e)?!1:ox.test(e)?Bf[e]=!0:(Af[e]=!0,!1)}function ax(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function cx(e,t,r,n){if(t===null||typeof t>"u"||ax(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function $t(e,t,r,n,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Et={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Et[e]=new $t(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Et[t]=new $t(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Et[e]=new $t(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Et[e]=new $t(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){Et[e]=new $t(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Et[e]=new $t(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Et[e]=new $t(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Et[e]=new $t(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Et[e]=new $t(e,5,!1,e.toLowerCase(),null,!1,!1)});var td=/[\-:]([a-z])/g;function rd(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,rd);Et[t]=new $t(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,rd);Et[t]=new $t(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,rd);Et[t]=new $t(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Et[e]=new $t(e,1,!1,e.toLowerCase(),null,!1,!1)});Et.xlinkHref=new $t("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Et[e]=new $t(e,1,!1,e.toLowerCase(),null,!0,!0)});function nd(e,t,r,n){var i=Et.hasOwnProperty(t)?Et[t]:null;(i!==null?i.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(cx(t,r,i,n)&&(r=null),n||i===null?lx(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):i.mustUseProperty?e[i.propertyName]=r===null?i.type===3?!1:"":r:(t=i.attributeName,n=i.attributeNamespace,r===null?e.removeAttribute(t):(i=i.type,r=i===3||i===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var hn=sx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Uo=Symbol.for("react.element"),Li=Symbol.for("react.portal"),Di=Symbol.for("react.fragment"),id=Symbol.for("react.strict_mode"),su=Symbol.for("react.profiler"),g_=Symbol.for("react.provider"),__=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"),Sn=Symbol.for("react.lazy"),v_=Symbol.for("react.offscreen"),Of=Symbol.iterator;function ms(e){return e===null||typeof e!="object"?null:(e=Of&&e[Of]||e["@@iterator"],typeof e=="function"?e:null)}var Ye=Object.assign,Za;function Ms(e){if(Za===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Za=t&&t[1]||""}return`
34
34
  `+Za+e}var Ja=!1;function ec(e,t){if(!e||Ja)return"";Ja=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var n=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){n=c}e.call(t.prototype)}else{try{throw Error()}catch(c){n=c}e()}}catch(c){if(c&&n&&typeof c.stack=="string"){for(var i=c.stack.split(`
35
35
  `),s=n.stack.split(`
36
36
  `),o=i.length-1,l=s.length-1;1<=o&&0<=l&&i[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==s[l]){var a=`
37
- `+i[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Ja=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Ms(e):""}function J1(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 Ri:return"Fragment";case Li: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 l_:return(e.displayName||"Context")+".Consumer";case o_: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 Sn:t=e._payload,e=e._init;try{return au(e(t))}catch{}}return null}function ex(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 zn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function c_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function tx(e){var t=c_(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qo(e){e._valueTracker||(e._valueTracker=tx(e))}function u_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=c_(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Hl(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 r=t.checked;return Ge({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Pf(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=zn(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function h_(e,t){t=t.checked,t!=null&&nd(e,"checked",t,!1)}function uu(e,t){h_(e,t);var r=zn(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?hu(e,t.type,r):t.hasOwnProperty("defaultValue")&&hu(e,t.type,zn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Lf(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function hu(e,t,r){(t!=="number"||Hl(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Is=Array.isArray;function Wi(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+zn(r),t=null,i=0;i<e.length;i++){if(e[i].value===r){e[i].selected=!0,n&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function du(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return Ge({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Rf(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(te(92));if(Is(r)){if(1<r.length)throw Error(te(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:zn(r)}}function d_(e,t){var r=zn(t.value),n=zn(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function Df(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function f_(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"?f_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Yo,p_=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,i){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(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 ro(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Hs={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},rx=["Webkit","ms","Moz","O"];Object.keys(Hs).forEach(function(e){rx.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hs[t]=Hs[e]})});function m_(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Hs.hasOwnProperty(e)&&Hs[e]?(""+t).trim():t+"px"}function g_(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=m_(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var nx=Ge({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(nx[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function mu(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 gu=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=Po(e)){if(typeof _u!="function")throw Error(te(280));var t=e.stateNode;t&&(t=Na(t),_u(e.stateNode,e.type,t))}}function __(e){Ui?Ki?Ki.push(e):Ki=[e]:Ui=e}function v_(){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 y_(e,t){return e(t)}function x_(){}var tc=!1;function S_(e,t,r){if(tc)return e(t,r);tc=!0;try{return y_(e,t,r)}finally{tc=!1,(Ui!==null||Ki!==null)&&(x_(),v_())}}function no(e,t){var r=e.stateNode;if(r===null)return null;var n=Na(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(te(231,t,typeof r));return r}var vu=!1;if(an)try{var gs={};Object.defineProperty(gs,"passive",{get:function(){vu=!0}}),window.addEventListener("test",gs,gs),window.removeEventListener("test",gs,gs)}catch{vu=!1}function ix(e,t,r,n,i,s,o,l,a){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(h){this.onError(h)}}var Ws=!1,Wl=null,Ul=!1,yu=null,sx={onError:function(e){Ws=!0,Wl=e}};function ox(e,t,r,n,i,s,o,l,a){Ws=!1,Wl=null,ix.apply(sx,arguments)}function lx(e,t,r,n,i,s,o,l,a){if(ox.apply(this,arguments),Ws){if(Ws){var c=Wl;Ws=!1,Wl=null}else throw Error(te(198));Ul||(Ul=!0,yu=c)}}function xi(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function 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 If(e){if(xi(e)!==e)throw Error(te(188))}function ax(e){var t=e.alternate;if(!t){if(t=xi(e),t===null)throw Error(te(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(i===null)break;var s=i.alternate;if(s===null){if(n=i.return,n!==null){r=n;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===r)return If(i),e;if(s===n)return If(i),t;s=s.sibling}throw Error(te(188))}if(r.return!==n.return)r=i,n=s;else{for(var o=!1,l=i.child;l;){if(l===r){o=!0,r=i,n=s;break}if(l===n){o=!0,n=i,r=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===r){o=!0,r=s,n=i;break}if(l===n){o=!0,n=s,r=i;break}l=l.sibling}if(!o)throw Error(te(189))}}if(r.alternate!==n)throw Error(te(190))}if(r.tag!==3)throw Error(te(188));return r.stateNode.current===r?e:t}function b_(e){return e=ax(e),e!==null?k_(e):null}function k_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=k_(e);if(t!==null)return t;e=e.sibling}return null}var C_=dr.unstable_scheduleCallback,Af=dr.unstable_cancelCallback,cx=dr.unstable_shouldYield,ux=dr.unstable_requestPaint,st=dr.unstable_now,hx=dr.unstable_getCurrentPriorityLevel,ad=dr.unstable_ImmediatePriority,E_=dr.unstable_UserBlockingPriority,Kl=dr.unstable_NormalPriority,dx=dr.unstable_LowPriority,T_=dr.unstable_IdlePriority,ka=null,qr=null;function fx(e){if(qr&&typeof qr.onCommitFiberRoot=="function")try{qr.onCommitFiberRoot(ka,e,void 0,(e.current.flags&128)===128)}catch{}}var Mr=Math.clz32?Math.clz32:gx,px=Math.log,mx=Math.LN2;function gx(e){return e>>>=0,e===0?32:31-(px(e)/mx|0)|0}var Xo=64,Go=4194304;function As(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 r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~i;l!==0?n=As(l):(s&=o,s!==0&&(n=As(s)))}else o=r&~i,o!==0?n=As(o):s!==0&&(n=As(s));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-Mr(t),i=1<<r,n|=e[r],t&=~i;return n}function _x(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 vx(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Mr(s),l=1<<o,a=i[o];a===-1?(!(l&r)||l&n)&&(i[o]=_x(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function xu(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function N_(){var e=Xo;return Xo<<=1,!(Xo&4194240)&&(Xo=64),e}function rc(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function To(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Mr(t),e[t]=r}function yx(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var i=31-Mr(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}function cd(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Mr(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var Me=0;function P_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var L_,ud,R_,D_,M_,Su=!1,Qo=[],Ln=null,Rn=null,Dn=null,io=new Map,so=new Map,kn=[],xx="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 Bf(e,t){switch(e){case"focusin":case"focusout":Ln=null;break;case"dragenter":case"dragleave":Rn=null;break;case"mouseover":case"mouseout":Dn=null;break;case"pointerover":case"pointerout":io.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":so.delete(t.pointerId)}}function _s(e,t,r,n,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:s,targetContainers:[i]},t!==null&&(t=Po(t),t!==null&&ud(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Sx(e,t,r,n,i){switch(t){case"focusin":return Ln=_s(Ln,e,t,r,n,i),!0;case"dragenter":return Rn=_s(Rn,e,t,r,n,i),!0;case"mouseover":return Dn=_s(Dn,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return io.set(s,_s(io.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,so.set(s,_s(so.get(s)||null,e,t,r,n,i)),!0}return!1}function I_(e){var t=ni(e.target);if(t!==null){var r=xi(t);if(r!==null){if(t=r.tag,t===13){if(t=w_(r),t!==null){e.blockedOn=t,M_(e.priority,function(){R_(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function xl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=wu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);gu=n,r.target.dispatchEvent(n),gu=null}else return t=Po(r),t!==null&&ud(t),e.blockedOn=r,!1;t.shift()}return!0}function Of(e,t,r){xl(e)&&r.delete(t)}function wx(){Su=!1,Ln!==null&&xl(Ln)&&(Ln=null),Rn!==null&&xl(Rn)&&(Rn=null),Dn!==null&&xl(Dn)&&(Dn=null),io.forEach(Of),so.forEach(Of)}function vs(e,t){e.blockedOn===t&&(e.blockedOn=null,Su||(Su=!0,dr.unstable_scheduleCallback(dr.unstable_NormalPriority,wx)))}function oo(e){function t(i){return vs(i,e)}if(0<Qo.length){vs(Qo[0],e);for(var r=1;r<Qo.length;r++){var n=Qo[r];n.blockedOn===e&&(n.blockedOn=null)}}for(Ln!==null&&vs(Ln,e),Rn!==null&&vs(Rn,e),Dn!==null&&vs(Dn,e),io.forEach(t),so.forEach(t),r=0;r<kn.length;r++)n=kn[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<kn.length&&(r=kn[0],r.blockedOn===null);)I_(r),r.blockedOn===null&&kn.shift()}var Vi=dn.ReactCurrentBatchConfig,ql=!0;function bx(e,t,r,n){var i=Me,s=Vi.transition;Vi.transition=null;try{Me=1,hd(e,t,r,n)}finally{Me=i,Vi.transition=s}}function kx(e,t,r,n){var i=Me,s=Vi.transition;Vi.transition=null;try{Me=4,hd(e,t,r,n)}finally{Me=i,Vi.transition=s}}function hd(e,t,r,n){if(ql){var i=wu(e,t,r,n);if(i===null)dc(e,t,n,Yl,r),Bf(e,n);else if(Sx(i,e,t,r,n))n.stopPropagation();else if(Bf(e,n),t&4&&-1<xx.indexOf(e)){for(;i!==null;){var s=Po(i);if(s!==null&&L_(s),s=wu(e,t,r,n),s===null&&dc(e,t,n,Yl,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else dc(e,t,n,null,r)}}var Yl=null;function wu(e,t,r,n){if(Yl=null,e=ld(n),e=ni(e),e!==null)if(t=xi(e),t===null)e=null;else if(r=t.tag,r===13){if(e=w_(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return 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(hx()){case ad:return 1;case E_:return 4;case Kl:case dx:return 16;case T_:return 536870912;default:return 16}default:return 16}}var En=null,dd=null,Sl=null;function B_(){if(Sl)return Sl;var e,t=dd,r=t.length,n,i="value"in En?En.value:En.textContent,s=i.length;for(e=0;e<r&&t[e]===i[e];e++);var o=r-e;for(n=1;n<=o&&t[r-n]===i[s-n];n++);return Sl=i.slice(e,1<n?1-n:void 0)}function wl(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 jf(){return!1}function pr(e){function t(r,n,i,s,o){this._reactName=r,this._targetInst=i,this.type=n,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Zo:jf,this.isPropagationStopped=jf,this}return Ge(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Zo)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.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=pr(os),No=Ge({},os,{view:0,detail:0}),Cx=pr(No),nc,ic,ys,Ca=Ge({},No,{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"?(nc=e.screenX-ys.screenX,ic=e.screenY-ys.screenY):ic=nc=0,ys=e),nc)},movementY:function(e){return"movementY"in e?e.movementY:ic}}),zf=pr(Ca),Ex=Ge({},Ca,{dataTransfer:0}),Tx=pr(Ex),Nx=Ge({},No,{relatedTarget:0}),sc=pr(Nx),Px=Ge({},os,{animationName:0,elapsedTime:0,pseudoElement:0}),Lx=pr(Px),Rx=Ge({},os,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Dx=pr(Rx),Mx=Ge({},os,{data:0}),Ff=pr(Mx),Ix={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ax={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"},Bx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ox(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Bx[e])?!!t[e]:!1}function pd(){return Ox}var jx=Ge({},No,{key:function(e){if(e.key){var t=Ix[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=wl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ax[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"?wl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?wl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zx=pr(jx),Fx=Ge({},Ca,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=pr(Fx),$x=Ge({},No,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pd}),Hx=pr($x),Wx=Ge({},os,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ux=pr(Wx),Kx=Ge({},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}),Vx=pr(Kx),qx=[9,13,27,32],md=an&&"CompositionEvent"in window,Us=null;an&&"documentMode"in document&&(Us=document.documentMode);var Yx=an&&"TextEvent"in window&&!Us,O_=an&&(!md||Us&&8<Us&&11>=Us),Hf=" ",Wf=!1;function j_(e,t){switch(e){case"keyup":return qx.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function z_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Di=!1;function Xx(e,t){switch(e){case"compositionend":return z_(t);case"keypress":return t.which!==32?null:(Wf=!0,Hf);case"textInput":return e=t.data,e===Hf&&Wf?null:e;default:return null}}function Gx(e,t){if(Di)return e==="compositionend"||!md&&j_(e,t)?(e=B_(),Sl=dd=En=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 O_&&t.locale!=="ko"?null:t.data;default:return null}}var Qx={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"?!!Qx[e.type]:t==="textarea"}function F_(e,t,r,n){__(n),t=Xl(t,"onChange"),0<t.length&&(r=new fd("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Ks=null,lo=null;function Zx(e){Q_(e,0)}function Ea(e){var t=Ai(e);if(u_(t))return e}function Jx(e,t){if(e==="change")return t}var $_=!1;if(an){var oc;if(an){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;$_=oc&&(!document.documentMode||9<document.documentMode)}function Vf(){Ks&&(Ks.detachEvent("onpropertychange",H_),lo=Ks=null)}function H_(e){if(e.propertyName==="value"&&Ea(lo)){var t=[];F_(t,lo,e,ld(e)),S_(Zx,t)}}function eS(e,t,r){e==="focusin"?(Vf(),Ks=t,lo=r,Ks.attachEvent("onpropertychange",H_)):e==="focusout"&&Vf()}function tS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ea(lo)}function rS(e,t){if(e==="click")return Ea(t)}function nS(e,t){if(e==="input"||e==="change")return Ea(t)}function iS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Br=typeof Object.is=="function"?Object.is:iS;function ao(e,t){if(Br(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var i=r[n];if(!iu.call(t,i)||!Br(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 r=qf(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=qf(r)}}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 U_(){for(var e=window,t=Hl();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Hl(e.document)}return t}function gd(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 sS(e){var t=U_(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&W_(r.ownerDocument.documentElement,r)){if(n!==null&&gd(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=Yf(r,s);var o=Yf(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var oS=an&&"documentMode"in document&&11>=document.documentMode,Mi=null,bu=null,Vs=null,ku=!1;function Xf(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ku||Mi==null||Mi!==Hl(n)||(n=Mi,"selectionStart"in n&&gd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Vs&&ao(Vs,n)||(Vs=n,n=Xl(bu,"onSelect"),0<n.length&&(t=new fd("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Mi)))}function Jo(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Ii={animationend:Jo("Animation","AnimationEnd"),animationiteration:Jo("Animation","AnimationIteration"),animationstart:Jo("Animation","AnimationStart"),transitionend:Jo("Transition","TransitionEnd")},ac={},K_={};an&&(K_=document.createElement("div").style,"AnimationEvent"in window||(delete Ii.animationend.animation,delete Ii.animationiteration.animation,delete Ii.animationstart.animation),"TransitionEvent"in window||delete Ii.transitionend.transition);function Ta(e){if(ac[e])return ac[e];if(!Ii[e])return e;var t=Ii[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in K_)return ac[e]=t[r];return e}var V_=Ta("animationend"),q_=Ta("animationiteration"),Y_=Ta("animationstart"),X_=Ta("transitionend"),G_=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 $n(e,t){G_.set(e,t),yi(t,[e])}for(var cc=0;cc<Gf.length;cc++){var uc=Gf[cc],lS=uc.toLowerCase(),aS=uc[0].toUpperCase()+uc.slice(1);$n(lS,"on"+aS)}$n(V_,"onAnimationEnd");$n(q_,"onAnimationIteration");$n(Y_,"onAnimationStart");$n("dblclick","onDoubleClick");$n("focusin","onFocus");$n("focusout","onBlur");$n(X_,"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 Bs="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(" "),cS=new Set("cancel close invalid load scroll toggle".split(" ").concat(Bs));function Qf(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,lx(n,t,void 0,e),e.currentTarget=null}function Q_(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var s=void 0;if(t)for(var o=n.length-1;0<=o;o--){var l=n[o],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==s&&i.isPropagationStopped())break e;Qf(i,l,c),s=a}else for(o=0;o<n.length;o++){if(l=n[o],a=l.instance,c=l.currentTarget,l=l.listener,a!==s&&i.isPropagationStopped())break e;Qf(i,l,c),s=a}}}if(Ul)throw e=yu,Ul=!1,yu=null,e}function ze(e,t){var r=t[Pu];r===void 0&&(r=t[Pu]=new Set);var n=e+"__bubble";r.has(n)||(Z_(t,e,2,!1),r.add(n))}function hc(e,t,r){var n=0;t&&(n|=4),Z_(r,e,n,t)}var el="_reactListening"+Math.random().toString(36).slice(2);function co(e){if(!e[el]){e[el]=!0,s_.forEach(function(r){r!=="selectionchange"&&(cS.has(r)||hc(r,!1,e),hc(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[el]||(t[el]=!0,hc("selectionchange",!1,t))}}function Z_(e,t,r,n){switch(A_(t)){case 1:var i=bx;break;case 4:i=kx;break;default:i=hd}r=i.bind(null,t,r,e),i=void 0,!vu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),n?i!==void 0?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):i!==void 0?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function dc(e,t,r,n,i){var s=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=n.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===i||a.nodeType===8&&a.parentNode===i))return;o=o.return}for(;l!==null;){if(o=ni(l),o===null)return;if(a=o.tag,a===5||a===6){n=s=o;continue e}l=l.parentNode}}n=n.return}S_(function(){var c=s,h=ld(r),u=[];e:{var d=G_.get(e);if(d!==void 0){var f=fd,m=e;switch(e){case"keypress":if(wl(r)===0)break e;case"keydown":case"keyup":f=zx;break;case"focusin":m="focus",f=sc;break;case"focusout":m="blur",f=sc;break;case"beforeblur":case"afterblur":f=sc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=zf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=Tx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=Hx;break;case V_:case q_:case Y_:f=Lx;break;case X_:f=Ux;break;case"scroll":f=Cx;break;case"wheel":f=Vx;break;case"copy":case"cut":case"paste":f=Dx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=$f}var g=(t&4)!==0,x=!g&&e==="scroll",_=g?d!==null?d+"Capture":null:d;g=[];for(var v=c,y;v!==null;){y=v;var E=y.stateNode;if(y.tag===5&&E!==null&&(y=E,_!==null&&(E=no(v,_),E!=null&&g.push(uo(v,E,y)))),x)break;v=v.return}0<g.length&&(d=new f(d,m,null,r,h),u.push({event:d,listeners:g}))}}if(!(t&7)){e:{if(d=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",d&&r!==gu&&(m=r.relatedTarget||r.fromElement)&&(ni(m)||m[cn]))break e;if((f||d)&&(d=h.window===h?h:(d=h.ownerDocument)?d.defaultView||d.parentWindow:window,f?(m=r.relatedTarget||r.toElement,f=c,m=m?ni(m):null,m!==null&&(x=xi(m),m!==x||m.tag!==5&&m.tag!==6)&&(m=null)):(f=null,m=c),f!==m)){if(g=zf,E="onMouseLeave",_="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(g=$f,E="onPointerLeave",_="onPointerEnter",v="pointer"),x=f==null?d:Ai(f),y=m==null?d:Ai(m),d=new g(E,v+"leave",f,r,h),d.target=x,d.relatedTarget=y,E=null,ni(h)===c&&(g=new g(_,v+"enter",m,r,h),g.target=y,g.relatedTarget=x,E=g),x=E,f&&m)t:{for(g=f,_=m,v=0,y=g;y;y=Ci(y))v++;for(y=0,E=_;E;E=Ci(E))y++;for(;0<v-y;)g=Ci(g),v--;for(;0<y-v;)_=Ci(_),y--;for(;v--;){if(g===_||_!==null&&g===_.alternate)break t;g=Ci(g),_=Ci(_)}g=null}else g=null;f!==null&&Zf(u,d,f,g,!1),m!==null&&x!==null&&Zf(u,x,m,g,!0)}}e:{if(d=c?Ai(c):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var N=Jx;else if(Uf(d))if($_)N=nS;else{N=tS;var k=eS}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(N=rS);if(N&&(N=N(e,c))){F_(u,N,r,h);break e}k&&k(e,d,c),e==="focusout"&&(k=d._wrapperState)&&k.controlled&&d.type==="number"&&hu(d,"number",d.value)}switch(k=c?Ai(c):window,e){case"focusin":(Uf(k)||k.contentEditable==="true")&&(Mi=k,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,r,h);break;case"selectionchange":if(oS)break;case"keydown":case"keyup":Xf(u,r,h)}var I;if(md)e:{switch(e){case"compositionstart":var z="onCompositionStart";break e;case"compositionend":z="onCompositionEnd";break e;case"compositionupdate":z="onCompositionUpdate";break e}z=void 0}else Di?j_(e,r)&&(z="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(z="onCompositionStart");z&&(O_&&r.locale!=="ko"&&(Di||z!=="onCompositionStart"?z==="onCompositionEnd"&&Di&&(I=B_()):(En=h,dd="value"in En?En.value:En.textContent,Di=!0)),k=Xl(c,z),0<k.length&&(z=new Ff(z,e,null,r,h),u.push({event:z,listeners:k}),I?z.data=I:(I=z_(r),I!==null&&(z.data=I)))),(I=Yx?Xx(e,r):Gx(e,r))&&(c=Xl(c,"onBeforeInput"),0<c.length&&(h=new Ff("onBeforeInput","beforeinput",null,r,h),u.push({event:h,listeners:c}),h.data=I))}Q_(u,t)})}function uo(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Xl(e,t){for(var r=t+"Capture",n=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=no(e,r),s!=null&&n.unshift(uo(e,s,i)),s=no(e,t),s!=null&&n.push(uo(e,s,i))),e=e.return}return n}function Ci(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Zf(e,t,r,n,i){for(var s=t._reactName,o=[];r!==null&&r!==n;){var l=r,a=l.alternate,c=l.stateNode;if(a!==null&&a===n)break;l.tag===5&&c!==null&&(l=c,i?(a=no(r,s),a!=null&&o.unshift(uo(r,a,l))):i||(a=no(r,s),a!=null&&o.push(uo(r,a,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var uS=/\r\n?/g,hS=/\u0000|\uFFFD/g;function Jf(e){return(typeof e=="string"?e:""+e).replace(uS,`
38
- `).replace(hS,"")}function tl(e,t,r){if(t=Jf(t),Jf(e)!==t&&r)throw Error(te(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 Nu=typeof setTimeout=="function"?setTimeout:void 0,dS=typeof clearTimeout=="function"?clearTimeout:void 0,ep=typeof Promise=="function"?Promise:void 0,fS=typeof queueMicrotask=="function"?queueMicrotask:typeof ep<"u"?function(e){return ep.resolve(null).then(e).catch(pS)}:Nu;function pS(e){setTimeout(function(){throw e})}function fc(e,t){var r=t,n=0;do{var i=r.nextSibling;if(e.removeChild(r),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(n===0){e.removeChild(i),oo(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);oo(t)}function Mn(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 r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var ls=Math.random().toString(36).slice(2),Kr="__reactFiber$"+ls,ho="__reactProps$"+ls,cn="__reactContainer$"+ls,Pu="__reactEvents$"+ls,mS="__reactListeners$"+ls,gS="__reactHandles$"+ls;function ni(e){var t=e[Kr];if(t)return t;for(var r=e.parentNode;r;){if(t=r[cn]||r[Kr]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=tp(e);e!==null;){if(r=e[Kr])return r;e=tp(e)}return t}e=r,r=e.parentNode}return null}function Po(e){return e=e[Kr]||e[cn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ai(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function Na(e){return e[ho]||null}var Lu=[],Bi=-1;function Hn(e){return{current:e}}function $e(e){0>Bi||(e.current=Lu[Bi],Lu[Bi]=null,Bi--)}function Oe(e,t){Bi++,Lu[Bi]=e.current,e.current=t}var Fn={},At=Hn(Fn),er=Hn(!1),hi=Fn;function Qi(e,t){var r=e.type.contextTypes;if(!r)return Fn;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function tr(e){return e=e.childContextTypes,e!=null}function Ql(){$e(er),$e(At)}function rp(e,t,r){if(At.current!==Fn)throw Error(te(168));Oe(At,t),Oe(er,r)}function J_(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(te(108,ex(e)||"Unknown",i));return Ge({},r,n)}function Zl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Fn,hi=At.current,Oe(At,e),Oe(er,er.current),!0}function np(e,t,r){var n=e.stateNode;if(!n)throw Error(te(169));r?(e=J_(e,t,hi),n.__reactInternalMemoizedMergedChildContext=e,$e(er),$e(At),Oe(At,e)):$e(er),Oe(er,r)}var tn=null,Pa=!1,pc=!1;function ev(e){tn===null?tn=[e]:tn.push(e)}function _S(e){Pa=!0,ev(e)}function Wn(){if(!pc&&tn!==null){pc=!0;var e=0,t=Me;try{var r=tn;for(Me=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}tn=null,Pa=!1}catch(i){throw tn!==null&&(tn=tn.slice(e+1)),C_(ad,Wn),i}finally{Me=t,pc=!1}}return null}var Oi=[],ji=0,Jl=null,ea=0,yr=[],xr=0,di=null,nn=1,sn="";function Gn(e,t){Oi[ji++]=ea,Oi[ji++]=Jl,Jl=e,ea=t}function tv(e,t,r){yr[xr++]=nn,yr[xr++]=sn,yr[xr++]=di,di=e;var n=nn;e=sn;var i=32-Mr(n)-1;n&=~(1<<i),r+=1;var s=32-Mr(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,nn=1<<32-Mr(t)+i|r<<i|n,sn=s+e}else nn=1<<s|r<<i|n,sn=e}function _d(e){e.return!==null&&(Gn(e,1),tv(e,1,0))}function vd(e){for(;e===Jl;)Jl=Oi[--ji],Oi[ji]=null,ea=Oi[--ji],Oi[ji]=null;for(;e===di;)di=yr[--xr],yr[xr]=null,sn=yr[--xr],yr[xr]=null,nn=yr[--xr],yr[xr]=null}var ur=null,cr=null,He=!1,Rr=null;function rv(e,t){var r=wr(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function ip(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,ur=e,cr=Mn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ur=e,cr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=di!==null?{id:nn,overflow:sn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=wr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,ur=e,cr=null,!0):!1;default:return!1}}function Ru(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Du(e){if(He){var t=cr;if(t){var r=t;if(!ip(e,t)){if(Ru(e))throw Error(te(418));t=Mn(r.nextSibling);var n=ur;t&&ip(e,t)?rv(n,r):(e.flags=e.flags&-4097|2,He=!1,ur=e)}}else{if(Ru(e))throw Error(te(418));e.flags=e.flags&-4097|2,He=!1,ur=e}}}function sp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ur=e}function rl(e){if(e!==ur)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=cr)){if(Ru(e))throw nv(),Error(te(418));for(;t;)rv(e,t),t=Mn(t.nextSibling)}if(sp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){cr=Mn(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}cr=null}}else cr=ur?Mn(e.stateNode.nextSibling):null;return!0}function nv(){for(var e=cr;e;)e=Mn(e.nextSibling)}function Zi(){cr=ur=null,He=!1}function yd(e){Rr===null?Rr=[e]:Rr.push(e)}var vS=dn.ReactCurrentBatchConfig;function xs(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(te(309));var n=r.stateNode}if(!n)throw Error(te(147,e));var i=n,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(te(284));if(!r._owner)throw Error(te(290,e))}return e}function nl(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function op(e){var t=e._init;return t(e._payload)}function iv(e){function t(_,v){if(e){var y=_.deletions;y===null?(_.deletions=[v],_.flags|=16):y.push(v)}}function r(_,v){if(!e)return null;for(;v!==null;)t(_,v),v=v.sibling;return null}function n(_,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 _=On(_,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=Sc(y,_.mode,E),v.return=_,v):(v=i(v,y),v.return=_,v)}function a(_,v,y,E){var N=y.type;return N===Ri?h(_,v,y.props.children,E,y.key):v!==null&&(v.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Sn&&op(N)===v.type)?(E=i(v,y.props),E.ref=xs(_,v,y),E.return=_,E):(E=Pl(y.type,y.key,y.props,null,_.mode,E),E.ref=xs(_,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=wc(y,_.mode,E),v.return=_,v):(v=i(v,y.children||[]),v.return=_,v)}function h(_,v,y,E,N){return v===null||v.tag!==7?(v=ai(y,_.mode,E,N),v.return=_,v):(v=i(v,y),v.return=_,v)}function u(_,v,y){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Sc(""+v,_.mode,y),v.return=_,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Vo:return y=Pl(v.type,v.key,v.props,null,_.mode,y),y.ref=xs(_,null,v),y.return=_,y;case Li:return v=wc(v,_.mode,y),v.return=_,v;case Sn:var E=v._init;return u(_,E(v._payload),y)}if(Is(v)||ms(v))return v=ai(v,_.mode,y,null),v.return=_,v;nl(_,v)}return null}function d(_,v,y,E){var N=v!==null?v.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return N!==null?null:l(_,v,""+y,E);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Vo:return y.key===N?a(_,v,y,E):null;case Li:return y.key===N?c(_,v,y,E):null;case Sn:return N=y._init,d(_,v,N(y._payload),E)}if(Is(y)||ms(y))return N!==null?null:h(_,v,y,E,null);nl(_,y)}return null}function f(_,v,y,E,N){if(typeof E=="string"&&E!==""||typeof E=="number")return _=_.get(y)||null,l(v,_,""+E,N);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case Vo:return _=_.get(E.key===null?y:E.key)||null,a(v,_,E,N);case Li:return _=_.get(E.key===null?y:E.key)||null,c(v,_,E,N);case Sn:var k=E._init;return f(_,v,y,k(E._payload),N)}if(Is(E)||ms(E))return _=_.get(y)||null,h(v,_,E,N,null);nl(v,E)}return null}function m(_,v,y,E){for(var N=null,k=null,I=v,z=v=0,Z=null;I!==null&&z<y.length;z++){I.index>z?(Z=I,I=null):Z=I.sibling;var T=d(_,I,y[z],E);if(T===null){I===null&&(I=Z);break}e&&I&&T.alternate===null&&t(_,I),v=s(T,v,z),k===null?N=T:k.sibling=T,k=T,I=Z}if(z===y.length)return r(_,I),He&&Gn(_,z),N;if(I===null){for(;z<y.length;z++)I=u(_,y[z],E),I!==null&&(v=s(I,v,z),k===null?N=I:k.sibling=I,k=I);return He&&Gn(_,z),N}for(I=n(_,I);z<y.length;z++)Z=f(I,_,z,y[z],E),Z!==null&&(e&&Z.alternate!==null&&I.delete(Z.key===null?z:Z.key),v=s(Z,v,z),k===null?N=Z:k.sibling=Z,k=Z);return e&&I.forEach(function(R){return t(_,R)}),He&&Gn(_,z),N}function g(_,v,y,E){var N=ms(y);if(typeof N!="function")throw Error(te(150));if(y=N.call(y),y==null)throw Error(te(151));for(var k=N=null,I=v,z=v=0,Z=null,T=y.next();I!==null&&!T.done;z++,T=y.next()){I.index>z?(Z=I,I=null):Z=I.sibling;var R=d(_,I,T.value,E);if(R===null){I===null&&(I=Z);break}e&&I&&R.alternate===null&&t(_,I),v=s(R,v,z),k===null?N=R:k.sibling=R,k=R,I=Z}if(T.done)return r(_,I),He&&Gn(_,z),N;if(I===null){for(;!T.done;z++,T=y.next())T=u(_,T.value,E),T!==null&&(v=s(T,v,z),k===null?N=T:k.sibling=T,k=T);return He&&Gn(_,z),N}for(I=n(_,I);!T.done;z++,T=y.next())T=f(I,_,z,T.value,E),T!==null&&(e&&T.alternate!==null&&I.delete(T.key===null?z:T.key),v=s(T,v,z),k===null?N=T:k.sibling=T,k=T);return e&&I.forEach(function(A){return t(_,A)}),He&&Gn(_,z),N}function x(_,v,y,E){if(typeof y=="object"&&y!==null&&y.type===Ri&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Vo:e:{for(var N=y.key,k=v;k!==null;){if(k.key===N){if(N=y.type,N===Ri){if(k.tag===7){r(_,k.sibling),v=i(k,y.props.children),v.return=_,_=v;break e}}else if(k.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Sn&&op(N)===k.type){r(_,k.sibling),v=i(k,y.props),v.ref=xs(_,k,y),v.return=_,_=v;break e}r(_,k);break}else t(_,k);k=k.sibling}y.type===Ri?(v=ai(y.props.children,_.mode,E,y.key),v.return=_,_=v):(E=Pl(y.type,y.key,y.props,null,_.mode,E),E.ref=xs(_,v,y),E.return=_,_=E)}return o(_);case Li:e:{for(k=y.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){r(_,v.sibling),v=i(v,y.children||[]),v.return=_,_=v;break e}else{r(_,v);break}else t(_,v);v=v.sibling}v=wc(y,_.mode,E),v.return=_,_=v}return o(_);case Sn:return k=y._init,x(_,v,k(y._payload),E)}if(Is(y))return m(_,v,y,E);if(ms(y))return g(_,v,y,E);nl(_,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(r(_,v.sibling),v=i(v,y),v.return=_,_=v):(r(_,v),v=Sc(y,_.mode,E),v.return=_,_=v),o(_)):r(_,v)}return x}var Ji=iv(!0),sv=iv(!1),ta=Hn(null),ra=null,zi=null,xd=null;function Sd(){xd=zi=ra=null}function wd(e){var t=ta.current;$e(ta),e._currentValue=t}function Mu(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function qi(e,t){ra=e,xd=zi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Jt=!0),e.firstContext=null)}function Cr(e){var t=e._currentValue;if(xd!==e)if(e={context:e,memoizedValue:t,next:null},zi===null){if(ra===null)throw Error(te(308));zi=e,ra.dependencies={lanes:0,firstContext:e}}else zi=zi.next=e;return t}var ii=null;function bd(e){ii===null?ii=[e]:ii.push(e)}function ov(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,bd(t)):(r.next=i.next,i.next=r),t.interleaved=r,un(e,n)}function un(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var wn=!1;function kd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lv(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 ln(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function In(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Re&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,un(e,r)}return i=n.interleaved,i===null?(t.next=t,bd(n)):(t.next=i.next,i.next=t),n.interleaved=t,un(e,r)}function bl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,cd(e,r)}}function lp(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=t:s=s.next=t}else i=s=t;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function na(e,t,r,n){var i=e.updateQueue;wn=!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((n&d)===d){h!==null&&(h=h.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,g=l;switch(d=t,f=r,g.tag){case 1:if(m=g.payload,typeof m=="function"){u=m.call(f,u,d);break e}u=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,d=typeof m=="function"?m.call(f,u,d):m,d==null)break e;u=Ge({},u,d);break e;case 2:wn=!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,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(i!==null){if(n.callback=null,n=r,typeof i!="function")throw Error(te(191,i));i.call(n)}}}var Lo={},Yr=Hn(Lo),fo=Hn(Lo),po=Hn(Lo);function si(e){if(e===Lo)throw Error(te(174));return e}function Cd(e,t){switch(Oe(po,t),Oe(fo,e),Oe(Yr,Lo),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)}$e(Yr),Oe(Yr,t)}function es(){$e(Yr),$e(fo),$e(po)}function av(e){si(po.current);var t=si(Yr.current),r=fu(t,e.type);t!==r&&(Oe(fo,e),Oe(Yr,r))}function Ed(e){fo.current===e&&($e(Yr),$e(fo))}var Ye=Hn(0);function ia(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var mc=[];function Td(){for(var e=0;e<mc.length;e++)mc[e]._workInProgressVersionPrimary=null;mc.length=0}var kl=dn.ReactCurrentDispatcher,gc=dn.ReactCurrentBatchConfig,fi=0,Xe=null,ft=null,vt=null,sa=!1,qs=!1,mo=0,yS=0;function Lt(){throw Error(te(321))}function Nd(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Br(e[r],t[r]))return!1;return!0}function Pd(e,t,r,n,i,s){if(fi=s,Xe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,kl.current=e===null||e.memoizedState===null?bS:kS,e=r(n,i),qs){s=0;do{if(qs=!1,mo=0,25<=s)throw Error(te(301));s+=1,vt=ft=null,t.updateQueue=null,kl.current=CS,e=r(n,i)}while(qs)}if(kl.current=oa,t=ft!==null&&ft.next!==null,fi=0,vt=ft=Xe=null,sa=!1,t)throw Error(te(300));return e}function Ld(){var e=mo!==0;return mo=0,e}function Hr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?Xe.memoizedState=vt=e:vt=vt.next=e,vt}function Er(){if(ft===null){var e=Xe.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var t=vt===null?Xe.memoizedState:vt.next;if(t!==null)vt=t,ft=e;else{if(e===null)throw Error(te(310));ft=e,e={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},vt===null?Xe.memoizedState=vt=e:vt=vt.next=e}return vt}function go(e,t){return typeof t=="function"?t(e):t}function _c(e){var t=Er(),r=t.queue;if(r===null)throw Error(te(311));r.lastRenderedReducer=e;var n=ft,i=n.baseQueue,s=r.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}n.baseQueue=i=s,r.pending=null}if(i!==null){s=i.next,n=n.baseState;var l=o=null,a=null,c=s;do{var h=c.lane;if((fi&h)===h)a!==null&&(a=a.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),n=c.hasEagerState?c.eagerState:e(n,c.action);else{var u={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=u,o=n):a=a.next=u,Xe.lanes|=h,pi|=h}c=c.next}while(c!==null&&c!==s);a===null?o=n:a.next=l,Br(n,t.memoizedState)||(Jt=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=a,r.lastRenderedState=n}if(e=r.interleaved,e!==null){i=e;do s=i.lane,Xe.lanes|=s,pi|=s,i=i.next;while(i!==e)}else i===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function vc(e){var t=Er(),r=t.queue;if(r===null)throw Error(te(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,s=t.memoizedState;if(i!==null){r.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);Br(s,t.memoizedState)||(Jt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function cv(){}function uv(e,t){var r=Xe,n=Er(),i=t(),s=!Br(n.memoizedState,i);if(s&&(n.memoizedState=i,Jt=!0),n=n.queue,Rd(fv.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||vt!==null&&vt.memoizedState.tag&1){if(r.flags|=2048,_o(9,dv.bind(null,r,n,i,t),void 0,null),wt===null)throw Error(te(349));fi&30||hv(r,t,i)}return i}function hv(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Xe.updateQueue,t===null?(t={lastEffect:null,stores:null},Xe.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function dv(e,t,r,n){t.value=r,t.getSnapshot=n,pv(t)&&mv(e)}function fv(e,t,r){return r(function(){pv(t)&&mv(e)})}function pv(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Br(e,r)}catch{return!0}}function mv(e){var t=un(e,1);t!==null&&Ir(t,e,1,-1)}function cp(e){var t=Hr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:go,lastRenderedState:e},t.queue=e,e=e.dispatch=wS.bind(null,Xe,e),[t.memoizedState,e]}function _o(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=Xe.updateQueue,t===null?(t={lastEffect:null,stores:null},Xe.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function gv(){return Er().memoizedState}function Cl(e,t,r,n){var i=Hr();Xe.flags|=e,i.memoizedState=_o(1|t,r,void 0,n===void 0?null:n)}function La(e,t,r,n){var i=Er();n=n===void 0?null:n;var s=void 0;if(ft!==null){var o=ft.memoizedState;if(s=o.destroy,n!==null&&Nd(n,o.deps)){i.memoizedState=_o(t,r,s,n);return}}Xe.flags|=e,i.memoizedState=_o(1|t,r,s,n)}function up(e,t){return Cl(8390656,8,e,t)}function Rd(e,t){return La(2048,8,e,t)}function _v(e,t){return La(4,2,e,t)}function vv(e,t){return La(4,4,e,t)}function yv(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 xv(e,t,r){return r=r!=null?r.concat([e]):null,La(4,4,yv.bind(null,t,e),r)}function Dd(){}function Sv(e,t){var r=Er();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Nd(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function wv(e,t){var r=Er();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Nd(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function bv(e,t,r){return fi&21?(Br(r,t)||(r=N_(),Xe.lanes|=r,pi|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Jt=!0),e.memoizedState=r)}function xS(e,t){var r=Me;Me=r!==0&&4>r?r:4,e(!0);var n=gc.transition;gc.transition={};try{e(!1),t()}finally{Me=r,gc.transition=n}}function kv(){return Er().memoizedState}function SS(e,t,r){var n=Bn(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Cv(e))Ev(t,r);else if(r=ov(e,t,r,n),r!==null){var i=Ht();Ir(r,e,n,i),Tv(r,t,n)}}function wS(e,t,r){var n=Bn(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Cv(e))Ev(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,r);if(i.hasEagerState=!0,i.eagerState=l,Br(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{}r=ov(e,t,i,n),r!==null&&(i=Ht(),Ir(r,e,n,i),Tv(r,t,n))}}function Cv(e){var t=e.alternate;return e===Xe||t!==null&&t===Xe}function Ev(e,t){qs=sa=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Tv(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,cd(e,r)}}var oa={readContext:Cr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},bS={readContext:Cr,useCallback:function(e,t){return Hr().memoizedState=[e,t===void 0?null:t],e},useContext:Cr,useEffect:up,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Cl(4194308,4,yv.bind(null,t,e),r)},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 r=Hr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Hr();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=SS.bind(null,Xe,e),[n.memoizedState,e]},useRef:function(e){var t=Hr();return e={current:e},t.memoizedState=e},useState:cp,useDebugValue:Dd,useDeferredValue:function(e){return Hr().memoizedState=e},useTransition:function(){var e=cp(!1),t=e[0];return e=xS.bind(null,e[1]),Hr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Xe,i=Hr();if(He){if(r===void 0)throw Error(te(407));r=r()}else{if(r=t(),wt===null)throw Error(te(349));fi&30||hv(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,up(fv.bind(null,n,s,e),[e]),n.flags|=2048,_o(9,dv.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=Hr(),t=wt.identifierPrefix;if(He){var r=sn,n=nn;r=(n&~(1<<32-Mr(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=mo++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=yS++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},kS={readContext:Cr,useCallback:Sv,useContext:Cr,useEffect:Rd,useImperativeHandle:xv,useInsertionEffect:_v,useLayoutEffect:vv,useMemo:wv,useReducer:_c,useRef:gv,useState:function(){return _c(go)},useDebugValue:Dd,useDeferredValue:function(e){var t=Er();return bv(t,ft.memoizedState,e)},useTransition:function(){var e=_c(go)[0],t=Er().memoizedState;return[e,t]},useMutableSource:cv,useSyncExternalStore:uv,useId:kv,unstable_isNewReconciler:!1},CS={readContext:Cr,useCallback:Sv,useContext:Cr,useEffect:Rd,useImperativeHandle:xv,useInsertionEffect:_v,useLayoutEffect:vv,useMemo:wv,useReducer:vc,useRef:gv,useState:function(){return vc(go)},useDebugValue:Dd,useDeferredValue:function(e){var t=Er();return ft===null?t.memoizedState=e:bv(t,ft.memoizedState,e)},useTransition:function(){var e=vc(go)[0],t=Er().memoizedState;return[e,t]},useMutableSource:cv,useSyncExternalStore:uv,useId:kv,unstable_isNewReconciler:!1};function Pr(e,t){if(e&&e.defaultProps){t=Ge({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Iu(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:Ge({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Ra={isMounted:function(e){return(e=e._reactInternals)?xi(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Ht(),i=Bn(e),s=ln(n,i);s.payload=t,r!=null&&(s.callback=r),t=In(e,s,i),t!==null&&(Ir(t,e,i,n),bl(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Ht(),i=Bn(e),s=ln(n,i);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=In(e,s,i),t!==null&&(Ir(t,e,i,n),bl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Ht(),n=Bn(e),i=ln(r,n);i.tag=2,t!=null&&(i.callback=t),t=In(e,i,n),t!==null&&(Ir(t,e,n,r),bl(t,e,n))}};function hp(e,t,r,n,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,s,o):t.prototype&&t.prototype.isPureReactComponent?!ao(r,n)||!ao(i,s):!0}function Nv(e,t,r){var n=!1,i=Fn,s=t.contextType;return typeof s=="object"&&s!==null?s=Cr(s):(i=tr(t)?hi:At.current,n=t.contextTypes,s=(n=n!=null)?Qi(e,i):Fn),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ra,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function dp(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&Ra.enqueueReplaceState(t,t.state,null)}function Au(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs={},kd(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Cr(s):(s=tr(t)?hi:At.current,i.context=Qi(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Iu(e,t,s,r),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Ra.enqueueReplaceState(i,i.state,null),na(e,r,i,n),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function ts(e,t){try{var r="",n=t;do r+=J1(n),n=n.return;while(n);var i=r}catch(s){i=`
37
+ `+i[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Ja=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Ms(e):""}function ux(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 Di:return"Fragment";case Li: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 __:return(e.displayName||"Context")+".Consumer";case g_: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 Sn:t=e._payload,e=e._init;try{return au(e(t))}catch{}}return null}function hx(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 zn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function y_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dx(e){var t=y_(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ko(e){e._valueTracker||(e._valueTracker=dx(e))}function x_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=y_(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Fl(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 r=t.checked;return Ye({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function jf(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=zn(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function S_(e,t){t=t.checked,t!=null&&nd(e,"checked",t,!1)}function uu(e,t){S_(e,t);var r=zn(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?hu(e,t.type,r):t.hasOwnProperty("defaultValue")&&hu(e,t.type,zn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function zf(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function hu(e,t,r){(t!=="number"||Fl(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Is=Array.isArray;function Wi(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+zn(r),t=null,i=0;i<e.length;i++){if(e[i].value===r){e[i].selected=!0,n&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function du(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return Ye({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ff(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(te(92));if(Is(r)){if(1<r.length)throw Error(te(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:zn(r)}}function w_(e,t){var r=zn(t.value),n=zn(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function $f(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function b_(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"?b_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Vo,k_=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,i){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Vo=Vo||document.createElement("div"),Vo.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Vo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ro(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Hs={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},fx=["Webkit","ms","Moz","O"];Object.keys(Hs).forEach(function(e){fx.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hs[t]=Hs[e]})});function C_(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Hs.hasOwnProperty(e)&&Hs[e]?(""+t).trim():t+"px"}function E_(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=C_(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var px=Ye({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(px[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function mu(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 gu=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 Hf(e){if(e=Po(e)){if(typeof _u!="function")throw Error(te(280));var t=e.stateNode;t&&(t=Ea(t),_u(e.stateNode,e.type,t))}}function N_(e){Ui?Ki?Ki.push(e):Ki=[e]:Ui=e}function T_(){if(Ui){var e=Ui,t=Ki;if(Ki=Ui=null,Hf(e),t)for(e=0;e<t.length;e++)Hf(t[e])}}function P_(e,t){return e(t)}function L_(){}var tc=!1;function D_(e,t,r){if(tc)return e(t,r);tc=!0;try{return P_(e,t,r)}finally{tc=!1,(Ui!==null||Ki!==null)&&(L_(),T_())}}function no(e,t){var r=e.stateNode;if(r===null)return null;var n=Ea(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(te(231,t,typeof r));return r}var vu=!1;if(ln)try{var gs={};Object.defineProperty(gs,"passive",{get:function(){vu=!0}}),window.addEventListener("test",gs,gs),window.removeEventListener("test",gs,gs)}catch{vu=!1}function mx(e,t,r,n,i,s,o,l,a){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(h){this.onError(h)}}var Ws=!1,$l=null,Hl=!1,yu=null,gx={onError:function(e){Ws=!0,$l=e}};function _x(e,t,r,n,i,s,o,l,a){Ws=!1,$l=null,mx.apply(gx,arguments)}function vx(e,t,r,n,i,s,o,l,a){if(_x.apply(this,arguments),Ws){if(Ws){var c=$l;Ws=!1,$l=null}else throw Error(te(198));Hl||(Hl=!0,yu=c)}}function yi(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function R_(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 Wf(e){if(yi(e)!==e)throw Error(te(188))}function yx(e){var t=e.alternate;if(!t){if(t=yi(e),t===null)throw Error(te(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(i===null)break;var s=i.alternate;if(s===null){if(n=i.return,n!==null){r=n;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===r)return Wf(i),e;if(s===n)return Wf(i),t;s=s.sibling}throw Error(te(188))}if(r.return!==n.return)r=i,n=s;else{for(var o=!1,l=i.child;l;){if(l===r){o=!0,r=i,n=s;break}if(l===n){o=!0,n=i,r=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===r){o=!0,r=s,n=i;break}if(l===n){o=!0,n=s,r=i;break}l=l.sibling}if(!o)throw Error(te(189))}}if(r.alternate!==n)throw Error(te(190))}if(r.tag!==3)throw Error(te(188));return r.stateNode.current===r?e:t}function M_(e){return e=yx(e),e!==null?I_(e):null}function I_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=I_(e);if(t!==null)return t;e=e.sibling}return null}var A_=lr.unstable_scheduleCallback,Uf=lr.unstable_cancelCallback,xx=lr.unstable_shouldYield,Sx=lr.unstable_requestPaint,tt=lr.unstable_now,wx=lr.unstable_getCurrentPriorityLevel,ad=lr.unstable_ImmediatePriority,B_=lr.unstable_UserBlockingPriority,Wl=lr.unstable_NormalPriority,bx=lr.unstable_LowPriority,O_=lr.unstable_IdlePriority,wa=null,qr=null;function kx(e){if(qr&&typeof qr.onCommitFiberRoot=="function")try{qr.onCommitFiberRoot(wa,e,void 0,(e.current.flags&128)===128)}catch{}}var Rr=Math.clz32?Math.clz32:Nx,Cx=Math.log,Ex=Math.LN2;function Nx(e){return e>>>=0,e===0?32:31-(Cx(e)/Ex|0)|0}var qo=64,Yo=4194304;function As(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 Ul(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~i;l!==0?n=As(l):(s&=o,s!==0&&(n=As(s)))}else o=r&~i,o!==0?n=As(o):s!==0&&(n=As(s));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-Rr(t),i=1<<r,n|=e[r],t&=~i;return n}function Tx(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 Px(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Rr(s),l=1<<o,a=i[o];a===-1?(!(l&r)||l&n)&&(i[o]=Tx(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function xu(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function j_(){var e=qo;return qo<<=1,!(qo&4194240)&&(qo=64),e}function rc(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function No(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Rr(t),e[t]=r}function Lx(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var i=31-Rr(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}function cd(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Rr(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var De=0;function z_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var F_,ud,$_,H_,W_,Su=!1,Xo=[],Ln=null,Dn=null,Rn=null,io=new Map,so=new Map,kn=[],Dx="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 Kf(e,t){switch(e){case"focusin":case"focusout":Ln=null;break;case"dragenter":case"dragleave":Dn=null;break;case"mouseover":case"mouseout":Rn=null;break;case"pointerover":case"pointerout":io.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":so.delete(t.pointerId)}}function _s(e,t,r,n,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:s,targetContainers:[i]},t!==null&&(t=Po(t),t!==null&&ud(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Rx(e,t,r,n,i){switch(t){case"focusin":return Ln=_s(Ln,e,t,r,n,i),!0;case"dragenter":return Dn=_s(Dn,e,t,r,n,i),!0;case"mouseover":return Rn=_s(Rn,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return io.set(s,_s(io.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,so.set(s,_s(so.get(s)||null,e,t,r,n,i)),!0}return!1}function U_(e){var t=ri(e.target);if(t!==null){var r=yi(t);if(r!==null){if(t=r.tag,t===13){if(t=R_(r),t!==null){e.blockedOn=t,W_(e.priority,function(){$_(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function vl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=wu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);gu=n,r.target.dispatchEvent(n),gu=null}else return t=Po(r),t!==null&&ud(t),e.blockedOn=r,!1;t.shift()}return!0}function Vf(e,t,r){vl(e)&&r.delete(t)}function Mx(){Su=!1,Ln!==null&&vl(Ln)&&(Ln=null),Dn!==null&&vl(Dn)&&(Dn=null),Rn!==null&&vl(Rn)&&(Rn=null),io.forEach(Vf),so.forEach(Vf)}function vs(e,t){e.blockedOn===t&&(e.blockedOn=null,Su||(Su=!0,lr.unstable_scheduleCallback(lr.unstable_NormalPriority,Mx)))}function oo(e){function t(i){return vs(i,e)}if(0<Xo.length){vs(Xo[0],e);for(var r=1;r<Xo.length;r++){var n=Xo[r];n.blockedOn===e&&(n.blockedOn=null)}}for(Ln!==null&&vs(Ln,e),Dn!==null&&vs(Dn,e),Rn!==null&&vs(Rn,e),io.forEach(t),so.forEach(t),r=0;r<kn.length;r++)n=kn[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<kn.length&&(r=kn[0],r.blockedOn===null);)U_(r),r.blockedOn===null&&kn.shift()}var Vi=hn.ReactCurrentBatchConfig,Kl=!0;function Ix(e,t,r,n){var i=De,s=Vi.transition;Vi.transition=null;try{De=1,hd(e,t,r,n)}finally{De=i,Vi.transition=s}}function Ax(e,t,r,n){var i=De,s=Vi.transition;Vi.transition=null;try{De=4,hd(e,t,r,n)}finally{De=i,Vi.transition=s}}function hd(e,t,r,n){if(Kl){var i=wu(e,t,r,n);if(i===null)dc(e,t,n,Vl,r),Kf(e,n);else if(Rx(i,e,t,r,n))n.stopPropagation();else if(Kf(e,n),t&4&&-1<Dx.indexOf(e)){for(;i!==null;){var s=Po(i);if(s!==null&&F_(s),s=wu(e,t,r,n),s===null&&dc(e,t,n,Vl,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else dc(e,t,n,null,r)}}var Vl=null;function wu(e,t,r,n){if(Vl=null,e=ld(n),e=ri(e),e!==null)if(t=yi(e),t===null)e=null;else if(r=t.tag,r===13){if(e=R_(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Vl=e,null}function K_(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(wx()){case ad:return 1;case B_:return 4;case Wl:case bx:return 16;case O_:return 536870912;default:return 16}default:return 16}}var En=null,dd=null,yl=null;function V_(){if(yl)return yl;var e,t=dd,r=t.length,n,i="value"in En?En.value:En.textContent,s=i.length;for(e=0;e<r&&t[e]===i[e];e++);var o=r-e;for(n=1;n<=o&&t[r-n]===i[s-n];n++);return yl=i.slice(e,1<n?1-n: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 Go(){return!0}function qf(){return!1}function cr(e){function t(r,n,i,s,o){this._reactName=r,this._targetInst=i,this.type=n,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Go:qf,this.isPropagationStopped=qf,this}return Ye(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Go)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Go)},persist:function(){},isPersistent:Go}),t}var os={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fd=cr(os),To=Ye({},os,{view:0,detail:0}),Bx=cr(To),nc,ic,ys,ba=Ye({},To,{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"?(nc=e.screenX-ys.screenX,ic=e.screenY-ys.screenY):ic=nc=0,ys=e),nc)},movementY:function(e){return"movementY"in e?e.movementY:ic}}),Yf=cr(ba),Ox=Ye({},ba,{dataTransfer:0}),jx=cr(Ox),zx=Ye({},To,{relatedTarget:0}),sc=cr(zx),Fx=Ye({},os,{animationName:0,elapsedTime:0,pseudoElement:0}),$x=cr(Fx),Hx=Ye({},os,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Wx=cr(Hx),Ux=Ye({},os,{data:0}),Xf=cr(Ux),Kx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vx={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"},qx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yx(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=qx[e])?!!t[e]:!1}function pd(){return Yx}var Xx=Ye({},To,{key:function(e){if(e.key){var t=Kx[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"?Vx[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}}),Gx=cr(Xx),Qx=Ye({},ba,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gf=cr(Qx),Zx=Ye({},To,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pd}),Jx=cr(Zx),eS=Ye({},os,{propertyName:0,elapsedTime:0,pseudoElement:0}),tS=cr(eS),rS=Ye({},ba,{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}),nS=cr(rS),iS=[9,13,27,32],md=ln&&"CompositionEvent"in window,Us=null;ln&&"documentMode"in document&&(Us=document.documentMode);var sS=ln&&"TextEvent"in window&&!Us,q_=ln&&(!md||Us&&8<Us&&11>=Us),Qf=" ",Zf=!1;function Y_(e,t){switch(e){case"keyup":return iS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function X_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ri=!1;function oS(e,t){switch(e){case"compositionend":return X_(t);case"keypress":return t.which!==32?null:(Zf=!0,Qf);case"textInput":return e=t.data,e===Qf&&Zf?null:e;default:return null}}function lS(e,t){if(Ri)return e==="compositionend"||!md&&Y_(e,t)?(e=V_(),yl=dd=En=null,Ri=!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 q_&&t.locale!=="ko"?null:t.data;default:return null}}var aS={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 Jf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!aS[e.type]:t==="textarea"}function G_(e,t,r,n){N_(n),t=ql(t,"onChange"),0<t.length&&(r=new fd("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Ks=null,lo=null;function cS(e){lv(e,0)}function ka(e){var t=Ai(e);if(x_(t))return e}function uS(e,t){if(e==="change")return t}var Q_=!1;if(ln){var oc;if(ln){var lc="oninput"in document;if(!lc){var ep=document.createElement("div");ep.setAttribute("oninput","return;"),lc=typeof ep.oninput=="function"}oc=lc}else oc=!1;Q_=oc&&(!document.documentMode||9<document.documentMode)}function tp(){Ks&&(Ks.detachEvent("onpropertychange",Z_),lo=Ks=null)}function Z_(e){if(e.propertyName==="value"&&ka(lo)){var t=[];G_(t,lo,e,ld(e)),D_(cS,t)}}function hS(e,t,r){e==="focusin"?(tp(),Ks=t,lo=r,Ks.attachEvent("onpropertychange",Z_)):e==="focusout"&&tp()}function dS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ka(lo)}function fS(e,t){if(e==="click")return ka(t)}function pS(e,t){if(e==="input"||e==="change")return ka(t)}function mS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ar=typeof Object.is=="function"?Object.is:mS;function ao(e,t){if(Ar(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var i=r[n];if(!iu.call(t,i)||!Ar(e[i],t[i]))return!1}return!0}function rp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function np(e,t){var r=rp(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=rp(r)}}function J_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?J_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ev(){for(var e=window,t=Fl();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Fl(e.document)}return t}function gd(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=ev(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&J_(r.ownerDocument.documentElement,r)){if(n!==null&&gd(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=np(r,s);var o=np(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var _S=ln&&"documentMode"in document&&11>=document.documentMode,Mi=null,bu=null,Vs=null,ku=!1;function ip(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ku||Mi==null||Mi!==Fl(n)||(n=Mi,"selectionStart"in n&&gd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Vs&&ao(Vs,n)||(Vs=n,n=ql(bu,"onSelect"),0<n.length&&(t=new fd("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Mi)))}function Qo(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Ii={animationend:Qo("Animation","AnimationEnd"),animationiteration:Qo("Animation","AnimationIteration"),animationstart:Qo("Animation","AnimationStart"),transitionend:Qo("Transition","TransitionEnd")},ac={},tv={};ln&&(tv=document.createElement("div").style,"AnimationEvent"in window||(delete Ii.animationend.animation,delete Ii.animationiteration.animation,delete Ii.animationstart.animation),"TransitionEvent"in window||delete Ii.transitionend.transition);function Ca(e){if(ac[e])return ac[e];if(!Ii[e])return e;var t=Ii[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in tv)return ac[e]=t[r];return e}var rv=Ca("animationend"),nv=Ca("animationiteration"),iv=Ca("animationstart"),sv=Ca("transitionend"),ov=new Map,sp="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 $n(e,t){ov.set(e,t),vi(t,[e])}for(var cc=0;cc<sp.length;cc++){var uc=sp[cc],vS=uc.toLowerCase(),yS=uc[0].toUpperCase()+uc.slice(1);$n(vS,"on"+yS)}$n(rv,"onAnimationEnd");$n(nv,"onAnimationIteration");$n(iv,"onAnimationStart");$n("dblclick","onDoubleClick");$n("focusin","onFocus");$n("focusout","onBlur");$n(sv,"onTransitionEnd");Gi("onMouseEnter",["mouseout","mouseover"]);Gi("onMouseLeave",["mouseout","mouseover"]);Gi("onPointerEnter",["pointerout","pointerover"]);Gi("onPointerLeave",["pointerout","pointerover"]);vi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));vi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));vi("onBeforeInput",["compositionend","keypress","textInput","paste"]);vi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));vi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));vi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Bs="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(" "),xS=new Set("cancel close invalid load scroll toggle".split(" ").concat(Bs));function op(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,vx(n,t,void 0,e),e.currentTarget=null}function lv(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var s=void 0;if(t)for(var o=n.length-1;0<=o;o--){var l=n[o],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==s&&i.isPropagationStopped())break e;op(i,l,c),s=a}else for(o=0;o<n.length;o++){if(l=n[o],a=l.instance,c=l.currentTarget,l=l.listener,a!==s&&i.isPropagationStopped())break e;op(i,l,c),s=a}}}if(Hl)throw e=yu,Hl=!1,yu=null,e}function ze(e,t){var r=t[Pu];r===void 0&&(r=t[Pu]=new Set);var n=e+"__bubble";r.has(n)||(av(t,e,2,!1),r.add(n))}function hc(e,t,r){var n=0;t&&(n|=4),av(r,e,n,t)}var Zo="_reactListening"+Math.random().toString(36).slice(2);function co(e){if(!e[Zo]){e[Zo]=!0,m_.forEach(function(r){r!=="selectionchange"&&(xS.has(r)||hc(r,!1,e),hc(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zo]||(t[Zo]=!0,hc("selectionchange",!1,t))}}function av(e,t,r,n){switch(K_(t)){case 1:var i=Ix;break;case 4:i=Ax;break;default:i=hd}r=i.bind(null,t,r,e),i=void 0,!vu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),n?i!==void 0?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):i!==void 0?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function dc(e,t,r,n,i){var s=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=n.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===i||a.nodeType===8&&a.parentNode===i))return;o=o.return}for(;l!==null;){if(o=ri(l),o===null)return;if(a=o.tag,a===5||a===6){n=s=o;continue e}l=l.parentNode}}n=n.return}D_(function(){var c=s,h=ld(r),u=[];e:{var d=ov.get(e);if(d!==void 0){var f=fd,m=e;switch(e){case"keypress":if(xl(r)===0)break e;case"keydown":case"keyup":f=Gx;break;case"focusin":m="focus",f=sc;break;case"focusout":m="blur",f=sc;break;case"beforeblur":case"afterblur":f=sc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=Yf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=jx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=Jx;break;case rv:case nv:case iv:f=$x;break;case sv:f=tS;break;case"scroll":f=Bx;break;case"wheel":f=nS;break;case"copy":case"cut":case"paste":f=Wx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=Gf}var g=(t&4)!==0,x=!g&&e==="scroll",_=g?d!==null?d+"Capture":null:d;g=[];for(var v=c,y;v!==null;){y=v;var E=y.stateNode;if(y.tag===5&&E!==null&&(y=E,_!==null&&(E=no(v,_),E!=null&&g.push(uo(v,E,y)))),x)break;v=v.return}0<g.length&&(d=new f(d,m,null,r,h),u.push({event:d,listeners:g}))}}if(!(t&7)){e:{if(d=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",d&&r!==gu&&(m=r.relatedTarget||r.fromElement)&&(ri(m)||m[an]))break e;if((f||d)&&(d=h.window===h?h:(d=h.ownerDocument)?d.defaultView||d.parentWindow:window,f?(m=r.relatedTarget||r.toElement,f=c,m=m?ri(m):null,m!==null&&(x=yi(m),m!==x||m.tag!==5&&m.tag!==6)&&(m=null)):(f=null,m=c),f!==m)){if(g=Yf,E="onMouseLeave",_="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(g=Gf,E="onPointerLeave",_="onPointerEnter",v="pointer"),x=f==null?d:Ai(f),y=m==null?d:Ai(m),d=new g(E,v+"leave",f,r,h),d.target=x,d.relatedTarget=y,E=null,ri(h)===c&&(g=new g(_,v+"enter",m,r,h),g.target=y,g.relatedTarget=x,E=g),x=E,f&&m)t:{for(g=f,_=m,v=0,y=g;y;y=Ci(y))v++;for(y=0,E=_;E;E=Ci(E))y++;for(;0<v-y;)g=Ci(g),v--;for(;0<y-v;)_=Ci(_),y--;for(;v--;){if(g===_||_!==null&&g===_.alternate)break t;g=Ci(g),_=Ci(_)}g=null}else g=null;f!==null&&lp(u,d,f,g,!1),m!==null&&x!==null&&lp(u,x,m,g,!0)}}e:{if(d=c?Ai(c):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var P=uS;else if(Jf(d))if(Q_)P=pS;else{P=dS;var C=hS}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(P=fS);if(P&&(P=P(e,c))){G_(u,P,r,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?Ai(c):window,e){case"focusin":(Jf(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,ip(u,r,h);break;case"selectionchange":if(_S)break;case"keydown":case"keyup":ip(u,r,h)}var M;if(md)e:{switch(e){case"compositionstart":var z="onCompositionStart";break e;case"compositionend":z="onCompositionEnd";break e;case"compositionupdate":z="onCompositionUpdate";break e}z=void 0}else Ri?Y_(e,r)&&(z="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(z="onCompositionStart");z&&(q_&&r.locale!=="ko"&&(Ri||z!=="onCompositionStart"?z==="onCompositionEnd"&&Ri&&(M=V_()):(En=h,dd="value"in En?En.value:En.textContent,Ri=!0)),C=ql(c,z),0<C.length&&(z=new Xf(z,e,null,r,h),u.push({event:z,listeners:C}),M?z.data=M:(M=X_(r),M!==null&&(z.data=M)))),(M=sS?oS(e,r):lS(e,r))&&(c=ql(c,"onBeforeInput"),0<c.length&&(h=new Xf("onBeforeInput","beforeinput",null,r,h),u.push({event:h,listeners:c}),h.data=M))}lv(u,t)})}function uo(e,t,r){return{instance:e,listener:t,currentTarget:r}}function ql(e,t){for(var r=t+"Capture",n=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=no(e,r),s!=null&&n.unshift(uo(e,s,i)),s=no(e,t),s!=null&&n.push(uo(e,s,i))),e=e.return}return n}function Ci(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function lp(e,t,r,n,i){for(var s=t._reactName,o=[];r!==null&&r!==n;){var l=r,a=l.alternate,c=l.stateNode;if(a!==null&&a===n)break;l.tag===5&&c!==null&&(l=c,i?(a=no(r,s),a!=null&&o.unshift(uo(r,a,l))):i||(a=no(r,s),a!=null&&o.push(uo(r,a,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var SS=/\r\n?/g,wS=/\u0000|\uFFFD/g;function ap(e){return(typeof e=="string"?e:""+e).replace(SS,`
38
+ `).replace(wS,"")}function Jo(e,t,r){if(t=ap(t),ap(e)!==t&&r)throw Error(te(425))}function Yl(){}var Cu=null,Eu=null;function Nu(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 Tu=typeof setTimeout=="function"?setTimeout:void 0,bS=typeof clearTimeout=="function"?clearTimeout:void 0,cp=typeof Promise=="function"?Promise:void 0,kS=typeof queueMicrotask=="function"?queueMicrotask:typeof cp<"u"?function(e){return cp.resolve(null).then(e).catch(CS)}:Tu;function CS(e){setTimeout(function(){throw e})}function fc(e,t){var r=t,n=0;do{var i=r.nextSibling;if(e.removeChild(r),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(n===0){e.removeChild(i),oo(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);oo(t)}function Mn(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 up(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var ls=Math.random().toString(36).slice(2),Kr="__reactFiber$"+ls,ho="__reactProps$"+ls,an="__reactContainer$"+ls,Pu="__reactEvents$"+ls,ES="__reactListeners$"+ls,NS="__reactHandles$"+ls;function ri(e){var t=e[Kr];if(t)return t;for(var r=e.parentNode;r;){if(t=r[an]||r[Kr]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=up(e);e!==null;){if(r=e[Kr])return r;e=up(e)}return t}e=r,r=e.parentNode}return null}function Po(e){return e=e[Kr]||e[an],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ai(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function Ea(e){return e[ho]||null}var Lu=[],Bi=-1;function Hn(e){return{current:e}}function $e(e){0>Bi||(e.current=Lu[Bi],Lu[Bi]=null,Bi--)}function Oe(e,t){Bi++,Lu[Bi]=e.current,e.current=t}var Fn={},Mt=Hn(Fn),Xt=Hn(!1),ui=Fn;function Qi(e,t){var r=e.type.contextTypes;if(!r)return Fn;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Gt(e){return e=e.childContextTypes,e!=null}function Xl(){$e(Xt),$e(Mt)}function hp(e,t,r){if(Mt.current!==Fn)throw Error(te(168));Oe(Mt,t),Oe(Xt,r)}function cv(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(te(108,hx(e)||"Unknown",i));return Ye({},r,n)}function Gl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Fn,ui=Mt.current,Oe(Mt,e),Oe(Xt,Xt.current),!0}function dp(e,t,r){var n=e.stateNode;if(!n)throw Error(te(169));r?(e=cv(e,t,ui),n.__reactInternalMemoizedMergedChildContext=e,$e(Xt),$e(Mt),Oe(Mt,e)):$e(Xt),Oe(Xt,r)}var en=null,Na=!1,pc=!1;function uv(e){en===null?en=[e]:en.push(e)}function TS(e){Na=!0,uv(e)}function Wn(){if(!pc&&en!==null){pc=!0;var e=0,t=De;try{var r=en;for(De=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}en=null,Na=!1}catch(i){throw en!==null&&(en=en.slice(e+1)),A_(ad,Wn),i}finally{De=t,pc=!1}}return null}var Oi=[],ji=0,Ql=null,Zl=0,gr=[],_r=0,hi=null,rn=1,nn="";function Xn(e,t){Oi[ji++]=Zl,Oi[ji++]=Ql,Ql=e,Zl=t}function hv(e,t,r){gr[_r++]=rn,gr[_r++]=nn,gr[_r++]=hi,hi=e;var n=rn;e=nn;var i=32-Rr(n)-1;n&=~(1<<i),r+=1;var s=32-Rr(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,rn=1<<32-Rr(t)+i|r<<i|n,nn=s+e}else rn=1<<s|r<<i|n,nn=e}function _d(e){e.return!==null&&(Xn(e,1),hv(e,1,0))}function vd(e){for(;e===Ql;)Ql=Oi[--ji],Oi[ji]=null,Zl=Oi[--ji],Oi[ji]=null;for(;e===hi;)hi=gr[--_r],gr[_r]=null,nn=gr[--_r],gr[_r]=null,rn=gr[--_r],gr[_r]=null}var sr=null,ir=null,He=!1,Lr=null;function dv(e,t){var r=yr(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function fp(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,sr=e,ir=Mn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,sr=e,ir=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=hi!==null?{id:rn,overflow:nn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=yr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,sr=e,ir=null,!0):!1;default:return!1}}function Du(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ru(e){if(He){var t=ir;if(t){var r=t;if(!fp(e,t)){if(Du(e))throw Error(te(418));t=Mn(r.nextSibling);var n=sr;t&&fp(e,t)?dv(n,r):(e.flags=e.flags&-4097|2,He=!1,sr=e)}}else{if(Du(e))throw Error(te(418));e.flags=e.flags&-4097|2,He=!1,sr=e}}}function pp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;sr=e}function el(e){if(e!==sr)return!1;if(!He)return pp(e),He=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Nu(e.type,e.memoizedProps)),t&&(t=ir)){if(Du(e))throw fv(),Error(te(418));for(;t;)dv(e,t),t=Mn(t.nextSibling)}if(pp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){ir=Mn(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}ir=null}}else ir=sr?Mn(e.stateNode.nextSibling):null;return!0}function fv(){for(var e=ir;e;)e=Mn(e.nextSibling)}function Zi(){ir=sr=null,He=!1}function yd(e){Lr===null?Lr=[e]:Lr.push(e)}var PS=hn.ReactCurrentBatchConfig;function xs(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(te(309));var n=r.stateNode}if(!n)throw Error(te(147,e));var i=n,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(te(284));if(!r._owner)throw Error(te(290,e))}return e}function tl(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function mp(e){var t=e._init;return t(e._payload)}function pv(e){function t(_,v){if(e){var y=_.deletions;y===null?(_.deletions=[v],_.flags|=16):y.push(v)}}function r(_,v){if(!e)return null;for(;v!==null;)t(_,v),v=v.sibling;return null}function n(_,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 _=On(_,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=Sc(y,_.mode,E),v.return=_,v):(v=i(v,y),v.return=_,v)}function a(_,v,y,E){var P=y.type;return P===Di?h(_,v,y.props.children,E,y.key):v!==null&&(v.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Sn&&mp(P)===v.type)?(E=i(v,y.props),E.ref=xs(_,v,y),E.return=_,E):(E=Nl(y.type,y.key,y.props,null,_.mode,E),E.ref=xs(_,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=wc(y,_.mode,E),v.return=_,v):(v=i(v,y.children||[]),v.return=_,v)}function h(_,v,y,E,P){return v===null||v.tag!==7?(v=li(y,_.mode,E,P),v.return=_,v):(v=i(v,y),v.return=_,v)}function u(_,v,y){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Sc(""+v,_.mode,y),v.return=_,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Uo:return y=Nl(v.type,v.key,v.props,null,_.mode,y),y.ref=xs(_,null,v),y.return=_,y;case Li:return v=wc(v,_.mode,y),v.return=_,v;case Sn:var E=v._init;return u(_,E(v._payload),y)}if(Is(v)||ms(v))return v=li(v,_.mode,y,null),v.return=_,v;tl(_,v)}return null}function d(_,v,y,E){var P=v!==null?v.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return P!==null?null:l(_,v,""+y,E);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Uo:return y.key===P?a(_,v,y,E):null;case Li:return y.key===P?c(_,v,y,E):null;case Sn:return P=y._init,d(_,v,P(y._payload),E)}if(Is(y)||ms(y))return P!==null?null:h(_,v,y,E,null);tl(_,y)}return null}function f(_,v,y,E,P){if(typeof E=="string"&&E!==""||typeof E=="number")return _=_.get(y)||null,l(v,_,""+E,P);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case Uo:return _=_.get(E.key===null?y:E.key)||null,a(v,_,E,P);case Li:return _=_.get(E.key===null?y:E.key)||null,c(v,_,E,P);case Sn:var C=E._init;return f(_,v,y,C(E._payload),P)}if(Is(E)||ms(E))return _=_.get(y)||null,h(v,_,E,P,null);tl(v,E)}return null}function m(_,v,y,E){for(var P=null,C=null,M=v,z=v=0,J=null;M!==null&&z<y.length;z++){M.index>z?(J=M,M=null):J=M.sibling;var N=d(_,M,y[z],E);if(N===null){M===null&&(M=J);break}e&&M&&N.alternate===null&&t(_,M),v=s(N,v,z),C===null?P=N:C.sibling=N,C=N,M=J}if(z===y.length)return r(_,M),He&&Xn(_,z),P;if(M===null){for(;z<y.length;z++)M=u(_,y[z],E),M!==null&&(v=s(M,v,z),C===null?P=M:C.sibling=M,C=M);return He&&Xn(_,z),P}for(M=n(_,M);z<y.length;z++)J=f(M,_,z,y[z],E),J!==null&&(e&&J.alternate!==null&&M.delete(J.key===null?z:J.key),v=s(J,v,z),C===null?P=J:C.sibling=J,C=J);return e&&M.forEach(function(D){return t(_,D)}),He&&Xn(_,z),P}function g(_,v,y,E){var P=ms(y);if(typeof P!="function")throw Error(te(150));if(y=P.call(y),y==null)throw Error(te(151));for(var C=P=null,M=v,z=v=0,J=null,N=y.next();M!==null&&!N.done;z++,N=y.next()){M.index>z?(J=M,M=null):J=M.sibling;var D=d(_,M,N.value,E);if(D===null){M===null&&(M=J);break}e&&M&&D.alternate===null&&t(_,M),v=s(D,v,z),C===null?P=D:C.sibling=D,C=D,M=J}if(N.done)return r(_,M),He&&Xn(_,z),P;if(M===null){for(;!N.done;z++,N=y.next())N=u(_,N.value,E),N!==null&&(v=s(N,v,z),C===null?P=N:C.sibling=N,C=N);return He&&Xn(_,z),P}for(M=n(_,M);!N.done;z++,N=y.next())N=f(M,_,z,N.value,E),N!==null&&(e&&N.alternate!==null&&M.delete(N.key===null?z:N.key),v=s(N,v,z),C===null?P=N:C.sibling=N,C=N);return e&&M.forEach(function(I){return t(_,I)}),He&&Xn(_,z),P}function x(_,v,y,E){if(typeof y=="object"&&y!==null&&y.type===Di&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Uo:e:{for(var P=y.key,C=v;C!==null;){if(C.key===P){if(P=y.type,P===Di){if(C.tag===7){r(_,C.sibling),v=i(C,y.props.children),v.return=_,_=v;break e}}else if(C.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Sn&&mp(P)===C.type){r(_,C.sibling),v=i(C,y.props),v.ref=xs(_,C,y),v.return=_,_=v;break e}r(_,C);break}else t(_,C);C=C.sibling}y.type===Di?(v=li(y.props.children,_.mode,E,y.key),v.return=_,_=v):(E=Nl(y.type,y.key,y.props,null,_.mode,E),E.ref=xs(_,v,y),E.return=_,_=E)}return o(_);case Li: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){r(_,v.sibling),v=i(v,y.children||[]),v.return=_,_=v;break e}else{r(_,v);break}else t(_,v);v=v.sibling}v=wc(y,_.mode,E),v.return=_,_=v}return o(_);case Sn:return C=y._init,x(_,v,C(y._payload),E)}if(Is(y))return m(_,v,y,E);if(ms(y))return g(_,v,y,E);tl(_,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(r(_,v.sibling),v=i(v,y),v.return=_,_=v):(r(_,v),v=Sc(y,_.mode,E),v.return=_,_=v),o(_)):r(_,v)}return x}var Ji=pv(!0),mv=pv(!1),Jl=Hn(null),ea=null,zi=null,xd=null;function Sd(){xd=zi=ea=null}function wd(e){var t=Jl.current;$e(Jl),e._currentValue=t}function Mu(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function qi(e,t){ea=e,xd=zi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Yt=!0),e.firstContext=null)}function wr(e){var t=e._currentValue;if(xd!==e)if(e={context:e,memoizedValue:t,next:null},zi===null){if(ea===null)throw Error(te(308));zi=e,ea.dependencies={lanes:0,firstContext:e}}else zi=zi.next=e;return t}var ni=null;function bd(e){ni===null?ni=[e]:ni.push(e)}function gv(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,bd(t)):(r.next=i.next,i.next=r),t.interleaved=r,cn(e,n)}function cn(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var wn=!1;function kd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _v(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 on(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function In(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Le&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,cn(e,r)}return i=n.interleaved,i===null?(t.next=t,bd(n)):(t.next=i.next,i.next=t),n.interleaved=t,cn(e,r)}function Sl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,cd(e,r)}}function gp(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=t:s=s.next=t}else i=s=t;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function ta(e,t,r,n){var i=e.updateQueue;wn=!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((n&d)===d){h!==null&&(h=h.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,g=l;switch(d=t,f=r,g.tag){case 1:if(m=g.payload,typeof m=="function"){u=m.call(f,u,d);break e}u=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,d=typeof m=="function"?m.call(f,u,d):m,d==null)break e;u=Ye({},u,d);break e;case 2:wn=!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);fi|=o,e.lanes=o,e.memoizedState=u}}function _p(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(i!==null){if(n.callback=null,n=r,typeof i!="function")throw Error(te(191,i));i.call(n)}}}var Lo={},Yr=Hn(Lo),fo=Hn(Lo),po=Hn(Lo);function ii(e){if(e===Lo)throw Error(te(174));return e}function Cd(e,t){switch(Oe(po,t),Oe(fo,e),Oe(Yr,Lo),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)}$e(Yr),Oe(Yr,t)}function es(){$e(Yr),$e(fo),$e(po)}function vv(e){ii(po.current);var t=ii(Yr.current),r=fu(t,e.type);t!==r&&(Oe(fo,e),Oe(Yr,r))}function Ed(e){fo.current===e&&($e(Yr),$e(fo))}var Ve=Hn(0);function ra(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var mc=[];function Nd(){for(var e=0;e<mc.length;e++)mc[e]._workInProgressVersionPrimary=null;mc.length=0}var wl=hn.ReactCurrentDispatcher,gc=hn.ReactCurrentBatchConfig,di=0,qe=null,ut=null,gt=null,na=!1,qs=!1,mo=0,LS=0;function Tt(){throw Error(te(321))}function Td(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Ar(e[r],t[r]))return!1;return!0}function Pd(e,t,r,n,i,s){if(di=s,qe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,wl.current=e===null||e.memoizedState===null?IS:AS,e=r(n,i),qs){s=0;do{if(qs=!1,mo=0,25<=s)throw Error(te(301));s+=1,gt=ut=null,t.updateQueue=null,wl.current=BS,e=r(n,i)}while(qs)}if(wl.current=ia,t=ut!==null&&ut.next!==null,di=0,gt=ut=qe=null,na=!1,t)throw Error(te(300));return e}function Ld(){var e=mo!==0;return mo=0,e}function Hr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?qe.memoizedState=gt=e:gt=gt.next=e,gt}function br(){if(ut===null){var e=qe.alternate;e=e!==null?e.memoizedState:null}else e=ut.next;var t=gt===null?qe.memoizedState:gt.next;if(t!==null)gt=t,ut=e;else{if(e===null)throw Error(te(310));ut=e,e={memoizedState:ut.memoizedState,baseState:ut.baseState,baseQueue:ut.baseQueue,queue:ut.queue,next:null},gt===null?qe.memoizedState=gt=e:gt=gt.next=e}return gt}function go(e,t){return typeof t=="function"?t(e):t}function _c(e){var t=br(),r=t.queue;if(r===null)throw Error(te(311));r.lastRenderedReducer=e;var n=ut,i=n.baseQueue,s=r.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}n.baseQueue=i=s,r.pending=null}if(i!==null){s=i.next,n=n.baseState;var l=o=null,a=null,c=s;do{var h=c.lane;if((di&h)===h)a!==null&&(a=a.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),n=c.hasEagerState?c.eagerState:e(n,c.action);else{var u={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=u,o=n):a=a.next=u,qe.lanes|=h,fi|=h}c=c.next}while(c!==null&&c!==s);a===null?o=n:a.next=l,Ar(n,t.memoizedState)||(Yt=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=a,r.lastRenderedState=n}if(e=r.interleaved,e!==null){i=e;do s=i.lane,qe.lanes|=s,fi|=s,i=i.next;while(i!==e)}else i===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function vc(e){var t=br(),r=t.queue;if(r===null)throw Error(te(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,s=t.memoizedState;if(i!==null){r.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);Ar(s,t.memoizedState)||(Yt=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function yv(){}function xv(e,t){var r=qe,n=br(),i=t(),s=!Ar(n.memoizedState,i);if(s&&(n.memoizedState=i,Yt=!0),n=n.queue,Dd(bv.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||gt!==null&&gt.memoizedState.tag&1){if(r.flags|=2048,_o(9,wv.bind(null,r,n,i,t),void 0,null),xt===null)throw Error(te(349));di&30||Sv(r,t,i)}return i}function Sv(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=qe.updateQueue,t===null?(t={lastEffect:null,stores:null},qe.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function wv(e,t,r,n){t.value=r,t.getSnapshot=n,kv(t)&&Cv(e)}function bv(e,t,r){return r(function(){kv(t)&&Cv(e)})}function kv(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Ar(e,r)}catch{return!0}}function Cv(e){var t=cn(e,1);t!==null&&Mr(t,e,1,-1)}function vp(e){var t=Hr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:go,lastRenderedState:e},t.queue=e,e=e.dispatch=MS.bind(null,qe,e),[t.memoizedState,e]}function _o(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=qe.updateQueue,t===null?(t={lastEffect:null,stores:null},qe.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function Ev(){return br().memoizedState}function bl(e,t,r,n){var i=Hr();qe.flags|=e,i.memoizedState=_o(1|t,r,void 0,n===void 0?null:n)}function Ta(e,t,r,n){var i=br();n=n===void 0?null:n;var s=void 0;if(ut!==null){var o=ut.memoizedState;if(s=o.destroy,n!==null&&Td(n,o.deps)){i.memoizedState=_o(t,r,s,n);return}}qe.flags|=e,i.memoizedState=_o(1|t,r,s,n)}function yp(e,t){return bl(8390656,8,e,t)}function Dd(e,t){return Ta(2048,8,e,t)}function Nv(e,t){return Ta(4,2,e,t)}function Tv(e,t){return Ta(4,4,e,t)}function Pv(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 Lv(e,t,r){return r=r!=null?r.concat([e]):null,Ta(4,4,Pv.bind(null,t,e),r)}function Rd(){}function Dv(e,t){var r=br();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Td(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Rv(e,t){var r=br();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Td(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Mv(e,t,r){return di&21?(Ar(r,t)||(r=j_(),qe.lanes|=r,fi|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Yt=!0),e.memoizedState=r)}function DS(e,t){var r=De;De=r!==0&&4>r?r:4,e(!0);var n=gc.transition;gc.transition={};try{e(!1),t()}finally{De=r,gc.transition=n}}function Iv(){return br().memoizedState}function RS(e,t,r){var n=Bn(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Av(e))Bv(t,r);else if(r=gv(e,t,r,n),r!==null){var i=zt();Mr(r,e,n,i),Ov(r,t,n)}}function MS(e,t,r){var n=Bn(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Av(e))Bv(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,r);if(i.hasEagerState=!0,i.eagerState=l,Ar(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{}r=gv(e,t,i,n),r!==null&&(i=zt(),Mr(r,e,n,i),Ov(r,t,n))}}function Av(e){var t=e.alternate;return e===qe||t!==null&&t===qe}function Bv(e,t){qs=na=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Ov(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,cd(e,r)}}var ia={readContext:wr,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useInsertionEffect:Tt,useLayoutEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useMutableSource:Tt,useSyncExternalStore:Tt,useId:Tt,unstable_isNewReconciler:!1},IS={readContext:wr,useCallback:function(e,t){return Hr().memoizedState=[e,t===void 0?null:t],e},useContext:wr,useEffect:yp,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,bl(4194308,4,Pv.bind(null,t,e),r)},useLayoutEffect:function(e,t){return bl(4194308,4,e,t)},useInsertionEffect:function(e,t){return bl(4,2,e,t)},useMemo:function(e,t){var r=Hr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Hr();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=RS.bind(null,qe,e),[n.memoizedState,e]},useRef:function(e){var t=Hr();return e={current:e},t.memoizedState=e},useState:vp,useDebugValue:Rd,useDeferredValue:function(e){return Hr().memoizedState=e},useTransition:function(){var e=vp(!1),t=e[0];return e=DS.bind(null,e[1]),Hr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=qe,i=Hr();if(He){if(r===void 0)throw Error(te(407));r=r()}else{if(r=t(),xt===null)throw Error(te(349));di&30||Sv(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,yp(bv.bind(null,n,s,e),[e]),n.flags|=2048,_o(9,wv.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=Hr(),t=xt.identifierPrefix;if(He){var r=nn,n=rn;r=(n&~(1<<32-Rr(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=mo++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=LS++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},AS={readContext:wr,useCallback:Dv,useContext:wr,useEffect:Dd,useImperativeHandle:Lv,useInsertionEffect:Nv,useLayoutEffect:Tv,useMemo:Rv,useReducer:_c,useRef:Ev,useState:function(){return _c(go)},useDebugValue:Rd,useDeferredValue:function(e){var t=br();return Mv(t,ut.memoizedState,e)},useTransition:function(){var e=_c(go)[0],t=br().memoizedState;return[e,t]},useMutableSource:yv,useSyncExternalStore:xv,useId:Iv,unstable_isNewReconciler:!1},BS={readContext:wr,useCallback:Dv,useContext:wr,useEffect:Dd,useImperativeHandle:Lv,useInsertionEffect:Nv,useLayoutEffect:Tv,useMemo:Rv,useReducer:vc,useRef:Ev,useState:function(){return vc(go)},useDebugValue:Rd,useDeferredValue:function(e){var t=br();return ut===null?t.memoizedState=e:Mv(t,ut.memoizedState,e)},useTransition:function(){var e=vc(go)[0],t=br().memoizedState;return[e,t]},useMutableSource:yv,useSyncExternalStore:xv,useId:Iv,unstable_isNewReconciler:!1};function Tr(e,t){if(e&&e.defaultProps){t=Ye({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Iu(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:Ye({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Pa={isMounted:function(e){return(e=e._reactInternals)?yi(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=zt(),i=Bn(e),s=on(n,i);s.payload=t,r!=null&&(s.callback=r),t=In(e,s,i),t!==null&&(Mr(t,e,i,n),Sl(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=zt(),i=Bn(e),s=on(n,i);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=In(e,s,i),t!==null&&(Mr(t,e,i,n),Sl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=zt(),n=Bn(e),i=on(r,n);i.tag=2,t!=null&&(i.callback=t),t=In(e,i,n),t!==null&&(Mr(t,e,n,r),Sl(t,e,n))}};function xp(e,t,r,n,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,s,o):t.prototype&&t.prototype.isPureReactComponent?!ao(r,n)||!ao(i,s):!0}function jv(e,t,r){var n=!1,i=Fn,s=t.contextType;return typeof s=="object"&&s!==null?s=wr(s):(i=Gt(t)?ui:Mt.current,n=t.contextTypes,s=(n=n!=null)?Qi(e,i):Fn),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Pa,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function Sp(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&Pa.enqueueReplaceState(t,t.state,null)}function Au(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs={},kd(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=wr(s):(s=Gt(t)?ui:Mt.current,i.context=Qi(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Iu(e,t,s,r),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Pa.enqueueReplaceState(i,i.state,null),ta(e,r,i,n),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function ts(e,t){try{var r="",n=t;do r+=ux(n),n=n.return;while(n);var i=r}catch(s){i=`
39
39
  Error generating stack: `+s.message+`
40
- `+s.stack}return{value:e,source:t,stack:i,digest:null}}function yc(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Bu(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var ES=typeof WeakMap=="function"?WeakMap:Map;function Pv(e,t,r){r=ln(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){aa||(aa=!0,Vu=n),Bu(e,t)},r}function Lv(e,t,r){r=ln(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){Bu(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){Bu(e,t),typeof n!="function"&&(An===null?An=new Set([this]):An.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function fp(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new ES;var i=new Set;n.set(t,i)}else i=n.get(t),i===void 0&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=FS.bind(null,e,t,r),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 mp(e,t,r,n,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=ln(-1,1),t.tag=2,In(r,t,1))),r.lanes|=1),e)}var TS=dn.ReactCurrentOwner,Jt=!1;function Ft(e,t,r,n){t.child=e===null?sv(t,null,r,n):Ji(t,e.child,r,n)}function gp(e,t,r,n,i){r=r.render;var s=t.ref;return qi(t,i),n=Pd(e,t,r,n,s,i),r=Ld(),e!==null&&!Jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,hn(e,t,i)):(He&&r&&_d(t),t.flags|=1,Ft(e,t,n,i),t.child)}function _p(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!Fd(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,Rv(e,t,s,n,i)):(e=Pl(r.type,null,n,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:ao,r(o,n)&&e.ref===t.ref)return hn(e,t,i)}return t.flags|=1,e=On(s,n),e.ref=t.ref,e.return=t,t.child=e}function Rv(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(ao(s,n)&&e.ref===t.ref)if(Jt=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&(Jt=!0);else return t.lanes=e.lanes,hn(e,t,i)}return Ou(e,t,r,n,i)}function Dv(e,t,r){var n=t.pendingProps,i=n.children,s=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Oe($i,lr),lr|=r;else{if(!(r&1073741824))return e=s!==null?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Oe($i,lr),lr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,Oe($i,lr),lr|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,Oe($i,lr),lr|=n;return Ft(e,t,i,r),t.child}function Mv(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ou(e,t,r,n,i){var s=tr(r)?hi:At.current;return s=Qi(t,s),qi(t,i),r=Pd(e,t,r,n,s,i),n=Ld(),e!==null&&!Jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,hn(e,t,i)):(He&&n&&_d(t),t.flags|=1,Ft(e,t,r,i),t.child)}function vp(e,t,r,n,i){if(tr(r)){var s=!0;Zl(t)}else s=!1;if(qi(t,i),t.stateNode===null)El(e,t),Nv(t,r,n),Au(t,r,n,i),n=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var a=o.context,c=r.contextType;typeof c=="object"&&c!==null?c=Cr(c):(c=tr(r)?hi:At.current,c=Qi(t,c));var h=r.getDerivedStateFromProps,u=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||a!==c)&&dp(t,o,n,c),wn=!1;var d=t.memoizedState;o.state=d,na(t,n,o,i),a=t.memoizedState,l!==n||d!==a||er.current||wn?(typeof h=="function"&&(Iu(t,r,h,n),a=t.memoizedState),(l=wn||hp(t,r,l,n,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=n,t.memoizedState=a),o.props=n,o.state=a,o.context=c,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,lv(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Pr(t.type,l),o.props=c,u=t.pendingProps,d=o.context,a=r.contextType,typeof a=="object"&&a!==null?a=Cr(a):(a=tr(r)?hi:At.current,a=Qi(t,a));var f=r.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,n,a),wn=!1,d=t.memoizedState,o.state=d,na(t,n,o,i);var m=t.memoizedState;l!==u||d!==m||er.current||wn?(typeof f=="function"&&(Iu(t,r,f,n),m=t.memoizedState),(c=wn||hp(t,r,c,n,d,m,a)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=a,n=c):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),n=!1)}return ju(e,t,r,n,s,i)}function ju(e,t,r,n,i,s){Mv(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&np(t,r,!1),hn(e,t,s);n=t.stateNode,TS.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.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=n.state,i&&np(t,r,!0),t.child}function Iv(e){var t=e.stateNode;t.pendingContext?rp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&rp(e,t.context,!1),Cd(e,t.containerInfo)}function yp(e,t,r,n,i){return Zi(),yd(i),t.flags|=256,Ft(e,t,r,n),t.child}var zu={dehydrated:null,treeContext:null,retryLane:0};function Fu(e){return{baseLanes:e,cachePool:null,transitions:null}}function Av(e,t,r){var n=t.pendingProps,i=Ye.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(Ye,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=n.children,e=n.fallback,s?(n=t.mode,s=t.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Ia(o,n,0,null),e=ai(e,n,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Fu(r),t.memoizedState=zu,e):Md(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return NS(e,t,o,n,l,i,r);if(s){s=n.fallback,o=t.mode,i=e.child,l=i.sibling;var a={mode:"hidden",children:n.children};return!(o&1)&&t.child!==i?(n=t.child,n.childLanes=0,n.pendingProps=a,t.deletions=null):(n=On(i,a),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=On(l,s):(s=ai(s,o,r,null),s.flags|=2),s.return=t,n.return=t,n.sibling=s,t.child=n,n=s,s=t.child,o=e.child.memoizedState,o=o===null?Fu(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=zu,n}return s=e.child,e=s.sibling,n=On(s,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function Md(e,t){return t=Ia({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function il(e,t,r,n){return n!==null&&yd(n),Ji(t,e.child,null,r),e=Md(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function NS(e,t,r,n,i,s,o){if(r)return t.flags&256?(t.flags&=-257,n=yc(Error(te(422))),il(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=Ia({mode:"visible",children:n.children},i,0,null),s=ai(s,i,o,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,t.mode&1&&Ji(t,e.child,null,o),t.child.memoizedState=Fu(o),t.memoizedState=zu,s);if(!(t.mode&1))return il(e,t,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,s=Error(te(419)),n=yc(s,n,void 0),il(e,t,o,n)}if(l=(o&e.childLanes)!==0,Jt||l){if(n=wt,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,un(e,i),Ir(n,e,i,-1))}return zd(),n=yc(Error(te(421))),il(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=$S.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,cr=Mn(i.nextSibling),ur=t,He=!0,Rr=null,e!==null&&(yr[xr++]=nn,yr[xr++]=sn,yr[xr++]=di,nn=e.id,sn=e.overflow,di=t),t=Md(t,n.children),t.flags|=4096,t)}function xp(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Mu(e.return,t,r)}function xc(e,t,r,n,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function Bv(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(Ft(e,t,n.children,r),n=Ye.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xp(e,r,t);else if(e.tag===19)xp(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(Oe(Ye,n),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;r!==null;)e=r.alternate,e!==null&&ia(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),xc(t,!1,i,r,s);break;case"backwards":for(r=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ia(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}xc(t,!0,r,null,s);break;case"together":xc(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 hn(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),pi|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,r=On(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=On(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function PS(e,t,r){switch(t.tag){case 3:Iv(t),Zi();break;case 5:av(t);break;case 1:tr(t.type)&&Zl(t);break;case 4:Cd(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;Oe(ta,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(Oe(Ye,Ye.current&1),t.flags|=128,null):r&t.child.childLanes?Av(e,t,r):(Oe(Ye,Ye.current&1),e=hn(e,t,r),e!==null?e.sibling:null);Oe(Ye,Ye.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return Bv(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Oe(Ye,Ye.current),n)break;return null;case 22:case 23:return t.lanes=0,Dv(e,t,r)}return hn(e,t,r)}var Ov,$u,jv,zv;Ov=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};$u=function(){};jv=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,si(Yr.current);var s=null;switch(r){case"input":i=cu(e,i),n=cu(e,n),s=[];break;case"select":i=Ge({},i,{value:void 0}),n=Ge({},n,{value:void 0}),s=[];break;case"textarea":i=du(e,i),n=du(e,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Gl)}pu(r,n);var o;r=null;for(c in i)if(!n.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var l=i[c];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(to.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in n){var a=n[c];if(l=i!=null?i[c]:void 0,n.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(r||(r={}),r[o]=a[o])}else r||(s||(s=[]),s.push(c,r)),r=a;else c==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(s=s||[]).push(c,a)):c==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(c,""+a):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(to.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&ze("scroll",e),s||l===a||(s=[])):(s=s||[]).push(c,a))}r&&(s=s||[]).push("style",r);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};zv=function(e,t,r,n){r!==n&&(t.flags|=4)};function Ss(e,t){if(!He)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Rt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function LS(e,t,r){var n=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 Rt(t),null;case 1:return tr(t.type)&&Ql(),Rt(t),null;case 3:return n=t.stateNode,es(),$e(er),$e(At),Td(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(rl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Rr!==null&&(Xu(Rr),Rr=null))),$u(e,t),Rt(t),null;case 5:Ed(t);var i=si(po.current);if(r=t.type,e!==null&&t.stateNode!=null)jv(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(te(166));return Rt(t),null}if(e=si(Yr.current),rl(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[Kr]=t,n[ho]=s,e=(t.mode&1)!==0,r){case"dialog":ze("cancel",n),ze("close",n);break;case"iframe":case"object":case"embed":ze("load",n);break;case"video":case"audio":for(i=0;i<Bs.length;i++)ze(Bs[i],n);break;case"source":ze("error",n);break;case"img":case"image":case"link":ze("error",n),ze("load",n);break;case"details":ze("toggle",n);break;case"input":Pf(n,s),ze("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},ze("invalid",n);break;case"textarea":Rf(n,s),ze("invalid",n)}pu(r,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?n.textContent!==l&&(s.suppressHydrationWarning!==!0&&tl(n.textContent,l,e),i=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&tl(n.textContent,l,e),i=["children",""+l]):to.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&ze("scroll",n)}switch(r){case"input":qo(n),Lf(n,s,!0);break;case"textarea":qo(n),Df(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=Gl)}n=i,t.updateQueue=n,n!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=f_(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[Kr]=t,e[ho]=n,Ov(e,t,!1,!1),t.stateNode=e;e:{switch(o=mu(r,n),r){case"dialog":ze("cancel",e),ze("close",e),i=n;break;case"iframe":case"object":case"embed":ze("load",e),i=n;break;case"video":case"audio":for(i=0;i<Bs.length;i++)ze(Bs[i],e);i=n;break;case"source":ze("error",e),i=n;break;case"img":case"image":case"link":ze("error",e),ze("load",e),i=n;break;case"details":ze("toggle",e),i=n;break;case"input":Pf(e,n),i=cu(e,n),ze("invalid",e);break;case"option":i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=Ge({},n,{value:void 0}),ze("invalid",e);break;case"textarea":Rf(e,n),i=du(e,n),ze("invalid",e);break;default:i=n}pu(r,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&&p_(e,a)):s==="children"?typeof a=="string"?(r!=="textarea"||a!=="")&&ro(e,a):typeof a=="number"&&ro(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(to.hasOwnProperty(s)?a!=null&&s==="onScroll"&&ze("scroll",e):a!=null&&nd(e,s,a,o))}switch(r){case"input":qo(e),Lf(e,n,!1);break;case"textarea":qo(e),Df(e);break;case"option":n.value!=null&&e.setAttribute("value",""+zn(n.value));break;case"select":e.multiple=!!n.multiple,s=n.value,s!=null?Wi(e,!!n.multiple,s,!1):n.defaultValue!=null&&Wi(e,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Gl)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Rt(t),null;case 6:if(e&&t.stateNode!=null)zv(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(te(166));if(r=si(po.current),si(Yr.current),rl(t)){if(n=t.stateNode,r=t.memoizedProps,n[Kr]=t,(s=n.nodeValue!==r)&&(e=ur,e!==null))switch(e.tag){case 3:tl(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&tl(n.nodeValue,r,(e.mode&1)!==0)}s&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Kr]=t,t.stateNode=n}return Rt(t),null;case 13:if($e(Ye),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(He&&cr!==null&&t.mode&1&&!(t.flags&128))nv(),Zi(),t.flags|=98560,s=!1;else if(s=rl(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(te(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(te(317));s[Kr]=t}else Zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rt(t),s=!1}else Rr!==null&&(Xu(Rr),Rr=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||Ye.current&1?pt===0&&(pt=3):zd())),t.updateQueue!==null&&(t.flags|=4),Rt(t),null);case 4:return es(),$u(e,t),e===null&&co(t.stateNode.containerInfo),Rt(t),null;case 10:return wd(t.type._context),Rt(t),null;case 17:return tr(t.type)&&Ql(),Rt(t),null;case 19:if($e(Ye),s=t.memoizedState,s===null)return Rt(t),null;if(n=(t.flags&128)!==0,o=s.rendering,o===null)if(n)Ss(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,Ss(s,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)s=r,e=n,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Oe(Ye,Ye.current&1|2),t.child}e=e.sibling}s.tail!==null&&st()>rs&&(t.flags|=128,n=!0,Ss(s,!1),t.lanes=4194304)}else{if(!n)if(e=ia(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ss(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!He)return Rt(t),null}else 2*st()-s.renderingStartTime>rs&&r!==1073741824&&(t.flags|=128,n=!0,Ss(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=st(),t.sibling=null,r=Ye.current,Oe(Ye,n?r&1|2:r&1),t):(Rt(t),null);case 22:case 23:return jd(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?lr&1073741824&&(Rt(t),t.subtreeFlags&6&&(t.flags|=8192)):Rt(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function RS(e,t){switch(vd(t),t.tag){case 1:return tr(t.type)&&Ql(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return es(),$e(er),$e(At),Td(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ed(t),null;case 13:if($e(Ye),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));Zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $e(Ye),null;case 4:return es(),null;case 10:return wd(t.type._context),null;case 22:case 23:return jd(),null;case 24:return null;default:return null}}var sl=!1,Mt=!1,DS=typeof WeakSet=="function"?WeakSet:Set,de=null;function Fi(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){tt(e,t,n)}else r.current=null}function Hu(e,t,r){try{r()}catch(n){tt(e,t,n)}}var Sp=!1;function MS(e,t){if(Cu=ql,e=U_(),gd(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,l=-1,a=-1,c=0,h=0,u=e,d=null;t:for(;;){for(var f;u!==r||i!==0&&u.nodeType!==3||(l=o+i),u!==s||n!==0&&u.nodeType!==3||(a=o+n),u.nodeType===3&&(o+=u.nodeValue.length),(f=u.firstChild)!==null;)d=u,u=f;for(;;){if(u===e)break t;if(d===r&&++c===i&&(l=o),d===s&&++h===n&&(a=o),(f=u.nextSibling)!==null)break;u=d,d=u.parentNode}u=f}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Eu={focusedElem:e,selectionRange:r},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 m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,x=m.memoizedState,_=t.stateNode,v=_.getSnapshotBeforeUpdate(t.elementType===t.type?g:Pr(t.type,g),x);_.__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(te(163))}}catch(E){tt(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return m=Sp,Sp=!1,m}function Ys(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Hu(t,r,s)}i=i.next}while(i!==n)}}function Da(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Wu(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Fv(e){var t=e.alternate;t!==null&&(e.alternate=null,Fv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Kr],delete t[ho],delete t[Pu],delete t[mS],delete t[gS])),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 $v(e){return e.tag===5||e.tag===3||e.tag===4}function wp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||$v(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,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Gl));else if(n!==4&&(e=e.child,e!==null))for(Uu(e,t,r),e=e.sibling;e!==null;)Uu(e,t,r),e=e.sibling}function Ku(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Ku(e,t,r),e=e.sibling;e!==null;)Ku(e,t,r),e=e.sibling}var kt=null,Lr=!1;function gn(e,t,r){for(r=r.child;r!==null;)Hv(e,t,r),r=r.sibling}function Hv(e,t,r){if(qr&&typeof qr.onCommitFiberUnmount=="function")try{qr.onCommitFiberUnmount(ka,r)}catch{}switch(r.tag){case 5:Mt||Fi(r,t);case 6:var n=kt,i=Lr;kt=null,gn(e,t,r),kt=n,Lr=i,kt!==null&&(Lr?(e=kt,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):kt.removeChild(r.stateNode));break;case 18:kt!==null&&(Lr?(e=kt,r=r.stateNode,e.nodeType===8?fc(e.parentNode,r):e.nodeType===1&&fc(e,r),oo(e)):fc(kt,r.stateNode));break;case 4:n=kt,i=Lr,kt=r.stateNode.containerInfo,Lr=!0,gn(e,t,r),kt=n,Lr=i;break;case 0:case 11:case 14:case 15:if(!Mt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Hu(r,t,o),i=i.next}while(i!==n)}gn(e,t,r);break;case 1:if(!Mt&&(Fi(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){tt(r,t,l)}gn(e,t,r);break;case 21:gn(e,t,r);break;case 22:r.mode&1?(Mt=(n=Mt)||r.memoizedState!==null,gn(e,t,r),Mt=n):gn(e,t,r);break;default:gn(e,t,r)}}function bp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new DS),t.forEach(function(n){var i=HS.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Tr(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var i=r[n];try{var s=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:kt=l.stateNode,Lr=!1;break e;case 3:kt=l.stateNode.containerInfo,Lr=!0;break e;case 4:kt=l.stateNode.containerInfo,Lr=!0;break e}l=l.return}if(kt===null)throw Error(te(160));Hv(s,o,i),kt=null,Lr=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(c){tt(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Wv(t,e),t=t.sibling}function Wv(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Tr(t,e),jr(e),n&4){try{Ys(3,e,e.return),Da(3,e)}catch(g){tt(e,e.return,g)}try{Ys(5,e,e.return)}catch(g){tt(e,e.return,g)}}break;case 1:Tr(t,e),jr(e),n&512&&r!==null&&Fi(r,r.return);break;case 5:if(Tr(t,e),jr(e),n&512&&r!==null&&Fi(r,r.return),e.flags&32){var i=e.stateNode;try{ro(i,"")}catch(g){tt(e,e.return,g)}}if(n&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=r!==null?r.memoizedProps:s,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&h_(i,s),mu(l,o);var c=mu(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"?p_(i,u):h==="children"?ro(i,u):nd(i,h,u,c)}switch(l){case"input":uu(i,s);break;case"textarea":d_(i,s);break;case"select":var d=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var f=s.value;f!=null?Wi(i,!!s.multiple,f,!1):d!==!!s.multiple&&(s.defaultValue!=null?Wi(i,!!s.multiple,s.defaultValue,!0):Wi(i,!!s.multiple,s.multiple?[]:"",!1))}i[ho]=s}catch(g){tt(e,e.return,g)}}break;case 6:if(Tr(t,e),jr(e),n&4){if(e.stateNode===null)throw Error(te(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(g){tt(e,e.return,g)}}break;case 3:if(Tr(t,e),jr(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{oo(t.containerInfo)}catch(g){tt(e,e.return,g)}break;case 4:Tr(t,e),jr(e);break;case 13:Tr(t,e),jr(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Bd=st())),n&4&&bp(e);break;case 22:if(h=r!==null&&r.memoizedState!==null,e.mode&1?(Mt=(c=Mt)||h,Tr(t,e),Mt=c):Tr(t,e),jr(e),n&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 m=d.stateNode;if(typeof m.componentWillUnmount=="function"){n=d,r=d.return;try{t=n,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){tt(n,r,g)}}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=m_("display",o))}catch(g){tt(e,e.return,g)}}}else if(u.tag===6){if(h===null)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(g){tt(e,e.return,g)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;h===u&&(h=null),u=u.return}h===u&&(h=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:Tr(t,e),jr(e),n&4&&bp(e);break;case 21:break;default:Tr(t,e),jr(e)}}function jr(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if($v(r)){var n=r;break e}r=r.return}throw Error(te(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(ro(i,""),n.flags&=-33);var s=wp(e);Ku(e,s,i);break;case 3:case 4:var o=n.stateNode.containerInfo,l=wp(e);Uu(e,l,o);break;default:throw Error(te(161))}}catch(a){tt(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function IS(e,t,r){de=e,Uv(e)}function Uv(e,t,r){for(var n=(e.mode&1)!==0;de!==null;){var i=de,s=i.child;if(i.tag===22&&n){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,Uv(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 r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Mt||Da(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Mt)if(r===null)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:Pr(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&ap(t,s,n);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}ap(t,o,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break;case"img":a.src&&(r.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var h=c.memoizedState;if(h!==null){var u=h.dehydrated;u!==null&&oo(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}Mt||t.flags&512&&Wu(t)}catch(d){tt(t,t.return,d)}}if(t===e){de=null;break}if(r=t.sibling,r!==null){r.return=t.return,de=r;break}de=t.return}}function Cp(e){for(;de!==null;){var t=de;if(t===e){de=null;break}var r=t.sibling;if(r!==null){r.return=t.return,de=r;break}de=t.return}}function Ep(e){for(;de!==null;){var t=de;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{Da(4,t)}catch(a){tt(t,r,a)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var i=t.return;try{n.componentDidMount()}catch(a){tt(t,i,a)}}var s=t.return;try{Wu(t)}catch(a){tt(t,s,a)}break;case 5:var o=t.return;try{Wu(t)}catch(a){tt(t,o,a)}}}catch(a){tt(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 AS=Math.ceil,la=dn.ReactCurrentDispatcher,Id=dn.ReactCurrentOwner,br=dn.ReactCurrentBatchConfig,Re=0,wt=null,ct=null,Tt=0,lr=0,$i=Hn(0),pt=0,vo=null,pi=0,Ma=0,Ad=0,Xs=null,Zt=null,Bd=0,rs=1/0,en=null,aa=!1,Vu=null,An=null,ol=!1,Tn=null,ca=0,Gs=0,qu=null,Tl=-1,Nl=0;function Ht(){return Re&6?st():Tl!==-1?Tl:Tl=st()}function Bn(e){return e.mode&1?Re&2&&Tt!==0?Tt&-Tt:vS.transition!==null?(Nl===0&&(Nl=N_()),Nl):(e=Me,e!==0||(e=window.event,e=e===void 0?16:A_(e.type)),e):1}function Ir(e,t,r,n){if(50<Gs)throw Gs=0,qu=null,Error(te(185));To(e,r,n),(!(Re&2)||e!==wt)&&(e===wt&&(!(Re&2)&&(Ma|=r),pt===4&&Cn(e,Tt)),rr(e,n),r===1&&Re===0&&!(t.mode&1)&&(rs=st()+500,Pa&&Wn()))}function rr(e,t){var r=e.callbackNode;vx(e,t);var n=Vl(e,e===wt?Tt:0);if(n===0)r!==null&&Af(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&Af(r),t===1)e.tag===0?_S(Tp.bind(null,e)):ev(Tp.bind(null,e)),fS(function(){!(Re&6)&&Wn()}),r=null;else{switch(P_(n)){case 1:r=ad;break;case 4:r=E_;break;case 16:r=Kl;break;case 536870912:r=T_;break;default:r=Kl}r=Zv(r,Kv.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function Kv(e,t){if(Tl=-1,Nl=0,Re&6)throw Error(te(327));var r=e.callbackNode;if(Yi()&&e.callbackNode!==r)return null;var n=Vl(e,e===wt?Tt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=ua(e,n);else{t=n;var i=Re;Re|=2;var s=qv();(wt!==e||Tt!==t)&&(en=null,rs=st()+500,li(e,t));do try{jS();break}catch(l){Vv(e,l)}while(!0);Sd(),la.current=s,Re=i,ct!==null?t=0:(wt=null,Tt=0,t=pt)}if(t!==0){if(t===2&&(i=xu(e),i!==0&&(n=i,t=Yu(e,i))),t===1)throw r=vo,li(e,0),Cn(e,n),rr(e,st()),r;if(t===6)Cn(e,n);else{if(i=e.current.alternate,!(n&30)&&!BS(i)&&(t=ua(e,n),t===2&&(s=xu(e),s!==0&&(n=s,t=Yu(e,s))),t===1))throw r=vo,li(e,0),Cn(e,n),rr(e,st()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(te(345));case 2:Qn(e,Zt,en);break;case 3:if(Cn(e,n),(n&130023424)===n&&(t=Bd+500-st(),10<t)){if(Vl(e,0)!==0)break;if(i=e.suspendedLanes,(i&n)!==n){Ht(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Nu(Qn.bind(null,e,Zt,en),t);break}Qn(e,Zt,en);break;case 4:if(Cn(e,n),(n&4194240)===n)break;for(t=e.eventTimes,i=-1;0<n;){var o=31-Mr(n);s=1<<o,o=t[o],o>i&&(i=o),n&=~s}if(n=i,n=st()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*AS(n/1960))-n,10<n){e.timeoutHandle=Nu(Qn.bind(null,e,Zt,en),n);break}Qn(e,Zt,en);break;case 5:Qn(e,Zt,en);break;default:throw Error(te(329))}}}return rr(e,st()),e.callbackNode===r?Kv.bind(null,e):null}function Yu(e,t){var r=Xs;return e.current.memoizedState.isDehydrated&&(li(e,t).flags|=256),e=ua(e,t),e!==2&&(t=Zt,Zt=r,t!==null&&Xu(t)),e}function Xu(e){Zt===null?Zt=e:Zt.push.apply(Zt,e)}function BS(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var i=r[n],s=i.getSnapshot;i=i.value;try{if(!Br(s(),i))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Cn(e,t){for(t&=~Ad,t&=~Ma,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Mr(t),n=1<<r;e[r]=-1,t&=~n}}function Tp(e){if(Re&6)throw Error(te(327));Yi();var t=Vl(e,0);if(!(t&1))return rr(e,st()),null;var r=ua(e,t);if(e.tag!==0&&r===2){var n=xu(e);n!==0&&(t=n,r=Yu(e,n))}if(r===1)throw r=vo,li(e,0),Cn(e,t),rr(e,st()),r;if(r===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Qn(e,Zt,en),rr(e,st()),null}function Od(e,t){var r=Re;Re|=1;try{return e(t)}finally{Re=r,Re===0&&(rs=st()+500,Pa&&Wn())}}function mi(e){Tn!==null&&Tn.tag===0&&!(Re&6)&&Yi();var t=Re;Re|=1;var r=br.transition,n=Me;try{if(br.transition=null,Me=1,e)return e()}finally{Me=n,br.transition=r,Re=t,!(Re&6)&&Wn()}}function jd(){lr=$i.current,$e($i)}function li(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,dS(r)),ct!==null)for(r=ct.return;r!==null;){var n=r;switch(vd(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Ql();break;case 3:es(),$e(er),$e(At),Td();break;case 5:Ed(n);break;case 4:es();break;case 13:$e(Ye);break;case 19:$e(Ye);break;case 10:wd(n.type._context);break;case 22:case 23:jd()}r=r.return}if(wt=e,ct=e=On(e.current,null),Tt=lr=t,pt=0,vo=null,Ad=Ma=pi=0,Zt=Xs=null,ii!==null){for(t=0;t<ii.length;t++)if(r=ii[t],n=r.interleaved,n!==null){r.interleaved=null;var i=n.next,s=r.pending;if(s!==null){var o=s.next;s.next=i,n.next=o}r.pending=n}ii=null}return e}function Vv(e,t){do{var r=ct;try{if(Sd(),kl.current=oa,sa){for(var n=Xe.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}sa=!1}if(fi=0,vt=ft=Xe=null,qs=!1,mo=0,Id.current=null,r===null||r.return===null){pt=1,vo=t,ct=null;break}e:{var s=e,o=r.return,l=r,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,mp(f,o,l,s,t),f.mode&1&&fp(s,c,t),t=f,a=c;var m=t.updateQueue;if(m===null){var g=new Set;g.add(a),t.updateQueue=g}else m.add(a);break e}else{if(!(t&1)){fp(s,c,t),zd();break e}a=Error(te(426))}}else if(He&&l.mode&1){var x=pp(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),mp(x,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 _=Pv(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"&&(An===null||!An.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t;var E=Lv(s,l,t);lp(s,E);break e}}s=s.return}while(s!==null)}Xv(r)}catch(N){t=N,ct===r&&r!==null&&(ct=r=r.return);continue}break}while(!0)}function qv(){var e=la.current;return la.current=oa,e===null?oa:e}function zd(){(pt===0||pt===3||pt===2)&&(pt=4),wt===null||!(pi&268435455)&&!(Ma&268435455)||Cn(wt,Tt)}function ua(e,t){var r=Re;Re|=2;var n=qv();(wt!==e||Tt!==t)&&(en=null,li(e,t));do try{OS();break}catch(i){Vv(e,i)}while(!0);if(Sd(),Re=r,la.current=n,ct!==null)throw Error(te(261));return wt=null,Tt=0,pt}function OS(){for(;ct!==null;)Yv(ct)}function jS(){for(;ct!==null&&!cx();)Yv(ct)}function Yv(e){var t=Qv(e.alternate,e,lr);e.memoizedProps=e.pendingProps,t===null?Xv(e):ct=t,Id.current=null}function Xv(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=RS(r,t),r!==null){r.flags&=32767,ct=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{pt=6,ct=null;return}}else if(r=LS(r,t,lr),r!==null){ct=r;return}if(t=t.sibling,t!==null){ct=t;return}ct=t=e}while(t!==null);pt===0&&(pt=5)}function Qn(e,t,r){var n=Me,i=br.transition;try{br.transition=null,Me=1,zS(e,t,r,n)}finally{br.transition=i,Me=n}return null}function zS(e,t,r,n){do Yi();while(Tn!==null);if(Re&6)throw Error(te(327));r=e.finishedWork;var i=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(te(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(yx(e,s),e===wt&&(ct=wt=null,Tt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||ol||(ol=!0,Zv(Kl,function(){return Yi(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=br.transition,br.transition=null;var o=Me;Me=1;var l=Re;Re|=4,Id.current=null,MS(e,r),Wv(r,e),sS(Eu),ql=!!Cu,Eu=Cu=null,e.current=r,IS(r),ux(),Re=l,Me=o,br.transition=s}else e.current=r;if(ol&&(ol=!1,Tn=e,ca=i),s=e.pendingLanes,s===0&&(An=null),fx(r.stateNode),rr(e,st()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)i=t[r],n(i.value,{componentStack:i.stack,digest:i.digest});if(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,Wn(),null}function Yi(){if(Tn!==null){var e=P_(ca),t=br.transition,r=Me;try{if(br.transition=null,Me=16>e?16:e,Tn===null)var n=!1;else{if(e=Tn,Tn=null,ca=0,Re&6)throw Error(te(331));var i=Re;for(Re|=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(Fv(h),h===c){de=null;break}if(d!==null){d.return=f,de=d;break}de=f}}}var m=s.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var x=g.sibling;g.sibling=null,g=x}while(g!==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(N){tt(l,l.return,N)}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(Re=i,Wn(),qr&&typeof qr.onPostCommitFiberRoot=="function")try{qr.onPostCommitFiberRoot(ka,e)}catch{}n=!0}return n}finally{Me=r,br.transition=t}}return!1}function Np(e,t,r){t=ts(r,t),t=Pv(e,t,1),e=In(e,t,1),t=Ht(),e!==null&&(To(e,1,t),rr(e,t))}function tt(e,t,r){if(e.tag===3)Np(e,e,r);else for(;t!==null;){if(t.tag===3){Np(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(An===null||!An.has(n))){e=ts(r,e),e=Lv(t,e,1),t=In(t,e,1),e=Ht(),t!==null&&(To(t,1,e),rr(t,e));break}}t=t.return}}function FS(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=Ht(),e.pingedLanes|=e.suspendedLanes&r,wt===e&&(Tt&r)===r&&(pt===4||pt===3&&(Tt&130023424)===Tt&&500>st()-Bd?li(e,0):Ad|=r),rr(e,t)}function Gv(e,t){t===0&&(e.mode&1?(t=Go,Go<<=1,!(Go&130023424)&&(Go=4194304)):t=1);var r=Ht();e=un(e,t),e!==null&&(To(e,t,r),rr(e,r))}function $S(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Gv(e,r)}function HS(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(te(314))}n!==null&&n.delete(t),Gv(e,r)}var Qv;Qv=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||er.current)Jt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Jt=!1,PS(e,t,r);Jt=!!(e.flags&131072)}else Jt=!1,He&&t.flags&1048576&&tv(t,ea,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;El(e,t),e=t.pendingProps;var i=Qi(t,At.current);qi(t,r),i=Pd(null,t,n,e,i,r);var s=Ld();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,tr(n)?(s=!0,Zl(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,kd(t),i.updater=Ra,t.stateNode=i,i._reactInternals=t,Au(t,n,e,r),t=ju(null,t,n,!0,s,r)):(t.tag=0,He&&s&&_d(t),Ft(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(El(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=US(n),e=Pr(n,e),i){case 0:t=Ou(null,t,n,e,r);break e;case 1:t=vp(null,t,n,e,r);break e;case 11:t=gp(null,t,n,e,r);break e;case 14:t=_p(null,t,n,Pr(n.type,e),r);break e}throw Error(te(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Pr(n,i),Ou(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Pr(n,i),vp(e,t,n,i,r);case 3:e:{if(Iv(t),e===null)throw Error(te(387));n=t.pendingProps,s=t.memoizedState,i=s.element,lv(e,t),na(t,n,null,r);var o=t.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=ts(Error(te(423)),t),t=yp(e,t,n,r,i);break e}else if(n!==i){i=ts(Error(te(424)),t),t=yp(e,t,n,r,i);break e}else for(cr=Mn(t.stateNode.containerInfo.firstChild),ur=t,He=!0,Rr=null,r=sv(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Zi(),n===i){t=hn(e,t,r);break e}Ft(e,t,n,r)}t=t.child}return t;case 5:return av(t),e===null&&Du(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Tu(n,i)?o=null:s!==null&&Tu(n,s)&&(t.flags|=32),Mv(e,t),Ft(e,t,o,r),t.child;case 6:return e===null&&Du(t),null;case 13:return Av(e,t,r);case 4:return Cd(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ji(t,null,n,r):Ft(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Pr(n,i),gp(e,t,n,i,r);case 7:return Ft(e,t,t.pendingProps,r),t.child;case 8:return Ft(e,t,t.pendingProps.children,r),t.child;case 12:return Ft(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Oe(ta,n._currentValue),n._currentValue=o,s!==null)if(Br(s.value,o)){if(s.children===i.children&&!er.current){t=hn(e,t,r);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(s.tag===1){a=ln(-1,r&-r),a.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?a.next=a:(a.next=h.next,h.next=a),c.pending=a}}s.lanes|=r,a=s.alternate,a!==null&&(a.lanes|=r),Mu(s.return,r,t),l.lanes|=r;break}a=a.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(te(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),Mu(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ft(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,qi(t,r),i=Cr(i),n=n(i),t.flags|=1,Ft(e,t,n,r),t.child;case 14:return n=t.type,i=Pr(n,t.pendingProps),i=Pr(n.type,i),_p(e,t,n,i,r);case 15:return Rv(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Pr(n,i),El(e,t),t.tag=1,tr(n)?(e=!0,Zl(t)):e=!1,qi(t,r),Nv(t,n,i),Au(t,n,i,r),ju(null,t,n,!0,e,r);case 19:return Bv(e,t,r);case 22:return Dv(e,t,r)}throw Error(te(156,t.tag))};function Zv(e,t){return C_(e,t)}function WS(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wr(e,t,r,n){return new WS(e,t,r,n)}function Fd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function US(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 On(e,t){var r=e.alternate;return r===null?(r=wr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Pl(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")Fd(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ri:return ai(r.children,i,s,t);case id:o=8,i|=8;break;case su:return e=wr(12,r,t,i|2),e.elementType=su,e.lanes=s,e;case ou:return e=wr(13,r,t,i),e.elementType=ou,e.lanes=s,e;case lu:return e=wr(19,r,t,i),e.elementType=lu,e.lanes=s,e;case a_:return Ia(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case o_:o=10;break e;case l_:o=9;break e;case sd:o=11;break e;case od:o=14;break e;case Sn:o=16,n=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=wr(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function ai(e,t,r,n){return e=wr(7,e,n,t),e.lanes=r,e}function Ia(e,t,r,n){return e=wr(22,e,n,t),e.elementType=a_,e.lanes=r,e.stateNode={isHidden:!1},e}function Sc(e,t,r){return e=wr(6,e,null,t),e.lanes=r,e}function wc(e,t,r){return t=wr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function KS(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=rc(0),this.expirationTimes=rc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function $d(e,t,r,n,i,s,o,l,a){return e=new KS(e,t,r,l,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=wr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},kd(s),e}function VS(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Li,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function Jv(e){if(!e)return Fn;e=e._reactInternals;e:{if(xi(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(tr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var r=e.type;if(tr(r))return J_(e,r,t)}return t}function e0(e,t,r,n,i,s,o,l,a){return e=$d(r,n,!0,e,i,s,o,l,a),e.context=Jv(null),r=e.current,n=Ht(),i=Bn(r),s=ln(n,i),s.callback=t??null,In(r,s,i),e.current.lanes=i,To(e,i,n),rr(e,n),e}function Aa(e,t,r,n){var i=t.current,s=Ht(),o=Bn(i);return r=Jv(r),t.context===null?t.context=r:t.pendingContext=r,t=ln(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=In(i,t,o),e!==null&&(Ir(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 Pp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Hd(e,t){Pp(e,t),(e=e.alternate)&&Pp(e,t)}function qS(){return null}var t0=typeof reportError=="function"?reportError:function(e){console.error(e)};function Wd(e){this._internalRoot=e}Ba.prototype.render=Wd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));Aa(e,t,null,null)};Ba.prototype.unmount=Wd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;mi(function(){Aa(null,e,null,null)}),t[cn]=null}};function Ba(e){this._internalRoot=e}Ba.prototype.unstable_scheduleHydration=function(e){if(e){var t=D_();e={blockedOn:null,target:e,priority:t};for(var r=0;r<kn.length&&t!==0&&t<kn[r].priority;r++);kn.splice(r,0,e),r===0&&I_(e)}};function Ud(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Oa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Lp(){}function YS(e,t,r,n,i){if(i){if(typeof n=="function"){var s=n;n=function(){var c=ha(o);s.call(c)}}var o=e0(t,n,e,0,null,!1,!1,"",Lp);return e._reactRootContainer=o,e[cn]=o.current,co(e.nodeType===8?e.parentNode:e),mi(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof n=="function"){var l=n;n=function(){var c=ha(a);l.call(c)}}var a=$d(e,0,!1,null,null,!1,!1,"",Lp);return e._reactRootContainer=a,e[cn]=a.current,co(e.nodeType===8?e.parentNode:e),mi(function(){Aa(t,a,r,n)}),a}function ja(e,t,r,n,i){var s=r._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var a=ha(o);l.call(a)}}Aa(t,o,e,i)}else o=YS(r,t,e,i,n);return ha(o)}L_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=As(t.pendingLanes);r!==0&&(cd(t,r|1),rr(t,st()),!(Re&6)&&(rs=st()+500,Wn()))}break;case 13:mi(function(){var n=un(e,1);if(n!==null){var i=Ht();Ir(n,e,1,i)}}),Hd(e,1)}};ud=function(e){if(e.tag===13){var t=un(e,134217728);if(t!==null){var r=Ht();Ir(t,e,134217728,r)}Hd(e,134217728)}};R_=function(e){if(e.tag===13){var t=Bn(e),r=un(e,t);if(r!==null){var n=Ht();Ir(r,e,t,n)}Hd(e,t)}};D_=function(){return Me};M_=function(e,t){var r=Me;try{return Me=e,t()}finally{Me=r}};_u=function(e,t,r){switch(t){case"input":if(uu(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=Na(n);if(!i)throw Error(te(90));u_(n),uu(n,i)}}}break;case"textarea":d_(e,r);break;case"select":t=r.value,t!=null&&Wi(e,!!r.multiple,t,!1)}};y_=Od;x_=mi;var XS={usingClientEntryPoint:!1,Events:[Po,Ai,Na,__,v_,Od]},ws={findFiberByHostInstance:ni,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},GS={bundleType:ws.bundleType,version:ws.version,rendererPackageName:ws.rendererPackageName,rendererConfig:ws.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:dn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=b_(e),e===null?null:e.stateNode},findFiberByHostInstance:ws.findFiberByHostInstance||qS,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(GS),qr=ll}catch{}}fr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=XS;fr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ud(t))throw Error(te(200));return VS(e,t,null,r)};fr.createRoot=function(e,t){if(!Ud(e))throw Error(te(299));var r=!1,n="",i=t0;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=$d(e,1,!1,null,null,r,!1,n,i),e[cn]=t.current,co(e.nodeType===8?e.parentNode:e),new Wd(t)};fr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=b_(t),e=e===null?null:e.stateNode,e};fr.flushSync=function(e){return mi(e)};fr.hydrate=function(e,t,r){if(!Oa(t))throw Error(te(200));return ja(null,e,t,!0,r)};fr.hydrateRoot=function(e,t,r){if(!Ud(e))throw Error(te(405));var n=r!=null&&r.hydratedSources||null,i=!1,s="",o=t0;if(r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=e0(t,null,e,1,r??null,i,!1,s,o),e[cn]=t.current,co(e),n)for(e=0;e<n.length;e++)r=n[e],i=r._getVersion,i=i(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,i]:t.mutableSourceEagerHydrationData.push(r,i);return new Ba(t)};fr.render=function(e,t,r){if(!Oa(t))throw Error(te(200));return ja(null,e,t,!1,r)};fr.unmountComponentAtNode=function(e){if(!Oa(e))throw Error(te(40));return e._reactRootContainer?(mi(function(){ja(null,null,e,!1,function(){e._reactRootContainer=null,e[cn]=null})}),!0):!1};fr.unstable_batchedUpdates=Od;fr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Oa(r))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return ja(e,t,r,!1,n)};fr.version="18.3.1-next-f1338f8080-20240426";function r0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r0)}catch(e){console.error(e)}}r0(),r_.exports=fr;var QS=r_.exports,n0,Rp=QS;n0=Rp.createRoot,Rp.hydrateRoot;/**
40
+ `+s.stack}return{value:e,source:t,stack:i,digest:null}}function yc(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Bu(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var OS=typeof WeakMap=="function"?WeakMap:Map;function zv(e,t,r){r=on(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){oa||(oa=!0,Vu=n),Bu(e,t)},r}function Fv(e,t,r){r=on(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){Bu(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){Bu(e,t),typeof n!="function"&&(An===null?An=new Set([this]):An.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function wp(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new OS;var i=new Set;n.set(t,i)}else i=n.get(t),i===void 0&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=QS.bind(null,e,t,r),t.then(e,e))}function bp(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 kp(e,t,r,n,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=on(-1,1),t.tag=2,In(r,t,1))),r.lanes|=1),e)}var jS=hn.ReactCurrentOwner,Yt=!1;function Ot(e,t,r,n){t.child=e===null?mv(t,null,r,n):Ji(t,e.child,r,n)}function Cp(e,t,r,n,i){r=r.render;var s=t.ref;return qi(t,i),n=Pd(e,t,r,n,s,i),r=Ld(),e!==null&&!Yt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,un(e,t,i)):(He&&r&&_d(t),t.flags|=1,Ot(e,t,n,i),t.child)}function Ep(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!Fd(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,$v(e,t,s,n,i)):(e=Nl(r.type,null,n,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:ao,r(o,n)&&e.ref===t.ref)return un(e,t,i)}return t.flags|=1,e=On(s,n),e.ref=t.ref,e.return=t,t.child=e}function $v(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(ao(s,n)&&e.ref===t.ref)if(Yt=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&(Yt=!0);else return t.lanes=e.lanes,un(e,t,i)}return Ou(e,t,r,n,i)}function Hv(e,t,r){var n=t.pendingProps,i=n.children,s=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Oe($i,rr),rr|=r;else{if(!(r&1073741824))return e=s!==null?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Oe($i,rr),rr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,Oe($i,rr),rr|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,Oe($i,rr),rr|=n;return Ot(e,t,i,r),t.child}function Wv(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ou(e,t,r,n,i){var s=Gt(r)?ui:Mt.current;return s=Qi(t,s),qi(t,i),r=Pd(e,t,r,n,s,i),n=Ld(),e!==null&&!Yt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,un(e,t,i)):(He&&n&&_d(t),t.flags|=1,Ot(e,t,r,i),t.child)}function Np(e,t,r,n,i){if(Gt(r)){var s=!0;Gl(t)}else s=!1;if(qi(t,i),t.stateNode===null)kl(e,t),jv(t,r,n),Au(t,r,n,i),n=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var a=o.context,c=r.contextType;typeof c=="object"&&c!==null?c=wr(c):(c=Gt(r)?ui:Mt.current,c=Qi(t,c));var h=r.getDerivedStateFromProps,u=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||a!==c)&&Sp(t,o,n,c),wn=!1;var d=t.memoizedState;o.state=d,ta(t,n,o,i),a=t.memoizedState,l!==n||d!==a||Xt.current||wn?(typeof h=="function"&&(Iu(t,r,h,n),a=t.memoizedState),(l=wn||xp(t,r,l,n,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=n,t.memoizedState=a),o.props=n,o.state=a,o.context=c,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,_v(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Tr(t.type,l),o.props=c,u=t.pendingProps,d=o.context,a=r.contextType,typeof a=="object"&&a!==null?a=wr(a):(a=Gt(r)?ui:Mt.current,a=Qi(t,a));var f=r.getDerivedStateFromProps;(h=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==u||d!==a)&&Sp(t,o,n,a),wn=!1,d=t.memoizedState,o.state=d,ta(t,n,o,i);var m=t.memoizedState;l!==u||d!==m||Xt.current||wn?(typeof f=="function"&&(Iu(t,r,f,n),m=t.memoizedState),(c=wn||xp(t,r,c,n,d,m,a)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=a,n=c):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),n=!1)}return ju(e,t,r,n,s,i)}function ju(e,t,r,n,i,s){Wv(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&dp(t,r,!1),un(e,t,s);n=t.stateNode,jS.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=Ji(t,e.child,null,s),t.child=Ji(t,null,l,s)):Ot(e,t,l,s),t.memoizedState=n.state,i&&dp(t,r,!0),t.child}function Uv(e){var t=e.stateNode;t.pendingContext?hp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&hp(e,t.context,!1),Cd(e,t.containerInfo)}function Tp(e,t,r,n,i){return Zi(),yd(i),t.flags|=256,Ot(e,t,r,n),t.child}var zu={dehydrated:null,treeContext:null,retryLane:0};function Fu(e){return{baseLanes:e,cachePool:null,transitions:null}}function Kv(e,t,r){var n=t.pendingProps,i=Ve.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(Ve,i&1),e===null)return Ru(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=n.children,e=n.fallback,s?(n=t.mode,s=t.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Ra(o,n,0,null),e=li(e,n,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Fu(r),t.memoizedState=zu,e):Md(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return zS(e,t,o,n,l,i,r);if(s){s=n.fallback,o=t.mode,i=e.child,l=i.sibling;var a={mode:"hidden",children:n.children};return!(o&1)&&t.child!==i?(n=t.child,n.childLanes=0,n.pendingProps=a,t.deletions=null):(n=On(i,a),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=On(l,s):(s=li(s,o,r,null),s.flags|=2),s.return=t,n.return=t,n.sibling=s,t.child=n,n=s,s=t.child,o=e.child.memoizedState,o=o===null?Fu(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=zu,n}return s=e.child,e=s.sibling,n=On(s,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function Md(e,t){return t=Ra({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function rl(e,t,r,n){return n!==null&&yd(n),Ji(t,e.child,null,r),e=Md(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function zS(e,t,r,n,i,s,o){if(r)return t.flags&256?(t.flags&=-257,n=yc(Error(te(422))),rl(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=Ra({mode:"visible",children:n.children},i,0,null),s=li(s,i,o,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,t.mode&1&&Ji(t,e.child,null,o),t.child.memoizedState=Fu(o),t.memoizedState=zu,s);if(!(t.mode&1))return rl(e,t,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,s=Error(te(419)),n=yc(s,n,void 0),rl(e,t,o,n)}if(l=(o&e.childLanes)!==0,Yt||l){if(n=xt,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,cn(e,i),Mr(n,e,i,-1))}return zd(),n=yc(Error(te(421))),rl(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=ZS.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,ir=Mn(i.nextSibling),sr=t,He=!0,Lr=null,e!==null&&(gr[_r++]=rn,gr[_r++]=nn,gr[_r++]=hi,rn=e.id,nn=e.overflow,hi=t),t=Md(t,n.children),t.flags|=4096,t)}function Pp(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Mu(e.return,t,r)}function xc(e,t,r,n,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function Vv(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(Ot(e,t,n.children,r),n=Ve.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Pp(e,r,t);else if(e.tag===19)Pp(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(Oe(Ve,n),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;r!==null;)e=r.alternate,e!==null&&ra(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),xc(t,!1,i,r,s);break;case"backwards":for(r=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ra(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}xc(t,!0,r,null,s);break;case"together":xc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function kl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function un(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),fi|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,r=On(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=On(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function FS(e,t,r){switch(t.tag){case 3:Uv(t),Zi();break;case 5:vv(t);break;case 1:Gt(t.type)&&Gl(t);break;case 4:Cd(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;Oe(Jl,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(Oe(Ve,Ve.current&1),t.flags|=128,null):r&t.child.childLanes?Kv(e,t,r):(Oe(Ve,Ve.current&1),e=un(e,t,r),e!==null?e.sibling:null);Oe(Ve,Ve.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return Vv(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Oe(Ve,Ve.current),n)break;return null;case 22:case 23:return t.lanes=0,Hv(e,t,r)}return un(e,t,r)}var qv,$u,Yv,Xv;qv=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};$u=function(){};Yv=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,ii(Yr.current);var s=null;switch(r){case"input":i=cu(e,i),n=cu(e,n),s=[];break;case"select":i=Ye({},i,{value:void 0}),n=Ye({},n,{value:void 0}),s=[];break;case"textarea":i=du(e,i),n=du(e,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Yl)}pu(r,n);var o;r=null;for(c in i)if(!n.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var l=i[c];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(to.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in n){var a=n[c];if(l=i!=null?i[c]:void 0,n.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(r||(r={}),r[o]=a[o])}else r||(s||(s=[]),s.push(c,r)),r=a;else c==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(s=s||[]).push(c,a)):c==="children"?typeof a!="string"&&typeof a!="number"||(s=s||[]).push(c,""+a):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(to.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&ze("scroll",e),s||l===a||(s=[])):(s=s||[]).push(c,a))}r&&(s=s||[]).push("style",r);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};Xv=function(e,t,r,n){r!==n&&(t.flags|=4)};function Ss(e,t){if(!He)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Pt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function $S(e,t,r){var n=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 Pt(t),null;case 1:return Gt(t.type)&&Xl(),Pt(t),null;case 3:return n=t.stateNode,es(),$e(Xt),$e(Mt),Nd(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(el(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Lr!==null&&(Xu(Lr),Lr=null))),$u(e,t),Pt(t),null;case 5:Ed(t);var i=ii(po.current);if(r=t.type,e!==null&&t.stateNode!=null)Yv(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(te(166));return Pt(t),null}if(e=ii(Yr.current),el(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[Kr]=t,n[ho]=s,e=(t.mode&1)!==0,r){case"dialog":ze("cancel",n),ze("close",n);break;case"iframe":case"object":case"embed":ze("load",n);break;case"video":case"audio":for(i=0;i<Bs.length;i++)ze(Bs[i],n);break;case"source":ze("error",n);break;case"img":case"image":case"link":ze("error",n),ze("load",n);break;case"details":ze("toggle",n);break;case"input":jf(n,s),ze("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},ze("invalid",n);break;case"textarea":Ff(n,s),ze("invalid",n)}pu(r,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?n.textContent!==l&&(s.suppressHydrationWarning!==!0&&Jo(n.textContent,l,e),i=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Jo(n.textContent,l,e),i=["children",""+l]):to.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&ze("scroll",n)}switch(r){case"input":Ko(n),zf(n,s,!0);break;case"textarea":Ko(n),$f(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=Yl)}n=i,t.updateQueue=n,n!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=b_(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[Kr]=t,e[ho]=n,qv(e,t,!1,!1),t.stateNode=e;e:{switch(o=mu(r,n),r){case"dialog":ze("cancel",e),ze("close",e),i=n;break;case"iframe":case"object":case"embed":ze("load",e),i=n;break;case"video":case"audio":for(i=0;i<Bs.length;i++)ze(Bs[i],e);i=n;break;case"source":ze("error",e),i=n;break;case"img":case"image":case"link":ze("error",e),ze("load",e),i=n;break;case"details":ze("toggle",e),i=n;break;case"input":jf(e,n),i=cu(e,n),ze("invalid",e);break;case"option":i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=Ye({},n,{value:void 0}),ze("invalid",e);break;case"textarea":Ff(e,n),i=du(e,n),ze("invalid",e);break;default:i=n}pu(r,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?E_(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&k_(e,a)):s==="children"?typeof a=="string"?(r!=="textarea"||a!=="")&&ro(e,a):typeof a=="number"&&ro(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(to.hasOwnProperty(s)?a!=null&&s==="onScroll"&&ze("scroll",e):a!=null&&nd(e,s,a,o))}switch(r){case"input":Ko(e),zf(e,n,!1);break;case"textarea":Ko(e),$f(e);break;case"option":n.value!=null&&e.setAttribute("value",""+zn(n.value));break;case"select":e.multiple=!!n.multiple,s=n.value,s!=null?Wi(e,!!n.multiple,s,!1):n.defaultValue!=null&&Wi(e,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Yl)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Pt(t),null;case 6:if(e&&t.stateNode!=null)Xv(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(te(166));if(r=ii(po.current),ii(Yr.current),el(t)){if(n=t.stateNode,r=t.memoizedProps,n[Kr]=t,(s=n.nodeValue!==r)&&(e=sr,e!==null))switch(e.tag){case 3:Jo(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Jo(n.nodeValue,r,(e.mode&1)!==0)}s&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Kr]=t,t.stateNode=n}return Pt(t),null;case 13:if($e(Ve),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(He&&ir!==null&&t.mode&1&&!(t.flags&128))fv(),Zi(),t.flags|=98560,s=!1;else if(s=el(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(te(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(te(317));s[Kr]=t}else Zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pt(t),s=!1}else Lr!==null&&(Xu(Lr),Lr=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||Ve.current&1?ht===0&&(ht=3):zd())),t.updateQueue!==null&&(t.flags|=4),Pt(t),null);case 4:return es(),$u(e,t),e===null&&co(t.stateNode.containerInfo),Pt(t),null;case 10:return wd(t.type._context),Pt(t),null;case 17:return Gt(t.type)&&Xl(),Pt(t),null;case 19:if($e(Ve),s=t.memoizedState,s===null)return Pt(t),null;if(n=(t.flags&128)!==0,o=s.rendering,o===null)if(n)Ss(s,!1);else{if(ht!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ra(e),o!==null){for(t.flags|=128,Ss(s,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)s=r,e=n,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Oe(Ve,Ve.current&1|2),t.child}e=e.sibling}s.tail!==null&&tt()>rs&&(t.flags|=128,n=!0,Ss(s,!1),t.lanes=4194304)}else{if(!n)if(e=ra(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ss(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!He)return Pt(t),null}else 2*tt()-s.renderingStartTime>rs&&r!==1073741824&&(t.flags|=128,n=!0,Ss(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=tt(),t.sibling=null,r=Ve.current,Oe(Ve,n?r&1|2:r&1),t):(Pt(t),null);case 22:case 23:return jd(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?rr&1073741824&&(Pt(t),t.subtreeFlags&6&&(t.flags|=8192)):Pt(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function HS(e,t){switch(vd(t),t.tag){case 1:return Gt(t.type)&&Xl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return es(),$e(Xt),$e(Mt),Nd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ed(t),null;case 13:if($e(Ve),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));Zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $e(Ve),null;case 4:return es(),null;case 10:return wd(t.type._context),null;case 22:case 23:return jd(),null;case 24:return null;default:return null}}var nl=!1,Dt=!1,WS=typeof WeakSet=="function"?WeakSet:Set,fe=null;function Fi(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Ze(e,t,n)}else r.current=null}function Hu(e,t,r){try{r()}catch(n){Ze(e,t,n)}}var Lp=!1;function US(e,t){if(Cu=Kl,e=ev(),gd(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,l=-1,a=-1,c=0,h=0,u=e,d=null;t:for(;;){for(var f;u!==r||i!==0&&u.nodeType!==3||(l=o+i),u!==s||n!==0&&u.nodeType!==3||(a=o+n),u.nodeType===3&&(o+=u.nodeValue.length),(f=u.firstChild)!==null;)d=u,u=f;for(;;){if(u===e)break t;if(d===r&&++c===i&&(l=o),d===s&&++h===n&&(a=o),(f=u.nextSibling)!==null)break;u=d,d=u.parentNode}u=f}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Eu={focusedElem:e,selectionRange:r},Kl=!1,fe=t;fe!==null;)if(t=fe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,fe=e;else for(;fe!==null;){t=fe;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,x=m.memoizedState,_=t.stateNode,v=_.getSnapshotBeforeUpdate(t.elementType===t.type?g:Tr(t.type,g),x);_.__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(te(163))}}catch(E){Ze(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,fe=e;break}fe=t.return}return m=Lp,Lp=!1,m}function Ys(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Hu(t,r,s)}i=i.next}while(i!==n)}}function La(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Wu(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Gv(e){var t=e.alternate;t!==null&&(e.alternate=null,Gv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Kr],delete t[ho],delete t[Pu],delete t[ES],delete t[NS])),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 Qv(e){return e.tag===5||e.tag===3||e.tag===4}function Dp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Qv(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,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Yl));else if(n!==4&&(e=e.child,e!==null))for(Uu(e,t,r),e=e.sibling;e!==null;)Uu(e,t,r),e=e.sibling}function Ku(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Ku(e,t,r),e=e.sibling;e!==null;)Ku(e,t,r),e=e.sibling}var wt=null,Pr=!1;function gn(e,t,r){for(r=r.child;r!==null;)Zv(e,t,r),r=r.sibling}function Zv(e,t,r){if(qr&&typeof qr.onCommitFiberUnmount=="function")try{qr.onCommitFiberUnmount(wa,r)}catch{}switch(r.tag){case 5:Dt||Fi(r,t);case 6:var n=wt,i=Pr;wt=null,gn(e,t,r),wt=n,Pr=i,wt!==null&&(Pr?(e=wt,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):wt.removeChild(r.stateNode));break;case 18:wt!==null&&(Pr?(e=wt,r=r.stateNode,e.nodeType===8?fc(e.parentNode,r):e.nodeType===1&&fc(e,r),oo(e)):fc(wt,r.stateNode));break;case 4:n=wt,i=Pr,wt=r.stateNode.containerInfo,Pr=!0,gn(e,t,r),wt=n,Pr=i;break;case 0:case 11:case 14:case 15:if(!Dt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Hu(r,t,o),i=i.next}while(i!==n)}gn(e,t,r);break;case 1:if(!Dt&&(Fi(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){Ze(r,t,l)}gn(e,t,r);break;case 21:gn(e,t,r);break;case 22:r.mode&1?(Dt=(n=Dt)||r.memoizedState!==null,gn(e,t,r),Dt=n):gn(e,t,r);break;default:gn(e,t,r)}}function Rp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new WS),t.forEach(function(n){var i=JS.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Er(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var i=r[n];try{var s=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:wt=l.stateNode,Pr=!1;break e;case 3:wt=l.stateNode.containerInfo,Pr=!0;break e;case 4:wt=l.stateNode.containerInfo,Pr=!0;break e}l=l.return}if(wt===null)throw Error(te(160));Zv(s,o,i),wt=null,Pr=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(c){Ze(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Jv(t,e),t=t.sibling}function Jv(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Er(t,e),jr(e),n&4){try{Ys(3,e,e.return),La(3,e)}catch(g){Ze(e,e.return,g)}try{Ys(5,e,e.return)}catch(g){Ze(e,e.return,g)}}break;case 1:Er(t,e),jr(e),n&512&&r!==null&&Fi(r,r.return);break;case 5:if(Er(t,e),jr(e),n&512&&r!==null&&Fi(r,r.return),e.flags&32){var i=e.stateNode;try{ro(i,"")}catch(g){Ze(e,e.return,g)}}if(n&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=r!==null?r.memoizedProps:s,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&S_(i,s),mu(l,o);var c=mu(l,s);for(o=0;o<a.length;o+=2){var h=a[o],u=a[o+1];h==="style"?E_(i,u):h==="dangerouslySetInnerHTML"?k_(i,u):h==="children"?ro(i,u):nd(i,h,u,c)}switch(l){case"input":uu(i,s);break;case"textarea":w_(i,s);break;case"select":var d=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var f=s.value;f!=null?Wi(i,!!s.multiple,f,!1):d!==!!s.multiple&&(s.defaultValue!=null?Wi(i,!!s.multiple,s.defaultValue,!0):Wi(i,!!s.multiple,s.multiple?[]:"",!1))}i[ho]=s}catch(g){Ze(e,e.return,g)}}break;case 6:if(Er(t,e),jr(e),n&4){if(e.stateNode===null)throw Error(te(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(g){Ze(e,e.return,g)}}break;case 3:if(Er(t,e),jr(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{oo(t.containerInfo)}catch(g){Ze(e,e.return,g)}break;case 4:Er(t,e),jr(e);break;case 13:Er(t,e),jr(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Bd=tt())),n&4&&Rp(e);break;case 22:if(h=r!==null&&r.memoizedState!==null,e.mode&1?(Dt=(c=Dt)||h,Er(t,e),Dt=c):Er(t,e),jr(e),n&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(fe=e,h=e.child;h!==null;){for(u=fe=h;fe!==null;){switch(d=fe,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 m=d.stateNode;if(typeof m.componentWillUnmount=="function"){n=d,r=d.return;try{t=n,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){Ze(n,r,g)}}break;case 5:Fi(d,d.return);break;case 22:if(d.memoizedState!==null){Ip(u);continue}}f!==null?(f.return=d,fe=f):Ip(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=C_("display",o))}catch(g){Ze(e,e.return,g)}}}else if(u.tag===6){if(h===null)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(g){Ze(e,e.return,g)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;h===u&&(h=null),u=u.return}h===u&&(h=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:Er(t,e),jr(e),n&4&&Rp(e);break;case 21:break;default:Er(t,e),jr(e)}}function jr(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(Qv(r)){var n=r;break e}r=r.return}throw Error(te(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(ro(i,""),n.flags&=-33);var s=Dp(e);Ku(e,s,i);break;case 3:case 4:var o=n.stateNode.containerInfo,l=Dp(e);Uu(e,l,o);break;default:throw Error(te(161))}}catch(a){Ze(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function KS(e,t,r){fe=e,e0(e)}function e0(e,t,r){for(var n=(e.mode&1)!==0;fe!==null;){var i=fe,s=i.child;if(i.tag===22&&n){var o=i.memoizedState!==null||nl;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||Dt;l=nl;var c=Dt;if(nl=o,(Dt=a)&&!c)for(fe=i;fe!==null;)o=fe,a=o.child,o.tag===22&&o.memoizedState!==null?Ap(i):a!==null?(a.return=o,fe=a):Ap(i);for(;s!==null;)fe=s,e0(s),s=s.sibling;fe=i,nl=l,Dt=c}Mp(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,fe=s):Mp(e)}}function Mp(e){for(;fe!==null;){var t=fe;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Dt||La(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Dt)if(r===null)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:Tr(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&_p(t,s,n);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}_p(t,o,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break;case"img":a.src&&(r.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var h=c.memoizedState;if(h!==null){var u=h.dehydrated;u!==null&&oo(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}Dt||t.flags&512&&Wu(t)}catch(d){Ze(t,t.return,d)}}if(t===e){fe=null;break}if(r=t.sibling,r!==null){r.return=t.return,fe=r;break}fe=t.return}}function Ip(e){for(;fe!==null;){var t=fe;if(t===e){fe=null;break}var r=t.sibling;if(r!==null){r.return=t.return,fe=r;break}fe=t.return}}function Ap(e){for(;fe!==null;){var t=fe;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{La(4,t)}catch(a){Ze(t,r,a)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var i=t.return;try{n.componentDidMount()}catch(a){Ze(t,i,a)}}var s=t.return;try{Wu(t)}catch(a){Ze(t,s,a)}break;case 5:var o=t.return;try{Wu(t)}catch(a){Ze(t,o,a)}}}catch(a){Ze(t,t.return,a)}if(t===e){fe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,fe=l;break}fe=t.return}}var VS=Math.ceil,sa=hn.ReactCurrentDispatcher,Id=hn.ReactCurrentOwner,xr=hn.ReactCurrentBatchConfig,Le=0,xt=null,ot=null,Ct=0,rr=0,$i=Hn(0),ht=0,vo=null,fi=0,Da=0,Ad=0,Xs=null,qt=null,Bd=0,rs=1/0,Jr=null,oa=!1,Vu=null,An=null,il=!1,Nn=null,la=0,Gs=0,qu=null,Cl=-1,El=0;function zt(){return Le&6?tt():Cl!==-1?Cl:Cl=tt()}function Bn(e){return e.mode&1?Le&2&&Ct!==0?Ct&-Ct:PS.transition!==null?(El===0&&(El=j_()),El):(e=De,e!==0||(e=window.event,e=e===void 0?16:K_(e.type)),e):1}function Mr(e,t,r,n){if(50<Gs)throw Gs=0,qu=null,Error(te(185));No(e,r,n),(!(Le&2)||e!==xt)&&(e===xt&&(!(Le&2)&&(Da|=r),ht===4&&Cn(e,Ct)),Qt(e,n),r===1&&Le===0&&!(t.mode&1)&&(rs=tt()+500,Na&&Wn()))}function Qt(e,t){var r=e.callbackNode;Px(e,t);var n=Ul(e,e===xt?Ct:0);if(n===0)r!==null&&Uf(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&Uf(r),t===1)e.tag===0?TS(Bp.bind(null,e)):uv(Bp.bind(null,e)),kS(function(){!(Le&6)&&Wn()}),r=null;else{switch(z_(n)){case 1:r=ad;break;case 4:r=B_;break;case 16:r=Wl;break;case 536870912:r=O_;break;default:r=Wl}r=a0(r,t0.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function t0(e,t){if(Cl=-1,El=0,Le&6)throw Error(te(327));var r=e.callbackNode;if(Yi()&&e.callbackNode!==r)return null;var n=Ul(e,e===xt?Ct:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=aa(e,n);else{t=n;var i=Le;Le|=2;var s=n0();(xt!==e||Ct!==t)&&(Jr=null,rs=tt()+500,oi(e,t));do try{XS();break}catch(l){r0(e,l)}while(!0);Sd(),sa.current=s,Le=i,ot!==null?t=0:(xt=null,Ct=0,t=ht)}if(t!==0){if(t===2&&(i=xu(e),i!==0&&(n=i,t=Yu(e,i))),t===1)throw r=vo,oi(e,0),Cn(e,n),Qt(e,tt()),r;if(t===6)Cn(e,n);else{if(i=e.current.alternate,!(n&30)&&!qS(i)&&(t=aa(e,n),t===2&&(s=xu(e),s!==0&&(n=s,t=Yu(e,s))),t===1))throw r=vo,oi(e,0),Cn(e,n),Qt(e,tt()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(te(345));case 2:Gn(e,qt,Jr);break;case 3:if(Cn(e,n),(n&130023424)===n&&(t=Bd+500-tt(),10<t)){if(Ul(e,0)!==0)break;if(i=e.suspendedLanes,(i&n)!==n){zt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Tu(Gn.bind(null,e,qt,Jr),t);break}Gn(e,qt,Jr);break;case 4:if(Cn(e,n),(n&4194240)===n)break;for(t=e.eventTimes,i=-1;0<n;){var o=31-Rr(n);s=1<<o,o=t[o],o>i&&(i=o),n&=~s}if(n=i,n=tt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*VS(n/1960))-n,10<n){e.timeoutHandle=Tu(Gn.bind(null,e,qt,Jr),n);break}Gn(e,qt,Jr);break;case 5:Gn(e,qt,Jr);break;default:throw Error(te(329))}}}return Qt(e,tt()),e.callbackNode===r?t0.bind(null,e):null}function Yu(e,t){var r=Xs;return e.current.memoizedState.isDehydrated&&(oi(e,t).flags|=256),e=aa(e,t),e!==2&&(t=qt,qt=r,t!==null&&Xu(t)),e}function Xu(e){qt===null?qt=e:qt.push.apply(qt,e)}function qS(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var i=r[n],s=i.getSnapshot;i=i.value;try{if(!Ar(s(),i))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Cn(e,t){for(t&=~Ad,t&=~Da,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Rr(t),n=1<<r;e[r]=-1,t&=~n}}function Bp(e){if(Le&6)throw Error(te(327));Yi();var t=Ul(e,0);if(!(t&1))return Qt(e,tt()),null;var r=aa(e,t);if(e.tag!==0&&r===2){var n=xu(e);n!==0&&(t=n,r=Yu(e,n))}if(r===1)throw r=vo,oi(e,0),Cn(e,t),Qt(e,tt()),r;if(r===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Gn(e,qt,Jr),Qt(e,tt()),null}function Od(e,t){var r=Le;Le|=1;try{return e(t)}finally{Le=r,Le===0&&(rs=tt()+500,Na&&Wn())}}function pi(e){Nn!==null&&Nn.tag===0&&!(Le&6)&&Yi();var t=Le;Le|=1;var r=xr.transition,n=De;try{if(xr.transition=null,De=1,e)return e()}finally{De=n,xr.transition=r,Le=t,!(Le&6)&&Wn()}}function jd(){rr=$i.current,$e($i)}function oi(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,bS(r)),ot!==null)for(r=ot.return;r!==null;){var n=r;switch(vd(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Xl();break;case 3:es(),$e(Xt),$e(Mt),Nd();break;case 5:Ed(n);break;case 4:es();break;case 13:$e(Ve);break;case 19:$e(Ve);break;case 10:wd(n.type._context);break;case 22:case 23:jd()}r=r.return}if(xt=e,ot=e=On(e.current,null),Ct=rr=t,ht=0,vo=null,Ad=Da=fi=0,qt=Xs=null,ni!==null){for(t=0;t<ni.length;t++)if(r=ni[t],n=r.interleaved,n!==null){r.interleaved=null;var i=n.next,s=r.pending;if(s!==null){var o=s.next;s.next=i,n.next=o}r.pending=n}ni=null}return e}function r0(e,t){do{var r=ot;try{if(Sd(),wl.current=ia,na){for(var n=qe.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}na=!1}if(di=0,gt=ut=qe=null,qs=!1,mo=0,Id.current=null,r===null||r.return===null){ht=1,vo=t,ot=null;break}e:{var s=e,o=r.return,l=r,a=t;if(t=Ct,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=bp(o);if(f!==null){f.flags&=-257,kp(f,o,l,s,t),f.mode&1&&wp(s,c,t),t=f,a=c;var m=t.updateQueue;if(m===null){var g=new Set;g.add(a),t.updateQueue=g}else m.add(a);break e}else{if(!(t&1)){wp(s,c,t),zd();break e}a=Error(te(426))}}else if(He&&l.mode&1){var x=bp(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),kp(x,o,l,s,t),yd(ts(a,l));break e}}s=a=ts(a,l),ht!==4&&(ht=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 _=zv(s,a,t);gp(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"&&(An===null||!An.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t;var E=Fv(s,l,t);gp(s,E);break e}}s=s.return}while(s!==null)}s0(r)}catch(P){t=P,ot===r&&r!==null&&(ot=r=r.return);continue}break}while(!0)}function n0(){var e=sa.current;return sa.current=ia,e===null?ia:e}function zd(){(ht===0||ht===3||ht===2)&&(ht=4),xt===null||!(fi&268435455)&&!(Da&268435455)||Cn(xt,Ct)}function aa(e,t){var r=Le;Le|=2;var n=n0();(xt!==e||Ct!==t)&&(Jr=null,oi(e,t));do try{YS();break}catch(i){r0(e,i)}while(!0);if(Sd(),Le=r,sa.current=n,ot!==null)throw Error(te(261));return xt=null,Ct=0,ht}function YS(){for(;ot!==null;)i0(ot)}function XS(){for(;ot!==null&&!xx();)i0(ot)}function i0(e){var t=l0(e.alternate,e,rr);e.memoizedProps=e.pendingProps,t===null?s0(e):ot=t,Id.current=null}function s0(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=HS(r,t),r!==null){r.flags&=32767,ot=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ht=6,ot=null;return}}else if(r=$S(r,t,rr),r!==null){ot=r;return}if(t=t.sibling,t!==null){ot=t;return}ot=t=e}while(t!==null);ht===0&&(ht=5)}function Gn(e,t,r){var n=De,i=xr.transition;try{xr.transition=null,De=1,GS(e,t,r,n)}finally{xr.transition=i,De=n}return null}function GS(e,t,r,n){do Yi();while(Nn!==null);if(Le&6)throw Error(te(327));r=e.finishedWork;var i=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(te(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(Lx(e,s),e===xt&&(ot=xt=null,Ct=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||il||(il=!0,a0(Wl,function(){return Yi(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=xr.transition,xr.transition=null;var o=De;De=1;var l=Le;Le|=4,Id.current=null,US(e,r),Jv(r,e),gS(Eu),Kl=!!Cu,Eu=Cu=null,e.current=r,KS(r),Sx(),Le=l,De=o,xr.transition=s}else e.current=r;if(il&&(il=!1,Nn=e,la=i),s=e.pendingLanes,s===0&&(An=null),kx(r.stateNode),Qt(e,tt()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)i=t[r],n(i.value,{componentStack:i.stack,digest:i.digest});if(oa)throw oa=!1,e=Vu,Vu=null,e;return la&1&&e.tag!==0&&Yi(),s=e.pendingLanes,s&1?e===qu?Gs++:(Gs=0,qu=e):Gs=0,Wn(),null}function Yi(){if(Nn!==null){var e=z_(la),t=xr.transition,r=De;try{if(xr.transition=null,De=16>e?16:e,Nn===null)var n=!1;else{if(e=Nn,Nn=null,la=0,Le&6)throw Error(te(331));var i=Le;for(Le|=4,fe=e.current;fe!==null;){var s=fe,o=s.child;if(fe.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(fe=c;fe!==null;){var h=fe;switch(h.tag){case 0:case 11:case 15:Ys(8,h,s)}var u=h.child;if(u!==null)u.return=h,fe=u;else for(;fe!==null;){h=fe;var d=h.sibling,f=h.return;if(Gv(h),h===c){fe=null;break}if(d!==null){d.return=f,fe=d;break}fe=f}}}var m=s.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var x=g.sibling;g.sibling=null,g=x}while(g!==null)}}fe=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,fe=o;else e:for(;fe!==null;){if(s=fe,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,fe=_;break e}fe=s.return}}var v=e.current;for(fe=v;fe!==null;){o=fe;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,fe=y;else e:for(o=v;fe!==null;){if(l=fe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:La(9,l)}}catch(P){Ze(l,l.return,P)}if(l===o){fe=null;break e}var E=l.sibling;if(E!==null){E.return=l.return,fe=E;break e}fe=l.return}}if(Le=i,Wn(),qr&&typeof qr.onPostCommitFiberRoot=="function")try{qr.onPostCommitFiberRoot(wa,e)}catch{}n=!0}return n}finally{De=r,xr.transition=t}}return!1}function Op(e,t,r){t=ts(r,t),t=zv(e,t,1),e=In(e,t,1),t=zt(),e!==null&&(No(e,1,t),Qt(e,t))}function Ze(e,t,r){if(e.tag===3)Op(e,e,r);else for(;t!==null;){if(t.tag===3){Op(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(An===null||!An.has(n))){e=ts(r,e),e=Fv(t,e,1),t=In(t,e,1),e=zt(),t!==null&&(No(t,1,e),Qt(t,e));break}}t=t.return}}function QS(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=zt(),e.pingedLanes|=e.suspendedLanes&r,xt===e&&(Ct&r)===r&&(ht===4||ht===3&&(Ct&130023424)===Ct&&500>tt()-Bd?oi(e,0):Ad|=r),Qt(e,t)}function o0(e,t){t===0&&(e.mode&1?(t=Yo,Yo<<=1,!(Yo&130023424)&&(Yo=4194304)):t=1);var r=zt();e=cn(e,t),e!==null&&(No(e,t,r),Qt(e,r))}function ZS(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),o0(e,r)}function JS(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(te(314))}n!==null&&n.delete(t),o0(e,r)}var l0;l0=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Xt.current)Yt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Yt=!1,FS(e,t,r);Yt=!!(e.flags&131072)}else Yt=!1,He&&t.flags&1048576&&hv(t,Zl,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;kl(e,t),e=t.pendingProps;var i=Qi(t,Mt.current);qi(t,r),i=Pd(null,t,n,e,i,r);var s=Ld();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,Gt(n)?(s=!0,Gl(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,kd(t),i.updater=Pa,t.stateNode=i,i._reactInternals=t,Au(t,n,e,r),t=ju(null,t,n,!0,s,r)):(t.tag=0,He&&s&&_d(t),Ot(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(kl(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=tw(n),e=Tr(n,e),i){case 0:t=Ou(null,t,n,e,r);break e;case 1:t=Np(null,t,n,e,r);break e;case 11:t=Cp(null,t,n,e,r);break e;case 14:t=Ep(null,t,n,Tr(n.type,e),r);break e}throw Error(te(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Tr(n,i),Ou(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Tr(n,i),Np(e,t,n,i,r);case 3:e:{if(Uv(t),e===null)throw Error(te(387));n=t.pendingProps,s=t.memoizedState,i=s.element,_v(e,t),ta(t,n,null,r);var o=t.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=ts(Error(te(423)),t),t=Tp(e,t,n,r,i);break e}else if(n!==i){i=ts(Error(te(424)),t),t=Tp(e,t,n,r,i);break e}else for(ir=Mn(t.stateNode.containerInfo.firstChild),sr=t,He=!0,Lr=null,r=mv(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Zi(),n===i){t=un(e,t,r);break e}Ot(e,t,n,r)}t=t.child}return t;case 5:return vv(t),e===null&&Ru(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Nu(n,i)?o=null:s!==null&&Nu(n,s)&&(t.flags|=32),Wv(e,t),Ot(e,t,o,r),t.child;case 6:return e===null&&Ru(t),null;case 13:return Kv(e,t,r);case 4:return Cd(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ji(t,null,n,r):Ot(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Tr(n,i),Cp(e,t,n,i,r);case 7:return Ot(e,t,t.pendingProps,r),t.child;case 8:return Ot(e,t,t.pendingProps.children,r),t.child;case 12:return Ot(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Oe(Jl,n._currentValue),n._currentValue=o,s!==null)if(Ar(s.value,o)){if(s.children===i.children&&!Xt.current){t=un(e,t,r);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(s.tag===1){a=on(-1,r&-r),a.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?a.next=a:(a.next=h.next,h.next=a),c.pending=a}}s.lanes|=r,a=s.alternate,a!==null&&(a.lanes|=r),Mu(s.return,r,t),l.lanes|=r;break}a=a.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(te(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),Mu(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ot(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,qi(t,r),i=wr(i),n=n(i),t.flags|=1,Ot(e,t,n,r),t.child;case 14:return n=t.type,i=Tr(n,t.pendingProps),i=Tr(n.type,i),Ep(e,t,n,i,r);case 15:return $v(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Tr(n,i),kl(e,t),t.tag=1,Gt(n)?(e=!0,Gl(t)):e=!1,qi(t,r),jv(t,n,i),Au(t,n,i,r),ju(null,t,n,!0,e,r);case 19:return Vv(e,t,r);case 22:return Hv(e,t,r)}throw Error(te(156,t.tag))};function a0(e,t){return A_(e,t)}function ew(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yr(e,t,r,n){return new ew(e,t,r,n)}function Fd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tw(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 On(e,t){var r=e.alternate;return r===null?(r=yr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Nl(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")Fd(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Di:return li(r.children,i,s,t);case id:o=8,i|=8;break;case su:return e=yr(12,r,t,i|2),e.elementType=su,e.lanes=s,e;case ou:return e=yr(13,r,t,i),e.elementType=ou,e.lanes=s,e;case lu:return e=yr(19,r,t,i),e.elementType=lu,e.lanes=s,e;case v_:return Ra(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case g_:o=10;break e;case __:o=9;break e;case sd:o=11;break e;case od:o=14;break e;case Sn:o=16,n=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=yr(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function li(e,t,r,n){return e=yr(7,e,n,t),e.lanes=r,e}function Ra(e,t,r,n){return e=yr(22,e,n,t),e.elementType=v_,e.lanes=r,e.stateNode={isHidden:!1},e}function Sc(e,t,r){return e=yr(6,e,null,t),e.lanes=r,e}function wc(e,t,r){return t=yr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function rw(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=rc(0),this.expirationTimes=rc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function $d(e,t,r,n,i,s,o,l,a){return e=new rw(e,t,r,l,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=yr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},kd(s),e}function nw(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Li,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function c0(e){if(!e)return Fn;e=e._reactInternals;e:{if(yi(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Gt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var r=e.type;if(Gt(r))return cv(e,r,t)}return t}function u0(e,t,r,n,i,s,o,l,a){return e=$d(r,n,!0,e,i,s,o,l,a),e.context=c0(null),r=e.current,n=zt(),i=Bn(r),s=on(n,i),s.callback=t??null,In(r,s,i),e.current.lanes=i,No(e,i,n),Qt(e,n),e}function Ma(e,t,r,n){var i=t.current,s=zt(),o=Bn(i);return r=c0(r),t.context===null?t.context=r:t.pendingContext=r,t=on(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=In(i,t,o),e!==null&&(Mr(e,i,o,s),Sl(e,i,o)),o}function ca(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 jp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Hd(e,t){jp(e,t),(e=e.alternate)&&jp(e,t)}function iw(){return null}var h0=typeof reportError=="function"?reportError:function(e){console.error(e)};function Wd(e){this._internalRoot=e}Ia.prototype.render=Wd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));Ma(e,t,null,null)};Ia.prototype.unmount=Wd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;pi(function(){Ma(null,e,null,null)}),t[an]=null}};function Ia(e){this._internalRoot=e}Ia.prototype.unstable_scheduleHydration=function(e){if(e){var t=H_();e={blockedOn:null,target:e,priority:t};for(var r=0;r<kn.length&&t!==0&&t<kn[r].priority;r++);kn.splice(r,0,e),r===0&&U_(e)}};function Ud(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Aa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function zp(){}function sw(e,t,r,n,i){if(i){if(typeof n=="function"){var s=n;n=function(){var c=ca(o);s.call(c)}}var o=u0(t,n,e,0,null,!1,!1,"",zp);return e._reactRootContainer=o,e[an]=o.current,co(e.nodeType===8?e.parentNode:e),pi(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof n=="function"){var l=n;n=function(){var c=ca(a);l.call(c)}}var a=$d(e,0,!1,null,null,!1,!1,"",zp);return e._reactRootContainer=a,e[an]=a.current,co(e.nodeType===8?e.parentNode:e),pi(function(){Ma(t,a,r,n)}),a}function Ba(e,t,r,n,i){var s=r._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var a=ca(o);l.call(a)}}Ma(t,o,e,i)}else o=sw(r,t,e,i,n);return ca(o)}F_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=As(t.pendingLanes);r!==0&&(cd(t,r|1),Qt(t,tt()),!(Le&6)&&(rs=tt()+500,Wn()))}break;case 13:pi(function(){var n=cn(e,1);if(n!==null){var i=zt();Mr(n,e,1,i)}}),Hd(e,1)}};ud=function(e){if(e.tag===13){var t=cn(e,134217728);if(t!==null){var r=zt();Mr(t,e,134217728,r)}Hd(e,134217728)}};$_=function(e){if(e.tag===13){var t=Bn(e),r=cn(e,t);if(r!==null){var n=zt();Mr(r,e,t,n)}Hd(e,t)}};H_=function(){return De};W_=function(e,t){var r=De;try{return De=e,t()}finally{De=r}};_u=function(e,t,r){switch(t){case"input":if(uu(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=Ea(n);if(!i)throw Error(te(90));x_(n),uu(n,i)}}}break;case"textarea":w_(e,r);break;case"select":t=r.value,t!=null&&Wi(e,!!r.multiple,t,!1)}};P_=Od;L_=pi;var ow={usingClientEntryPoint:!1,Events:[Po,Ai,Ea,N_,T_,Od]},ws={findFiberByHostInstance:ri,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},lw={bundleType:ws.bundleType,version:ws.version,rendererPackageName:ws.rendererPackageName,rendererConfig:ws.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:hn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=M_(e),e===null?null:e.stateNode},findFiberByHostInstance:ws.findFiberByHostInstance||iw,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 sl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sl.isDisabled&&sl.supportsFiber)try{wa=sl.inject(lw),qr=sl}catch{}}ar.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ow;ar.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ud(t))throw Error(te(200));return nw(e,t,null,r)};ar.createRoot=function(e,t){if(!Ud(e))throw Error(te(299));var r=!1,n="",i=h0;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=$d(e,1,!1,null,null,r,!1,n,i),e[an]=t.current,co(e.nodeType===8?e.parentNode:e),new Wd(t)};ar.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(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=M_(t),e=e===null?null:e.stateNode,e};ar.flushSync=function(e){return pi(e)};ar.hydrate=function(e,t,r){if(!Aa(t))throw Error(te(200));return Ba(null,e,t,!0,r)};ar.hydrateRoot=function(e,t,r){if(!Ud(e))throw Error(te(405));var n=r!=null&&r.hydratedSources||null,i=!1,s="",o=h0;if(r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=u0(t,null,e,1,r??null,i,!1,s,o),e[an]=t.current,co(e),n)for(e=0;e<n.length;e++)r=n[e],i=r._getVersion,i=i(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,i]:t.mutableSourceEagerHydrationData.push(r,i);return new Ia(t)};ar.render=function(e,t,r){if(!Aa(t))throw Error(te(200));return Ba(null,e,t,!1,r)};ar.unmountComponentAtNode=function(e){if(!Aa(e))throw Error(te(40));return e._reactRootContainer?(pi(function(){Ba(null,null,e,!1,function(){e._reactRootContainer=null,e[an]=null})}),!0):!1};ar.unstable_batchedUpdates=Od;ar.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Aa(r))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return Ba(e,t,r,!1,n)};ar.version="18.3.1-next-f1338f8080-20240426";function d0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(d0)}catch(e){console.error(e)}}d0(),d_.exports=ar;var aw=d_.exports,f0,Fp=aw;f0=Fp.createRoot,Fp.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 yo(){return yo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},yo.apply(this,arguments)}var Nn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Nn||(Nn={}));const Dp="popstate";function ZS(e){e===void 0&&(e={});function t(n,i){let{pathname:s,search:o,hash:l}=n.location;return Gu("",{pathname:s,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(n,i){return typeof i=="string"?i:i0(i)}return ew(t,r,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 JS(){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,r,n){return r===void 0&&(r=null),yo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?as(t):t,{state:r,key:t&&t.key||n||JS()})}function i0(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function as(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function ew(e,t,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,l=Nn.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=Nn.Pop;let x=h(),_=x==null?null:x-c;c=x,a&&a({action:l,location:g.location,delta:_})}function d(x,_){l=Nn.Push;let v=Gu(g.location,x,_);c=h()+1;let y=Mp(v,c),E=g.createHref(v);try{o.pushState(y,"",E)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;i.location.assign(E)}s&&a&&a({action:l,location:g.location,delta:1})}function f(x,_){l=Nn.Replace;let v=Gu(g.location,x,_);c=h();let y=Mp(v,c),E=g.createHref(v);o.replaceState(y,"",E),s&&a&&a({action:l,location:g.location,delta:0})}function m(x){let _=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof x=="string"?x:i0(x);return v=v.replace(/ $/,"%20"),ut(_,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,_)}let g={get action(){return l},get location(){return e(i,o)},listen(x){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Dp,u),a=x,()=>{i.removeEventListener(Dp,u),a=null}},createHref(x){return t(i,x)},createURL:m,encodeLocation(x){let _=m(x);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:d,replace:f,go(x){return o.go(x)}};return g}var Ip;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ip||(Ip={}));function tw(e,t,r){return r===void 0&&(r="/"),rw(e,t,r)}function rw(e,t,r,n){let i=typeof t=="string"?as(t):t,s=l0(i.pathname||"/",r);if(s==null)return null;let o=s0(e);nw(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let c=mw(s);l=dw(o[a],c)}return l}function s0(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let i=(s,o,l)=>{let a={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};a.relativePath.startsWith("/")&&(ut(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let c=ci([n,a.relativePath]),h=r.concat(a);s.children&&s.children.length>0&&(ut(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),s0(s.children,t,h,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:uw(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 o0(s.path))i(s,o,a)}),t}function o0(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=o0(n.join("/")),l=[];return l.push(...o.map(a=>a===""?s:[s,a].join("/"))),i&&l.push(...o),l.map(a=>e.startsWith("/")&&a===""?"/":a)}function nw(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:hw(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const iw=/^:[\w-]+$/,sw=3,ow=2,lw=1,aw=10,cw=-2,Ap=e=>e==="*";function uw(e,t){let r=e.split("/"),n=r.length;return r.some(Ap)&&(n+=cw),t&&(n+=ow),r.filter(i=>!Ap(i)).reduce((i,s)=>i+(iw.test(s)?sw:s===""?lw:aw),n)}function hw(e,t){return e.length===t.length&&e.slice(0,-1).every((n,i)=>n===t[i])?e[e.length-1]-t[t.length-1]:0}function dw(e,t,r){let{routesMeta:n}=e,i={},s="/",o=[];for(let l=0;l<n.length;++l){let a=n[l],c=l===n.length-1,h=s==="/"?t:t.slice(s.length)||"/",u=fw({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:xw(ci([s,u.pathnameBase])),route:d}),u.pathnameBase!=="/"&&(s=ci([s,u.pathnameBase]))}return o}function fw(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=pw(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:n.reduce((c,h,u)=>{let{paramName:d,isOptional:f}=h;if(d==="*"){let g=l[u]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const m=l[u];return f&&!m?c[d]=void 0:c[d]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function pw(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!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 n=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),n]}function mw(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 l0(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const gw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_w=e=>gw.test(e);function vw(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?as(e):e,s;if(r)if(_w(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),Kd(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=Bp(r.substring(1),"/"):s=Bp(r,t)}else s=t;return{pathname:s,search:Sw(n),hash:ww(i)}}function Bp(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function bc(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function yw(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function a0(e,t){let r=yw(e);return t?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function c0(e,t,r,n){n===void 0&&(n=!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=r;else{let u=t.length-1;if(!n&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),u-=1;i.pathname=d.join("/")}l=u>=0?t[u]:"/"}let a=vw(i,l),c=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(c||h)&&(a.pathname+="/"),a}const ci=e=>e.join("/").replace(/\/\/+/g,"/"),xw=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Sw=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ww=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function bw(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const u0=["post","put","patch","delete"];new Set(u0);const kw=["get",...u0];new Set(kw);/**
49
+ */function yo(){return yo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},yo.apply(this,arguments)}var Tn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Tn||(Tn={}));const $p="popstate";function cw(e){e===void 0&&(e={});function t(n,i){let{pathname:s,search:o,hash:l}=n.location;return Gu("",{pathname:s,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(n,i){return typeof i=="string"?i:p0(i)}return hw(t,r,null,e)}function lt(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 uw(){return Math.random().toString(36).substr(2,8)}function Hp(e,t){return{usr:e.state,key:e.key,idx:t}}function Gu(e,t,r,n){return r===void 0&&(r=null),yo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?as(t):t,{state:r,key:t&&t.key||n||uw()})}function p0(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function as(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function hw(e,t,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,l=Tn.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=Tn.Pop;let x=h(),_=x==null?null:x-c;c=x,a&&a({action:l,location:g.location,delta:_})}function d(x,_){l=Tn.Push;let v=Gu(g.location,x,_);c=h()+1;let y=Hp(v,c),E=g.createHref(v);try{o.pushState(y,"",E)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;i.location.assign(E)}s&&a&&a({action:l,location:g.location,delta:1})}function f(x,_){l=Tn.Replace;let v=Gu(g.location,x,_);c=h();let y=Hp(v,c),E=g.createHref(v);o.replaceState(y,"",E),s&&a&&a({action:l,location:g.location,delta:0})}function m(x){let _=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof x=="string"?x:p0(x);return v=v.replace(/ $/,"%20"),lt(_,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,_)}let g={get action(){return l},get location(){return e(i,o)},listen(x){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener($p,u),a=x,()=>{i.removeEventListener($p,u),a=null}},createHref(x){return t(i,x)},createURL:m,encodeLocation(x){let _=m(x);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:d,replace:f,go(x){return o.go(x)}};return g}var Wp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Wp||(Wp={}));function dw(e,t,r){return r===void 0&&(r="/"),fw(e,t,r)}function fw(e,t,r,n){let i=typeof t=="string"?as(t):t,s=_0(i.pathname||"/",r);if(s==null)return null;let o=m0(e);pw(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let c=Ew(s);l=bw(o[a],c)}return l}function m0(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let i=(s,o,l)=>{let a={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};a.relativePath.startsWith("/")&&(lt(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let c=ai([n,a.relativePath]),h=r.concat(a);s.children&&s.children.length>0&&(lt(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),m0(s.children,t,h,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:Sw(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 g0(s.path))i(s,o,a)}),t}function g0(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=g0(n.join("/")),l=[];return l.push(...o.map(a=>a===""?s:[s,a].join("/"))),i&&l.push(...o),l.map(a=>e.startsWith("/")&&a===""?"/":a)}function pw(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:ww(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const mw=/^:[\w-]+$/,gw=3,_w=2,vw=1,yw=10,xw=-2,Up=e=>e==="*";function Sw(e,t){let r=e.split("/"),n=r.length;return r.some(Up)&&(n+=xw),t&&(n+=_w),r.filter(i=>!Up(i)).reduce((i,s)=>i+(mw.test(s)?gw:s===""?vw:yw),n)}function ww(e,t){return e.length===t.length&&e.slice(0,-1).every((n,i)=>n===t[i])?e[e.length-1]-t[t.length-1]:0}function bw(e,t,r){let{routesMeta:n}=e,i={},s="/",o=[];for(let l=0;l<n.length;++l){let a=n[l],c=l===n.length-1,h=s==="/"?t:t.slice(s.length)||"/",u=kw({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:ai([s,u.pathname]),pathnameBase:Dw(ai([s,u.pathnameBase])),route:d}),u.pathnameBase!=="/"&&(s=ai([s,u.pathnameBase]))}return o}function kw(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Cw(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:n.reduce((c,h,u)=>{let{paramName:d,isOptional:f}=h;if(d==="*"){let g=l[u]||"";o=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const m=l[u];return f&&!m?c[d]=void 0:c[d]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function Cw(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!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 n=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),n]}function Ew(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 _0(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const Nw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Tw=e=>Nw.test(e);function Pw(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?as(e):e,s;if(r)if(Tw(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),Kd(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=Kp(r.substring(1),"/"):s=Kp(r,t)}else s=t;return{pathname:s,search:Rw(n),hash:Mw(i)}}function Kp(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function bc(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Lw(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function v0(e,t){let r=Lw(e);return t?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function y0(e,t,r,n){n===void 0&&(n=!1);let i;typeof e=="string"?i=as(e):(i=yo({},e),lt(!i.pathname||!i.pathname.includes("?"),bc("?","pathname","search",i)),lt(!i.pathname||!i.pathname.includes("#"),bc("#","pathname","hash",i)),lt(!i.search||!i.search.includes("#"),bc("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=r;else{let u=t.length-1;if(!n&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),u-=1;i.pathname=d.join("/")}l=u>=0?t[u]:"/"}let a=Pw(i,l),c=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(c||h)&&(a.pathname+="/"),a}const ai=e=>e.join("/").replace(/\/\/+/g,"/"),Dw=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Rw=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Mw=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Iw(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const x0=["post","put","patch","delete"];new Set(x0);const Aw=["get",...x0];new Set(Aw);/**
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 xo(){return xo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xo.apply(this,arguments)}const Vd=w.createContext(null),Cw=w.createContext(null),Ro=w.createContext(null),za=w.createContext(null),Un=w.createContext({outlet:null,matches:[],isDataRoute:!1}),h0=w.createContext(null);function Do(){return w.useContext(za)!=null}function Mo(){return Do()||ut(!1),w.useContext(za).location}function d0(e){w.useContext(Ro).static||w.useLayoutEffect(e)}function cs(){let{isDataRoute:e}=w.useContext(Un);return e?jw():Ew()}function Ew(){Do()||ut(!1);let e=w.useContext(Vd),{basename:t,future:r,navigator:n}=w.useContext(Ro),{matches:i}=w.useContext(Un),{pathname:s}=Mo(),o=JSON.stringify(a0(i,r.v7_relativeSplatPath)),l=w.useRef(!1);return d0(()=>{l.current=!0}),w.useCallback(function(c,h){if(h===void 0&&(h={}),!l.current)return;if(typeof c=="number"){n.go(c);return}let u=c0(c,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:ci([t,u.pathname])),(h.replace?n.replace:n.push)(u,h.state,h)},[t,n,o,s,e])}function f0(){let{matches:e}=w.useContext(Un),t=e[e.length-1];return t?t.params:{}}function Tw(e,t){return Nw(e,t)}function Nw(e,t,r,n){Do()||ut(!1);let{navigator:i}=w.useContext(Ro),{matches:s}=w.useContext(Un),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 x=typeof t=="string"?as(t):t;a==="/"||(u=x.pathname)!=null&&u.startsWith(a)||ut(!1),h=x}else h=c;let d=h.pathname||"/",f=d;if(a!=="/"){let x=a.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(x.length).join("/")}let m=tw(e,{pathname:f}),g=Mw(m&&m.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:ci([a,i.encodeLocation?i.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?a:ci([a,i.encodeLocation?i.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),s,r,n);return t&&g?w.createElement(za.Provider,{value:{location:xo({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:Nn.Pop}},g):g}function Pw(){let e=Ow(),t=bw(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),r?w.createElement("pre",{style:i},r):null,null)}const Lw=w.createElement(Pw,null);class Rw extends w.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?w.createElement(Un.Provider,{value:this.props.routeContext},w.createElement(h0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Dw(e){let{routeContext:t,match:r,children:n}=e,i=w.useContext(Vd);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),w.createElement(Un.Provider,{value:t},n)}function Mw(e,t,r,n){var i;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var s;if(!r)return null;if(r.errors)e=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(i=r)==null?void 0:i.errors;if(l!=null){let h=o.findIndex(u=>u.route.id&&(l==null?void 0:l[u.route.id])!==void 0);h>=0||ut(!1),o=o.slice(0,Math.min(o.length,h+1))}let a=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let h=0;h<o.length;h++){let u=o[h];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(c=h),u.route.id){let{loaderData:d,errors:f}=r,m=u.route.loader&&d[u.route.id]===void 0&&(!f||f[u.route.id]===void 0);if(u.route.lazy||m){a=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((h,u,d)=>{let f,m=!1,g=null,x=null;r&&(f=l&&u.route.id?l[u.route.id]:void 0,g=u.route.errorElement||Lw,a&&(c<0&&d===0?(zw("route-fallback"),m=!0,x=null):c===d&&(m=!0,x=u.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,d+1)),v=()=>{let y;return f?y=g:m?y=x:u.route.Component?y=w.createElement(u.route.Component,null):u.route.element?y=u.route.element:y=h,w.createElement(Dw,{match:u,routeContext:{outlet:h,matches:_,isDataRoute:r!=null},children:y})};return r&&(u.route.ErrorBoundary||u.route.errorElement||d===0)?w.createElement(Rw,{location:r.location,revalidation:r.revalidation,component:g,error:f,children:v(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):v()},null)}var p0=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(p0||{}),m0=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}(m0||{});function Iw(e){let t=w.useContext(Vd);return t||ut(!1),t}function Aw(e){let t=w.useContext(Cw);return t||ut(!1),t}function Bw(e){let t=w.useContext(Un);return t||ut(!1),t}function g0(e){let t=Bw(),r=t.matches[t.matches.length-1];return r.route.id||ut(!1),r.route.id}function Ow(){var e;let t=w.useContext(h0),r=Aw(),n=g0();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function jw(){let{router:e}=Iw(p0.UseNavigateStable),t=g0(m0.UseNavigateStable),r=w.useRef(!1);return d0(()=>{r.current=!0}),w.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,xo({fromRouteId:t},s)))},[e,t])}const Op={};function zw(e,t,r){Op[e]||(Op[e]=!0)}function Fw(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Ll(e){let{to:t,replace:r,state:n,relative:i}=e;Do()||ut(!1);let{future:s,static:o}=w.useContext(Ro),{matches:l}=w.useContext(Un),{pathname:a}=Mo(),c=cs(),h=c0(t,a0(l,s.v7_relativeSplatPath),a,i==="path"),u=JSON.stringify(h);return w.useEffect(()=>c(JSON.parse(u),{replace:r,state:n,relative:i}),[c,u,i,r,n]),null}function Zn(e){ut(!1)}function $w(e){let{basename:t="/",children:r=null,location:n,navigationType:i=Nn.Pop,navigator:s,static:o=!1,future:l}=e;Do()&&ut(!1);let a=t.replace(/^\/*/,"/"),c=w.useMemo(()=>({basename:a,navigator:s,static:o,future:xo({v7_relativeSplatPath:!1},l)}),[a,l,s,o]);typeof n=="string"&&(n=as(n));let{pathname:h="/",search:u="",hash:d="",state:f=null,key:m="default"}=n,g=w.useMemo(()=>{let x=l0(h,a);return x==null?null:{location:{pathname:x,search:u,hash:d,state:f,key:m},navigationType:i}},[a,h,u,d,f,m,i]);return g==null?null:w.createElement(Ro.Provider,{value:c},w.createElement(za.Provider,{children:r,value:g}))}function Hw(e){let{children:t,location:r}=e;return Tw(Qu(t),r)}new Promise(()=>{});function Qu(e,t){t===void 0&&(t=[]);let r=[];return w.Children.forEach(e,(n,i)=>{if(!w.isValidElement(n))return;let s=[...t,i];if(n.type===w.Fragment){r.push.apply(r,Qu(n.props.children,s));return}n.type!==Zn&&ut(!1),!n.props.index||!n.props.children||ut(!1);let o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=Qu(n.props.children,s)),r.push(o)}),r}/**
58
+ */function xo(){return xo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xo.apply(this,arguments)}const Vd=b.createContext(null),Bw=b.createContext(null),Do=b.createContext(null),Oa=b.createContext(null),Un=b.createContext({outlet:null,matches:[],isDataRoute:!1}),S0=b.createContext(null);function Ro(){return b.useContext(Oa)!=null}function Mo(){return Ro()||lt(!1),b.useContext(Oa).location}function w0(e){b.useContext(Do).static||b.useLayoutEffect(e)}function cs(){let{isDataRoute:e}=b.useContext(Un);return e?Xw():Ow()}function Ow(){Ro()||lt(!1);let e=b.useContext(Vd),{basename:t,future:r,navigator:n}=b.useContext(Do),{matches:i}=b.useContext(Un),{pathname:s}=Mo(),o=JSON.stringify(v0(i,r.v7_relativeSplatPath)),l=b.useRef(!1);return w0(()=>{l.current=!0}),b.useCallback(function(c,h){if(h===void 0&&(h={}),!l.current)return;if(typeof c=="number"){n.go(c);return}let u=y0(c,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:ai([t,u.pathname])),(h.replace?n.replace:n.push)(u,h.state,h)},[t,n,o,s,e])}function b0(){let{matches:e}=b.useContext(Un),t=e[e.length-1];return t?t.params:{}}function jw(e,t){return zw(e,t)}function zw(e,t,r,n){Ro()||lt(!1);let{navigator:i}=b.useContext(Do),{matches:s}=b.useContext(Un),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 x=typeof t=="string"?as(t):t;a==="/"||(u=x.pathname)!=null&&u.startsWith(a)||lt(!1),h=x}else h=c;let d=h.pathname||"/",f=d;if(a!=="/"){let x=a.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(x.length).join("/")}let m=dw(e,{pathname:f}),g=Uw(m&&m.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:ai([a,i.encodeLocation?i.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?a:ai([a,i.encodeLocation?i.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),s,r,n);return t&&g?b.createElement(Oa.Provider,{value:{location:xo({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:Tn.Pop}},g):g}function Fw(){let e=Yw(),t=Iw(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),r?b.createElement("pre",{style:i},r):null,null)}const $w=b.createElement(Fw,null);class Hw extends b.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?b.createElement(Un.Provider,{value:this.props.routeContext},b.createElement(S0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Ww(e){let{routeContext:t,match:r,children:n}=e,i=b.useContext(Vd);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),b.createElement(Un.Provider,{value:t},n)}function Uw(e,t,r,n){var i;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var s;if(!r)return null;if(r.errors)e=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(i=r)==null?void 0:i.errors;if(l!=null){let h=o.findIndex(u=>u.route.id&&(l==null?void 0:l[u.route.id])!==void 0);h>=0||lt(!1),o=o.slice(0,Math.min(o.length,h+1))}let a=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let h=0;h<o.length;h++){let u=o[h];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(c=h),u.route.id){let{loaderData:d,errors:f}=r,m=u.route.loader&&d[u.route.id]===void 0&&(!f||f[u.route.id]===void 0);if(u.route.lazy||m){a=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((h,u,d)=>{let f,m=!1,g=null,x=null;r&&(f=l&&u.route.id?l[u.route.id]:void 0,g=u.route.errorElement||$w,a&&(c<0&&d===0?(Gw("route-fallback"),m=!0,x=null):c===d&&(m=!0,x=u.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,d+1)),v=()=>{let y;return f?y=g:m?y=x:u.route.Component?y=b.createElement(u.route.Component,null):u.route.element?y=u.route.element:y=h,b.createElement(Ww,{match:u,routeContext:{outlet:h,matches:_,isDataRoute:r!=null},children:y})};return r&&(u.route.ErrorBoundary||u.route.errorElement||d===0)?b.createElement(Hw,{location:r.location,revalidation:r.revalidation,component:g,error:f,children:v(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):v()},null)}var k0=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(k0||{}),C0=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}(C0||{});function Kw(e){let t=b.useContext(Vd);return t||lt(!1),t}function Vw(e){let t=b.useContext(Bw);return t||lt(!1),t}function qw(e){let t=b.useContext(Un);return t||lt(!1),t}function E0(e){let t=qw(),r=t.matches[t.matches.length-1];return r.route.id||lt(!1),r.route.id}function Yw(){var e;let t=b.useContext(S0),r=Vw(),n=E0();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function Xw(){let{router:e}=Kw(k0.UseNavigateStable),t=E0(C0.UseNavigateStable),r=b.useRef(!1);return w0(()=>{r.current=!0}),b.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,xo({fromRouteId:t},s)))},[e,t])}const Vp={};function Gw(e,t,r){Vp[e]||(Vp[e]=!0)}function Qw(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Tl(e){let{to:t,replace:r,state:n,relative:i}=e;Ro()||lt(!1);let{future:s,static:o}=b.useContext(Do),{matches:l}=b.useContext(Un),{pathname:a}=Mo(),c=cs(),h=y0(t,v0(l,s.v7_relativeSplatPath),a,i==="path"),u=JSON.stringify(h);return b.useEffect(()=>c(JSON.parse(u),{replace:r,state:n,relative:i}),[c,u,i,r,n]),null}function Qn(e){lt(!1)}function Zw(e){let{basename:t="/",children:r=null,location:n,navigationType:i=Tn.Pop,navigator:s,static:o=!1,future:l}=e;Ro()&&lt(!1);let a=t.replace(/^\/*/,"/"),c=b.useMemo(()=>({basename:a,navigator:s,static:o,future:xo({v7_relativeSplatPath:!1},l)}),[a,l,s,o]);typeof n=="string"&&(n=as(n));let{pathname:h="/",search:u="",hash:d="",state:f=null,key:m="default"}=n,g=b.useMemo(()=>{let x=_0(h,a);return x==null?null:{location:{pathname:x,search:u,hash:d,state:f,key:m},navigationType:i}},[a,h,u,d,f,m,i]);return g==null?null:b.createElement(Do.Provider,{value:c},b.createElement(Oa.Provider,{children:r,value:g}))}function Jw(e){let{children:t,location:r}=e;return jw(Qu(t),r)}new Promise(()=>{});function Qu(e,t){t===void 0&&(t=[]);let r=[];return b.Children.forEach(e,(n,i)=>{if(!b.isValidElement(n))return;let s=[...t,i];if(n.type===b.Fragment){r.push.apply(r,Qu(n.props.children,s));return}n.type!==Qn&&lt(!1),!n.props.index||!n.props.children||lt(!1);let o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=Qu(n.props.children,s)),r.push(o)}),r}/**
59
59
  * React Router DOM v6.30.3
60
60
  *
61
61
  * Copyright (c) Remix Software Inc.
@@ -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 Zu(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(i=>[r,i]):[[r,n]])},[]))}function Ww(e,t){let r=Zu(e);return t&&t.forEach((n,i)=>{r.has(i)||t.getAll(i).forEach(s=>{r.append(i,s)})}),r}const Uw="6";try{window.__reactRouterVersion=Uw}catch{}const Kw="startTransition",jp=F1[Kw];function Vw(e){let{basename:t,children:r,future:n,window:i}=e,s=w.useRef();s.current==null&&(s.current=ZS({window:i,v5Compat:!0}));let o=s.current,[l,a]=w.useState({action:o.action,location:o.location}),{v7_startTransition:c}=n||{},h=w.useCallback(u=>{c&&jp?jp(()=>a(u)):a(u)},[a,c]);return w.useLayoutEffect(()=>o.listen(h),[o,h]),w.useEffect(()=>Fw(n),[n]),w.createElement($w,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}var zp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(zp||(zp={}));var Fp;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Fp||(Fp={}));function qw(e){let t=w.useRef(Zu(e)),r=w.useRef(!1),n=Mo(),i=w.useMemo(()=>Ww(n.search,r.current?null:t.current),[n.search]),s=cs(),o=w.useCallback((l,a)=>{const c=Zu(typeof l=="function"?l(i):l);r.current=!0,s("?"+c,a)},[s,i]);return[i,o]}const _0=w.createContext({ides:[],updateIdeChats:()=>{},screenshotMap:{},setScreenshotMap:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{}}),v0=w.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function Yw(e,t){var o,l,a,c;const r=Date.now();if(t.length===0)return e.map(h=>({...h,_lastUpdate:r}));const n=new Map;for(const h of t)n.set(h.id,h);for(const h of e){const u=n.get(h.id);if(!u){n.set(h.id,{...h,_lastUpdate:r});continue}const d=h.timestamp||r,f=u._lastUpdate||u.timestamp||0;if(d>=f){const m=(o=h.chats)!=null&&o.length?h.chats:u.chats;n.set(h.id,{...u,...h,chats:m,_lastUpdate:r})}else(l=h.chats)!=null&&l.length&&!((a=u.chats)!=null&&a.length)&&n.set(h.id,{...u,chats:h.chats})}const i=new Set(e.map(h=>h.id)),s=new Set;for(const h of e){const u=h.daemonId||((c=h.id)==null?void 0:c.split(":")[0]);u&&s.add(u)}for(const[h,u]of n){const d=u.daemonId||h.split(":")[0];if(!s.has(d))continue;const f=r-(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)&&n.delete(h)}for(const[h,u]of n)r-(u._lastUpdate||u.timestamp||0)>3e5&&u.status!=="online"&&n.delete(h);return Array.from(n.values())}function Xw({children:e}){const[t,r]=w.useState([]),[n,i]=w.useState({}),[s,o]=w.useState(!1),[l,a]=w.useState([]),c=w.useCallback((u,d)=>{r(f=>f.map(m=>m.id===u?{...m,chats:d}:m))},[]),h={injectEntries:u=>{r(d=>d.length===0?u:Yw(u,d))},markLoaded:()=>o(!0),getIdes:()=>t};return p.jsx(v0.Provider,{value:h,children:p.jsx(_0.Provider,{value:{ides:t,updateIdeChats:c,screenshotMap:n,setScreenshotMap:i,initialLoaded:s,toasts:l,setToasts:a},children:e})})}function y0(){return w.useContext(_0)}function $p(){return w.useContext(v0)}function Gw(e){const{baseUrl:t,getToken:r,onUnauthorized:n}=e;async function i(s,o={}){const l={"Content-Type":"application/json",...o.headers||{}},a=r==null?void 0:r();a&&(l.Authorization=`Bearer ${a}`);const c=s.startsWith("http")?s:`${t}${s.startsWith("/")?"":"/"}${s}`,h=await fetch(c,{...o,headers:l});if(h.status===401)throw n==null||n(),new Error("Unauthorized");if(!h.ok){const u=await h.json().catch(()=>({error:h.statusText}));throw new Error(u.error||`API Error: ${h.status}`)}return h.json()}return{getDaemons:()=>i("/api/v1/daemons"),getDaemonStatus:s=>i(`/api/v1/daemons/${s}/status`),sendCommand:(s,o,l={})=>i(`/api/v1/daemons/${s}/command`,{method:"POST",body:JSON.stringify({type:o,payload:l})}),execTerminal:(s,o,l)=>i(`/api/v1/daemons/${s}/terminal`,{method:"POST",body:JSON.stringify({command:o,name:l})}),sendAgentMessage:(s,o,l)=>i(`/api/v1/agents/${s}/send`,{method:"POST",body:JSON.stringify({agentType:o,message:l})}),getAgentStatus:s=>i(`/api/v1/agents/${s}/status`),approveAgent:(s,o,l)=>i(`/api/v1/agents/${s}/approve`,{method:"POST",body:JSON.stringify({agentType:o,approve:l})}),request:i}}const Qw=Gw({baseUrl:"http://localhost:3847"});w.createContext(Qw);const Zw={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},x0=w.createContext(Zw);function Jw({value:e,children:t}){return p.jsx(x0.Provider,{value:e,children:t})}function Si(){return w.useContext(x0)}function eb(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const tb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nb={};function Hp(e,t){return(nb.jsx?rb:tb).test(e)}const ib=/[ \t\n\f\r]/g;function sb(e){return typeof e=="object"?e.type==="text"?Wp(e.value):!1:Wp(e)}function Wp(e){return e.replace(ib,"")===""}class Io{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}Io.prototype.normal={};Io.prototype.property={};Io.prototype.space=void 0;function S0(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new Io(r,n,t)}function Ju(e){return e.toLowerCase()}class nr{constructor(t,r){this.attribute=r,this.property=t}}nr.prototype.attribute="";nr.prototype.booleanish=!1;nr.prototype.boolean=!1;nr.prototype.commaOrSpaceSeparated=!1;nr.prototype.commaSeparated=!1;nr.prototype.defined=!1;nr.prototype.mustUseProperty=!1;nr.prototype.number=!1;nr.prototype.overloadedBoolean=!1;nr.prototype.property="";nr.prototype.spaceSeparated=!1;nr.prototype.space=void 0;let ob=0;const be=wi(),ot=wi(),eh=wi(),re=wi(),Be=wi(),Xi=wi(),or=wi();function wi(){return 2**++ob}const th=Object.freeze(Object.defineProperty({__proto__:null,boolean:be,booleanish:ot,commaOrSpaceSeparated:or,commaSeparated:Xi,number:re,overloadedBoolean:eh,spaceSeparated:Be},Symbol.toStringTag,{value:"Module"})),kc=Object.keys(th);class qd extends nr{constructor(t,r,n,i){let s=-1;if(super(t,r),Up(this,"space",i),typeof n=="number")for(;++s<kc.length;){const o=kc[s];Up(this,kc[s],(n&th[o])===th[o])}}}qd.prototype.defined=!0;function Up(e,t,r){r&&(e[t]=r)}function us(e){const t={},r={};for(const[n,i]of Object.entries(e.properties)){const s=new qd(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),t[n]=s,r[Ju(n)]=n,r[Ju(s.attribute)]=n}return new Io(t,r,e.space)}const w0=us({properties:{ariaActiveDescendant:null,ariaAtomic:ot,ariaAutoComplete:null,ariaBusy:ot,ariaChecked:ot,ariaColCount:re,ariaColIndex:re,ariaColSpan:re,ariaControls:Be,ariaCurrent:null,ariaDescribedBy:Be,ariaDetails:null,ariaDisabled:ot,ariaDropEffect:Be,ariaErrorMessage:null,ariaExpanded:ot,ariaFlowTo:Be,ariaGrabbed:ot,ariaHasPopup:null,ariaHidden:ot,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Be,ariaLevel:re,ariaLive:null,ariaModal:ot,ariaMultiLine:ot,ariaMultiSelectable:ot,ariaOrientation:null,ariaOwns:Be,ariaPlaceholder:null,ariaPosInSet:re,ariaPressed:ot,ariaReadOnly:ot,ariaRelevant:null,ariaRequired:ot,ariaRoleDescription:Be,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 b0(e,t){return t in e?e[t]:t}function k0(e,t){return b0(e,t.toLowerCase())}const lb=us({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Xi,acceptCharset:Be,accessKey:Be,action:null,allow:null,allowFullScreen:be,allowPaymentRequest:be,allowUserMedia:be,alt:null,as:null,async:be,autoCapitalize:null,autoComplete:Be,autoFocus:be,autoPlay:be,blocking:Be,capture:null,charSet:null,checked:be,cite:null,className:Be,cols:re,colSpan:null,content:null,contentEditable:ot,controls:be,controlsList:Be,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:Be,height:re,hidden:eh,high:re,href:null,hrefLang:null,htmlFor:Be,httpEquiv:Be,id:null,imageSizes:null,imageSrcSet:null,inert:be,inputMode:null,integrity:null,is:null,isMap:be,itemId:null,itemProp:Be,itemRef:Be,itemScope:be,itemType:Be,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:Be,placeholder:null,playsInline:be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:be,referrerPolicy:null,rel:Be,required:be,reversed:be,rows:re,rowSpan:re,sandbox:Be,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: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: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:k0}),ab=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:or,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: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:or,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:or,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:or,rev:or,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:or,requiredFeatures:or,requiredFonts:or,requiredFormats:or,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant: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:or,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:or,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:or,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:b0}),C0=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()}}),E0=us({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:k0}),T0=us({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),cb={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"},ub=/[A-Z]/g,Kp=/-[a-z]/g,hb=/^data[-\w.:]+$/i;function db(e,t){const r=Ju(t);let n=t,i=nr;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&hb.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Kp,pb);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Kp.test(s)){let o=s.replace(ub,fb);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=qd}return new i(n,t)}function fb(e){return"-"+e.toLowerCase()}function pb(e){return e.charAt(1).toUpperCase()}const mb=S0([w0,lb,C0,E0,T0],"html"),Yd=S0([w0,ab,C0,E0,T0],"svg");function gb(e){return e.join(" ").trim()}var Xd={},Vp=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,_b=/\n/g,vb=/^\s*/,yb=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,xb=/^:\s*/,Sb=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,wb=/^[;\s]*/,bb=/^\s+|\s+$/g,kb=`
68
- `,qp="/",Yp="*",ri="",Cb="comment",Eb="declaration";function Tb(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function i(m){var g=m.match(_b);g&&(r+=g.length);var x=m.lastIndexOf(kb);n=~x?m.length-x:n+m.length}function s(){var m={line:r,column:n};return function(g){return g.position=new o(m),c(),g}}function o(m){this.start=m,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(m){var g=new Error(t.source+":"+r+":"+n+": "+m);if(g.reason=m,g.filename=t.source,g.line=r,g.column=n,g.source=e,!t.silent)throw g}function a(m){var g=m.exec(e);if(g){var x=g[0];return i(x),e=e.slice(x.length),g}}function c(){a(vb)}function h(m){var g;for(m=m||[];g=u();)g!==!1&&m.push(g);return m}function u(){var m=s();if(!(qp!=e.charAt(0)||Yp!=e.charAt(1))){for(var g=2;ri!=e.charAt(g)&&(Yp!=e.charAt(g)||qp!=e.charAt(g+1));)++g;if(g+=2,ri===e.charAt(g-1))return l("End of comment missing");var x=e.slice(2,g-2);return n+=2,i(x),e=e.slice(g),n+=2,m({type:Cb,comment:x})}}function d(){var m=s(),g=a(yb);if(g){if(u(),!a(xb))return l("property missing ':'");var x=a(Sb),_=m({type:Eb,property:Xp(g[0].replace(Vp,ri)),value:x?Xp(x[0].replace(Vp,ri)):ri});return a(wb),_}}function f(){var m=[];h(m);for(var g;g=d();)g!==!1&&(m.push(g),h(m));return m}return c(),f()}function Xp(e){return e?e.replace(bb,ri):ri}var Nb=Tb,Pb=$l&&$l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Xd,"__esModule",{value:!0});Xd.default=Rb;const Lb=Pb(Nb);function Rb(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,Lb.default)(e),i=typeof t=="function";return n.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(r=r||{},r[o]=l)}),r}var Fa={};Object.defineProperty(Fa,"__esModule",{value:!0});Fa.camelCase=void 0;var Db=/^--[a-zA-Z0-9_-]+$/,Mb=/-([a-z])/g,Ib=/^[^-]+$/,Ab=/^-(webkit|moz|ms|o|khtml)-/,Bb=/^-(ms)-/,Ob=function(e){return!e||Ib.test(e)||Db.test(e)},jb=function(e,t){return t.toUpperCase()},Gp=function(e,t){return"".concat(t,"-")},zb=function(e,t){return t===void 0&&(t={}),Ob(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Bb,Gp):e=e.replace(Ab,Gp),e.replace(Mb,jb))};Fa.camelCase=zb;var Fb=$l&&$l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},$b=Fb(Xd),Hb=Fa;function rh(e,t){var r={};return!e||typeof e!="string"||(0,$b.default)(e,function(n,i){n&&i&&(r[(0,Hb.camelCase)(n,t)]=i)}),r}rh.default=rh;var Wb=rh;const Ub=Gh(Wb),N0=P0("end"),Gd=P0("start");function P0(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function Kb(e){const t=Gd(e),r=N0(e);if(t&&r)return{start:t,end:r}}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?nh(e):""}function nh(e){return Zp(e&&e.line)+":"+Zp(e&&e.column)}function Qp(e){return nh(e&&e.start)+"-"+nh(e&&e.end)}function Zp(e){return e&&typeof e=="number"?e:1}class Bt extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof n=="string"){const a=n.indexOf(":");a===-1?s.ruleId=n:(s.source=n.slice(0,a),s.ruleId=n.slice(a+1))}if(!s.place&&s.ancestors&&s.ancestors){const a=s.ancestors[s.ancestors.length-1];a&&(s.place=a.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=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}}Bt.prototype.file="";Bt.prototype.name="";Bt.prototype.reason="";Bt.prototype.message="";Bt.prototype.stack="";Bt.prototype.column=void 0;Bt.prototype.line=void 0;Bt.prototype.ancestors=void 0;Bt.prototype.cause=void 0;Bt.prototype.fatal=void 0;Bt.prototype.place=void 0;Bt.prototype.ruleId=void 0;Bt.prototype.source=void 0;const Qd={}.hasOwnProperty,Vb=new Map,qb=/[A-Z]/g,Yb=new Set(["table","tbody","thead","tfoot","tr"]),Xb=new Set(["td","th"]),L0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Gb(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=ik(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=nk(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Yd:mb,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=R0(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function R0(e,t,r){if(t.type==="element")return Qb(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Zb(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ek(e,t,r);if(t.type==="mdxjsEsm")return Jb(e,t);if(t.type==="root")return tk(e,t,r);if(t.type==="text")return rk(e,t)}function Qb(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Yd,e.schema=i),e.ancestors.push(t);const s=M0(e,t.tagName,!1),o=sk(e,t);let l=Jd(e,t);return Yb.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!sb(a):!0})),D0(e,o,s,t),Zd(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function Zb(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}So(e,t.position)}function Jb(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);So(e,t.position)}function ek(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=Yd,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:M0(e,t.name,!0),o=ok(e,t),l=Jd(e,t);return D0(e,o,s,t),Zd(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function tk(e,t,r){const n={};return Zd(n,Jd(e,t)),e.create(t,e.Fragment,n,r)}function rk(e,t){return t.value}function D0(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function Zd(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function nk(e,t,r){return n;function n(i,s,o,l){const c=Array.isArray(o.children)?r:t;return l?c(s,o,l):c(s,o)}}function ik(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),a=Gd(n);return t(i,s,o,l,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function sk(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&Qd.call(t.properties,i)){const s=lk(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Xb.has(t.tagName)?n=l:r[o]=l}}if(n){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function ok(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else So(e,t.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const l=n.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else So(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function Jd(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:Vb;for(;++n<t.children.length;){const s=t.children[n];let o;if(e.passKeys){const a=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(a){const c=i.get(a)||0;o=a+"-"+c,i.set(a,c+1)}}const l=R0(e,s,o);l!==void 0&&r.push(l)}return r}function lk(e,t,r){const n=db(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?eb(r):gb(r)),n.property==="style"){let i=typeof r=="object"?r:ak(e,String(r));return e.stylePropertyNameCase==="css"&&(i=ck(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?cb[n.property]||n.property:n.attribute,r]}}function ak(e,t){try{return Ub(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,i=new Bt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=L0+"#cannot-parse-style-attribute",i}}function M0(e,t,r){let n;if(!r)n={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=Hp(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}n=o}else n=Hp(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return Qd.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);So(e)}function So(e,t){const r=new Bt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=L0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function ck(e){const t={};let r;for(r in e)Qd.call(e,r)&&(t[uk(r)]=e[r]);return t}function uk(e){let t=e.replace(qb,hk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function hk(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"]},dk={};function ef(e,t){const r=dk,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return I0(e,n,i)}function I0(e,t,r){if(fk(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Jp(e.children,t,r)}return Array.isArray(e)?Jp(e,t,r):""}function Jp(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=I0(e[i],t,r);return n.join("")}function fk(e){return!!(e&&typeof e=="object")}const em=document.createElement("i");function tf(e){const t="&"+e+";";em.innerHTML=t;const r=em.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function hr(e,t,r,n){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function Sr(e,t){return e.length>0?(hr(e,e.length,0,t),e):t}const tm={}.hasOwnProperty;function A0(e){const t={};let r=-1;for(;++r<e.length;)pk(t,e[r]);return t}function pk(e,t){let r;for(r in t){const i=(tm.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){tm.call(i,o)||(i[o]=[]);const l=s[o];mk(i[o],Array.isArray(l)?l:l?[l]:[])}}}function mk(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);hr(e,0,0,n)}function B0(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Ar(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $t=Kn(/[A-Za-z]/),It=Kn(/[\dA-Za-z]/),gk=Kn(/[#-'*+\--9=?A-Z^-~]/);function da(e){return e!==null&&(e<32||e===127)}const ih=Kn(/\d/),_k=Kn(/[\dA-Fa-f]/),vk=Kn(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function Ae(e){return e!==null&&(e<0||e===32)}function Ne(e){return e===-2||e===-1||e===32}const $a=Kn(new RegExp("\\p{P}|\\p{S}","u")),gi=Kn(/\s/);function Kn(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function hs(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&It(e.charCodeAt(r+1))&&It(e.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(r+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function Le(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return Ne(a)?(e.enter(r),l(a)):t(a)}function l(a){return Ne(a)&&s++<i?(e.consume(a),l):(e.exit(r),t(a))}}const yk={tokenize:xk};function xk(e){const t=e.attempt(this.parser.constructs.contentInitial,n,i);let r;return t;function n(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Le(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const a=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=a),r=a,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return _e(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const Sk={tokenize:wk},rm={tokenize:bk};function wk(e){const t=this,r=[];let n=0,i,s,o;return l;function l(y){if(n<r.length){const E=r[n];return t.containerState=E[1],e.attempt(E[0].continuation,a,c)(y)}return c(y)}function a(y){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const E=t.events.length;let N=E,k;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){k=t.events[N][1].end;break}_(n);let I=E;for(;I<t.events.length;)t.events[I][1].end={...k},I++;return hr(t.events,N+1,0,t.events.slice(E)),t.events.length=I,c(y)}return l(y)}function c(y){if(n===r.length){if(!i)return d(y);if(i.currentConstruct&&i.currentConstruct.concrete)return m(y);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(rm,h,u)(y)}function h(y){return i&&v(),_(n),d(y)}function u(y){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,m(y)}function d(y){return t.containerState={},e.attempt(rm,f,m)(y)}function f(y){return n++,r.push([t.currentConstruct,t.containerState]),d(y)}function m(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}),g(y)}function g(y){if(y===null){x(e.exit("chunkFlow"),!0),_(0),e.consume(y);return}return _e(y)?(e.consume(y),x(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(y),g)}function x(y,E){const N=t.sliceStream(y);if(E&&N.push(null),y.previous=s,s&&(s.next=y),s=y,i.defineSkip(y.start),i.write(N),t.parser.lazy[y.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const I=t.events.length;let z=I,Z,T;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(Z){T=t.events[z][1].end;break}Z=!0}for(_(n),k=I;k<t.events.length;)t.events[k][1].end={...T},k++;hr(t.events,z+1,0,t.events.slice(I)),t.events.length=k}}function _(y){let E=r.length;for(;E-- >y;){const N=r[E];t.containerState=N[1],N[0].exit.call(t,e)}r.length=y}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function bk(e,t,r){return Le(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ns(e){if(e===null||Ae(e)||gi(e))return 1;if($a(e))return 2}function Ha(e,t,r){const n=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!n.includes(s)&&(t=s(t,r),n.push(s))}return t}const sh={name:"attention",resolveAll:kk,tokenize:Ck};function kk(e,t){let r=-1,n,i,s,o,l,a,c,h;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const u={...e[n][1].end},d={...e[r][1].start};nm(u,-a),nm(d,a),o={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:d},s={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:a>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[n][1].end={...o.start},e[r][1].start={...l.end},c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=Sr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=Sr(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=Sr(c,Ha(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=Sr(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(h=2,c=Sr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,hr(e,n-1,r-n+3,c),r=n+c.length-h-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function Ck(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=ns(n);let s;return o;function o(a){return s=a,e.enter("attentionSequence"),l(a)}function l(a){if(a===s)return e.consume(a),l;const c=e.exit("attentionSequence"),h=ns(a),u=!h||h===2&&i||r.includes(a),d=!i||i===2&&h||r.includes(n);return c._open=!!(s===42?u:u&&(i||!d)),c._close=!!(s===42?d:d&&(h||!u)),t(a)}}function nm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Ek={name:"autolink",tokenize:Tk};function Tk(e,t,r){let n=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?r(f):c(f)}function o(f){return f===43||f===45||f===46||It(f)?(n=1,l(f)):c(f)}function l(f){return f===58?(e.consume(f),n=0,a):(f===43||f===45||f===46||It(f))&&n++<32?(e.consume(f),l):(n=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)?r(f):(e.consume(f),a)}function c(f){return f===64?(e.consume(f),h):gk(f)?(e.consume(f),c):r(f)}function h(f){return It(f)?u(f):r(f)}function u(f){return f===46?(e.consume(f),n=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||It(f))&&n++<63){const m=f===45?d:u;return e.consume(f),m}return r(f)}}const Ao={partial:!0,tokenize:Nk};function Nk(e,t,r){return n;function n(s){return Ne(s)?Le(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||_e(s)?t(s):r(s)}}const O0={continuation:{tokenize:Lk},exit:Rk,name:"blockQuote",tokenize:Pk};function Pk(e,t,r){const n=this;return i;function i(o){if(o===62){const l=n.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return r(o)}function s(o){return Ne(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Lk(e,t,r){const n=this;return i;function i(o){return Ne(o)?Le(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(O0,t,r)(o)}}function Rk(e){e.exit("blockQuote")}const j0={name:"characterEscape",tokenize:Dk};function Dk(e,t,r){return n;function n(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return vk(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const z0={name:"characterReference",tokenize:Mk};function Mk(e,t,r){const n=this;let i=0,s,o;return l;function l(u){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),a}function a(u){return u===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(u),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=It,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=_k,h):(e.enter("characterReferenceValue"),s=7,o=ih,h(u))}function h(u){if(u===59&&i){const d=e.exit("characterReferenceValue");return o===It&&!tf(n.sliceSerialize(d))?r(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(u)&&i++<s?(e.consume(u),h):r(u)}}const im={partial:!0,tokenize:Ak},sm={concrete:!0,name:"codeFenced",tokenize:Ik};function Ik(e,t,r){const n=this,i={partial:!0,tokenize:N};let s=0,o=0,l;return a;function a(k){return c(k)}function c(k){const I=n.events[n.events.length-1];return s=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,l=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(k)}function h(k){return k===l?(o++,e.consume(k),h):o<3?r(k):(e.exit("codeFencedFenceSequence"),Ne(k)?Le(e,u,"whitespace")(k):u(k))}function u(k){return k===null||_e(k)?(e.exit("codeFencedFence"),n.interrupt?t(k):e.check(im,g,E)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(k))}function d(k){return k===null||_e(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(k)):Ne(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Le(e,f,"whitespace")(k)):k===96&&k===l?r(k):(e.consume(k),d)}function f(k){return k===null||_e(k)?u(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||_e(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(k)):k===96&&k===l?r(k):(e.consume(k),m)}function g(k){return e.attempt(i,E,x)(k)}function x(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),_}function _(k){return s>0&&Ne(k)?Le(e,v,"linePrefix",s+1)(k):v(k)}function v(k){return k===null||_e(k)?e.check(im,g,E)(k):(e.enter("codeFlowValue"),y(k))}function y(k){return k===null||_e(k)?(e.exit("codeFlowValue"),v(k)):(e.consume(k),y)}function E(k){return e.exit("codeFenced"),t(k)}function N(k,I,z){let Z=0;return T;function T(M){return k.enter("lineEnding"),k.consume(M),k.exit("lineEnding"),R}function R(M){return k.enter("codeFencedFence"),Ne(M)?Le(k,A,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):A(M)}function A(M){return M===l?(k.enter("codeFencedFenceSequence"),D(M)):z(M)}function D(M){return M===l?(Z++,k.consume(M),D):Z>=o?(k.exit("codeFencedFenceSequence"),Ne(M)?Le(k,U,"whitespace")(M):U(M)):z(M)}function U(M){return M===null||_e(M)?(k.exit("codeFencedFence"),I(M)):z(M)}}}function Ak(e,t,r){const n=this;return i;function i(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}const Ec={name:"codeIndented",tokenize:Ok},Bk={partial:!0,tokenize:jk};function Ok(e,t,r){const n=this;return i;function i(c){return e.enter("codeIndented"),Le(e,s,"linePrefix",5)(c)}function s(c){const h=n.events[n.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?a(c):_e(c)?e.attempt(Bk,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||_e(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function jk(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):_e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Le(e,s,"linePrefix",5)(o)}function s(o){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):_e(o)?i(o):r(o)}}const zk={name:"codeText",previous:$k,resolve:Fk,tokenize:Hk};function Fk(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)i===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(i=n):(n===t||e[n][1].type==="lineEnding")&&(e[i][1].type="codeTextData",n!==i+2&&(e[i][1].end=e[n-1][1].end,e.splice(i+2,n-i-2),t-=n-i-2,n=i+2),i=void 0);return e}function $k(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Hk(e,t,r){let n=0,i,s;return o;function o(u){return e.enter("codeText"),e.enter("codeTextSequence"),l(u)}function l(u){return u===96?(e.consume(u),n++,l):(e.exit("codeTextSequence"),a(u))}function a(u){return u===null?r(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),a):u===96?(s=e.enter("codeTextSequence"),i=0,h(u)):_e(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||_e(u)?(e.exit("codeTextData"),a(u)):(e.consume(u),c)}function h(u){return u===96?(e.consume(u),i++,h):i===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(s.type="codeTextData",c(u))}}class 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,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&bs(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),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 r=this.left.splice(t,Number.POSITIVE_INFINITY);bs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);bs(this.left,r.reverse())}}}function bs(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function F0(e){const t={};let r=-1,n,i,s,o,l,a,c;const h=new Wk(e);for(;++r<h.length;){for(;r in t;)r=t[r];if(n=h.get(r),r&&n[1].type==="chunkFlow"&&h.get(r-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,s=0,s<a.length&&a[s][1].type==="lineEndingBlank"&&(s+=2),s<a.length&&a[s][1].type==="content"))for(;++s<a.length&&a[s][1].type!=="content";)a[s][1].type==="chunkText"&&(a[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,Uk(h,r)),r=t[r],c=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=h.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...h.get(i)[1].start},l=h.slice(i,r),l.unshift(n),h.splice(i,r-i+1,l))}}return hr(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function Uk(e,t){const r=e.get(t)[1],n=e.get(t)[2];let i=t-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,a=[],c={};let h,u,d=-1,f=r,m=0,g=0;const x=[g];for(;f;){for(;e.get(++i)[1]!==f;);s.push(i),f._tokenizer||(h=n.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=r;++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&&(g=d+1,x.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):x.pop(),d=x.length;d--;){const _=l.slice(x[d],x[d+1]),v=s.pop();a.push([v,v+_.length-1]),e.splice(v,2,_)}for(a.reverse(),d=-1;++d<a.length;)c[m+a[d][0]]=m+a[d][1],m+=a[d][1]-a[d][0]-1;return c}const Kk={resolve:qk,tokenize:Yk},Vk={partial:!0,tokenize:Xk};function qk(e){return F0(e),e}function Yk(e,t){let r;return n;function n(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):_e(l)?e.check(Vk,o,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function Xk(e,t,r){const n=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Le(e,s,"linePrefix")}function s(o){if(o===null||_e(o))return r(o);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(n.parser.constructs.flow,r,t)(o)}}function $0(e,t,r,n,i,s,o,l,a){const c=a||Number.POSITIVE_INFINITY;let h=0;return u;function u(_){return _===60?(e.enter(n),e.enter(i),e.enter(s),e.consume(_),e.exit(s),d):_===null||_===32||_===41||da(_)?r(_):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(_))}function d(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(_))}function f(_){return _===62?(e.exit("chunkString"),e.exit(l),d(_)):_===null||_===60||_e(_)?r(_):(e.consume(_),_===92?m:f)}function m(_){return _===60||_===62||_===92?(e.consume(_),f):f(_)}function g(_){return!h&&(_===null||_===41||Ae(_))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(_)):h<c&&_===40?(e.consume(_),h++,g):_===41?(e.consume(_),h--,g):_===null||_===32||_===40||da(_)?r(_):(e.consume(_),_===92?x:g)}function x(_){return _===40||_===41||_===92?(e.consume(_),g):g(_)}}function H0(e,t,r,n,i,s){const o=this;let l=0,a;return c;function c(f){return e.enter(n),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?r(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(n),t):_e(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||_e(f)||l++>999?(e.exit("chunkString"),h(f)):(e.consume(f),a||(a=!Ne(f)),f===92?d:u)}function d(f){return f===91||f===92||f===93?(e.consume(f),l++,u):u(f)}}function W0(e,t,r,n,i,s){let o;return l;function l(d){return d===34||d===39||d===40?(e.enter(n),e.enter(i),e.consume(d),e.exit(i),o=d===40?41:d,a):r(d)}function a(d){return d===o?(e.enter(i),e.consume(d),e.exit(i),e.exit(n),t):(e.enter(s),c(d))}function c(d){return d===o?(e.exit(s),a(o)):d===null?r(d):_e(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Le(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===o||d===null||_e(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 r;return n;function n(i){return _e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Ne(i)?Le(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const Gk={name:"definition",tokenize:Zk},Qk={partial:!0,tokenize:Jk};function Zk(e,t,r){const n=this;let i;return s;function s(f){return e.enter("definition"),o(f)}function o(f){return H0.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return i=Ar(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),a):r(f)}function a(f){return Ae(f)?Zs(e,c)(f):c(f)}function c(f){return $0(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function h(f){return e.attempt(Qk,u,u)(f)}function u(f){return Ne(f)?Le(e,d,"whitespace")(f):d(f)}function d(f){return f===null||_e(f)?(e.exit("definition"),n.parser.defined.push(i),t(f)):r(f)}}function Jk(e,t,r){return n;function n(l){return Ae(l)?Zs(e,i)(l):r(l)}function i(l){return W0(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Ne(l)?Le(e,o,"whitespace")(l):o(l)}function o(l){return l===null||_e(l)?t(l):r(l)}}const eC={name:"hardBreakEscape",tokenize:tC};function tC(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return _e(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const rC={name:"headingAtx",resolve:nC,tokenize:iC};function nC(e,t){let r=e.length-2,n=3,i,s;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},s={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},hr(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function iC(e,t,r){let n=0;return i;function i(h){return e.enter("atxHeading"),s(h)}function s(h){return e.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&n++<6?(e.consume(h),o):h===null||Ae(h)?(e.exit("atxHeadingSequence"),l(h)):r(h)}function l(h){return h===35?(e.enter("atxHeadingSequence"),a(h)):h===null||_e(h)?(e.exit("atxHeading"),t(h)):Ne(h)?Le(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||Ae(h)?(e.exit("atxHeadingText"),l(h)):(e.consume(h),c)}}const sC=["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"],om=["pre","script","style","textarea"],oC={concrete:!0,name:"htmlFlow",resolveTo:cC,tokenize:uC},lC={partial:!0,tokenize:dC},aC={partial:!0,tokenize:hC};function cC(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 uC(e,t,r){const n=this;let i,s,o,l,a;return c;function c(b){return h(b)}function h(b){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(b),u}function u(b){return b===33?(e.consume(b),d):b===47?(e.consume(b),s=!0,g):b===63?(e.consume(b),i=3,n.interrupt?t:S):$t(b)?(e.consume(b),o=String.fromCharCode(b),x):r(b)}function d(b){return b===45?(e.consume(b),i=2,f):b===91?(e.consume(b),i=5,l=0,m):$t(b)?(e.consume(b),i=4,n.interrupt?t:S):r(b)}function f(b){return b===45?(e.consume(b),n.interrupt?t:S):r(b)}function m(b){const me="CDATA[";return b===me.charCodeAt(l++)?(e.consume(b),l===me.length?n.interrupt?t:A:m):r(b)}function g(b){return $t(b)?(e.consume(b),o=String.fromCharCode(b),x):r(b)}function x(b){if(b===null||b===47||b===62||Ae(b)){const me=b===47,V=o.toLowerCase();return!me&&!s&&om.includes(V)?(i=1,n.interrupt?t(b):A(b)):sC.includes(o.toLowerCase())?(i=6,me?(e.consume(b),_):n.interrupt?t(b):A(b)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(b):s?v(b):y(b))}return b===45||It(b)?(e.consume(b),o+=String.fromCharCode(b),x):r(b)}function _(b){return b===62?(e.consume(b),n.interrupt?t:A):r(b)}function v(b){return Ne(b)?(e.consume(b),v):T(b)}function y(b){return b===47?(e.consume(b),T):b===58||b===95||$t(b)?(e.consume(b),E):Ne(b)?(e.consume(b),y):T(b)}function E(b){return b===45||b===46||b===58||b===95||It(b)?(e.consume(b),E):N(b)}function N(b){return b===61?(e.consume(b),k):Ne(b)?(e.consume(b),N):y(b)}function k(b){return b===null||b===60||b===61||b===62||b===96?r(b):b===34||b===39?(e.consume(b),a=b,I):Ne(b)?(e.consume(b),k):z(b)}function I(b){return b===a?(e.consume(b),a=null,Z):b===null||_e(b)?r(b):(e.consume(b),I)}function z(b){return b===null||b===34||b===39||b===47||b===60||b===61||b===62||b===96||Ae(b)?N(b):(e.consume(b),z)}function Z(b){return b===47||b===62||Ne(b)?y(b):r(b)}function T(b){return b===62?(e.consume(b),R):r(b)}function R(b){return b===null||_e(b)?A(b):Ne(b)?(e.consume(b),R):r(b)}function A(b){return b===45&&i===2?(e.consume(b),F):b===60&&i===1?(e.consume(b),W):b===62&&i===4?(e.consume(b),ne):b===63&&i===3?(e.consume(b),S):b===93&&i===5?(e.consume(b),$):_e(b)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(lC,oe,D)(b)):b===null||_e(b)?(e.exit("htmlFlowData"),D(b)):(e.consume(b),A)}function D(b){return e.check(aC,U,oe)(b)}function U(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),M}function M(b){return b===null||_e(b)?D(b):(e.enter("htmlFlowData"),A(b))}function F(b){return b===45?(e.consume(b),S):A(b)}function W(b){return b===47?(e.consume(b),o="",L):A(b)}function L(b){if(b===62){const me=o.toLowerCase();return om.includes(me)?(e.consume(b),ne):A(b)}return $t(b)&&o.length<8?(e.consume(b),o+=String.fromCharCode(b),L):A(b)}function $(b){return b===93?(e.consume(b),S):A(b)}function S(b){return b===62?(e.consume(b),ne):b===45&&i===2?(e.consume(b),S):A(b)}function ne(b){return b===null||_e(b)?(e.exit("htmlFlowData"),oe(b)):(e.consume(b),ne)}function oe(b){return e.exit("htmlFlow"),t(b)}}function hC(e,t,r){const n=this;return i;function i(o){return _e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}function dC(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ao,t,r)}}const fC={name:"htmlText",tokenize:pC};function pC(e,t,r){const n=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),N):S===63?(e.consume(S),y):$t(S)?(e.consume(S),z):r(S)}function c(S){return S===45?(e.consume(S),h):S===91?(e.consume(S),s=0,m):$t(S)?(e.consume(S),v):r(S)}function h(S){return S===45?(e.consume(S),f):r(S)}function u(S){return S===null?r(S):S===45?(e.consume(S),d):_e(S)?(o=u,W(S)):(e.consume(S),u)}function d(S){return S===45?(e.consume(S),f):u(S)}function f(S){return S===62?F(S):S===45?d(S):u(S)}function m(S){const ne="CDATA[";return S===ne.charCodeAt(s++)?(e.consume(S),s===ne.length?g:m):r(S)}function g(S){return S===null?r(S):S===93?(e.consume(S),x):_e(S)?(o=g,W(S)):(e.consume(S),g)}function x(S){return S===93?(e.consume(S),_):g(S)}function _(S){return S===62?F(S):S===93?(e.consume(S),_):g(S)}function v(S){return S===null||S===62?F(S):_e(S)?(o=v,W(S)):(e.consume(S),v)}function y(S){return S===null?r(S):S===63?(e.consume(S),E):_e(S)?(o=y,W(S)):(e.consume(S),y)}function E(S){return S===62?F(S):y(S)}function N(S){return $t(S)?(e.consume(S),k):r(S)}function k(S){return S===45||It(S)?(e.consume(S),k):I(S)}function I(S){return _e(S)?(o=I,W(S)):Ne(S)?(e.consume(S),I):F(S)}function z(S){return S===45||It(S)?(e.consume(S),z):S===47||S===62||Ae(S)?Z(S):r(S)}function Z(S){return S===47?(e.consume(S),F):S===58||S===95||$t(S)?(e.consume(S),T):_e(S)?(o=Z,W(S)):Ne(S)?(e.consume(S),Z):F(S)}function T(S){return S===45||S===46||S===58||S===95||It(S)?(e.consume(S),T):R(S)}function R(S){return S===61?(e.consume(S),A):_e(S)?(o=R,W(S)):Ne(S)?(e.consume(S),R):Z(S)}function A(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(e.consume(S),i=S,D):_e(S)?(o=A,W(S)):Ne(S)?(e.consume(S),A):(e.consume(S),U)}function D(S){return S===i?(e.consume(S),i=void 0,M):S===null?r(S):_e(S)?(o=D,W(S)):(e.consume(S),D)}function U(S){return S===null||S===34||S===39||S===60||S===61||S===96?r(S):S===47||S===62||Ae(S)?Z(S):(e.consume(S),U)}function M(S){return S===47||S===62||Ae(S)?Z(S):r(S)}function F(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):r(S)}function W(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),L}function L(S){return Ne(S)?Le(e,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):$(S)}function $(S){return e.enter("htmlTextData"),o(S)}}const rf={name:"labelEnd",resolveAll:vC,resolveTo:yC,tokenize:xC},mC={tokenize:SC},gC={tokenize:wC},_C={tokenize:bC};function vC(e){let t=-1;const r=[];for(;++t<e.length;){const n=e[t][1];if(r.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",t+=i}}return e.length!==r.length&&hr(e,0,e.length,r),e}function yC(e,t){let r=e.length,n=0,i,s,o,l;for(;r--;)if(i=e[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const a={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},h={type:"labelText",start:{...e[s+n+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",a,t],["enter",c,t]],l=Sr(l,e.slice(s+1,s+n+3)),l=Sr(l,[["enter",h,t]]),l=Sr(l,Ha(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=Sr(l,[["exit",h,t],e[o-2],e[o-1],["exit",c,t]]),l=Sr(l,e.slice(o+1)),l=Sr(l,[["exit",a,t]]),hr(e,s,e.length,l),e}function xC(e,t,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return l;function l(d){return s?s._inactive?u(d):(o=n.parser.defined.includes(Ar(n.sliceSerialize({start:s.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelEnd"),a):r(d)}function a(d){return d===40?e.attempt(mC,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(_C,h,u)(d)}function h(d){return t(d)}function u(d){return s._balanced=!0,r(d)}}function SC(e,t,r){return n;function n(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),i}function i(u){return Ae(u)?Zs(e,s)(u):s(u)}function s(u){return u===41?h(u):$0(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function o(u){return Ae(u)?Zs(e,a)(u):h(u)}function l(u){return r(u)}function a(u){return u===34||u===39||u===40?W0(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):h(u)}function c(u){return Ae(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):r(u)}}function wC(e,t,r){const n=this;return i;function i(l){return H0.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes(Ar(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function bC(e,t,r){return n;function n(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):r(s)}}const kC={name:"labelStartImage",resolveAll:rf.resolveAll,tokenize:CC};function CC(e,t,r){const n=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):t(l)}}const EC={name:"labelStartLink",resolveAll:rf.resolveAll,tokenize:TC};function TC(e,t,r){const n=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):t(o)}}const Tc={name:"lineEnding",tokenize:NC};function NC(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Le(e,t,"linePrefix")}}const Rl={name:"thematicBreak",tokenize:PC};function PC(e,t,r){let n=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,l(c)}function l(c){return c===i?(e.enter("thematicBreakSequence"),a(c)):n>=3&&(c===null||_e(c))?(e.exit("thematicBreak"),t(c)):r(c)}function a(c){return c===i?(e.consume(c),n++,a):(e.exit("thematicBreakSequence"),Ne(c)?Le(e,l,"whitespace")(c):l(c))}}const Qt={continuation:{tokenize:MC},exit:AC,name:"list",tokenize:DC},LC={partial:!0,tokenize:BC},RC={partial:!0,tokenize:IC};function DC(e,t,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(f){const m=n.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||f===n.containerState.marker:ih(f)){if(n.containerState.type||(n.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Rl,r,c)(f):c(f);if(!n.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(f)}return r(f)}function a(f){return ih(f)&&++o<10?(e.consume(f),a):(!n.interrupt||o<2)&&(n.containerState.marker?f===n.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):r(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||f,e.check(Ao,n.interrupt?r:h,e.attempt(LC,d,u))}function h(f){return n.containerState.initialBlankLine=!0,s++,d(f)}function u(f){return Ne(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),d):r(f)}function d(f){return n.containerState.size=s+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function MC(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(Ao,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Le(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!Ne(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(RC,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Le(e,e.attempt(Qt,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function IC(e,t,r){const n=this;return Le(e,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(s):r(s)}}function AC(e){e.exit(this.containerState.type)}function BC(e,t,r){const n=this;return Le(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!Ne(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const lm={name:"setextUnderline",resolveTo:OC,tokenize:jC};function OC(e,t){let r=e.length,n,i,s;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!s&&e[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[n][1],t]),e[n][1].end={...e[s][1].end}):e[n][1]=o,e.push(["exit",o,t]),e}function jC(e,t,r){const n=this;let i;return s;function s(c){let h=n.events.length,u;for(;h--;)if(n.events[h][1].type!=="lineEnding"&&n.events[h][1].type!=="linePrefix"&&n.events[h][1].type!=="content"){u=n.events[h][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||u)?(e.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),Ne(c)?Le(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||_e(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const zC={tokenize:FC};function FC(e){const t=this,r=e.attempt(Ao,n,e.attempt(this.parser.constructs.flowInitial,i,Le(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Kk,i)),"linePrefix")));return r;function n(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const $C={resolveAll:K0()},HC=U0("string"),WC=U0("text");function U0(e){return{resolveAll:K0(e==="text"?UC:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],s=r.attempt(i,o,l);return o;function o(h){return c(h)?s(h):l(h)}function l(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),a}function a(h){return c(h)?(r.exit("data"),s(h)):(r.consume(h),a)}function c(h){if(h===null)return!0;const u=i[h];let d=-1;if(u)for(;++d<u.length;){const f=u[d];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}function K0(e){return t;function t(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(r,n):r}}function UC(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const n=e[r-1][1],i=t.sliceStream(n);let s=i.length,o=-1,l=0,a;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(c===-2)a=!0,l++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){const c={type:r===e.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(e.splice(r,0,["enter",c,t],["exit",c,t]),r+=2)}r++}return e}const KC={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:O0},VC={91:Gk},qC={[-2]:Ec,[-1]:Ec,32:Ec},YC={35:rC,42:Rl,45:[lm,Rl],60:oC,61:lm,95:Rl,96:sm,126:sm},XC={38:z0,92:j0},GC={[-5]:Tc,[-4]:Tc,[-3]:Tc,33:kC,38:z0,42:sh,60:[Ek,fC],91:EC,92:[eC,j0],93:rf,95:sh,96:zk},QC={null:[sh,$C]},ZC={null:[42,95]},JC={null:[]},e2=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ZC,contentInitial:VC,disable:JC,document:KC,flow:YC,flowInitial:qC,insideSpan:QC,string:XC,text:GC},Symbol.toStringTag,{value:"Module"}));function t2(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],l=[];const a={attempt:I(N),check:I(k),consume:v,enter:y,exit:E,interrupt:I(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:m,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(R){return o=Sr(o,R),x(),o[o.length-1]!==null?[]:(z(t,0),c.events=Ha(s,c.events,c),c.events)}function d(R,A){return n2(f(R),A)}function f(R){return r2(o,R)}function m(){const{_bufferIndex:R,_index:A,line:D,column:U,offset:M}=n;return{_bufferIndex:R,_index:A,line:D,column:U,offset:M}}function g(R){i[R.line]=R.column,T()}function x(){let R;for(;n._index<o.length;){const A=o[n._index];if(typeof A=="string")for(R=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===R&&n._bufferIndex<A.length;)_(A.charCodeAt(n._bufferIndex));else _(A)}}function _(R){h=h(R)}function v(R){_e(R)?(n.line++,n.column=1,n.offset+=R===-3?2:1,T()):R!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=R}function y(R,A){const D=A||{};return D.type=R,D.start=m(),c.events.push(["enter",D,c]),l.push(D),D}function E(R){const A=l.pop();return A.end=m(),c.events.push(["exit",A,c]),A}function N(R,A){z(R,A.from)}function k(R,A){A.restore()}function I(R,A){return D;function D(U,M,F){let W,L,$,S;return Array.isArray(U)?oe(U):"tokenize"in U?oe([U]):ne(U);function ne(H){return G;function G(he){const ue=he!==null&&H[he],ge=he!==null&&H.null,O=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return oe(O)(he)}}function oe(H){return W=H,L=0,H.length===0?F:b(H[L])}function b(H){return G;function G(he){return S=Z(),$=H,H.partial||(c.currentConstruct=H),H.name&&c.parser.constructs.disable.null.includes(H.name)?V():H.tokenize.call(A?Object.assign(Object.create(c),A):c,a,me,V)(he)}}function me(H){return R($,S),M}function V(H){return S.restore(),++L<W.length?b(W[L]):F}}}function z(R,A){R.resolveAll&&!s.includes(R)&&s.push(R),R.resolve&&hr(c.events,A,c.events.length-A,R.resolve(c.events.slice(A),c)),R.resolveTo&&(c.events=R.resolveTo(c.events,c))}function Z(){const R=m(),A=c.previous,D=c.currentConstruct,U=c.events.length,M=Array.from(l);return{from:U,restore:F};function F(){n=R,c.previous=A,c.currentConstruct=D,c.events.length=U,l=M,T()}}function T(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function r2(e,t){const r=t.start._index,n=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(r===i)o=[e[r].slice(n,s)];else{if(o=e.slice(r,i),n>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(n):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function n2(e,t){let r=-1;const n=[];let i;for(;++r<e.length;){const s=e[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
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,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(i=>[r,i]):[[r,n]])},[]))}function eb(e,t){let r=Zu(e);return t&&t.forEach((n,i)=>{r.has(i)||t.getAll(i).forEach(s=>{r.append(i,s)})}),r}const tb="6";try{window.__reactRouterVersion=tb}catch{}const rb="startTransition",qp=Q1[rb];function nb(e){let{basename:t,children:r,future:n,window:i}=e,s=b.useRef();s.current==null&&(s.current=cw({window:i,v5Compat:!0}));let o=s.current,[l,a]=b.useState({action:o.action,location:o.location}),{v7_startTransition:c}=n||{},h=b.useCallback(u=>{c&&qp?qp(()=>a(u)):a(u)},[a,c]);return b.useLayoutEffect(()=>o.listen(h),[o,h]),b.useEffect(()=>Qw(n),[n]),b.createElement(Zw,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}var Yp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Yp||(Yp={}));var Xp;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Xp||(Xp={}));function ib(e){let t=b.useRef(Zu(e)),r=b.useRef(!1),n=Mo(),i=b.useMemo(()=>eb(n.search,r.current?null:t.current),[n.search]),s=cs(),o=b.useCallback((l,a)=>{const c=Zu(typeof l=="function"?l(i):l);r.current=!0,s("?"+c,a)},[s,i]);return[i,o]}const N0=b.createContext({ides:[],updateIdeChats:()=>{},screenshotMap:{},setScreenshotMap:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{},wsStatus:"connected",isConnected:!0,connectionStates:{},connectionTransports:{},showReconnected:!1}),T0=b.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function sb(e,t){var o,l,a,c;const r=Date.now();if(t.length===0)return e.map(h=>({...h,_lastUpdate:r}));const n=new Map;for(const h of t)n.set(h.id,h);for(const h of e){const u=n.get(h.id);if(!u){n.set(h.id,{...h,_lastUpdate:r});continue}const d=h.timestamp||r,f=u._lastUpdate||u.timestamp||0;if(d>=f){const m=(o=h.chats)!=null&&o.length?h.chats:u.chats;n.set(h.id,{...u,...h,chats:m,_lastUpdate:r})}else(l=h.chats)!=null&&l.length&&!((a=u.chats)!=null&&a.length)&&n.set(h.id,{...u,chats:h.chats})}const i=new Set(e.map(h=>h.id)),s=new Set;for(const h of e){const u=h.daemonId||((c=h.id)==null?void 0:c.split(":")[0]);u&&s.add(u)}for(const[h,u]of n){const d=u.daemonId||h.split(":")[0];if(!s.has(d))continue;const f=r-(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)&&n.delete(h)}for(const[h,u]of n)r-(u._lastUpdate||u.timestamp||0)>3e5&&u.status!=="online"&&n.delete(h);return Array.from(n.values())}function ob({children:e}){const[t,r]=b.useState([]),[n,i]=b.useState({}),[s,o]=b.useState(!1),[l,a]=b.useState([]),c=b.useCallback((u,d)=>{r(f=>f.map(m=>m.id===u?{...m,chats:d}:m))},[]),h={injectEntries:u=>{r(d=>d.length===0?u:sb(u,d))},markLoaded:()=>o(!0),getIdes:()=>t};return p.jsx(T0.Provider,{value:h,children:p.jsx(N0.Provider,{value:{ides:t,updateIdeChats:c,screenshotMap:n,setScreenshotMap:i,initialLoaded:s,toasts:l,setToasts:a,wsStatus:"connected",isConnected:!0,connectionStates:{},connectionTransports:{},showReconnected:!1},children:e})})}function P0(){return b.useContext(N0)}function Gp(){return b.useContext(T0)}function lb(e){const{baseUrl:t,getToken:r,onUnauthorized:n}=e;async function i(s,o={}){const l={"Content-Type":"application/json",...o.headers||{}},a=r==null?void 0:r();a&&(l.Authorization=`Bearer ${a}`);const c=s.startsWith("http")?s:`${t}${s.startsWith("/")?"":"/"}${s}`,h=await fetch(c,{...o,headers:l});if(h.status===401)throw n==null||n(),new Error("Unauthorized");if(!h.ok){const u=await h.json().catch(()=>({error:h.statusText}));throw new Error(u.error||`API Error: ${h.status}`)}return h.json()}return{getDaemons:()=>i("/api/v1/daemons"),getDaemonStatus:s=>i(`/api/v1/daemons/${s}/status`),sendCommand:(s,o,l={})=>i(`/api/v1/daemons/${s}/command`,{method:"POST",body:JSON.stringify({type:o,payload:l})}),execTerminal:(s,o,l)=>i(`/api/v1/daemons/${s}/terminal`,{method:"POST",body:JSON.stringify({command:o,name:l})}),sendAgentMessage:(s,o,l)=>i(`/api/v1/agents/${s}/send`,{method:"POST",body:JSON.stringify({agentType:o,message:l})}),getAgentStatus:s=>i(`/api/v1/agents/${s}/status`),approveAgent:(s,o,l)=>i(`/api/v1/agents/${s}/approve`,{method:"POST",body:JSON.stringify({agentType:o,approve:l})}),request:i}}const ab=lb({baseUrl:"http://localhost:3847"});b.createContext(ab);const cb={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},L0=b.createContext(cb);function ub({value:e,children:t}){return p.jsx(L0.Provider,{value:e,children:t})}function xi(){return b.useContext(L0)}function hb(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const db=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pb={};function Qp(e,t){return(pb.jsx?fb:db).test(e)}const mb=/[ \t\n\f\r]/g;function gb(e){return typeof e=="object"?e.type==="text"?Zp(e.value):!1:Zp(e)}function Zp(e){return e.replace(mb,"")===""}class Io{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}Io.prototype.normal={};Io.prototype.property={};Io.prototype.space=void 0;function D0(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new Io(r,n,t)}function Ju(e){return e.toLowerCase()}class Zt{constructor(t,r){this.attribute=r,this.property=t}}Zt.prototype.attribute="";Zt.prototype.booleanish=!1;Zt.prototype.boolean=!1;Zt.prototype.commaOrSpaceSeparated=!1;Zt.prototype.commaSeparated=!1;Zt.prototype.defined=!1;Zt.prototype.mustUseProperty=!1;Zt.prototype.number=!1;Zt.prototype.overloadedBoolean=!1;Zt.prototype.property="";Zt.prototype.spaceSeparated=!1;Zt.prototype.space=void 0;let _b=0;const ke=Si(),nt=Si(),eh=Si(),ie=Si(),Be=Si(),Xi=Si(),tr=Si();function Si(){return 2**++_b}const th=Object.freeze(Object.defineProperty({__proto__:null,boolean:ke,booleanish:nt,commaOrSpaceSeparated:tr,commaSeparated:Xi,number:ie,overloadedBoolean:eh,spaceSeparated:Be},Symbol.toStringTag,{value:"Module"})),kc=Object.keys(th);class qd extends Zt{constructor(t,r,n,i){let s=-1;if(super(t,r),Jp(this,"space",i),typeof n=="number")for(;++s<kc.length;){const o=kc[s];Jp(this,kc[s],(n&th[o])===th[o])}}}qd.prototype.defined=!0;function Jp(e,t,r){r&&(e[t]=r)}function us(e){const t={},r={};for(const[n,i]of Object.entries(e.properties)){const s=new qd(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),t[n]=s,r[Ju(n)]=n,r[Ju(s.attribute)]=n}return new Io(t,r,e.space)}const R0=us({properties:{ariaActiveDescendant:null,ariaAtomic:nt,ariaAutoComplete:null,ariaBusy:nt,ariaChecked:nt,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,ariaControls:Be,ariaCurrent:null,ariaDescribedBy:Be,ariaDetails:null,ariaDisabled:nt,ariaDropEffect:Be,ariaErrorMessage:null,ariaExpanded:nt,ariaFlowTo:Be,ariaGrabbed:nt,ariaHasPopup:null,ariaHidden:nt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Be,ariaLevel:ie,ariaLive:null,ariaModal:nt,ariaMultiLine:nt,ariaMultiSelectable:nt,ariaOrientation:null,ariaOwns:Be,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:nt,ariaReadOnly:nt,ariaRelevant:null,ariaRequired:nt,ariaRoleDescription:Be,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:nt,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function M0(e,t){return t in e?e[t]:t}function I0(e,t){return M0(e,t.toLowerCase())}const vb=us({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Xi,acceptCharset:Be,accessKey:Be,action:null,allow:null,allowFullScreen:ke,allowPaymentRequest:ke,allowUserMedia:ke,alt:null,as:null,async:ke,autoCapitalize:null,autoComplete:Be,autoFocus:ke,autoPlay:ke,blocking:Be,capture:null,charSet:null,checked:ke,cite:null,className:Be,cols:ie,colSpan:null,content:null,contentEditable:nt,controls:ke,controlsList:Be,coords:ie|Xi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ke,defer:ke,dir:null,dirName:null,disabled:ke,download:eh,draggable:nt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ke,formTarget:null,headers:Be,height:ie,hidden:eh,high:ie,href:null,hrefLang:null,htmlFor:Be,httpEquiv:Be,id:null,imageSizes:null,imageSrcSet:null,inert:ke,inputMode:null,integrity:null,is:null,isMap:ke,itemId:null,itemProp:Be,itemRef:Be,itemScope:ke,itemType:Be,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ke,low:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:ke,muted:ke,name:null,nonce:null,noModule:ke,noValidate:ke,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:ke,optimum:ie,pattern:null,ping:Be,placeholder:null,playsInline:ke,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ke,referrerPolicy:null,rel:Be,required:ke,reversed:ke,rows:ie,rowSpan:ie,sandbox:Be,scope:null,scoped:ke,seamless:ke,selected:ke,shadowRootClonable:ke,shadowRootDelegatesFocus:ke,shadowRootMode:null,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:nt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:ke,useMap:null,value:nt,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Be,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ke,declare:ke,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:ke,noHref:ke,noShade:ke,noWrap:ke,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:nt,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ke,disableRemotePlayback:ke,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:I0}),yb=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:tr,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,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:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:ke,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,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:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:tr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,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:ie,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:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Be,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tr,rev:tr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tr,requiredFeatures:tr,requiredFonts:tr,requiredFormats:tr,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:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:tr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tr,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:M0}),A0=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()}}),B0=us({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:I0}),O0=us({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),xb={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"},Sb=/[A-Z]/g,em=/-[a-z]/g,wb=/^data[-\w.:]+$/i;function bb(e,t){const r=Ju(t);let n=t,i=Zt;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&wb.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(em,Cb);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!em.test(s)){let o=s.replace(Sb,kb);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=qd}return new i(n,t)}function kb(e){return"-"+e.toLowerCase()}function Cb(e){return e.charAt(1).toUpperCase()}const Eb=D0([R0,vb,A0,B0,O0],"html"),Yd=D0([R0,yb,A0,B0,O0],"svg");function Nb(e){return e.join(" ").trim()}var Xd={},tm=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Tb=/\n/g,Pb=/^\s*/,Lb=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Db=/^:\s*/,Rb=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Mb=/^[;\s]*/,Ib=/^\s+|\s+$/g,Ab=`
68
+ `,rm="/",nm="*",ti="",Bb="comment",Ob="declaration";function jb(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function i(m){var g=m.match(Tb);g&&(r+=g.length);var x=m.lastIndexOf(Ab);n=~x?m.length-x:n+m.length}function s(){var m={line:r,column:n};return function(g){return g.position=new o(m),c(),g}}function o(m){this.start=m,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(m){var g=new Error(t.source+":"+r+":"+n+": "+m);if(g.reason=m,g.filename=t.source,g.line=r,g.column=n,g.source=e,!t.silent)throw g}function a(m){var g=m.exec(e);if(g){var x=g[0];return i(x),e=e.slice(x.length),g}}function c(){a(Pb)}function h(m){var g;for(m=m||[];g=u();)g!==!1&&m.push(g);return m}function u(){var m=s();if(!(rm!=e.charAt(0)||nm!=e.charAt(1))){for(var g=2;ti!=e.charAt(g)&&(nm!=e.charAt(g)||rm!=e.charAt(g+1));)++g;if(g+=2,ti===e.charAt(g-1))return l("End of comment missing");var x=e.slice(2,g-2);return n+=2,i(x),e=e.slice(g),n+=2,m({type:Bb,comment:x})}}function d(){var m=s(),g=a(Lb);if(g){if(u(),!a(Db))return l("property missing ':'");var x=a(Rb),_=m({type:Ob,property:im(g[0].replace(tm,ti)),value:x?im(x[0].replace(tm,ti)):ti});return a(Mb),_}}function f(){var m=[];h(m);for(var g;g=d();)g!==!1&&(m.push(g),h(m));return m}return c(),f()}function im(e){return e?e.replace(Ib,ti):ti}var zb=jb,Fb=zl&&zl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Xd,"__esModule",{value:!0});Xd.default=Hb;const $b=Fb(zb);function Hb(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,$b.default)(e),i=typeof t=="function";return n.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(r=r||{},r[o]=l)}),r}var ja={};Object.defineProperty(ja,"__esModule",{value:!0});ja.camelCase=void 0;var Wb=/^--[a-zA-Z0-9_-]+$/,Ub=/-([a-z])/g,Kb=/^[^-]+$/,Vb=/^-(webkit|moz|ms|o|khtml)-/,qb=/^-(ms)-/,Yb=function(e){return!e||Kb.test(e)||Wb.test(e)},Xb=function(e,t){return t.toUpperCase()},sm=function(e,t){return"".concat(t,"-")},Gb=function(e,t){return t===void 0&&(t={}),Yb(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(qb,sm):e=e.replace(Vb,sm),e.replace(Ub,Xb))};ja.camelCase=Gb;var Qb=zl&&zl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Zb=Qb(Xd),Jb=ja;function rh(e,t){var r={};return!e||typeof e!="string"||(0,Zb.default)(e,function(n,i){n&&i&&(r[(0,Jb.camelCase)(n,t)]=i)}),r}rh.default=rh;var ek=rh;const tk=Gh(ek),j0=z0("end"),Gd=z0("start");function z0(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function rk(e){const t=Gd(e),r=j0(e);if(t&&r)return{start:t,end:r}}function Qs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?om(e.position):"start"in e||"end"in e?om(e):"line"in e||"column"in e?nh(e):""}function nh(e){return lm(e&&e.line)+":"+lm(e&&e.column)}function om(e){return nh(e&&e.start)+"-"+nh(e&&e.end)}function lm(e){return e&&typeof e=="number"?e:1}class It extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",s={},o=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof n=="string"){const a=n.indexOf(":");a===-1?s.ruleId=n:(s.source=n.slice(0,a),s.ruleId=n.slice(a+1))}if(!s.place&&s.ancestors&&s.ancestors){const a=s.ancestors[s.ancestors.length-1];a&&(s.place=a.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=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}}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 Qd={}.hasOwnProperty,nk=new Map,ik=/[A-Z]/g,sk=new Set(["table","tbody","thead","tfoot","tr"]),ok=new Set(["td","th"]),F0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function lk(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=mk(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=pk(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Yd:Eb,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=$0(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function $0(e,t,r){if(t.type==="element")return ak(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ck(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return hk(e,t,r);if(t.type==="mdxjsEsm")return uk(e,t);if(t.type==="root")return dk(e,t,r);if(t.type==="text")return fk(e,t)}function ak(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Yd,e.schema=i),e.ancestors.push(t);const s=W0(e,t.tagName,!1),o=gk(e,t);let l=Jd(e,t);return sk.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!gb(a):!0})),H0(e,o,s,t),Zd(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function ck(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}So(e,t.position)}function uk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);So(e,t.position)}function hk(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=Yd,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:W0(e,t.name,!0),o=_k(e,t),l=Jd(e,t);return H0(e,o,s,t),Zd(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function dk(e,t,r){const n={};return Zd(n,Jd(e,t)),e.create(t,e.Fragment,n,r)}function fk(e,t){return t.value}function H0(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function Zd(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function pk(e,t,r){return n;function n(i,s,o,l){const c=Array.isArray(o.children)?r:t;return l?c(s,o,l):c(s,o)}}function mk(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),a=Gd(n);return t(i,s,o,l,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function gk(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&Qd.call(t.properties,i)){const s=vk(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&ok.has(t.tagName)?n=l:r[o]=l}}if(n){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function _k(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else So(e,t.position);else{const i=n.name;let s;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const l=n.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else So(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function Jd(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:nk;for(;++n<t.children.length;){const s=t.children[n];let o;if(e.passKeys){const a=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(a){const c=i.get(a)||0;o=a+"-"+c,i.set(a,c+1)}}const l=$0(e,s,o);l!==void 0&&r.push(l)}return r}function vk(e,t,r){const n=bb(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?hb(r):Nb(r)),n.property==="style"){let i=typeof r=="object"?r:yk(e,String(r));return e.stylePropertyNameCase==="css"&&(i=xk(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?xb[n.property]||n.property:n.attribute,r]}}function yk(e,t){try{return tk(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,i=new It("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=F0+"#cannot-parse-style-attribute",i}}function W0(e,t,r){let n;if(!r)n={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=Qp(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}n=o}else n=Qp(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return Qd.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);So(e)}function So(e,t){const r=new It("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=F0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function xk(e){const t={};let r;for(r in e)Qd.call(e,r)&&(t[Sk(r)]=e[r]);return t}function Sk(e){let t=e.replace(ik,wk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function wk(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"]},bk={};function ef(e,t){const r=bk,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return U0(e,n,i)}function U0(e,t,r){if(kk(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return am(e.children,t,r)}return Array.isArray(e)?am(e,t,r):""}function am(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=U0(e[i],t,r);return n.join("")}function kk(e){return!!(e&&typeof e=="object")}const cm=document.createElement("i");function tf(e){const t="&"+e+";";cm.innerHTML=t;const r=cm.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function or(e,t,r,n){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function vr(e,t){return e.length>0?(or(e,e.length,0,t),e):t}const um={}.hasOwnProperty;function K0(e){const t={};let r=-1;for(;++r<e.length;)Ck(t,e[r]);return t}function Ck(e,t){let r;for(r in t){const i=(um.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){um.call(i,o)||(i[o]=[]);const l=s[o];Ek(i[o],Array.isArray(l)?l:l?[l]:[])}}}function Ek(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);or(e,0,0,n)}function V0(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Ir(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const jt=Kn(/[A-Za-z]/),Rt=Kn(/[\dA-Za-z]/),Nk=Kn(/[#-'*+\--9=?A-Z^-~]/);function ua(e){return e!==null&&(e<32||e===127)}const ih=Kn(/\d/),Tk=Kn(/[\dA-Fa-f]/),Pk=Kn(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function Ae(e){return e!==null&&(e<0||e===32)}function Ne(e){return e===-2||e===-1||e===32}const za=Kn(new RegExp("\\p{P}|\\p{S}","u")),mi=Kn(/\s/);function Kn(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function hs(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&Rt(e.charCodeAt(r+1))&&Rt(e.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(r+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+i+1,o=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function Pe(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return Ne(a)?(e.enter(r),l(a)):t(a)}function l(a){return Ne(a)&&s++<i?(e.consume(a),l):(e.exit(r),t(a))}}const Lk={tokenize:Dk};function Dk(e){const t=e.attempt(this.parser.constructs.contentInitial,n,i);let r;return t;function n(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Pe(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const a=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=a),r=a,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return _e(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const Rk={tokenize:Mk},hm={tokenize:Ik};function Mk(e){const t=this,r=[];let n=0,i,s,o;return l;function l(y){if(n<r.length){const E=r[n];return t.containerState=E[1],e.attempt(E[0].continuation,a,c)(y)}return c(y)}function a(y){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const E=t.events.length;let P=E,C;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){C=t.events[P][1].end;break}_(n);let M=E;for(;M<t.events.length;)t.events[M][1].end={...C},M++;return or(t.events,P+1,0,t.events.slice(E)),t.events.length=M,c(y)}return l(y)}function c(y){if(n===r.length){if(!i)return d(y);if(i.currentConstruct&&i.currentConstruct.concrete)return m(y);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(hm,h,u)(y)}function h(y){return i&&v(),_(n),d(y)}function u(y){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,m(y)}function d(y){return t.containerState={},e.attempt(hm,f,m)(y)}function f(y){return n++,r.push([t.currentConstruct,t.containerState]),d(y)}function m(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}),g(y)}function g(y){if(y===null){x(e.exit("chunkFlow"),!0),_(0),e.consume(y);return}return _e(y)?(e.consume(y),x(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(y),g)}function x(y,E){const P=t.sliceStream(y);if(E&&P.push(null),y.previous=s,s&&(s.next=y),s=y,i.defineSkip(y.start),i.write(P),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 z=M,J,N;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(J){N=t.events[z][1].end;break}J=!0}for(_(n),C=M;C<t.events.length;)t.events[C][1].end={...N},C++;or(t.events,z+1,0,t.events.slice(M)),t.events.length=C}}function _(y){let E=r.length;for(;E-- >y;){const P=r[E];t.containerState=P[1],P[0].exit.call(t,e)}r.length=y}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ik(e,t,r){return Pe(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ns(e){if(e===null||Ae(e)||mi(e))return 1;if(za(e))return 2}function Fa(e,t,r){const n=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!n.includes(s)&&(t=s(t,r),n.push(s))}return t}const sh={name:"attention",resolveAll:Ak,tokenize:Bk};function Ak(e,t){let r=-1,n,i,s,o,l,a,c,h;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const u={...e[n][1].end},d={...e[r][1].start};dm(u,-a),dm(d,a),o={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:d},s={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:a>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[n][1].end={...o.start},e[r][1].start={...l.end},c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=vr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=vr(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=vr(c,Fa(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=vr(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(h=2,c=vr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,or(e,n-1,r-n+3,c),r=n+c.length-h-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function Bk(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=ns(n);let s;return o;function o(a){return s=a,e.enter("attentionSequence"),l(a)}function l(a){if(a===s)return e.consume(a),l;const c=e.exit("attentionSequence"),h=ns(a),u=!h||h===2&&i||r.includes(a),d=!i||i===2&&h||r.includes(n);return c._open=!!(s===42?u:u&&(i||!d)),c._close=!!(s===42?d:d&&(h||!u)),t(a)}}function dm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Ok={name:"autolink",tokenize:jk};function jk(e,t,r){let n=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 jt(f)?(e.consume(f),o):f===64?r(f):c(f)}function o(f){return f===43||f===45||f===46||Rt(f)?(n=1,l(f)):c(f)}function l(f){return f===58?(e.consume(f),n=0,a):(f===43||f===45||f===46||Rt(f))&&n++<32?(e.consume(f),l):(n=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||ua(f)?r(f):(e.consume(f),a)}function c(f){return f===64?(e.consume(f),h):Nk(f)?(e.consume(f),c):r(f)}function h(f){return Rt(f)?u(f):r(f)}function u(f){return f===46?(e.consume(f),n=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||Rt(f))&&n++<63){const m=f===45?d:u;return e.consume(f),m}return r(f)}}const Ao={partial:!0,tokenize:zk};function zk(e,t,r){return n;function n(s){return Ne(s)?Pe(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||_e(s)?t(s):r(s)}}const q0={continuation:{tokenize:$k},exit:Hk,name:"blockQuote",tokenize:Fk};function Fk(e,t,r){const n=this;return i;function i(o){if(o===62){const l=n.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return r(o)}function s(o){return Ne(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function $k(e,t,r){const n=this;return i;function i(o){return Ne(o)?Pe(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(q0,t,r)(o)}}function Hk(e){e.exit("blockQuote")}const Y0={name:"characterEscape",tokenize:Wk};function Wk(e,t,r){return n;function n(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return Pk(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const X0={name:"characterReference",tokenize:Uk};function Uk(e,t,r){const n=this;let i=0,s,o;return l;function l(u){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),a}function a(u){return u===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(u),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=Rt,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=Tk,h):(e.enter("characterReferenceValue"),s=7,o=ih,h(u))}function h(u){if(u===59&&i){const d=e.exit("characterReferenceValue");return o===Rt&&!tf(n.sliceSerialize(d))?r(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(u)&&i++<s?(e.consume(u),h):r(u)}}const fm={partial:!0,tokenize:Vk},pm={concrete:!0,name:"codeFenced",tokenize:Kk};function Kk(e,t,r){const n=this,i={partial:!0,tokenize:P};let s=0,o=0,l;return a;function a(C){return c(C)}function c(C){const M=n.events[n.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?r(C):(e.exit("codeFencedFenceSequence"),Ne(C)?Pe(e,u,"whitespace")(C):u(C))}function u(C){return C===null||_e(C)?(e.exit("codeFencedFence"),n.interrupt?t(C):e.check(fm,g,E)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(C))}function d(C){return C===null||_e(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(C)):Ne(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Pe(e,f,"whitespace")(C)):C===96&&C===l?r(C):(e.consume(C),d)}function f(C){return C===null||_e(C)?u(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||_e(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(C)):C===96&&C===l?r(C):(e.consume(C),m)}function g(C){return e.attempt(i,E,x)(C)}function x(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),_}function _(C){return s>0&&Ne(C)?Pe(e,v,"linePrefix",s+1)(C):v(C)}function v(C){return C===null||_e(C)?e.check(fm,g,E)(C):(e.enter("codeFlowValue"),y(C))}function y(C){return C===null||_e(C)?(e.exit("codeFlowValue"),v(C)):(e.consume(C),y)}function E(C){return e.exit("codeFenced"),t(C)}function P(C,M,z){let J=0;return N;function N(A){return C.enter("lineEnding"),C.consume(A),C.exit("lineEnding"),D}function D(A){return C.enter("codeFencedFence"),Ne(A)?Pe(C,I,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):I(A)}function I(A){return A===l?(C.enter("codeFencedFenceSequence"),R(A)):z(A)}function R(A){return A===l?(J++,C.consume(A),R):J>=o?(C.exit("codeFencedFenceSequence"),Ne(A)?Pe(C,W,"whitespace")(A):W(A)):z(A)}function W(A){return A===null||_e(A)?(C.exit("codeFencedFence"),M(A)):z(A)}}}function Vk(e,t,r){const n=this;return i;function i(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}const Ec={name:"codeIndented",tokenize:Yk},qk={partial:!0,tokenize:Xk};function Yk(e,t,r){const n=this;return i;function i(c){return e.enter("codeIndented"),Pe(e,s,"linePrefix",5)(c)}function s(c){const h=n.events[n.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?a(c):_e(c)?e.attempt(qk,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||_e(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function Xk(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):_e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Pe(e,s,"linePrefix",5)(o)}function s(o){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):_e(o)?i(o):r(o)}}const Gk={name:"codeText",previous:Zk,resolve:Qk,tokenize:Jk};function Qk(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)i===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(i=n):(n===t||e[n][1].type==="lineEnding")&&(e[i][1].type="codeTextData",n!==i+2&&(e[i][1].end=e[n-1][1].end,e.splice(i+2,n-i-2),t-=n-i-2,n=i+2),i=void 0);return e}function Zk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Jk(e,t,r){let n=0,i,s;return o;function o(u){return e.enter("codeText"),e.enter("codeTextSequence"),l(u)}function l(u){return u===96?(e.consume(u),n++,l):(e.exit("codeTextSequence"),a(u))}function a(u){return u===null?r(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),a):u===96?(s=e.enter("codeTextSequence"),i=0,h(u)):_e(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||_e(u)?(e.exit("codeTextData"),a(u)):(e.consume(u),c)}function h(u){return u===96?(e.consume(u),i++,h):i===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(s.type="codeTextData",c(u))}}class eC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&bs(this.left,n),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),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 r=this.left.splice(t,Number.POSITIVE_INFINITY);bs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);bs(this.left,r.reverse())}}}function bs(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function G0(e){const t={};let r=-1,n,i,s,o,l,a,c;const h=new eC(e);for(;++r<h.length;){for(;r in t;)r=t[r];if(n=h.get(r),r&&n[1].type==="chunkFlow"&&h.get(r-1)[1].type==="listItemPrefix"&&(a=n[1]._tokenizer.events,s=0,s<a.length&&a[s][1].type==="lineEndingBlank"&&(s+=2),s<a.length&&a[s][1].type==="content"))for(;++s<a.length&&a[s][1].type!=="content";)a[s][1].type==="chunkText"&&(a[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,tC(h,r)),r=t[r],c=!0);else if(n[1]._container){for(s=r,i=void 0;s--;)if(o=h.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(n[1].end={...h.get(i)[1].start},l=h.slice(i,r),l.unshift(n),h.splice(i,r-i+1,l))}}return or(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function tC(e,t){const r=e.get(t)[1],n=e.get(t)[2];let i=t-1;const s=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,a=[],c={};let h,u,d=-1,f=r,m=0,g=0;const x=[g];for(;f;){for(;e.get(++i)[1]!==f;);s.push(i),f._tokenizer||(h=n.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=r;++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&&(g=d+1,x.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):x.pop(),d=x.length;d--;){const _=l.slice(x[d],x[d+1]),v=s.pop();a.push([v,v+_.length-1]),e.splice(v,2,_)}for(a.reverse(),d=-1;++d<a.length;)c[m+a[d][0]]=m+a[d][1],m+=a[d][1]-a[d][0]-1;return c}const rC={resolve:iC,tokenize:sC},nC={partial:!0,tokenize:oC};function iC(e){return G0(e),e}function sC(e,t){let r;return n;function n(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):_e(l)?e.check(nC,o,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function oC(e,t,r){const n=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||_e(o))return r(o);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(n.parser.constructs.flow,r,t)(o)}}function Q0(e,t,r,n,i,s,o,l,a){const c=a||Number.POSITIVE_INFINITY;let h=0;return u;function u(_){return _===60?(e.enter(n),e.enter(i),e.enter(s),e.consume(_),e.exit(s),d):_===null||_===32||_===41||ua(_)?r(_):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(_))}function d(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(_))}function f(_){return _===62?(e.exit("chunkString"),e.exit(l),d(_)):_===null||_===60||_e(_)?r(_):(e.consume(_),_===92?m:f)}function m(_){return _===60||_===62||_===92?(e.consume(_),f):f(_)}function g(_){return!h&&(_===null||_===41||Ae(_))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(_)):h<c&&_===40?(e.consume(_),h++,g):_===41?(e.consume(_),h--,g):_===null||_===32||_===40||ua(_)?r(_):(e.consume(_),_===92?x:g)}function x(_){return _===40||_===41||_===92?(e.consume(_),g):g(_)}}function Z0(e,t,r,n,i,s){const o=this;let l=0,a;return c;function c(f){return e.enter(n),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?r(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(n),t):_e(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||_e(f)||l++>999?(e.exit("chunkString"),h(f)):(e.consume(f),a||(a=!Ne(f)),f===92?d:u)}function d(f){return f===91||f===92||f===93?(e.consume(f),l++,u):u(f)}}function J0(e,t,r,n,i,s){let o;return l;function l(d){return d===34||d===39||d===40?(e.enter(n),e.enter(i),e.consume(d),e.exit(i),o=d===40?41:d,a):r(d)}function a(d){return d===o?(e.enter(i),e.consume(d),e.exit(i),e.exit(n),t):(e.enter(s),c(d))}function c(d){return d===o?(e.exit(s),a(o)):d===null?r(d):_e(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||_e(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 r;return n;function n(i){return _e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Ne(i)?Pe(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const lC={name:"definition",tokenize:cC},aC={partial:!0,tokenize:uC};function cC(e,t,r){const n=this;let i;return s;function s(f){return e.enter("definition"),o(f)}function o(f){return Z0.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return i=Ir(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),a):r(f)}function a(f){return Ae(f)?Zs(e,c)(f):c(f)}function c(f){return Q0(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function h(f){return e.attempt(aC,u,u)(f)}function u(f){return Ne(f)?Pe(e,d,"whitespace")(f):d(f)}function d(f){return f===null||_e(f)?(e.exit("definition"),n.parser.defined.push(i),t(f)):r(f)}}function uC(e,t,r){return n;function n(l){return Ae(l)?Zs(e,i)(l):r(l)}function i(l){return J0(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Ne(l)?Pe(e,o,"whitespace")(l):o(l)}function o(l){return l===null||_e(l)?t(l):r(l)}}const hC={name:"hardBreakEscape",tokenize:dC};function dC(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return _e(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const fC={name:"headingAtx",resolve:pC,tokenize:mC};function pC(e,t){let r=e.length-2,n=3,i,s;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},s={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},or(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function mC(e,t,r){let n=0;return i;function i(h){return e.enter("atxHeading"),s(h)}function s(h){return e.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&n++<6?(e.consume(h),o):h===null||Ae(h)?(e.exit("atxHeadingSequence"),l(h)):r(h)}function l(h){return h===35?(e.enter("atxHeadingSequence"),a(h)):h===null||_e(h)?(e.exit("atxHeading"),t(h)):Ne(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||Ae(h)?(e.exit("atxHeadingText"),l(h)):(e.consume(h),c)}}const gC=["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"],mm=["pre","script","style","textarea"],_C={concrete:!0,name:"htmlFlow",resolveTo:xC,tokenize:SC},vC={partial:!0,tokenize:bC},yC={partial:!0,tokenize:wC};function xC(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 SC(e,t,r){const n=this;let i,s,o,l,a;return c;function c(k){return h(k)}function h(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),u}function u(k){return k===33?(e.consume(k),d):k===47?(e.consume(k),s=!0,g):k===63?(e.consume(k),i=3,n.interrupt?t:S):jt(k)?(e.consume(k),o=String.fromCharCode(k),x):r(k)}function d(k){return k===45?(e.consume(k),i=2,f):k===91?(e.consume(k),i=5,l=0,m):jt(k)?(e.consume(k),i=4,n.interrupt?t:S):r(k)}function f(k){return k===45?(e.consume(k),n.interrupt?t:S):r(k)}function m(k){const ge="CDATA[";return k===ge.charCodeAt(l++)?(e.consume(k),l===ge.length?n.interrupt?t:I:m):r(k)}function g(k){return jt(k)?(e.consume(k),o=String.fromCharCode(k),x):r(k)}function x(k){if(k===null||k===47||k===62||Ae(k)){const ge=k===47,X=o.toLowerCase();return!ge&&!s&&mm.includes(X)?(i=1,n.interrupt?t(k):I(k)):gC.includes(o.toLowerCase())?(i=6,ge?(e.consume(k),_):n.interrupt?t(k):I(k)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(k):s?v(k):y(k))}return k===45||Rt(k)?(e.consume(k),o+=String.fromCharCode(k),x):r(k)}function _(k){return k===62?(e.consume(k),n.interrupt?t:I):r(k)}function v(k){return Ne(k)?(e.consume(k),v):N(k)}function y(k){return k===47?(e.consume(k),N):k===58||k===95||jt(k)?(e.consume(k),E):Ne(k)?(e.consume(k),y):N(k)}function E(k){return k===45||k===46||k===58||k===95||Rt(k)?(e.consume(k),E):P(k)}function P(k){return k===61?(e.consume(k),C):Ne(k)?(e.consume(k),P):y(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(e.consume(k),a=k,M):Ne(k)?(e.consume(k),C):z(k)}function M(k){return k===a?(e.consume(k),a=null,J):k===null||_e(k)?r(k):(e.consume(k),M)}function z(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Ae(k)?P(k):(e.consume(k),z)}function J(k){return k===47||k===62||Ne(k)?y(k):r(k)}function N(k){return k===62?(e.consume(k),D):r(k)}function D(k){return k===null||_e(k)?I(k):Ne(k)?(e.consume(k),D):r(k)}function I(k){return k===45&&i===2?(e.consume(k),F):k===60&&i===1?(e.consume(k),H):k===62&&i===4?(e.consume(k),ne):k===63&&i===3?(e.consume(k),S):k===93&&i===5?(e.consume(k),$):_e(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(vC,ce,R)(k)):k===null||_e(k)?(e.exit("htmlFlowData"),R(k)):(e.consume(k),I)}function R(k){return e.check(yC,W,ce)(k)}function W(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),A}function A(k){return k===null||_e(k)?R(k):(e.enter("htmlFlowData"),I(k))}function F(k){return k===45?(e.consume(k),S):I(k)}function H(k){return k===47?(e.consume(k),o="",L):I(k)}function L(k){if(k===62){const ge=o.toLowerCase();return mm.includes(ge)?(e.consume(k),ne):I(k)}return jt(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),L):I(k)}function $(k){return k===93?(e.consume(k),S):I(k)}function S(k){return k===62?(e.consume(k),ne):k===45&&i===2?(e.consume(k),S):I(k)}function ne(k){return k===null||_e(k)?(e.exit("htmlFlowData"),ce(k)):(e.consume(k),ne)}function ce(k){return e.exit("htmlFlow"),t(k)}}function wC(e,t,r){const n=this;return i;function i(o){return _e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):r(o)}function s(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}function bC(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ao,t,r)}}const kC={name:"htmlText",tokenize:CC};function CC(e,t,r){const n=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),P):S===63?(e.consume(S),y):jt(S)?(e.consume(S),z):r(S)}function c(S){return S===45?(e.consume(S),h):S===91?(e.consume(S),s=0,m):jt(S)?(e.consume(S),v):r(S)}function h(S){return S===45?(e.consume(S),f):r(S)}function u(S){return S===null?r(S):S===45?(e.consume(S),d):_e(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?F(S):S===45?d(S):u(S)}function m(S){const ne="CDATA[";return S===ne.charCodeAt(s++)?(e.consume(S),s===ne.length?g:m):r(S)}function g(S){return S===null?r(S):S===93?(e.consume(S),x):_e(S)?(o=g,H(S)):(e.consume(S),g)}function x(S){return S===93?(e.consume(S),_):g(S)}function _(S){return S===62?F(S):S===93?(e.consume(S),_):g(S)}function v(S){return S===null||S===62?F(S):_e(S)?(o=v,H(S)):(e.consume(S),v)}function y(S){return S===null?r(S):S===63?(e.consume(S),E):_e(S)?(o=y,H(S)):(e.consume(S),y)}function E(S){return S===62?F(S):y(S)}function P(S){return jt(S)?(e.consume(S),C):r(S)}function C(S){return S===45||Rt(S)?(e.consume(S),C):M(S)}function M(S){return _e(S)?(o=M,H(S)):Ne(S)?(e.consume(S),M):F(S)}function z(S){return S===45||Rt(S)?(e.consume(S),z):S===47||S===62||Ae(S)?J(S):r(S)}function J(S){return S===47?(e.consume(S),F):S===58||S===95||jt(S)?(e.consume(S),N):_e(S)?(o=J,H(S)):Ne(S)?(e.consume(S),J):F(S)}function N(S){return S===45||S===46||S===58||S===95||Rt(S)?(e.consume(S),N):D(S)}function D(S){return S===61?(e.consume(S),I):_e(S)?(o=D,H(S)):Ne(S)?(e.consume(S),D):J(S)}function I(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(e.consume(S),i=S,R):_e(S)?(o=I,H(S)):Ne(S)?(e.consume(S),I):(e.consume(S),W)}function R(S){return S===i?(e.consume(S),i=void 0,A):S===null?r(S):_e(S)?(o=R,H(S)):(e.consume(S),R)}function W(S){return S===null||S===34||S===39||S===60||S===61||S===96?r(S):S===47||S===62||Ae(S)?J(S):(e.consume(S),W)}function A(S){return S===47||S===62||Ae(S)?J(S):r(S)}function F(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):r(S)}function H(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),L}function L(S){return Ne(S)?Pe(e,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):$(S)}function $(S){return e.enter("htmlTextData"),o(S)}}const rf={name:"labelEnd",resolveAll:PC,resolveTo:LC,tokenize:DC},EC={tokenize:RC},NC={tokenize:MC},TC={tokenize:IC};function PC(e){let t=-1;const r=[];for(;++t<e.length;){const n=e[t][1];if(r.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const i=n.type==="labelImage"?4:2;n.type="data",t+=i}}return e.length!==r.length&&or(e,0,e.length,r),e}function LC(e,t){let r=e.length,n=0,i,s,o,l;for(;r--;)if(i=e[r][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(o=r);const a={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},h={type:"labelText",start:{...e[s+n+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",a,t],["enter",c,t]],l=vr(l,e.slice(s+1,s+n+3)),l=vr(l,[["enter",h,t]]),l=vr(l,Fa(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=vr(l,[["exit",h,t],e[o-2],e[o-1],["exit",c,t]]),l=vr(l,e.slice(o+1)),l=vr(l,[["exit",a,t]]),or(e,s,e.length,l),e}function DC(e,t,r){const n=this;let i=n.events.length,s,o;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){s=n.events[i][1];break}return l;function l(d){return s?s._inactive?u(d):(o=n.parser.defined.includes(Ir(n.sliceSerialize({start:s.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelEnd"),a):r(d)}function a(d){return d===40?e.attempt(EC,h,o?h:u)(d):d===91?e.attempt(NC,h,o?c:u)(d):o?h(d):u(d)}function c(d){return e.attempt(TC,h,u)(d)}function h(d){return t(d)}function u(d){return s._balanced=!0,r(d)}}function RC(e,t,r){return n;function n(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),i}function i(u){return Ae(u)?Zs(e,s)(u):s(u)}function s(u){return u===41?h(u):Q0(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function o(u){return Ae(u)?Zs(e,a)(u):h(u)}function l(u){return r(u)}function a(u){return u===34||u===39||u===40?J0(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):h(u)}function c(u){return Ae(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):r(u)}}function MC(e,t,r){const n=this;return i;function i(l){return Z0.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes(Ir(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function IC(e,t,r){return n;function n(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):r(s)}}const AC={name:"labelStartImage",resolveAll:rf.resolveAll,tokenize:BC};function BC(e,t,r){const n=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):t(l)}}const OC={name:"labelStartLink",resolveAll:rf.resolveAll,tokenize:jC};function jC(e,t,r){const n=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):t(o)}}const Nc={name:"lineEnding",tokenize:zC};function zC(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Pe(e,t,"linePrefix")}}const Pl={name:"thematicBreak",tokenize:FC};function FC(e,t,r){let n=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,l(c)}function l(c){return c===i?(e.enter("thematicBreakSequence"),a(c)):n>=3&&(c===null||_e(c))?(e.exit("thematicBreak"),t(c)):r(c)}function a(c){return c===i?(e.consume(c),n++,a):(e.exit("thematicBreakSequence"),Ne(c)?Pe(e,l,"whitespace")(c):l(c))}}const Vt={continuation:{tokenize:UC},exit:VC,name:"list",tokenize:WC},$C={partial:!0,tokenize:qC},HC={partial:!0,tokenize:KC};function WC(e,t,r){const n=this,i=n.events[n.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(f){const m=n.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||f===n.containerState.marker:ih(f)){if(n.containerState.type||(n.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Pl,r,c)(f):c(f);if(!n.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(f)}return r(f)}function a(f){return ih(f)&&++o<10?(e.consume(f),a):(!n.interrupt||o<2)&&(n.containerState.marker?f===n.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):r(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||f,e.check(Ao,n.interrupt?r:h,e.attempt($C,d,u))}function h(f){return n.containerState.initialBlankLine=!0,s++,d(f)}function u(f){return Ne(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),d):r(f)}function d(f){return n.containerState.size=s+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function UC(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(Ao,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Pe(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!Ne(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(HC,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Pe(e,e.attempt(Vt,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function KC(e,t,r){const n=this;return Pe(e,i,"listItemIndent",n.containerState.size+1);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(s):r(s)}}function VC(e){e.exit(this.containerState.type)}function qC(e,t,r){const n=this;return Pe(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=n.events[n.events.length-1];return!Ne(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const gm={name:"setextUnderline",resolveTo:YC,tokenize:XC};function YC(e,t){let r=e.length,n,i,s;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!s&&e[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[n][1],t]),e[n][1].end={...e[s][1].end}):e[n][1]=o,e.push(["exit",o,t]),e}function XC(e,t,r){const n=this;let i;return s;function s(c){let h=n.events.length,u;for(;h--;)if(n.events[h][1].type!=="lineEnding"&&n.events[h][1].type!=="linePrefix"&&n.events[h][1].type!=="content"){u=n.events[h][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||u)?(e.enter("setextHeadingLine"),i=c,o(c)):r(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),Ne(c)?Pe(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||_e(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const GC={tokenize:QC};function QC(e){const t=this,r=e.attempt(Ao,n,e.attempt(this.parser.constructs.flowInitial,i,Pe(e,e.attempt(this.parser.constructs.flow,i,e.attempt(rC,i)),"linePrefix")));return r;function n(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const ZC={resolveAll:ty()},JC=ey("string"),e2=ey("text");function ey(e){return{resolveAll:ty(e==="text"?t2:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],s=r.attempt(i,o,l);return o;function o(h){return c(h)?s(h):l(h)}function l(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),a}function a(h){return c(h)?(r.exit("data"),s(h)):(r.consume(h),a)}function c(h){if(h===null)return!0;const u=i[h];let d=-1;if(u)for(;++d<u.length;){const f=u[d];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}function ty(e){return t;function t(r,n){let i=-1,s;for(;++i<=r.length;)s===void 0?r[i]&&r[i][1].type==="data"&&(s=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==s+2&&(r[s][1].end=r[i-1][1].end,r.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(r,n):r}}function t2(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const n=e[r-1][1],i=t.sliceStream(n);let s=i.length,o=-1,l=0,a;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(c===-2)a=!0,l++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){const c={type:r===e.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:n.start._bufferIndex+o,_index:n.start._index+s,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(e.splice(r,0,["enter",c,t],["exit",c,t]),r+=2)}r++}return e}const r2={42:Vt,43:Vt,45:Vt,48:Vt,49:Vt,50:Vt,51:Vt,52:Vt,53:Vt,54:Vt,55:Vt,56:Vt,57:Vt,62:q0},n2={91:lC},i2={[-2]:Ec,[-1]:Ec,32:Ec},s2={35:fC,42:Pl,45:[gm,Pl],60:_C,61:gm,95:Pl,96:pm,126:pm},o2={38:X0,92:Y0},l2={[-5]:Nc,[-4]:Nc,[-3]:Nc,33:AC,38:X0,42:sh,60:[Ok,kC],91:OC,92:[hC,Y0],93:rf,95:sh,96:Gk},a2={null:[sh,ZC]},c2={null:[42,95]},u2={null:[]},h2=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:c2,contentInitial:n2,disable:u2,document:r2,flow:s2,flowInitial:i2,insideSpan:a2,string:o2,text:l2},Symbol.toStringTag,{value:"Module"}));function d2(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},s=[];let o=[],l=[];const a={attempt:M(P),check:M(C),consume:v,enter:y,exit:E,interrupt:M(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:m,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(D){return o=vr(o,D),x(),o[o.length-1]!==null?[]:(z(t,0),c.events=Fa(s,c.events,c),c.events)}function d(D,I){return p2(f(D),I)}function f(D){return f2(o,D)}function m(){const{_bufferIndex:D,_index:I,line:R,column:W,offset:A}=n;return{_bufferIndex:D,_index:I,line:R,column:W,offset:A}}function g(D){i[D.line]=D.column,N()}function x(){let D;for(;n._index<o.length;){const I=o[n._index];if(typeof I=="string")for(D=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===D&&n._bufferIndex<I.length;)_(I.charCodeAt(n._bufferIndex));else _(I)}}function _(D){h=h(D)}function v(D){_e(D)?(n.line++,n.column=1,n.offset+=D===-3?2:1,N()):D!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=D}function y(D,I){const R=I||{};return R.type=D,R.start=m(),c.events.push(["enter",R,c]),l.push(R),R}function E(D){const I=l.pop();return I.end=m(),c.events.push(["exit",I,c]),I}function P(D,I){z(D,I.from)}function C(D,I){I.restore()}function M(D,I){return R;function R(W,A,F){let H,L,$,S;return Array.isArray(W)?ce(W):"tokenize"in W?ce([W]):ne(W);function ne(Q){return K;function K(ue){const de=ue!==null&&Q[ue],pe=ue!==null&&Q.null,B=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(pe)?pe:pe?[pe]:[]];return ce(B)(ue)}}function ce(Q){return H=Q,L=0,Q.length===0?F:k(Q[L])}function k(Q){return K;function K(ue){return S=J(),$=Q,Q.partial||(c.currentConstruct=Q),Q.name&&c.parser.constructs.disable.null.includes(Q.name)?X():Q.tokenize.call(I?Object.assign(Object.create(c),I):c,a,ge,X)(ue)}}function ge(Q){return D($,S),A}function X(Q){return S.restore(),++L<H.length?k(H[L]):F}}}function z(D,I){D.resolveAll&&!s.includes(D)&&s.push(D),D.resolve&&or(c.events,I,c.events.length-I,D.resolve(c.events.slice(I),c)),D.resolveTo&&(c.events=D.resolveTo(c.events,c))}function J(){const D=m(),I=c.previous,R=c.currentConstruct,W=c.events.length,A=Array.from(l);return{from:W,restore:F};function F(){n=D,c.previous=I,c.currentConstruct=R,c.events.length=W,l=A,N()}}function N(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function f2(e,t){const r=t.start._index,n=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(r===i)o=[e[r].slice(n,s)];else{if(o=e.slice(r,i),n>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(n):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function p2(e,t){let r=-1;const n=[];let i;for(;++r<e.length;){const s=e[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
69
69
  `;break}case-3:{o=`\r
70
- `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function i2(e){const n={constructs:A0([e2,...(e||{}).extensions||[]]),content:i(yk),defined:[],document:i(Sk),flow:i(zC),lazy:{},string:i(HC),text:i(WC)};return n;function i(s){return o;function o(l){return t2(n,s,l)}}}function s2(e){for(;!F0(e););return e}const am=/[\0\t\n\r]/g;function o2(){let e=1,t="",r=!0,n;return i;function i(s,o,l){const a=[];let c,h,u,d,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),u=0,t="",r&&(s.charCodeAt(0)===65279&&u++,r=void 0);u<s.length;){if(am.lastIndex=u,c=am.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&&n)a.push(-3),n=void 0;else switch(n&&(a.push(-5),n=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:n=!0,e=1}u=d+1}return l&&(n&&a.push(-5),t&&a.push(t),a.push(null)),a}}const l2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function a2(e){return e.replace(l2,c2)}function c2(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return B0(r.slice(s?2:1),s?16:10)}return tf(r)||e}const V0={}.hasOwnProperty;function u2(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),h2(r)(s2(i2(r).document().write(o2()(e,t,!0))))}function h2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Or),autolinkProtocol:Z,autolinkEmail:Z,atxHeading:s(Ot),blockQuote:s(ge),characterEscape:Z,characterReference:Z,codeFenced:s(O),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(O,o),codeText:s(Ue,o),codeTextData:Z,data:Z,codeFlowValue:Z,definition:s(ve),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Ke),hardBreakEscape:s(qt),hardBreakTrailing:s(qt),htmlFlow:s(De,o),htmlFlowData:Z,htmlText:s(De,o),htmlTextData:Z,image:s(ke),label:o,link:s(Or),listItem:s(Pt),listItemValue:d,listOrdered:s(Zr,u),listUnordered:s(Zr),paragraph:s(Yt),reference:b,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Ot),strong:s(Qe),thematicBreak:s(pe)},exit:{atxHeading:a(),atxHeadingSequence:N,autolink:a(),autolinkEmail:ue,autolinkProtocol:he,blockQuote:a(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:V,characterReferenceMarkerNumeric:V,characterReferenceValue:H,characterReference:G,codeFenced:a(x),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:T,codeIndented:a(_),codeText:a(M),codeTextData:T,data:T,definition:a(),definitionDestinationString:E,definitionLabelString:v,definitionTitleString:y,emphasis:a(),hardBreakEscape:a(A),hardBreakTrailing:a(A),htmlFlow:a(D),htmlFlowData:T,htmlText:a(U),htmlTextData:T,image:a(W),label:$,labelText:L,lineEnding:R,link:a(F),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:me,resourceDestinationString:S,resourceTitleString:ne,resource:oe,setextHeading:a(z),setextHeadingLineSequence:I,setextHeadingText:k,strong:a(),thematicBreak:a()}};q0(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(P){let X={type:"root",children:[]};const B={stack:[X],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:h,data:r},j=[];let K=-1;for(;++K<P.length;)if(P[K][1].type==="listOrdered"||P[K][1].type==="listUnordered")if(P[K][0]==="enter")j.push(K);else{const Y=j.pop();K=i(P,Y,K)}for(K=-1;++K<P.length;){const Y=t[P[K][0]];V0.call(Y,P[K][1].type)&&Y[P[K][1].type].call(Object.assign({sliceSerialize:P[K][2].sliceSerialize},B),P[K][1])}if(B.tokenStack.length>0){const Y=B.tokenStack[B.tokenStack.length-1];(Y[1]||cm).call(B,void 0,Y[0])}for(X.position={start:_n(P.length>0?P[0][1].start:{line:1,column:1,offset:0}),end:_n(P.length>0?P[P.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(P,X,B){let j=X-1,K=-1,Y=!1,ee,se,le,fe;for(;++j<=B;){const ae=P[j];switch(ae[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ae[0]==="enter"?K++:K--,fe=void 0;break}case"lineEndingBlank":{ae[0]==="enter"&&(ee&&!fe&&!K&&!le&&(le=j),fe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:fe=void 0}if(!K&&ae[0]==="enter"&&ae[1].type==="listItemPrefix"||K===-1&&ae[0]==="exit"&&(ae[1].type==="listUnordered"||ae[1].type==="listOrdered")){if(ee){let xe=j;for(se=void 0;xe--;){const we=P[xe];if(we[1].type==="lineEnding"||we[1].type==="lineEndingBlank"){if(we[0]==="exit")continue;se&&(P[se][1].type="lineEndingBlank",Y=!0),we[1].type="lineEnding",se=xe}else if(!(we[1].type==="linePrefix"||we[1].type==="blockQuotePrefix"||we[1].type==="blockQuotePrefixWhitespace"||we[1].type==="blockQuoteMarker"||we[1].type==="listItemIndent"))break}le&&(!se||le<se)&&(ee._spread=!0),ee.end=Object.assign({},se?P[se][1].start:ae[1].end),P.splice(se||j,0,["exit",ee,ae[2]]),j++,B++}if(ae[1].type==="listItemPrefix"){const xe={type:"listItem",_spread:!1,start:Object.assign({},ae[1].start),end:void 0};ee=xe,P.splice(j,0,["enter",xe,ae[2]]),j++,B++,le=void 0,fe=!0}}}return P[X][1]._spread=Y,B}function s(P,X){return B;function B(j){l.call(this,P(j),j),X&&X.call(this,j)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(P,X,B){this.stack[this.stack.length-1].children.push(P),this.stack.push(P),this.tokenStack.push([X,B||void 0]),P.position={start:_n(X.start),end:void 0}}function a(P){return X;function X(B){P&&P.call(this,B),c.call(this,B)}}function c(P,X){const B=this.stack.pop(),j=this.tokenStack.pop();if(j)j[0].type!==P.type&&(X?X.call(this,P,j[0]):(j[1]||cm).call(this,P,j[0]));else throw new Error("Cannot close `"+P.type+"` ("+Qs({start:P.start,end:P.end})+"): it’s not open");B.position.end=_n(P.end)}function h(){return ef(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function d(P){if(this.data.expectingFirstListItemValue){const X=this.stack[this.stack.length-2];X.start=Number.parseInt(this.sliceSerialize(P),10),this.data.expectingFirstListItemValue=void 0}}function f(){const P=this.resume(),X=this.stack[this.stack.length-1];X.lang=P}function m(){const P=this.resume(),X=this.stack[this.stack.length-1];X.meta=P}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const P=this.resume(),X=this.stack[this.stack.length-1];X.value=P.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const P=this.resume(),X=this.stack[this.stack.length-1];X.value=P.replace(/(\r?\n|\r)$/g,"")}function v(P){const X=this.resume(),B=this.stack[this.stack.length-1];B.label=X,B.identifier=Ar(this.sliceSerialize(P)).toLowerCase()}function y(){const P=this.resume(),X=this.stack[this.stack.length-1];X.title=P}function E(){const P=this.resume(),X=this.stack[this.stack.length-1];X.url=P}function N(P){const X=this.stack[this.stack.length-1];if(!X.depth){const B=this.sliceSerialize(P).length;X.depth=B}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function I(P){const X=this.stack[this.stack.length-1];X.depth=this.sliceSerialize(P).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function Z(P){const B=this.stack[this.stack.length-1].children;let j=B[B.length-1];(!j||j.type!=="text")&&(j=J(),j.position={start:_n(P.start),end:void 0},B.push(j)),this.stack.push(j)}function T(P){const X=this.stack.pop();X.value+=this.sliceSerialize(P),X.position.end=_n(P.end)}function R(P){const X=this.stack[this.stack.length-1];if(this.data.atHardBreak){const B=X.children[X.children.length-1];B.position.end=_n(P.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(X.type)&&(Z.call(this,P),T.call(this,P))}function A(){this.data.atHardBreak=!0}function D(){const P=this.resume(),X=this.stack[this.stack.length-1];X.value=P}function U(){const P=this.resume(),X=this.stack[this.stack.length-1];X.value=P}function M(){const P=this.resume(),X=this.stack[this.stack.length-1];X.value=P}function F(){const P=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";P.type+="Reference",P.referenceType=X,delete P.url,delete P.title}else delete P.identifier,delete P.label;this.data.referenceType=void 0}function W(){const P=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";P.type+="Reference",P.referenceType=X,delete P.url,delete P.title}else delete P.identifier,delete P.label;this.data.referenceType=void 0}function L(P){const X=this.sliceSerialize(P),B=this.stack[this.stack.length-2];B.label=a2(X),B.identifier=Ar(X).toLowerCase()}function $(){const P=this.stack[this.stack.length-1],X=this.resume(),B=this.stack[this.stack.length-1];if(this.data.inReference=!0,B.type==="link"){const j=P.children;B.children=j}else B.alt=X}function S(){const P=this.resume(),X=this.stack[this.stack.length-1];X.url=P}function ne(){const P=this.resume(),X=this.stack[this.stack.length-1];X.title=P}function oe(){this.data.inReference=void 0}function b(){this.data.referenceType="collapsed"}function me(P){const X=this.resume(),B=this.stack[this.stack.length-1];B.label=X,B.identifier=Ar(this.sliceSerialize(P)).toLowerCase(),this.data.referenceType="full"}function V(P){this.data.characterReferenceType=P.type}function H(P){const X=this.sliceSerialize(P),B=this.data.characterReferenceType;let j;B?(j=B0(X,B==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):j=tf(X);const K=this.stack[this.stack.length-1];K.value+=j}function G(P){const X=this.stack.pop();X.position.end=_n(P.end)}function he(P){T.call(this,P);const X=this.stack[this.stack.length-1];X.url=this.sliceSerialize(P)}function ue(P){T.call(this,P);const X=this.stack[this.stack.length-1];X.url="mailto:"+this.sliceSerialize(P)}function ge(){return{type:"blockquote",children:[]}}function O(){return{type:"code",lang:null,meta:null,value:""}}function Ue(){return{type:"inlineCode",value:""}}function ve(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ke(){return{type:"emphasis",children:[]}}function Ot(){return{type:"heading",depth:0,children:[]}}function qt(){return{type:"break"}}function De(){return{type:"html",value:""}}function ke(){return{type:"image",title:null,url:"",alt:null}}function Or(){return{type:"link",title:null,url:"",children:[]}}function Zr(P){return{type:"list",ordered:P.type==="listOrdered",start:null,spread:P._spread,children:[]}}function Pt(P){return{type:"listItem",spread:P._spread,checked:null,children:[]}}function Yt(){return{type:"paragraph",children:[]}}function Qe(){return{type:"strong",children:[]}}function J(){return{type:"text",value:""}}function pe(){return{type:"thematicBreak"}}}function _n(e){return{line:e.line,column:e.column,offset:e.offset}}function q0(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?q0(e,n):d2(e,n)}}function d2(e,t){let r;for(r in t)if(V0.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function cm(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 f2(e){const t=this;t.parser=r;function r(n){return u2(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function p2(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function m2(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
71
- `}]}function g2(e,t){const r=t.value?t.value+`
72
- `:"",n={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function _2(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function v2(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function y2(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),i=hs(n.toLowerCase()),s=e.footnoteOrder.indexOf(n);let o,l=e.footnoteCounts.get(n);l===void 0?(l=0,e.footnoteOrder.push(n),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(n,l);const a={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,a);const c={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,c),e.applyData(t,c)}function x2(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function S2(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function Y0(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function w2(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Y0(e,t);const i={src:hs(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function b2(e,t){const r={src:hs(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function k2(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function C2(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Y0(e,t);const i={href:hs(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function E2(e,t){const r={href:hs(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function T2(e,t,r){const n=e.all(t),i=r?N2(r):X0(t),s={},o=[];if(typeof t.checked=="boolean"){const h=n[0];let u;h&&h.type==="element"&&h.tagName==="p"?u=h:(u={type:"element",tagName:"p",properties:{},children:[]},n.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const h=n[l];(i||l!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
70
+ `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function m2(e){const n={constructs:K0([h2,...(e||{}).extensions||[]]),content:i(Lk),defined:[],document:i(Rk),flow:i(GC),lazy:{},string:i(JC),text:i(e2)};return n;function i(s){return o;function o(l){return d2(n,s,l)}}}function g2(e){for(;!G0(e););return e}const _m=/[\0\t\n\r]/g;function _2(){let e=1,t="",r=!0,n;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="",r&&(s.charCodeAt(0)===65279&&u++,r=void 0);u<s.length;){if(_m.lastIndex=u,c=_m.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&&n)a.push(-3),n=void 0;else switch(n&&(a.push(-5),n=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:n=!0,e=1}u=d+1}return l&&(n&&a.push(-5),t&&a.push(t),a.push(null)),a}}const v2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function y2(e){return e.replace(v2,x2)}function x2(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return V0(r.slice(s?2:1),s?16:10)}return tf(r)||e}const ry={}.hasOwnProperty;function S2(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),w2(r)(g2(m2(r).document().write(_2()(e,t,!0))))}function w2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Or),autolinkProtocol:J,autolinkEmail:J,atxHeading:s(Nt),blockQuote:s(pe),characterEscape:J,characterReference:J,codeFenced:s(B),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(B,o),codeText:s(Re,o),codeTextData:J,data:J,codeFlowValue:J,definition:s(be),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Ie),hardBreakEscape:s(ur),hardBreakTrailing:s(ur),htmlFlow:s(kr,o),htmlFlowData:J,htmlText:s(kr,o),htmlTextData:J,image:s(Br),label:o,link:s(Or),listItem:s(hr),listItemValue:d,listOrdered:s(mn,u),listUnordered:s(mn),paragraph:s(Cr),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Nt),strong:s(ft),thematicBreak:s(ae)},exit:{atxHeading:a(),atxHeadingSequence:P,autolink:a(),autolinkEmail:de,autolinkProtocol:ue,blockQuote:a(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:X,characterReferenceMarkerNumeric:X,characterReferenceValue:Q,characterReference:K,codeFenced:a(x),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:N,codeIndented:a(_),codeText:a(A),codeTextData:N,data:N,definition:a(),definitionDestinationString:E,definitionLabelString:v,definitionTitleString:y,emphasis:a(),hardBreakEscape:a(I),hardBreakTrailing:a(I),htmlFlow:a(R),htmlFlowData:N,htmlText:a(W),htmlTextData:N,image:a(H),label:$,labelText:L,lineEnding:D,link:a(F),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:ge,resourceDestinationString:S,resourceTitleString:ne,resource:ce,setextHeading:a(z),setextHeadingLineSequence:M,setextHeadingText:C,strong:a(),thematicBreak:a()}};ny(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(T){let q={type:"root",children:[]};const O={stack:[q],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:h,data:r},j=[];let U=-1;for(;++U<T.length;)if(T[U][1].type==="listOrdered"||T[U][1].type==="listUnordered")if(T[U][0]==="enter")j.push(U);else{const V=j.pop();U=i(T,V,U)}for(U=-1;++U<T.length;){const V=t[T[U][0]];ry.call(V,T[U][1].type)&&V[T[U][1].type].call(Object.assign({sliceSerialize:T[U][2].sliceSerialize},O),T[U][1])}if(O.tokenStack.length>0){const V=O.tokenStack[O.tokenStack.length-1];(V[1]||vm).call(O,void 0,V[0])}for(q.position={start:_n(T.length>0?T[0][1].start:{line:1,column:1,offset:0}),end:_n(T.length>0?T[T.length-2][1].end:{line:1,column:1,offset:0})},U=-1;++U<t.transforms.length;)q=t.transforms[U](q)||q;return q}function i(T,q,O){let j=q-1,U=-1,V=!1,Z,se,le,me;for(;++j<=O;){const re=T[j];switch(re[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{re[0]==="enter"?U++:U--,me=void 0;break}case"lineEndingBlank":{re[0]==="enter"&&(Z&&!me&&!U&&!le&&(le=j),me=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:me=void 0}if(!U&&re[0]==="enter"&&re[1].type==="listItemPrefix"||U===-1&&re[0]==="exit"&&(re[1].type==="listUnordered"||re[1].type==="listOrdered")){if(Z){let xe=j;for(se=void 0;xe--;){const ye=T[xe];if(ye[1].type==="lineEnding"||ye[1].type==="lineEndingBlank"){if(ye[0]==="exit")continue;se&&(T[se][1].type="lineEndingBlank",V=!0),ye[1].type="lineEnding",se=xe}else if(!(ye[1].type==="linePrefix"||ye[1].type==="blockQuotePrefix"||ye[1].type==="blockQuotePrefixWhitespace"||ye[1].type==="blockQuoteMarker"||ye[1].type==="listItemIndent"))break}le&&(!se||le<se)&&(Z._spread=!0),Z.end=Object.assign({},se?T[se][1].start:re[1].end),T.splice(se||j,0,["exit",Z,re[2]]),j++,O++}if(re[1].type==="listItemPrefix"){const xe={type:"listItem",_spread:!1,start:Object.assign({},re[1].start),end:void 0};Z=xe,T.splice(j,0,["enter",xe,re[2]]),j++,O++,le=void 0,me=!0}}}return T[q][1]._spread=V,O}function s(T,q){return O;function O(j){l.call(this,T(j),j),q&&q.call(this,j)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(T,q,O){this.stack[this.stack.length-1].children.push(T),this.stack.push(T),this.tokenStack.push([q,O||void 0]),T.position={start:_n(q.start),end:void 0}}function a(T){return q;function q(O){T&&T.call(this,O),c.call(this,O)}}function c(T,q){const O=this.stack.pop(),j=this.tokenStack.pop();if(j)j[0].type!==T.type&&(q?q.call(this,T,j[0]):(j[1]||vm).call(this,T,j[0]));else throw new Error("Cannot close `"+T.type+"` ("+Qs({start:T.start,end:T.end})+"): it’s not open");O.position.end=_n(T.end)}function h(){return ef(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function d(T){if(this.data.expectingFirstListItemValue){const q=this.stack[this.stack.length-2];q.start=Number.parseInt(this.sliceSerialize(T),10),this.data.expectingFirstListItemValue=void 0}}function f(){const T=this.resume(),q=this.stack[this.stack.length-1];q.lang=T}function m(){const T=this.resume(),q=this.stack[this.stack.length-1];q.meta=T}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const T=this.resume(),q=this.stack[this.stack.length-1];q.value=T.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const T=this.resume(),q=this.stack[this.stack.length-1];q.value=T.replace(/(\r?\n|\r)$/g,"")}function v(T){const q=this.resume(),O=this.stack[this.stack.length-1];O.label=q,O.identifier=Ir(this.sliceSerialize(T)).toLowerCase()}function y(){const T=this.resume(),q=this.stack[this.stack.length-1];q.title=T}function E(){const T=this.resume(),q=this.stack[this.stack.length-1];q.url=T}function P(T){const q=this.stack[this.stack.length-1];if(!q.depth){const O=this.sliceSerialize(T).length;q.depth=O}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function M(T){const q=this.stack[this.stack.length-1];q.depth=this.sliceSerialize(T).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function J(T){const O=this.stack[this.stack.length-1].children;let j=O[O.length-1];(!j||j.type!=="text")&&(j=ee(),j.position={start:_n(T.start),end:void 0},O.push(j)),this.stack.push(j)}function N(T){const q=this.stack.pop();q.value+=this.sliceSerialize(T),q.position.end=_n(T.end)}function D(T){const q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const O=q.children[q.children.length-1];O.position.end=_n(T.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(q.type)&&(J.call(this,T),N.call(this,T))}function I(){this.data.atHardBreak=!0}function R(){const T=this.resume(),q=this.stack[this.stack.length-1];q.value=T}function W(){const T=this.resume(),q=this.stack[this.stack.length-1];q.value=T}function A(){const T=this.resume(),q=this.stack[this.stack.length-1];q.value=T}function F(){const T=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";T.type+="Reference",T.referenceType=q,delete T.url,delete T.title}else delete T.identifier,delete T.label;this.data.referenceType=void 0}function H(){const T=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";T.type+="Reference",T.referenceType=q,delete T.url,delete T.title}else delete T.identifier,delete T.label;this.data.referenceType=void 0}function L(T){const q=this.sliceSerialize(T),O=this.stack[this.stack.length-2];O.label=y2(q),O.identifier=Ir(q).toLowerCase()}function $(){const T=this.stack[this.stack.length-1],q=this.resume(),O=this.stack[this.stack.length-1];if(this.data.inReference=!0,O.type==="link"){const j=T.children;O.children=j}else O.alt=q}function S(){const T=this.resume(),q=this.stack[this.stack.length-1];q.url=T}function ne(){const T=this.resume(),q=this.stack[this.stack.length-1];q.title=T}function ce(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function ge(T){const q=this.resume(),O=this.stack[this.stack.length-1];O.label=q,O.identifier=Ir(this.sliceSerialize(T)).toLowerCase(),this.data.referenceType="full"}function X(T){this.data.characterReferenceType=T.type}function Q(T){const q=this.sliceSerialize(T),O=this.data.characterReferenceType;let j;O?(j=V0(q,O==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):j=tf(q);const U=this.stack[this.stack.length-1];U.value+=j}function K(T){const q=this.stack.pop();q.position.end=_n(T.end)}function ue(T){N.call(this,T);const q=this.stack[this.stack.length-1];q.url=this.sliceSerialize(T)}function de(T){N.call(this,T);const q=this.stack[this.stack.length-1];q.url="mailto:"+this.sliceSerialize(T)}function pe(){return{type:"blockquote",children:[]}}function B(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function be(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ie(){return{type:"emphasis",children:[]}}function Nt(){return{type:"heading",depth:0,children:[]}}function ur(){return{type:"break"}}function kr(){return{type:"html",value:""}}function Br(){return{type:"image",title:null,url:"",alt:null}}function Or(){return{type:"link",title:null,url:"",children:[]}}function mn(T){return{type:"list",ordered:T.type==="listOrdered",start:null,spread:T._spread,children:[]}}function hr(T){return{type:"listItem",spread:T._spread,checked:null,children:[]}}function Cr(){return{type:"paragraph",children:[]}}function ft(){return{type:"strong",children:[]}}function ee(){return{type:"text",value:""}}function ae(){return{type:"thematicBreak"}}}function _n(e){return{line:e.line,column:e.column,offset:e.offset}}function ny(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?ny(e,n):b2(e,n)}}function b2(e,t){let r;for(r in t)if(ry.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function vm(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 k2(e){const t=this;t.parser=r;function r(n){return S2(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function C2(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function E2(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
71
+ `}]}function N2(e,t){const r=t.value?t.value+`
72
+ `:"",n={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function T2(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function P2(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function L2(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),i=hs(n.toLowerCase()),s=e.footnoteOrder.indexOf(n);let o,l=e.footnoteCounts.get(n);l===void 0?(l=0,e.footnoteOrder.push(n),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(n,l);const a={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,a);const c={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,c),e.applyData(t,c)}function D2(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function R2(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function iy(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function M2(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return iy(e,t);const i={src:hs(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function I2(e,t){const r={src:hs(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function A2(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function B2(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return iy(e,t);const i={href:hs(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function O2(e,t){const r={href:hs(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j2(e,t,r){const n=e.all(t),i=r?z2(r):sy(t),s={},o=[];if(typeof t.checked=="boolean"){const h=n[0];let u;h&&h.type==="element"&&h.tagName==="p"?u=h:(u={type:"element",tagName:"p",properties:{},children:[]},n.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const h=n[l];(i||l!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
73
73
  `}),h.type==="element"&&h.tagName==="p"&&!i?o.push(...h.children):o.push(h)}const a=n[n.length-1];a&&(i||a.type!=="element"||a.tagName!=="p")&&o.push({type:"text",value:`
74
- `});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function N2(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let n=-1;for(;!t&&++n<r.length;)t=X0(r[n])}return t}function X0(e){const t=e.spread;return t??e.children.length>1}function P2(e,t){const r={},n=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,s),e.applyData(t,s)}function L2(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function R2(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function D2(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function M2(e,t){const r=e.all(t),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=Gd(t.children[1]),a=N0(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 I2(e,t,r){const n=r?r.children:void 0,s=(n?n.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:t.children.length;let a=-1;const c=[];for(;++a<l;){const u=t.children[a],d={},f=o?o[a]:void 0;f&&(d.align=f);let m={type:"element",tagName:s,properties:d,children:[]};u&&(m.children=e.all(u),e.patch(u,m),m=e.applyData(u,m)),c.push(m)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function A2(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const um=9,hm=32;function B2(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),i=0;const s=[];for(;n;)s.push(dm(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return s.push(dm(t.slice(i),i>0,!1)),s.join("")}function dm(e,t,r){let n=0,i=e.length;if(t){let s=e.codePointAt(n);for(;s===um||s===hm;)n++,s=e.codePointAt(n)}if(r){let s=e.codePointAt(i-1);for(;s===um||s===hm;)i--,s=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}function O2(e,t){const r={type:"text",value:B2(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function j2(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const z2={blockquote:p2,break:m2,code:g2,delete:_2,emphasis:v2,footnoteReference:y2,heading:x2,html:S2,imageReference:w2,image:b2,inlineCode:k2,linkReference:C2,link:E2,listItem:T2,list:P2,paragraph:L2,root:R2,strong:D2,table:M2,tableCell:A2,tableRow:I2,text:O2,thematicBreak:j2,toml:al,yaml:al,definition:al,footnoteDefinition:al};function al(){}const G0=-1,Wa=0,Js=1,fa=2,nf=3,sf=4,of=5,lf=6,Q0=7,Z0=8,fm=typeof self=="object"?self:globalThis,F2=(e,t)=>{const r=(i,s)=>(e.set(s,i),i),n=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case Wa:case G0:return r(o,i);case Js:{const l=r([],i);for(const a of o)l.push(n(a));return l}case fa:{const l=r({},i);for(const[a,c]of o)l[n(a)]=n(c);return l}case nf:return r(new Date(o),i);case sf:{const{source:l,flags:a}=o;return r(new RegExp(l,a),i)}case of:{const l=r(new Map,i);for(const[a,c]of o)l.set(n(a),n(c));return l}case lf:{const l=r(new Set,i);for(const a of o)l.add(n(a));return l}case Q0:{const{name:l,message:a}=o;return r(new fm[l](a),i)}case Z0:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new fm[s](o),i)};return n},pm=e=>F2(new Map,e)(0),Ei="",{toString:$2}={},{keys:H2}=Object,ks=e=>{const t=typeof e;if(t!=="object"||!e)return[Wa,t];const r=$2.call(e).slice(8,-1);switch(r){case"Array":return[Js,Ei];case"Object":return[fa,Ei];case"Date":return[nf,Ei];case"RegExp":return[sf,Ei];case"Map":return[of,Ei];case"Set":return[lf,Ei];case"DataView":return[Js,r]}return r.includes("Array")?[Js,r]:r.includes("Error")?[Q0,r]:[fa,r]},cl=([e,t])=>e===Wa&&(t==="function"||t==="symbol"),W2=(e,t,r,n)=>{const i=(o,l)=>{const a=n.push(o)-1;return r.set(l,a),a},s=o=>{if(r.has(o))return r.get(o);let[l,a]=ks(o);switch(l){case Wa:{let h=o;switch(a){case"bigint":l=Z0,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);h=null;break;case"undefined":return i([G0],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 H2(o))(e||!cl(ks(o[d])))&&h.push([s(d),s(o[d])]);return u}case nf: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},mm=(e,{json:t,lossy:r}={})=>{const n=[];return W2(!(t||r),!!t,new Map,n)(e),n},pa=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?pm(mm(e,t)):structuredClone(e):(e,t)=>pm(mm(e,t));function U2(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function K2(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function V2(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||U2,n=e.options.footnoteBackLabel||K2,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 m=[],g=e.footnoteCounts.get(u);for(;g!==void 0&&++f<=g;){m.length>0&&m.push({type:"text",value:" "});let v=typeof r=="string"?r:r(a,f);typeof v=="string"&&(v={type:"text",value:v}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(a,f),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=h[h.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...m)}else h.push(...m);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:`
74
+ `});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function z2(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let n=-1;for(;!t&&++n<r.length;)t=sy(r[n])}return t}function sy(e){const t=e.spread;return t??e.children.length>1}function F2(e,t){const r={},n=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i<n.length;){const o=n[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,s),e.applyData(t,s)}function $2(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function H2(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function W2(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function U2(e,t){const r=e.all(t),n=r.shift(),i=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],o),i.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=Gd(t.children[1]),a=j0(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 K2(e,t,r){const n=r?r.children:void 0,s=(n?n.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:t.children.length;let a=-1;const c=[];for(;++a<l;){const u=t.children[a],d={},f=o?o[a]:void 0;f&&(d.align=f);let m={type:"element",tagName:s,properties:d,children:[]};u&&(m.children=e.all(u),e.patch(u,m),m=e.applyData(u,m)),c.push(m)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function V2(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const ym=9,xm=32;function q2(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),i=0;const s=[];for(;n;)s.push(Sm(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return s.push(Sm(t.slice(i),i>0,!1)),s.join("")}function Sm(e,t,r){let n=0,i=e.length;if(t){let s=e.codePointAt(n);for(;s===ym||s===xm;)n++,s=e.codePointAt(n)}if(r){let s=e.codePointAt(i-1);for(;s===ym||s===xm;)i--,s=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}function Y2(e,t){const r={type:"text",value:q2(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function X2(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const G2={blockquote:C2,break:E2,code:N2,delete:T2,emphasis:P2,footnoteReference:L2,heading:D2,html:R2,imageReference:M2,image:I2,inlineCode:A2,linkReference:B2,link:O2,listItem:j2,list:F2,paragraph:$2,root:H2,strong:W2,table:U2,tableCell:V2,tableRow:K2,text:Y2,thematicBreak:X2,toml:ol,yaml:ol,definition:ol,footnoteDefinition:ol};function ol(){}const oy=-1,$a=0,Js=1,ha=2,nf=3,sf=4,of=5,lf=6,ly=7,ay=8,wm=typeof self=="object"?self:globalThis,Q2=(e,t)=>{const r=(i,s)=>(e.set(s,i),i),n=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case $a:case oy:return r(o,i);case Js:{const l=r([],i);for(const a of o)l.push(n(a));return l}case ha:{const l=r({},i);for(const[a,c]of o)l[n(a)]=n(c);return l}case nf:return r(new Date(o),i);case sf:{const{source:l,flags:a}=o;return r(new RegExp(l,a),i)}case of:{const l=r(new Map,i);for(const[a,c]of o)l.set(n(a),n(c));return l}case lf:{const l=r(new Set,i);for(const a of o)l.add(n(a));return l}case ly:{const{name:l,message:a}=o;return r(new wm[l](a),i)}case ay:return r(BigInt(o),i);case"BigInt":return r(Object(BigInt(o)),i);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new wm[s](o),i)};return n},bm=e=>Q2(new Map,e)(0),Ei="",{toString:Z2}={},{keys:J2}=Object,ks=e=>{const t=typeof e;if(t!=="object"||!e)return[$a,t];const r=Z2.call(e).slice(8,-1);switch(r){case"Array":return[Js,Ei];case"Object":return[ha,Ei];case"Date":return[nf,Ei];case"RegExp":return[sf,Ei];case"Map":return[of,Ei];case"Set":return[lf,Ei];case"DataView":return[Js,r]}return r.includes("Array")?[Js,r]:r.includes("Error")?[ly,r]:[ha,r]},ll=([e,t])=>e===$a&&(t==="function"||t==="symbol"),eE=(e,t,r,n)=>{const i=(o,l)=>{const a=n.push(o)-1;return r.set(l,a),a},s=o=>{if(r.has(o))return r.get(o);let[l,a]=ks(o);switch(l){case $a:{let h=o;switch(a){case"bigint":l=ay,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 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 ha:{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 J2(o))(e||!ll(ks(o[d])))&&h.push([s(d),s(o[d])]);return u}case nf: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||!(ll(ks(d))||ll(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||!ll(ks(d)))&&h.push(s(d));return u}}const{message:c}=o;return i([l,{name:a,message:c}],o)};return s},km=(e,{json:t,lossy:r}={})=>{const n=[];return eE(!(t||r),!!t,new Map,n)(e),n},da=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?bm(km(e,t)):structuredClone(e):(e,t)=>bm(km(e,t));function tE(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function rE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function nE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||tE,n=e.options.footnoteBackLabel||rE,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 m=[],g=e.footnoteCounts.get(u);for(;g!==void 0&&++f<=g;){m.length>0&&m.push({type:"text",value:" "});let v=typeof r=="string"?r:r(a,f);typeof v=="string"&&(v={type:"text",value:v}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(a,f),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=h[h.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...m)}else h.push(...m);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:{...da(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 Ua=function(e){if(e==null)return G2;if(typeof e=="function")return Ka(e);if(typeof e=="object")return Array.isArray(e)?q2(e):Y2(e);if(typeof e=="string")return X2(e);throw new Error("Expected function, string, or object as test")};function q2(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Ua(e[r]);return Ka(n);function n(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function Y2(e){const t=e;return Ka(r);function r(n){const i=n;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function X2(e){return Ka(t);function t(r){return r&&r.type===e}}function Ka(e){return t;function t(r,n,i){return!!(Q2(r)&&e.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function G2(){return!0}function Q2(e){return e!==null&&typeof e=="object"&&"type"in e}const J0=[],Z2=!0,oh=!1,J2="skip";function ey(e,t,r,n){let i;typeof t=="function"&&typeof r!="function"?(n=r,r=t):i=t;const s=Ua(i),o=n?-1:1;l(e,void 0,[])();function l(a,c,h){const u=a&&typeof a=="object"?a:{};if(typeof u.type=="string"){const 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=J0,m,g,x;if((!t||s(a,c,h[h.length-1]||void 0))&&(f=eE(r(a,h)),f[0]===oh))return f;if("children"in a&&a.children){const _=a;if(_.children&&f[0]!==J2)for(g=(n?_.children.length:-1)+o,x=h.concat(_);g>-1&&g<_.children.length;){const v=_.children[g];if(m=l(v,g,x)(),m[0]===oh)return m;g=typeof m[1]=="number"?m[1]:g+o}}return f}}}function eE(e){return Array.isArray(e)?e:typeof e=="number"?[Z2,e]:e==null?J0:[e]}function Va(e,t,r,n){let i,s,o;typeof t=="function"&&typeof r!="function"?(s=void 0,o=t,i=r):(s=t,o=r,i=n),ey(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,tE={};function rE(e,t){const r=t||tE,n=new Map,i=new Map,s=new Map,o={...z2,...r.handlers},l={all:c,applyData:iE,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:a,options:r,patch:nE,wrap:oE};return Va(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const u=h.type==="definition"?n: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:g,...x}=h,_=pa(x);return _.children=l.all(h),_}return pa(h)}return(l.options.unknownHandler||sE)(l,h,u)}function c(h){const u=[];if("children"in h){const d=h.children;let f=-1;for(;++f<d.length;){const m=l.one(d[f],h);if(m){if(f&&d[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=gm(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=gm(g.value))}Array.isArray(m)?u.push(...m):u.push(m)}}}return u}}function nE(e,t){e.position&&(t.position=Kb(e))}function iE(e,t){let r=t;if(e&&e.data){const n=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,pa(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function sE(e,t){const r=t.data||{},n="value"in t&&!(lh.call(r,"hProperties")||lh.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oE(e,t){const r=[];let n=-1;for(t&&r.push({type:"text",value:`
76
+ `}]}}const Ha=function(e){if(e==null)return lE;if(typeof e=="function")return Wa(e);if(typeof e=="object")return Array.isArray(e)?iE(e):sE(e);if(typeof e=="string")return oE(e);throw new Error("Expected function, string, or object as test")};function iE(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Ha(e[r]);return Wa(n);function n(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function sE(e){const t=e;return Wa(r);function r(n){const i=n;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function oE(e){return Wa(t);function t(r){return r&&r.type===e}}function Wa(e){return t;function t(r,n,i){return!!(aE(r)&&e.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function lE(){return!0}function aE(e){return e!==null&&typeof e=="object"&&"type"in e}const cy=[],cE=!0,oh=!1,uE="skip";function uy(e,t,r,n){let i;typeof t=="function"&&typeof r!="function"?(n=r,r=t):i=t;const s=Ha(i),o=n?-1:1;l(e,void 0,[])();function l(a,c,h){const u=a&&typeof a=="object"?a:{};if(typeof u.type=="string"){const 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=cy,m,g,x;if((!t||s(a,c,h[h.length-1]||void 0))&&(f=hE(r(a,h)),f[0]===oh))return f;if("children"in a&&a.children){const _=a;if(_.children&&f[0]!==uE)for(g=(n?_.children.length:-1)+o,x=h.concat(_);g>-1&&g<_.children.length;){const v=_.children[g];if(m=l(v,g,x)(),m[0]===oh)return m;g=typeof m[1]=="number"?m[1]:g+o}}return f}}}function hE(e){return Array.isArray(e)?e:typeof e=="number"?[cE,e]:e==null?cy:[e]}function Ua(e,t,r,n){let i,s,o;typeof t=="function"&&typeof r!="function"?(s=void 0,o=t,i=r):(s=t,o=r,i=n),uy(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,dE={};function fE(e,t){const r=t||dE,n=new Map,i=new Map,s=new Map,o={...G2,...r.handlers},l={all:c,applyData:mE,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:a,options:r,patch:pE,wrap:_E};return Ua(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const u=h.type==="definition"?n: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:g,...x}=h,_=da(x);return _.children=l.all(h),_}return da(h)}return(l.options.unknownHandler||gE)(l,h,u)}function c(h){const u=[];if("children"in h){const d=h.children;let f=-1;for(;++f<d.length;){const m=l.one(d[f],h);if(m){if(f&&d[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Cm(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=Cm(g.value))}Array.isArray(m)?u.push(...m):u.push(m)}}}return u}}function pE(e,t){e.position&&(t.position=rk(e))}function mE(e,t){let r=t;if(e&&e.data){const n=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&s&&Object.assign(r.properties,da(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function gE(e,t){const r=t.data||{},n="value"in t&&!(lh.call(r,"hProperties")||lh.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _E(e,t){const r=[];let n=-1;for(t&&r.push({type:"text",value:`
77
77
  `});++n<e.length;)n&&r.push({type:"text",value:`
78
78
  `}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:`
79
- `}),r}function gm(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function _m(e,t){const r=rE(e,t),n=r.one(e,void 0),i=V2(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
80
- `},i),s}function lE(e,t){return e&&"run"in e?async function(r,n){const i=_m(r,{file:n,...t});await e.run(i,n)}:function(r,n){return _m(r,{file:n,...e||t})}}function vm(e){if(e)throw e}var Dl=Object.prototype.hasOwnProperty,ty=Object.prototype.toString,ym=Object.defineProperty,xm=Object.getOwnPropertyDescriptor,Sm=function(t){return typeof Array.isArray=="function"?Array.isArray(t):ty.call(t)==="[object Array]"},wm=function(t){if(!t||ty.call(t)!=="[object Object]")return!1;var r=Dl.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&Dl.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var i;for(i in t);return typeof i>"u"||Dl.call(t,i)},bm=function(t,r){ym&&r.name==="__proto__"?ym(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},km=function(t,r){if(r==="__proto__")if(Dl.call(t,r)){if(xm)return xm(t,r).value}else return;return t[r]},aE=function e(){var t,r,n,i,s,o,l=arguments[0],a=1,c=arguments.length,h=!1;for(typeof l=="boolean"&&(h=l,l=arguments[1]||{},a=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});a<c;++a)if(t=arguments[a],t!=null)for(r in t)n=km(l,r),i=km(t,r),l!==i&&(h&&i&&(wm(i)||(s=Sm(i)))?(s?(s=!1,o=n&&Sm(n)?n:[]):o=n&&wm(n)?n:{},bm(l,{name:r,newValue:e(h,o,i)})):typeof i<"u"&&bm(l,{name:r,newValue:i}));return l};const Nc=Gh(aE);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 cE(){const e=[],t={run:r,use:n};return t;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(a,...c){const h=e[++s];let u=-1;if(a){o(a);return}for(;++u<i.length;)(c[u]===null||c[u]===void 0)&&(c[u]=i[u]);i=c,h?uE(h,l)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function uE(e,t){let r;return n;function n(...o){const l=e.length>o.length;let a;l&&o.push(i);try{a=e.apply(this,o)}catch(c){const h=c;if(l&&r)throw h;return i(h)}l||(a&&a.then&&typeof a.then=="function"?a.then(s,i):a instanceof Error?i(a):s(a))}function i(o,...l){r||(r=!0,t(o,...l))}function s(o){i(null,o)}}const Wr={basename:hE,dirname:dE,extname:fE,join:pE,sep:"/"};function hE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Bo(e);let r=0,n=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(n=i):(l=-1,n=o));return r===n?n=o:n<0&&(n=e.length),e.slice(r,n)}function dE(e){if(Bo(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function fE(e){Bo(e);let t=e.length,r=-1,n=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){n=t+1;break}continue}r<0&&(o=!0,r=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function pE(...e){let t=-1,r;for(;++t<e.length;)Bo(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":mE(r)}function mE(e){Bo(e);const t=e.codePointAt(0)===47;let r=gE(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function gE(e,t){let r="",n=0,i=-1,s=0,o=-1,l,a;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(a=r.lastIndexOf("/"),a!==r.length-1){a<0?(r="",n=0):(r=r.slice(0,a),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,o):r=e.slice(i+1,o),n=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return r}function Bo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _E={cwd:vE};function vE(){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 yE(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 xE(e)}function xE(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Pc=["history","path","basename","stem","extname","dirname"];class ry{constructor(t){let r;t?ch(t)?r={path:t}:typeof t=="string"||SE(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":_E.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Pc.length;){const s=Pc[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)Pc.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Wr.basename(this.path):void 0}set basename(t){Rc(t,"basename"),Lc(t,"basename"),this.path=Wr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Wr.dirname(this.path):void 0}set dirname(t){Cm(this.basename,"dirname"),this.path=Wr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Wr.extname(this.path):void 0}set extname(t){if(Lc(t,"extname"),Cm(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=Wr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ch(t)&&(t=yE(t)),Rc(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Wr.basename(this.path,this.extname):void 0}set stem(t){Rc(t,"stem"),Lc(t,"stem"),this.path=Wr.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){const i=this.message(t,r,n);throw i.fatal=!0,i}info(t,r,n){const i=this.message(t,r,n);return i.fatal=void 0,i}message(t,r,n){const i=new Bt(t,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Lc(e,t){if(e&&e.includes(Wr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Wr.sep+"`")}function Rc(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Cm(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 n=this.constructor.prototype,i=n[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s},bE={}.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=cE()}copy(){const t=new af;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(Nc(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Ic("data",this.frozen),this.namespace[t]=r,this):bE.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ic("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(t,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=ul(t),n=this.parser||this.Parser;return Dc("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),Dc("process",this.parser||this.Parser),Mc("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const l=ul(t),a=n.parse(l);n.run(a,l,function(h,u,d){if(h||!u||!d)return c(h);const f=u,m=n.stringify(f,d);EE(m)?d.value=m:d.result=m,c(h,d)});function c(h,u){h||!u?o(h):s?s(u):r(void 0,u)}}}processSync(t){let r=!1,n;return this.freeze(),Dc("processSync",this.parser||this.Parser),Mc("processSync",this.compiler||this.Compiler),this.process(t,i),Tm("processSync","process",r),n;function i(s,o){r=!0,vm(s),n=o}}run(t,r,n){Em(t),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,l){const a=ul(r);i.run(t,a,c);function c(h,u,d){const f=u||t;h?l(h):o?o(f):n(void 0,f,d)}}}runSync(t,r){let n=!1,i;return this.run(t,r,s),Tm("runSync","run",n),i;function s(o,l){vm(o),i=l,n=!0}}stringify(t,r){this.freeze();const n=ul(r),i=this.compiler||this.Compiler;return Mc("stringify",i),Em(t),i(t,n)}use(t,...r){const n=this.attachers,i=this.namespace;if(Ic("use",this.frozen),t!=null)if(typeof t=="function")a(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")a(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[h,...u]=c;a(h,u)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(c.plugins),c.settings&&(i.settings=Nc(!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<n.length;)if(n[u][0]===c){d=u;break}if(d===-1)n.push([c,...h]);else if(h.length>0){let[f,...m]=h;const g=n[d][1];ah(g)&&ah(f)&&(f=Nc(!0,g,f)),n[d]=[c,f,...m]}}}}const kE=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 Ic(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 Em(e){if(!ah(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Tm(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ul(e){return CE(e)?e:new ry(e)}function CE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function EE(e){return typeof e=="string"||TE(e)}function TE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const NE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Nm=[],Pm={allowDangerousHtml:!0},PE=/^(https?|ircs?|mailto|xmpp)$/i,LE=[{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 Ac(e){const t=RE(e),r=DE(e);return ME(t.runSync(t.parse(r),r),e)}function RE(e){const t=e.rehypePlugins||Nm,r=e.remarkPlugins||Nm,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Pm}:Pm;return kE().use(f2).use(r).use(lE,n).use(t)}function DE(e){const t=e.children||"",r=new ry;return typeof t=="string"&&(r.value=t),r}function ME(e,t){const r=t.allowedElements,n=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||IE;for(const h of LE)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+NE+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),Gb(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 m=h.properties[f],g=Cc[f];(g===null||g.includes(h.tagName))&&(h.properties[f]=a(String(m||""),f,h))}}if(h.type==="element"){let f=r?!r.includes(h.tagName):s?s.includes(h.tagName):!1;if(!f&&n&&typeof u=="number"&&(f=!n(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 IE(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||n!==-1&&t>n||PE.test(e.slice(0,t))?e:""}function Lm(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}function AE(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ny(e,t,r){const i=Ua((r||{}).ignore||[]),s=BE(t);let o=-1;for(;++o<s.length;)ey(e,"text",l);function l(c,h){let u=-1,d;for(;++u<h.length;){const f=h[u],m=d?d.children:void 0;if(i(f,m?m.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 m=0;const x=u.children.indexOf(c);let _=!1,v=[];d.lastIndex=0;let y=d.exec(c.value);for(;y;){const E=y.index,N={index:y.index,input:y.input,stack:[...h,c]};let k=f(...y,N);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?d.lastIndex=E+1:(m!==E&&v.push({type:"text",value:c.value.slice(m,E)}),Array.isArray(k)?v.push(...k):k&&v.push(k),m=E+y[0].length,_=!0),!d.global)break;y=d.exec(c.value)}return _?(m<c.value.length&&v.push({type:"text",value:c.value.slice(m)}),u.children.splice(x,1,...v)):v=[c],x+v.length}}function BE(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let n=-1;for(;++n<r.length;){const i=r[n];t.push([OE(i[0]),jE(i[1])])}return t}function OE(e){return typeof e=="string"?new RegExp(AE(e),"g"):e}function jE(e){return typeof e=="function"?e:function(){return e}}const Bc="phrasing",Oc=["autolink","link","image","label"];function zE(){return{transforms:[VE],enter:{literalAutolink:$E,literalAutolinkEmail:jc,literalAutolinkHttp:jc,literalAutolinkWww:jc},exit:{literalAutolink:KE,literalAutolinkEmail:UE,literalAutolinkHttp:HE,literalAutolinkWww:WE}}}function FE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Bc,notInConstruct:Oc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Bc,notInConstruct:Oc},{character:":",before:"[ps]",after:"\\/",inConstruct:Bc,notInConstruct:Oc}]}}function $E(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function jc(e){this.config.enter.autolinkProtocol.call(this,e)}function HE(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 UE(e){this.config.exit.autolinkEmail.call(this,e)}function KE(e){this.exit(e)}function VE(e){ny(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,qE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),YE]],{ignore:["link","linkReference"]})}function qE(e,t,r,n,i){let s="";if(!iy(i)||(/^w/i.test(t)&&(r=t+r,t="",s="http://"),!XE(r)))return!1;const o=GE(r+n);if(!o[0])return!1;const l={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function YE(e,t,r,n){return!iy(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function XE(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 GE(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")");const i=Lm(e,"(");let s=Lm(e,")");for(;n!==-1&&i>s;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),s++;return[e,r]}function iy(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||gi(r)||$a(r))&&(!t||r!==47)}sy.peek=s5;function QE(){this.buffer()}function ZE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function JE(){this.buffer()}function e5(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function t5(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Ar(this.sliceSerialize(e)).toLowerCase(),r.label=t}function r5(e){this.exit(e)}function n5(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Ar(this.sliceSerialize(e)).toLowerCase(),r.label=t}function i5(e){this.exit(e)}function s5(){return"["}function sy(e,t,r,n){const i=r.createTracker(n);let s=i.move("[^");const o=r.enter("footnoteReference"),l=r.enter("reference");return s+=i.move(r.safe(r.associationId(e),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function o5(){return{enter:{gfmFootnoteCallString:QE,gfmFootnoteCall:ZE,gfmFootnoteDefinitionLabelString:JE,gfmFootnoteDefinition:e5},exit:{gfmFootnoteCallString:t5,gfmFootnoteCall:r5,gfmFootnoteDefinitionLabelString:n5,gfmFootnoteDefinition:i5}}}function l5(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:sy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const l=s.createTracker(o);let a=l.move("[^");const c=s.enter("footnoteDefinition"),h=s.enter("label");return a+=l.move(s.safe(s.associationId(n),{before:a,after:"]"})),h(),a+=l.move("]:"),n.children&&n.children.length>0&&(l.shift(4),a+=l.move((t?`
81
- `:" ")+s.indentLines(s.containerFlow(n,l.current()),t?oy:a5))),c(),a}}function a5(e,t,r){return t===0?e:oy(e,t,r)}function oy(e,t,r){return(r?"":" ")+e}const c5=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ly.peek=p5;function u5(){return{canContainEols:["delete"],enter:{strikethrough:d5},exit:{strikethrough:f5}}}function h5(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:c5}],handlers:{delete:ly}}}function d5(e){this.enter({type:"delete",children:[]},e)}function f5(e){this.exit(e)}function ly(e,t,r,n){const i=r.createTracker(n),s=r.enter("strikethrough");let o=i.move("~~");return o+=r.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function p5(){return"~"}function m5(e){return e.length}function g5(e,t){const r=t||{},n=(r.align||[]).concat(),i=r.stringLength||m5,s=[],o=[],l=[],a=[];let c=0,h=-1;for(;++h<e.length;){const g=[],x=[];let _=-1;for(e[h].length>c&&(c=e[h].length);++_<e[h].length;){const v=_5(e[h][_]);if(r.alignDelimiters!==!1){const y=i(v);x[_]=y,(a[_]===void 0||y>a[_])&&(a[_]=y)}g.push(v)}o[h]=g,l[h]=x}let u=-1;if(typeof n=="object"&&"length"in n)for(;++u<c;)s[u]=Rm(n[u]);else{const g=Rm(n);for(;++u<c;)s[u]=g}u=-1;const d=[],f=[];for(;++u<c;){const g=s[u];let x="",_="";g===99?(x=":",_=":"):g===108?x=":":g===114&&(_=":");let v=r.alignDelimiters===!1?1:Math.max(1,a[u]-x.length-_.length);const y=x+"-".repeat(v)+_;r.alignDelimiters!==!1&&(v=x.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 m=[];for(;++h<o.length;){const g=o[h],x=l[h];u=-1;const _=[];for(;++u<c;){const v=g[u]||"";let y="",E="";if(r.alignDelimiters!==!1){const N=a[u]-(x[u]||0),k=s[u];k===114?y=" ".repeat(N):k===99?N%2?(y=" ".repeat(N/2+.5),E=" ".repeat(N/2-.5)):(y=" ".repeat(N/2),E=y):E=" ".repeat(N)}r.delimiterStart!==!1&&!u&&_.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&v==="")&&(r.delimiterStart!==!1||u)&&_.push(" "),r.alignDelimiters!==!1&&_.push(y),_.push(v),r.alignDelimiters!==!1&&_.push(E),r.padding!==!1&&_.push(" "),(r.delimiterEnd!==!1||u!==c-1)&&_.push("|")}m.push(r.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return m.join(`
82
- `)}function _5(e){return e==null?"":String(e)}function Rm(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 v5(e,t,r,n){const i=r.enter("blockquote"),s=r.createTracker(n);s.move("> "),s.shift(2);const o=r.indentLines(r.containerFlow(e,s.current()),y5);return i(),o}function y5(e,t,r){return">"+(r?"":" ")+e}function x5(e,t){return Dm(e,t.inConstruct,!0)&&!Dm(e,t.notInConstruct,!1)}function Dm(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let n=-1;for(;++n<t.length;)if(e.includes(t[n]))return!0;return!1}function Mm(e,t,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
83
- `&&x5(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
84
- `}function S5(e,t){const r=String(e);let n=r.indexOf(t),i=n,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++s>o&&(o=s):s=1,i=n+t.length,n=r.indexOf(t,i);return o}function 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 b5(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 k5(e,t,r,n){const i=b5(r),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(w5(e,r)){const u=r.enter("codeIndented"),d=r.indentLines(s,C5);return u(),d}const l=r.createTracker(n),a=i.repeat(Math.max(S5(s,i)+1,3)),c=r.enter("codeFenced");let h=l.move(a);if(e.lang){const u=r.enter(`codeFencedLang${o}`);h+=l.move(r.safe(e.lang,{before:h,after:" ",encode:["`"],...l.current()})),u()}if(e.lang&&e.meta){const u=r.enter(`codeFencedMeta${o}`);h+=l.move(" "),h+=l.move(r.safe(e.meta,{before:h,after:`
79
+ `}),r}function Cm(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Em(e,t){const r=fE(e,t),n=r.one(e,void 0),i=nE(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
80
+ `},i),s}function vE(e,t){return e&&"run"in e?async function(r,n){const i=Em(r,{file:n,...t});await e.run(i,n)}:function(r,n){return Em(r,{file:n,...e||t})}}function Nm(e){if(e)throw e}var Ll=Object.prototype.hasOwnProperty,hy=Object.prototype.toString,Tm=Object.defineProperty,Pm=Object.getOwnPropertyDescriptor,Lm=function(t){return typeof Array.isArray=="function"?Array.isArray(t):hy.call(t)==="[object Array]"},Dm=function(t){if(!t||hy.call(t)!=="[object Object]")return!1;var r=Ll.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&Ll.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var i;for(i in t);return typeof i>"u"||Ll.call(t,i)},Rm=function(t,r){Tm&&r.name==="__proto__"?Tm(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},Mm=function(t,r){if(r==="__proto__")if(Ll.call(t,r)){if(Pm)return Pm(t,r).value}else return;return t[r]},yE=function e(){var t,r,n,i,s,o,l=arguments[0],a=1,c=arguments.length,h=!1;for(typeof l=="boolean"&&(h=l,l=arguments[1]||{},a=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});a<c;++a)if(t=arguments[a],t!=null)for(r in t)n=Mm(l,r),i=Mm(t,r),l!==i&&(h&&i&&(Dm(i)||(s=Lm(i)))?(s?(s=!1,o=n&&Lm(n)?n:[]):o=n&&Dm(n)?n:{},Rm(l,{name:r,newValue:e(h,o,i)})):typeof i<"u"&&Rm(l,{name:r,newValue:i}));return l};const Tc=Gh(yE);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 xE(){const e=[],t={run:r,use:n};return t;function r(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(a,...c){const h=e[++s];let u=-1;if(a){o(a);return}for(;++u<i.length;)(c[u]===null||c[u]===void 0)&&(c[u]=i[u]);i=c,h?SE(h,l)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function SE(e,t){let r;return n;function n(...o){const l=e.length>o.length;let a;l&&o.push(i);try{a=e.apply(this,o)}catch(c){const h=c;if(l&&r)throw h;return i(h)}l||(a&&a.then&&typeof a.then=="function"?a.then(s,i):a instanceof Error?i(a):s(a))}function i(o,...l){r||(r=!0,t(o,...l))}function s(o){i(null,o)}}const Wr={basename:wE,dirname:bE,extname:kE,join:CE,sep:"/"};function wE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Bo(e);let r=0,n=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else n<0&&(s=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){r=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(n=i):(l=-1,n=o));return r===n?n=o:n<0&&(n=e.length),e.slice(r,n)}function bE(e){if(Bo(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function kE(e){Bo(e);let t=e.length,r=-1,n=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){n=t+1;break}continue}r<0&&(o=!0,r=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||r<0||s===0||s===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function CE(...e){let t=-1,r;for(;++t<e.length;)Bo(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":EE(r)}function EE(e){Bo(e);const t=e.codePointAt(0)===47;let r=NE(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function NE(e,t){let r="",n=0,i=-1,s=0,o=-1,l,a;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(a=r.lastIndexOf("/"),a!==r.length-1){a<0?(r="",n=0):(r=r.slice(0,a),n=r.length-1-r.lastIndexOf("/")),i=o,s=0;continue}}else if(r.length>0){r="",n=0,i=o,s=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,o):r=e.slice(i+1,o),n=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return r}function Bo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const TE={cwd:PE};function PE(){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 LE(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 DE(e)}function DE(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Pc=["history","path","basename","stem","extname","dirname"];class dy{constructor(t){let r;t?ch(t)?r={path:t}:typeof t=="string"||RE(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":TE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Pc.length;){const s=Pc[n];s in r&&r[s]!==void 0&&r[s]!==null&&(this[s]=s==="history"?[...r[s]]:r[s])}let i;for(i in r)Pc.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Wr.basename(this.path):void 0}set basename(t){Dc(t,"basename"),Lc(t,"basename"),this.path=Wr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Wr.dirname(this.path):void 0}set dirname(t){Im(this.basename,"dirname"),this.path=Wr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Wr.extname(this.path):void 0}set extname(t){if(Lc(t,"extname"),Im(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=Wr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ch(t)&&(t=LE(t)),Dc(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Wr.basename(this.path,this.extname):void 0}set stem(t){Dc(t,"stem"),Lc(t,"stem"),this.path=Wr.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){const i=this.message(t,r,n);throw i.fatal=!0,i}info(t,r,n){const i=this.message(t,r,n);return i.fatal=void 0,i}message(t,r,n){const i=new It(t,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Lc(e,t){if(e&&e.includes(Wr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Wr.sep+"`")}function Dc(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Im(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function RE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ME=function(e){const n=this.constructor.prototype,i=n[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s},IE={}.hasOwnProperty;class af extends ME{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=xE()}copy(){const t=new af;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(Tc(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Ic("data",this.frozen),this.namespace[t]=r,this):IE.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ic("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(t,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=al(t),n=this.parser||this.Parser;return Rc("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),Rc("process",this.parser||this.Parser),Mc("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const l=al(t),a=n.parse(l);n.run(a,l,function(h,u,d){if(h||!u||!d)return c(h);const f=u,m=n.stringify(f,d);OE(m)?d.value=m:d.result=m,c(h,d)});function c(h,u){h||!u?o(h):s?s(u):r(void 0,u)}}}processSync(t){let r=!1,n;return this.freeze(),Rc("processSync",this.parser||this.Parser),Mc("processSync",this.compiler||this.Compiler),this.process(t,i),Bm("processSync","process",r),n;function i(s,o){r=!0,Nm(s),n=o}}run(t,r,n){Am(t),this.freeze();const i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?s(void 0,n):new Promise(s);function s(o,l){const a=al(r);i.run(t,a,c);function c(h,u,d){const f=u||t;h?l(h):o?o(f):n(void 0,f,d)}}}runSync(t,r){let n=!1,i;return this.run(t,r,s),Bm("runSync","run",n),i;function s(o,l){Nm(o),i=l,n=!0}}stringify(t,r){this.freeze();const n=al(r),i=this.compiler||this.Compiler;return Mc("stringify",i),Am(t),i(t,n)}use(t,...r){const n=this.attachers,i=this.namespace;if(Ic("use",this.frozen),t!=null)if(typeof t=="function")a(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")a(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[h,...u]=c;a(h,u)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(c.plugins),c.settings&&(i.settings=Tc(!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<n.length;)if(n[u][0]===c){d=u;break}if(d===-1)n.push([c,...h]);else if(h.length>0){let[f,...m]=h;const g=n[d][1];ah(g)&&ah(f)&&(f=Tc(!0,g,f)),n[d]=[c,f,...m]}}}}const AE=new af().freeze();function Rc(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 Ic(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 Am(e){if(!ah(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Bm(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function al(e){return BE(e)?e:new dy(e)}function BE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function OE(e){return typeof e=="string"||jE(e)}function jE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const zE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Om=[],jm={allowDangerousHtml:!0},FE=/^(https?|ircs?|mailto|xmpp)$/i,$E=[{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 Ac(e){const t=HE(e),r=WE(e);return UE(t.runSync(t.parse(r),r),e)}function HE(e){const t=e.rehypePlugins||Om,r=e.remarkPlugins||Om,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...jm}:jm;return AE().use(k2).use(r).use(vE,n).use(t)}function WE(e){const t=e.children||"",r=new dy;return typeof t=="string"&&(r.value=t),r}function UE(e,t){const r=t.allowedElements,n=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||KE;for(const h of $E)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+zE+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Ua(e,c),lk(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 m=h.properties[f],g=Cc[f];(g===null||g.includes(h.tagName))&&(h.properties[f]=a(String(m||""),f,h))}}if(h.type==="element"){let f=r?!r.includes(h.tagName):s?s.includes(h.tagName):!1;if(!f&&n&&typeof u=="number"&&(f=!n(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 KE(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||n!==-1&&t>n||FE.test(e.slice(0,t))?e:""}function zm(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}function VE(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function fy(e,t,r){const i=Ha((r||{}).ignore||[]),s=qE(t);let o=-1;for(;++o<s.length;)uy(e,"text",l);function l(c,h){let u=-1,d;for(;++u<h.length;){const f=h[u],m=d?d.children:void 0;if(i(f,m?m.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 m=0;const x=u.children.indexOf(c);let _=!1,v=[];d.lastIndex=0;let y=d.exec(c.value);for(;y;){const E=y.index,P={index:y.index,input:y.input,stack:[...h,c]};let C=f(...y,P);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?d.lastIndex=E+1:(m!==E&&v.push({type:"text",value:c.value.slice(m,E)}),Array.isArray(C)?v.push(...C):C&&v.push(C),m=E+y[0].length,_=!0),!d.global)break;y=d.exec(c.value)}return _?(m<c.value.length&&v.push({type:"text",value:c.value.slice(m)}),u.children.splice(x,1,...v)):v=[c],x+v.length}}function qE(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let n=-1;for(;++n<r.length;){const i=r[n];t.push([YE(i[0]),XE(i[1])])}return t}function YE(e){return typeof e=="string"?new RegExp(VE(e),"g"):e}function XE(e){return typeof e=="function"?e:function(){return e}}const Bc="phrasing",Oc=["autolink","link","image","label"];function GE(){return{transforms:[n5],enter:{literalAutolink:ZE,literalAutolinkEmail:jc,literalAutolinkHttp:jc,literalAutolinkWww:jc},exit:{literalAutolink:r5,literalAutolinkEmail:t5,literalAutolinkHttp:JE,literalAutolinkWww:e5}}}function QE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Bc,notInConstruct:Oc},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Bc,notInConstruct:Oc},{character:":",before:"[ps]",after:"\\/",inConstruct:Bc,notInConstruct:Oc}]}}function ZE(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function jc(e){this.config.enter.autolinkProtocol.call(this,e)}function JE(e){this.config.exit.autolinkProtocol.call(this,e)}function e5(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 t5(e){this.config.exit.autolinkEmail.call(this,e)}function r5(e){this.exit(e)}function n5(e){fy(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,i5],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),s5]],{ignore:["link","linkReference"]})}function i5(e,t,r,n,i){let s="";if(!py(i)||(/^w/i.test(t)&&(r=t+r,t="",s="http://"),!o5(r)))return!1;const o=l5(r+n);if(!o[0])return!1;const l={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function s5(e,t,r,n){return!py(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function o5(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 l5(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")");const i=zm(e,"(");let s=zm(e,")");for(;n!==-1&&i>s;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),s++;return[e,r]}function py(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||mi(r)||za(r))&&(!t||r!==47)}my.peek=g5;function a5(){this.buffer()}function c5(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function u5(){this.buffer()}function h5(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function d5(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Ir(this.sliceSerialize(e)).toLowerCase(),r.label=t}function f5(e){this.exit(e)}function p5(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Ir(this.sliceSerialize(e)).toLowerCase(),r.label=t}function m5(e){this.exit(e)}function g5(){return"["}function my(e,t,r,n){const i=r.createTracker(n);let s=i.move("[^");const o=r.enter("footnoteReference"),l=r.enter("reference");return s+=i.move(r.safe(r.associationId(e),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function _5(){return{enter:{gfmFootnoteCallString:a5,gfmFootnoteCall:c5,gfmFootnoteDefinitionLabelString:u5,gfmFootnoteDefinition:h5},exit:{gfmFootnoteCallString:d5,gfmFootnoteCall:f5,gfmFootnoteDefinitionLabelString:p5,gfmFootnoteDefinition:m5}}}function v5(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:my},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const l=s.createTracker(o);let a=l.move("[^");const c=s.enter("footnoteDefinition"),h=s.enter("label");return a+=l.move(s.safe(s.associationId(n),{before:a,after:"]"})),h(),a+=l.move("]:"),n.children&&n.children.length>0&&(l.shift(4),a+=l.move((t?`
81
+ `:" ")+s.indentLines(s.containerFlow(n,l.current()),t?gy:y5))),c(),a}}function y5(e,t,r){return t===0?e:gy(e,t,r)}function gy(e,t,r){return(r?"":" ")+e}const x5=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];_y.peek=C5;function S5(){return{canContainEols:["delete"],enter:{strikethrough:b5},exit:{strikethrough:k5}}}function w5(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:x5}],handlers:{delete:_y}}}function b5(e){this.enter({type:"delete",children:[]},e)}function k5(e){this.exit(e)}function _y(e,t,r,n){const i=r.createTracker(n),s=r.enter("strikethrough");let o=i.move("~~");return o+=r.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function C5(){return"~"}function E5(e){return e.length}function N5(e,t){const r=t||{},n=(r.align||[]).concat(),i=r.stringLength||E5,s=[],o=[],l=[],a=[];let c=0,h=-1;for(;++h<e.length;){const g=[],x=[];let _=-1;for(e[h].length>c&&(c=e[h].length);++_<e[h].length;){const v=T5(e[h][_]);if(r.alignDelimiters!==!1){const y=i(v);x[_]=y,(a[_]===void 0||y>a[_])&&(a[_]=y)}g.push(v)}o[h]=g,l[h]=x}let u=-1;if(typeof n=="object"&&"length"in n)for(;++u<c;)s[u]=Fm(n[u]);else{const g=Fm(n);for(;++u<c;)s[u]=g}u=-1;const d=[],f=[];for(;++u<c;){const g=s[u];let x="",_="";g===99?(x=":",_=":"):g===108?x=":":g===114&&(_=":");let v=r.alignDelimiters===!1?1:Math.max(1,a[u]-x.length-_.length);const y=x+"-".repeat(v)+_;r.alignDelimiters!==!1&&(v=x.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 m=[];for(;++h<o.length;){const g=o[h],x=l[h];u=-1;const _=[];for(;++u<c;){const v=g[u]||"";let y="",E="";if(r.alignDelimiters!==!1){const P=a[u]-(x[u]||0),C=s[u];C===114?y=" ".repeat(P):C===99?P%2?(y=" ".repeat(P/2+.5),E=" ".repeat(P/2-.5)):(y=" ".repeat(P/2),E=y):E=" ".repeat(P)}r.delimiterStart!==!1&&!u&&_.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&v==="")&&(r.delimiterStart!==!1||u)&&_.push(" "),r.alignDelimiters!==!1&&_.push(y),_.push(v),r.alignDelimiters!==!1&&_.push(E),r.padding!==!1&&_.push(" "),(r.delimiterEnd!==!1||u!==c-1)&&_.push("|")}m.push(r.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return m.join(`
82
+ `)}function T5(e){return e==null?"":String(e)}function Fm(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 P5(e,t,r,n){const i=r.enter("blockquote"),s=r.createTracker(n);s.move("> "),s.shift(2);const o=r.indentLines(r.containerFlow(e,s.current()),L5);return i(),o}function L5(e,t,r){return">"+(r?"":" ")+e}function D5(e,t){return $m(e,t.inConstruct,!0)&&!$m(e,t.notInConstruct,!1)}function $m(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let n=-1;for(;++n<t.length;)if(e.includes(t[n]))return!0;return!1}function Hm(e,t,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
83
+ `&&D5(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
84
+ `}function R5(e,t){const r=String(e);let n=r.indexOf(t),i=n,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;n!==-1;)n===i?++s>o&&(o=s):s=1,i=n+t.length,n=r.indexOf(t,i);return o}function M5(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 I5(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 A5(e,t,r,n){const i=I5(r),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(M5(e,r)){const u=r.enter("codeIndented"),d=r.indentLines(s,B5);return u(),d}const l=r.createTracker(n),a=i.repeat(Math.max(R5(s,i)+1,3)),c=r.enter("codeFenced");let h=l.move(a);if(e.lang){const u=r.enter(`codeFencedLang${o}`);h+=l.move(r.safe(e.lang,{before:h,after:" ",encode:["`"],...l.current()})),u()}if(e.lang&&e.meta){const u=r.enter(`codeFencedMeta${o}`);h+=l.move(" "),h+=l.move(r.safe(e.meta,{before:h,after:`
85
85
  `,encode:["`"],...l.current()})),u()}return h+=l.move(`
86
86
  `),s&&(h+=l.move(s+`
87
- `)),h+=l.move(a),c(),h}function C5(e,t,r){return(r?"":" ")+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 E5(e,t,r,n){const i=cf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let l=r.enter("label");const a=r.createTracker(n);let c=a.move("[");return c+=a.move(r.safe(r.associationId(e),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(r.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=r.enter("destinationRaw"),c+=a.move(r.safe(e.url,{before:c,after:e.title?" ":`
88
- `,...a.current()}))),l(),e.title&&(l=r.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(r.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),o(),c}function T5(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 wo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ma(e,t,r){const n=ns(e),i=ns(t);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ay.peek=N5;function ay(e,t,r,n){const i=T5(r),s=r.enter("emphasis"),o=r.createTracker(n),l=o.move(i);let a=o.move(r.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),h=ma(n.before.charCodeAt(n.before.length-1),c,i);h.inside&&(a=wo(c)+a.slice(1));const u=a.charCodeAt(a.length-1),d=ma(n.after.charCodeAt(0),u,i);d.inside&&(a=a.slice(0,-1)+wo(u));const f=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},l+a+f}function N5(e,t,r){return r.options.emphasis||"*"}function P5(e,t){let r=!1;return Va(e,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,oh}),!!((!e.depth||e.depth<3)&&ef(e)&&(t.options.setext||r))}function L5(e,t,r,n){const i=Math.max(Math.min(6,e.depth||1),1),s=r.createTracker(n);if(P5(e,r)){const h=r.enter("headingSetext"),u=r.enter("phrasing"),d=r.containerPhrasing(e,{...s.current(),before:`
87
+ `)),h+=l.move(a),c(),h}function B5(e,t,r){return(r?"":" ")+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 O5(e,t,r,n){const i=cf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let l=r.enter("label");const a=r.createTracker(n);let c=a.move("[");return c+=a.move(r.safe(r.associationId(e),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(r.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=r.enter("destinationRaw"),c+=a.move(r.safe(e.url,{before:c,after:e.title?" ":`
88
+ `,...a.current()}))),l(),e.title&&(l=r.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(r.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),o(),c}function j5(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 wo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function fa(e,t,r){const n=ns(e),i=ns(t);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}vy.peek=z5;function vy(e,t,r,n){const i=j5(r),s=r.enter("emphasis"),o=r.createTracker(n),l=o.move(i);let a=o.move(r.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),h=fa(n.before.charCodeAt(n.before.length-1),c,i);h.inside&&(a=wo(c)+a.slice(1));const u=a.charCodeAt(a.length-1),d=fa(n.after.charCodeAt(0),u,i);d.inside&&(a=a.slice(0,-1)+wo(u));const f=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},l+a+f}function z5(e,t,r){return r.options.emphasis||"*"}function F5(e,t){let r=!1;return Ua(e,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,oh}),!!((!e.depth||e.depth<3)&&ef(e)&&(t.options.setext||r))}function $5(e,t,r,n){const i=Math.max(Math.min(6,e.depth||1),1),s=r.createTracker(n);if(F5(e,r)){const h=r.enter("headingSetext"),u=r.enter("phrasing"),d=r.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=r.enter("headingAtx"),a=r.enter("phrasing");s.move(o+" ");let c=r.containerPhrasing(e,{before:"# ",after:`
93
- `,...s.current()});return/^[\t ]/.test(c)&&(c=wo(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),a(),l(),c}cy.peek=R5;function cy(e){return e.value||""}function R5(){return"<"}uy.peek=D5;function uy(e,t,r,n){const i=cf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let l=r.enter("label");const a=r.createTracker(n);let c=a.move("![");return c+=a.move(r.safe(e.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(r.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=r.enter("destinationRaw"),c+=a.move(r.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=r.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(r.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),o(),c}function D5(){return"!"}hy.peek=M5;function hy(e,t,r,n){const i=e.referenceType,s=r.enter("imageReference");let o=r.enter("label");const l=r.createTracker(n);let a=l.move("![");const c=r.safe(e.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const h=r.stack;r.stack=[],o=r.enter("reference");const u=r.safe(r.associationId(e),{before:a,after:"]",...l.current()});return o(),r.stack=h,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function M5(){return"!"}dy.peek=I5;function dy(e,t,r){let n=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s<r.unsafe.length;){const o=r.unsafe[s],l=r.compilePattern(o);let a;if(o.atBreak)for(;a=l.exec(n);){let c=a.index;n.charCodeAt(c)===10&&n.charCodeAt(c-1)===13&&c--,n=n.slice(0,c)+" "+n.slice(a.index+1)}}return i+n+i}function I5(){return"`"}function fy(e,t){const r=ef(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}py.peek=A5;function py(e,t,r,n){const i=cf(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let l,a;if(fy(e,r)){const h=r.stack;r.stack=[],l=r.enter("autolink");let u=o.move("<");return u+=o.move(r.containerPhrasing(e,{before:u,after:">",...o.current()})),u+=o.move(">"),l(),r.stack=h,u}l=r.enter("link"),a=r.enter("label");let c=o.move("[");return c+=o.move(r.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=r.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(r.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(a=r.enter("destinationRaw"),c+=o.move(r.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),a(),e.title&&(a=r.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(r.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),a()),c+=o.move(")"),l(),c}function A5(e,t,r){return fy(e,r)?"<":"["}my.peek=B5;function my(e,t,r,n){const i=e.referenceType,s=r.enter("linkReference");let o=r.enter("label");const l=r.createTracker(n);let a=l.move("[");const c=r.containerPhrasing(e,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const h=r.stack;r.stack=[],o=r.enter("reference");const u=r.safe(r.associationId(e),{before:a,after:"]",...l.current()});return o(),r.stack=h,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function 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 O5(e){const t=uf(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function j5(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 gy(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 z5(e,t,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=e.ordered?j5(r):uf(r);const l=e.ordered?o==="."?")":".":O5(r);let a=t&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&h&&(!h.children||!h.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(a=!0),gy(r)===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),r.bulletCurrent=o;const c=r.containerFlow(e,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),c}function F5(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 $5(e,t,r,n){const i=F5(r);let s=r.bulletCurrent||uf(r);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=r.createTracker(n);l.move(s+" ".repeat(o-s.length)),l.shift(o);const a=r.enter("listItem"),c=r.indentLines(r.containerFlow(e,l.current()),h);return a(),c;function h(u,d,f){return d?(f?"":" ".repeat(o))+u:(f?s:s+" ".repeat(o-s.length))+u}}function H5(e,t,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(e,n);return s(),i(),o}const W5=Ua(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function U5(e,t,r,n){return(e.children.some(function(o){return W5(o)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function K5(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}_y.peek=V5;function _y(e,t,r,n){const i=K5(r),s=r.enter("strong"),o=r.createTracker(n),l=o.move(i+i);let a=o.move(r.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),h=ma(n.before.charCodeAt(n.before.length-1),c,i);h.inside&&(a=wo(c)+a.slice(1));const u=a.charCodeAt(a.length-1),d=ma(n.after.charCodeAt(0),u,i);d.inside&&(a=a.slice(0,-1)+wo(u));const f=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},l+a+f}function V5(e,t,r){return r.options.strong||"*"}function q5(e,t,r,n){return r.safe(e.value,n)}function Y5(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 X5(e,t,r){const n=(gy(r)+(r.options.ruleSpaces?" ":"")).repeat(Y5(r));return r.options.ruleSpaces?n.slice(0,-1):n}const vy={blockquote:v5,break:Mm,code:k5,definition:E5,emphasis:ay,hardBreak:Mm,heading:L5,html:cy,image:uy,imageReference:hy,inlineCode:dy,link:py,linkReference:my,list:z5,listItem:$5,paragraph:H5,root:U5,strong:_y,text:q5,thematicBreak:X5};function G5(){return{enter:{table:Q5,tableData:Im,tableHeader:Im,tableRow:J5},exit:{codeText:eT,table:Z5,tableData:zc,tableHeader:zc,tableRow:zc}}}function Q5(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function Z5(e){this.exit(e),this.data.inTable=void 0}function J5(e){this.enter({type:"tableRow",children:[]},e)}function zc(e){this.exit(e)}function Im(e){this.enter({type:"tableCell",children:[]},e)}function eT(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,tT));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function tT(e,t){return t==="|"?t:e}function rT(e){const t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
93
+ `,...s.current()});return/^[\t ]/.test(c)&&(c=wo(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),a(),l(),c}yy.peek=H5;function yy(e){return e.value||""}function H5(){return"<"}xy.peek=W5;function xy(e,t,r,n){const i=cf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let l=r.enter("label");const a=r.createTracker(n);let c=a.move("![");return c+=a.move(r.safe(e.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(r.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=r.enter("destinationRaw"),c+=a.move(r.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=r.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(r.safe(e.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),o(),c}function W5(){return"!"}Sy.peek=U5;function Sy(e,t,r,n){const i=e.referenceType,s=r.enter("imageReference");let o=r.enter("label");const l=r.createTracker(n);let a=l.move("![");const c=r.safe(e.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const h=r.stack;r.stack=[],o=r.enter("reference");const u=r.safe(r.associationId(e),{before:a,after:"]",...l.current()});return o(),r.stack=h,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function U5(){return"!"}wy.peek=K5;function wy(e,t,r){let n=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++s<r.unsafe.length;){const o=r.unsafe[s],l=r.compilePattern(o);let a;if(o.atBreak)for(;a=l.exec(n);){let c=a.index;n.charCodeAt(c)===10&&n.charCodeAt(c-1)===13&&c--,n=n.slice(0,c)+" "+n.slice(a.index+1)}}return i+n+i}function K5(){return"`"}function by(e,t){const r=ef(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}ky.peek=V5;function ky(e,t,r,n){const i=cf(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let l,a;if(by(e,r)){const h=r.stack;r.stack=[],l=r.enter("autolink");let u=o.move("<");return u+=o.move(r.containerPhrasing(e,{before:u,after:">",...o.current()})),u+=o.move(">"),l(),r.stack=h,u}l=r.enter("link"),a=r.enter("label");let c=o.move("[");return c+=o.move(r.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=r.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(r.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(a=r.enter("destinationRaw"),c+=o.move(r.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),a(),e.title&&(a=r.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(r.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),a()),c+=o.move(")"),l(),c}function V5(e,t,r){return by(e,r)?"<":"["}Cy.peek=q5;function Cy(e,t,r,n){const i=e.referenceType,s=r.enter("linkReference");let o=r.enter("label");const l=r.createTracker(n);let a=l.move("[");const c=r.containerPhrasing(e,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const h=r.stack;r.stack=[],o=r.enter("reference");const u=r.safe(r.associationId(e),{before:a,after:"]",...l.current()});return o(),r.stack=h,s(),i==="full"||!c||c!==u?a+=l.move(u+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function q5(){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 Y5(e){const t=uf(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function X5(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 Ey(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 G5(e,t,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=e.ordered?X5(r):uf(r);const l=e.ordered?o==="."?")":".":Y5(r);let a=t&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&h&&(!h.children||!h.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(a=!0),Ey(r)===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),r.bulletCurrent=o;const c=r.containerFlow(e,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),c}function Q5(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 Z5(e,t,r,n){const i=Q5(r);let s=r.bulletCurrent||uf(r);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=r.createTracker(n);l.move(s+" ".repeat(o-s.length)),l.shift(o);const a=r.enter("listItem"),c=r.indentLines(r.containerFlow(e,l.current()),h);return a(),c;function h(u,d,f){return d?(f?"":" ".repeat(o))+u:(f?s:s+" ".repeat(o-s.length))+u}}function J5(e,t,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(e,n);return s(),i(),o}const eN=Ha(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function tN(e,t,r,n){return(e.children.some(function(o){return eN(o)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function rN(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ny.peek=nN;function Ny(e,t,r,n){const i=rN(r),s=r.enter("strong"),o=r.createTracker(n),l=o.move(i+i);let a=o.move(r.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),h=fa(n.before.charCodeAt(n.before.length-1),c,i);h.inside&&(a=wo(c)+a.slice(1));const u=a.charCodeAt(a.length-1),d=fa(n.after.charCodeAt(0),u,i);d.inside&&(a=a.slice(0,-1)+wo(u));const f=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},l+a+f}function nN(e,t,r){return r.options.strong||"*"}function iN(e,t,r,n){return r.safe(e.value,n)}function sN(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 oN(e,t,r){const n=(Ey(r)+(r.options.ruleSpaces?" ":"")).repeat(sN(r));return r.options.ruleSpaces?n.slice(0,-1):n}const Ty={blockquote:P5,break:Hm,code:A5,definition:O5,emphasis:vy,hardBreak:Hm,heading:$5,html:yy,image:xy,imageReference:Sy,inlineCode:wy,link:ky,linkReference:Cy,list:G5,listItem:Z5,paragraph:J5,root:tN,strong:Ny,text:iN,thematicBreak:oN};function lN(){return{enter:{table:aN,tableData:Wm,tableHeader:Wm,tableRow:uN},exit:{codeText:hN,table:cN,tableData:zc,tableHeader:zc,tableRow:zc}}}function aN(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function cN(e){this.exit(e),this.data.inTable=void 0}function uN(e){this.enter({type:"tableRow",children:[]},e)}function zc(e){this.exit(e)}function Wm(e){this.enter({type:"tableCell",children:[]},e)}function hN(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,dN));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function dN(e,t){return t==="|"?t:e}function fN(e){const t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
94
94
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:d,table:o,tableCell:a,tableRow:l}};function o(f,m,g,x){return c(h(f,g,x),f.align)}function l(f,m,g,x){const _=u(f,g,x),v=c([_]);return v.slice(0,v.indexOf(`
95
- `))}function a(f,m,g,x){const _=g.enter("tableCell"),v=g.enter("phrasing"),y=g.containerPhrasing(f,{...x,before:s,after:s});return v(),_(),y}function c(f,m){return g5(f,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function h(f,m,g){const x=f.children;let _=-1;const v=[],y=m.enter("table");for(;++_<x.length;)v[_]=u(x[_],m,g);return y(),v}function u(f,m,g){const x=f.children;let _=-1;const v=[],y=m.enter("tableRow");for(;++_<x.length;)v[_]=a(x[_],f,m,g);return y(),v}function d(f,m,g){let x=vy.inlineCode(f,m,g);return g.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function nT(){return{exit:{taskListCheckValueChecked:Am,taskListCheckValueUnchecked:Am,paragraph:sT}}}function iT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:oT}}}function Am(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function sT(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const l=i[s];if(l.type==="paragraph"){o=l;break}}o===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function oT(e,t,r,n){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=r.createTracker(n);s&&l.move(o);let a=vy.listItem(e,t,r,{...n,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(h){return h+o}}function lT(){return[zE(),o5(),u5(),G5(),nT()]}function aT(e){return{extensions:[FE(),l5(e),h5(),rT(e),iT()]}}const cT={tokenize:mT,partial:!0},yy={tokenize:gT,partial:!0},xy={tokenize:_T,partial:!0},Sy={tokenize:vT,partial:!0},uT={tokenize:yT,partial:!0},wy={name:"wwwAutolink",tokenize:fT,previous:ky},by={name:"protocolAutolink",tokenize:pT,previous:Cy},fn={name:"emailAutolink",tokenize:dT,previous:Ey},Qr={};function hT(){return{text:Qr}}let qn=48;for(;qn<123;)Qr[qn]=fn,qn++,qn===58?qn=65:qn===91&&(qn=97);Qr[43]=fn;Qr[45]=fn;Qr[46]=fn;Qr[95]=fn;Qr[72]=[fn,by];Qr[104]=[fn,by];Qr[87]=[fn,wy];Qr[119]=[fn,wy];function dT(e,t,r){const n=this;let i,s;return o;function o(u){return!uh(u)||!Ey.call(n,n.previous)||hf(n.events)?r(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):r(u)}function a(u){return u===46?e.check(uT,h,c)(u):u===45||u===95||It(u)?(s=!0,e.consume(u),a):h(u)}function c(u){return e.consume(u),i=!0,a}function h(u){return s&&i&&$t(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(u)):r(u)}}function fT(e,t,r){const n=this;return i;function i(o){return o!==87&&o!==119||!ky.call(n,n.previous)||hf(n.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(cT,e.attempt(yy,e.attempt(xy,s),r),r)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function pT(e,t,r){const n=this;let i="",s=!1;return o;function o(u){return(u===72||u===104)&&Cy.call(n,n.previous)&&!hf(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(u),e.consume(u),l):r(u)}function l(u){if($t(u)&&i.length<5)return i+=String.fromCodePoint(u),e.consume(u),l;if(u===58){const d=i.toLowerCase();if(d==="http"||d==="https")return e.consume(u),a}return r(u)}function a(u){return u===47?(e.consume(u),s?c:(s=!0,a)):r(u)}function c(u){return u===null||da(u)||Ae(u)||gi(u)||$a(u)?r(u):e.attempt(yy,e.attempt(xy,h),r)(u)}function h(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(u)}}function mT(e,t,r){let n=0;return i;function i(o){return(o===87||o===119)&&n<3?(n++,e.consume(o),i):o===46&&n===3?(e.consume(o),s):r(o)}function s(o){return o===null?r(o):t(o)}}function gT(e,t,r){let n,i,s;return o;function o(c){return c===46||c===95?e.check(Sy,a,l)(c):c===null||Ae(c)||gi(c)||c!==45&&$a(c)?a(c):(s=!0,e.consume(c),o)}function l(c){return c===95?n=!0:(i=n,n=void 0),e.consume(c),o}function a(c){return i||n||!s?r(c):t(c)}}function _T(e,t){let r=0,n=0;return i;function i(o){return o===40?(r++,e.consume(o),i):o===41&&n<r?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Sy,t,s)(o):o===null||Ae(o)||gi(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&n++,e.consume(o),i}}function vT(e,t,r){return n;function n(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),n):l===38?(e.consume(l),s):l===93?(e.consume(l),i):l===60||l===null||Ae(l)||gi(l)?t(l):r(l)}function i(l){return l===null||l===40||l===91||Ae(l)||gi(l)?t(l):n(l)}function s(l){return $t(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),n):$t(l)?(e.consume(l),o):r(l)}}function yT(e,t,r){return n;function n(s){return e.consume(s),i}function i(s){return It(s)?r(s):t(s)}}function ky(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ae(e)}function Cy(e){return!$t(e)}function Ey(e){return!(e===47||uh(e))}function uh(e){return e===43||e===45||e===46||e===95||It(e)}function hf(e){let t=e.length,r=!1;for(;t--;){const n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const xT={tokenize:NT,partial:!0};function ST(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:CT,continuation:{tokenize:ET},exit:TT}},text:{91:{name:"gfmFootnoteCall",tokenize:kT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:wT,resolveTo:bT}}}}function wT(e,t,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const a=n.events[i][1];if(a.type==="labelImage"){o=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return l;function l(a){if(!o||!o._balanced)return r(a);const c=Ar(n.sliceSerialize({start:o.end,end:n.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?r(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function bT(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...l),e}function kT(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return l;function l(u){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),a}function a(u){return u!==94?r(u):(e.enter("gfmFootnoteCallMarker"),e.consume(u),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(u){if(s>999||u===93&&!o||u===null||u===91||Ae(u))return r(u);if(u===93){e.exit("chunkString");const d=e.exit("gfmFootnoteCallString");return i.includes(Ar(n.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(u)}return Ae(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 CT(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,l;return a;function a(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):r(m)}function h(m){if(o>999||m===93&&!l||m===null||m===91||Ae(m))return r(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=Ar(n.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return Ae(m)||(l=!0),o++,e.consume(m),m===92?u:h}function u(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}function d(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),Le(e,f,"gfmFootnoteDefinitionWhitespace")):r(m)}function f(m){return t(m)}}function ET(e,t,r){return e.check(Ao,t,e.attempt(xT,t,r))}function TT(e){e.exit("gfmFootnoteDefinition")}function NT(e,t,r){const n=this;return Le(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):r(s)}}function PT(e){let r=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(o,l){let a=-1;for(;++a<o.length;)if(o[a][0]==="enter"&&o[a][1].type==="strikethroughSequenceTemporary"&&o[a][1]._close){let c=a;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[a][1].end.offset-o[a][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[a][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[a][1].end)},u={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[a][1].start)},d=[["enter",h,l],["enter",o[c][1],l],["exit",o[c][1],l],["enter",u,l]],f=l.parser.constructs.insideSpan.null;f&&hr(d,d.length,0,Ha(f,o.slice(c+1,a),l)),hr(d,d.length,0,[["exit",u,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",h,l]]),hr(o,c-1,a-c+3,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(m){return c===126&&h[h.length-1][1].type!=="characterEscape"?a(m):(o.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const g=ns(c);if(m===126)return u>1?a(m):(o.consume(m),u++,f);if(u<2&&!r)return a(m);const x=o.exit("strikethroughSequenceTemporary"),_=ns(m);return x._open=!_||_===2&&!!g,x._close=!g||g===2&&!!_,l(m)}}}class LT{constructor(){this.map=[]}add(t,r,n){RT(this,t,r,n)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];n.push(t.slice()),t.length=0;let i=n.pop();for(;i;){for(const s of i)t.push(s);i=n.pop()}this.map.length=0}}function RT(e,t,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=r,e.map[i][2].push(...n);return}i+=1}e.map.push([t,r,n])}}function DT(e,t){let r=!1;const n=[];for(;t<e.length;){const i=e[t];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=n.length-1;n[s]=n[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return n}function MT(){return{flow:{null:{name:"table",tokenize:IT,resolveAll:AT}}}}function IT(e,t,r){const n=this;let i=0,s=0,o;return l;function l(T){let R=n.events.length-1;for(;R>-1;){const U=n.events[R][1].type;if(U==="lineEnding"||U==="linePrefix")R--;else break}const A=R>-1?n.events[R][1].type:null,D=A==="tableHead"||A==="tableRow"?k:a;return D===k&&n.parser.lazy[n.now().line]?r(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?r(T):_e(T)?s>1?(s=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),f):r(T):Ne(T)?Le(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||Ae(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 n.interrupt=!1,n.parser.lazy[n.now().line]?r(T):(e.enter("tableDelimiterRow"),o=!1,Ne(T)?Le(e,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):m(T))}function m(T){return T===45||T===58?x(T):T===124?(o=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),g):N(T)}function g(T){return Ne(T)?Le(e,x,"whitespace")(T):x(T)}function x(T){return T===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),_):T===45?(s+=1,_(T)):T===null||_e(T)?E(T):N(T)}function _(T){return T===45?(e.enter("tableDelimiterFiller"),v(T)):N(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 Ne(T)?Le(e,E,"whitespace")(T):E(T)}function E(T){return T===124?m(T):T===null||_e(T)?!o||i!==s?N(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):N(T)}function N(T){return r(T)}function k(T){return e.enter("tableRow"),I(T)}function I(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),I):T===null||_e(T)?(e.exit("tableRow"),t(T)):Ne(T)?Le(e,I,"whitespace")(T):(e.enter("data"),z(T))}function z(T){return T===null||T===124||Ae(T)?(e.exit("data"),I(T)):(e.consume(T),T===92?Z:z)}function Z(T){return T===92||T===124?(e.consume(T),z):z(T)}}function AT(e,t){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,a=0,c,h,u;const d=new LT;for(;++r<e.length;){const f=e[r],m=f[1];f[0]==="enter"?m.type==="tableHead"?(l=!1,a!==0&&(Bm(d,t,a,c,h),h=void 0,a=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},d.add(r,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,u=void 0,s=[0,0,0,0],o=[0,r+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},d.add(r,0,[["enter",h,t]])),i=m.type==="tableDelimiterRow"?2:h?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],u=hl(d,t,s,i,void 0,u),s=[0,0,0,0]),o[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],u=hl(d,t,s,i,void 0,u)),s=o,o=[s[1],r,0,0])):m.type==="tableHead"?(l=!0,a=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(a=r,s[1]!==0?(o[0]=o[1],u=hl(d,t,s,i,r,u)):o[1]!==0&&(u=hl(d,t,o,i,r,u)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(a!==0&&Bm(d,t,a,c,h),d.consume(t.events),r=-1;++r<t.events.length;){const f=t.events[r];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=DT(t.events,r))}return e}function hl(e,t,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(s.end=Object.assign({},Pi(t.events,r[0])),e.add(r[0],0,[["exit",s,t]]));const a=Pi(t.events,r[1]);if(s={type:o,start:Object.assign({},a),end:Object.assign({},a)},e.add(r[1],0,[["enter",s,t]]),r[2]!==0){const c=Pi(t.events,r[2]),h=Pi(t.events,r[3]),u={type:l,start:Object.assign({},c),end:Object.assign({},h)};if(e.add(r[2],0,[["enter",u,t]]),n!==2){const d=t.events[r[2]],f=t.events[r[3]];if(d[1].end=Object.assign({},f[1].end),d[1].type="chunkText",d[1].contentType="text",r[3]>r[2]+1){const m=r[2]+1,g=r[3]-r[2]-1;e.add(m,g,[])}}e.add(r[3]+1,0,[["exit",u,t]])}return i!==void 0&&(s.end=Object.assign({},Pi(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Bm(e,t,r,n,i){const s=[],o=Pi(t.events,r);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),n.end=Object.assign({},o),s.push(["exit",n,t]),e.add(r+1,0,s)}function Pi(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const BT={name:"tasklistCheck",tokenize:jT};function OT(){return{text:{91:BT}}}function jT(e,t,r){const n=this;return i;function i(a){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),s)}function s(a){return Ae(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),o):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),o):r(a)}function o(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):r(a)}function l(a){return _e(a)?t(a):Ne(a)?e.check({tokenize:zT},t,r)(a):r(a)}}function zT(e,t,r){return Le(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function FT(e){return A0([hT(),ST(),PT(e),MT(),OT()])}const $T={};function Fc(e){const t=this,r=e||$T,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(FT(r)),s.push(lT()),o.push(aT(r))}const HT=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,WT=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,Om=({legacyTitle:e=!1,tagName:t="div"}={})=>r=>{Va(r,"blockquote",(n,i,s)=>{let o="",l="",a=!0,c=n.children.map(h=>{if(a&&h.type==="paragraph"){const u=h.children[0],d=u.type==="text"?u.value:"",f=e?WT:HT,m=d.match(f);if(m&&(a=!1,o=m[1].toLocaleLowerCase(),l=e&&m[2]||o.toLocaleUpperCase(),d.includes(`
95
+ `))}function a(f,m,g,x){const _=g.enter("tableCell"),v=g.enter("phrasing"),y=g.containerPhrasing(f,{...x,before:s,after:s});return v(),_(),y}function c(f,m){return N5(f,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function h(f,m,g){const x=f.children;let _=-1;const v=[],y=m.enter("table");for(;++_<x.length;)v[_]=u(x[_],m,g);return y(),v}function u(f,m,g){const x=f.children;let _=-1;const v=[],y=m.enter("tableRow");for(;++_<x.length;)v[_]=a(x[_],f,m,g);return y(),v}function d(f,m,g){let x=Ty.inlineCode(f,m,g);return g.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function pN(){return{exit:{taskListCheckValueChecked:Um,taskListCheckValueUnchecked:Um,paragraph:gN}}}function mN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:_N}}}function Um(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function gN(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const n=r.children[0];if(n&&n.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const l=i[s];if(l.type==="paragraph"){o=l;break}}o===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function _N(e,t,r,n){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=r.createTracker(n);s&&l.move(o);let a=Ty.listItem(e,t,r,{...n,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(h){return h+o}}function vN(){return[GE(),_5(),S5(),lN(),pN()]}function yN(e){return{extensions:[QE(),v5(e),w5(),fN(e),mN()]}}const xN={tokenize:EN,partial:!0},Py={tokenize:NN,partial:!0},Ly={tokenize:TN,partial:!0},Dy={tokenize:PN,partial:!0},SN={tokenize:LN,partial:!0},Ry={name:"wwwAutolink",tokenize:kN,previous:Iy},My={name:"protocolAutolink",tokenize:CN,previous:Ay},dn={name:"emailAutolink",tokenize:bN,previous:By},Qr={};function wN(){return{text:Qr}}let Vn=48;for(;Vn<123;)Qr[Vn]=dn,Vn++,Vn===58?Vn=65:Vn===91&&(Vn=97);Qr[43]=dn;Qr[45]=dn;Qr[46]=dn;Qr[95]=dn;Qr[72]=[dn,My];Qr[104]=[dn,My];Qr[87]=[dn,Ry];Qr[119]=[dn,Ry];function bN(e,t,r){const n=this;let i,s;return o;function o(u){return!uh(u)||!By.call(n,n.previous)||hf(n.events)?r(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):r(u)}function a(u){return u===46?e.check(SN,h,c)(u):u===45||u===95||Rt(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&&jt(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(u)):r(u)}}function kN(e,t,r){const n=this;return i;function i(o){return o!==87&&o!==119||!Iy.call(n,n.previous)||hf(n.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(xN,e.attempt(Py,e.attempt(Ly,s),r),r)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function CN(e,t,r){const n=this;let i="",s=!1;return o;function o(u){return(u===72||u===104)&&Ay.call(n,n.previous)&&!hf(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(u),e.consume(u),l):r(u)}function l(u){if(jt(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 r(u)}function a(u){return u===47?(e.consume(u),s?c:(s=!0,a)):r(u)}function c(u){return u===null||ua(u)||Ae(u)||mi(u)||za(u)?r(u):e.attempt(Py,e.attempt(Ly,h),r)(u)}function h(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(u)}}function EN(e,t,r){let n=0;return i;function i(o){return(o===87||o===119)&&n<3?(n++,e.consume(o),i):o===46&&n===3?(e.consume(o),s):r(o)}function s(o){return o===null?r(o):t(o)}}function NN(e,t,r){let n,i,s;return o;function o(c){return c===46||c===95?e.check(Dy,a,l)(c):c===null||Ae(c)||mi(c)||c!==45&&za(c)?a(c):(s=!0,e.consume(c),o)}function l(c){return c===95?n=!0:(i=n,n=void 0),e.consume(c),o}function a(c){return i||n||!s?r(c):t(c)}}function TN(e,t){let r=0,n=0;return i;function i(o){return o===40?(r++,e.consume(o),i):o===41&&n<r?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Dy,t,s)(o):o===null||Ae(o)||mi(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&n++,e.consume(o),i}}function PN(e,t,r){return n;function n(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),n):l===38?(e.consume(l),s):l===93?(e.consume(l),i):l===60||l===null||Ae(l)||mi(l)?t(l):r(l)}function i(l){return l===null||l===40||l===91||Ae(l)||mi(l)?t(l):n(l)}function s(l){return jt(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),n):jt(l)?(e.consume(l),o):r(l)}}function LN(e,t,r){return n;function n(s){return e.consume(s),i}function i(s){return Rt(s)?r(s):t(s)}}function Iy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ae(e)}function Ay(e){return!jt(e)}function By(e){return!(e===47||uh(e))}function uh(e){return e===43||e===45||e===46||e===95||Rt(e)}function hf(e){let t=e.length,r=!1;for(;t--;){const n=e[t][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const DN={tokenize:zN,partial:!0};function RN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:BN,continuation:{tokenize:ON},exit:jN}},text:{91:{name:"gfmFootnoteCall",tokenize:AN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:MN,resolveTo:IN}}}}function MN(e,t,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const a=n.events[i][1];if(a.type==="labelImage"){o=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return l;function l(a){if(!o||!o._balanced)return r(a);const c=Ir(n.sliceSerialize({start:o.end,end:n.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?r(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function IN(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...l),e}function AN(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s=0,o;return l;function l(u){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),a}function a(u){return u!==94?r(u):(e.enter("gfmFootnoteCallMarker"),e.consume(u),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(u){if(s>999||u===93&&!o||u===null||u===91||Ae(u))return r(u);if(u===93){e.exit("chunkString");const d=e.exit("gfmFootnoteCallString");return i.includes(Ir(n.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(u)}return Ae(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 BN(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,l;return a;function a(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):r(m)}function h(m){if(o>999||m===93&&!l||m===null||m===91||Ae(m))return r(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=Ir(n.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return Ae(m)||(l=!0),o++,e.consume(m),m===92?u:h}function u(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}function d(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),Pe(e,f,"gfmFootnoteDefinitionWhitespace")):r(m)}function f(m){return t(m)}}function ON(e,t,r){return e.check(Ao,t,e.attempt(DN,t,r))}function jN(e){e.exit("gfmFootnoteDefinition")}function zN(e,t,r){const n=this;return Pe(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=n.events[n.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):r(s)}}function FN(e){let r=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(o,l){let a=-1;for(;++a<o.length;)if(o[a][0]==="enter"&&o[a][1].type==="strikethroughSequenceTemporary"&&o[a][1]._close){let c=a;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[a][1].end.offset-o[a][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[a][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[a][1].end)},u={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[a][1].start)},d=[["enter",h,l],["enter",o[c][1],l],["exit",o[c][1],l],["enter",u,l]],f=l.parser.constructs.insideSpan.null;f&&or(d,d.length,0,Fa(f,o.slice(c+1,a),l)),or(d,d.length,0,[["exit",u,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",h,l]]),or(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(m){return c===126&&h[h.length-1][1].type!=="characterEscape"?a(m):(o.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const g=ns(c);if(m===126)return u>1?a(m):(o.consume(m),u++,f);if(u<2&&!r)return a(m);const x=o.exit("strikethroughSequenceTemporary"),_=ns(m);return x._open=!_||_===2&&!!g,x._close=!g||g===2&&!!_,l(m)}}}class $N{constructor(){this.map=[]}add(t,r,n){HN(this,t,r,n)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];n.push(t.slice()),t.length=0;let i=n.pop();for(;i;){for(const s of i)t.push(s);i=n.pop()}this.map.length=0}}function HN(e,t,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=r,e.map[i][2].push(...n);return}i+=1}e.map.push([t,r,n])}}function WN(e,t){let r=!1;const n=[];for(;t<e.length;){const i=e[t];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=n.length-1;n[s]=n[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return n}function UN(){return{flow:{null:{name:"table",tokenize:KN,resolveAll:VN}}}}function KN(e,t,r){const n=this;let i=0,s=0,o;return l;function l(N){let D=n.events.length-1;for(;D>-1;){const W=n.events[D][1].type;if(W==="lineEnding"||W==="linePrefix")D--;else break}const I=D>-1?n.events[D][1].type:null,R=I==="tableHead"||I==="tableRow"?C:a;return R===C&&n.parser.lazy[n.now().line]?r(N):R(N)}function a(N){return e.enter("tableHead"),e.enter("tableRow"),c(N)}function c(N){return N===124||(o=!0,s+=1),h(N)}function h(N){return N===null?r(N):_e(N)?s>1?(s=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),f):r(N):Ne(N)?Pe(e,h,"whitespace")(N):(s+=1,o&&(o=!1,i+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),u(N)))}function u(N){return N===null||N===124||Ae(N)?(e.exit("data"),h(N)):(e.consume(N),N===92?d:u)}function d(N){return N===92||N===124?(e.consume(N),u):u(N)}function f(N){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(N):(e.enter("tableDelimiterRow"),o=!1,Ne(N)?Pe(e,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):m(N))}function m(N){return N===45||N===58?x(N):N===124?(o=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),g):P(N)}function g(N){return Ne(N)?Pe(e,x,"whitespace")(N):x(N)}function x(N){return N===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),_):N===45?(s+=1,_(N)):N===null||_e(N)?E(N):P(N)}function _(N){return N===45?(e.enter("tableDelimiterFiller"),v(N)):P(N)}function v(N){return N===45?(e.consume(N),v):N===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(N))}function y(N){return Ne(N)?Pe(e,E,"whitespace")(N):E(N)}function E(N){return N===124?m(N):N===null||_e(N)?!o||i!==s?P(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):P(N)}function P(N){return r(N)}function C(N){return e.enter("tableRow"),M(N)}function M(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),M):N===null||_e(N)?(e.exit("tableRow"),t(N)):Ne(N)?Pe(e,M,"whitespace")(N):(e.enter("data"),z(N))}function z(N){return N===null||N===124||Ae(N)?(e.exit("data"),M(N)):(e.consume(N),N===92?J:z)}function J(N){return N===92||N===124?(e.consume(N),z):z(N)}}function VN(e,t){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,a=0,c,h,u;const d=new $N;for(;++r<e.length;){const f=e[r],m=f[1];f[0]==="enter"?m.type==="tableHead"?(l=!1,a!==0&&(Km(d,t,a,c,h),h=void 0,a=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},d.add(r,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,u=void 0,s=[0,0,0,0],o=[0,r+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},d.add(r,0,[["enter",h,t]])),i=m.type==="tableDelimiterRow"?2:h?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],u=cl(d,t,s,i,void 0,u),s=[0,0,0,0]),o[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],u=cl(d,t,s,i,void 0,u)),s=o,o=[s[1],r,0,0])):m.type==="tableHead"?(l=!0,a=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(a=r,s[1]!==0?(o[0]=o[1],u=cl(d,t,s,i,r,u)):o[1]!==0&&(u=cl(d,t,o,i,r,u)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(a!==0&&Km(d,t,a,c,h),d.consume(t.events),r=-1;++r<t.events.length;){const f=t.events[r];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=WN(t.events,r))}return e}function cl(e,t,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(s.end=Object.assign({},Pi(t.events,r[0])),e.add(r[0],0,[["exit",s,t]]));const a=Pi(t.events,r[1]);if(s={type:o,start:Object.assign({},a),end:Object.assign({},a)},e.add(r[1],0,[["enter",s,t]]),r[2]!==0){const c=Pi(t.events,r[2]),h=Pi(t.events,r[3]),u={type:l,start:Object.assign({},c),end:Object.assign({},h)};if(e.add(r[2],0,[["enter",u,t]]),n!==2){const d=t.events[r[2]],f=t.events[r[3]];if(d[1].end=Object.assign({},f[1].end),d[1].type="chunkText",d[1].contentType="text",r[3]>r[2]+1){const m=r[2]+1,g=r[3]-r[2]-1;e.add(m,g,[])}}e.add(r[3]+1,0,[["exit",u,t]])}return i!==void 0&&(s.end=Object.assign({},Pi(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Km(e,t,r,n,i){const s=[],o=Pi(t.events,r);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),n.end=Object.assign({},o),s.push(["exit",n,t]),e.add(r+1,0,s)}function Pi(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const qN={name:"tasklistCheck",tokenize:XN};function YN(){return{text:{91:qN}}}function XN(e,t,r){const n=this;return i;function i(a){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),s)}function s(a){return Ae(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),o):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),o):r(a)}function o(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):r(a)}function l(a){return _e(a)?t(a):Ne(a)?e.check({tokenize:GN},t,r)(a):r(a)}}function GN(e,t,r){return Pe(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function QN(e){return K0([wN(),RN(),FN(e),UN(),YN()])}const ZN={};function Fc(e){const t=this,r=e||ZN,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(QN(r)),s.push(vN()),o.push(yN(r))}const JN=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,eT=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,Vm=({legacyTitle:e=!1,tagName:t="div"}={})=>r=>{Ua(r,"blockquote",(n,i,s)=>{let o="",l="",a=!0,c=n.children.map(h=>{if(a&&h.type==="paragraph"){const u=h.children[0],d=u.type==="text"?u.value:"",f=e?eT:JN,m=d.match(f);if(m&&(a=!1,o=m[1].toLocaleLowerCase(),l=e&&m[2]||o.toLocaleUpperCase(),d.includes(`
96
96
  `)&&(h.children[0]={type:"text",value:d.replace(f,"").replace(/^\n+/,"")}),!d.includes(`
97
- `))){const g=[];h.children.forEach((x,_)=>{_!=0&&(_==1&&x.type==="break"||g.push(x))}),h.children=[...g]}}return h});o&&(n.data={hName:t,hProperties:{className:["markdown-alert",`markdown-alert-${o}`],dir:"auto"}},c.unshift({type:"paragraph",children:[UT(o),{type:"text",value:l.replace(/^\//,"")}],data:{hProperties:{className:"markdown-alert-title",dir:"auto"}}})),n.children=[...c]})};function UT(e){let t=KT[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 KT={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 VT(e){ny(e,[/\r?\n|\r/g,qT])}function qT(){return{type:"break"}}function YT(){return function(e){VT(e)}}function XT(e){const r=e.split(`
97
+ `))){const g=[];h.children.forEach((x,_)=>{_!=0&&(_==1&&x.type==="break"||g.push(x))}),h.children=[...g]}}return h});o&&(n.data={hName:t,hProperties:{className:["markdown-alert",`markdown-alert-${o}`],dir:"auto"}},c.unshift({type:"paragraph",children:[tT(o),{type:"text",value:l.replace(/^\//,"")}],data:{hProperties:{className:"markdown-alert-title",dir:"auto"}}})),n.children=[...c]})};function tT(e){let t=rT[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 rT={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 nT(e){fy(e,[/\r?\n|\r/g,iT])}function iT(){return{type:"break"}}function sT(){return function(e){nT(e)}}function oT(e){const r=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
  `),n={},i=[];let s=!1;for(const l of r){const a=l.trim();if(a===""){s=!1,i.push("");continue}if(/^❯\s*$/.test(a)||/^>\s*$/.test(a)||/^[✡-✩✪-✿⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◆◇◐◑◒◓]\s*\S+[…\.]{1,3}\s*$/.test(a)||/^◐\s/.test(a)||/\/effort/.test(a)||/^⎿\s+(Tip|Note|Hint):/.test(a)||/^\?\s*(for\s*shortcuts|shortcuts)/.test(a)||/esc\s+to\s+interrupt|shift\+tab\s+to\s+cycle|accept\s+edits\s+on/i.test(a)||/Brewing[…\.]{0,3}\s*\d*$/i.test(a)||/^[✢✳✶✻⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◆◇✦\s]+$/.test(a)||/^Auto-updating/i.test(a))continue;if(/^[⏺●·⏵]/.test(l)){const h=l.match(/^[⏺●·]\s*([A-Za-z][A-Za-z0-9_]*)\s*[\(\[]/);if(h)n[h[1]]=(n[h[1]]||0)+1;else{const u=l.replace(/^[⏺●·⏵]\s*/,"").trim().slice(0,40);u&&(n[u]=(n[u]||0)+1)}s=!0;continue}if(/^[\s]*[╭╰│├╮╯]/.test(l)||/^[╭╰│├╮╯─]+/.test(a)||/^\s+[⊙✓✗○◎▸►✦]/.test(l)||s&&/^\s{2,}/.test(l))continue;s=!1;const c=l.replace(/^❯\s+/,"");i.push(c)}const o=i.join(`
101
101
  `).replace(/\n{3,}/g,`
102
102
 
103
- `).trim();return{toolCounts:n,textContent:o,hasTools:Object.keys(n).length>0}}function $c(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const Ty=w.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",isCliMode:i=!1,isWorking:s=!1,contextKey:o="",receivedAtMap:l={},emptyState:a,onLoadMore:c,isLoadingMore:h,hasMoreHistory:u},d){var U;const f=w.useRef(null),m=w.useRef(null),g=w.useRef(0),x=w.useRef(""),_=w.useRef(!1),[v,y]=w.useState(new Set),[E,N]=w.useState(new Set),k=w.useRef(!1),I=()=>{const M=f.current;return M?M.scrollHeight-M.scrollTop-M.clientHeight<200:!0},z=t.length>0?`${t.length}:${(((U=t[t.length-1])==null?void 0:U.content)||"").length}`:"0:0";w.useEffect(()=>{var L,$;const M=!_.current,F=x.current!==o;if(x.current=o,M||F){_.current=!0,k.current=!1;const S=()=>{var ne;(ne=m.current)==null||ne.scrollIntoView({behavior:"instant"})};requestAnimationFrame(()=>requestAnimationFrame(S)),setTimeout(S,100),setTimeout(S,300),g.current=t.length;return}t.length>g.current?k.current||(L=m.current)==null||L.scrollIntoView({behavior:"instant"}):I()&&!k.current&&(($=m.current)==null||$.scrollIntoView({behavior:"instant"})),g.current=t.length},[z,o,s]),w.useImperativeHandle(d,()=>({scrollToBottom:(M="smooth")=>{var F;(F=m.current)==null||F.scrollIntoView({behavior:M})}})),w.useEffect(()=>{const M=f.current;if(!M)return;let F;const W=()=>{clearTimeout(F),F=setTimeout(()=>{k.current=!I()},50)};return M.addEventListener("scroll",W,{passive:!0}),()=>{M.removeEventListener("scroll",W),clearTimeout(F)}},[]);const Z=w.useRef(!1),T=w.useRef(0),R=w.useRef(!1);w.useEffect(()=>{const M=f.current;if(!M||!R.current||T.current===0)return;const W=M.scrollHeight-T.current;W>0&&(M.scrollTop=W),T.current=0,R.current=!1},[t.length]),w.useEffect(()=>{const M=f.current;if(!M||!c)return;const F=()=>{M.scrollTop<60&&u&&!h&&!Z.current&&(Z.current=!0,T.current=M.scrollHeight,c(),setTimeout(()=>{Z.current=!1},1500))};return M.addEventListener("scroll",F,{passive:!0}),()=>M.removeEventListener("scroll",F)},[c,u,h]);const A=(()=>{const M=t.map(($,S)=>({type:"message",data:$,index:S,ts:$.receivedAt||l[$.id??`i-${S}`]||0}));if(!r||r.length===0)return M;const F=[...r].sort(($,S)=>$.timestamp-S.timestamp).map(($,S)=>({type:"action",data:$,index:S,ts:$.timestamp})),W=[];let L=0;for(const $ of M){for(;L<F.length&&$.ts>0&&F[L].ts<$.ts;)W.push(F[L++]);W.push($)}for(;L<F.length;)W.push(F[L++]);return W})(),D=700;return p.jsxs("div",{ref:f,"data-chat-scroll":!0,className:"flex-1 min-h-0 overflow-y-auto px-5 py-6 flex flex-col gap-4 bg-bg-primary",children:[h&&p.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60",children:"⏳ Loading older messages..."}),u&&!h&&p.jsx("div",{className:"text-center py-2",children:p.jsx("button",{onClick:c,className:"bg-transparent border border-border-subtle text-text-muted text-[11px] rounded-xl px-4 py-1 cursor-pointer opacity-70",children:"↑ Load older messages"})}),A.length===0&&!u&&(a||p.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),A.map(M=>{if(M.type==="action"){const ge=M.data;return p.jsxs("div",{className:"self-center max-w-[80%] bg-indigo-500/[0.08] text-accent px-3.5 py-1.5 rounded-[20px] text-xs text-center border border-indigo-500/15 opacity-85",children:[p.jsx(Ac,{remarkPlugins:[Fc],children:ge.text}),p.jsx("span",{className:"text-[10px] opacity-50 ml-2",children:$c(ge.timestamp)})]},`action-${M.index}`)}const F=M.data,W=M.index,L=(F.role||"").toLowerCase(),$=L==="user"||L==="human",S=F.kind||"standard",ne=F.receivedAt||l[F.id??`i-${W}`],oe=`${o}-${W}`,b=v.has(oe),me=E.has(oe);if(S==="thought")return p.jsx("div",{className:"self-start max-w-[88%] border-l-2 border-indigo-500/35 pl-3 text-text-muted text-xs italic leading-relaxed opacity-75",children:p.jsx("div",{className:"chat-markdown",children:p.jsx(Ac,{remarkPlugins:[Fc,Om],children:F.content||""})})},`msg-${W}`);if(S==="tool")return p.jsxs("div",{className:"self-start flex items-center gap-1.5 text-[11px] text-text-muted py-0.5 px-2.5 pl-2 bg-emerald-500/[0.05] border border-emerald-500/[0.12] rounded-md font-mono",children:[p.jsx("span",{className:"text-emerald-500 text-[10px]",children:"⏺"}),p.jsx("span",{className:"text-emerald-500 opacity-80",children:(F.content||"").split(`
104
- `)[0].slice(0,80)})]},`msg-${W}`);if(S==="system")return p.jsx("div",{className:"self-center text-[11px] text-text-muted opacity-60 px-3 py-0.5 rounded-[20px] border border-border-subtle",children:(F.content||"").slice(0,100)},`msg-${W}`);const V=!$&&i?XT(F.content||""):null,H=V?V.textContent:F.content||"",G=V?Object.entries(V.toolCounts):[],he=i&&!$&&!b&&H.length>D,ue=b?F.content||"":he&&!me?H.slice(0,D):H;return p.jsxs("div",{className:`max-w-[88%] flex flex-col gap-1 ${$?"self-end":"self-start"}`,children:[G.length>0&&p.jsxs("div",{className:"flex flex-wrap gap-1 items-center mb-0.5",children:[G.map(([ge,O])=>p.jsxs("span",{className:"text-[10px] font-mono text-emerald-500 bg-emerald-500/[0.07] border border-emerald-500/[0.18] rounded px-[7px] py-0.5",children:["⏺ ",ge,O>1?` ×${O}`:""]},ge)),(V==null?void 0:V.hasTools)&&p.jsx("button",{onClick:()=>y(ge=>{const O=new Set(ge);return b?O.delete(oe):O.add(oe),O}),className:"text-[10px] text-text-muted bg-transparent border-none cursor-pointer px-1 py-px opacity-50",children:b?"Collapse":"Original"}),!H&&ne!=null&&p.jsx("span",{className:"text-[10px] opacity-35 ml-0.5",children:$c(ne)})]}),(H||$)&&p.jsxs("div",{style:{background:$?"linear-gradient(135deg, var(--accent-primary), #4f46e5)":"var(--bg-secondary)",color:$?"#fff":"var(--text-primary)",padding:"12px 16px",borderRadius:$?"16px 16px 4px 16px":"16px 16px 16px 4px",fontSize:13,lineHeight:1.65,border:$?"none":"1px solid var(--border-subtle)",boxShadow:$?"0 2px 12px rgba(99, 102, 241, 0.25)":"0 1px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04)"},children:[p.jsxs("div",{className:`flex justify-between items-baseline gap-2 ${H?"mb-1.5":"mb-0"}`,children:[p.jsx("span",{className:"text-[10px] font-bold opacity-60 tracking-wide uppercase",children:$?"You":n}),ne!=null&&p.jsx("span",{className:"text-[10px] opacity-45",children:$c(ne)})]}),H&&p.jsx("div",{className:"chat-markdown",children:p.jsx(Ac,{remarkPlugins:[Fc,Om,YT],children:ue})}),he&&p.jsx("button",{onClick:()=>N(ge=>{const O=new Set(ge);return me?O.delete(oe):O.add(oe),O}),className:"mt-1.5 text-[11px] font-semibold text-[var(--accent-primary)] bg-transparent border-none cursor-pointer p-0 opacity-80",children:me?"Collapse ↑":`Show more (${Math.round(H.length/100)*100} chars) ↓`})]})]},`msg-${W}`)}),s&&p.jsx("div",{className:"self-start max-w-[90%] bg-bg-secondary rounded-[16px_16px_16px_4px] border border-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",{className:"text-[11px] text-text-muted ml-1",children:"Agent working..."})]})}),p.jsx("div",{className:"min-h-10",ref:m})]})}),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"}},Hc={cline:"#22d3ee","roo-code":"#a78bfa",continue:"#34d399",copilot:"#60a5fa"};function GT({agentStreams:e,sendCommand:t}){var d,f,m;const[r,n]=w.useState(null),[i,s]=w.useState(""),[o,l]=w.useState(!1);w.useEffect(()=>{!r&&e.length>0&&n(e[0].agentType)},[e,r]);const a=e.find(g=>g.agentType===r),c=w.useCallback(async()=>{if(!(!i.trim()||!r||o)){l(!0);try{await t("agent_stream_send",{agentType:r,text:i.trim()}),s("")}catch(g){console.error("Failed to send agent message",g)}finally{l(!1)}}},[i,r,o,t]),h=w.useCallback(async g=>{if(r)try{await t("agent_stream_resolve",{agentType:r,action:g})}catch(x){console.error("Failed to resolve agent action",x)}},[r,t]),u=w.useCallback(async()=>{if(r)try{await t("agent_stream_new_session",{agentType:r})}catch(g){console.error("Failed to start new session",g)}},[r,t]);return e.length===0?null:p.jsxs("div",{className:"flex flex-col h-full bg-[#0c0e14] rounded-xl overflow-hidden border border-white/[0.06]",children:[p.jsxs("div",{className:"flex items-center gap-0.5 px-3 pt-2 border-b border-white/[0.06] bg-white/[0.02] overflow-x-auto",children:[e.map(g=>{const x=g.agentType===r,_=Hc[g.agentType]||"#94a3b8",v=Cs[g.status]||Cs.idle;return p.jsxs("button",{onClick:()=>n(g.agentType),className:`flex items-center gap-2 px-4 py-2 border-none rounded-t-lg text-[13px] whitespace-nowrap cursor-pointer transition-all duration-150 ${x?"bg-white/[0.05] text-slate-100 font-semibold":"bg-transparent text-slate-500 font-normal"}`,style:{borderBottom:x?`2px solid ${_}`:"2px solid transparent"},children:[p.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:v.dot,boxShadow:g.status==="streaming"?`0 0 6px ${v.dot}`:"none",animation:g.status==="streaming"?"pulse 1.5s infinite":"none"}}),g.agentName,g.status==="waiting_approval"&&p.jsx("span",{className:"text-[10px] px-1.5 py-px rounded bg-yellow-500/20 text-yellow-300 font-semibold",children:"APPROVE"})]},g.agentType)}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{onClick:u,title:"New Chat Session",className:"px-2 py-1 mb-1 border-none bg-white/[0.06] text-slate-400 rounded-md cursor-pointer text-[13px]",children:"+ New"})]}),a?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-1.5 text-[11px] text-slate-500 border-b border-white/[0.04]",children:[p.jsx("span",{className:"px-2 py-0.5 rounded font-semibold text-[10px] tracking-wide uppercase",style:{background:(d=Cs[a.status])==null?void 0:d.bg,color:(f=Cs[a.status])==null?void 0:f.text},children:((m=Cs[a.status])==null?void 0:m.label)||a.status}),a.model&&p.jsxs("span",{className:"text-slate-600",children:["Model: ",p.jsx("span",{className:"text-slate-400",children:a.model})]}),p.jsx("span",{className:"text-slate-700",children:"|"}),p.jsxs("span",{children:[a.messages.length," messages"]})]}),a.activeModal&&p.jsxs("div",{className:"px-3.5 py-2.5 bg-gradient-to-br from-yellow-500/10 to-orange-600/[0.08] border-b border-yellow-500/20 flex items-center gap-2.5",children:[p.jsx("span",{className:"text-base",children:"⚠️"}),p.jsx("span",{className:"flex-1 text-[13px] text-yellow-300 leading-snug",children:a.activeModal.message||"Action requires approval"}),p.jsx("button",{onClick:()=>h("approve"),className:"px-3.5 py-1 border-none rounded-md bg-green-500 text-white text-xs font-semibold cursor-pointer",children:"Approve"}),p.jsx("button",{onClick:()=>h("reject"),className:"px-3.5 py-1 border-none rounded-md bg-red-500/20 text-red-400 text-xs font-semibold cursor-pointer",children:"Reject"})]}),p.jsx(Ty,{messages:a.messages.map((g,x)=>({role:g.role,content:g.content,kind:g.kind,id:`${a.agentType}-${x}`,receivedAt:g.timestamp})),agentName:a.agentName,isWorking:a.status==="streaming",contextKey:`agent-${a.agentType}`,emptyState:p.jsxs("div",{className:"flex items-center justify-center h-full text-text-muted text-[13px]",children:["No messages yet. Start a conversation with ",a.agentName,"."]})}),p.jsxs("div",{className:"px-3.5 py-2.5 border-t border-white/[0.06] flex gap-2",children:[p.jsx("input",{type:"text",value:i,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),c())},placeholder:`Message ${a.agentName}...`,disabled:o,className:"flex-1 bg-white/[0.04] border border-white/[0.08] rounded-lg px-3.5 py-2 text-slate-200 text-[13px] outline-none"}),p.jsx("button",{onClick:c,disabled:o||!i.trim(),className:"px-4.5 py-2 border-none rounded-lg text-[13px] font-semibold transition-all duration-150",style:{background:i.trim()?`linear-gradient(135deg, ${Hc[a.agentType]||"#3b82f6"}, ${Hc[a.agentType]||"#3b82f6"}cc)`:"rgba(255,255,255,0.04)",color:i.trim()?"#fff":"#475569",cursor:i.trim()?"pointer":"default"},children:o?"…":"Send"})]})]}):p.jsx("div",{className:"flex-1 flex items-center justify-center text-slate-700 text-[13px]",children:"Select an agent tab to view its chat stream."}),p.jsx("style",{children:`
103
+ `).trim();return{toolCounts:n,textContent:o,hasTools:Object.keys(n).length>0}}function $c(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const Oy=b.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",isCliMode:i=!1,isWorking:s=!1,contextKey:o="",receivedAtMap:l={},emptyState:a,onLoadMore:c,isLoadingMore:h,hasMoreHistory:u},d){var W;const f=b.useRef(null),m=b.useRef(null),g=b.useRef(0),x=b.useRef(""),_=b.useRef(!1),[v,y]=b.useState(new Set),[E,P]=b.useState(new Set),C=b.useRef(!1),M=()=>{const A=f.current;return A?A.scrollHeight-A.scrollTop-A.clientHeight<200:!0},z=t.length>0?`${t.length}:${(((W=t[t.length-1])==null?void 0:W.content)||"").length}`:"0:0";b.useEffect(()=>{var L,$;const A=!_.current,F=x.current!==o;if(x.current=o,A||F){_.current=!0,C.current=!1;const S=()=>{var ne;(ne=m.current)==null||ne.scrollIntoView({behavior:"instant"})};requestAnimationFrame(()=>requestAnimationFrame(S)),setTimeout(S,100),setTimeout(S,300),g.current=t.length;return}t.length>g.current?C.current||(L=m.current)==null||L.scrollIntoView({behavior:"instant"}):M()&&!C.current&&(($=m.current)==null||$.scrollIntoView({behavior:"instant"})),g.current=t.length},[z,o,s]),b.useImperativeHandle(d,()=>({scrollToBottom:(A="smooth")=>{var F;(F=m.current)==null||F.scrollIntoView({behavior:A})}})),b.useEffect(()=>{const A=f.current;if(!A)return;let F;const H=()=>{clearTimeout(F),F=setTimeout(()=>{C.current=!M()},50)};return A.addEventListener("scroll",H,{passive:!0}),()=>{A.removeEventListener("scroll",H),clearTimeout(F)}},[]);const J=b.useRef(!1),N=b.useRef(0),D=b.useRef(!1);b.useEffect(()=>{const A=f.current;if(!A||!D.current||N.current===0)return;const H=A.scrollHeight-N.current;H>0&&(A.scrollTop=H),N.current=0,D.current=!1},[t.length]),b.useEffect(()=>{const A=f.current;if(!A||!c)return;const F=()=>{A.scrollTop<60&&u&&!h&&!J.current&&(J.current=!0,N.current=A.scrollHeight,c(),setTimeout(()=>{J.current=!1},1500))};return A.addEventListener("scroll",F,{passive:!0}),()=>A.removeEventListener("scroll",F)},[c,u,h]);const I=(()=>{const A=t.map(($,S)=>({type:"message",data:$,index:S,ts:$.receivedAt||l[$.id??`i-${S}`]||0}));if(!r||r.length===0)return A;const F=[...r].sort(($,S)=>$.timestamp-S.timestamp).map(($,S)=>({type:"action",data:$,index:S,ts:$.timestamp})),H=[];let L=0;for(const $ of A){for(;L<F.length&&$.ts>0&&F[L].ts<$.ts;)H.push(F[L++]);H.push($)}for(;L<F.length;)H.push(F[L++]);return H})(),R=700;return p.jsxs("div",{ref:f,"data-chat-scroll":!0,className:"flex-1 min-h-0 overflow-y-auto px-5 py-6 flex flex-col gap-4 bg-bg-primary",children:[h&&p.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60",children:"⏳ Loading older messages..."}),u&&!h&&p.jsx("div",{className:"text-center py-2",children:p.jsx("button",{onClick:c,className:"bg-transparent border border-border-subtle text-text-muted text-[11px] rounded-xl px-4 py-1 cursor-pointer opacity-70",children:"↑ Load older messages"})}),I.length===0&&!u&&(a||p.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),I.map(A=>{if(A.type==="action"){const pe=A.data;return p.jsxs("div",{className:"self-center max-w-[80%] bg-indigo-500/[0.08] text-accent px-3.5 py-1.5 rounded-[20px] text-xs text-center border border-indigo-500/15 opacity-85",children:[p.jsx(Ac,{remarkPlugins:[Fc],children:pe.text}),p.jsx("span",{className:"text-[10px] opacity-50 ml-2",children:$c(pe.timestamp)})]},`action-${A.index}`)}const F=A.data,H=A.index,L=(F.role||"").toLowerCase(),$=L==="user"||L==="human",S=F.kind||"standard",ne=F.receivedAt||l[F.id??`i-${H}`],ce=`${o}-${H}`,k=v.has(ce),ge=E.has(ce);if(S==="thought")return p.jsx("div",{className:"self-start max-w-[88%] border-l-2 border-indigo-500/35 pl-3 text-text-muted text-xs italic leading-relaxed opacity-75",children:p.jsx("div",{className:"chat-markdown",children:p.jsx(Ac,{remarkPlugins:[Fc,Vm],children:F.content||""})})},`msg-${H}`);if(S==="tool")return p.jsxs("div",{className:"self-start flex items-center gap-1.5 text-[11px] text-text-muted py-0.5 px-2.5 pl-2 bg-emerald-500/[0.05] border border-emerald-500/[0.12] rounded-md font-mono",children:[p.jsx("span",{className:"text-emerald-500 text-[10px]",children:"⏺"}),p.jsx("span",{className:"text-emerald-500 opacity-80",children:(F.content||"").split(`
104
+ `)[0].slice(0,80)})]},`msg-${H}`);if(S==="system")return p.jsx("div",{className:"self-center text-[11px] text-text-muted opacity-60 px-3 py-0.5 rounded-[20px] border border-border-subtle",children:(F.content||"").slice(0,100)},`msg-${H}`);const X=!$&&i?oT(F.content||""):null,Q=X?X.textContent:F.content||"",K=X?Object.entries(X.toolCounts):[],ue=i&&!$&&!k&&Q.length>R,de=k?F.content||"":ue&&!ge?Q.slice(0,R):Q;return p.jsxs("div",{className:`max-w-[88%] flex flex-col gap-1 ${$?"self-end":"self-start"}`,children:[K.length>0&&p.jsxs("div",{className:"flex flex-wrap gap-1 items-center mb-0.5",children:[K.map(([pe,B])=>p.jsxs("span",{className:"text-[10px] font-mono text-emerald-500 bg-emerald-500/[0.07] border border-emerald-500/[0.18] rounded px-[7px] py-0.5",children:["⏺ ",pe,B>1?` ×${B}`:""]},pe)),(X==null?void 0:X.hasTools)&&p.jsx("button",{onClick:()=>y(pe=>{const B=new Set(pe);return k?B.delete(ce):B.add(ce),B}),className:"text-[10px] text-text-muted bg-transparent border-none cursor-pointer px-1 py-px opacity-50",children:k?"Collapse":"Original"}),!Q&&ne!=null&&p.jsx("span",{className:"text-[10px] opacity-35 ml-0.5",children:$c(ne)})]}),(Q||$)&&p.jsxs("div",{style:{background:$?"linear-gradient(135deg, var(--accent-primary), #4f46e5)":"var(--bg-secondary)",color:$?"#fff":"var(--text-primary)",padding:"12px 16px",borderRadius:$?"16px 16px 4px 16px":"16px 16px 16px 4px",fontSize:13,lineHeight:1.65,border:$?"none":"1px solid var(--border-subtle)",boxShadow:$?"0 2px 12px rgba(99, 102, 241, 0.25)":"0 1px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04)"},children:[p.jsxs("div",{className:`flex justify-between items-baseline gap-2 ${Q?"mb-1.5":"mb-0"}`,children:[p.jsx("span",{className:"text-[10px] font-bold opacity-60 tracking-wide uppercase",children:$?"You":n}),ne!=null&&p.jsx("span",{className:"text-[10px] opacity-45",children:$c(ne)})]}),Q&&p.jsx("div",{className:"chat-markdown",children:p.jsx(Ac,{remarkPlugins:[Fc,Vm,sT],children:de})}),ue&&p.jsx("button",{onClick:()=>P(pe=>{const B=new Set(pe);return ge?B.delete(ce):B.add(ce),B}),className:"mt-1.5 text-[11px] font-semibold text-[var(--accent-primary)] bg-transparent border-none cursor-pointer p-0 opacity-80",children:ge?"Collapse ↑":`Show more (${Math.round(Q.length/100)*100} chars) ↓`})]})]},`msg-${H}`)}),s&&p.jsx("div",{className:"self-start max-w-[90%] bg-bg-secondary rounded-[16px_16px_16px_4px] border border-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",{className:"text-[11px] text-text-muted ml-1",children:"Agent working..."})]})}),p.jsx("div",{className:"min-h-10",ref:m})]})}),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"}},Hc={cline:"#22d3ee","roo-code":"#a78bfa",continue:"#34d399",copilot:"#60a5fa"};function lT({agentStreams:e,sendCommand:t}){var d,f,m;const[r,n]=b.useState(null),[i,s]=b.useState(""),[o,l]=b.useState(!1);b.useEffect(()=>{!r&&e.length>0&&n(e[0].agentType)},[e,r]);const a=e.find(g=>g.agentType===r),c=b.useCallback(async()=>{if(!(!i.trim()||!r||o)){l(!0);try{await t("agent_stream_send",{agentType:r,text:i.trim()}),s("")}catch(g){console.error("Failed to send agent message",g)}finally{l(!1)}}},[i,r,o,t]),h=b.useCallback(async g=>{if(r)try{await t("agent_stream_resolve",{agentType:r,action:g})}catch(x){console.error("Failed to resolve agent action",x)}},[r,t]),u=b.useCallback(async()=>{if(r)try{await t("agent_stream_new_session",{agentType:r})}catch(g){console.error("Failed to start new session",g)}},[r,t]);return e.length===0?null:p.jsxs("div",{className:"flex flex-col h-full bg-[#0c0e14] rounded-xl overflow-hidden border border-white/[0.06]",children:[p.jsxs("div",{className:"flex items-center gap-0.5 px-3 pt-2 border-b border-white/[0.06] bg-white/[0.02] overflow-x-auto",children:[e.map(g=>{const x=g.agentType===r,_=Hc[g.agentType]||"#94a3b8",v=Cs[g.status]||Cs.idle;return p.jsxs("button",{onClick:()=>n(g.agentType),className:`flex items-center gap-2 px-4 py-2 border-none rounded-t-lg text-[13px] whitespace-nowrap cursor-pointer transition-all duration-150 ${x?"bg-white/[0.05] text-slate-100 font-semibold":"bg-transparent text-slate-500 font-normal"}`,style:{borderBottom:x?`2px solid ${_}`:"2px solid transparent"},children:[p.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:v.dot,boxShadow:g.status==="streaming"?`0 0 6px ${v.dot}`:"none",animation:g.status==="streaming"?"pulse 1.5s infinite":"none"}}),g.agentName,g.status==="waiting_approval"&&p.jsx("span",{className:"text-[10px] px-1.5 py-px rounded bg-yellow-500/20 text-yellow-300 font-semibold",children:"APPROVE"})]},g.agentType)}),p.jsx("div",{className:"flex-1"}),p.jsx("button",{onClick:u,title:"New Chat Session",className:"px-2 py-1 mb-1 border-none bg-white/[0.06] text-slate-400 rounded-md cursor-pointer text-[13px]",children:"+ New"})]}),a?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-1.5 text-[11px] text-slate-500 border-b border-white/[0.04]",children:[p.jsx("span",{className:"px-2 py-0.5 rounded font-semibold text-[10px] tracking-wide uppercase",style:{background:(d=Cs[a.status])==null?void 0:d.bg,color:(f=Cs[a.status])==null?void 0:f.text},children:((m=Cs[a.status])==null?void 0:m.label)||a.status}),a.model&&p.jsxs("span",{className:"text-slate-600",children:["Model: ",p.jsx("span",{className:"text-slate-400",children:a.model})]}),p.jsx("span",{className:"text-slate-700",children:"|"}),p.jsxs("span",{children:[a.messages.length," messages"]})]}),a.activeModal&&p.jsxs("div",{className:"px-3.5 py-2.5 bg-gradient-to-br from-yellow-500/10 to-orange-600/[0.08] border-b border-yellow-500/20 flex items-center gap-2.5",children:[p.jsx("span",{className:"text-base",children:"⚠️"}),p.jsx("span",{className:"flex-1 text-[13px] text-yellow-300 leading-snug",children:a.activeModal.message||"Action requires approval"}),p.jsx("button",{onClick:()=>h("approve"),className:"px-3.5 py-1 border-none rounded-md bg-green-500 text-white text-xs font-semibold cursor-pointer",children:"Approve"}),p.jsx("button",{onClick:()=>h("reject"),className:"px-3.5 py-1 border-none rounded-md bg-red-500/20 text-red-400 text-xs font-semibold cursor-pointer",children:"Reject"})]}),p.jsx(Oy,{messages:a.messages.map((g,x)=>({role:g.role,content:g.content,kind:g.kind,id:`${a.agentType}-${x}`,receivedAt:g.timestamp})),agentName:a.agentName,isWorking:a.status==="streaming",contextKey:`agent-${a.agentType}`,emptyState:p.jsxs("div",{className:"flex items-center justify-center h-full text-text-muted text-[13px]",children:["No messages yet. Start a conversation with ",a.agentName,"."]})}),p.jsxs("div",{className:"px-3.5 py-2.5 border-t border-white/[0.06] flex gap-2",children:[p.jsx("input",{type:"text",value:i,onChange:g=>s(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),c())},placeholder:`Message ${a.agentName}...`,disabled:o,className:"flex-1 bg-white/[0.04] border border-white/[0.08] rounded-lg px-3.5 py-2 text-slate-200 text-[13px] outline-none"}),p.jsx("button",{onClick:c,disabled:o||!i.trim(),className:"px-4.5 py-2 border-none rounded-lg text-[13px] font-semibold transition-all duration-150",style:{background:i.trim()?`linear-gradient(135deg, ${Hc[a.agentType]||"#3b82f6"}, ${Hc[a.agentType]||"#3b82f6"}cc)`:"rgba(255,255,255,0.04)",color:i.trim()?"#fff":"#475569",cursor:i.trim()?"pointer":"default"},children:o?"…":"Send"})]})]}):p.jsx("div",{className:"flex-1 flex items-center justify-center text-slate-700 text-[13px]",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,21 +117,21 @@ 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 Ny=Object.defineProperty,QT=Object.getOwnPropertyDescriptor,ZT=(e,t)=>{for(var r in t)Ny(e,r,{get:t[r],enumerable:!0})},rt=(e,t,r,n)=>{for(var i=n>1?void 0:n?QT(t,r):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Ny(t,r,i),i},ce=(e,t)=>(r,n)=>t(r,n,e),jm="Terminal input",hh={get:()=>jm,set:e=>jm=e},zm="Too much output to announce, navigate to rows manually to read",dh={get:()=>zm,set:e=>zm=e};function JT(e){return e.replace(/\r?\n/g,"\r")}function eN(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function tN(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function rN(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");Py(i,t,r,n)}}function Py(e,t,r,n){e=JT(e),e=eN(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function Ly(e,t,r){let n=r.getBoundingClientRect(),i=e.clientX-n.left-10,s=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function Fm(e,t,r,n,i){Ly(e,t,r),i&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function bn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function qa(e,t=0,r=e.length){let n="";for(let i=t;i<r;++i){let s=e[i];s>65535?(s-=65536,n+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):n+=String.fromCharCode(s)}return n}var nN=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let n=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[n++]=(this._interim-55296)*1024+s-56320+65536:(t[n++]=this._interim,t[n++]=s),this._interim=0}for(let s=i;s<r;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=r)return this._interim=o,n;let l=e.charCodeAt(s);56320<=l&&l<=57343?t[n++]=(o-55296)*1024+l-56320+65536:(t[n++]=o,t[n++]=l);continue}o!==65279&&(t[n++]=o)}return n}},iN=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let n=0,i,s,o,l,a=0,c=0;if(this.interim[0]){let d=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)f<<=6,f|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,_=x-m;for(;c<_;){if(c>=r)return 0;if(g=e[c++],(g&192)!==128){c--,d=!0;break}else this.interim[m++]=g,f<<=6,f|=g&63}d||(x===2?f<128?c--:t[n++]=f:x===3?f<2048||f>=55296&&f<=57343||f===65279||(t[n++]=f):f<65536||f>1114111||(t[n++]=f)),this.interim.fill(0)}let h=r-4,u=c;for(;u<r;){for(;u<h&&!((i=e[u])&128)&&!((s=e[u+1])&128)&&!((o=e[u+2])&128)&&!((l=e[u+3])&128);)t[n++]=i,t[n++]=s,t[n++]=o,t[n++]=l,u+=4;if(i=e[u++],i<128)t[n++]=i;else if((i&224)===192){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(a=(i&31)<<6|s&63,a<128){u--;continue}t[n++]=a}else if((i&240)===224){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[u++],(o&192)!==128){u--;continue}if(a=(i&15)<<12|(s&63)<<6|o&63,a<2048||a>=55296&&a<=57343||a===65279)continue;t[n++]=a}else if((i&248)===240){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[u++],(o&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,n;if(l=e[u++],(l&192)!==128){u--;continue}if(a=(i&7)<<18|(s&63)<<12|(o&63)<<6|l&63,a<65536||a>1114111)continue;t[n++]=a}}return n}},Ry="",Pn=" ",Oo=class Dy{constructor(){this.fg=0,this.bg=0,this.extended=new ga}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Dy;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ga=class My{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new My(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},kr=class Iy extends Oo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ga,this.combinedData=""}static fromCharData(t){let r=new Iy;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?bn(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},$m="di$target",fh="di$dependencies",Wc=new Map;function sN(e){return e[fh]||[]}function bt(e){if(Wc.has(e))return Wc.get(e);let t=function(r,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");oN(t,r,i)};return t._id=e,Wc.set(e,t),t}function oN(e,t,r){t[$m]===t?t[fh].push({id:e,index:r}):(t[fh]=[{id:e,index:r}],t[$m]=t)}var Kt=bt("BufferService"),Ay=bt("CoreMouseService"),bi=bt("CoreService"),lN=bt("CharsetService"),df=bt("InstantiationService"),By=bt("LogService"),Vt=bt("OptionsService"),Oy=bt("OscLinkService"),aN=bt("UnicodeService"),jo=bt("DecorationService"),ph=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var h;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,s=new kr,o=r.getTrimmedLength(),l=-1,a=-1,c=!1;for(let u=0;u<o;u++)if(!(a===-1&&!r.hasContent(u))){if(r.loadCell(u,s),s.hasExtendedAttrs()&&s.extended.urlId)if(a===-1){a=u,l=s.extended.urlId;continue}else c=s.extended.urlId!==l;else a!==-1&&(c=!0);if(c||a!==-1&&u===o-1){let 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}},m=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let g=new URL(d);["http:","https:"].includes(g.protocol)||(m=!0)}catch{m=!0}m||n.push({text:d,range:f,activate:(g,x)=>i?i.activate(g,x,f):cN(g,x),hover:(g,x)=>{var _;return(_=i==null?void 0:i.hover)==null?void 0:_.call(i,g,x,f)},leave:(g,x)=>{var _;return(_=i==null?void 0:i.leave)==null?void 0:_.call(i,g,x,f)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(a=u,l=s.extended.urlId):(a=-1,l=-1)}}t(n)}};ph=rt([ce(0,Kt),ce(1,Vt),ce(2,Oy)],ph);function cN(e,t){if(confirm(`Do you want to navigate to ${t}?
120
+ */var jy=Object.defineProperty,aT=Object.getOwnPropertyDescriptor,cT=(e,t)=>{for(var r in t)jy(e,r,{get:t[r],enumerable:!0})},Je=(e,t,r,n)=>{for(var i=n>1?void 0:n?aT(t,r):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&jy(t,r,i),i},he=(e,t)=>(r,n)=>t(r,n,e),qm="Terminal input",hh={get:()=>qm,set:e=>qm=e},Ym="Too much output to announce, navigate to rows manually to read",dh={get:()=>Ym,set:e=>Ym=e};function uT(e){return e.replace(/\r?\n/g,"\r")}function hT(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function dT(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function fT(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");zy(i,t,r,n)}}function zy(e,t,r,n){e=uT(e),e=hT(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function Fy(e,t,r){let n=r.getBoundingClientRect(),i=e.clientX-n.left-10,s=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function Xm(e,t,r,n,i){Fy(e,t,r),i&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function bn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Ka(e,t=0,r=e.length){let n="";for(let i=t;i<r;++i){let s=e[i];s>65535?(s-=65536,n+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):n+=String.fromCharCode(s)}return n}var pT=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let n=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[n++]=(this._interim-55296)*1024+s-56320+65536:(t[n++]=this._interim,t[n++]=s),this._interim=0}for(let s=i;s<r;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=r)return this._interim=o,n;let l=e.charCodeAt(s);56320<=l&&l<=57343?t[n++]=(o-55296)*1024+l-56320+65536:(t[n++]=o,t[n++]=l);continue}o!==65279&&(t[n++]=o)}return n}},mT=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let n=0,i,s,o,l,a=0,c=0;if(this.interim[0]){let d=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)f<<=6,f|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,_=x-m;for(;c<_;){if(c>=r)return 0;if(g=e[c++],(g&192)!==128){c--,d=!0;break}else this.interim[m++]=g,f<<=6,f|=g&63}d||(x===2?f<128?c--:t[n++]=f:x===3?f<2048||f>=55296&&f<=57343||f===65279||(t[n++]=f):f<65536||f>1114111||(t[n++]=f)),this.interim.fill(0)}let h=r-4,u=c;for(;u<r;){for(;u<h&&!((i=e[u])&128)&&!((s=e[u+1])&128)&&!((o=e[u+2])&128)&&!((l=e[u+3])&128);)t[n++]=i,t[n++]=s,t[n++]=o,t[n++]=l,u+=4;if(i=e[u++],i<128)t[n++]=i;else if((i&224)===192){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(a=(i&31)<<6|s&63,a<128){u--;continue}t[n++]=a}else if((i&240)===224){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[u++],(o&192)!==128){u--;continue}if(a=(i&15)<<12|(s&63)<<6|o&63,a<2048||a>=55296&&a<=57343||a===65279)continue;t[n++]=a}else if((i&248)===240){if(u>=r)return this.interim[0]=i,n;if(s=e[u++],(s&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,n;if(o=e[u++],(o&192)!==128){u--;continue}if(u>=r)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,n;if(l=e[u++],(l&192)!==128){u--;continue}if(a=(i&7)<<18|(s&63)<<12|(o&63)<<6|l&63,a<65536||a>1114111)continue;t[n++]=a}}return n}},$y="",Pn=" ",Oo=class Hy{constructor(){this.fg=0,this.bg=0,this.extended=new pa}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 Hy;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}},pa=class Wy{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Wy(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Sr=class Uy extends Oo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new pa,this.combinedData=""}static fromCharData(t){let r=new Uy;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?bn(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Gm="di$target",fh="di$dependencies",Wc=new Map;function gT(e){return e[fh]||[]}function St(e){if(Wc.has(e))return Wc.get(e);let t=function(r,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");_T(t,r,i)};return t._id=e,Wc.set(e,t),t}function _T(e,t,r){t[Gm]===t?t[fh].push({id:e,index:r}):(t[fh]=[{id:e,index:r}],t[Gm]=t)}var Ht=St("BufferService"),Ky=St("CoreMouseService"),wi=St("CoreService"),vT=St("CharsetService"),df=St("InstantiationService"),Vy=St("LogService"),Wt=St("OptionsService"),qy=St("OscLinkService"),yT=St("UnicodeService"),jo=St("DecorationService"),ph=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var h;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,s=new Sr,o=r.getTrimmedLength(),l=-1,a=-1,c=!1;for(let u=0;u<o;u++)if(!(a===-1&&!r.hasContent(u))){if(r.loadCell(u,s),s.hasExtendedAttrs()&&s.extended.urlId)if(a===-1){a=u,l=s.extended.urlId;continue}else c=s.extended.urlId!==l;else a!==-1&&(c=!0);if(c||a!==-1&&u===o-1){let 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}},m=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let g=new URL(d);["http:","https:"].includes(g.protocol)||(m=!0)}catch{m=!0}m||n.push({text:d,range:f,activate:(g,x)=>i?i.activate(g,x,f):xT(g,x),hover:(g,x)=>{var _;return(_=i==null?void 0:i.hover)==null?void 0:_.call(i,g,x,f)},leave:(g,x)=>{var _;return(_=i==null?void 0:i.leave)==null?void 0:_.call(i,g,x,f)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(a=u,l=s.extended.urlId):(a=-1,l=-1)}}t(n)}};ph=Je([he(0,Ht),he(1,Wt),he(2,qy)],ph);function xT(e,t){if(confirm(`Do you want to navigate to ${t}?
121
121
 
122
- WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Ya=bt("CharSizeService"),pn=bt("CoreBrowserService"),ff=bt("MouseService"),mn=bt("RenderService"),uN=bt("SelectionService"),jy=bt("CharacterJoinerService"),ds=bt("ThemeService"),zy=bt("LinkProviderService"),hN=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Hm.isErrorNoTelemetry(e)?new Hm(e.message+`
122
+ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Va=St("CharSizeService"),fn=St("CoreBrowserService"),ff=St("MouseService"),pn=St("RenderService"),ST=St("SelectionService"),Yy=St("CharacterJoinerService"),ds=St("ThemeService"),Xy=St("LinkProviderService"),wT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Qm.isErrorNoTelemetry(e)?new Qm(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)}},dN=new hN;function Ml(e){fN(e)||dN.onUnexpectedError(e)}var mh="Canceled";function fN(e){return e instanceof pN?!0:e instanceof Error&&e.name===mh&&e.message===mh}var pN=class extends Error{constructor(){super(mh),this.name=this.message}};function mN(e){return new Error(`Illegal argument: ${e}`)}var Hm=class gh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof gh)return t;let r=new gh;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},_h=class Fy extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Fy.prototype)}};function ir(e,t=0){return e[e.length-(1+t)]}var gN;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function n(s){return s>0}e.isGreaterThan=n;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(gN||(gN={}));function _N(e,t){let r=this,n=!1,i;return function(){return n||(n=!0,t||(i=e.apply(r,arguments))),i}}var $y;(e=>{function t(E){return E&&typeof E=="object"&&typeof E[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;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||r}e.from=o;function*l(E){for(let N=E.length-1;N>=0;N--)yield E[N]}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,N){let k=0;for(let I of E)if(N(I,k++))return!0;return!1}e.some=h;function u(E,N){for(let k of E)if(N(k))return k}e.find=u;function*d(E,N){for(let k of E)N(k)&&(yield k)}e.filter=d;function*f(E,N){let k=0;for(let I of E)yield N(I,k++)}e.map=f;function*m(E,N){let k=0;for(let I of E)yield*N(I,k++)}e.flatMap=m;function*g(...E){for(let N of E)yield*N}e.concat=g;function x(E,N,k){let I=k;for(let z of E)I=N(I,z);return I}e.reduce=x;function*_(E,N,k=E.length){for(N<0&&(N+=E.length),k<0?k+=E.length:k>E.length&&(k=E.length);N<k;N++)yield E[N]}e.slice=_;function v(E,N=Number.POSITIVE_INFINITY){let k=[];if(N===0)return[k,E];let I=E[Symbol.iterator]();for(let z=0;z<N;z++){let Z=I.next();if(Z.done)return[k,e.empty()];k.push(Z.value)}return[k,{[Symbol.iterator](){return I}}]}e.consume=v;async function y(E){let N=[];for await(let k of E)N.push(k);return Promise.resolve(N)}e.asyncToArray=y})($y||($y={}));function _i(e){if($y.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function vN(...e){return We(()=>_i(e))}function We(e){return{dispose:_N(()=>{e()})}}var Hy=class Wy{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?Wy.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)}};Hy.DISABLE_DISPOSED_WARNING=!1;var jn=Hy,Ee=class{constructor(){this._store=new jn,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)}};Ee.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}},on=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 Ve=vh,Wm=class{constructor(){this._first=Ve.Undefined,this._last=Ve.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ve.Undefined}clear(){let e=this._first;for(;e!==Ve.Undefined;){let t=e.next;e.prev=Ve.Undefined,e.next=Ve.Undefined,e=t}this._first=Ve.Undefined,this._last=Ve.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Ve(e);if(this._first===Ve.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==Ve.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ve.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ve.Undefined&&e.next!==Ve.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ve.Undefined&&e.next===Ve.Undefined?(this._first=Ve.Undefined,this._last=Ve.Undefined):e.next===Ve.Undefined?(this._last=this._last.prev,this._last.next=Ve.Undefined):e.prev===Ve.Undefined&&(this._first=this._first.next,this._first.prev=Ve.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ve.Undefined;)yield e.element,e=e.next}},yN=globalThis.performance&&typeof globalThis.performance.now=="function",xN=class Uy{static create(t){return new Uy(t)}constructor(t){this._now=yN&&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=()=>Ee.None;function t(A,D){return u(A,()=>{},0,void 0,!0,void 0,D)}e.defer=t;function r(A){return(D,U=null,M)=>{let F=!1,W;return W=A(L=>{if(!F)return W?W.dispose():F=!0,D.call(U,L)},null,M),F&&W.dispose(),W}}e.once=r;function n(A,D,U){return c((M,F=null,W)=>A(L=>M.call(F,D(L)),null,W),U)}e.map=n;function i(A,D,U){return c((M,F=null,W)=>A(L=>{D(L),M.call(F,L)},null,W),U)}e.forEach=i;function s(A,D,U){return c((M,F=null,W)=>A(L=>D(L)&&M.call(F,L),null,W),U)}e.filter=s;function o(A){return A}e.signal=o;function l(...A){return(D,U=null,M)=>{let F=vN(...A.map(W=>W(L=>D.call(U,L))));return h(F,M)}}e.any=l;function a(A,D,U,M){let F=U;return n(A,W=>(F=D(F,W),F),M)}e.reduce=a;function c(A,D){let U,M={onWillAddFirstListener(){U=A(F.fire,F)},onDidRemoveLastListener(){U==null||U.dispose()}},F=new ie(M);return D==null||D.add(F),F.event}function h(A,D){return D instanceof Array?D.push(A):D&&D.add(A),A}function u(A,D,U=100,M=!1,F=!1,W,L){let $,S,ne,oe=0,b,me={leakWarningThreshold:W,onWillAddFirstListener(){$=A(H=>{oe++,S=D(S,H),M&&!ne&&(V.fire(S),S=void 0),b=()=>{let G=S;S=void 0,ne=void 0,(!M||oe>1)&&V.fire(G),oe=0},typeof U=="number"?(clearTimeout(ne),ne=setTimeout(b,U)):ne===void 0&&(ne=0,queueMicrotask(b))})},onWillRemoveListener(){F&&oe>0&&(b==null||b())},onDidRemoveLastListener(){b=void 0,$.dispose()}},V=new ie(me);return L==null||L.add(V),V.event}e.debounce=u;function d(A,D=0,U){return e.debounce(A,(M,F)=>M?(M.push(F),M):[F],D,void 0,!0,void 0,U)}e.accumulate=d;function f(A,D=(M,F)=>M===F,U){let M=!0,F;return s(A,W=>{let L=M||!D(W,F);return M=!1,F=W,L},U)}e.latch=f;function m(A,D,U){return[e.filter(A,D,U),e.filter(A,M=>!D(M),U)]}e.split=m;function g(A,D=!1,U=[],M){let F=U.slice(),W=A(S=>{F?F.push(S):$.fire(S)});M&&M.add(W);let L=()=>{F==null||F.forEach(S=>$.fire(S)),F=null},$=new ie({onWillAddFirstListener(){W||(W=A(S=>$.fire(S)),M&&M.add(W))},onDidAddFirstListener(){F&&(D?setTimeout(L):L())},onDidRemoveLastListener(){W&&W.dispose(),W=null}});return M&&M.add($),$.event}e.buffer=g;function x(A,D){return(U,M,F)=>{let W=D(new v);return A(function(L){let $=W.evaluate(L);$!==_&&U.call(M,$)},void 0,F)}}e.chain=x;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 M=U;return this.steps.push(F=>(M=D(M,F),M)),this}latch(D=(U,M)=>U===M){let U=!0,M;return this.steps.push(F=>{let W=U||!D(F,M);return U=!1,M=F,W?F:_}),this}evaluate(D){for(let U of this.steps)if(D=U(D),D===_)break;return D}}function y(A,D,U=M=>M){let M=(...$)=>L.fire(U(...$)),F=()=>A.on(D,M),W=()=>A.removeListener(D,M),L=new ie({onWillAddFirstListener:F,onDidRemoveLastListener:W});return L.event}e.fromNodeEventEmitter=y;function E(A,D,U=M=>M){let M=(...$)=>L.fire(U(...$)),F=()=>A.addEventListener(D,M),W=()=>A.removeEventListener(D,M),L=new ie({onWillAddFirstListener:F,onDidRemoveLastListener:W});return L.event}e.fromDOMEventEmitter=E;function N(A){return new Promise(D=>r(A)(D))}e.toPromise=N;function k(A){let D=new ie;return A.then(U=>{D.fire(U)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}e.fromPromise=k;function I(A,D){return A(U=>D.fire(U))}e.forward=I;function z(A,D,U){return D(U),A(M=>D(M))}e.runAndSubscribe=z;class Z{constructor(D,U){this._observable=D,this._counter=0,this._hasChanged=!1;let M={onWillAddFirstListener:()=>{D.addObserver(this)},onDidRemoveLastListener:()=>{D.removeObserver(this)}};this.emitter=new ie(M),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(A,D){return new Z(A,D).emitter.event}e.fromObservable=T;function R(A){return(D,U,M)=>{let F=0,W=!1,L={beginUpdate(){F++},endUpdate(){F--,F===0&&(A.reportChanges(),W&&(W=!1,D.call(U)))},handlePossibleChange(){},handleChange(){W=!0}};A.addObserver(L),A.reportChanges();let $={dispose(){A.removeObserver(L)}};return M instanceof jn?M.add($):Array.isArray(M)&&M.push($),$}}e.fromObservableLight=R})(Et||(Et={}));var xh=class Sh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Sh._idPool++}`,Sh.all.add(this)}start(t){this._stopWatch=new xN,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}}};xh.all=new Set,xh._idPool=0;var SN=xh,wN=-1,Ky=class Vy{constructor(t,r,n=(Vy._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let n=this.threshold;if(n<=0||r<n)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(s);let a=new CN(l,s);this._errorHandler(a)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,i]of this._stacks)(!t||r<i)&&(t=[n,i],r=i);return t}};Ky._idPool=1;var bN=Ky,kN=class qy{constructor(t){this.value=t}static create(){let t=new Error;return new qy(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)}},bT=new wT;function Dl(e){kT(e)||bT.onUnexpectedError(e)}var mh="Canceled";function kT(e){return e instanceof CT?!0:e instanceof Error&&e.name===mh&&e.message===mh}var CT=class extends Error{constructor(){super(mh),this.name=this.message}};function ET(e){return new Error(`Illegal argument: ${e}`)}var Qm=class gh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof gh)return t;let r=new gh;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},_h=class Gy extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Gy.prototype)}};function Jt(e,t=0){return e[e.length-(1+t)]}var NT;(e=>{function t(s){return s<0}e.isLessThan=t;function r(s){return s<=0}e.isLessThanOrEqual=r;function n(s){return s>0}e.isGreaterThan=n;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(NT||(NT={}));function TT(e,t){let r=this,n=!1,i;return function(){return n||(n=!0,t||(i=e.apply(r,arguments))),i}}var Qy;(e=>{function t(E){return E&&typeof E=="object"&&typeof E[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;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||r}e.from=o;function*l(E){for(let P=E.length-1;P>=0;P--)yield E[P]}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,P){let C=0;for(let M of E)if(P(M,C++))return!0;return!1}e.some=h;function u(E,P){for(let C of E)if(P(C))return C}e.find=u;function*d(E,P){for(let C of E)P(C)&&(yield C)}e.filter=d;function*f(E,P){let C=0;for(let M of E)yield P(M,C++)}e.map=f;function*m(E,P){let C=0;for(let M of E)yield*P(M,C++)}e.flatMap=m;function*g(...E){for(let P of E)yield*P}e.concat=g;function x(E,P,C){let M=C;for(let z of E)M=P(M,z);return M}e.reduce=x;function*_(E,P,C=E.length){for(P<0&&(P+=E.length),C<0?C+=E.length:C>E.length&&(C=E.length);P<C;P++)yield E[P]}e.slice=_;function v(E,P=Number.POSITIVE_INFINITY){let C=[];if(P===0)return[C,E];let M=E[Symbol.iterator]();for(let z=0;z<P;z++){let J=M.next();if(J.done)return[C,e.empty()];C.push(J.value)}return[C,{[Symbol.iterator](){return M}}]}e.consume=v;async function y(E){let P=[];for await(let C of E)P.push(C);return Promise.resolve(P)}e.asyncToArray=y})(Qy||(Qy={}));function gi(e){if(Qy.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function PT(...e){return We(()=>gi(e))}function We(e){return{dispose:TT(()=>{e()})}}var Zy=class Jy{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{gi(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?Jy.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)}};Zy.DISABLE_DISPOSED_WARNING=!1;var jn=Zy,Ee=class{constructor(){this._store=new jn,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)}};Ee.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}},sn=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 Ue=vh,Zm=class{constructor(){this._first=Ue.Undefined,this._last=Ue.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ue.Undefined}clear(){let e=this._first;for(;e!==Ue.Undefined;){let t=e.next;e.prev=Ue.Undefined,e.next=Ue.Undefined,e=t}this._first=Ue.Undefined,this._last=Ue.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Ue(e);if(this._first===Ue.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==Ue.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ue.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ue.Undefined&&e.next!==Ue.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ue.Undefined&&e.next===Ue.Undefined?(this._first=Ue.Undefined,this._last=Ue.Undefined):e.next===Ue.Undefined?(this._last=this._last.prev,this._last.next=Ue.Undefined):e.prev===Ue.Undefined&&(this._first=this._first.next,this._first.prev=Ue.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ue.Undefined;)yield e.element,e=e.next}},LT=globalThis.performance&&typeof globalThis.performance.now=="function",DT=class e1{static create(t){return new e1(t)}constructor(t){this._now=LT&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},kt;(e=>{e.None=()=>Ee.None;function t(I,R){return u(I,()=>{},0,void 0,!0,void 0,R)}e.defer=t;function r(I){return(R,W=null,A)=>{let F=!1,H;return H=I(L=>{if(!F)return H?H.dispose():F=!0,R.call(W,L)},null,A),F&&H.dispose(),H}}e.once=r;function n(I,R,W){return c((A,F=null,H)=>I(L=>A.call(F,R(L)),null,H),W)}e.map=n;function i(I,R,W){return c((A,F=null,H)=>I(L=>{R(L),A.call(F,L)},null,H),W)}e.forEach=i;function s(I,R,W){return c((A,F=null,H)=>I(L=>R(L)&&A.call(F,L),null,H),W)}e.filter=s;function o(I){return I}e.signal=o;function l(...I){return(R,W=null,A)=>{let F=PT(...I.map(H=>H(L=>R.call(W,L))));return h(F,A)}}e.any=l;function a(I,R,W,A){let F=W;return n(I,H=>(F=R(F,H),F),A)}e.reduce=a;function c(I,R){let W,A={onWillAddFirstListener(){W=I(F.fire,F)},onDidRemoveLastListener(){W==null||W.dispose()}},F=new oe(A);return R==null||R.add(F),F.event}function h(I,R){return R instanceof Array?R.push(I):R&&R.add(I),I}function u(I,R,W=100,A=!1,F=!1,H,L){let $,S,ne,ce=0,k,ge={leakWarningThreshold:H,onWillAddFirstListener(){$=I(Q=>{ce++,S=R(S,Q),A&&!ne&&(X.fire(S),S=void 0),k=()=>{let K=S;S=void 0,ne=void 0,(!A||ce>1)&&X.fire(K),ce=0},typeof W=="number"?(clearTimeout(ne),ne=setTimeout(k,W)):ne===void 0&&(ne=0,queueMicrotask(k))})},onWillRemoveListener(){F&&ce>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,$.dispose()}},X=new oe(ge);return L==null||L.add(X),X.event}e.debounce=u;function d(I,R=0,W){return e.debounce(I,(A,F)=>A?(A.push(F),A):[F],R,void 0,!0,void 0,W)}e.accumulate=d;function f(I,R=(A,F)=>A===F,W){let A=!0,F;return s(I,H=>{let L=A||!R(H,F);return A=!1,F=H,L},W)}e.latch=f;function m(I,R,W){return[e.filter(I,R,W),e.filter(I,A=>!R(A),W)]}e.split=m;function g(I,R=!1,W=[],A){let F=W.slice(),H=I(S=>{F?F.push(S):$.fire(S)});A&&A.add(H);let L=()=>{F==null||F.forEach(S=>$.fire(S)),F=null},$=new oe({onWillAddFirstListener(){H||(H=I(S=>$.fire(S)),A&&A.add(H))},onDidAddFirstListener(){F&&(R?setTimeout(L):L())},onDidRemoveLastListener(){H&&H.dispose(),H=null}});return A&&A.add($),$.event}e.buffer=g;function x(I,R){return(W,A,F)=>{let H=R(new v);return I(function(L){let $=H.evaluate(L);$!==_&&W.call(A,$)},void 0,F)}}e.chain=x;let _=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(W=>(R(W),W)),this}filter(R){return this.steps.push(W=>R(W)?W:_),this}reduce(R,W){let A=W;return this.steps.push(F=>(A=R(A,F),A)),this}latch(R=(W,A)=>W===A){let W=!0,A;return this.steps.push(F=>{let H=W||!R(F,A);return W=!1,A=F,H?F:_}),this}evaluate(R){for(let W of this.steps)if(R=W(R),R===_)break;return R}}function y(I,R,W=A=>A){let A=(...$)=>L.fire(W(...$)),F=()=>I.on(R,A),H=()=>I.removeListener(R,A),L=new oe({onWillAddFirstListener:F,onDidRemoveLastListener:H});return L.event}e.fromNodeEventEmitter=y;function E(I,R,W=A=>A){let A=(...$)=>L.fire(W(...$)),F=()=>I.addEventListener(R,A),H=()=>I.removeEventListener(R,A),L=new oe({onWillAddFirstListener:F,onDidRemoveLastListener:H});return L.event}e.fromDOMEventEmitter=E;function P(I){return new Promise(R=>r(I)(R))}e.toPromise=P;function C(I){let R=new oe;return I.then(W=>{R.fire(W)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=C;function M(I,R){return I(W=>R.fire(W))}e.forward=M;function z(I,R,W){return R(W),I(A=>R(A))}e.runAndSubscribe=z;class J{constructor(R,W){this._observable=R,this._counter=0,this._hasChanged=!1;let A={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};this.emitter=new oe(A),W&&W.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,W){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function N(I,R){return new J(I,R).emitter.event}e.fromObservable=N;function D(I){return(R,W,A)=>{let F=0,H=!1,L={beginUpdate(){F++},endUpdate(){F--,F===0&&(I.reportChanges(),H&&(H=!1,R.call(W)))},handlePossibleChange(){},handleChange(){H=!0}};I.addObserver(L),I.reportChanges();let $={dispose(){I.removeObserver(L)}};return A instanceof jn?A.add($):Array.isArray(A)&&A.push($),$}}e.fromObservableLight=D})(kt||(kt={}));var xh=class Sh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Sh._idPool++}`,Sh.all.add(this)}start(t){this._stopWatch=new DT,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}}};xh.all=new Set,xh._idPool=0;var RT=xh,MT=-1,t1=class r1{constructor(t,r,n=(r1._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let n=this.threshold;if(n<=0||r<n)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(s);let a=new BT(l,s);this._errorHandler(a)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,i]of this._stacks)(!t||r<i)&&(t=[n,i],r=i);return t}};t1._idPool=1;var IT=t1,AT=class n1{constructor(t){this.value=t}static create(){let t=new Error;return new n1(t.stack??"")}print(){console.warn(this.value.split(`
127
127
  `).slice(2).join(`
128
- `))}},CN=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},EN=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},TN=0,Uc=class{constructor(e){this.value=e,this.id=TN++}},NN=2,PN,ie=class{constructor(t){var r,n,i,s;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new bN((t==null?void 0:t.onListenerError)??Ml,((n=this._options)==null?void 0:n.leakWarningThreshold)??wN):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new SN(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,r,n,i;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||n.call(r),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(t,r,n)=>{var l,a,c,h,u;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let 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],m=new EN(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Ml)(m),Ee.None}if(this._disposed)return Ee.None;r&&(t=t.bind(r));let i=new Uc(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=kN.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Uc?(this._deliveryQueue??(this._deliveryQueue=new LN),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 n instanceof jn?n.add(o):Array.isArray(n)&&n.push(o),o}),this._event}_removeListener(t){var s,o,l,a;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||a.call(l,this),this._size=0;return}let r=this._listeners,n=r.indexOf(t);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*NN<=r.length){let c=0;for(let h=0;h<r.length;h++)r[h]?r[c++]=r[h]:i&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=c}}_deliver(t,r){var i;if(!t)return;let n=((i=this._options)==null?void 0:i.onListenerError)||Ml;if(!n){t.value(r);return}try{t.value(r)}catch(s){n(s)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,n,i,s;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof 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}},LN=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},wh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ie,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ie,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};wh.INSTANCE=new wh;var pf=wh;function RN(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}pf.INSTANCE.onDidChangeZoomLevel;function DN(e){return pf.INSTANCE.getZoomFactor(e)}pf.INSTANCE.onDidChangeFullscreen;var fs=typeof navigator=="object"?navigator.userAgent:"",bh=fs.indexOf("Firefox")>=0,MN=fs.indexOf("AppleWebKit")>=0,mf=fs.indexOf("Chrome")>=0,IN=!mf&&fs.indexOf("Safari")>=0;fs.indexOf("Electron/")>=0;fs.indexOf("Android")>=0;var Kc=!1;if(typeof on.matchMedia=="function"){let e=on.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=on.matchMedia("(display-mode: fullscreen)");Kc=e.matches,RN(on,e,({matches:r})=>{Kc&&t.matches||(Kc=r)})}var Hi="en",kh=!1,Ch=!1,Il=!1,Yy=!1,dl,Al=Hi,Um=Hi,AN,Nr,ui=globalThis,Ct,Hg;typeof ui.vscode<"u"&&typeof ui.vscode.process<"u"?Ct=ui.vscode.process:typeof process<"u"&&typeof((Hg=process==null?void 0:process.versions)==null?void 0:Hg.node)=="string"&&(Ct=process);var Wg,BN=typeof((Wg=Ct==null?void 0:Ct.versions)==null?void 0:Wg.electron)=="string",ON=BN&&(Ct==null?void 0:Ct.type)==="renderer",Ug;if(typeof Ct=="object"){kh=Ct.platform==="win32",Ch=Ct.platform==="darwin",Il=Ct.platform==="linux",Il&&Ct.env.SNAP&&Ct.env.SNAP_REVISION,Ct.env.CI||Ct.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dl=Hi,Al=Hi;let e=Ct.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);dl=t.userLocale,Um=t.osLocale,Al=t.resolvedLanguage||Hi,AN=(Ug=t.languagePack)==null?void 0:Ug.translationsConfigFile}catch{}Yy=!0}else typeof navigator=="object"&&!ON?(Nr=navigator.userAgent,kh=Nr.indexOf("Windows")>=0,Ch=Nr.indexOf("Macintosh")>=0,(Nr.indexOf("Macintosh")>=0||Nr.indexOf("iPad")>=0||Nr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Il=Nr.indexOf("Linux")>=0,(Nr==null?void 0:Nr.indexOf("Mobi"))>=0,Al=globalThis._VSCODE_NLS_LANGUAGE||Hi,dl=navigator.language.toLowerCase(),Um=dl):console.error("Unable to resolve platform.");var Xy=kh,Xr=Ch,jN=Il,Km=Yy,Gr=Nr,vn=Al,zN;(e=>{function t(){return vn}e.value=t;function r(){return vn.length===2?vn==="en":vn.length>=3?vn[0]==="e"&&vn[1]==="n"&&vn[2]==="-":!1}e.isDefaultVariant=r;function n(){return vn==="en"}e.isDefault=n})(zN||(zN={}));var FN=typeof ui.postMessage=="function"&&!ui.importScripts;(()=>{if(FN){let e=[];ui.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,i=e.length;n<i;n++){let s=e[n];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(n,1),s.callback();return}}});let t=0;return r=>{let n=++t;e.push({id:n,callback:r}),ui.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var $N=!!(Gr&&Gr.indexOf("Chrome")>=0);Gr&&Gr.indexOf("Firefox")>=0;!$N&&Gr&&Gr.indexOf("Safari")>=0;Gr&&Gr.indexOf("Edg/")>=0;Gr&&Gr.indexOf("Android")>=0;var Ti=typeof navigator=="object"?navigator:{};Km||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ti&&Ti.clipboard&&Ti.clipboard.writeText,Km||Ti&&Ti.clipboard&&Ti.clipboard.readText;var gf=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 gf,Vm=new gf,qm=new gf,HN=new Array(230),Gy;(e=>{function t(l){return Vc.keyCodeToStr(l)}e.toString=t;function r(l){return Vc.strToKeyCode(l)}e.fromString=r;function n(l){return Vm.keyCodeToStr(l)}e.toUserSettingsUS=n;function i(l){return qm.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return Vm.strToKeyCode(l)||qm.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})(Gy||(Gy={}));var WN=class Qy{constructor(t,r,n,i,s){this.ctrlKey=t,this.shiftKey=r,this.altKey=n,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof Qy&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",n=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${r}${n}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new UN([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},UN=class{constructor(e){if(e.length===0)throw mN("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function KN(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return Gy.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(bh)switch(t){case 59:return 85;case 60:if(jN)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Xr)return 57;break}else if(MN&&(Xr&&t===93||!Xr&&t===92))return 57;return HN[t]||0}var VN=Xr?256:2048,qN=512,YN=1024,XN=Xr?2048:256,Ym=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=KN(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|=VN),this.altKey&&(t|=qN),this.shiftKey&&(t|=YN),this.metaKey&&(t|=XN),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new WN(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Xm=new WeakMap;function GN(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var QN=class{static getSameOriginWindowChain(e){let t=Xm.get(e);if(!t){t=[],Xm.set(e,t);let r=e,n;do n=GN(r),n?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=n;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,n=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(r+=(o==null?void 0:o.scrollY)??0,n+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let l=s.iframeElement.getBoundingClientRect();r+=l.top,n+=l.left}return{top:r,left:n}}},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 r=QN.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Gm=class{constructor(e,t=0,r=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let n=!1;if(mf){let s=navigator.userAgent.match(/Chrome\/(\d+)/);n=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,l=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")n?this.deltaY=s.wheelDeltaY/(120*l):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?bh&&!Xr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")IN&&Xy?this.deltaX=-(s.wheelDeltaX/120):n?this.deltaX=s.wheelDeltaX/(120*l):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?bh&&!Xr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Zy=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),ZN;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof JN?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Et.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Zy})})(ZN||(ZN={}));var JN=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?Zy:(this._emitter||(this._emitter=new ie),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))}},eP=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new _h("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=We(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},tP;(e=>{async function t(n){let i,s=await Promise.all(n.map(o=>o.then(l=>l,l=>{i||(i=l)})));if(typeof i<"u")throw i;return s}e.settled=t;function r(n){return new Promise(async(i,s)=>{try{await n(i,s)}catch(o){s(o)}})}e.withAsyncBody=r})(tP||(tP={}));var Qm=class _r{static fromArray(t){return new _r(r=>{r.emitMany(t)})}static fromPromise(t){return new _r(async r=>{r.emitMany(await t)})}static fromPromises(t){return new _r(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new _r(async r=>{await Promise.all(t.map(async n=>{for await(let i of n)r.emitOne(i)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new ie,queueMicrotask(async()=>{let n={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(n)),this.resolve()}catch(i){this.reject(i)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Et.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new _r(async n=>{for await(let i of t)n.emitOne(r(i))})}map(t){return _r.map(this,t)}static filter(t,r){return new _r(async n=>{for await(let i of t)r(i)&&n.emitOne(i)})}filter(t){return _r.filter(this,t)}static coalesce(t){return _r.filter(t,r=>!!r)}coalesce(){return _r.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return _r.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())}};Qm.EMPTY=Qm.fromArray([]);var{getWindow:Vr,getWindowId:rP,onDidRegisterWindow:nP}=function(){let e=new Map,t={window:on,disposables:new jn};e.set(on.vscodeWindowId,t);let r=new ie,n=new ie,i=new ie;function s(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:n.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Ee.None;let l=new jn,a={window:o,disposables:l.add(new jn)};return e.set(o.vscodeWindowId,a),l.add(We(()=>{e.delete(o.vscodeWindowId),n.fire(o)})),l.add(Se(o,_t.BEFORE_UNLOAD,()=>{i.fire(o)})),r.fire(a),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let l=o;if((c=l==null?void 0:l.ownerDocument)!=null&&c.defaultView)return l.ownerDocument.defaultView.window;let a=o;return a!=null&&a.view?a.view.window:on},getDocument(o){return Vr(o).document}}}(),iP=class{constructor(e,t,r,n){this._node=e,this._type=t,this._handler=r,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Se(e,t,r,n){return new iP(e,t,r,n)}var Zm=function(e,t,r,n){return Se(e,t,r,n)},vf,sP=class extends eP{constructor(e){super(),this.defaultTarget=e&&Vr(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},Jm=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,r=new Map,n=new Map,i=s=>{r.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),n.set(s,!0);o.length>0;)o.sort(Jm.sort),o.shift().execute();n.set(s,!1)};vf=(s,o,l=0)=>{let a=rP(s),c=new Jm(o,l),h=e.get(a);return h||(h=[],e.set(a,h)),h.push(c),r.get(a)||(r.set(a,!0),s.requestAnimationFrame(()=>i(a))),c}})();function oP(e){let t=e.getBoundingClientRect(),r=Vr(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var _t={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},lP=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 lP(e)}var Jy=class{constructor(){this._hooks=new jn,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,n,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(We(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=Vr(e)}this._hooks.add(Se(s,_t.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Se(s,_t.POINTER_UP,o=>this.stopMonitoring(!0)))}};function aP(e,t,r){let n=null,i=null;if(typeof r.value=="function"?(n="value",i=r.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",i=r.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;r[n]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var $r;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))($r||($r={}));var Os=class Dt extends Ee{constructor(){super(),this.dispatched=!1,this.targets=new Wm,this.ignoreTargets=new Wm,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Et.runAndSubscribe(nP,({window:t,disposables:r})=>{r.add(Se(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(Se(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(Se(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:on,disposables:this._store}))}static addTarget(t){if(!Dt.isTouchDevice())return Ee.None;Dt.INSTANCE||(Dt.INSTANCE=new Dt);let r=Dt.INSTANCE.targets.push(t);return We(r)}static ignoreTarget(t){if(!Dt.isTouchDevice())return Ee.None;Dt.INSTANCE||(Dt.INSTANCE=new Dt);let r=Dt.INSTANCE.ignoreTargets.push(t);return We(r)}static isTouchDevice(){return"ontouchstart"in on||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,i=t.targetTouches.length;n<i;n++){let s=t.targetTouches.item(n);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:r,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[r],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent($r.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let n=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=r.changedTouches.length;s<o;s++){let l=r.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let a=this.activeTouches[l.identifier],c=Date.now()-a.initialTimeStamp;if(c<Dt.HOLD_DELAY&&Math.abs(a.initialPageX-ir(a.rollingPageX))<30&&Math.abs(a.initialPageY-ir(a.rollingPageY))<30){let h=this.newGestureEvent($r.Tap,a.initialTarget);h.pageX=ir(a.rollingPageX),h.pageY=ir(a.rollingPageY),this.dispatchEvent(h)}else if(c>=Dt.HOLD_DELAY&&Math.abs(a.initialPageX-ir(a.rollingPageX))<30&&Math.abs(a.initialPageY-ir(a.rollingPageY))<30){let h=this.newGestureEvent($r.Contextmenu,a.initialTarget);h.pageX=ir(a.rollingPageX),h.pageY=ir(a.rollingPageY),this.dispatchEvent(h)}else if(i===1){let h=ir(a.rollingPageX),u=ir(a.rollingPageY),d=ir(a.rollingTimestamps)-a.rollingTimestamps[0],f=h-a.rollingPageX[0],m=u-a.rollingPageY[0],g=[...this.targets].filter(x=>a.initialTarget instanceof Node&&x.contains(a.initialTarget));this.inertia(t,g,n,Math.abs(f)/d,f>0?1:-1,h,Math.abs(m)/d,m>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent($r.End,a.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=r,n.tapCount=0,n}dispatchEvent(t){if(t.type===$r.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Dt.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===$r.Change||t.type===$r.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let r=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==n;)i++,s=s.parentElement;r.push([i,n])}r.sort((n,i)=>n[0]-i[0]);for(let[n,i]of r)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,n,i,s,o,l,a,c){this.handle=vf(t,()=>{let h=Date.now(),u=h-n,d=0,f=0,m=!0;i+=Dt.SCROLL_FRICTION*u,l+=Dt.SCROLL_FRICTION*u,i>0&&(m=!1,d=s*i*u),l>0&&(m=!1,f=a*l*u);let g=this.newGestureEvent($r.Change);g.translationX=d,g.translationY=f,r.forEach(x=>x.dispatchEvent(g)),m||this.inertia(t,r,h,i,s,o+d,l,a,c+f)})}onTouchMove(t){let r=Date.now();for(let n=0,i=t.changedTouches.length;n<i;n++){let s=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],l=this.newGestureEvent($r.Change,o.initialTarget);l.translationX=s.pageX-ir(o.rollingPageX),l.translationY=s.pageY-ir(o.rollingPageY),l.pageX=s.pageX,l.pageY=s.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Os.SCROLL_FRICTION=-.005,Os.HOLD_DELAY=700,Os.CLEAR_TAP_COUNT_TIME=400,rt([aP],Os,"isTouchDevice",1);var cP=Os,yf=class extends Ee{onclick(e,t){this._register(Se(e,_t.CLICK,r=>t(new fl(Vr(e),r))))}onmousedown(e,t){this._register(Se(e,_t.MOUSE_DOWN,r=>t(new fl(Vr(e),r))))}onmouseover(e,t){this._register(Se(e,_t.MOUSE_OVER,r=>t(new fl(Vr(e),r))))}onmouseleave(e,t){this._register(Se(e,_t.MOUSE_LEAVE,r=>t(new fl(Vr(e),r))))}onkeydown(e,t){this._register(Se(e,_t.KEY_DOWN,r=>t(new Ym(r))))}onkeyup(e,t){this._register(Se(e,_t.KEY_UP,r=>t(new Ym(r))))}oninput(e,t){this._register(Se(e,_t.INPUT,t))}onblur(e,t){this._register(Se(e,_t.BLUR,t))}onfocus(e,t){this._register(Se(e,_t.FOCUS,t))}onchange(e,t){this._register(Se(e,_t.CHANGE,t))}ignoreGesture(e){return cP.ignoreTarget(e)}},eg=11,uP=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=eg+"px",this.domNode.style.height=eg+"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 Jy),this._register(Zm(this.bgDomNode,_t.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Zm(this.domNode,_t.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new sP),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,Vr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},hP=class Eh{constructor(t,r,n,i,s,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,i=i|0,s=s|0,o=o|0,l=l|0),this.rawScrollLeft=i,this.rawScrollTop=l,r<0&&(r=0),i+r>n&&(i=n-r),i<0&&(i=0),s<0&&(s=0),l+s>o&&(l=o-s),l<0&&(l=0),this.width=r,this.scrollWidth=n,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Eh(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new 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,r){let n=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,a=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},dP=class extends Ee{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ie),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new hP(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var n;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(n=this._smoothScrolling)==null||n.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let n;t?n=new rg(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=rg.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},tg=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function qc(e,t){let r=t-e;return function(n){return e+r*mP(n)}}function fP(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var rg=class Th{constructor(t,r,n,i){this.from=t,this.to=r,this.duration=i,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,r,n){if(Math.abs(t-r)>2.5*n){let i,s;return t<r?(i=t+.75*n,s=r-.75*n):(i=t-.75*n,s=r+.75*n),fP(qc(t,i),qc(s,r),.33)}return qc(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let n=this.scrollLeft(r),i=this.scrollTop(r);return new tg(n,i,!1)}return new tg(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return Th.start(t,r,n)}static start(t,r,n){n=n+10;let i=Date.now()-10;return new Th(t,r,i,n)}};function pP(e){return Math.pow(e,3)}function mP(e){return 1-pP(1-e)}var gP=class extends Ee{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new _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":"")))}},_P=140,e1=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 gP(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Jy),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(Se(this.domNode.domNode,_t.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new uP(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=eo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Se(this.slider.domNode,_t.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);r<=i&&i<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let i=oP(this.domNode.domNode);t=e.pageX-i.left,r=e.pageY-i.top}let n=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-r);if(Xy&&o>_P){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let l=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},t1=class Nh{constructor(t,r,n,i,s,o){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Nh(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,n,i,s){let o=Math.max(0,n-t),l=Math.max(0,o-2*r),a=i>0&&i>n;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*l/i))),h=(l-c)/(i-n),u=s*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=Nh._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,n=this._scrollPosition;return r<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},vP=class extends e1{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new t1(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},yP=class extends e1{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new t1(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},xP=500,ng=50,SP=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Ph=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,n=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-n);if(t-=s,r+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,n++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(mf){let r=Vr(t.browserEvent),n=DN(r);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,n){let i=null,s=new SP(t,r,n);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,i)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),r){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(r.deltaX),l=Math.abs(r.deltaY),a=Math.max(Math.min(i,o),1),c=Math.max(Math.min(s,l),1),h=Math.max(i,o),u=Math.max(s,l);h%a===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Ph.INSTANCE=new Ph;var wP=Ph,bP=class extends yf{constructor(e,t,r){super(),this._onScroll=this._register(new ie),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ie),this.onWillScroll=this._onWillScroll.event,this._options=CP(t),this._scrollable=r,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let n={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new yP(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new vP(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=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,Xr&&(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 Gm(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=_i(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new Gm(r))};this._mouseWheelToDispose.push(Se(this._listenOnDomNode,_t.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=wP.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let l=!Xr&&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=ng*s,u=a.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(c,u)}if(o){let h=ng*o,u=a.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(c,u)}c=this._scrollable.validateScrollPosition(c),(a.scrollLeft!==c.scrollLeft||a.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,n=r?" left":"",i=t?" top":"",s=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),xP)}},kP=class extends bP{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function CP(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,Xr&&(t.className+=" mac"),t}var Lh=class extends Ee{constructor(e,t,r,n,i,s,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new ie),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new dP({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>vf(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new kP(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(We(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(We(()=>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),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Lh=rt([ce(2,Kt),ce(3,pn),ce(4,Ay),ce(5,ds),ce(6,Vt),ce(7,mn)],Lh);var Rh=class extends Ee{constructor(e,t,r,n,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=n,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(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 n;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((n=e==null?void 0:e.options)==null?void 0:n.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Rh=rt([ce(1,Kt),ce(2,pn),ce(3,jo),ce(4,mn)],Rh);var EP=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},zr={full:0,left:0,center:0,right:0},yn={full:0,left:0,center:0,right:0},Es={full:0,left:0,center:0,right:0},_a=class extends Ee{constructor(e,t,r,n,i,s,o,l){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new EP,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);yn.full=this._canvas.width,yn.left=e,yn.center=t,yn.right=e,this._refreshDrawHeightConstants(),Es.full=1,Es.left=1,Es.center=1+yn.left,Es.right=1+yn.left+yn.center}_refreshDrawHeightConstants(){zr.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);zr.left=t,zr.center=t,zr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.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)-zr[e.position||"full"]/2),yn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+zr[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=rt([ce(2,Kt),ce(3,jo),ce(4,mn),ce(5,Vt),ce(6,ds),ce(7,pn)],_a);var q;(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=""))(q||(q={}));var Bl;(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="Ÿ"))(Bl||(Bl={}));var r1;(e=>e.ST=`${q.ESC}\\`)(r1||(r1={}));var Dh=class{constructor(e,t,r,n,i,s){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=i,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${q.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Dh=rt([ce(2,Kt),ce(3,Vt),ce(4,bi),ce(5,mn)],Dh);var yt=0,xt=0,St=0,et=0,ig={css:"#00000000",rgba:0},at;(e=>{function t(i,s,o,l){return l!==void 0?`#${Yn(i)}${Yn(s)}${Yn(o)}${Yn(l)}`:`#${Yn(i)}${Yn(s)}${Yn(o)}`}e.toCss=t;function r(i,s,o,l=255){return(i<<24|s<<16|o<<8|l)>>>0}e.toRgba=r;function n(i,s,o,l){return{css:e.toCss(i,s,o,l),rgba:e.toRgba(i,s,o,l)}}e.toColor=n})(at||(at={}));var Fe;(e=>{function t(a,c){if(et=(c.rgba&255)/255,et===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,m=a.rgba>>16&255,g=a.rgba>>8&255;yt=f+Math.round((h-f)*et),xt=m+Math.round((u-m)*et),St=g+Math.round((d-g)*et);let x=at.toCss(yt,xt,St),_=at.toRgba(yt,xt,St);return{css:x,rgba:_}}e.blend=t;function r(a){return(a.rgba&255)===255}e.isOpaque=r;function n(a,c,h){let u=Ol.ensureContrastRatio(a.rgba,c.rgba,h);if(u)return at.toColor(u>>24&255,u>>16&255,u>>8&255)}e.ensureContrastRatio=n;function i(a){let c=(a.rgba|255)>>>0;return[yt,xt,St]=Ol.toChannels(c),{css:at.toCss(yt,xt,St),rgba:c}}e.opaque=i;function s(a,c){return et=Math.round(c*255),[yt,xt,St]=Ol.toChannels(a.rgba),{css:at.toCss(yt,xt,St,et),rgba:at.toRgba(yt,xt,St,et)}}e.opacity=s;function o(a,c){return et=a.rgba&255,s(a,et*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})(Fe||(Fe={}));var qe;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return yt=parseInt(i.slice(1,2).repeat(2),16),xt=parseInt(i.slice(2,3).repeat(2),16),St=parseInt(i.slice(3,4).repeat(2),16),at.toColor(yt,xt,St);case 5:return yt=parseInt(i.slice(1,2).repeat(2),16),xt=parseInt(i.slice(2,3).repeat(2),16),St=parseInt(i.slice(3,4).repeat(2),16),et=parseInt(i.slice(4,5).repeat(2),16),at.toColor(yt,xt,St,et);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return yt=parseInt(s[1]),xt=parseInt(s[2]),St=parseInt(s[3]),et=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),at.toColor(yt,xt,St,et);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[yt,xt,St,et]=t.getImageData(0,0,1,1).data,et!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:at.toRgba(yt,xt,St,et),css:i}}e.toColor=n})(qe||(qe={}));var zt;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,s){let o=n/255,l=i/255,a=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),u=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return c*.2126+h*.7152+u*.0722}e.relativeLuminance2=r})(zt||(zt={}));var Ol;(e=>{function t(o,l){if(et=(l&255)/255,et===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)*et),xt=d+Math.round((c-d)*et),St=f+Math.round((h-f)*et),at.toRgba(yt,xt,St)}e.blend=t;function r(o,l,a){let c=zt.relativeLuminance(o>>8),h=zt.relativeLuminance(l>>8);if(Jr(c,h)<a){if(h<c){let f=n(o,l,a),m=Jr(c,zt.relativeLuminance(f>>8));if(m<a){let g=i(o,l,a),x=Jr(c,zt.relativeLuminance(g>>8));return m>x?f:g}return f}let u=i(o,l,a),d=Jr(c,zt.relativeLuminance(u>>8));if(d<a){let f=n(o,l,a),m=Jr(c,zt.relativeLuminance(f>>8));return d>m?u:f}return u}}e.ensureContrastRatio=r;function n(o,l,a){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,m=l>>8&255,g=Jr(zt.relativeLuminance2(d,f,m),zt.relativeLuminance2(c,h,u));for(;g<a&&(d>0||f>0||m>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),m-=Math.max(0,Math.ceil(m*.1)),g=Jr(zt.relativeLuminance2(d,f,m),zt.relativeLuminance2(c,h,u));return(d<<24|f<<16|m<<8|255)>>>0}e.reduceLuminance=n;function i(o,l,a){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,m=l>>8&255,g=Jr(zt.relativeLuminance2(d,f,m),zt.relativeLuminance2(c,h,u));for(;g<a&&(d<255||f<255||m<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),g=Jr(zt.relativeLuminance2(d,f,m),zt.relativeLuminance2(c,h,u));return(d<<24|f<<16|m<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(Ol||(Ol={}));function Yn(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Jr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var TP=class extends Oo{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},va=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new kr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],n=t.translateToString(!0),i=0,s=0,o=0,l=t.getFg(0),a=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==a){if(c-i>1){let h=this._getJoinedRanges(n,o,s,t,i);for(let u=0;u<h.length;u++)r.push(h[u])}i=c,o=s,l=this._workCell.fg,a=this._workCell.bg}s+=this._workCell.getChars().length||Pn.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(n,o,s,t,i);for(let h=0;h<c.length;h++)r.push(c[h])}return r}_getJoinedRanges(e,t,r,n,i){let s=e.substring(t,r),o=[];try{o=this._characterJoiners[0].handler(s)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let a=this._characterJoiners[l].handler(s);for(let c=0;c<a.length;c++)va._mergeRanges(o,a[c])}catch(a){console.error(a)}return this._stringRangesToCellRanges(o,n,i),o}_stringRangesToCellRanges(e,t,r){let n=0,i=!1,s=0,o=e[n];if(o){for(let l=r;l<this._bufferService.cols;l++){let a=t.getWidth(l),c=t.getString(l).length||Pn.length;if(a!==0){if(!i&&o[0]<=s&&(o[0]=l,i=!0),o[1]<=s){if(o[1]=l,o=e[++n],!o)break;o[0]<=s?(o[0]=l,i=!0):i=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(r){if(t[1]<=i[0])return e[n-1][1]=t[1],e;if(t[1]<=i[1])return e[n-1][1]=Math.max(t[1],i[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=i[0])return e.splice(n,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};va=rt([ce(0,Kt)],va);function NP(e){return 57508<=e&&e<=57558}function PP(e){return 9472<=e&&e<=9631}function LP(e){return NP(e)||PP(e)}function RP(){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,r,n,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new kr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,i,s,o,l,a,c,h){let u=[],d=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,m=e.getNoBgTrimmedLength();r&&m<s+1&&(m=s+1);let g,x=0,_="",v=0,y=0,E=0,N=0,k=!1,I=0,z=!1,Z=0,T=0,R=[],A=c!==-1&&h!==-1;for(let D=0;D<m;D++){e.loadCell(D,this._workCell);let U=this._workCell.getWidth();if(U===0)continue;let M=!1,F=D>=T,W=D,L=this._workCell;if(d.length>0&&D===d[0][0]&&F){let ve=d.shift(),Ke=this._isCellInSelection(ve[0],t);for(v=ve[0]+1;v<ve[1];v++)F&&(F=Ke===this._isCellInSelection(v,t));F&&(F=!r||s<ve[0]||s>=ve[1]),F?(M=!0,L=new TP(this._workCell,e.translateToString(!0,ve[0],ve[1]),ve[1]-ve[0]),W=ve[1]-1,U=L.getWidth()):T=ve[1]}let $=this._isCellInSelection(D,t),S=r&&D===s,ne=A&&D>=c&&D<=h,oe=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,ve=>{oe=!0});let b=L.getChars()||Pn;if(b===" "&&(L.isUnderline()||L.isOverline())&&(b=" "),Z=U*l-a.get(b,L.isBold(),L.isItalic()),!g)g=this._document.createElement("span");else if(x&&($&&z||!$&&!z&&L.bg===y)&&($&&z&&f.selectionForeground||L.fg===E)&&L.extended.ext===N&&ne===k&&Z===I&&!S&&!M&&!oe&&F){L.isInvisible()?_+=Pn:_+=b,x++;continue}else x&&(g.textContent=_),g=this._document.createElement("span"),x=0,_="";if(y=L.bg,E=L.fg,N=L.extended.ext,k=ne,I=Z,z=$,M&&s>=D&&s<=W&&(s=D),!this._coreService.isCursorHidden&&S&&this._coreService.isCursorInitialized){if(R.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&R.push("xterm-cursor-blink"),R.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":R.push("xterm-cursor-outline");break;case"block":R.push("xterm-cursor-block");break;case"bar":R.push("xterm-cursor-bar");break;case"underline":R.push("xterm-cursor-underline");break}}if(L.isBold()&&R.push("xterm-bold"),L.isItalic()&&R.push("xterm-italic"),L.isDim()&&R.push("xterm-dim"),L.isInvisible()?_=Pn:_=L.getChars()||Pn,L.isUnderline()&&(R.push(`xterm-underline-${L.extended.underlineStyle}`),_===" "&&(_=" "),!L.isUnderlineColorDefault()))if(L.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Oo.toColorRGB(L.getUnderlineColor()).join(",")})`;else{let ve=L.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&L.isBold()&&ve<8&&(ve+=8),g.style.textDecorationColor=f.ansi[ve].css}L.isOverline()&&(R.push("xterm-overline"),_===" "&&(_=" ")),L.isStrikethrough()&&R.push("xterm-strikethrough"),ne&&(g.style.textDecoration="underline");let me=L.getFgColor(),V=L.getFgColorMode(),H=L.getBgColor(),G=L.getBgColorMode(),he=!!L.isInverse();if(he){let ve=me;me=H,H=ve;let Ke=V;V=G,G=Ke}let ue,ge,O=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,ve=>{ve.options.layer!=="top"&&O||(ve.backgroundColorRGB&&(G=50331648,H=ve.backgroundColorRGB.rgba>>8&16777215,ue=ve.backgroundColorRGB),ve.foregroundColorRGB&&(V=50331648,me=ve.foregroundColorRGB.rgba>>8&16777215,ge=ve.foregroundColorRGB),O=ve.options.layer==="top")}),!O&&$&&(ue=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,H=ue.rgba>>8&16777215,G=50331648,O=!0,f.selectionForeground&&(V=50331648,me=f.selectionForeground.rgba>>8&16777215,ge=f.selectionForeground)),O&&R.push("xterm-decoration-top");let Ue;switch(G){case 16777216:case 33554432:Ue=f.ansi[H],R.push(`xterm-bg-${H}`);break;case 50331648:Ue=at.toColor(H>>16,H>>8&255,H&255),this._addStyle(g,`background-color:#${sg((H>>>0).toString(16),"0",6)}`);break;case 0:default:he?(Ue=f.foreground,R.push("xterm-bg-257")):Ue=f.background}switch(ue||L.isDim()&&(ue=Fe.multiplyOpacity(Ue,.5)),V){case 16777216:case 33554432:L.isBold()&&me<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(me+=8),this._applyMinimumContrast(g,Ue,f.ansi[me],L,ue,void 0)||R.push(`xterm-fg-${me}`);break;case 50331648:let ve=at.toColor(me>>16&255,me>>8&255,me&255);this._applyMinimumContrast(g,Ue,ve,L,ue,ge)||this._addStyle(g,`color:#${sg(me.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,Ue,f.foreground,L,ue,ge)||he&&R.push("xterm-fg-257")}R.length&&(g.className=R.join(" "),R.length=0),!S&&!M&&!oe&&F?x++:g.textContent=_,Z!==this.defaultSpacing&&(g.style.letterSpacing=`${Z}px`),u.push(g),D=W}return g&&x&&(g.textContent=_),u}_applyMinimumContrast(e,t,r,n,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||LP(n.getCode()))return!1;let o=this._getContrastCache(n),l;if(!i&&!s&&(l=o.getColor(t.rgba,r.rgba)),l===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);l=Fe.ensureContrastRatio(i||t,s||r,a),o.setColor((i||t).rgba,(s||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,n=this._selectionEnd;return!r||!n?!1:this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&t>=r[1]&&e<n[0]&&t<=n[1]:e<r[0]&&t>=r[1]&&e>=n[0]&&t<=n[1]:t>r[1]&&t<n[1]||r[1]===n[1]&&t===r[1]&&e>=r[0]&&e<n[0]||r[1]<n[1]&&t===n[1]&&e<n[0]||r[1]<n[1]&&t===r[1]&&e>=r[0]}};Mh=rt([ce(1,jy),ce(2,Vt),ce(3,pn),ce(4,bi),ce(5,jo),ce(6,ds)],Mh);function sg(e,t,r){for(;e.length<r;)e=t+e;return e}var DP=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[r,n,i,s],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,r,n){e===this._font&&t===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,r){let n=0;if(!t&&!r&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let o=this._measure(e,0);return o>0&&(this._flat[n]=o),o}let i=e;t&&(i+="B"),r&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),r&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},MP=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,n=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=r[1]-i,l=Math.max(s,0),a=Math.min(o,e.rows-1);if(l>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=a,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function IP(){return new MP}var Yc="xterm-dom-renderer-owner-",mr="xterm-rows",ml="xterm-fg-",og="xterm-bg-",Ts="xterm-focus",gl="xterm-selection",AP=1,Ih=class extends Ee{constructor(e,t,r,n,i,s,o,l,a,c,h,u,d,f){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=a,this._optionsService=c,this._bufferService=h,this._coreService=u,this._coreBrowserService=d,this._themeService=f,this._terminalClass=AP++,this._rowElements=[],this._selectionRenderModel=IP(),this.onRequestRedraw=this._register(new ie).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(mr),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(gl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=RP(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(Mh,document),this._element.classList.add(Yc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(We(()=>{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 DP(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${mr} 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} .${mr} { 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} .${mr} .xterm-dim { color: ${Fe.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${mr}.${Ts} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${mr}.${Ts} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${mr}.${Ts} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${mr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${gl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${gl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${gl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${ml}${s} { color: ${o.css}; }${this._terminalSelector} .${ml}${s}.xterm-dim { color: ${Fe.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${og}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${ml}257 { color: ${Fe.opaque(e.background).css}; }${this._terminalSelector} .${ml}257.xterm-dim { color: ${Fe.multiplyOpacity(Fe.opaque(e.background),.5).css}; }${this._terminalSelector} .${og}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(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,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let a=e[0]>t[0];l.appendChild(this._createSelectionElement(s,a?t[0]:e[0],a?e[0]:t[0],o-s+1))}else{let a=n===s?e[0]:0,c=s===i?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(s,a,c));let h=o-s-1;if(l.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,h)),s!==o){let u=i===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,u))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,r,n=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(r-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${n*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,n=r.ybase+r.y,i=Math.min(r.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=t;a++){let c=a+r.ydisp,h=this._rowElements[a],u=r.lines.get(c);if(!h||!u)break;h.replaceChildren(...this._rowFactory.createRow(u,c,c===n,o,l,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${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,r,n,i,s){r<0&&(e=0),n<0&&(t=0);let o=this._bufferService.rows-1;r=Math.max(Math.min(r,o),0),n=Math.max(Math.min(n,o),0),i=Math.min(i,this._bufferService.cols);let l=this._bufferService.buffer,a=l.ybase+l.y,c=Math.min(l.x,i-1),h=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=r;f<=n;++f){let m=f+l.ydisp,g=this._rowElements[f],x=l.lines.get(m);if(!g||!x)break;g.replaceChildren(...this._rowFactory.createRow(x,m,m===a,u,d,c,h,this.dimensions.css.cell.width,this._widthCache,s?f===r?e:0:-1,s?(f===n?t:i)-1:-1))}}};Ih=rt([ce(7,df),ce(8,Ya),ce(9,Vt),ce(10,Kt),ce(11,bi),ce(12,pn),ce(13,ds)],Ih);var Ah=class extends Ee{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ie),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new OP(this._optionsService))}catch{this._measureStrategy=this._register(new BP(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())}};Ah=rt([ce(2,Vt)],Ah);var n1=class extends Ee{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)}},BP=class extends n1{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},OP=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}},jP=class extends Ee{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new zP(this._window)),this._onDprChange=this._register(new ie),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ie),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Et.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}},zP=class extends Ee{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new is),this._onDprChange=this._register(new ie),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)}},FP=class extends Ee{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 xf(e,t,r){let n=r.getBoundingClientRect(),i=e.getComputedStyle(r),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-n.left-s,t.clientY-n.top-o]}function $P(e,t,r,n,i,s,o,l,a){if(!s)return;let c=xf(e,t,r);if(c)return c[0]=Math.ceil((c[0]+(a?o/2:0))/o),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),n+(a?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var Bh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return $P(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let r=xf(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};Bh=rt([ce(0,mn),ce(1,Ya)],Bh);var HP=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},i1={};ZT(i1,{getSafariVersion:()=>UP,isChromeOS:()=>a1,isFirefox:()=>s1,isIpad:()=>KP,isIphone:()=>VP,isLegacyEdge:()=>WP,isLinux:()=>Sf,isMac:()=>ya,isNode:()=>Xa,isSafari:()=>o1,isWindows:()=>l1});var Xa=typeof process<"u"&&"title"in process,zo=Xa?"node":navigator.userAgent,Fo=Xa?"node":navigator.platform,s1=zo.includes("Firefox"),WP=zo.includes("Edge"),o1=/^((?!chrome|android).)*safari/i.test(zo);function UP(){if(!o1)return 0;let e=zo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ya=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Fo),KP=Fo==="iPad",VP=Fo==="iPhone",l1=["Windows","Win16","Win32","WinCE"].includes(Fo),Sf=Fo.indexOf("Linux")>=0,a1=/\bCrOS\b/.test(zo),c1=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,n=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),i=e.timeRemaining(),r*1.5>i){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=i}this.clear()}},qP=class extends c1{_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())}}},YP=class extends c1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},xa=!Xa&&"requestIdleCallback"in window?YP:qP,XP=class{constructor(){this._queue=new xa}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Oh=class extends Ee{constructor(e,t,r,n,i,s,o,l,a){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=i,this._coreBrowserService=l,this._renderer=this._register(new is),this._pausedResizeTask=new XP,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 ie),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ie),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ie),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ie),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new HP((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new GP(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 r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=We(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(n=this._renderer.value)==null||n.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Oh=rt([ce(2,Vt),ce(3,Ya),ce(4,bi),ce(5,jo),ce(6,Kt),ce(7,pn),ce(8,ds)],Oh);var GP=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function QP(e,t,r,n){let i=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return eL(i,s,e,t,r,n)+Ga(s,t,r,n)+tL(i,s,e,t,r,n);let o;if(s===t)return o=i>e?"D":"C",ko(Math.abs(i-e),bo(o,n));o=s>t?"D":"C";let l=Math.abs(s-t),a=JP(s>t?e:i,r)+(l-1)*r.cols+1+ZP(s>t?i:e);return ko(a,bo(o,n))}function ZP(e,t){return e-1}function JP(e,t){return t.cols-e}function eL(e,t,r,n,i,s){return Ga(t,n,i,s).length===0?"":ko(h1(e,t,e,t-vi(t,i),!1,i).length,bo("D",s))}function Ga(e,t,r,n){let i=e-vi(e,r),s=t-vi(t,r),o=Math.abs(i-s)-rL(e,t,r);return ko(o,bo(u1(e,t),n))}function tL(e,t,r,n,i,s){let o;Ga(t,n,i,s).length>0?o=n-vi(n,i):o=t;let l=n,a=nL(e,t,r,n,i,s);return ko(h1(e,o,r,l,a==="C",i).length,bo(a,s))}function rL(e,t,r){var o;let n=0,i=e-vi(e,r),s=t-vi(t,r);for(let l=0;l<Math.abs(i-s);l++){let a=u1(e,t)==="A"?-1:1;(o=r.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&n++}return n}function vi(e,t){let r=0,n=t.buffer.lines.get(e),i=n==null?void 0:n.isWrapped;for(;i&&e>=0&&e<t.rows;)r++,n=t.buffer.lines.get(--e),i=n==null?void 0:n.isWrapped;return r}function nL(e,t,r,n,i,s){let o;return Ga(r,n,i,s).length>0?o=n-vi(n,i):o=t,e<r&&o<=n||e>=r&&o<n?"C":"D"}function u1(e,t){return e>t?"A":"B"}function h1(e,t,r,n,i,s){let o=e,l=t,a="";for(;(o!==r||l!==n)&&l>=0&&l<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(a+=s.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!i&&o<0&&(a+=s.buffer.translateBufferLineToString(l,!1,0,e+1),o=s.cols-1,e=o,l--);return a+s.buffer.translateBufferLineToString(l,!1,e,o)}function bo(e,t){let r=t?"O":"[";return q.ESC+r+e}function ko(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var iL=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 lg(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,sL=15,oL=50,lL=500,aL=" ",cL=new RegExp(aL,"g"),jh=class extends Ee{constructor(e,t,r,n,i,s,o,l,a){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=l,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new kr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ie),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ie),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ie),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ie),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 iL(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 r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=r.translateBufferLineToString(o,!0,i,s);n.push(l)}}else{let i=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=r.lines.get(s),l=r.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?n[n.length-1]+=l:n.push(l)}if(e[1]!==t[1]){let s=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?n[n.length-1]+=o:n.push(o)}}return n.map(i=>i.replace(cL," ")).join(l1?`\r
128
+ `))}},BT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},OT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},jT=0,Uc=class{constructor(e){this.value=e,this.id=jT++}},zT=2,FT,oe=class{constructor(t){var r,n,i,s;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new IT((t==null?void 0:t.onListenerError)??Dl,((n=this._options)==null?void 0:n.leakWarningThreshold)??MT):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new RT(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,r,n,i;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||n.call(r),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(t,r,n)=>{var l,a,c,h,u;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let 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],m=new OT(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Dl)(m),Ee.None}if(this._disposed)return Ee.None;r&&(t=t.bind(r));let i=new Uc(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=AT.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Uc?(this._deliveryQueue??(this._deliveryQueue=new $T),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 n instanceof jn?n.add(o):Array.isArray(n)&&n.push(o),o}),this._event}_removeListener(t){var s,o,l,a;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||a.call(l,this),this._size=0;return}let r=this._listeners,n=r.indexOf(t);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*zT<=r.length){let c=0;for(let h=0;h<r.length;h++)r[h]?r[c++]=r[h]:i&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=c}}_deliver(t,r){var i;if(!t)return;let n=((i=this._options)==null?void 0:i.onListenerError)||Dl;if(!n){t.value(r);return}try{t.value(r)}catch(s){n(s)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,n,i,s;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof 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}},$T=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},wh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new oe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new oe,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};wh.INSTANCE=new wh;var pf=wh;function HT(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}pf.INSTANCE.onDidChangeZoomLevel;function WT(e){return pf.INSTANCE.getZoomFactor(e)}pf.INSTANCE.onDidChangeFullscreen;var fs=typeof navigator=="object"?navigator.userAgent:"",bh=fs.indexOf("Firefox")>=0,UT=fs.indexOf("AppleWebKit")>=0,mf=fs.indexOf("Chrome")>=0,KT=!mf&&fs.indexOf("Safari")>=0;fs.indexOf("Electron/")>=0;fs.indexOf("Android")>=0;var Kc=!1;if(typeof sn.matchMedia=="function"){let e=sn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=sn.matchMedia("(display-mode: fullscreen)");Kc=e.matches,HT(sn,e,({matches:r})=>{Kc&&t.matches||(Kc=r)})}var Hi="en",kh=!1,Ch=!1,Rl=!1,i1=!1,ul,Ml=Hi,Jm=Hi,VT,Nr,ci=globalThis,bt,Zg;typeof ci.vscode<"u"&&typeof ci.vscode.process<"u"?bt=ci.vscode.process:typeof process<"u"&&typeof((Zg=process==null?void 0:process.versions)==null?void 0:Zg.node)=="string"&&(bt=process);var Jg,qT=typeof((Jg=bt==null?void 0:bt.versions)==null?void 0:Jg.electron)=="string",YT=qT&&(bt==null?void 0:bt.type)==="renderer",e_;if(typeof bt=="object"){kh=bt.platform==="win32",Ch=bt.platform==="darwin",Rl=bt.platform==="linux",Rl&&bt.env.SNAP&&bt.env.SNAP_REVISION,bt.env.CI||bt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ul=Hi,Ml=Hi;let e=bt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ul=t.userLocale,Jm=t.osLocale,Ml=t.resolvedLanguage||Hi,VT=(e_=t.languagePack)==null?void 0:e_.translationsConfigFile}catch{}i1=!0}else typeof navigator=="object"&&!YT?(Nr=navigator.userAgent,kh=Nr.indexOf("Windows")>=0,Ch=Nr.indexOf("Macintosh")>=0,(Nr.indexOf("Macintosh")>=0||Nr.indexOf("iPad")>=0||Nr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Rl=Nr.indexOf("Linux")>=0,(Nr==null?void 0:Nr.indexOf("Mobi"))>=0,Ml=globalThis._VSCODE_NLS_LANGUAGE||Hi,ul=navigator.language.toLowerCase(),Jm=ul):console.error("Unable to resolve platform.");var s1=kh,Xr=Ch,XT=Rl,eg=i1,Gr=Nr,vn=Ml,GT;(e=>{function t(){return vn}e.value=t;function r(){return vn.length===2?vn==="en":vn.length>=3?vn[0]==="e"&&vn[1]==="n"&&vn[2]==="-":!1}e.isDefaultVariant=r;function n(){return vn==="en"}e.isDefault=n})(GT||(GT={}));var QT=typeof ci.postMessage=="function"&&!ci.importScripts;(()=>{if(QT){let e=[];ci.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,i=e.length;n<i;n++){let s=e[n];if(s.id===r.data.vscodeScheduleAsyncWork){e.splice(n,1),s.callback();return}}});let t=0;return r=>{let n=++t;e.push({id:n,callback:r}),ci.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var ZT=!!(Gr&&Gr.indexOf("Chrome")>=0);Gr&&Gr.indexOf("Firefox")>=0;!ZT&&Gr&&Gr.indexOf("Safari")>=0;Gr&&Gr.indexOf("Edg/")>=0;Gr&&Gr.indexOf("Android")>=0;var Ni=typeof navigator=="object"?navigator:{};eg||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ni&&Ni.clipboard&&Ni.clipboard.writeText,eg||Ni&&Ni.clipboard&&Ni.clipboard.readText;var gf=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 gf,tg=new gf,rg=new gf,JT=new Array(230),o1;(e=>{function t(l){return Vc.keyCodeToStr(l)}e.toString=t;function r(l){return Vc.strToKeyCode(l)}e.fromString=r;function n(l){return tg.keyCodeToStr(l)}e.toUserSettingsUS=n;function i(l){return rg.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return tg.strToKeyCode(l)||rg.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})(o1||(o1={}));var eP=class l1{constructor(t,r,n,i,s){this.ctrlKey=t,this.shiftKey=r,this.altKey=n,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof l1&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",n=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${r}${n}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new tP([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},tP=class{constructor(e){if(e.length===0)throw ET("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function rP(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return o1.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(bh)switch(t){case 59:return 85;case 60:if(XT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Xr)return 57;break}else if(UT&&(Xr&&t===93||!Xr&&t===92))return 57;return JT[t]||0}var nP=Xr?256:2048,iP=512,sP=1024,oP=Xr?2048:256,ng=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=rP(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|=nP),this.altKey&&(t|=iP),this.shiftKey&&(t|=sP),this.metaKey&&(t|=oP),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new eP(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},ig=new WeakMap;function lP(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var aP=class{static getSameOriginWindowChain(e){let t=ig.get(e);if(!t){t=[],ig.set(e,t);let r=e,n;do n=lP(r),n?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=n;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,n=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(r+=(o==null?void 0:o.scrollY)??0,n+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let l=s.iframeElement.getBoundingClientRect();r+=l.top,n+=l.left}return{top:r,left:n}}},hl=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=aP.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},sg=class{constructor(e,t=0,r=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let n=!1;if(mf){let s=navigator.userAgent.match(/Chrome\/(\d+)/);n=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,l=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")n?this.deltaY=s.wheelDeltaY/(120*l):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?bh&&!Xr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")KT&&s1?this.deltaX=-(s.wheelDeltaX/120):n?this.deltaX=s.wheelDeltaX/(120*l):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?bh&&!Xr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},a1=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),cP;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof uP?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:a1})})(cP||(cP={}));var uP=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?a1:(this._emitter||(this._emitter=new oe),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))}},hP=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new _h("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=We(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},dP;(e=>{async function t(n){let i,s=await Promise.all(n.map(o=>o.then(l=>l,l=>{i||(i=l)})));if(typeof i<"u")throw i;return s}e.settled=t;function r(n){return new Promise(async(i,s)=>{try{await n(i,s)}catch(o){s(o)}})}e.withAsyncBody=r})(dP||(dP={}));var og=class pr{static fromArray(t){return new pr(r=>{r.emitMany(t)})}static fromPromise(t){return new pr(async r=>{r.emitMany(await t)})}static fromPromises(t){return new pr(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new pr(async r=>{await Promise.all(t.map(async n=>{for await(let i of n)r.emitOne(i)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new oe,queueMicrotask(async()=>{let n={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(n)),this.resolve()}catch(i){this.reject(i)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await kt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new pr(async n=>{for await(let i of t)n.emitOne(r(i))})}map(t){return pr.map(this,t)}static filter(t,r){return new pr(async n=>{for await(let i of t)r(i)&&n.emitOne(i)})}filter(t){return pr.filter(this,t)}static coalesce(t){return pr.filter(t,r=>!!r)}coalesce(){return pr.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return pr.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())}};og.EMPTY=og.fromArray([]);var{getWindow:Vr,getWindowId:fP,onDidRegisterWindow:pP}=function(){let e=new Map,t={window:sn,disposables:new jn};e.set(sn.vscodeWindowId,t);let r=new oe,n=new oe,i=new oe;function s(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:n.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Ee.None;let l=new jn,a={window:o,disposables:l.add(new jn)};return e.set(o.vscodeWindowId,a),l.add(We(()=>{e.delete(o.vscodeWindowId),n.fire(o)})),l.add(we(o,mt.BEFORE_UNLOAD,()=>{i.fire(o)})),r.fire(a),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let l=o;if((c=l==null?void 0:l.ownerDocument)!=null&&c.defaultView)return l.ownerDocument.defaultView.window;let a=o;return a!=null&&a.view?a.view.window:sn},getDocument(o){return Vr(o).document}}}(),mP=class{constructor(e,t,r,n){this._node=e,this._type=t,this._handler=r,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function we(e,t,r,n){return new mP(e,t,r,n)}var lg=function(e,t,r,n){return we(e,t,r,n)},vf,gP=class extends hP{constructor(e){super(),this.defaultTarget=e&&Vr(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},ag=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){Dl(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,n=new Map,i=s=>{r.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),n.set(s,!0);o.length>0;)o.sort(ag.sort),o.shift().execute();n.set(s,!1)};vf=(s,o,l=0)=>{let a=fP(s),c=new ag(o,l),h=e.get(a);return h||(h=[],e.set(a,h)),h.push(c),r.get(a)||(r.set(a,!0),s.requestAnimationFrame(()=>i(a))),c}})();function _P(e){let t=e.getBoundingClientRect(),r=Vr(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var mt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},vP=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=Kt(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Kt(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Kt(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Kt(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Kt(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Kt(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Kt(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Kt(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Kt(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Kt(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Kt(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=Kt(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=Kt(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Kt(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 Kt(e){return typeof e=="number"?`${e}px`:e}function eo(e){return new vP(e)}var c1=class{constructor(){this._hooks=new jn,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,n,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(We(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=Vr(e)}this._hooks.add(we(s,mt.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(we(s,mt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function yP(e,t,r){let n=null,i=null;if(typeof r.value=="function"?(n="value",i=r.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",i=r.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;r[n]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var $r;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))($r||($r={}));var Os=class Lt extends Ee{constructor(){super(),this.dispatched=!1,this.targets=new Zm,this.ignoreTargets=new Zm,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(kt.runAndSubscribe(pP,({window:t,disposables:r})=>{r.add(we(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(we(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(we(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:sn,disposables:this._store}))}static addTarget(t){if(!Lt.isTouchDevice())return Ee.None;Lt.INSTANCE||(Lt.INSTANCE=new Lt);let r=Lt.INSTANCE.targets.push(t);return We(r)}static ignoreTarget(t){if(!Lt.isTouchDevice())return Ee.None;Lt.INSTANCE||(Lt.INSTANCE=new Lt);let r=Lt.INSTANCE.ignoreTargets.push(t);return We(r)}static isTouchDevice(){return"ontouchstart"in sn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,i=t.targetTouches.length;n<i;n++){let s=t.targetTouches.item(n);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:r,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[r],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent($r.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let n=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=r.changedTouches.length;s<o;s++){let l=r.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let a=this.activeTouches[l.identifier],c=Date.now()-a.initialTimeStamp;if(c<Lt.HOLD_DELAY&&Math.abs(a.initialPageX-Jt(a.rollingPageX))<30&&Math.abs(a.initialPageY-Jt(a.rollingPageY))<30){let h=this.newGestureEvent($r.Tap,a.initialTarget);h.pageX=Jt(a.rollingPageX),h.pageY=Jt(a.rollingPageY),this.dispatchEvent(h)}else if(c>=Lt.HOLD_DELAY&&Math.abs(a.initialPageX-Jt(a.rollingPageX))<30&&Math.abs(a.initialPageY-Jt(a.rollingPageY))<30){let h=this.newGestureEvent($r.Contextmenu,a.initialTarget);h.pageX=Jt(a.rollingPageX),h.pageY=Jt(a.rollingPageY),this.dispatchEvent(h)}else if(i===1){let h=Jt(a.rollingPageX),u=Jt(a.rollingPageY),d=Jt(a.rollingTimestamps)-a.rollingTimestamps[0],f=h-a.rollingPageX[0],m=u-a.rollingPageY[0],g=[...this.targets].filter(x=>a.initialTarget instanceof Node&&x.contains(a.initialTarget));this.inertia(t,g,n,Math.abs(f)/d,f>0?1:-1,h,Math.abs(m)/d,m>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent($r.End,a.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=r,n.tapCount=0,n}dispatchEvent(t){if(t.type===$r.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Lt.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===$r.Change||t.type===$r.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let r=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==n;)i++,s=s.parentElement;r.push([i,n])}r.sort((n,i)=>n[0]-i[0]);for(let[n,i]of r)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,n,i,s,o,l,a,c){this.handle=vf(t,()=>{let h=Date.now(),u=h-n,d=0,f=0,m=!0;i+=Lt.SCROLL_FRICTION*u,l+=Lt.SCROLL_FRICTION*u,i>0&&(m=!1,d=s*i*u),l>0&&(m=!1,f=a*l*u);let g=this.newGestureEvent($r.Change);g.translationX=d,g.translationY=f,r.forEach(x=>x.dispatchEvent(g)),m||this.inertia(t,r,h,i,s,o+d,l,a,c+f)})}onTouchMove(t){let r=Date.now();for(let n=0,i=t.changedTouches.length;n<i;n++){let s=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],l=this.newGestureEvent($r.Change,o.initialTarget);l.translationX=s.pageX-Jt(o.rollingPageX),l.translationY=s.pageY-Jt(o.rollingPageY),l.pageX=s.pageX,l.pageY=s.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Os.SCROLL_FRICTION=-.005,Os.HOLD_DELAY=700,Os.CLEAR_TAP_COUNT_TIME=400,Je([yP],Os,"isTouchDevice",1);var xP=Os,yf=class extends Ee{onclick(e,t){this._register(we(e,mt.CLICK,r=>t(new hl(Vr(e),r))))}onmousedown(e,t){this._register(we(e,mt.MOUSE_DOWN,r=>t(new hl(Vr(e),r))))}onmouseover(e,t){this._register(we(e,mt.MOUSE_OVER,r=>t(new hl(Vr(e),r))))}onmouseleave(e,t){this._register(we(e,mt.MOUSE_LEAVE,r=>t(new hl(Vr(e),r))))}onkeydown(e,t){this._register(we(e,mt.KEY_DOWN,r=>t(new ng(r))))}onkeyup(e,t){this._register(we(e,mt.KEY_UP,r=>t(new ng(r))))}oninput(e,t){this._register(we(e,mt.INPUT,t))}onblur(e,t){this._register(we(e,mt.BLUR,t))}onfocus(e,t){this._register(we(e,mt.FOCUS,t))}onchange(e,t){this._register(we(e,mt.CHANGE,t))}ignoreGesture(e){return xP.ignoreTarget(e)}},cg=11,SP=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=cg+"px",this.domNode.style.height=cg+"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 c1),this._register(lg(this.bgDomNode,mt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(lg(this.domNode,mt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new gP),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,Vr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},wP=class Eh{constructor(t,r,n,i,s,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,i=i|0,s=s|0,o=o|0,l=l|0),this.rawScrollLeft=i,this.rawScrollTop=l,r<0&&(r=0),i+r>n&&(i=n-r),i<0&&(i=0),s<0&&(s=0),l+s>o&&(l=o-s),l<0&&(l=0),this.width=r,this.scrollWidth=n,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Eh(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new 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,r){let n=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,a=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},bP=class extends Ee{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new wP(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var n;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(n=this._smoothScrolling)==null||n.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let n;t?n=new hg(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=hg.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},ug=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function qc(e,t){let r=t-e;return function(n){return e+r*EP(n)}}function kP(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var hg=class Nh{constructor(t,r,n,i){this.from=t,this.to=r,this.duration=i,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,r,n){if(Math.abs(t-r)>2.5*n){let i,s;return t<r?(i=t+.75*n,s=r-.75*n):(i=t-.75*n,s=r+.75*n),kP(qc(t,i),qc(s,r),.33)}return qc(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let n=this.scrollLeft(r),i=this.scrollTop(r);return new ug(n,i,!1)}return new ug(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,n){return Nh.start(t,r,n)}static start(t,r,n){n=n+10;let i=Date.now()-10;return new Nh(t,r,i,n)}};function CP(e){return Math.pow(e,3)}function EP(e){return 1-CP(1-e)}var NP=class extends Ee{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new _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":"")))}},TP=140,u1=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 NP(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new c1),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(we(this.domNode.domNode,mt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new SP(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=eo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(we(this.slider.domNode,mt.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);r<=i&&i<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let i=_P(this.domNode.domNode);t=e.pageX-i.left,r=e.pageY-i.top}let n=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-r);if(s1&&o>TP){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let l=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},h1=class Th{constructor(t,r,n,i,s,o){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Th(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,n,i,s){let o=Math.max(0,n-t),l=Math.max(0,o-2*r),a=i>0&&i>n;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*l/i))),h=(l-c)/(i-n),u=s*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=Th._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,n=this._scrollPosition;return r<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},PP=class extends u1{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new h1(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},LP=class extends u1{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new h1(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},DP=500,dg=50,RP=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Ph=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,n=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-n);if(t-=s,r+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,n++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(mf){let r=Vr(t.browserEvent),n=WT(r);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,n){let i=null,s=new RP(t,r,n);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,i)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),r){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(r.deltaX),l=Math.abs(r.deltaY),a=Math.max(Math.min(i,o),1),c=Math.max(Math.min(s,l),1),h=Math.max(i,o),u=Math.max(s,l);h%a===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Ph.INSTANCE=new Ph;var MP=Ph,IP=class extends yf{constructor(e,t,r){super(),this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new oe),this.onWillScroll=this._onWillScroll.event,this._options=BP(t),this._scrollable=r,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let n={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new LP(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new PP(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=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=gi(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,Xr&&(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 sg(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=gi(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new sg(r))};this._mouseWheelToDispose.push(we(this._listenOnDomNode,mt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=MP.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let l=!Xr&&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=dg*s,u=a.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(c,u)}if(o){let h=dg*o,u=a.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(c,u)}c=this._scrollable.validateScrollPosition(c),(a.scrollLeft!==c.scrollLeft||a.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,n=r?" left":"",i=t?" top":"",s=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),DP)}},AP=class extends IP{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function BP(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,Xr&&(t.className+=" mac"),t}var Lh=class extends Ee{constructor(e,t,r,n,i,s,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new oe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new bP({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>vf(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new AP(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(kt.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=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(We(()=>this._styleElement.remove())),this._register(kt.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
129
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Lh=Je([he(2,Ht),he(3,fn),he(4,Ky),he(5,ds),he(6,Wt),he(7,pn)],Lh);var Dh=class extends Ee{constructor(e,t,r,n,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=n,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(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 n;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((n=e==null?void 0:e.options)==null?void 0:n.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Dh=Je([he(1,Ht),he(2,fn),he(3,jo),he(4,pn)],Dh);var OP=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},zr={full:0,left:0,center:0,right:0},yn={full:0,left:0,center:0,right:0},Es={full:0,left:0,center:0,right:0},ma=class extends Ee{constructor(e,t,r,n,i,s,o,l){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new OP,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);yn.full=this._canvas.width,yn.left=e,yn.center=t,yn.right=e,this._refreshDrawHeightConstants(),Es.full=1,Es.left=1,Es.center=1+yn.left,Es.right=1+yn.left+yn.center}_refreshDrawHeightConstants(){zr.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);zr.left=t,zr.center=t,zr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zr.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)-zr[e.position||"full"]/2),yn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+zr[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}))}};ma=Je([he(2,Ht),he(3,jo),he(4,pn),he(5,Wt),he(6,ds),he(7,fn)],ma);var Y;(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=""))(Y||(Y={}));var Il;(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="Ÿ"))(Il||(Il={}));var d1;(e=>e.ST=`${Y.ESC}\\`)(d1||(d1={}));var Rh=class{constructor(e,t,r,n,i,s){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=i,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Y.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Rh=Je([he(2,Ht),he(3,Wt),he(4,wi),he(5,pn)],Rh);var _t=0,vt=0,yt=0,Qe=0,fg={css:"#00000000",rgba:0},st;(e=>{function t(i,s,o,l){return l!==void 0?`#${qn(i)}${qn(s)}${qn(o)}${qn(l)}`:`#${qn(i)}${qn(s)}${qn(o)}`}e.toCss=t;function r(i,s,o,l=255){return(i<<24|s<<16|o<<8|l)>>>0}e.toRgba=r;function n(i,s,o,l){return{css:e.toCss(i,s,o,l),rgba:e.toRgba(i,s,o,l)}}e.toColor=n})(st||(st={}));var Fe;(e=>{function t(a,c){if(Qe=(c.rgba&255)/255,Qe===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,m=a.rgba>>16&255,g=a.rgba>>8&255;_t=f+Math.round((h-f)*Qe),vt=m+Math.round((u-m)*Qe),yt=g+Math.round((d-g)*Qe);let x=st.toCss(_t,vt,yt),_=st.toRgba(_t,vt,yt);return{css:x,rgba:_}}e.blend=t;function r(a){return(a.rgba&255)===255}e.isOpaque=r;function n(a,c,h){let u=Al.ensureContrastRatio(a.rgba,c.rgba,h);if(u)return st.toColor(u>>24&255,u>>16&255,u>>8&255)}e.ensureContrastRatio=n;function i(a){let c=(a.rgba|255)>>>0;return[_t,vt,yt]=Al.toChannels(c),{css:st.toCss(_t,vt,yt),rgba:c}}e.opaque=i;function s(a,c){return Qe=Math.round(c*255),[_t,vt,yt]=Al.toChannels(a.rgba),{css:st.toCss(_t,vt,yt,Qe),rgba:st.toRgba(_t,vt,yt,Qe)}}e.opacity=s;function o(a,c){return Qe=a.rgba&255,s(a,Qe*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})(Fe||(Fe={}));var Ke;(e=>{let t,r;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return _t=parseInt(i.slice(1,2).repeat(2),16),vt=parseInt(i.slice(2,3).repeat(2),16),yt=parseInt(i.slice(3,4).repeat(2),16),st.toColor(_t,vt,yt);case 5:return _t=parseInt(i.slice(1,2).repeat(2),16),vt=parseInt(i.slice(2,3).repeat(2),16),yt=parseInt(i.slice(3,4).repeat(2),16),Qe=parseInt(i.slice(4,5).repeat(2),16),st.toColor(_t,vt,yt,Qe);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 _t=parseInt(s[1]),vt=parseInt(s[2]),yt=parseInt(s[3]),Qe=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),st.toColor(_t,vt,yt,Qe);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[_t,vt,yt,Qe]=t.getImageData(0,0,1,1).data,Qe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:st.toRgba(_t,vt,yt,Qe),css:i}}e.toColor=n})(Ke||(Ke={}));var Bt;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,i,s){let o=n/255,l=i/255,a=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),u=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4);return c*.2126+h*.7152+u*.0722}e.relativeLuminance2=r})(Bt||(Bt={}));var Al;(e=>{function t(o,l){if(Qe=(l&255)/255,Qe===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 _t=u+Math.round((a-u)*Qe),vt=d+Math.round((c-d)*Qe),yt=f+Math.round((h-f)*Qe),st.toRgba(_t,vt,yt)}e.blend=t;function r(o,l,a){let c=Bt.relativeLuminance(o>>8),h=Bt.relativeLuminance(l>>8);if(Zr(c,h)<a){if(h<c){let f=n(o,l,a),m=Zr(c,Bt.relativeLuminance(f>>8));if(m<a){let g=i(o,l,a),x=Zr(c,Bt.relativeLuminance(g>>8));return m>x?f:g}return f}let u=i(o,l,a),d=Zr(c,Bt.relativeLuminance(u>>8));if(d<a){let f=n(o,l,a),m=Zr(c,Bt.relativeLuminance(f>>8));return d>m?u:f}return u}}e.ensureContrastRatio=r;function n(o,l,a){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,m=l>>8&255,g=Zr(Bt.relativeLuminance2(d,f,m),Bt.relativeLuminance2(c,h,u));for(;g<a&&(d>0||f>0||m>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),m-=Math.max(0,Math.ceil(m*.1)),g=Zr(Bt.relativeLuminance2(d,f,m),Bt.relativeLuminance2(c,h,u));return(d<<24|f<<16|m<<8|255)>>>0}e.reduceLuminance=n;function i(o,l,a){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=l>>24&255,f=l>>16&255,m=l>>8&255,g=Zr(Bt.relativeLuminance2(d,f,m),Bt.relativeLuminance2(c,h,u));for(;g<a&&(d<255||f<255||m<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),g=Zr(Bt.relativeLuminance2(d,f,m),Bt.relativeLuminance2(c,h,u));return(d<<24|f<<16|m<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(Al||(Al={}));function qn(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Zr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var jP=class extends Oo{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ga=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Sr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],n=t.translateToString(!0),i=0,s=0,o=0,l=t.getFg(0),a=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==a){if(c-i>1){let h=this._getJoinedRanges(n,o,s,t,i);for(let u=0;u<h.length;u++)r.push(h[u])}i=c,o=s,l=this._workCell.fg,a=this._workCell.bg}s+=this._workCell.getChars().length||Pn.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(n,o,s,t,i);for(let h=0;h<c.length;h++)r.push(c[h])}return r}_getJoinedRanges(e,t,r,n,i){let s=e.substring(t,r),o=[];try{o=this._characterJoiners[0].handler(s)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let a=this._characterJoiners[l].handler(s);for(let c=0;c<a.length;c++)ga._mergeRanges(o,a[c])}catch(a){console.error(a)}return this._stringRangesToCellRanges(o,n,i),o}_stringRangesToCellRanges(e,t,r){let n=0,i=!1,s=0,o=e[n];if(o){for(let l=r;l<this._bufferService.cols;l++){let a=t.getWidth(l),c=t.getString(l).length||Pn.length;if(a!==0){if(!i&&o[0]<=s&&(o[0]=l,i=!0),o[1]<=s){if(o[1]=l,o=e[++n],!o)break;o[0]<=s?(o[0]=l,i=!0):i=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(r){if(t[1]<=i[0])return e[n-1][1]=t[1],e;if(t[1]<=i[1])return e[n-1][1]=Math.max(t[1],i[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=i[0])return e.splice(n,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};ga=Je([he(0,Ht)],ga);function zP(e){return 57508<=e&&e<=57558}function FP(e){return 9472<=e&&e<=9631}function $P(e){return zP(e)||FP(e)}function HP(){return{css:{canvas:dl(),cell:dl()},device:{canvas:dl(),cell:dl(),char:{width:0,height:0,left:0,top:0}}}}function dl(){return{width:0,height:0}}var Mh=class{constructor(e,t,r,n,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new Sr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,i,s,o,l,a,c,h){let u=[],d=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,m=e.getNoBgTrimmedLength();r&&m<s+1&&(m=s+1);let g,x=0,_="",v=0,y=0,E=0,P=0,C=!1,M=0,z=!1,J=0,N=0,D=[],I=c!==-1&&h!==-1;for(let R=0;R<m;R++){e.loadCell(R,this._workCell);let W=this._workCell.getWidth();if(W===0)continue;let A=!1,F=R>=N,H=R,L=this._workCell;if(d.length>0&&R===d[0][0]&&F){let be=d.shift(),Ie=this._isCellInSelection(be[0],t);for(v=be[0]+1;v<be[1];v++)F&&(F=Ie===this._isCellInSelection(v,t));F&&(F=!r||s<be[0]||s>=be[1]),F?(A=!0,L=new jP(this._workCell,e.translateToString(!0,be[0],be[1]),be[1]-be[0]),H=be[1]-1,W=L.getWidth()):N=be[1]}let $=this._isCellInSelection(R,t),S=r&&R===s,ne=I&&R>=c&&R<=h,ce=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,be=>{ce=!0});let k=L.getChars()||Pn;if(k===" "&&(L.isUnderline()||L.isOverline())&&(k=" "),J=W*l-a.get(k,L.isBold(),L.isItalic()),!g)g=this._document.createElement("span");else if(x&&($&&z||!$&&!z&&L.bg===y)&&($&&z&&f.selectionForeground||L.fg===E)&&L.extended.ext===P&&ne===C&&J===M&&!S&&!A&&!ce&&F){L.isInvisible()?_+=Pn:_+=k,x++;continue}else x&&(g.textContent=_),g=this._document.createElement("span"),x=0,_="";if(y=L.bg,E=L.fg,P=L.extended.ext,C=ne,M=J,z=$,A&&s>=R&&s<=H&&(s=R),!this._coreService.isCursorHidden&&S&&this._coreService.isCursorInitialized){if(D.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&D.push("xterm-cursor-blink"),D.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":D.push("xterm-cursor-outline");break;case"block":D.push("xterm-cursor-block");break;case"bar":D.push("xterm-cursor-bar");break;case"underline":D.push("xterm-cursor-underline");break}}if(L.isBold()&&D.push("xterm-bold"),L.isItalic()&&D.push("xterm-italic"),L.isDim()&&D.push("xterm-dim"),L.isInvisible()?_=Pn:_=L.getChars()||Pn,L.isUnderline()&&(D.push(`xterm-underline-${L.extended.underlineStyle}`),_===" "&&(_=" "),!L.isUnderlineColorDefault()))if(L.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Oo.toColorRGB(L.getUnderlineColor()).join(",")})`;else{let be=L.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&L.isBold()&&be<8&&(be+=8),g.style.textDecorationColor=f.ansi[be].css}L.isOverline()&&(D.push("xterm-overline"),_===" "&&(_=" ")),L.isStrikethrough()&&D.push("xterm-strikethrough"),ne&&(g.style.textDecoration="underline");let ge=L.getFgColor(),X=L.getFgColorMode(),Q=L.getBgColor(),K=L.getBgColorMode(),ue=!!L.isInverse();if(ue){let be=ge;ge=Q,Q=be;let Ie=X;X=K,K=Ie}let de,pe,B=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,be=>{be.options.layer!=="top"&&B||(be.backgroundColorRGB&&(K=50331648,Q=be.backgroundColorRGB.rgba>>8&16777215,de=be.backgroundColorRGB),be.foregroundColorRGB&&(X=50331648,ge=be.foregroundColorRGB.rgba>>8&16777215,pe=be.foregroundColorRGB),B=be.options.layer==="top")}),!B&&$&&(de=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,Q=de.rgba>>8&16777215,K=50331648,B=!0,f.selectionForeground&&(X=50331648,ge=f.selectionForeground.rgba>>8&16777215,pe=f.selectionForeground)),B&&D.push("xterm-decoration-top");let Re;switch(K){case 16777216:case 33554432:Re=f.ansi[Q],D.push(`xterm-bg-${Q}`);break;case 50331648:Re=st.toColor(Q>>16,Q>>8&255,Q&255),this._addStyle(g,`background-color:#${pg((Q>>>0).toString(16),"0",6)}`);break;case 0:default:ue?(Re=f.foreground,D.push("xterm-bg-257")):Re=f.background}switch(de||L.isDim()&&(de=Fe.multiplyOpacity(Re,.5)),X){case 16777216:case 33554432:L.isBold()&&ge<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ge+=8),this._applyMinimumContrast(g,Re,f.ansi[ge],L,de,void 0)||D.push(`xterm-fg-${ge}`);break;case 50331648:let be=st.toColor(ge>>16&255,ge>>8&255,ge&255);this._applyMinimumContrast(g,Re,be,L,de,pe)||this._addStyle(g,`color:#${pg(ge.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,Re,f.foreground,L,de,pe)||ue&&D.push("xterm-fg-257")}D.length&&(g.className=D.join(" "),D.length=0),!S&&!A&&!ce&&F?x++:g.textContent=_,J!==this.defaultSpacing&&(g.style.letterSpacing=`${J}px`),u.push(g),R=H}return g&&x&&(g.textContent=_),u}_applyMinimumContrast(e,t,r,n,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||$P(n.getCode()))return!1;let o=this._getContrastCache(n),l;if(!i&&!s&&(l=o.getColor(t.rgba,r.rgba)),l===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);l=Fe.ensureContrastRatio(i||t,s||r,a),o.setColor((i||t).rgba,(s||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,n=this._selectionEnd;return!r||!n?!1:this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&t>=r[1]&&e<n[0]&&t<=n[1]:e<r[0]&&t>=r[1]&&e>=n[0]&&t<=n[1]:t>r[1]&&t<n[1]||r[1]===n[1]&&t===r[1]&&e>=r[0]&&e<n[0]||r[1]<n[1]&&t===n[1]&&e<n[0]||r[1]<n[1]&&t===r[1]&&e>=r[0]}};Mh=Je([he(1,Yy),he(2,Wt),he(3,fn),he(4,wi),he(5,jo),he(6,ds)],Mh);function pg(e,t,r){for(;e.length<r;)e=t+e;return e}var WP=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[r,n,i,s],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,r,n){e===this._font&&t===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,r){let n=0;if(!t&&!r&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let o=this._measure(e,0);return o>0&&(this._flat[n]=o),o}let i=e;t&&(i+="B"),r&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),r&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},UP=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,n=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=r[1]-i,l=Math.max(s,0),a=Math.min(o,e.rows-1);if(l>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=a,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function KP(){return new UP}var Yc="xterm-dom-renderer-owner-",dr="xterm-rows",fl="xterm-fg-",mg="xterm-bg-",Ns="xterm-focus",pl="xterm-selection",VP=1,Ih=class extends Ee{constructor(e,t,r,n,i,s,o,l,a,c,h,u,d,f){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=a,this._optionsService=c,this._bufferService=h,this._coreService=u,this._coreBrowserService=d,this._themeService=f,this._terminalClass=VP++,this._rowElements=[],this._selectionRenderModel=KP(),this.onRequestRedraw=this._register(new oe).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(dr),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(pl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=HP(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(Mh,document),this._element.classList.add(Yc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(We(()=>{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 WP(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${dr} 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} .${dr} { 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} .${dr} .xterm-dim { color: ${Fe.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${dr}.${Ns} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${dr}.${Ns} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${dr}.${Ns} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${dr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${dr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${dr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${dr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${dr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${pl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${pl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${pl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${fl}${s} { color: ${o.css}; }${this._terminalSelector} .${fl}${s}.xterm-dim { color: ${Fe.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${mg}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${fl}257 { color: ${Fe.opaque(e.background).css}; }${this._terminalSelector} .${fl}257.xterm-dim { color: ${Fe.multiplyOpacity(Fe.opaque(e.background),.5).css}; }${this._terminalSelector} .${mg}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Ns),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ns),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let a=e[0]>t[0];l.appendChild(this._createSelectionElement(s,a?t[0]:e[0],a?e[0]:t[0],o-s+1))}else{let a=n===s?e[0]:0,c=s===i?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(s,a,c));let h=o-s-1;if(l.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,h)),s!==o){let u=i===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,u))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,r,n=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(r-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${n*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,n=r.ybase+r.y,i=Math.min(r.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=t;a++){let c=a+r.ydisp,h=this._rowElements[a],u=r.lines.get(c);if(!h||!u)break;h.replaceChildren(...this._rowFactory.createRow(u,c,c===n,o,l,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${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,r,n,i,s){r<0&&(e=0),n<0&&(t=0);let o=this._bufferService.rows-1;r=Math.max(Math.min(r,o),0),n=Math.max(Math.min(n,o),0),i=Math.min(i,this._bufferService.cols);let l=this._bufferService.buffer,a=l.ybase+l.y,c=Math.min(l.x,i-1),h=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=r;f<=n;++f){let m=f+l.ydisp,g=this._rowElements[f],x=l.lines.get(m);if(!g||!x)break;g.replaceChildren(...this._rowFactory.createRow(x,m,m===a,u,d,c,h,this.dimensions.css.cell.width,this._widthCache,s?f===r?e:0:-1,s?(f===n?t:i)-1:-1))}}};Ih=Je([he(7,df),he(8,Va),he(9,Wt),he(10,Ht),he(11,wi),he(12,fn),he(13,ds)],Ih);var Ah=class extends Ee{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new oe),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new YP(this._optionsService))}catch{this._measureStrategy=this._register(new qP(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())}};Ah=Je([he(2,Wt)],Ah);var f1=class extends Ee{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)}},qP=class extends f1{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},YP=class extends f1{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}},XP=class extends Ee{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new GP(this._window)),this._onDprChange=this._register(new oe),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new oe),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(kt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(we(this._textarea,"focus",()=>this._isFocused=!0)),this._register(we(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}},GP=class extends Ee{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new is),this._onDprChange=this._register(new oe),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(We(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=we(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)}},QP=class extends Ee{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 xf(e,t,r){let n=r.getBoundingClientRect(),i=e.getComputedStyle(r),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-n.left-s,t.clientY-n.top-o]}function ZP(e,t,r,n,i,s,o,l,a){if(!s)return;let c=xf(e,t,r);if(c)return c[0]=Math.ceil((c[0]+(a?o/2:0))/o),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),n+(a?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var Bh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return ZP(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let r=xf(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};Bh=Je([he(0,pn),he(1,Va)],Bh);var JP=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},p1={};cT(p1,{getSafariVersion:()=>tL,isChromeOS:()=>v1,isFirefox:()=>m1,isIpad:()=>rL,isIphone:()=>nL,isLegacyEdge:()=>eL,isLinux:()=>Sf,isMac:()=>_a,isNode:()=>qa,isSafari:()=>g1,isWindows:()=>_1});var qa=typeof process<"u"&&"title"in process,zo=qa?"node":navigator.userAgent,Fo=qa?"node":navigator.platform,m1=zo.includes("Firefox"),eL=zo.includes("Edge"),g1=/^((?!chrome|android).)*safari/i.test(zo);function tL(){if(!g1)return 0;let e=zo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var _a=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Fo),rL=Fo==="iPad",nL=Fo==="iPhone",_1=["Windows","Win16","Win32","WinCE"].includes(Fo),Sf=Fo.indexOf("Linux")>=0,v1=/\bCrOS\b/.test(zo),y1=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,n=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),i=e.timeRemaining(),r*1.5>i){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=i}this.clear()}},iL=class extends y1{_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())}}},sL=class extends y1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},va=!qa&&"requestIdleCallback"in window?sL:iL,oL=class{constructor(){this._queue=new va}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Oh=class extends Ee{constructor(e,t,r,n,i,s,o,l,a){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=i,this._coreBrowserService=l,this._renderer=this._register(new is),this._pausedResizeTask=new oL,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 oe),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new oe),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new oe),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new oe),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new JP((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new lL(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 r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=We(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(n=this._renderer.value)==null||n.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Oh=Je([he(2,Wt),he(3,Va),he(4,wi),he(5,jo),he(6,Ht),he(7,fn),he(8,ds)],Oh);var lL=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function aL(e,t,r,n){let i=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return hL(i,s,e,t,r,n)+Ya(s,t,r,n)+dL(i,s,e,t,r,n);let o;if(s===t)return o=i>e?"D":"C",ko(Math.abs(i-e),bo(o,n));o=s>t?"D":"C";let l=Math.abs(s-t),a=uL(s>t?e:i,r)+(l-1)*r.cols+1+cL(s>t?i:e);return ko(a,bo(o,n))}function cL(e,t){return e-1}function uL(e,t){return t.cols-e}function hL(e,t,r,n,i,s){return Ya(t,n,i,s).length===0?"":ko(S1(e,t,e,t-_i(t,i),!1,i).length,bo("D",s))}function Ya(e,t,r,n){let i=e-_i(e,r),s=t-_i(t,r),o=Math.abs(i-s)-fL(e,t,r);return ko(o,bo(x1(e,t),n))}function dL(e,t,r,n,i,s){let o;Ya(t,n,i,s).length>0?o=n-_i(n,i):o=t;let l=n,a=pL(e,t,r,n,i,s);return ko(S1(e,o,r,l,a==="C",i).length,bo(a,s))}function fL(e,t,r){var o;let n=0,i=e-_i(e,r),s=t-_i(t,r);for(let l=0;l<Math.abs(i-s);l++){let a=x1(e,t)==="A"?-1:1;(o=r.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&n++}return n}function _i(e,t){let r=0,n=t.buffer.lines.get(e),i=n==null?void 0:n.isWrapped;for(;i&&e>=0&&e<t.rows;)r++,n=t.buffer.lines.get(--e),i=n==null?void 0:n.isWrapped;return r}function pL(e,t,r,n,i,s){let o;return Ya(r,n,i,s).length>0?o=n-_i(n,i):o=t,e<r&&o<=n||e>=r&&o<n?"C":"D"}function x1(e,t){return e>t?"A":"B"}function S1(e,t,r,n,i,s){let o=e,l=t,a="";for(;(o!==r||l!==n)&&l>=0&&l<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(a+=s.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!i&&o<0&&(a+=s.buffer.translateBufferLineToString(l,!1,0,e+1),o=s.cols-1,e=o,l--);return a+s.buffer.translateBufferLineToString(l,!1,e,o)}function bo(e,t){let r=t?"O":"[";return Y.ESC+r+e}function ko(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var mL=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 Xc=50,gL=15,_L=50,vL=500,yL=" ",xL=new RegExp(yL,"g"),jh=class extends Ee{constructor(e,t,r,n,i,s,o,l,a){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=l,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Sr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new oe),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new oe),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new oe),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new oe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new mL(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 r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=r.translateBufferLineToString(o,!0,i,s);n.push(l)}}else{let i=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=r.lines.get(s),l=r.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?n[n.length-1]+=l:n.push(l)}if(e[1]!==t[1]){let s=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?n[n.length-1]+=o:n.push(o)}}return n.map(i=>i.replace(xL," ")).join(_1?`\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())),Sf&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n||!t?!1:this._areCoordsInSelection(t,r,n)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n?!1:this._areCoordsInSelection([e,t],r,n)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let r=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=lg(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=xf(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-Xc),Xc),t/=Xc,t/Math.abs(t)+Math.round(t*(sL-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(),oL)}_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 r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let n=r.lines.get(this._model.selectionEnd[1]);n&&n.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<lL&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let n=QP(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let n=0;t>=n;n++){let i=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:i>1&&t!==n&&(r+=i-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(s,e[0]),a=l,c=e[0]-l,h=0,u=0,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 x=e[0],_=e[0];s.getWidth(x)===0&&(h++,x--),s.getWidth(_)===2&&(u++,_++);let v=s.getString(_).length;for(v>1&&(f+=v-1,a+=v-1);x>0&&l>0&&!this._isCharWordSeparator(s.loadCell(x-1,this._workCell));){s.loadCell(x-1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,x--):y>1&&(d+=y-1,l-=y-1),l--,x--}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 m=l+c-h+d,g=Math.min(this._bufferService.cols,a-l+h+u-d-f);if(!(!t&&o.slice(l,a).trim()==="")){if(r&&m===0&&s.getCodePoint(0)!==32){let x=i.lines.get(e[1]-1);if(x&&s.isWrapped&&x.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;m-=v,g+=v}}}if(n&&m+g===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let x=i.lines.get(e[1]+1);if(x!=null&&x.isWrapped&&x.getCodePoint(0)!==32){let _=this._getWordAt([0,e[1]+1],!1,!1,!0);_&&(g+=_.length)}}return{start:m,length:g}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=lg(r,this._bufferService.cols)}};jh=rt([ce(3,Kt),ce(4,bi),ce(5,ff),ce(6,Vt),ce(7,mn),ce(8,pn)],jh);var ag=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},cg=class{constructor(){this._color=new ag,this._css=new ag}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ht=Object.freeze((()=>{let e=[qe.toColor("#2e3436"),qe.toColor("#cc0000"),qe.toColor("#4e9a06"),qe.toColor("#c4a000"),qe.toColor("#3465a4"),qe.toColor("#75507b"),qe.toColor("#06989a"),qe.toColor("#d3d7cf"),qe.toColor("#555753"),qe.toColor("#ef2929"),qe.toColor("#8ae234"),qe.toColor("#fce94f"),qe.toColor("#729fcf"),qe.toColor("#ad7fa8"),qe.toColor("#34e2e2"),qe.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],i=t[r/6%6|0],s=t[r%6];e.push({css:at.toCss(n,i,s),rgba:at.toRgba(n,i,s)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:at.toCss(n,n,n),rgba:at.toRgba(n,n,n)})}return e})()),Jn=qe.toColor("#ffffff"),js=qe.toColor("#000000"),ug=qe.toColor("#ffffff"),hg=js,Ns={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},uL=Jn,zh=class extends Ee{constructor(e){super(),this._optionsService=e,this._contrastCache=new cg,this._halfContrastCache=new cg,this._onChangeColors=this._register(new ie),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Jn,background:js,cursor:ug,cursorAccent:hg,selectionForeground:void 0,selectionBackgroundTransparent:Ns,selectionBackgroundOpaque:Fe.blend(js,Ns),selectionInactiveBackgroundTransparent:Ns,selectionInactiveBackgroundOpaque:Fe.blend(js,Ns),scrollbarSliderBackground:Fe.opacity(Jn,.2),scrollbarSliderHoverBackground:Fe.opacity(Jn,.4),scrollbarSliderActiveBackground:Fe.opacity(Jn,.5),overviewRulerBorder:Jn,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=Ie(e.foreground,Jn),t.background=Ie(e.background,js),t.cursor=Fe.blend(t.background,Ie(e.cursor,ug)),t.cursorAccent=Fe.blend(t.background,Ie(e.cursorAccent,hg)),t.selectionBackgroundTransparent=Ie(e.selectionBackground,Ns),t.selectionBackgroundOpaque=Fe.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ie(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Fe.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ie(e.selectionForeground,ig):void 0,t.selectionForeground===ig&&(t.selectionForeground=void 0),Fe.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Fe.opacity(t.selectionBackgroundTransparent,.3)),Fe.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Fe.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ie(e.scrollbarSliderBackground,Fe.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ie(e.scrollbarSliderHoverBackground,Fe.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ie(e.scrollbarSliderActiveBackground,Fe.opacity(t.foreground,.5)),t.overviewRulerBorder=Ie(e.overviewRulerBorder,uL),t.ansi=ht.slice(),t.ansi[0]=Ie(e.black,ht[0]),t.ansi[1]=Ie(e.red,ht[1]),t.ansi[2]=Ie(e.green,ht[2]),t.ansi[3]=Ie(e.yellow,ht[3]),t.ansi[4]=Ie(e.blue,ht[4]),t.ansi[5]=Ie(e.magenta,ht[5]),t.ansi[6]=Ie(e.cyan,ht[6]),t.ansi[7]=Ie(e.white,ht[7]),t.ansi[8]=Ie(e.brightBlack,ht[8]),t.ansi[9]=Ie(e.brightRed,ht[9]),t.ansi[10]=Ie(e.brightGreen,ht[10]),t.ansi[11]=Ie(e.brightYellow,ht[11]),t.ansi[12]=Ie(e.brightBlue,ht[12]),t.ansi[13]=Ie(e.brightMagenta,ht[13]),t.ansi[14]=Ie(e.brightCyan,ht[14]),t.ansi[15]=Ie(e.brightWhite,ht[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<r;n++)t.ansi[n+16]=Ie(e.extendedAnsi[n],ht[n+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};zh=rt([ce(0,Vt)],zh);function Ie(e,t){if(e!==void 0)try{return qe.toColor(e)}catch{}return t}var hL=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},dL=class{constructor(){this._services=new hL,this._services.set(df,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=sN(e).sort((s,o)=>s.index-o.index),n=[];for(let s of r){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);n.push(o)}let i=r.length>0?r[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},fL={trace:0,debug:1,info:2,warn:3,error:4,off:5},pL="xterm.js: ",Fh=class extends Ee{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=fL[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":pL)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Fh=rt([ce(0,Vt)],Fh);var dg=class extends Ee{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ie),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ie),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ie),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<r.length;n++)this._array[this._getCyclicIndex(e+n)]=r[n];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));let n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ce=3,lt=Object.freeze(new Oo),_l=0,Gc=2,zs=class d1{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ce);let i=r||kr.fromCharData([0,Ry,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let r=this._data[t*Ce+0],n=r&2097151;return[this._data[t*Ce+1],r&2097152?this._combined[t]:n?bn(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*Ce+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Ce+0]=t|2097152|r[2]<<22):this._data[t*Ce+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Ce+0]>>22}hasWidth(t){return this._data[t*Ce+0]&12582912}getFg(t){return this._data[t*Ce+1]}getBg(t){return this._data[t*Ce+2]}hasContent(t){return this._data[t*Ce+0]&4194303}getCodePoint(t){let r=this._data[t*Ce+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Ce+0]&2097152}getString(t){let r=this._data[t*Ce+0];return r&2097152?this._combined[t]:r&2097151?bn(r&2097151):""}isProtected(t){return this._data[t*Ce+2]&536870912}loadCell(t,r){return _l=t*Ce,r.content=this._data[_l+0],r.fg=this._data[_l+1],r.bg=this._data[_l+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Ce+0]=r.content,this._data[t*Ce+1]=r.fg,this._data[t*Ce+2]=r.bg}setCellFromCodepoint(t,r,n,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Ce+0]=r|n<<22,this._data[t*Ce+1]=i.fg,this._data[t*Ce+2]=i.bg}addCodepointToCell(t,r,n){let i=this._data[t*Ce+0];i&2097152?this._combined[t]+=bn(r):i&2097151?(this._combined[t]=bn(i&2097151)+bn(r),i&=-2097152,i|=2097152):i=r|1<<22,n&&(i&=-12582913,i|=n<<22),this._data[t*Ce+0]=i}insertCells(t,r,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length-t){let i=new kr;for(let s=this.length-t-r-1;s>=0;--s)this.setCell(t+r+s,this.loadCell(t+s,i));for(let s=0;s<r;++s)this.setCell(t+s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,r,n){if(t%=this.length,r<this.length-t){let i=new kr;for(let s=0;s<this.length-t-r;++s)this.setCell(t+s,this.loadCell(t+r+s,i));for(let s=this.length-r;s<this.length;++s)this.setCell(s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,r,n,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.setCell(t++,n)}resize(t,r){if(t===this.length)return this._data.length*4*Gc<this._data.buffer.byteLength;let n=t*Ce;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let i=new Uint32Array(n);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,r)}else{this._data=this._data.subarray(0,n);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let l=parseInt(i[o],10);l>=t&&delete this._combined[l]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,n*4*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,r=!1){if(r){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new d1(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ce+0]&4194303)return t+(this._data[t*Ce+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ce+0]&4194303||this._data[t*Ce+2]&50331648)return t+(this._data[t*Ce+0]>>22);return 0}copyCellsFrom(t,r,n,i,s){let o=t._data;if(s)for(let a=i-1;a>=0;a--){for(let c=0;c<Ce;c++)this._data[(n+a)*Ce+c]=o[(r+a)*Ce+c];o[(r+a)*Ce+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}else for(let a=0;a<i;a++){for(let c=0;c<Ce;c++)this._data[(n+a)*Ce+c]=o[(r+a)*Ce+c];o[(r+a)*Ce+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}let l=Object.keys(t._combined);for(let a=0;a<l.length;a++){let c=parseInt(l[a],10);c>=r&&(this._combined[c-r+n]=t._combined[c])}}translateToString(t,r,n,i){r=r??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;r<n;){let o=this._data[r*Ce+0],l=o&2097151,a=o&2097152?this._combined[r]:l?bn(l):Pn;if(s+=a,i)for(let c=0;c<a.length;++c)i.push(r);r+=o>>22||1}return i&&i.push(r),s}};function mL(e,t,r,n,i,s){let o=[];for(let l=0;l<e.length-1;l++){let a=l,c=e.get(++a);if(!c.isWrapped)continue;let h=[e.get(l)];for(;a<e.length&&c.isWrapped;)h.push(c),c=e.get(++a);if(!s&&n>=l&&n<a){l+=h.length-1;continue}let u=0,d=Co(h,u,t),f=1,m=0;for(;f<h.length;){let x=Co(h,f,t),_=x-m,v=r-d,y=Math.min(_,v);h[u].copyCellsFrom(h[f],m,d,y,!1),d+=y,d===r&&(u++,d=0),m+=y,m===x&&(f++,m=0),d===0&&u!==0&&h[u-1].getWidth(r-1)===2&&(h[u].copyCellsFrom(h[u-1],r-1,d++,1,!1),h[u-1].setCell(r-1,i))}h[u].replaceCells(d,r,i);let g=0;for(let x=h.length-1;x>0&&(x>u||h[x].getTrimmedLength()===0);x--)g++;g>0&&(o.push(l+h.length-g),o.push(g)),l+=h.length-1}return o}function gL(e,t){let r=[],n=0,i=t[n],s=0;for(let o=0;o<e.length;o++)if(i===o){let l=t[++n];e.onDeleteEmitter.fire({index:o-s,amount:l}),o+=l-1,s+=l,i=t[++n]}else r.push(o);return{layout:r,countRemoved:s}}function _L(e,t){let r=[];for(let n=0;n<t.length;n++)r.push(e.get(t[n]));for(let n=0;n<r.length;n++)e.set(n,r[n]);e.length=t.length}function vL(e,t,r){let n=[],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<r){n.push(i-l);break}s+=r;let a=Co(e,o,t);s>a&&(s-=a,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let h=c?r-1:r;n.push(h),l+=h}return n}function Co(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,i=e[t+1].getWidth(0)===2;return n&&i?r-1:r}var f1=class p1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=p1._nextId++,this._onDispose=this.register(new ie),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}};f1._nextId=1;var yL=f1,mt={},ei=mt.B;mt[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};mt.A={"#":"£"};mt.B=void 0;mt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};mt.C=mt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};mt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};mt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};mt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};mt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};mt.E=mt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};mt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};mt.H=mt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};mt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var fg=4294967295,pg=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=lt.clone(),this.savedCharset=ei,this.markers=[],this._nullCell=kr.fromCharData([0,Ry,1,0]),this._whitespaceCell=kr.fromCharData([0,Pn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new xa,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new dg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ga),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ga),this._whitespaceCell}getBlankLine(e,t){return new zs(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>fg?fg: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 dg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(lt),n=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)n+=+this.lines.get(o).resize(e,r);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new zs(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new zs(e,r)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let o=this.lines.length-i;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s<this.lines.length;s++)n+=+this.lines.get(s).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=mL(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(lt),r);if(n.length>0){let i=gL(this.lines,n);_L(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(lt),i=r;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new zs(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(lt),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let a=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),a.unshift(l);if(!r){let y=this.ybase+this.y;if(y>=o&&y<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),h=vL(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 m=h.length-1,g=h[m];g===0&&(m--,g=h[m]);let x=a.length-u-1,_=c;for(;x>=0;){let y=Math.min(_,g);if(a[m]===void 0)break;if(a[m].copyCellsFrom(a[x],_-y,g-y,y,!0),g-=y,g===0&&(m--,g=h[m]),_-=y,_===0){x--;let E=Math.max(x,0);_=Co(a,E,this._cols)}}for(let y=0;y<a.length;y++)h[y]<e&&a[y].setCell(h[y],n);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 g=0;g<this.lines.length;g++)l.push(this.lines.get(g));let a=this.lines.length,c=a-1,h=0,u=i[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let d=0;for(let g=Math.min(this.lines.maxLength-1,a+s-1);g>=0;g--)if(u&&u.start>c+d){for(let x=u.newLines.length-1;x>=0;x--)this.lines.set(g--,u.newLines[x]);g++,o.push({index:c+1,amount:u.newLines.length}),d+=u.newLines.length,u=i[++h]}else this.lines.set(g,l[c--]);let f=0;for(let g=o.length-1;g>=0;g--)o[g].index+=f,this.lines.onInsertEmitter.fire(o[g]),f+=o[g].amount;let m=Math.max(0,a+s-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,r=0,n){let i=this.lines.get(e);return i?i.translateToString(t,r,n):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new yL(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},xL=class extends Ee{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ie),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 pg(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new pg(!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)}},m1=2,g1=1,$h=class extends Ee{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ie),this.onResize=this._onResize.event,this._onScroll=this._register(new ie),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,m1),this.rows=Math.max(e.rawOptions.rows||0,g1),this.buffers=this._register(new xL(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let i=r.ybase+r.scrollTop,s=r.ybase+r.scrollBottom;if(r.scrollTop===0){let o=r.lines.isFull;s===r.lines.length-1?o?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(s+1,0,n.clone()),o?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let o=s-i+1;r.lines.shiftElements(i+1,o-1,-1),r.lines.set(s,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};$h=rt([ce(0,Vt)],$h);var Ni={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:{}},SL=["normal","bold","100","200","300","400","500","600","700","800","900"],wL=class extends Ee{constructor(e){super(),this._onOptionChange=this._register(new ie),this.onOptionChange=this._onOptionChange.event;let t={...Ni};for(let r in e)if(r in t)try{let n=e[r];t[r]=this._sanitizeAndValidateOption(r,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(We(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in Ni))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in Ni))throw new Error(`No option with key "${r}"`);n=this._sanitizeAndValidateOption(r,n),this.rawOptions[r]!==n&&(this.rawOptions[r]=n,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Ni[e]),!bL(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ni[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=SL.includes(t)?t:Ni[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 bL(e){return e==="block"||e==="underline"||e==="bar"}function Fs(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let n in e)r[n]=t<=1?e[n]:e[n]&&Fs(e[n],t-1);return r}var mg=Object.freeze({insertMode:!1}),gg=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Hh=class extends Ee{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ie),this.onData=this._onData.event,this._onUserInput=this._register(new ie),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ie),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ie),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Fs(mg),this.decPrivateModes=Fs(gg)}reset(){this.modes=Fs(mg),this.decPrivateModes=Fs(gg)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Hh=rt([ce(0,Kt),ce(1,By),ce(2,Vt)],Hh);var _g={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 r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var Zc=String.fromCharCode,vg={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}`}},Wh=class extends Ee{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ie),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(_g))this.addProtocol(n,_g[n]);for(let n of Object.keys(vg))this.addEncoding(n,vg[n]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let n=t/r,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=n+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Wh=rt([ce(0,Kt),ce(1,bi),ce(2,Vt)],Wh);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]],kL=[[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 CL(e,t){let r=0,n=t.length-1,i;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(i=r+n>>1,e>t[i][1])r=i+1;else if(e<t[i][0])n=i-1;else return!0;return!1}var EL=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]:CL(e,kL)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let i=oi.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return oi.createPropertyValue(0,r,n)}},oi=class jl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ie,this.onChange=this._onChange.event;let t=new EL;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,n=0,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return r+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:r+=this.wcwidth(c)}let l=this.charProperties(o,n),a=jl.extractWidth(l);jl.extractShouldJoin(l)&&(a-=jl.extractWidth(n)),r+=a,n=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},TL=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 yg(e){var n;let t=(n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:n.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var Ps=2147483647,NL=256,_1=class Uh{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>NL)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new Uh;if(!t.length)return r;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let i=t[n];if(Array.isArray(i))for(let s=0;s<i.length;++s)r.addSubParam(i[s]);else r.addParam(i)}return r}clone(){let t=new 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 r=0;r<this.length;++r){t.push(this.params[r]);let n=this._subParamsIdx[r]>>8,i=this._subParamsIdx[r]&255;i-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,i))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Ps?Ps: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>Ps?Ps:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-r>0?this._subParams.subarray(r,n):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let n=this._subParamsIdx[r]>>8,i=this._subParamsIdx[r]&255;i-n>0&&(t[r]=this._subParams.slice(n,i))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,i=n[r-1];n[r-1]=~i?Math.min(i*10+t,Ps):t}},Ls=[],PL=class{constructor(){this._state=0,this._active=Ls,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ls}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=Ls,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ls,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",qa(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&r===!1){for(;n>=0&&(r=this._active[n].end(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=Ls,this._id=-1,this._state=0}}},sr=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=qa(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},Rs=[],LL=class{constructor(){this._handlers=Object.create(null),this._active=Rs,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Rs}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Rs,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Rs,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",qa(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&r===!1){for(;n>=0&&(r=this._active[n].unhook(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=Rs,this._ident=0}},$s=new _1;$s.addParam(0);var xg=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,r){this._hitLimit||(this._data+=qa(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=$s,this._data="",this._hitLimit=!1,r));return this._params=$s,this._data="",this._hitLimit=!1,t}},RL=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,n){this.table[t<<8|e]=r<<4|n}addMany(e,t,r,n){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=r<<4|n}},vr=160,DL=function(){let e=new RL(4095),t=Array.apply(null,Array(256)).map((l,a)=>a),r=(l,a)=>t.slice(l,a),n=r(32,127),i=r(0,24);i.push(25),i.push.apply(i,r(28,32));let s=r(0,14),o;e.setDefault(1,0),e.addMany(n,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(vr,0,2,0),e.add(vr,8,5,8),e.add(vr,6,0,6),e.add(vr,11,0,11),e.add(vr,13,13,13),e}(),ML=class extends Ee{constructor(e=DL){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 _1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(We(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new PL),this._dcsParser=this._register(new LL),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=n,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,n,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=i}parse(e,t,r){let n=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](this._params),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 4:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(n!==24&&n!==26,r),o)return o;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],o=this._oscParser.end(n!==24&&n!==26,r),o)return o;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=s;l<t;++l){switch(n=e[l],i=this._transitions.table[this.currentState<<8|(n<160?n:vr)],i>>4){case 2:for(let d=l+1;;++d){if(d>=t||(n=e[d])<32||n>126&&n<vr){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(n=e[d])<32||n>126&&n<vr){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(n=e[d])<32||n>126&&n<vr){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(n=e[d])<32||n>126&&n<vr){this._printHandler(e,l,d),l=d-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|n],c=a?a.length-1:-1;for(;c>=0&&(o=a[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,a,c,i,l),o;c<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++l<t&&(n=e[l])>47&&n<60);l--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let h=this._escHandlers[this._collect<<8|n],u=h?h.length-1:-1;for(;u>=0&&(o=h[u](),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(4,h,u,i,l),o;u<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let d=l+1;;++d)if(d>=t||(n=e[d])===24||n===26||n===27||n>127&&n<vr){this._dcsParser.put(e,l,d),l=d-1;break}break;case 14:if(o=this._dcsParser.unhook(n!==24&&n!==26),o)return this._preserveStack(6,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let d=l+1;;d++)if(d>=t||(n=e[d])<32||n>127&&n<vr){this._oscParser.put(e,l,d),l=d-1;break}break;case 6:if(o=this._oscParser.end(n!==24&&n!==26),o)return this._preserveStack(5,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},IL=/^([\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})$/,AL=/^[\da-f]+$/;function Sg(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=IL.exec(t);if(r){let n=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/n*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/n*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),AL.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,n=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(r*i,r*i+r),16);n[i]=r===1?s<<4:r===2?s:r===3?s>>4:s>>8}return n}}function eu(e,t){let r=e.toString(16),n=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function BL(e,t=16){let[r,n,i]=e;return`rgb:${eu(r,t)}/${eu(n,t)}/${eu(i,t)}`}var OL={"(":0,")":1,"*":2,"+":3,"-":1,".":2},xn=131072,wg=10;function bg(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 kg=5e3,Cg=0,jL=class extends Ee{constructor(e,t,r,n,i,s,o,l,a=new ML){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=l,this._parser=a,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new nN,this._utf8Decoder=new iN,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=lt.clone(),this._eraseAttrDataInternal=lt.clone(),this._onRequestBell=this._register(new ie),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ie),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ie),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ie),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ie),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ie),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ie),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ie),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ie),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ie),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ie),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ie),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ie),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(q.BEL,()=>this.bell()),this._parser.setExecuteHandler(q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(q.BS,()=>this.backspace()),this._parser.setExecuteHandler(q.HT,()=>this.tab()),this._parser.setExecuteHandler(q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Bl.IND,()=>this.index()),this._parser.setExecuteHandler(Bl.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Bl.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new sr(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new sr(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new sr(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new sr(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new sr(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new sr(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new sr(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new sr(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new sr(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new sr(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new sr(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new sr(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in mt)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new xg((c,h)=>this.requestStatusString(c,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),kg))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${kg} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>xn&&(s=this._parseStack.position+xn)}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<xn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,xn))),o||this._dirtyRowTracker.clearRange(),e.length>xn)for(let c=s;c<e.length;c+=xn){let h=c+xn<e.length?c+xn:e.length,u=typeof e=="string"?this._stringDecoder.decode(e.substring(c,h),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,h),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,u))return this._preserveStack(n,i,u,c),this._logSlowResolvingAsync(r),r}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,c))return this._preserveStack(n,i,c,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),a=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);a<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(a,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,r){let n,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,a=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let d=this._parser.precedingJoinState;for(let f=t;f<r;++f){if(n=e[f],n<127&&s){let _=s[String.fromCharCode(n)];_&&(n=_.charCodeAt(0))}let m=this._unicodeService.charProperties(n,d);i=oi.extractWidth(m);let g=oi.extractShouldJoin(m),x=g?oi.extractWidth(d):0;if(d=m,o&&this._onA11yChar.fire(bn(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-x>l){if(a){let _=u,v=this._activeBuffer.x-x;for(this._activeBuffer.x=x,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),x>0&&u instanceof zs&&u.copyCellsFrom(_,v,0,x,!1);v<l;)_.setCellFromCodepoint(v++,0,1,h)}else if(this._activeBuffer.x=l-1,i===2)continue}if(g&&this._activeBuffer.x){let _=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-_,n,i);for(let v=i-x;--v>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,i-x,this._activeBuffer.getNullCell(h)),u.getWidth(l-1)===2&&u.setCellFromCodepoint(l-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,n,i,h),i>0)for(;--i;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<l&&r-t>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>bg(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new xg(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new sr(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,n=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),i),n&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&n.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(lt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,n=oi.extractWidth(t),i=this._activeBuffer.x-n,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*r),l=0;for(let c=0;c<s.length;){let h=s.codePointAt(c)||0;o[l++]=h,c+=h>65535?2:1}let a=l;for(let c=1;c<r;++c)o.copyWithin(a,0,l),a+=l;return this.print(o,0,a),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(q.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(q.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(q.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(q.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(q.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){(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let n=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:l,cols:a}=this._bufferService,{active:c,alt:h}=l,u=this._optionsService.rawOptions,d=(g,x)=>(o.triggerDataEvent(`${q.ESC}[${t?"":"?"}${g};${x}$y`),!0),f=g=>g?1:2,m=e.params[0];return t?m===2?d(m,4):m===4?d(m,f(o.modes.insertMode)):m===12?d(m,3):m===20?d(m,f(u.convertEol)):d(m,0):m===1?d(m,f(n.applicationCursorKeys)):m===3?d(m,u.windowOptions.setWinLines?a===80?2:a===132?1:0:0):m===6?d(m,f(n.origin)):m===7?d(m,f(n.wraparound)):m===8?d(m,3):m===9?d(m,f(i==="X10")):m===12?d(m,f(u.cursorBlink)):m===25?d(m,f(!o.isCursorHidden)):m===45?d(m,f(n.reverseWraparound)):m===66?d(m,f(n.applicationKeypad)):m===67?d(m,4):m===1e3?d(m,f(i==="VT200")):m===1002?d(m,f(i==="DRAG")):m===1003?d(m,f(i==="ANY")):m===1004?d(m,f(n.sendFocus)):m===1005?d(m,4):m===1006?d(m,f(s==="SGR")):m===1015?d(m,4):m===1016?d(m,f(s==="SGR_PIXELS")):m===1048?d(m,1):m===47||m===1047||m===1049?d(m,f(c===h)):m===2004?d(m,f(n.bracketedPasteMode)):m===2026?d(m,f(n.synchronizedOutput)):d(m,0)}_updateAttrColor(e,t,r,n,i){return t===2?(e|=50331648,e&=-16777216,e|=Oo.fromColorRGB([r,n,i])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let n=[0,0,-1,0,0,0],i=0,s=0;do{if(n[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),l=0;do n[1]===5&&(i=1),n[s+l+1+i]=o[l];while(++l<o.length&&l+s+1+i<n.length);break}if(n[1]===5&&s+i>=2||n[1]===2&&s+i>=5)break;n[1]&&(i=1)}while(++s+t<e.length&&s+i<n.length);for(let o=2;o<n.length;++o)n[o]===-1&&(n[o]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return s}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=lt.fg,e.bg=lt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,n=this._curAttrData;for(let i=0;i<t;i++)r=e.params[i],r>=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777216|r-90|8):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777216|r-100|8):r===0?this._processSGR0(n):r===1?n.fg|=134217728:r===3?n.bg|=67108864:r===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,n)):r===5?n.fg|=536870912:r===7?n.fg|=67108864:r===8?n.fg|=1073741824:r===9?n.fg|=2147483648:r===2?n.bg|=134217728:r===21?this._processUnderline(2,n):r===22?(n.fg&=-134217729,n.bg&=-134217729):r===23?n.bg&=-67108865:r===24?(n.fg&=-268435457,this._processUnderline(0,n)):r===25?n.fg&=-536870913:r===27?n.fg&=-67108865:r===28?n.fg&=-1073741825:r===29?n.fg&=2147483647:r===39?(n.fg&=-67108864,n.fg|=lt.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=lt.bg&16777215):r===38||r===48||r===58?i+=this._extractColor(e,i,n):r===53?n.bg|=1073741824:r===55?n.bg&=-1073741825:r===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):r===100?(n.fg&=-67108864,n.fg|=lt.fg&16777215,n.bg&=-67108864,n.bg|=lt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${q.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${q.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${q.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=lt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!bg(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(`${q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>wg&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>wg&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let n=r.shift(),i=r.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(Eg(s))if(i==="?")t.push({type:0,index:s});else{let o=Sg(i);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,i=r.findIndex(s=>s.startsWith("id="));return i!==-1&&(n=r[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let n=0;n<r.length&&!(t>=this._specialColors.length);++n,++t)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=Sg(r[n]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let n=0;n<r.length;++n)if(/^\d+$/.exec(r[n])){let i=parseInt(r[n]);Eg(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(OL[e[0]],mt[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 kr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=o=>(this._coreService.triggerDataEvent(`${q.ESC}${o}${q.ESC}\\`),!0),n=this._bufferService.buffer,i=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},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&&(Cg=e,e=t,t=Cg),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Kh=rt([ce(0,Kt)],Kh);function Eg(e){return 0<=e&&e<256}var zL=5e7,Tg=12,FL=50,$L=class extends Ee{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 ie),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>zL)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],i=this._action(n,t);if(i){let o=l=>performance.now()-r>=Tg?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);i.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=Tg)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>FL&&(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 r=e,n=this._getEntryIdKey(r),i=this._entriesWithId.get(n);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);r.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(r,n))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Vh=rt([ce(0,Kt)],Vh);var Ng=!1,HL=class extends Ee{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new is),this._onBinary=this._register(new ie),this.onBinary=this._onBinary.event,this._onData=this._register(new ie),this.onData=this._onData.event,this._onLineFeed=this._register(new ie),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ie),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ie),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ie),this._instantiationService=new dL,this.optionsService=this._register(new wL(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(By,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Hh)),this._instantiationService.setService(bi,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Wh)),this._instantiationService.setService(Ay,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(oi)),this._instantiationService.setService(aN,this.unicodeService),this._charsetService=this._instantiationService.createInstance(TL),this._instantiationService.setService(lN,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Vh),this._instantiationService.setService(Oy,this._oscLinkService),this._inputHandler=this._register(new jL(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 $L((t,r)=>this._inputHandler.parse(t,r))),this._register(Et.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ie),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&&!Ng&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Ng=!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,m1),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(yg.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(yg(this._bufferService),!1))),this._windowsWrappingHeuristics.value=We(()=>{for(let t of e)t.dispose()})}}},WL={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 UL(e,t,r,n){var o;let i={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?i.key=q.ESC+"OA":i.key=q.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=q.ESC+"OD":i.key=q.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=q.ESC+"OC":i.key=q.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=q.ESC+"OB":i.key=q.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":q.DEL,e.altKey&&(i.key=q.ESC+i.key);break;case 9:if(e.shiftKey){i.key=q.ESC+"[Z";break}i.key=q.HT,i.cancel=!0;break;case 13:i.key=e.altKey?q.ESC+q.CR:q.CR,i.cancel=!0;break;case 27:i.key=q.ESC,e.altKey&&(i.key=q.ESC+q.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=q.ESC+"[1;"+(s+1)+"D":t?i.key=q.ESC+"OD":i.key=q.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=q.ESC+"[1;"+(s+1)+"C":t?i.key=q.ESC+"OC":i.key=q.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=q.ESC+"[1;"+(s+1)+"A":t?i.key=q.ESC+"OA":i.key=q.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=q.ESC+"[1;"+(s+1)+"B":t?i.key=q.ESC+"OB":i.key=q.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=q.ESC+"[2~");break;case 46:s?i.key=q.ESC+"[3;"+(s+1)+"~":i.key=q.ESC+"[3~";break;case 36:s?i.key=q.ESC+"[1;"+(s+1)+"H":t?i.key=q.ESC+"OH":i.key=q.ESC+"[H";break;case 35:s?i.key=q.ESC+"[1;"+(s+1)+"F":t?i.key=q.ESC+"OF":i.key=q.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=q.ESC+"[5;"+(s+1)+"~":i.key=q.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=q.ESC+"[6;"+(s+1)+"~":i.key=q.ESC+"[6~";break;case 112:s?i.key=q.ESC+"[1;"+(s+1)+"P":i.key=q.ESC+"OP";break;case 113:s?i.key=q.ESC+"[1;"+(s+1)+"Q":i.key=q.ESC+"OQ";break;case 114:s?i.key=q.ESC+"[1;"+(s+1)+"R":i.key=q.ESC+"OR";break;case 115:s?i.key=q.ESC+"[1;"+(s+1)+"S":i.key=q.ESC+"OS";break;case 116:s?i.key=q.ESC+"[15;"+(s+1)+"~":i.key=q.ESC+"[15~";break;case 117:s?i.key=q.ESC+"[17;"+(s+1)+"~":i.key=q.ESC+"[17~";break;case 118:s?i.key=q.ESC+"[18;"+(s+1)+"~":i.key=q.ESC+"[18~";break;case 119:s?i.key=q.ESC+"[19;"+(s+1)+"~":i.key=q.ESC+"[19~";break;case 120:s?i.key=q.ESC+"[20;"+(s+1)+"~":i.key=q.ESC+"[20~";break;case 121:s?i.key=q.ESC+"[21;"+(s+1)+"~":i.key=q.ESC+"[21~";break;case 122:s?i.key=q.ESC+"[23;"+(s+1)+"~":i.key=q.ESC+"[23~";break;case 123:s?i.key=q.ESC+"[24;"+(s+1)+"~":i.key=q.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=q.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=q.DEL:e.keyCode===219?i.key=q.ESC:e.keyCode===220?i.key=q.FS:e.keyCode===221&&(i.key=q.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let l=(o=WL[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)i.key=q.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=q.ESC+c}else if(e.keyCode===32)i.key=q.ESC+(e.ctrlKey?q.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),i.key=q.ESC+a,i.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=q.US),e.key==="@"&&(i.key=q.NUL));break}return i}var it=0,KL=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new xa,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new xa,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,s)=>this._getKey(i)-this._getKey(s)),t=0,r=0,n=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<n.length;i++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(n[i]=e[t],t++):n[i]=this._array[r++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(it=this._search(t),it===-1)||this._getKey(this._array[it])!==t)return!1;do if(this._array[it]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(it),!0;while(++it<this._array.length&&this._getKey(this._array[it])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,r=new Array(this._array.length-e.length),n=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:r[n++]=this._array[i];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(it=this._search(e),!(it<0||it>=this._array.length)&&this._getKey(this._array[it])===e))do yield this._array[it];while(++it<this._array.length&&this._getKey(this._array[it])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(it=this._search(e),!(it<0||it>=this._array.length)&&this._getKey(this._array[it])===e))do t(this._array[it]);while(++it<this._array.length&&this._getKey(this._array[it])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let n=t+r>>1,i=this._getKey(this._array[n]);if(i>e)r=n-1;else if(i<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},tu=0,Pg=0,VL=class extends Ee{constructor(){super(),this._decorations=new KL(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ie),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ie),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 qL(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let n=0,i=0;for(let s of this._decorations.getKeyIterator(t))n=s.options.x??0,i=n+(s.options.width??1),e>=n&&e<i&&(!r||(s.options.layer??"bottom")===r)&&(yield s)}forEachDecorationAtCell(e,t,r,n){this._decorations.forEachByKey(t,i=>{tu=i.options.x??0,Pg=tu+(i.options.width??1),e>=tu&&e<Pg&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},qL=class extends jn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ie),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ie),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=qe.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=qe.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},YL=1e3,XL=class{constructor(e,t=YL){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=n-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Lg=20,Sa=class extends Ee{constructor(e,t,r,n){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new XL(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<Lg+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
134
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Lg+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 r=this._terminal.buffer,n=r.lines.length.toString();for(let i=e;i<=t;i++){let s=r.lines.get(r.ydisp+i),o=[],l=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",a=(r.ydisp+i+1).toString(),c=this._rowElements[i];c&&(l.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=l,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",a),c.setAttribute("aria-setsize",n),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],i=r.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==n)return;let o,l;if(t===0?(o=r,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=r,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let a=this._createAccessibilityTreeNode();this._rowElements.unshift(a),this._rowContainer.insertAdjacentElement("afterbegin",a)}else{let a=this._createAccessibilityTreeNode();this._rowElements.push(a),this._rowContainer.appendChild(a)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:((l=n.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(r.node))return;let i=({node:a,offset:c})=>{let h=a instanceof Text?a.parentNode:a,u=parseInt(h==null?void 0:h.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return console.warn("row is invalid. Race condition?"),null;let 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(r);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,r=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};Sa=rt([ce(1,df),ce(2,pn),ce(3,mn)],Sa);var qh=class extends Ee{constructor(e,t,r,n,i){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=n,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ie),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ie),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(We(()=>{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(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 r=e.composedPath();for(let n=0;n<r.length;n++){let i=r[n];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var n,i;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):o.provideLinks(e.y,l=>{var c,h;if(this._isMouseOut)return;let a=l==null?void 0:l.map(u=>({link:u}));(c=this._activeProviderReplies)==null||c.set(s,a),r=this._checkLinkProviderResult(s,e,r),((h=this._activeProviderReplies)==null?void 0:h.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let n=0;n<t.size;n++){let i=t.get(n);if(i)for(let s=0;s<i.length;s++){let o=i[s],l=o.link.range.start.y<e?0:o.link.range.start.x,a=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=l;c<=a;c++){if(r.has(c)){i.splice(s--,1);break}r.add(c)}}}}_checkLinkProviderResult(e,t,r){var s;if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&n){let o=n.find(l=>this._linkAtPosition(l.link,t));o&&(r=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(a=>this._linkAtPosition(a.link,t));if(l){r=!0,this._handleNewLink(l);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&GL(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 r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.pointerCursor},set:r=>{var n;(n=this._currentLink)!=null&&n.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline},set:r=>{var n,i,s;(n=this._currentLink)!=null&&n.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let n=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(n,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,r){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,n=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,r){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return r<=i&&i<=n}_positionFromMouseEvent(e,t,r){let n=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,n,i){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:i}}};qh=rt([ce(1,ff),ce(2,mn),ce(3,Kt),ce(4,zy)],qh);function GL(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 QL=class extends HL{constructor(e={}){super(e),this._linkifier=this._register(new is),this.browser=i1,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new is),this._onCursorMove=this._register(new ie),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ie),this.onKey=this._onKey.event,this._onRender=this._register(new ie),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ie),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ie),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ie),this.onBell=this._onBell.event,this._onFocus=this._register(new ie),this._onBlur=this._register(new ie),this._onA11yCharEmitter=this._register(new ie),this._onA11yTabEmitter=this._register(new ie),this._onWillOpen=this._register(new ie),this._setup(),this._decorationService=this._instantiationService.createInstance(VL),this._instantiationService.setService(jo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(FP),this._instantiationService.setService(zy,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(We(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,n="";switch(t.index){case 256:r="foreground",n="10";break;case 257:r="background",n="11";break;case 258:r="cursor",n="12";break;default:r="ansi",n="4;"+t.index}switch(t.type){case 0:let i=Fe.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${q.ESC}]${n};${BL(i)}${r1.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=at.toColor(...t.color));else{let s=r;this._themeService.modifyColors(o=>o[s]=at.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Sa,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(q.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(q.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,i=t.getWidth(r),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Se(this.element,"copy",t=>{this.hasSelection()&&tN(t,this._selectionService)}));let e=t=>rN(t,this.textarea,this.coreService,this.optionsService);this._register(Se(this.textarea,"paste",e)),this._register(Se(this.element,"paste",e)),s1?this._register(Se(this.element,"mousedown",t=>{t.button===2&&Fm(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Se(this.element,"contextmenu",t=>{Fm(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Sf&&this._register(Se(this.element,"auxclick",t=>{t.button===1&&Ly(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 r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",hh.get()),a1||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(jP,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(pn,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(Ah,this._document,this._helperContainer),this._instantiationService.setService(Ya,this._charSizeService),this._themeService=this._instantiationService.createInstance(zh),this._instantiationService.setService(ds,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(va),this._instantiationService.setService(jy,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Oh,this.rows,this.screenElement)),this._instantiationService.setService(mn,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(Bh),this._instantiationService.setService(ff,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(qh,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Lh,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(jh,this.element,this.screenElement,n)),this._instantiationService.setService(uN,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(Rh,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(Sa,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(Ih,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(s){var c,h,u,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 m=s.deltaY;if(m===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=m<0?0:1,l=4;break;default:return!1}return a===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:a,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(r(s),s.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(s)),wheel:s=>(r(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&r(s)},mousemove:s=>{s.buttons||r(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?n.mousemove||(t.addEventListener("mousemove",i.mousemove),n.mousemove=i.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),s&16?n.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),n.wheel=i.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),s&2?n.mouseup||(n.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),s&4?n.mousedrag||(n.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Se(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return r(s),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(s)})),this._register(Se(t,"wheel",s=>{var o,l,a,c,h;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(a=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:a.cell)==null?void 0:c.height,(h=e._coreBrowserService)==null?void 0:h.dpr)===0)return this.cancel(s,!0);let u=q.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Py(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=UL(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let n=this.rows-1;return this.scrollLines(r.type===2?-n:n),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===q.ETX||r.key===q.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(ZL(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(lt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(q.ESC+"[I"):this.coreService.triggerDataEvent(q.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${q.ESC}[4;${r};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${q.ESC}[6;${i};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function ZL(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var JL=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},e3=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 kr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},Rg=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 e3(t)}getNullCell(){return new kr}},t3=class extends Ee{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ie),this.onBufferChange=this._onBufferChange.event,this._normal=new Rg(this._core.buffers.normal,"normal"),this._alternate=new Rg(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)}},r3=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,n)=>t(r,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},n3=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}},i3=["cols","rows"],Fr=0,s3=class extends Ee{constructor(e){super(),this._core=this._register(new QL(e)),this._addonManager=this._register(new JL),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],r=(n,i)=>{this._checkReadonlyOptions(n),this._core.options[n]=i};for(let n in this._core.options){let i={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,i)}}_checkReadonlyOptions(e){if(i3.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 r3(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new n3(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 t3(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
132
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Sf&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n||!t?!1:this._areCoordsInSelection(t,r,n)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n?!1:this._areCoordsInSelection([e,t],r,n)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let r=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=gg(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=xf(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-Xc),Xc),t/=Xc,t/Math.abs(t)+Math.round(t*(gL-1)))}shouldForceSelection(e){return _a?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(),_L)}_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&&!(_a&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let n=r.lines.get(this._model.selectionEnd[1]);n&&n.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<vL&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let n=aL(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let n=0;t>=n;n++){let i=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:i>1&&t!==n&&(r+=i-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(s,e[0]),a=l,c=e[0]-l,h=0,u=0,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 x=e[0],_=e[0];s.getWidth(x)===0&&(h++,x--),s.getWidth(_)===2&&(u++,_++);let v=s.getString(_).length;for(v>1&&(f+=v-1,a+=v-1);x>0&&l>0&&!this._isCharWordSeparator(s.loadCell(x-1,this._workCell));){s.loadCell(x-1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,x--):y>1&&(d+=y-1,l-=y-1),l--,x--}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 m=l+c-h+d,g=Math.min(this._bufferService.cols,a-l+h+u-d-f);if(!(!t&&o.slice(l,a).trim()==="")){if(r&&m===0&&s.getCodePoint(0)!==32){let x=i.lines.get(e[1]-1);if(x&&s.isWrapped&&x.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;m-=v,g+=v}}}if(n&&m+g===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let x=i.lines.get(e[1]+1);if(x!=null&&x.isWrapped&&x.getCodePoint(0)!==32){let _=this._getWordAt([0,e[1]+1],!1,!1,!0);_&&(g+=_.length)}}return{start:m,length:g}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=gg(r,this._bufferService.cols)}};jh=Je([he(3,Ht),he(4,wi),he(5,ff),he(6,Wt),he(7,pn),he(8,fn)],jh);var _g=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},vg=class{constructor(){this._color=new _g,this._css=new _g}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},at=Object.freeze((()=>{let e=[Ke.toColor("#2e3436"),Ke.toColor("#cc0000"),Ke.toColor("#4e9a06"),Ke.toColor("#c4a000"),Ke.toColor("#3465a4"),Ke.toColor("#75507b"),Ke.toColor("#06989a"),Ke.toColor("#d3d7cf"),Ke.toColor("#555753"),Ke.toColor("#ef2929"),Ke.toColor("#8ae234"),Ke.toColor("#fce94f"),Ke.toColor("#729fcf"),Ke.toColor("#ad7fa8"),Ke.toColor("#34e2e2"),Ke.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],i=t[r/6%6|0],s=t[r%6];e.push({css:st.toCss(n,i,s),rgba:st.toRgba(n,i,s)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:st.toCss(n,n,n),rgba:st.toRgba(n,n,n)})}return e})()),Zn=Ke.toColor("#ffffff"),js=Ke.toColor("#000000"),yg=Ke.toColor("#ffffff"),xg=js,Ts={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},SL=Zn,zh=class extends Ee{constructor(e){super(),this._optionsService=e,this._contrastCache=new vg,this._halfContrastCache=new vg,this._onChangeColors=this._register(new oe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Zn,background:js,cursor:yg,cursorAccent:xg,selectionForeground:void 0,selectionBackgroundTransparent:Ts,selectionBackgroundOpaque:Fe.blend(js,Ts),selectionInactiveBackgroundTransparent:Ts,selectionInactiveBackgroundOpaque:Fe.blend(js,Ts),scrollbarSliderBackground:Fe.opacity(Zn,.2),scrollbarSliderHoverBackground:Fe.opacity(Zn,.4),scrollbarSliderActiveBackground:Fe.opacity(Zn,.5),overviewRulerBorder:Zn,ansi:at.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=Me(e.foreground,Zn),t.background=Me(e.background,js),t.cursor=Fe.blend(t.background,Me(e.cursor,yg)),t.cursorAccent=Fe.blend(t.background,Me(e.cursorAccent,xg)),t.selectionBackgroundTransparent=Me(e.selectionBackground,Ts),t.selectionBackgroundOpaque=Fe.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Me(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Fe.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Me(e.selectionForeground,fg):void 0,t.selectionForeground===fg&&(t.selectionForeground=void 0),Fe.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Fe.opacity(t.selectionBackgroundTransparent,.3)),Fe.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Fe.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Me(e.scrollbarSliderBackground,Fe.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Me(e.scrollbarSliderHoverBackground,Fe.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Me(e.scrollbarSliderActiveBackground,Fe.opacity(t.foreground,.5)),t.overviewRulerBorder=Me(e.overviewRulerBorder,SL),t.ansi=at.slice(),t.ansi[0]=Me(e.black,at[0]),t.ansi[1]=Me(e.red,at[1]),t.ansi[2]=Me(e.green,at[2]),t.ansi[3]=Me(e.yellow,at[3]),t.ansi[4]=Me(e.blue,at[4]),t.ansi[5]=Me(e.magenta,at[5]),t.ansi[6]=Me(e.cyan,at[6]),t.ansi[7]=Me(e.white,at[7]),t.ansi[8]=Me(e.brightBlack,at[8]),t.ansi[9]=Me(e.brightRed,at[9]),t.ansi[10]=Me(e.brightGreen,at[10]),t.ansi[11]=Me(e.brightYellow,at[11]),t.ansi[12]=Me(e.brightBlue,at[12]),t.ansi[13]=Me(e.brightMagenta,at[13]),t.ansi[14]=Me(e.brightCyan,at[14]),t.ansi[15]=Me(e.brightWhite,at[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<r;n++)t.ansi[n+16]=Me(e.extendedAnsi[n],at[n+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};zh=Je([he(0,Wt)],zh);function Me(e,t){if(e!==void 0)try{return Ke.toColor(e)}catch{}return t}var wL=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},bL=class{constructor(){this._services=new wL,this._services.set(df,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=gT(e).sort((s,o)=>s.index-o.index),n=[];for(let s of r){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);n.push(o)}let i=r.length>0?r[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},kL={trace:0,debug:1,info:2,warn:3,error:4,off:5},CL="xterm.js: ",Fh=class extends Ee{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=kL[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":CL)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Fh=Je([he(0,Wt)],Fh);var Sg=class extends Ee{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new oe),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new oe),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new oe),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<r.length;n++)this._array[this._getCyclicIndex(e+n)]=r[n];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));let n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ce=3,it=Object.freeze(new Oo),ml=0,Gc=2,zs=class w1{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ce);let i=r||Sr.fromCharData([0,$y,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let r=this._data[t*Ce+0],n=r&2097151;return[this._data[t*Ce+1],r&2097152?this._combined[t]:n?bn(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*Ce+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Ce+0]=t|2097152|r[2]<<22):this._data[t*Ce+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Ce+0]>>22}hasWidth(t){return this._data[t*Ce+0]&12582912}getFg(t){return this._data[t*Ce+1]}getBg(t){return this._data[t*Ce+2]}hasContent(t){return this._data[t*Ce+0]&4194303}getCodePoint(t){let r=this._data[t*Ce+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Ce+0]&2097152}getString(t){let r=this._data[t*Ce+0];return r&2097152?this._combined[t]:r&2097151?bn(r&2097151):""}isProtected(t){return this._data[t*Ce+2]&536870912}loadCell(t,r){return ml=t*Ce,r.content=this._data[ml+0],r.fg=this._data[ml+1],r.bg=this._data[ml+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Ce+0]=r.content,this._data[t*Ce+1]=r.fg,this._data[t*Ce+2]=r.bg}setCellFromCodepoint(t,r,n,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Ce+0]=r|n<<22,this._data[t*Ce+1]=i.fg,this._data[t*Ce+2]=i.bg}addCodepointToCell(t,r,n){let i=this._data[t*Ce+0];i&2097152?this._combined[t]+=bn(r):i&2097151?(this._combined[t]=bn(i&2097151)+bn(r),i&=-2097152,i|=2097152):i=r|1<<22,n&&(i&=-12582913,i|=n<<22),this._data[t*Ce+0]=i}insertCells(t,r,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length-t){let i=new Sr;for(let s=this.length-t-r-1;s>=0;--s)this.setCell(t+r+s,this.loadCell(t+s,i));for(let s=0;s<r;++s)this.setCell(t+s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,r,n){if(t%=this.length,r<this.length-t){let i=new Sr;for(let s=0;s<this.length-t-r;++s)this.setCell(t+s,this.loadCell(t+r+s,i));for(let s=this.length-r;s<this.length;++s)this.setCell(s,n)}else for(let i=t;i<this.length;++i)this.setCell(i,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,r,n,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,n);t<r&&t<this.length;)this.setCell(t++,n)}resize(t,r){if(t===this.length)return this._data.length*4*Gc<this._data.buffer.byteLength;let n=t*Ce;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let i=new Uint32Array(n);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,r)}else{this._data=this._data.subarray(0,n);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let l=parseInt(i[o],10);l>=t&&delete this._combined[l]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,n*4*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,r=!1){if(r){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new w1(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ce+0]&4194303)return t+(this._data[t*Ce+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ce+0]&4194303||this._data[t*Ce+2]&50331648)return t+(this._data[t*Ce+0]>>22);return 0}copyCellsFrom(t,r,n,i,s){let o=t._data;if(s)for(let a=i-1;a>=0;a--){for(let c=0;c<Ce;c++)this._data[(n+a)*Ce+c]=o[(r+a)*Ce+c];o[(r+a)*Ce+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}else for(let a=0;a<i;a++){for(let c=0;c<Ce;c++)this._data[(n+a)*Ce+c]=o[(r+a)*Ce+c];o[(r+a)*Ce+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}let l=Object.keys(t._combined);for(let a=0;a<l.length;a++){let c=parseInt(l[a],10);c>=r&&(this._combined[c-r+n]=t._combined[c])}}translateToString(t,r,n,i){r=r??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;r<n;){let o=this._data[r*Ce+0],l=o&2097151,a=o&2097152?this._combined[r]:l?bn(l):Pn;if(s+=a,i)for(let c=0;c<a.length;++c)i.push(r);r+=o>>22||1}return i&&i.push(r),s}};function EL(e,t,r,n,i,s){let o=[];for(let l=0;l<e.length-1;l++){let a=l,c=e.get(++a);if(!c.isWrapped)continue;let h=[e.get(l)];for(;a<e.length&&c.isWrapped;)h.push(c),c=e.get(++a);if(!s&&n>=l&&n<a){l+=h.length-1;continue}let u=0,d=Co(h,u,t),f=1,m=0;for(;f<h.length;){let x=Co(h,f,t),_=x-m,v=r-d,y=Math.min(_,v);h[u].copyCellsFrom(h[f],m,d,y,!1),d+=y,d===r&&(u++,d=0),m+=y,m===x&&(f++,m=0),d===0&&u!==0&&h[u-1].getWidth(r-1)===2&&(h[u].copyCellsFrom(h[u-1],r-1,d++,1,!1),h[u-1].setCell(r-1,i))}h[u].replaceCells(d,r,i);let g=0;for(let x=h.length-1;x>0&&(x>u||h[x].getTrimmedLength()===0);x--)g++;g>0&&(o.push(l+h.length-g),o.push(g)),l+=h.length-1}return o}function NL(e,t){let r=[],n=0,i=t[n],s=0;for(let o=0;o<e.length;o++)if(i===o){let l=t[++n];e.onDeleteEmitter.fire({index:o-s,amount:l}),o+=l-1,s+=l,i=t[++n]}else r.push(o);return{layout:r,countRemoved:s}}function TL(e,t){let r=[];for(let n=0;n<t.length;n++)r.push(e.get(t[n]));for(let n=0;n<r.length;n++)e.set(n,r[n]);e.length=t.length}function PL(e,t,r){let n=[],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<r){n.push(i-l);break}s+=r;let a=Co(e,o,t);s>a&&(s-=a,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let h=c?r-1:r;n.push(h),l+=h}return n}function Co(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,i=e[t+1].getWidth(0)===2;return n&&i?r-1:r}var b1=class k1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=k1._nextId++,this._onDispose=this.register(new oe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),gi(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};b1._nextId=1;var LL=b1,dt={},Jn=dt.B;dt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};dt.A={"#":"£"};dt.B=void 0;dt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};dt.C=dt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};dt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};dt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};dt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};dt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};dt.E=dt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};dt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};dt.H=dt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};dt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var wg=4294967295,bg=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=it.clone(),this.savedCharset=Jn,this.markers=[],this._nullCell=Sr.fromCharData([0,$y,1,0]),this._whitespaceCell=Sr.fromCharData([0,Pn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new va,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Sg(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 pa),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 pa),this._whitespaceCell}getBlankLine(e,t){return new zs(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>wg?wg:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=it);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 Sg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(it),n=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)n+=+this.lines.get(o).resize(e,r);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new zs(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new zs(e,r)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let o=this.lines.length-i;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s<this.lines.length;s++)n+=+this.lines.get(s).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=EL(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(it),r);if(n.length>0){let i=NL(this.lines,n);TL(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(it),i=r;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new zs(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(it),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let a=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),a.unshift(l);if(!r){let y=this.ybase+this.y;if(y>=o&&y<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),h=PL(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(it,!0);f.push(E)}f.length>0&&(i.push({start:o+a.length+s,newLines:f}),s+=f.length),a.push(...f);let m=h.length-1,g=h[m];g===0&&(m--,g=h[m]);let x=a.length-u-1,_=c;for(;x>=0;){let y=Math.min(_,g);if(a[m]===void 0)break;if(a[m].copyCellsFrom(a[x],_-y,g-y,y,!0),g-=y,g===0&&(m--,g=h[m]),_-=y,_===0){x--;let E=Math.max(x,0);_=Co(a,E,this._cols)}}for(let y=0;y<a.length;y++)h[y]<e&&a[y].setCell(h[y],n);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 g=0;g<this.lines.length;g++)l.push(this.lines.get(g));let a=this.lines.length,c=a-1,h=0,u=i[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let d=0;for(let g=Math.min(this.lines.maxLength-1,a+s-1);g>=0;g--)if(u&&u.start>c+d){for(let x=u.newLines.length-1;x>=0;x--)this.lines.set(g--,u.newLines[x]);g++,o.push({index:c+1,amount:u.newLines.length}),d+=u.newLines.length,u=i[++h]}else this.lines.set(g,l[c--]);let f=0;for(let g=o.length-1;g>=0;g--)o[g].index+=f,this.lines.onInsertEmitter.fire(o[g]),f+=o[g].amount;let m=Math.max(0,a+s-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,r=0,n){let i=this.lines.get(e);return i?i.translateToString(t,r,n):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new LL(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},DL=class extends Ee{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new oe),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new bg(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new bg(!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)}},C1=2,E1=1,$h=class extends Ee{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new oe),this.onResize=this._onResize.event,this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,C1),this.rows=Math.max(e.rawOptions.rows||0,E1),this.buffers=this._register(new DL(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let i=r.ybase+r.scrollTop,s=r.ybase+r.scrollBottom;if(r.scrollTop===0){let o=r.lines.isFull;s===r.lines.length-1?o?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(s+1,0,n.clone()),o?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let o=s-i+1;r.lines.shiftElements(i+1,o-1,-1),r.lines.set(s,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};$h=Je([he(0,Wt)],$h);var Ti={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:_a,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},RL=["normal","bold","100","200","300","400","500","600","700","800","900"],ML=class extends Ee{constructor(e){super(),this._onOptionChange=this._register(new oe),this.onOptionChange=this._onOptionChange.event;let t={...Ti};for(let r in e)if(r in t)try{let n=e[r];t[r]=this._sanitizeAndValidateOption(r,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(We(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in Ti))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in Ti))throw new Error(`No option with key "${r}"`);n=this._sanitizeAndValidateOption(r,n),this.rawOptions[r]!==n&&(this.rawOptions[r]=n,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Ti[e]),!IL(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ti[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=RL.includes(t)?t:Ti[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 IL(e){return e==="block"||e==="underline"||e==="bar"}function Fs(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let n in e)r[n]=t<=1?e[n]:e[n]&&Fs(e[n],t-1);return r}var kg=Object.freeze({insertMode:!1}),Cg=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Hh=class extends Ee{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new oe),this.onData=this._onData.event,this._onUserInput=this._register(new oe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new oe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new oe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Fs(kg),this.decPrivateModes=Fs(Cg)}reset(){this.modes=Fs(kg),this.decPrivateModes=Fs(Cg)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Hh=Je([he(0,Ht),he(1,Vy),he(2,Wt)],Hh);var Eg={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 r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var Zc=String.fromCharCode,Ng={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}`}},Wh=class extends Ee{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new oe),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(Eg))this.addProtocol(n,Eg[n]);for(let n of Object.keys(Ng))this.addEncoding(n,Ng[n]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let n=t/r,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=n+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Wh=Je([he(0,Ht),he(1,wi),he(2,Wt)],Wh);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]],AL=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],ct;function BL(e,t){let r=0,n=t.length-1,i;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=r;)if(i=r+n>>1,e>t[i][1])r=i+1;else if(e<t[i][0])n=i-1;else return!0;return!1}var OL=class{constructor(){if(this.version="6",!ct){ct=new Uint8Array(65536),ct.fill(1),ct[0]=0,ct.fill(0,1,32),ct.fill(0,127,160),ct.fill(2,4352,4448),ct[9001]=2,ct[9002]=2,ct.fill(2,11904,42192),ct[12351]=1,ct.fill(2,44032,55204),ct.fill(2,63744,64256),ct.fill(2,65040,65050),ct.fill(2,65072,65136),ct.fill(2,65280,65377),ct.fill(2,65504,65511);for(let e=0;e<Jc.length;++e)ct.fill(0,Jc[e][0],Jc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ct[e]:BL(e,AL)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let i=si.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return si.createPropertyValue(0,r,n)}},si=class Bl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new oe,this.onChange=this._onChange.event;let t=new OL;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,n=0,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return r+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:r+=this.wcwidth(c)}let l=this.charProperties(o,n),a=Bl.extractWidth(l);Bl.extractShouldJoin(l)&&(a-=Bl.extractWidth(n)),r+=a,n=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},jL=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Tg(e){var n;let t=(n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:n.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var Ps=2147483647,zL=256,N1=class Uh{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>zL)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new Uh;if(!t.length)return r;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let i=t[n];if(Array.isArray(i))for(let s=0;s<i.length;++s)r.addSubParam(i[s]);else r.addParam(i)}return r}clone(){let t=new 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 r=0;r<this.length;++r){t.push(this.params[r]);let n=this._subParamsIdx[r]>>8,i=this._subParamsIdx[r]&255;i-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,i))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Ps?Ps: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>Ps?Ps:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-r>0?this._subParams.subarray(r,n):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let n=this._subParamsIdx[r]>>8,i=this._subParamsIdx[r]&255;i-n>0&&(t[r]=this._subParams.slice(n,i))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,i=n[r-1];n[r-1]=~i?Math.min(i*10+t,Ps):t}},Ls=[],FL=class{constructor(){this._state=0,this._active=Ls,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ls}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=Ls,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ls,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",Ka(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&r===!1){for(;n>=0&&(r=this._active[n].end(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=Ls,this._id=-1,this._state=0}}},er=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Ka(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},Ds=[],$L=class{constructor(){this._handlers=Object.create(null),this._active=Ds,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ds}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Ds,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ds,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ka(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&r===!1){for(;n>=0&&(r=this._active[n].unhook(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=Ds,this._ident=0}},$s=new N1;$s.addParam(0);var Pg=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,r){this._hitLimit||(this._data+=Ka(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=$s,this._data="",this._hitLimit=!1,r));return this._params=$s,this._data="",this._hitLimit=!1,t}},HL=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,n){this.table[t<<8|e]=r<<4|n}addMany(e,t,r,n){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=r<<4|n}},mr=160,WL=function(){let e=new HL(4095),t=Array.apply(null,Array(256)).map((l,a)=>a),r=(l,a)=>t.slice(l,a),n=r(32,127),i=r(0,24);i.push(25),i.push.apply(i,r(28,32));let s=r(0,14),o;e.setDefault(1,0),e.addMany(n,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(mr,0,2,0),e.add(mr,8,5,8),e.add(mr,6,0,6),e.add(mr,11,0,11),e.add(mr,13,13,13),e}(),UL=class extends Ee{constructor(e=WL){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 N1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(We(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new FL),this._dcsParser=this._register(new $L),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=n,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,n,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=i}parse(e,t,r){let n=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](this._params),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 4:if(r===!1&&a>-1){for(;a>=0&&(o=l[a](),o!==!0);a--)if(o instanceof Promise)return this._parseStack.handlerPos=a,o}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(n!==24&&n!==26,r),o)return o;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],o=this._oscParser.end(n!==24&&n!==26,r),o)return o;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=s;l<t;++l){switch(n=e[l],i=this._transitions.table[this.currentState<<8|(n<160?n:mr)],i>>4){case 2:for(let d=l+1;;++d){if(d>=t||(n=e[d])<32||n>126&&n<mr){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(n=e[d])<32||n>126&&n<mr){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(n=e[d])<32||n>126&&n<mr){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(n=e[d])<32||n>126&&n<mr){this._printHandler(e,l,d),l=d-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|n],c=a?a.length-1:-1;for(;c>=0&&(o=a[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,a,c,i,l),o;c<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++l<t&&(n=e[l])>47&&n<60);l--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let h=this._escHandlers[this._collect<<8|n],u=h?h.length-1:-1;for(;u>=0&&(o=h[u](),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(4,h,u,i,l),o;u<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let d=l+1;;++d)if(d>=t||(n=e[d])===24||n===26||n===27||n>127&&n<mr){this._dcsParser.put(e,l,d),l=d-1;break}break;case 14:if(o=this._dcsParser.unhook(n!==24&&n!==26),o)return this._preserveStack(6,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let d=l+1;;d++)if(d>=t||(n=e[d])<32||n>127&&n<mr){this._oscParser.put(e,l,d),l=d-1;break}break;case 6:if(o=this._oscParser.end(n!==24&&n!==26),o)return this._preserveStack(5,[],0,i,l),o;n===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},KL=/^([\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})$/,VL=/^[\da-f]+$/;function Lg(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=KL.exec(t);if(r){let n=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/n*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/n*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),VL.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,n=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(r*i,r*i+r),16);n[i]=r===1?s<<4:r===2?s:r===3?s>>4:s>>8}return n}}function eu(e,t){let r=e.toString(16),n=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function qL(e,t=16){let[r,n,i]=e;return`rgb:${eu(r,t)}/${eu(n,t)}/${eu(i,t)}`}var YL={"(":0,")":1,"*":2,"+":3,"-":1,".":2},xn=131072,Dg=10;function Rg(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 Mg=5e3,Ig=0,XL=class extends Ee{constructor(e,t,r,n,i,s,o,l,a=new UL){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=l,this._parser=a,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new pT,this._utf8Decoder=new mT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=it.clone(),this._eraseAttrDataInternal=it.clone(),this._onRequestBell=this._register(new oe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new oe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new oe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new oe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new oe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new oe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new oe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new oe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new oe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new oe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new oe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new oe),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new 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(Y.BEL,()=>this.bell()),this._parser.setExecuteHandler(Y.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Y.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Y.BS,()=>this.backspace()),this._parser.setExecuteHandler(Y.HT,()=>this.tab()),this._parser.setExecuteHandler(Y.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Y.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Il.IND,()=>this.index()),this._parser.setExecuteHandler(Il.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Il.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new er(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new er(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new er(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new er(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new er(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new er(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new er(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new er(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new er(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new er(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new er(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new er(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 dt)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 Pg((c,h)=>this.requestStatusString(c,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),Mg))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Mg} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>xn&&(s=this._parseStack.position+xn)}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<xn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,xn))),o||this._dirtyRowTracker.clearRange(),e.length>xn)for(let c=s;c<e.length;c+=xn){let h=c+xn<e.length?c+xn:e.length,u=typeof e=="string"?this._stringDecoder.decode(e.substring(c,h),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,h),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,u))return this._preserveStack(n,i,u,c),this._logSlowResolvingAsync(r),r}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,c))return this._preserveStack(n,i,c,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),a=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);a<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(a,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,r){let n,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,a=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let d=this._parser.precedingJoinState;for(let f=t;f<r;++f){if(n=e[f],n<127&&s){let _=s[String.fromCharCode(n)];_&&(n=_.charCodeAt(0))}let m=this._unicodeService.charProperties(n,d);i=si.extractWidth(m);let g=si.extractShouldJoin(m),x=g?si.extractWidth(d):0;if(d=m,o&&this._onA11yChar.fire(bn(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-x>l){if(a){let _=u,v=this._activeBuffer.x-x;for(this._activeBuffer.x=x,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),x>0&&u instanceof zs&&u.copyCellsFrom(_,v,0,x,!1);v<l;)_.setCellFromCodepoint(v++,0,1,h)}else if(this._activeBuffer.x=l-1,i===2)continue}if(g&&this._activeBuffer.x){let _=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-_,n,i);for(let v=i-x;--v>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,i-x,this._activeBuffer.getNullCell(h)),u.getWidth(l-1)===2&&u.setCellFromCodepoint(l-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,n,i,h),i>0)for(;--i;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<l&&r-t>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>Rg(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Pg(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new er(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,n=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),i),n&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&n.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(it));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,n=si.extractWidth(t),i=this._activeBuffer.x-n,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*r),l=0;for(let c=0;c<s.length;){let h=s.codePointAt(c)||0;o[l++]=h,c+=h>65535?2:1}let a=l;for(let c=1;c<r;++c)o.copyWithin(a,0,l),a+=l;return this.print(o,0,a),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Y.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Y.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Y.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Y.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Y.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,Jn),this._charsetService.setgCharset(1,Jn),this._charsetService.setgCharset(2,Jn),this._charsetService.setgCharset(3,Jn);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let n=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:l,cols:a}=this._bufferService,{active:c,alt:h}=l,u=this._optionsService.rawOptions,d=(g,x)=>(o.triggerDataEvent(`${Y.ESC}[${t?"":"?"}${g};${x}$y`),!0),f=g=>g?1:2,m=e.params[0];return t?m===2?d(m,4):m===4?d(m,f(o.modes.insertMode)):m===12?d(m,3):m===20?d(m,f(u.convertEol)):d(m,0):m===1?d(m,f(n.applicationCursorKeys)):m===3?d(m,u.windowOptions.setWinLines?a===80?2:a===132?1:0:0):m===6?d(m,f(n.origin)):m===7?d(m,f(n.wraparound)):m===8?d(m,3):m===9?d(m,f(i==="X10")):m===12?d(m,f(u.cursorBlink)):m===25?d(m,f(!o.isCursorHidden)):m===45?d(m,f(n.reverseWraparound)):m===66?d(m,f(n.applicationKeypad)):m===67?d(m,4):m===1e3?d(m,f(i==="VT200")):m===1002?d(m,f(i==="DRAG")):m===1003?d(m,f(i==="ANY")):m===1004?d(m,f(n.sendFocus)):m===1005?d(m,4):m===1006?d(m,f(s==="SGR")):m===1015?d(m,4):m===1016?d(m,f(s==="SGR_PIXELS")):m===1048?d(m,1):m===47||m===1047||m===1049?d(m,f(c===h)):m===2004?d(m,f(n.bracketedPasteMode)):m===2026?d(m,f(n.synchronizedOutput)):d(m,0)}_updateAttrColor(e,t,r,n,i){return t===2?(e|=50331648,e&=-16777216,e|=Oo.fromColorRGB([r,n,i])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let n=[0,0,-1,0,0,0],i=0,s=0;do{if(n[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),l=0;do n[1]===5&&(i=1),n[s+l+1+i]=o[l];while(++l<o.length&&l+s+1+i<n.length);break}if(n[1]===5&&s+i>=2||n[1]===2&&s+i>=5)break;n[1]&&(i=1)}while(++s+t<e.length&&s+i<n.length);for(let o=2;o<n.length;++o)n[o]===-1&&(n[o]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return s}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=it.fg,e.bg=it.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,n=this._curAttrData;for(let i=0;i<t;i++)r=e.params[i],r>=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777216|r-90|8):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777216|r-100|8):r===0?this._processSGR0(n):r===1?n.fg|=134217728:r===3?n.bg|=67108864:r===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,n)):r===5?n.fg|=536870912:r===7?n.fg|=67108864:r===8?n.fg|=1073741824:r===9?n.fg|=2147483648:r===2?n.bg|=134217728:r===21?this._processUnderline(2,n):r===22?(n.fg&=-134217729,n.bg&=-134217729):r===23?n.bg&=-67108865:r===24?(n.fg&=-268435457,this._processUnderline(0,n)):r===25?n.fg&=-536870913:r===27?n.fg&=-67108865:r===28?n.fg&=-1073741825:r===29?n.fg&=2147483647:r===39?(n.fg&=-67108864,n.fg|=it.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=it.bg&16777215):r===38||r===48||r===58?i+=this._extractColor(e,i,n):r===53?n.bg|=1073741824:r===55?n.bg&=-1073741825:r===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):r===100?(n.fg&=-67108864,n.fg|=it.fg&16777215,n.bg&=-67108864,n.bg|=it.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Y.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Y.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Y.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=it.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Rg(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(`${Y.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Dg&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Dg&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let n=r.shift(),i=r.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(Ag(s))if(i==="?")t.push({type:0,index:s});else{let o=Lg(i);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,i=r.findIndex(s=>s.startsWith("id="));return i!==-1&&(n=r[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let n=0;n<r.length&&!(t>=this._specialColors.length);++n,++t)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=Lg(r[n]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let n=0;n<r.length;++n)if(/^\d+$/.exec(r[n])){let i=parseInt(r[n]);Ag(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,Jn),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(YL[e[0]],dt[e[1]]||Jn),!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=it.clone(),this._eraseAttrDataInternal=it.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 Sr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=o=>(this._coreService.triggerDataEvent(`${Y.ESC}${o}${Y.ESC}\\`),!0),n=this._bufferService.buffer,i=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},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&&(Ig=e,e=t,t=Ig),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Kh=Je([he(0,Ht)],Kh);function Ag(e){return 0<=e&&e<256}var GL=5e7,Bg=12,QL=50,ZL=class extends Ee{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new oe),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>GL)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],i=this._action(n,t);if(i){let o=l=>performance.now()-r>=Bg?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);i.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=Bg)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>QL&&(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 r=e,n=this._getEntryIdKey(r),i=this._entriesWithId.get(n);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);r.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(r,n))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Vh=Je([he(0,Ht)],Vh);var Og=!1,JL=class extends Ee{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new is),this._onBinary=this._register(new oe),this.onBinary=this._onBinary.event,this._onData=this._register(new oe),this.onData=this._onData.event,this._onLineFeed=this._register(new oe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new oe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new oe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new oe),this._instantiationService=new bL,this.optionsService=this._register(new ML(e)),this._instantiationService.setService(Wt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance($h)),this._instantiationService.setService(Ht,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Fh)),this._instantiationService.setService(Vy,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Hh)),this._instantiationService.setService(wi,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Wh)),this._instantiationService.setService(Ky,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(si)),this._instantiationService.setService(yT,this.unicodeService),this._charsetService=this._instantiationService.createInstance(jL),this._instantiationService.setService(vT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Vh),this._instantiationService.setService(qy,this._oscLinkService),this._inputHandler=this._register(new XL(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(kt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(kt.forward(this._bufferService.onResize,this._onResize)),this._register(kt.forward(this.coreService.onData,this._onData)),this._register(kt.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new ZL((t,r)=>this._inputHandler.parse(t,r))),this._register(kt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new oe),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Og&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Og=!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,C1),t=Math.max(t,E1),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(Tg.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Tg(this._bufferService),!1))),this._windowsWrappingHeuristics.value=We(()=>{for(let t of e)t.dispose()})}}},e3={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 t3(e,t,r,n){var o;let i={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?i.key=Y.ESC+"OA":i.key=Y.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=Y.ESC+"OD":i.key=Y.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=Y.ESC+"OC":i.key=Y.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=Y.ESC+"OB":i.key=Y.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":Y.DEL,e.altKey&&(i.key=Y.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Y.ESC+"[Z";break}i.key=Y.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Y.ESC+Y.CR:Y.CR,i.cancel=!0;break;case 27:i.key=Y.ESC,e.altKey&&(i.key=Y.ESC+Y.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=Y.ESC+"[1;"+(s+1)+"D":t?i.key=Y.ESC+"OD":i.key=Y.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=Y.ESC+"[1;"+(s+1)+"C":t?i.key=Y.ESC+"OC":i.key=Y.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=Y.ESC+"[1;"+(s+1)+"A":t?i.key=Y.ESC+"OA":i.key=Y.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=Y.ESC+"[1;"+(s+1)+"B":t?i.key=Y.ESC+"OB":i.key=Y.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Y.ESC+"[2~");break;case 46:s?i.key=Y.ESC+"[3;"+(s+1)+"~":i.key=Y.ESC+"[3~";break;case 36:s?i.key=Y.ESC+"[1;"+(s+1)+"H":t?i.key=Y.ESC+"OH":i.key=Y.ESC+"[H";break;case 35:s?i.key=Y.ESC+"[1;"+(s+1)+"F":t?i.key=Y.ESC+"OF":i.key=Y.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=Y.ESC+"[5;"+(s+1)+"~":i.key=Y.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=Y.ESC+"[6;"+(s+1)+"~":i.key=Y.ESC+"[6~";break;case 112:s?i.key=Y.ESC+"[1;"+(s+1)+"P":i.key=Y.ESC+"OP";break;case 113:s?i.key=Y.ESC+"[1;"+(s+1)+"Q":i.key=Y.ESC+"OQ";break;case 114:s?i.key=Y.ESC+"[1;"+(s+1)+"R":i.key=Y.ESC+"OR";break;case 115:s?i.key=Y.ESC+"[1;"+(s+1)+"S":i.key=Y.ESC+"OS";break;case 116:s?i.key=Y.ESC+"[15;"+(s+1)+"~":i.key=Y.ESC+"[15~";break;case 117:s?i.key=Y.ESC+"[17;"+(s+1)+"~":i.key=Y.ESC+"[17~";break;case 118:s?i.key=Y.ESC+"[18;"+(s+1)+"~":i.key=Y.ESC+"[18~";break;case 119:s?i.key=Y.ESC+"[19;"+(s+1)+"~":i.key=Y.ESC+"[19~";break;case 120:s?i.key=Y.ESC+"[20;"+(s+1)+"~":i.key=Y.ESC+"[20~";break;case 121:s?i.key=Y.ESC+"[21;"+(s+1)+"~":i.key=Y.ESC+"[21~";break;case 122:s?i.key=Y.ESC+"[23;"+(s+1)+"~":i.key=Y.ESC+"[23~";break;case 123:s?i.key=Y.ESC+"[24;"+(s+1)+"~":i.key=Y.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=Y.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Y.DEL:e.keyCode===219?i.key=Y.ESC:e.keyCode===220?i.key=Y.FS:e.keyCode===221&&(i.key=Y.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let l=(o=e3[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)i.key=Y.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=Y.ESC+c}else if(e.keyCode===32)i.key=Y.ESC+(e.ctrlKey?Y.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),i.key=Y.ESC+a,i.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=Y.US),e.key==="@"&&(i.key=Y.NUL));break}return i}var et=0,r3=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new va,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new va,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,s)=>this._getKey(i)-this._getKey(s)),t=0,r=0,n=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<n.length;i++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(n[i]=e[t],t++):n[i]=this._array[r++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(et=this._search(t),et===-1)||this._getKey(this._array[et])!==t)return!1;do if(this._array[et]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(et),!0;while(++et<this._array.length&&this._getKey(this._array[et])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,r=new Array(this._array.length-e.length),n=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:r[n++]=this._array[i];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(et=this._search(e),!(et<0||et>=this._array.length)&&this._getKey(this._array[et])===e))do yield this._array[et];while(++et<this._array.length&&this._getKey(this._array[et])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(et=this._search(e),!(et<0||et>=this._array.length)&&this._getKey(this._array[et])===e))do t(this._array[et]);while(++et<this._array.length&&this._getKey(this._array[et])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let n=t+r>>1,i=this._getKey(this._array[n]);if(i>e)r=n-1;else if(i<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},tu=0,jg=0,n3=class extends Ee{constructor(){super(),this._decorations=new r3(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new oe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new oe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(We(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new i3(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let n=0,i=0;for(let s of this._decorations.getKeyIterator(t))n=s.options.x??0,i=n+(s.options.width??1),e>=n&&e<i&&(!r||(s.options.layer??"bottom")===r)&&(yield s)}forEachDecorationAtCell(e,t,r,n){this._decorations.forEachByKey(t,i=>{tu=i.options.x??0,jg=tu+(i.options.width??1),e>=tu&&e<jg&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},i3=class extends jn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new oe),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new oe),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ke.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ke.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},s3=1e3,o3=class{constructor(e,t=s3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=n-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},zg=20,ya=class extends Ee{constructor(e,t,r,n){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new o3(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(we(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<zg+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
134
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===zg+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 r=this._terminal.buffer,n=r.lines.length.toString();for(let i=e;i<=t;i++){let s=r.lines.get(r.ydisp+i),o=[],l=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",a=(r.ydisp+i+1).toString(),c=this._rowElements[i];c&&(l.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=l,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",a),c.setAttribute("aria-setsize",n),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],i=r.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==n)return;let o,l;if(t===0?(o=r,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=r,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let a=this._createAccessibilityTreeNode();this._rowElements.unshift(a),this._rowContainer.insertAdjacentElement("afterbegin",a)}else{let a=this._createAccessibilityTreeNode();this._rowElements.push(a),this._rowContainer.appendChild(a)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:((l=n.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(r.node))return;let i=({node:a,offset:c})=>{let h=a instanceof Text?a.parentNode:a,u=parseInt(h==null?void 0:h.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return console.warn("row is invalid. Race condition?"),null;let 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(r);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,r=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};ya=Je([he(1,df),he(2,fn),he(3,pn)],ya);var qh=class extends Ee{constructor(e,t,r,n,i){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=n,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new oe),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new oe),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(We(()=>{var s;gi(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(we(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(we(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(we(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(we(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let n=0;n<r.length;n++){let i=r[n];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var n,i;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):o.provideLinks(e.y,l=>{var c,h;if(this._isMouseOut)return;let a=l==null?void 0:l.map(u=>({link:u}));(c=this._activeProviderReplies)==null||c.set(s,a),r=this._checkLinkProviderResult(s,e,r),((h=this._activeProviderReplies)==null?void 0:h.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let n=0;n<t.size;n++){let i=t.get(n);if(i)for(let s=0;s<i.length;s++){let o=i[s],l=o.link.range.start.y<e?0:o.link.range.start.x,a=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=l;c<=a;c++){if(r.has(c)){i.splice(s--,1);break}r.add(c)}}}}_checkLinkProviderResult(e,t,r){var s;if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&n){let o=n.find(l=>this._linkAtPosition(l.link,t));o&&(r=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(a=>this._linkAtPosition(a.link,t));if(l){r=!0,this._handleNewLink(l);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&l3(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,gi(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.pointerCursor},set:r=>{var n;(n=this._currentLink)!=null&&n.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,n;return(n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline},set:r=>{var n,i,s;(n=this._currentLink)!=null&&n.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let n=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(n,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,r){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,n=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,r){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return r<=i&&i<=n}_positionFromMouseEvent(e,t,r){let n=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,n,i){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:i}}};qh=Je([he(1,ff),he(2,pn),he(3,Ht),he(4,Xy)],qh);function l3(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 a3=class extends JL{constructor(e={}){super(e),this._linkifier=this._register(new is),this.browser=p1,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new is),this._onCursorMove=this._register(new oe),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new oe),this.onKey=this._onKey.event,this._onRender=this._register(new oe),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new oe),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new oe),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new oe),this.onBell=this._onBell.event,this._onFocus=this._register(new oe),this._onBlur=this._register(new oe),this._onA11yCharEmitter=this._register(new oe),this._onA11yTabEmitter=this._register(new oe),this._onWillOpen=this._register(new oe),this._setup(),this._decorationService=this._instantiationService.createInstance(n3),this._instantiationService.setService(jo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(QP),this._instantiationService.setService(Xy,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(kt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(kt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(kt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(kt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(We(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,n="";switch(t.index){case 256:r="foreground",n="10";break;case 257:r="background",n="11";break;case 258:r="cursor",n="12";break;default:r="ansi",n="4;"+t.index}switch(t.type){case 0:let i=Fe.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${Y.ESC}]${n};${qL(i)}${d1.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=st.toColor(...t.color));else{let s=r;this._themeService.modifyColors(o=>o[s]=st.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(ya,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.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(Y.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,i=t.getWidth(r),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(we(this.element,"copy",t=>{this.hasSelection()&&dT(t,this._selectionService)}));let e=t=>fT(t,this.textarea,this.coreService,this.optionsService);this._register(we(this.textarea,"paste",e)),this._register(we(this.element,"paste",e)),m1?this._register(we(this.element,"mousedown",t=>{t.button===2&&Xm(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(we(this.element,"contextmenu",t=>{Xm(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Sf&&this._register(we(this.element,"auxclick",t=>{t.button===1&&Fy(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(we(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(we(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(we(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(we(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(we(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(we(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(we(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(we(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",hh.get()),v1||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(XP,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(fn,this._coreBrowserService),this._register(we(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(we(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ah,this._document,this._helperContainer),this._instantiationService.setService(Va,this._charSizeService),this._themeService=this._instantiationService.createInstance(zh),this._instantiationService.setService(ds,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ga),this._instantiationService.setService(Yy,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Oh,this.rows,this.screenElement)),this._instantiationService.setService(pn,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(Rh,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Bh),this._instantiationService.setService(ff,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(qh,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Lh,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(jh,this.element,this.screenElement,n)),this._instantiationService.setService(ST,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(kt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(Dh,this.screenElement)),this._register(we(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(ya,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ma,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ma,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Ih,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(s){var c,h,u,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 m=s.deltaY;if(m===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=m<0?0:1,l=4;break;default:return!1}return a===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:a,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(r(s),s.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(s)),wheel:s=>(r(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&r(s)},mousemove:s=>{s.buttons||r(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?n.mousemove||(t.addEventListener("mousemove",i.mousemove),n.mousemove=i.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),s&16?n.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),n.wheel=i.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),s&2?n.mouseup||(n.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),s&4?n.mousedrag||(n.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(we(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return r(s),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(s)})),this._register(we(t,"wheel",s=>{var o,l,a,c,h;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(a=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:a.cell)==null?void 0:c.height,(h=e._coreBrowserService)==null?void 0:h.dpr)===0)return this.cancel(s,!0);let u=Y.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){zy(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=t3(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let n=this.rows-1;return this.scrollLines(r.type===2?-n:n),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===Y.ETX||r.key===Y.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(c3(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(it));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(Y.ESC+"[I"):this.coreService.triggerDataEvent(Y.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.ESC}[4;${r};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.ESC}[6;${i};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function c3(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 r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},h3=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 Sr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},Fg=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 h3(t)}getNullCell(){return new Sr}},d3=class extends Ee{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new oe),this.onBufferChange=this._onBufferChange.event,this._normal=new Fg(this._core.buffers.normal,"normal"),this._alternate=new Fg(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)}},f3=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,n)=>t(r,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},p3=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}},m3=["cols","rows"],Fr=0,g3=class extends Ee{constructor(e){super(),this._core=this._register(new a3(e)),this._addonManager=this._register(new u3),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],r=(n,i)=>{this._checkReadonlyOptions(n),this._core.options[n]=i};for(let n in this._core.options){let i={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,i)}}_checkReadonlyOptions(e){if(m3.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 f3(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new p3(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 d3(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
135
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(Fr of e)if(Fr===1/0||isNaN(Fr)||Fr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Fr of e)if(Fr&&(Fr===1/0||isNaN(Fr)||Fr%1!==0||Fr<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
@@ -143,7 +143,7 @@ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){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 o3=2,l3=1,a3=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var u;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((u=this._terminal.options.overviewRuler)==null?void 0:u.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),i=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),o={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},l=o.top+o.bottom,a=o.right+o.left,c=n-l,h=i-a-t;return{cols:Math.max(o3,Math.floor(h/e.css.cell.width)),rows:Math.max(l3,Math.floor(c/e.css.cell.height))}}};/**
146
+ */var _3=2,v3=1,y3=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var u;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((u=this._terminal.options.overviewRuler)==null?void 0:u.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),i=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),o={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},l=o.top+o.bottom,a=o.right+o.left,c=n-l,h=i-a-t;return{cols:Math.max(_3,Math.floor(h/e.css.cell.width)),rows:Math.max(v3,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 r=window.open();if(r){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 c3=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){let r=h3.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,n)=>{if(this._options.hover){let{range:i}=t;this._options.hover(r,n,i)}},t))}};function u3(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var h3=class zl{static computeLink(t,r,n,i){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=zl._getWindowedLineStrings(t-1,n),a=o.join(""),c,h=[];for(;c=s.exec(a);){let u=c[0];if(!u3(u))continue;let[d,f]=zl._mapStrIdx(n,l,0,c.index),[m,g]=zl._mapStrIdx(n,d,f,u.length);if(d===-1||f===-1||m===-1||g===-1)continue;let x={start:{x:f+1,y:d+1},end:{x:g,y:m+1}};h.push({range:x,text:u,activate:i})}return h}static _getWindowedLineStrings(t,r){let n,i=t,s=t,o=0,l="",a=[];if(n=r.buffer.active.getLine(t)){let c=n.translateToString(!0);if(n.isWrapped&&c[0]!==" "){for(o=0;(n=r.buffer.active.getLine(--i))&&o<2048&&(l=n.translateToString(!0),o+=l.length,a.push(l),!(!n.isWrapped||l.indexOf(" ")!==-1)););a.reverse()}for(a.push(c),o=0;(n=r.buffer.active.getLine(++s))&&n.isWrapped&&o<2048&&(l=n.translateToString(!0),o+=l.length,a.push(l),l.indexOf(" ")===-1););}return[a,i]}static _mapStrIdx(t,r,n,i){let s=t.buffer.active,o=s.getNullCell(),l=n;for(;i;){let a=s.getLine(r);if(!a)return[-1,-1];for(let c=l;c<a.length;++c){a.getCell(c,o);let h=o.getChars();if(o.getWidth()&&(i-=h.length||1,c===a.length-1&&h==="")){let u=s.getLine(r+1);u&&u.isWrapped&&(u.getCell(0,o),o.getWidth()===2&&(i+=1))}if(i<0)return[r,c]}r++,l=0}return[r,l]}},d3=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f3(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var p3=class{constructor(e=f3,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||d3;this._linkProvider=this._terminal.registerLinkProvider(new c3(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const Dg={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"},v1=w.forwardRef(({onInput:e,onResize:t,fontSize:r=13},n)=>{const i=w.useRef(null),s=w.useRef(null),o=w.useRef(null),[l,a]=w.useState(!1);return w.useImperativeHandle(n,()=>({write:c=>{var h;(h=s.current)==null||h.write(c)},clear:()=>{var c;(c=s.current)==null||c.clear()},fit:()=>{var c;try{(c=o.current)==null||c.fit(),s.current&&(t==null||t(s.current.cols,s.current.rows))}catch{}},bumpResize:()=>{var c;try{(c=o.current)==null||c.fit();const h=s.current;if(!h)return;const u=h.cols,d=h.rows;t==null||t(u+5,d),setTimeout(()=>{t==null||t(u,d)},100)}catch{}}})),w.useEffect(()=>{if(!i.current)return;const c=new s3({cursorBlink:!0,cursorStyle:"bar",fontSize:r,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:Dg,allowTransparency:!0,scrollback:5e3,convertEol:!1}),h=new a3,u=new p3;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(m=>{e(m)}),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}},[r]),p.jsx("div",{ref:i,className:"w-full h-full rounded-lg overflow-hidden transition-opacity duration-200",style:{background:Dg.background,opacity:l?1:0}})});v1.displayName="CliTerminal";function Mg({label:e,value:t,sub:r,icon:n}){return p.jsxs("div",{className:"px-4 py-3.5 rounded-xl bg-slate-900/50 border border-white/[0.06]",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[p.jsx("span",{className:"text-base",children:n}),p.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wide font-semibold",children:e})]}),p.jsx("div",{className:"text-[22px] font-bold text-slate-100 tracking-tight",children:t}),r&&p.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5",children:r})]})}function Ig({value:e,max:t,label:r,color:n="#8b5cf6",detail:i,compact:s=!1}){const o=t>0?Math.min(Math.round(e/t*100),100):0,l=o>85?"#ef4444":o>60?"#f59e0b":n;return s?p.jsxs("div",{className:"flex-1",children:[p.jsxs("div",{className:"flex justify-between mb-0.5",children:[p.jsx("span",{className:"text-[9px] text-slate-500 uppercase tracking-wide font-semibold",children:r}),p.jsxs("span",{className:"text-[10px] text-slate-400 font-semibold",children:[o,"%"]})]}),p.jsx("div",{className:"h-1 bg-white/[0.04] rounded-sm overflow-hidden",children:p.jsx("div",{className:"h-full rounded-sm transition-[width] duration-500",style:{width:`${o}%`,background:l}})})]}):p.jsxs("div",{className:"flex-1",children:[p.jsxs("div",{className:"flex justify-between mb-1.5",children:[p.jsx("span",{className:"text-[11px] text-slate-400 font-medium",children:r}),p.jsxs("span",{className:"text-[13px] text-slate-200 font-bold",children:[o,"%"]})]}),p.jsx("div",{className:"h-1.5 bg-white/[0.04] rounded-sm overflow-hidden",children:p.jsx("div",{className:"h-full rounded-sm transition-[width] duration-[600ms]",style:{width:`${o}%`,background:`linear-gradient(90deg, ${l}, ${l}cc)`}})}),i&&p.jsx("div",{className:"text-[10px] text-slate-500 mt-0.5",children:i})]})}function m3({screenshot:e,isCapturing:t,onRefresh:r,onAction:n,addLog:i,connState:s,connScreenshot:o}){const l=w.useRef(null),a=w.useRef(null),c=w.useRef(null),[h,u]=w.useState(!0),[d,f]=w.useState(2e3),[m,g]=w.useState(null),[x,_]=w.useState(""),[,v]=w.useState(!1),[y,E]=w.useState(!1),[N,k]=w.useState(!1),I=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[z,Z]=w.useState(I?"mouse":"touch"),[T,R]=w.useState(1),[A,D]=w.useState(0),[U,M]=w.useState(0),F=w.useRef(0),W=w.useRef(t),L=w.useRef(r),$=w.useRef(n),S=w.useRef(null),ne=w.useRef(null),oe=w.useRef(!1),b=w.useRef(null),me=w.useRef(0),V=w.useRef(null),H=w.useRef(1),G=w.useRef({x:0,y:0}),he=w.useRef(T),ue=w.useRef(A),ge=w.useRef(U),O=w.useRef(z);w.useEffect(()=>{W.current=t},[t]),w.useEffect(()=>{L.current=r},[r]),w.useEffect(()=>{he.current=T},[T]),w.useEffect(()=>{ue.current=A},[A]),w.useEffect(()=>{ge.current=U},[U]),w.useEffect(()=>{$.current=n},[n]),w.useEffect(()=>{O.current=z},[z]),w.useEffect(()=>{var J;(J=l.current)==null||J.focus()},[]);const Ue=s==="connected",ve=s!=="connected"&&s!=="connecting",Ke=Ue&&o?o:e;w.useEffect(()=>{T<=1&&(D(0),M(0))},[T]);const Ot=(J,pe,P)=>{if(P<=1)return{x:0,y:0};const X=(P-1)/(2*P)*100,B=(P-1)/(2*P)*100;return{x:Math.max(-X,Math.min(X,J)),y:Math.max(-B,Math.min(B,pe))}};w.useEffect(()=>{if(!h||!ve)return;let J=null;const pe=()=>{J&&clearInterval(J),!document.hidden&&(J=setInterval(()=>{var X;if(!W.current){const B=((X=l.current)==null?void 0:X.clientWidth)||0,j=Math.max(400,Math.ceil(B/100)*100);L.current(j)}},d))},P=()=>{document.hidden?(J&&clearInterval(J),J=null):pe()};return pe(),document.addEventListener("visibilitychange",P),()=>{J&&clearInterval(J),document.removeEventListener("visibilitychange",P)}},[h,ve,d]);const qt=(J,pe)=>{if(!c.current)return null;const P=c.current.getBoundingClientRect();return!P.width||!P.height?null:{nx:Math.max(0,Math.min(1,(J-P.left)/P.width)),ny:Math.max(0,Math.min(1,(pe-P.top)/P.height))}},De=async J=>{var P;const pe=qt(J.clientX,J.clientY);if(pe){g(`Click: ${Math.round(pe.nx*100)}%, ${Math.round(pe.ny*100)}%`),(P=l.current)==null||P.focus();try{const X=await n("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}`)}}},ke=async(J,pe,P,X=0)=>{try{await n("input_key",{type:P?"char":"keyDown",key:J,code:pe,text:P?J:void 0,unmodifiedText:P?J:void 0,modifiers:X})}catch(B){i(`❌ Key error: ${B.message||B}`)}},Or=async J=>{if(J.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(J.key)&&J.preventDefault();let P=0;J.altKey&&(P|=1),J.ctrlKey&&(P|=2),J.metaKey&&(P|=4),J.shiftKey&&(P|=8),g(`Key: ${J.key}`),await ke(J.key,J.code,J.key.length===1,P)},Zr=async J=>{if(J.key==="Enter"){if(J.nativeEvent.isComposing)return;if(x){const pe=x;_(""),g(`IME Sent: ${pe}`);try{const P=await n("input_type",{text:pe});P!=null&&P.success||i(`❌ IME error: ${P==null?void 0:P.error}`)}catch(P){i(`❌ IME error: ${P.message}`)}}else g("Key: Enter"),await ke("Enter","Enter",!1)}};w.useEffect(()=>{const J=l.current;if(!J)return;const pe=P=>{var X;if((X=c.current)!=null&&X.contains(P.target)){P.preventDefault();const B=Date.now();if(B-F.current<40)return;F.current=B;const j=qt(P.clientX,P.clientY);if(!j)return;g(`Scroll: ${Math.round(P.deltaY)}`),n("input_wheel",{nx:j.nx,ny:j.ny,deltaX:Math.round(P.deltaX),deltaY:Math.round(P.deltaY)}).catch(()=>{})}};return J.addEventListener("wheel",pe,{passive:!1}),()=>J.removeEventListener("wheel",pe)},[n]);const[Pt,Yt]=w.useState(null),Qe=w.useRef(null);return w.useEffect(()=>{if(z==="mouse"&&!Qe.current){const J={nx:.5,ny:.5};Qe.current=J,Yt(J)}},[z]),w.useEffect(()=>{const J=l.current;if(!J)return;const pe=Y=>{if(!c.current)return null;const ee=c.current.getBoundingClientRect();return!ee.width||!ee.height?null:{nx:Math.max(0,Math.min(1,(Y.clientX-ee.left)/ee.width)),ny:Math.max(0,Math.min(1,(Y.clientY-ee.top)/ee.height))}},P=(Y,ee)=>{if(!c.current)return{dnx:0,dny:0};const se=c.current,le=se.getBoundingClientRect(),fe=se.naturalWidth||le.width,ae=se.naturalHeight||le.height,xe=fe/ae,we=le.width/le.height;let Ze,nt;return xe>we?(Ze=le.width,nt=le.width/xe):(nt=le.height,Ze=le.height*xe),{dnx:Y/Ze,dny:ee/nt}},X=(Y,ee,se)=>{if(se<=1.05)return;const le=-(Y-.5)*100,fe=-(ee-.5)*100,ae=Ot(le,fe,se);(Math.abs(ae.x-ue.current)>.1||Math.abs(ae.y-ge.current)>.1)&&(D(ae.x),M(ae.y),ue.current=ae.x,ge.current=ae.y)},B=Y=>{if(Y.preventDefault(),Y.touches.length===1){const ee=Y.touches[0];S.current={x:ee.clientX,y:ee.clientY,time:Date.now()},ne.current={x:ee.clientX,y:ee.clientY},oe.current=!1,b.current=setTimeout(()=>{if(!oe.current)if(oe.current=!0,O.current==="mouse"){const se=Qe.current||{nx:.5,ny:.5};g("Right Click"),$.current("input_click",{...se,button:"right"}).catch(()=>{})}else{const se=pe(ee);se&&(g("Right Click"),$.current("input_click",{...se,button:"right"}).catch(()=>{}))}},500)}else if(Y.touches.length===2){clearTimeout(b.current),oe.current=!0;const ee=Y.touches[1].clientX-Y.touches[0].clientX,se=Y.touches[1].clientY-Y.touches[0].clientY;V.current=Math.sqrt(ee*ee+se*se),H.current=he.current,G.current={x:(Y.touches[0].clientX+Y.touches[1].clientX)/2,y:(Y.touches[0].clientY+Y.touches[1].clientY)/2}}},j=Y=>{if(Y.preventDefault(),Y.touches.length===1&&ne.current){const ee=Y.touches[0],se=ee.clientX-ne.current.x,le=ee.clientY-ne.current.y;if(!oe.current&&(Math.abs(se)>10||Math.abs(le)>10)&&(oe.current=!0,clearTimeout(b.current)),oe.current)if(O.current==="mouse"){const fe=P(se,le),ae=Qe.current||{nx:.5,ny:.5},xe=Math.max(0,Math.min(1,ae.nx+fe.dnx)),we=Math.max(0,Math.min(1,ae.ny+fe.dny));Qe.current={nx:xe,ny:we},Yt({nx:xe,ny:we}),g(`Cursor: ${Math.round(xe*100)}%, ${Math.round(we*100)}%`),X(xe,we,he.current);const Ze=Date.now();Ze-F.current>=30&&(F.current=Ze,$.current("input_mouseMoved",{nx:xe,ny:we}).catch(()=>{}))}else if(he.current>1){const fe=a.current;if(fe){const ae=fe.clientWidth,xe=fe.clientHeight,we=ue.current+se/ae*100,Ze=ge.current+le/xe*100,nt=Ot(we,Ze,he.current);D(nt.x),M(nt.y),ue.current=nt.x,ge.current=nt.y}}else{const fe=pe(ee);if(fe){const ae=Date.now();ae-F.current>=40&&(F.current=ae,g("Scroll"),$.current("input_wheel",{nx:fe.nx,ny:fe.ny,deltaX:Math.round(-se*2.5),deltaY:Math.round(-le*2.5)}).catch(()=>{}))}}ne.current={x:ee.clientX,y:ee.clientY}}else if(Y.touches.length===2&&V.current!==null){const ee=Y.touches[1].clientX-Y.touches[0].clientX,se=Y.touches[1].clientY-Y.touches[0].clientY,fe=Math.sqrt(ee*ee+se*se)/V.current,ae=(Y.touches[0].clientX+Y.touches[1].clientX)/2,xe=(Y.touches[0].clientY+Y.touches[1].clientY)/2,we=ae-G.current.x,Ze=xe-G.current.y,nt=Math.abs(fe-1)>.03;if(O.current==="mouse"){if(nt){const Xt=Math.max(.5,Math.min(5,H.current*fe));R(Xt),he.current=Xt}else if(Math.abs(we)>2||Math.abs(Ze)>2){const Xt=Qe.current||{nx:.5,ny:.5},jt=Date.now();jt-F.current>=30&&(F.current=jt,g("Scroll"),$.current("input_wheel",{nx:Xt.nx,ny:Xt.ny,deltaX:Math.round(-we*3),deltaY:Math.round(-Ze*3)}).catch(()=>{}))}}else{const Xt=Math.max(.5,Math.min(5,H.current*fe));R(Xt),he.current=Xt;const jt=a.current;if(jt&&Xt>1){const $o=jt.clientWidth,Ho=jt.clientHeight,Wo=ue.current+we/$o*100,Uo=ge.current+Ze/Ho*100,Vn=Ot(Wo,Uo,Xt);D(Vn.x),M(Vn.y),ue.current=Vn.x,ge.current=Vn.y}}G.current={x:ae,y:xe}}},K=Y=>{var ee;if(clearTimeout(b.current),V.current=null,Y.touches.length===0&&Y.changedTouches.length===1&&!oe.current){const se=Y.changedTouches[0],le=Date.now();if(le-(((ee=S.current)==null?void 0:ee.time)||0)<40)return;if(O.current==="mouse"){const ae=Qe.current||pe(se);ae&&(g(`Click: ${Math.round(ae.nx*100)}%, ${Math.round(ae.ny*100)}%`),$.current("input_click",{...ae}).catch(()=>{}))}else{const ae=pe(se);if(!ae)return;le-me.current<300?(g("Double tap"),$.current("input_click",{...ae,clickCount:2}).catch(()=>{}),me.current=0):(g(`Tap: ${Math.round(ae.nx*100)}%, ${Math.round(ae.ny*100)}%`),$.current("input_click",{...ae}).catch(()=>{}),me.current=le)}}oe.current=!1};return J.addEventListener("touchstart",B,{passive:!1}),J.addEventListener("touchmove",j,{passive:!1}),J.addEventListener("touchend",K,{passive:!1}),()=>{J.removeEventListener("touchstart",B),J.removeEventListener("touchmove",j),J.removeEventListener("touchend",K),clearTimeout(b.current)}},[]),p.jsxs("div",{ref:l,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:Or,onContextMenu:J=>J.preventDefault(),onFocus:()=>v(!0),onBlur:()=>v(!1),tabIndex:0,children:[p.jsxs("div",{ref:a,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[Ke?p.jsx("img",{ref:c,src:Ke,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${T}) translate(${A}%, ${U}%)`,transformOrigin:"center center",cursor:z==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:De,onContextMenu:J=>J.preventDefault(),onDragStart:J=>J.preventDefault()}):p.jsxs("div",{className:"text-slate-800 text-center",children:[p.jsx("div",{className:"text-5xl mb-3",children:"🌑"}),p.jsx("div",{className:"text-[13px] font-semibold",children:"Connecting to Host..."})]}),z==="mouse"&&Pt&&Ke&&c.current&&(()=>{var Ze;const J=c.current,pe=J.getBoundingClientRect(),P=(Ze=a.current)==null?void 0:Ze.getBoundingClientRect();if(!P)return null;const X=J.naturalWidth||pe.width,B=J.naturalHeight||pe.height,j=X/B,K=pe.width/pe.height;let Y,ee,se,le;j>K?(Y=pe.width,ee=pe.width/j,se=0,le=(pe.height-ee)/2):(ee=pe.height,Y=pe.height*j,se=(pe.width-Y)/2,le=0);const fe=pe.left-P.left+se+Y*Pt.nx,ae=pe.top-P.top+le+ee*Pt.ny,xe=Math.max(8,Math.min(P.width-8,fe)),we=Math.max(8,Math.min(P.height-8,ae));return p.jsxs("div",{style:{position:"absolute",left:xe-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:J=>J.stopPropagation(),className:"absolute bottom-0 left-0 right-0 z-[1000] flex items-center justify-center gap-1.5 px-3 py-2 bg-black/75 backdrop-blur-xl border-t border-white/[0.08] touch-none",children:[p.jsxs("div",{onClick:()=>{Z(J=>{const pe=J==="touch"?"mouse":"touch";if(pe==="mouse"&&!Qe.current){const P={nx:.5,ny:.5};Qe.current=P,Yt(P)}return pe})},className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${z==="mouse"?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:[p.jsx("span",{className:"text-sm",children:z==="mouse"?"🖱️":"👆"}),p.jsx("span",{className:`text-[10px] font-bold ${z==="mouse"?"text-blue-400":"text-slate-400"}`,children:z==="mouse"?"Mouse":"Touch"})]}),p.jsxs("div",{className:"relative",children:[p.jsx("div",{onClick:()=>{k(!N),E(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${N?"bg-emerald-500/25 border border-emerald-500/40":"bg-white/[0.08] border border-white/10"}`,children:p.jsx("span",{className:"text-sm",children:"⌨️"})}),N&&p.jsx("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 w-[220px] bg-neutral-950/[0.98] backdrop-blur-[30px] rounded-xl border border-white/20 p-[10px_12px] shadow-[0_10px_30px_rgba(0,0,0,0.8)] flex flex-col gap-2 z-[2000]",style:{animation:"slideUp 0.15s ease-out"},children:p.jsx("input",{type:"text",placeholder:"Type & Enter...",value:x,autoFocus:!0,onTouchStart:J=>J.stopPropagation(),onChange:J=>_(J.target.value),onKeyDown:Zr,className:"w-full bg-black/60 border border-white/15 rounded-lg px-2.5 py-2 text-white text-[13px] outline-none"})})]}),p.jsx("div",{className:"relative",children:p.jsx("div",{onClick:()=>{E(!y),k(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${y?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:p.jsx("span",{className:"text-sm",children:"⚙️"})})}),p.jsx("div",{className:"w-px h-[18px] bg-white/10"}),p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 rounded-md",style:{background:Ue?"rgba(16,185,129,0.12)":"rgba(251,191,36,0.12)"},children:[p.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:Ue?"#10b981":"#fbbf24"}}),p.jsx("span",{className:"text-[8px] font-extrabold",style:{color:Ue?"#10b981":"#fbbf24"},children:Ue?"Connected":"WS"})]}),T>1&&p.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(T*100),"%"]}),m&&p.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:m})]})]}),y&&p.jsxs("div",{onTouchStart:J=>J.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:J=>{J.stopPropagation(),R(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:J=>{J.stopPropagation(),R(1),D(0),M(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:J=>{J.stopPropagation(),R(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:J=>{var X;J.stopPropagation();const pe=((X=l.current)==null?void 0:X.clientWidth)||0,P=pe>0?Math.max(400,Math.ceil(pe/100)*100):void 0;r(P)},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:J=>u(J.target.checked)})]}),p.jsxs("select",{value:d,onChange:J=>f(Number(J.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 x3=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){let r=w3.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,n)=>{if(this._options.hover){let{range:i}=t;this._options.hover(r,n,i)}},t))}};function S3(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var w3=class Ol{static computeLink(t,r,n,i){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=Ol._getWindowedLineStrings(t-1,n),a=o.join(""),c,h=[];for(;c=s.exec(a);){let u=c[0];if(!S3(u))continue;let[d,f]=Ol._mapStrIdx(n,l,0,c.index),[m,g]=Ol._mapStrIdx(n,d,f,u.length);if(d===-1||f===-1||m===-1||g===-1)continue;let x={start:{x:f+1,y:d+1},end:{x:g,y:m+1}};h.push({range:x,text:u,activate:i})}return h}static _getWindowedLineStrings(t,r){let n,i=t,s=t,o=0,l="",a=[];if(n=r.buffer.active.getLine(t)){let c=n.translateToString(!0);if(n.isWrapped&&c[0]!==" "){for(o=0;(n=r.buffer.active.getLine(--i))&&o<2048&&(l=n.translateToString(!0),o+=l.length,a.push(l),!(!n.isWrapped||l.indexOf(" ")!==-1)););a.reverse()}for(a.push(c),o=0;(n=r.buffer.active.getLine(++s))&&n.isWrapped&&o<2048&&(l=n.translateToString(!0),o+=l.length,a.push(l),l.indexOf(" ")===-1););}return[a,i]}static _mapStrIdx(t,r,n,i){let s=t.buffer.active,o=s.getNullCell(),l=n;for(;i;){let a=s.getLine(r);if(!a)return[-1,-1];for(let c=l;c<a.length;++c){a.getCell(c,o);let h=o.getChars();if(o.getWidth()&&(i-=h.length||1,c===a.length-1&&h==="")){let u=s.getLine(r+1);u&&u.isWrapped&&(u.getCell(0,o),o.getWidth()===2&&(i+=1))}if(i<0)return[r,c]}r++,l=0}return[r,l]}},b3=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function k3(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var C3=class{constructor(e=k3,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||b3;this._linkProvider=this._terminal.registerLinkProvider(new x3(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const $g={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"},T1=b.forwardRef(({onInput:e,onResize:t,fontSize:r=13},n)=>{const i=b.useRef(null),s=b.useRef(null),o=b.useRef(null),[l,a]=b.useState(!1);return b.useImperativeHandle(n,()=>({write:c=>{var 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{}}})),b.useEffect(()=>{if(!i.current)return;const c=new g3({cursorBlink:!0,cursorStyle:"bar",fontSize:r,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:$g,allowTransparency:!0,scrollback:5e3,convertEol:!1}),h=new y3,u=new C3;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(m=>{e(m)}),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}},[r]),p.jsx("div",{ref:i,className:"w-full h-full rounded-lg overflow-hidden transition-opacity duration-200",style:{background:$g.background,opacity:l?1:0}})});T1.displayName="CliTerminal";function Hg({label:e,value:t,sub:r,icon:n}){return p.jsxs("div",{className:"px-4 py-3.5 rounded-xl bg-slate-900/50 border border-white/[0.06]",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[p.jsx("span",{className:"text-base",children:n}),p.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wide font-semibold",children:e})]}),p.jsx("div",{className:"text-[22px] font-bold text-slate-100 tracking-tight",children:t}),r&&p.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5",children:r})]})}function Wg({value:e,max:t,label:r,color:n="#8b5cf6",detail:i,compact:s=!1}){const o=t>0?Math.min(Math.round(e/t*100),100):0,l=o>85?"#ef4444":o>60?"#f59e0b":n;return s?p.jsxs("div",{className:"flex-1",children:[p.jsxs("div",{className:"flex justify-between mb-0.5",children:[p.jsx("span",{className:"text-[9px] text-slate-500 uppercase tracking-wide font-semibold",children:r}),p.jsxs("span",{className:"text-[10px] text-slate-400 font-semibold",children:[o,"%"]})]}),p.jsx("div",{className:"h-1 bg-white/[0.04] rounded-sm overflow-hidden",children:p.jsx("div",{className:"h-full rounded-sm transition-[width] duration-500",style:{width:`${o}%`,background:l}})})]}):p.jsxs("div",{className:"flex-1",children:[p.jsxs("div",{className:"flex justify-between mb-1.5",children:[p.jsx("span",{className:"text-[11px] text-slate-400 font-medium",children:r}),p.jsxs("span",{className:"text-[13px] text-slate-200 font-bold",children:[o,"%"]})]}),p.jsx("div",{className:"h-1.5 bg-white/[0.04] rounded-sm overflow-hidden",children:p.jsx("div",{className:"h-full rounded-sm transition-[width] duration-[600ms]",style:{width:`${o}%`,background:`linear-gradient(90deg, ${l}, ${l}cc)`}})}),i&&p.jsx("div",{className:"text-[10px] text-slate-500 mt-0.5",children:i})]})}function E3({screenshot:e,isCapturing:t,onRefresh:r,onAction:n,addLog:i,connState:s,connScreenshot:o}){const l=b.useRef(null),a=b.useRef(null),c=b.useRef(null),[h,u]=b.useState(!0),[d,f]=b.useState(2e3),[m,g]=b.useState(null),[x,_]=b.useState(""),[,v]=b.useState(!1),[y,E]=b.useState(!1),[P,C]=b.useState(!1),M=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[z,J]=b.useState(M?"mouse":"touch"),[N,D]=b.useState(1),[I,R]=b.useState(0),[W,A]=b.useState(0),F=b.useRef(0),H=b.useRef(t),L=b.useRef(r),$=b.useRef(n),S=b.useRef(null),ne=b.useRef(null),ce=b.useRef(!1),k=b.useRef(null),ge=b.useRef(0),X=b.useRef(null),Q=b.useRef(1),K=b.useRef({x:0,y:0}),ue=b.useRef(N),de=b.useRef(I),pe=b.useRef(W),B=b.useRef(z);b.useEffect(()=>{H.current=t},[t]),b.useEffect(()=>{L.current=r},[r]),b.useEffect(()=>{ue.current=N},[N]),b.useEffect(()=>{de.current=I},[I]),b.useEffect(()=>{pe.current=W},[W]),b.useEffect(()=>{$.current=n},[n]),b.useEffect(()=>{B.current=z},[z]),b.useEffect(()=>{var ee;(ee=l.current)==null||ee.focus()},[]);const Re=s==="connected",be=s!=="connected"&&s!=="connecting",Ie=Re&&o?o:e;b.useEffect(()=>{N<=1&&(R(0),A(0))},[N]);const Nt=(ee,ae,T)=>{if(T<=1)return{x:0,y:0};const q=(T-1)/(2*T)*100,O=(T-1)/(2*T)*100;return{x:Math.max(-q,Math.min(q,ee)),y:Math.max(-O,Math.min(O,ae))}};b.useEffect(()=>{if(!h||!be)return;let ee=null;const ae=()=>{ee&&clearInterval(ee),!document.hidden&&(ee=setInterval(()=>{var q;if(!H.current){const O=((q=l.current)==null?void 0:q.clientWidth)||0,j=Math.max(400,Math.ceil(O/100)*100);L.current(j)}},d))},T=()=>{document.hidden?(ee&&clearInterval(ee),ee=null):ae()};return ae(),document.addEventListener("visibilitychange",T),()=>{ee&&clearInterval(ee),document.removeEventListener("visibilitychange",T)}},[h,be,d]);const ur=(ee,ae)=>{if(!c.current)return null;const T=c.current.getBoundingClientRect();return!T.width||!T.height?null:{nx:Math.max(0,Math.min(1,(ee-T.left)/T.width)),ny:Math.max(0,Math.min(1,(ae-T.top)/T.height))}},kr=async ee=>{var T;const ae=ur(ee.clientX,ee.clientY);if(ae){g(`Click: ${Math.round(ae.nx*100)}%, ${Math.round(ae.ny*100)}%`),(T=l.current)==null||T.focus();try{const q=await n("input_click",{nx:ae.nx,ny:ae.ny});q!=null&&q.success||i(`❌ Click failed: ${q==null?void 0:q.error}`)}catch(q){i(`❌ Click error: ${q.message||q}`)}}},Br=async(ee,ae,T,q=0)=>{try{await n("input_key",{type:T?"char":"keyDown",key:ee,code:ae,text:T?ee:void 0,unmodifiedText:T?ee:void 0,modifiers:q})}catch(O){i(`❌ Key error: ${O.message||O}`)}},Or=async ee=>{if(ee.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(ee.key)&&ee.preventDefault();let T=0;ee.altKey&&(T|=1),ee.ctrlKey&&(T|=2),ee.metaKey&&(T|=4),ee.shiftKey&&(T|=8),g(`Key: ${ee.key}`),await Br(ee.key,ee.code,ee.key.length===1,T)},mn=async ee=>{if(ee.key==="Enter"){if(ee.nativeEvent.isComposing)return;if(x){const ae=x;_(""),g(`IME Sent: ${ae}`);try{const T=await n("input_type",{text:ae});T!=null&&T.success||i(`❌ IME error: ${T==null?void 0:T.error}`)}catch(T){i(`❌ IME error: ${T.message}`)}}else g("Key: Enter"),await Br("Enter","Enter",!1)}};b.useEffect(()=>{const ee=l.current;if(!ee)return;const ae=T=>{var q;if((q=c.current)!=null&&q.contains(T.target)){T.preventDefault();const O=Date.now();if(O-F.current<40)return;F.current=O;const j=ur(T.clientX,T.clientY);if(!j)return;g(`Scroll: ${Math.round(T.deltaY)}`),n("input_wheel",{nx:j.nx,ny:j.ny,deltaX:Math.round(T.deltaX),deltaY:Math.round(T.deltaY)}).catch(()=>{})}};return ee.addEventListener("wheel",ae,{passive:!1}),()=>ee.removeEventListener("wheel",ae)},[n]);const[hr,Cr]=b.useState(null),ft=b.useRef(null);return b.useEffect(()=>{if(z==="mouse"&&!ft.current){const ee={nx:.5,ny:.5};ft.current=ee,Cr(ee)}},[z]),b.useEffect(()=>{const ee=l.current;if(!ee)return;const ae=V=>{if(!c.current)return null;const Z=c.current.getBoundingClientRect();return!Z.width||!Z.height?null:{nx:Math.max(0,Math.min(1,(V.clientX-Z.left)/Z.width)),ny:Math.max(0,Math.min(1,(V.clientY-Z.top)/Z.height))}},T=(V,Z)=>{if(!c.current)return{dnx:0,dny:0};const se=c.current,le=se.getBoundingClientRect(),me=se.naturalWidth||le.width,re=se.naturalHeight||le.height,xe=me/re,ye=le.width/le.height;let Xe,rt;return xe>ye?(Xe=le.width,rt=le.width/xe):(rt=le.height,Xe=le.height*xe),{dnx:V/Xe,dny:Z/rt}},q=(V,Z,se)=>{if(se<=1.05)return;const le=-(V-.5)*100,me=-(Z-.5)*100,re=Nt(le,me,se);(Math.abs(re.x-de.current)>.1||Math.abs(re.y-pe.current)>.1)&&(R(re.x),A(re.y),de.current=re.x,pe.current=re.y)},O=V=>{if(V.preventDefault(),V.touches.length===1){const Z=V.touches[0];S.current={x:Z.clientX,y:Z.clientY,time:Date.now()},ne.current={x:Z.clientX,y:Z.clientY},ce.current=!1,k.current=setTimeout(()=>{if(!ce.current)if(ce.current=!0,B.current==="mouse"){const se=ft.current||{nx:.5,ny:.5};g("Right Click"),$.current("input_click",{...se,button:"right"}).catch(()=>{})}else{const se=ae(Z);se&&(g("Right Click"),$.current("input_click",{...se,button:"right"}).catch(()=>{}))}},500)}else if(V.touches.length===2){clearTimeout(k.current),ce.current=!0;const Z=V.touches[1].clientX-V.touches[0].clientX,se=V.touches[1].clientY-V.touches[0].clientY;X.current=Math.sqrt(Z*Z+se*se),Q.current=ue.current,K.current={x:(V.touches[0].clientX+V.touches[1].clientX)/2,y:(V.touches[0].clientY+V.touches[1].clientY)/2}}},j=V=>{if(V.preventDefault(),V.touches.length===1&&ne.current){const Z=V.touches[0],se=Z.clientX-ne.current.x,le=Z.clientY-ne.current.y;if(!ce.current&&(Math.abs(se)>10||Math.abs(le)>10)&&(ce.current=!0,clearTimeout(k.current)),ce.current)if(B.current==="mouse"){const me=T(se,le),re=ft.current||{nx:.5,ny:.5},xe=Math.max(0,Math.min(1,re.nx+me.dnx)),ye=Math.max(0,Math.min(1,re.ny+me.dny));ft.current={nx:xe,ny:ye},Cr({nx:xe,ny:ye}),g(`Cursor: ${Math.round(xe*100)}%, ${Math.round(ye*100)}%`),q(xe,ye,ue.current);const Xe=Date.now();Xe-F.current>=30&&(F.current=Xe,$.current("input_mouseMoved",{nx:xe,ny:ye}).catch(()=>{}))}else if(ue.current>1){const me=a.current;if(me){const re=me.clientWidth,xe=me.clientHeight,ye=de.current+se/re*100,Xe=pe.current+le/xe*100,rt=Nt(ye,Xe,ue.current);R(rt.x),A(rt.y),de.current=rt.x,pe.current=rt.y}}else{const me=ae(Z);if(me){const re=Date.now();re-F.current>=40&&(F.current=re,g("Scroll"),$.current("input_wheel",{nx:me.nx,ny:me.ny,deltaX:Math.round(-se*2.5),deltaY:Math.round(-le*2.5)}).catch(()=>{}))}}ne.current={x:Z.clientX,y:Z.clientY}}else if(V.touches.length===2&&X.current!==null){const Z=V.touches[1].clientX-V.touches[0].clientX,se=V.touches[1].clientY-V.touches[0].clientY,me=Math.sqrt(Z*Z+se*se)/X.current,re=(V.touches[0].clientX+V.touches[1].clientX)/2,xe=(V.touches[0].clientY+V.touches[1].clientY)/2,ye=re-K.current.x,Xe=xe-K.current.y,rt=Math.abs(me-1)>.03;if(B.current==="mouse"){if(rt){const Ut=Math.max(.5,Math.min(5,Q.current*me));D(Ut),ue.current=Ut}else if(Math.abs(ye)>2||Math.abs(Xe)>2){const Ut=ft.current||{nx:.5,ny:.5},At=Date.now();At-F.current>=30&&(F.current=At,g("Scroll"),$.current("input_wheel",{nx:Ut.nx,ny:Ut.ny,deltaX:Math.round(-ye*3),deltaY:Math.round(-Xe*3)}).catch(()=>{}))}}else{const Ut=Math.max(.5,Math.min(5,Q.current*me));D(Ut),ue.current=Ut;const At=a.current;if(At&&Ut>1){const Xa=At.clientWidth,$o=At.clientHeight,Ga=de.current+ye/Xa*100,Ho=pe.current+Xe/$o*100,bi=Nt(Ga,Ho,Ut);R(bi.x),A(bi.y),de.current=bi.x,pe.current=bi.y}}K.current={x:re,y:xe}}},U=V=>{var Z;if(clearTimeout(k.current),X.current=null,V.touches.length===0&&V.changedTouches.length===1&&!ce.current){const se=V.changedTouches[0],le=Date.now();if(le-(((Z=S.current)==null?void 0:Z.time)||0)<40)return;if(B.current==="mouse"){const re=ft.current||ae(se);re&&(g(`Click: ${Math.round(re.nx*100)}%, ${Math.round(re.ny*100)}%`),$.current("input_click",{...re}).catch(()=>{}))}else{const re=ae(se);if(!re)return;le-ge.current<300?(g("Double tap"),$.current("input_click",{...re,clickCount:2}).catch(()=>{}),ge.current=0):(g(`Tap: ${Math.round(re.nx*100)}%, ${Math.round(re.ny*100)}%`),$.current("input_click",{...re}).catch(()=>{}),ge.current=le)}}ce.current=!1};return ee.addEventListener("touchstart",O,{passive:!1}),ee.addEventListener("touchmove",j,{passive:!1}),ee.addEventListener("touchend",U,{passive:!1}),()=>{ee.removeEventListener("touchstart",O),ee.removeEventListener("touchmove",j),ee.removeEventListener("touchend",U),clearTimeout(k.current)}},[]),p.jsxs("div",{ref:l,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:Or,onContextMenu:ee=>ee.preventDefault(),onFocus:()=>v(!0),onBlur:()=>v(!1),tabIndex:0,children:[p.jsxs("div",{ref:a,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[Ie?p.jsx("img",{ref:c,src:Ie,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${N}) translate(${I}%, ${W}%)`,transformOrigin:"center center",cursor:z==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:kr,onContextMenu:ee=>ee.preventDefault(),onDragStart:ee=>ee.preventDefault()}):p.jsxs("div",{className:"text-slate-800 text-center",children:[p.jsx("div",{className:"text-5xl mb-3",children:"🌑"}),p.jsx("div",{className:"text-[13px] font-semibold",children:"Connecting to Host..."})]}),z==="mouse"&&hr&&Ie&&c.current&&(()=>{var Xe;const ee=c.current,ae=ee.getBoundingClientRect(),T=(Xe=a.current)==null?void 0:Xe.getBoundingClientRect();if(!T)return null;const q=ee.naturalWidth||ae.width,O=ee.naturalHeight||ae.height,j=q/O,U=ae.width/ae.height;let V,Z,se,le;j>U?(V=ae.width,Z=ae.width/j,se=0,le=(ae.height-Z)/2):(Z=ae.height,V=ae.height*j,se=(ae.width-V)/2,le=0);const me=ae.left-T.left+se+V*hr.nx,re=ae.top-T.top+le+Z*hr.ny,xe=Math.max(8,Math.min(T.width-8,me)),ye=Math.max(8,Math.min(T.height-8,re));return p.jsxs("div",{style:{position:"absolute",left:xe-8,top:ye-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:ee=>ee.stopPropagation(),className:"absolute bottom-0 left-0 right-0 z-[1000] flex items-center justify-center gap-1.5 px-3 py-2 bg-black/75 backdrop-blur-xl border-t border-white/[0.08] touch-none",children:[p.jsxs("div",{onClick:()=>{J(ee=>{const ae=ee==="touch"?"mouse":"touch";if(ae==="mouse"&&!ft.current){const T={nx:.5,ny:.5};ft.current=T,Cr(T)}return ae})},className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${z==="mouse"?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:[p.jsx("span",{className:"text-sm",children:z==="mouse"?"🖱️":"👆"}),p.jsx("span",{className:`text-[10px] font-bold ${z==="mouse"?"text-blue-400":"text-slate-400"}`,children:z==="mouse"?"Mouse":"Touch"})]}),p.jsxs("div",{className:"relative",children:[p.jsx("div",{onClick:()=>{C(!P),E(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${P?"bg-emerald-500/25 border border-emerald-500/40":"bg-white/[0.08] border border-white/10"}`,children:p.jsx("span",{className:"text-sm",children:"⌨️"})}),P&&p.jsx("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 w-[220px] bg-neutral-950/[0.98] backdrop-blur-[30px] rounded-xl border border-white/20 p-[10px_12px] shadow-[0_10px_30px_rgba(0,0,0,0.8)] flex flex-col gap-2 z-[2000]",style:{animation:"slideUp 0.15s ease-out"},children:p.jsx("input",{type:"text",placeholder:"Type & Enter...",value:x,autoFocus:!0,onTouchStart:ee=>ee.stopPropagation(),onChange:ee=>_(ee.target.value),onKeyDown:mn,className:"w-full bg-black/60 border border-white/15 rounded-lg px-2.5 py-2 text-white text-[13px] outline-none"})})]}),p.jsx("div",{className:"relative",children:p.jsx("div",{onClick:()=>{E(!y),C(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${y?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:p.jsx("span",{className:"text-sm",children:"⚙️"})})}),p.jsx("div",{className:"w-px h-[18px] bg-white/10"}),p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 rounded-md",style:{background:Re?"rgba(16,185,129,0.12)":"rgba(251,191,36,0.12)"},children:[p.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:Re?"#10b981":"#fbbf24"}}),p.jsx("span",{className:"text-[8px] font-extrabold",style:{color:Re?"#10b981":"#fbbf24"},children:Re?"Connected":"WS"})]}),N>1&&p.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(N*100),"%"]}),m&&p.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:m})]})]}),y&&p.jsxs("div",{onTouchStart:ee=>ee.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: ",N===1?"FIT":`${Math.round(N*100)}%`]}),p.jsxs("div",{style:{display:"flex",gap:4},children:[p.jsx("button",{onClick:ee=>{ee.stopPropagation(),D(ae=>Math.max(.5,ae-.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:ee=>{ee.stopPropagation(),D(1),R(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:ee=>{ee.stopPropagation(),D(ae=>Math.min(5,ae+.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:ee=>{var q;ee.stopPropagation();const ae=((q=l.current)==null?void 0:q.clientWidth)||0,T=ae>0?Math.max(400,Math.ceil(ae/100)*100):void 0;r(T)},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:ee=>u(ee.target.checked)})]}),p.jsxs("select",{value:d,onChange:ee=>f(Number(ee.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 r=window.open();if(r){t
163
163
  from { opacity: 0; transform: translateY(6px); }
164
164
  to { opacity: 1; transform: translateY(0); }
165
165
  }
166
- `})]})}function g3({screenshotUrl:e,mode:t="preview",zoom:r=100,interactive:n=!1,connectionState:i,onDismiss:s,onClickAt:o,onKeyDown:l,badge:a,emptyMessage:c,aspectRatio:h,className:u,style:d}){const f=w.useRef(null),m=w.useCallback(g=>{if(!n||!o||!f.current)return;const x=f.current,_=x.getBoundingClientRect(),v=(g.clientX-_.left)/_.width*x.naturalWidth,y=(g.clientY-_.top)/_.height*x.naturalHeight;o(v,y,x.naturalWidth,x.naturalHeight)},[n,o]);return t==="preview"?e?p.jsxs("div",{className:`relative rounded-xl overflow-hidden border border-border-subtle bg-bg-secondary ${u||""}`,style:{aspectRatio:h||"16/9",...d},children:[p.jsx("img",{ref:f,src:e,alt:"IDE Screenshot",className:"w-full h-full object-cover"}),s&&p.jsx("button",{onClick:s,className:"absolute top-2.5 right-2.5 bg-black/50 border-none text-white w-5 h-5 rounded-full text-[10px] z-10 cursor-pointer flex items-center justify-center",children:"✕"})]}):null:e?p.jsxs("div",{className:`${n?"screenshot-interactive":""} ${u||""} relative h-full flex items-center justify-center overflow-auto`,tabIndex:n?0:void 0,onKeyDown:n?l:void 0,style:d,children:[p.jsx("img",{ref:f,src:e,alt:"IDE Screenshot",onClick:n?m:void 0,className:"max-w-full max-h-full object-contain",style:{...n?{cursor:"crosshair"}:{},...r!==100?{transform:`scale(${r/100})`,transformOrigin:"center center"}:{}}}),a&&p.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 bg-black/70 text-white px-3.5 py-1.5 rounded-[20px] text-xs font-semibold backdrop-blur-sm",children:a})]}):p.jsxs("div",{className:`flex items-center justify-center flex-col gap-2 h-full text-text-muted ${u||""}`,style:d,children:[p.jsx("p",{className:"text-base",children:c||"🖥 Waiting for screenshot stream..."}),i&&p.jsxs("p",{className:"text-[13px] mt-2 opacity-50",children:["P2P: ",i]})]})}function y1({activeConv:e,onModalButton:t}){const[r,n]=w.useState(null);if(w.useEffect(()=>{n(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=s=>{r||(n(s),t(s))};return p.jsxs("div",{className:"bg-gradient-to-br from-amber-600 to-amber-700 text-white py-2.5 px-4 shrink-0 z-[5]",children:[e.modalMessage&&p.jsx("div",{className:"text-[11px] opacity-85 mb-1.5 whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:e.modalMessage.replace(/[\n\r]+/g," ").slice(0,120)}),p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsxs("div",{className:"font-black text-xs flex items-center gap-2",children:[p.jsx("span",{children:"⚠️"})," ",r?"PROCESSING...":"ACTION REQUIRED"]}),p.jsx("div",{className:"flex gap-2 flex-wrap",children:e.modalButtons.map((s,o)=>{const l=s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),a=/^(run|approve|accept|yes|allow|always)/.test(l),c=/^(reject|deny|delete|remove|abort)/.test(l),h=r===s,u=r!==null;return p.jsx("button",{onClick:()=>i(s),disabled:u,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${a?"bg-white text-amber-700 font-extrabold":c?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${u&&!h?"opacity-40":"opacity-100"} ${u?"cursor-not-allowed":"cursor-pointer"}`,children:h?"⏳ ...":s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim()},o)})})]})]})}const gr=new Map;function _3({ideId:e,ideType:t,agentType:r,agentName:n,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var me;const{sendCommand:a}=Si(),c=!!(o||l),h=`${e}:${r}`,u=gr.get(h),[d,f]=w.useState(!1),[m,g]=w.useState(!1),[x,_]=w.useState((u==null?void 0:u.models)||[]),[v,y]=w.useState((u==null?void 0:u.modes)||[]),E=V=>V?typeof V=="string"?V:typeof V=="object"?V.name||V.id||JSON.stringify(V):String(V):"",[N,k]=w.useState(E(i)),[I,z]=w.useState(E(s)),[Z,T]=w.useState(!1),[R,A]=w.useState(!1),D=w.useRef(0),U=V=>V.map(H=>typeof H=="string"?H:(H==null?void 0:H.name)||(H==null?void 0:H.id)||String(H));w.useEffect(()=>{if(o){const V=o.find(H=>H.category==="model");if(V){const H=U(V.options.map(he=>he.value));_(H),V.currentValue&&k(E(V.currentValue));const G=gr.get(h)||{models:[],modes:[]};gr.set(h,{...G,models:H})}}if(l&&l.length>0){const V=U(l.map(G=>G.id));y(V);const H=gr.get(h)||{models:[],modes:[]};gr.set(h,{...H,modes:V})}else if(o){const V=o.find(H=>H.category!=="model");if(V){const H=U(V.options.map(he=>he.value));y(H),V.currentValue&&z(E(V.currentValue));const G=gr.get(h)||{models:[],modes:[]};gr.set(h,{...G,modes:H})}}},[o,l,h]),w.useEffect(()=>{f(!1),g(!1),k(E(i)),z(E(s));const V=gr.get(h);V?(_(V.models),y(V.modes)):(_([]),y([]))},[e,r]),w.useEffect(()=>{i&&Date.now()>D.current&&k(E(i))},[i]),w.useEffect(()=>{s&&Date.now()>D.current&&z(E(s))},[s]);const M=w.useCallback(async(V,H={})=>{const G={...H},he=e.split(":");return he.length>=3&&(he[1]==="ide"||he[1]==="cli"||he[1]==="acp")&&(G._targetInstance=he.slice(2).join(":"),G._targetType=he[1]),await a(e,V,G)},[e]),F=async()=>{var V,H;if(x.length>0){f(!d);return}if(c){f(!0);return}T(!0);try{const G=await M("list_extension_models",{agentType:r,ideType:t}),he=(G==null?void 0:G.models)||((V=G==null?void 0:G.result)==null?void 0:V.models)||[],ue=U(he);_(ue),G!=null&&G.current&&k(E(G.current)),(H=G==null?void 0:G.result)!=null&&H.current&&k(E(G.result.current));const ge=gr.get(h)||{models:[],modes:[]};gr.set(h,{...ge,models:ue}),f(!0)}catch{}finally{T(!1)}},W=async()=>{var V,H;if(v.length>0){g(!m);return}if(c){g(!0);return}A(!0);try{const G=await M("list_extension_modes",{agentType:r,ideType:t}),he=(G==null?void 0:G.modes)||((V=G==null?void 0:G.result)==null?void 0:V.modes)||[],ue=U(he);y(ue),G!=null&&G.current&&z(E(G.current)),(H=G==null?void 0:G.result)!=null&&H.current&&z(E(G.result.current));const ge=gr.get(h)||{models:[],modes:[]};gr.set(h,{...ge,modes:ue}),g(!0)}catch{}finally{A(!1)}},L=async V=>{f(!1),k(V),D.current=Date.now()+5e3;try{c?await M("change_model",{agentType:r,ideType:t,model:V}):await M("set_extension_model",{agentType:r,ideType:t,model:V})}catch{}},$=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(V=>V.category!=="model")),S=$?(me=o==null?void 0:o.find(V=>V.category!=="model"))==null?void 0:me.configId:void 0,ne=async V=>{g(!1),z(V),D.current=Date.now()+5e3;try{c&&$&&S?await M("set_thought_level",{agentType:r,ideType:t,configId:S,value:V}):c?await M("set_mode",{agentType:r,ideType:t,mode:V}):await M("set_extension_mode",{agentType:r,ideType:t,mode:V})}catch{}},b={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[r]||"#94a3b8";return p.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 flex-wrap text-[10px] border-t border-border-subtle bg-[var(--surface-primary)]",children:[p.jsx("span",{className:"text-[9px] font-bold tracking-wide uppercase opacity-70",style:{color:b},children:n}),p.jsx("span",{className:"text-border-subtle text-[10px]",children:"│"}),p.jsxs("div",{className:"relative",children:[p.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:d?`${b}55`:"transparent",border:"1px solid",color:N?"var(--text-primary)":"var(--text-muted)"},onClick:F,children:[p.jsx("span",{className:"text-[9px] opacity-60",children:"🤖"}),Z?"...":N||"Model",p.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),d&&x.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>f(!1)}),p.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[p.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:"SELECT MODEL"}),x.map(V=>p.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:V===N?`${b}18`:"transparent",color:V===N?b:"var(--text-secondary)",fontWeight:V===N?600:400,borderLeft:V===N?`2px solid ${b}`:"2px solid transparent"},onMouseEnter:H=>{H.currentTarget.style.background=`${b}12`},onMouseLeave:H=>{H.currentTarget.style.background=V===N?`${b}18`:"transparent"},onClick:()=>L(V),children:V},V))]})]})]}),p.jsxs("div",{className:"relative",children:[p.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:m?`${b}55`:"transparent",border:"1px solid",color:I?"var(--text-primary)":"var(--text-muted)"},onClick:W,children:[p.jsx("span",{className:"text-[9px] opacity-60",children:$?"🧠":"⚡"}),R?"...":I||($?"Thinking":"Mode"),p.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),m&&v.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>g(!1)}),p.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[p.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:$?"SELECT THINKING LEVEL":"SELECT MODE"}),v.map(V=>p.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:V===I?`${b}18`:"transparent",color:V===I?b:"var(--text-secondary)",fontWeight:V===I?600:400,borderLeft:V===I?`2px solid ${b}`:"2px solid transparent"},onMouseEnter:H=>{H.currentTarget.style.background=`${b}12`},onMouseLeave:H=>{H.currentTarget.style.background=V===I?`${b}18`:"transparent"},onClick:()=>ne(V),children:V},V))]})]})]})]})}const ar=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),Dr=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function x1({activeConv:e,ides:t,agentInput:r,setAgentInput:n,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a}){const c=w.useRef(null),{sendCommand:h}=Si(),[u,d]=w.useState([]),[f,m]=w.useState(0),[g,x]=w.useState(!0),[_,v]=w.useState(!1),y=w.useRef("");e.tabKey!==y.current&&(y.current=e.tabKey,d([]),m(0),x(!0));const E=w.useCallback(async()=>{var I,z,Z,T,R;if(!(_||!g)){v(!0);try{const A=t.find(L=>L.id===e.ideId),D=(A==null?void 0:A.daemonId)||((I=e.ideId)==null?void 0:I.split(":")[0])||"";if(!D){x(!1);return}const U=e.ideType||e.agentType||"",M=(e.ideId||"").split(":"),F=M.length>=3?M.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:D,agentType:U,instanceId:F,offset:f});const W=await h(D,"chat_history",{agentType:U,offset:f,limit:30,instanceId:F});console.log("[ChatPane] got result:",{count:((z=W.messages)==null?void 0:z.length)||0,hasMore:W.hasMore}),((Z=W.messages)==null?void 0:Z.length)>0&&(d(L=>[...W.messages,...L]),m(L=>L+W.messages.length)),x(W.hasMore)}catch(A){console.warn("[ChatPane] Failed to load history:",A),!((T=A==null?void 0:A.message)!=null&&T.includes("P2P not available"))&&!((R=A==null?void 0:A.message)!=null&&R.includes("channel not open"))&&x(!1)}finally{v(!1)}}},[_,g,f,t,e]),N=w.useRef(0);w.useEffect(()=>{if(e.messages.length<10&&g&&!_&&u.length===0){const I=N.current;if(I>5)return;const Z=setTimeout(()=>{N.current=I+1,E()},I===0?0:2e3);return()=>clearTimeout(Z)}else u.length>0&&(N.current=0)},[e.tabKey,e.messages.length,g,_,u.length,E]);const k=(()=>{const I=e.messages.map((T,R)=>{const A=`${e.ideId}-${T.id??`i-${R}`}`;return{...T,receivedAt:T.receivedAt||l[A]||0}});if(u.length===0)return I;const z=new Set(I.map(T=>`${T.role}:${(T.content||"").slice(0,100)}`));return[...u.filter(T=>!z.has(`${T.role}:${(T.content||"").slice(0,100)}`)),...I]})();return p.jsxs(p.Fragment,{children:[p.jsx(Ty,{messages:k,actionLogs:a.filter(I=>I.ideId===e.tabKey).sort((I,z)=>I.timestamp-z.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",isCliMode:ar(e)||Dr(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:E,isLoadingMore:_,hasMoreHistory:g,emptyState:e.messages.length===0?e.status==="not_monitored"?p.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[p.jsx("div",{className:"text-3xl opacity-60",children:"🔌"}),p.jsx("div",{className:"text-[13px] opacity-50",children:"Agent not monitored"}),p.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Switching...":`📂 Open ${e.displayPrimary} Panel`}),p.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Click to switch monitoring to this agent"})]}):e.status==="panel_hidden"?p.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[p.jsx("div",{className:"text-3xl opacity-60",children:"👁️‍🗨️"}),p.jsx("div",{className:"text-[13px] opacity-50",children:"Panel is not visible in IDE"}),p.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Opening...":`📂 Open ${e.displayPrimary} Panel`}),p.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Open the agent sidebar in your IDE to start viewing messages"})]}):void 0:void 0}),!ar(e)&&(()=>{const I=t.find(z=>z.id===e.ideId);return p.jsx(_3,{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:(I==null?void 0:I.currentModel)||void 0,serverMode:(I==null?void 0:I.currentPlan)||void 0,acpConfigOptions:Dr(e)?I==null?void 0:I.acpConfigOptions:void 0,acpModes:Dr(e)?I==null?void 0:I.acpModes:void 0})})(),p.jsx("div",{className:"dashboard-input-area px-3 py-2.5 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:p.jsxs("div",{className:"flex gap-2.5 items-center",children:[p.jsx("div",{className:"flex-1 relative",children:p.jsx("input",{ref:c,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:I=>n(I.target.value),onPaste:I=>{const z=I.clipboardData.getData("text");z&&n(Z=>Z+z),I.preventDefault()},onKeyDown:I=>{if(I.key==="Enter"){if(I.nativeEvent.isComposing){I.preventDefault();return}I.preventDefault(),i()}},onBlur:()=>{window.innerWidth<768&&setTimeout(()=>{document.documentElement.scrollTop=0},100)},className:"w-full h-10 rounded-[20px] px-4 bg-bg-secondary border border-border-subtle text-sm text-text-primary"})}),p.jsx("button",{onClick:i,disabled:!r.trim(),className:`w-10 h-10 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${r.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:p.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:r.trim()?"text-white":"text-text-muted",children:p.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function v3({activeConv:e,ptyBuffers:t,terminalRef:r,agentInput:n,setAgentInput:i,handleSendChat:s,handleModalButton:o}){const l=w.useRef(null),{sendCommand:a,sendData:c}=Si();return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--surface-primary)] border-b border-border-subtle shrink-0",children:[p.jsx("div",{className:"flex gap-1",children:p.jsx("div",{className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-accent text-white",children:"⬛ Terminal"})}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"text-[10px] text-text-muted",children:[e.agentName," — Terminal"]}),p.jsx("button",{onClick:()=>{if(!r.current||!e)return;const h=t.current.get(e.tabKey);if(h&&h.length>0)for(const u of h)r.current.write(u);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var u;(u=r.current)==null||u.bumpResize()})})},title:"Refresh terminal (replay buffer + TUI redraw)",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-bg-secondary text-text-secondary border border-border-subtle cursor-pointer leading-none",children:"↺"}),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",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-red-500/[0.08] text-red-400 border border-red-500/30 cursor-pointer leading-none font-semibold",children:"■ Stop"})]})]}),p.jsx(y1,{activeConv:e,onModalButton:o}),p.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:p.jsx(v1,{ref:r,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 m;const d=e.ideId||e.daemonId||"",f=(m=e.ideId)!=null&&m.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",{className:"px-3 py-2 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:p.jsxs("div",{className:"flex gap-2.5 items-center",children:[p.jsx("div",{className:"flex-1 relative",children:p.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:n,onChange:h=>i(h.target.value),onPaste:h=>{const u=h.clipboardData.getData("text");u&&i(d=>d+u),h.preventDefault()},onKeyDown:h=>{if(h.key==="Enter"){if(h.nativeEvent.isComposing){h.preventDefault();return}h.preventDefault(),s()}},className:"w-full h-9 rounded-[18px] px-4 bg-bg-secondary border border-border-subtle text-[13px] text-text-primary"})}),p.jsx("button",{onClick:s,disabled:!n.trim(),className:`w-9 h-9 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${n.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:n.trim()?"text-white":"text-text-muted",children:p.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function y3({wsStatus:e,showReconnected:t,loginUrl:r}){const n=e==="disconnected"||e==="reconnecting"||e==="offline"||e==="auth_failed",i=e==="auth_failed"?"red":e==="offline"?"orange":"violet",s={red:"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))",orange:"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))",violet:"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))"},o={red:"1px solid rgba(239,68,68,0.2)",orange:"1px solid rgba(255,107,53,0.2)",violet:"1px solid rgba(139,92,246,0.2)"},l={red:"#ef4444",orange:"#ff6b35",violet:"#a78bfa"};return p.jsxs(p.Fragment,{children:[n&&p.jsxs("div",{className:"py-2.5 px-5 text-[13px] font-semibold flex items-center gap-2.5 justify-center",style:{background:s[i],borderBottom:o[i],color:l[i]},children:[p.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-5 h-5",style:{opacity:e==="auth_failed"?.6:1,animation:e==="auth_failed"?void 0:"pulse 2s ease-in-out infinite",filter:e==="auth_failed"?"grayscale(1)":void 0}}),e==="offline"&&"Network offline — waiting for connection...",e==="disconnected"&&"Reconnecting to server...",e==="reconnecting"&&"Reconnecting to server...",e==="auth_failed"&&(r?p.jsxs(p.Fragment,{children:["Session expired."," ",p.jsx("a",{href:r,className:"text-inherit underline",children:"Log in again"})]}):"Connection failed — please restart the server.")]}),t&&e==="connected"&&p.jsxs("div",{className:"py-2 px-4 text-xs font-semibold flex items-center gap-2 justify-center bg-gradient-to-r from-green-500/[0.12] to-green-500/[0.04] text-green-400 border-b border-green-500/15 animate-[fadeIn_0.3s_ease]",children:[p.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-4 h-4"}),"Connected"]})]})}const ru=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),nu=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function x3({activeConv:e,agentCount:t,wsStatus:r,isP2PActive:n,onOpenHistory:i}){const s=cs(),o=n?"#22c55e":r==="connected"?"#eab308":"#ef4444",l=n?"0 0 4px #22c55e80":r==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480";return p.jsxs("div",{className:"dashboard-header",children:[p.jsx("div",{className:"flex items-center gap-3",children:p.jsxs("div",{className:"leading-tight",children:[p.jsxs("h1",{className:"header-title m-0",children:["💬 Dashboard",p.jsxs("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:[t," Active",p.jsx("span",{className:"inline-block w-[5px] h-[5px] rounded-full ml-1 align-middle",style:{background:o}})]})]}),p.jsxs("div",{className:"header-subtitle text-[11px] items-center gap-1",children:[t," agent",t!==1?"s":""," active",p.jsx("span",{title:n?"P2P Direct":r==="connected"?"WebSocket":"Disconnected",className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{background:o,boxShadow:l}})]})]})}),p.jsxs("div",{className:"flex gap-2 items-center",children:[e&&!ru(e)&&!nu(e)&&p.jsx("button",{onClick:()=>s(`/ide/${e.ideId}`),className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs",children:"IDE"}),e&&!ru(e)&&!nu(e)&&p.jsx("button",{onClick:i,className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5 flex items-center gap-1",title:"Chat History",children:"📜"}),e&&!ru(e)&&!nu(e)&&p.jsx("button",{onClick:()=>s(`/ide/${e.ideId}?view=remote`),className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5",title:"Remote Control",children:"🖥️"})]})]})}function Ur(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function S3(e){if(e<60)return`${Math.round(e)}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const r=Math.floor(t/60),n=t%60;if(r<24)return n>0?`${r}h ${n}m`:`${r}h`;const i=Math.floor(r/24),s=r%24;return`${i}d ${s}h`}function Ag(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Bg(e){return(e.id||"").includes(":cli:")}function Yh(e,t){return Ur(e)}function w3(e){if(!Array.isArray(e)||e.length<=1)return e;const t=new Map,r=["generating","streaming","active","connected","idle","panel_hidden"];for(const n of e){const i=(n.name||n.id||"").toLowerCase().replace(/\s+/g,"-"),s=t.get(i);if(!s){t.set(i,n);continue}const o=r.indexOf(s.status||"idle"),l=r.indexOf(n.status||"idle");l>=0&&(o<0||l<o)&&t.set(i,n)}return Array.from(t.values())}function b3({activeConv:e,ides:t,isCreatingChat:r,isRefreshingHistory:n,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",{className:"fixed inset-0 z-[1000] flex items-center justify-center",children:[p.jsx("div",{onClick:i,className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),p.jsxs("div",{className:"card fade-in relative w-[90%] max-w-[500px] max-h-[80vh] flex flex-col p-0 overflow-hidden shadow-[0_20px_40px_rgba(0,0,0,0.4)] rounded-[20px]",children:[p.jsxs("div",{className:"px-6 py-5 border-b border-border-subtle flex justify-between items-center bg-[var(--surface-primary)]",children:[p.jsxs("div",{children:[p.jsx("h3",{className:"m-0 text-lg font-extrabold",children:"Chat History"}),p.jsxs("div",{className:"text-xs text-text-muted mt-0.5",children:[e.displayPrimary," — ",Ur(e.ideType)]})]}),p.jsx("button",{onClick:i,className:"bg-transparent border-none text-xl text-text-muted cursor-pointer",children:"✕"})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-3 bg-bg-primary",children:[p.jsx("button",{onClick:s,disabled:r,className:"w-full p-3.5 rounded-xl mb-3 bg-indigo-500/10 border border-dashed border-accent text-accent font-bold text-sm cursor-pointer",children:r?"⌛ Creating...":"+ Start New Chat Session"}),c.map(d=>p.jsxs("div",{onClick:()=>{o(e.ideId,d.id),i()},className:`p-4 rounded-xl mb-2 cursor-pointer border transition-all ${h===d.id?"bg-[var(--bg-glass-hover)] border-accent":"bg-[var(--surface-secondary)] border-border-subtle"}`,children:[p.jsx("div",{className:`font-bold text-sm mb-1 ${h===d.id?"text-[var(--accent-primary-light)]":"text-text-primary"}`,children:d.title||"Untitled Session"}),p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsxs("div",{className:"text-[11px] text-text-muted font-mono",children:[d.id.substring(0,12),"..."]}),h===d.id&&p.jsx("span",{className:"text-[10px] bg-accent text-white px-2 py-0.5 rounded-[10px] font-extrabold",children:"ACTIVE"})]})]},d.id)),c.length===0&&p.jsxs("div",{className:"py-10 px-5 text-center text-text-muted",children:[p.jsx("div",{className:"text-3xl mb-3",children:"🕯️"}),p.jsx("div",{className:"text-[13px]",children:"No recent chat sessions found."})]})]}),p.jsx("div",{className:"px-5 py-4 bg-[var(--surface-tertiary)] border-t border-border-subtle text-right",children:p.jsx("button",{onClick:l,disabled:n,className:"btn btn-secondary btn-sm rounded-[10px]",children:n?"⌛ Refreshing...":"🔄 Refresh History"})})]})]})}function k3({sortedConversations:e,activeTabId:t,tabsOverflow:r,tabsContainerRef:n,terminalRef:i,onSelectTab:s,onReorder:o,pinTab:l,clearTabPinTimers:a,retryP2P:c}){const{sendCommand:h}=Si(),u=w.useRef(null),d=w.useRef(null),f=w.useRef(null),m=w.useRef(null),[g,x]=w.useState(!1),_=w.useCallback((R,A)=>{const D=A.touches[0];f.current={x:D.clientX,y:D.clientY},d.current=R,m.current=setTimeout(()=>{x(!0)},400)},[]),v=w.useCallback(R=>{if(!g||!d.current){m.current&&(clearTimeout(m.current),m.current=null);return}R.preventDefault();const A=R.touches[0],D=n.current;if(!D)return;const U=Array.from(D.querySelectorAll("[data-tabkey]"));for(const M of U){const F=M.getBoundingClientRect();if(A.clientX>=F.left&&A.clientX<=F.right){const W=M.getAttribute("data-tabkey");if(W&&W!==d.current){const L=e.map(ne=>ne.tabKey),$=L.indexOf(d.current),S=L.indexOf(W);if($!==-1&&S!==-1){const ne=[...L];ne.splice($,1),ne.splice(S,0,d.current),o(ne)}}break}}},[g,e,n,o]),y=w.useCallback(()=>{m.current&&(clearTimeout(m.current),m.current=null),x(!1),d.current=null,f.current=null},[]),E=()=>{const R=n.current;R&&R.scrollBy({left:-150,behavior:"smooth"})},N=()=>{const R=n.current;R&&R.scrollBy({left:150,behavior:"smooth"})},[k,I]=w.useState(!1),[z,Z]=w.useState(!1),T=w.useCallback(()=>{const R=n.current;R&&(I(R.scrollLeft>4),Z(R.scrollLeft+R.clientWidth<R.scrollWidth-4))},[n]);return w.useEffect(()=>{const R=n.current;if(!R)return;T(),R.addEventListener("scroll",T,{passive:!0});const A=new ResizeObserver(T);return A.observe(R),()=>{R.removeEventListener("scroll",T),A.disconnect()}},[n,T,e.length]),p.jsxs("div",{className:"relative shrink-0",children:[r&&p.jsx("button",{onClick:E,className:"absolute left-0 top-0 bottom-0 z-[5] w-8 border-none text-text-muted text-xs flex items-center justify-center transition-opacity duration-150",style:{background:"linear-gradient(to right, var(--bg-secondary) 60%, transparent)",cursor:k?"pointer":"default",opacity:k?.7:0,pointerEvents:k?"auto":"none"},onMouseEnter:R=>{k&&(R.currentTarget.style.opacity="1")},onMouseLeave:R=>{R.currentTarget.style.opacity=k?"0.7":"0"},children:"◀"}),r&&p.jsx("button",{onClick:N,className:"absolute right-0 top-0 bottom-0 z-[5] w-8 border-none text-text-muted text-xs flex items-center justify-center transition-opacity duration-150",style:{background:"linear-gradient(to left, var(--bg-secondary) 60%, transparent)",cursor:z?"pointer":"default",opacity:z?.7:0,pointerEvents:z?"auto":"none"},onMouseEnter:R=>{z&&(R.currentTarget.style.opacity="1")},onMouseLeave:R=>{R.currentTarget.style.opacity=z?"0.7":"0"},children:"▶"}),p.jsxs("div",{ref:n,className:"dashboard-agent-tabs flex overflow-x-auto overflow-y-visible shrink-0 bg-bg-secondary border-b border-border-subtle pt-1.5 pb-0 gap-1 select-none",onWheel:R=>{const A=n.current;A&&Math.abs(R.deltaY)>Math.abs(R.deltaX)&&(R.preventDefault(),A.scrollLeft+=R.deltaY)},style:{paddingLeft:r?36:8,paddingRight:r?36:8,scrollbarWidth:"none",WebkitOverflowScrolling:"touch"},children:[e.map((R,A)=>{const D=t===R.tabKey,U=R.status==="working"?"agent-tab-working":R.status==="waiting_approval"?"agent-tab-waiting":"",M=A<9?String(A+1):null,F=R.p2pState==="gave_up";return p.jsxs("div",{"data-tabkey":R.tabKey,className:`${U} shrink-0 px-2.5 py-1.5 rounded-t-lg border-b-0 cursor-grab flex items-center gap-2 transition-all duration-200`,draggable:!0,onDragStart:()=>{u.current=R.tabKey},onDragOver:W=>{W.preventDefault(),W.currentTarget.style.borderLeft="2px solid var(--accent-primary)"},onDragLeave:W=>{W.currentTarget.style.borderLeft=D?"1px solid var(--border-subtle)":"1px solid transparent"},onDrop:W=>{if(W.preventDefault(),W.currentTarget.style.borderLeft=D?"1px solid var(--border-subtle)":"1px solid transparent",!u.current||u.current===R.tabKey)return;const L=e.map(oe=>oe.tabKey),$=L.indexOf(u.current),S=L.indexOf(R.tabKey);if($===-1||S===-1)return;const ne=[...L];ne.splice($,1),ne.splice(S,0,u.current),o(ne),u.current=null},onDragEnd:()=>{u.current=null},onTouchStart:W=>_(R.tabKey,W),onTouchMove:v,onTouchEnd:y,onClick:()=>{a(),s(R.tabKey),R.streamSource==="agent-stream"&&R.agentType&&(h(R.ideId,"agent_stream_focus",{agentType:R.agentType}).catch(()=>{}),l(R.tabKey,[200,1500])),ar(R)&&setTimeout(()=>{var W,L;(L=(W=i.current)==null?void 0:W.bumpResize)==null||L.call(W)},100)},style:{background:D?"var(--bg-primary)":"rgba(255,255,255,0.03)",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",opacity:g&&d.current===R.tabKey?F?.15:.3:F?D?.6:.3:D?1:.5},children:[R.status==="working"?p.jsx("div",{className:"tab-spinner"}):R.status==="waiting_approval"?p.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400",children:"▲"}):R.p2pState==="gave_up"?p.jsx("span",{onClick:W=>{var $;W.stopPropagation();const L=R.daemonId||(($=R.ideId)==null?void 0:$.split(":")[0])||"";c==null||c(L)},title:"P2P disconnected — click to reconnect",className:"text-[8px] px-[5px] py-px text-yellow-400 cursor-pointer",children:"●"}):R.p2pState==="connecting"?p.jsx("span",{className:"text-[8px] px-[5px] py-px text-blue-400",children:"○"}):R.p2pState==="connected"?p.jsx("span",{className:"text-[8px] px-[5px] py-px text-green-400",children:"●"}):p.jsx("span",{className:"text-[8px] px-[5px] py-px text-text-muted",children:"●"}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-xs font-bold whitespace-nowrap overflow-hidden text-ellipsis",children:R.displayPrimary}),p.jsxs("div",{className:"text-[8px] opacity-50 flex gap-1 items-center",children:[R.displaySecondary,R.machineName&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"opacity-40",children:"·"}),p.jsxs("span",{className:"opacity-70",children:["🖥 ",R.machineName]})]})]})]}),M&&p.jsx("span",{className:"text-[9px] opacity-35 font-mono ml-0.5 shrink-0",children:M})]},R.tabKey)}),e.length===0&&p.jsx("div",{className:"p-2 text-xs opacity-40",children:"No active agents online."})]})]})}const Og={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function C3({toasts:e,onDismiss:t,onClickToast:r}){return p.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:e.map(n=>p.jsx("div",{className:"fade-in text-white px-5 py-3 rounded-xl text-[13px] font-semibold shadow-[0_8px_32px_rgba(0,0,0,0.3)] backdrop-blur-lg pointer-events-auto cursor-pointer animate-[toast-in_0.3s_ease-out] max-w-[360px]",style:{background:Og[n.type]||Og.info},onClick:()=>{r&&r(n),t(n.id)},children:n.message},n.id))})}const E3=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function T3(e){var n;const t=(n=e.workspaceFolders)==null?void 0:n[0];return t!=null&&t.name?t.name:((t==null?void 0:t.path)??"").split("/").filter(Boolean).pop()||"Workspace"}function N3(e,t,r,n){var s;const i={};if(r)for(const o of r){const l=o;if(l.type==="adhdev-daemon"||l.daemonMode){const a=l.machine||{},c=l.machineNickname,h=a.hostname||((s=l.system)==null?void 0:s.hostname)||"",u=c||(h&&h!=="Unknown"?h.replace(/\.local$/,""):null)||`Machine ${(l.id||"").substring(0,6)}`;i[l.id]=u}}return e.flatMap(o=>{var x,_,v,y,E;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((x=o.id)==null?void 0:x.split(":")[0])||o.id,h=n?n[c]||"new":void 0,u=T3(o),d=Ur(o.type),f=o.agentStreams,m=Array.isArray(f)?f:[],g=E3(o);if(g){const N=Yh(o.type),k=(_=o.agents)==null?void 0:_[0],I=(v=o.activeChat)==null?void 0:v.activeModal,z=I&&Array.isArray(I.buttons)&&I.buttons.length>0,Z=(y=o.activeChat)==null?void 0:y.status,T=Z==="generating"||Z==="loading"||Z&&Z.toLowerCase()==="thinking",A=z||Z==="waiting_approval"?"waiting_approval":T?"working":(k==null?void 0:k.status)||"idle",D=o.activeChat||{title:"",messages:[]};let U=D.title&&String(D.title).trim()?String(D.title).trim():"";const M=(E=o.activeChat)==null?void 0:E.id,F=o.chats;if(M&&Array.isArray(F)&&F.length>0){const ne=F.find(oe=>oe.id===M||oe.id&&String(oe.id)===String(M));ne!=null&&ne.title&&String(ne.title).trim()&&(U=String(ne.title).trim())}const W=D.messages||[],L=t[o.id]||[],$=new Map;W.filter(ne=>ne.role==="user").forEach(ne=>{$.set(ne.content,($.get(ne.content)||0)+1)});const S=L.filter(ne=>{const oe=$.get(ne.content)||0;return oe>0?($.set(ne.content,oe-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:N,agentType:ar(o)||Dr(o)?o.type:(k==null?void 0:k.type)||"ide-native",status:A,title:U,messages:[...W,...S],ideType:o.type,workspaceName:u,displayPrimary:U||N||u,displaySecondary:d,cdpconnected:o.cdpconnected,modalButtons:z?I.buttons:void 0,modalMessage:z?I.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,p2pState:h})}if(g&&(ar(o)||Dr(o)))return l;for(const N of m){const k=N.activeModal&&Array.isArray(N.activeModal.buttons)&&N.activeModal.buttons.length>0,I=k?"waiting_approval":N.status==="streaming"?"working":N.status,z=`${o.id}:${N.agentType}`,Z=N.messages||[],T=t[z]||[],R=new Map;Z.filter(D=>D.role==="user").forEach(D=>{R.set(D.content,(R.get(D.content)||0)+1)});const A=T.filter(D=>{const U=R.get(D.content)||0;return U>0?(R.set(D.content,U-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:N.agentName,agentType:N.agentType,status:I,title:"",messages:[...Z,...A],ideType:o.type,workspaceName:u,displayPrimary:N.agentName,displaySecondary:d,cdpconnected:o.cdpconnected,modalButtons:k?N.activeModal.buttons:void 0,modalMessage:k?N.activeModal.message:void 0,streamSource:"agent-stream",tabKey:z,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 P3=y0;function wf(){return P3()}class L3{constructor(){ps(this,"listeners",new Map)}send(t){}isConnected(){return!1}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>{var n;(n=this.listeners.get(t))==null||n.delete(r)}}emit(t,...r){var n;(n=this.listeners.get(t))==null||n.forEach(i=>i(...r))}}let R3=new L3;class D3{constructor(){ps(this,"ptyCallbacks",new Set)}sendPtyInput(t,r,n){return!1}sendPtyResize(t,r,n,i){return!1}async requestChatHistory(t,r,n,i,s){return{messages:[],hasMore:!1}}retryConnection(t){}getState(t){return"disconnected"}sendData(t,r){return!1}get(t){}onScreenshot(t,r){return()=>{}}onStatusEvent(t){return()=>{}}onPtyOutput(t){return this.ptyCallbacks.add(t),()=>{this.ptyCallbacks.delete(t)}}emitPtyOutput(t,r){this.ptyCallbacks.forEach(n=>n(t,r))}}let ti=new D3,jg=ti;function M3(){const{sendCommand:e}=Si(),t=wf(),{updateIdeChats:r,screenshotMap:n,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,m]=w.useState(()=>{try{const j=new URLSearchParams(window.location.search).get("activeTab");return j||sessionStorage.getItem("adhdev_dashboard_activeTab")}catch{return null}}),g=w.useCallback(B=>{m(B);try{B?sessionStorage.setItem("adhdev_dashboard_activeTab",B):sessionStorage.removeItem("adhdev_dashboard_activeTab")}catch{}},[]),x=w.useRef([]),[_,v]=w.useState(""),[y,E]=w.useState({}),[N,k]=w.useState(!1),[I,z]=w.useState(!1),[Z,T]=w.useState(!1),[R,A]=w.useState([]),[D,U]=w.useState({}),[M,F]=w.useState({}),W=w.useRef(null),L=w.useRef(null),$=w.useRef(null),[S,ne]=w.useState(!1),oe=s.find(B=>B.type==="adhdev-daemon"),b=(oe==null?void 0:oe.detectedIdes)||[],me=!!oe,V=w.useMemo(()=>{var K,Y;const B=s.filter(ee=>ee.type!=="adhdev-daemon"),j=new Map;for(const ee of B){const se=j.get(ee.id);if(!se)j.set(ee.id,ee);else{const le=(((K=se.workspaceFolders)==null?void 0:K.length)||0)+(se.activeChat?1:0);((((Y=ee.workspaceFolders)==null?void 0:Y.length)||0)+(ee.activeChat?1:0)>le||(ee.timestamp||0)>(se.timestamp||0))&&j.set(ee.id,ee)}}return Array.from(j.values())},[s]),H=w.useMemo(()=>{const B=N3(V,D,s,h),j=Date.now();return B.map(K=>{const Y=M[K.tabKey];return Y&&j-Y<5e3?{...K,messages:[],title:""}:K})},[V,D,M,s]),[G,he]=w.useState(()=>{try{return JSON.parse(sessionStorage.getItem("adhdev_tabOrder")||"[]")}catch{return[]}}),ue=w.useMemo(()=>{if(G.length===0)return H;const B=new Map(G.map((j,K)=>[j,K]));return[...H].sort((j,K)=>{const Y=B.get(j.tabKey)??9999,ee=B.get(K.tabKey)??9999;return Y-ee})},[H,G]);w.useEffect(()=>{const B=$.current;if(!B)return;const j=()=>ne(B.scrollWidth>B.clientWidth+2);j();const K=new ResizeObserver(j);return K.observe(B),B.addEventListener("scroll",j),()=>{K.disconnect(),B.removeEventListener("scroll",j)}},[ue.length]);const ge=w.useCallback(B=>{he(B);try{sessionStorage.setItem("adhdev_tabOrder",JSON.stringify(B))}catch{}},[]);w.useEffect(()=>{if(Object.keys(M).length===0)return;const j=setTimeout(()=>{F(K=>{const Y=Date.now(),ee={};for(const[se,le]of Object.entries(K))Y-le<5e3&&(ee[se]=le);return Object.keys(ee).length===Object.keys(K).length?K:ee})},5500);return()=>clearTimeout(j)},[M]);const O=ue.find(B=>B.tabKey===f),Ue=ue.map(B=>B.tabKey).join(","),ve=w.useRef(!1);w.useEffect(()=>{if(ue.length===0||ve.current&&f&&ue.some(j=>j.tabKey===f))return;const B=ue.find(j=>j.cdpconnected===!0);B?g(B.tabKey):(!f||!ue.some(j=>j.tabKey===f))&&g(ue[0].tabKey)},[Ue]);const Ke=w.useCallback(()=>{x.current.forEach(B=>clearTimeout(B)),x.current=[]},[]),Ot=w.useCallback((B,j)=>{Ke();for(const K of j)x.current.push(setTimeout(()=>g(B),K))},[Ke]);w.useEffect(()=>{var K;if(!((K=O==null?void 0:O.messages)!=null&&K.length))return;const B=O.ideId,j=Date.now();E(Y=>{let ee=!1;const se={...Y};return O.messages.forEach((le,fe)=>{const ae=`${B}-${le.id??`i-${fe}`}`;se[ae]==null&&(se[ae]=j,ee=!0)}),ee?se:Y})},[O==null?void 0:O.ideId,O==null?void 0:O.messages]);const qt=w.useRef(!1);w.useEffect(()=>{if(!N){qt.current=!1;return}if(!O||qt.current||I)return;const B=s.find(j=>j.id===O.ideId);B&&(!B.chats||B.chats.length===0)&&(qt.current=!0,X())},[N,O==null?void 0:O.ideId]),w.useEffect(()=>{const B=setInterval(()=>{const j=Date.now()-3e5;A(K=>{const Y=K.filter(ee=>ee.timestamp>j).slice(-100);return Y.length===K.length?K:Y})},6e4);return()=>clearInterval(B)},[]);const De=w.useRef(new Map);w.useEffect(()=>{const B=(K,Y)=>{var fe,ae,xe;if(!Y)return;for(const we of H){if(!ar(we))continue;const nt=(fe=we.ideId)!=null&&fe.includes(":cli:")?we.ideId.split(":cli:")[1]:"";if(K===nt||K===we.agentType||K===we.ideType){const jt=De.current.get(we.tabKey)||[];jt.push(Y),jt.length>1e4&&jt.splice(0,jt.length-5e3),De.current.set(we.tabKey,jt)}}const ee=O&&ar(O),se=(ae=O==null?void 0:O.ideId)!=null&&ae.includes(":cli:")?O.ideId.split(":cli:")[1]:"",le=K===se||K===(O==null?void 0:O.agentType)||K===(O==null?void 0:O.ideType);ee&&le&&((xe=W.current)==null||xe.write(Y))},j=jg.onPtyOutput(B);return()=>{j()}},[O==null?void 0:O.agentType,O==null?void 0:O.ideType,O==null?void 0:O.tabKey,H]),w.useEffect(()=>{if(!O||!ar(O))return;const j=setTimeout(()=>{if(W.current){const K=De.current.get(O.tabKey);if(K&&K.length>0)for(const Y of K)W.current.write(Y);W.current.bumpResize()}},200);return()=>clearTimeout(j)},[O==null?void 0:O.tabKey]),w.useEffect(()=>{if(!O)return;const B=setTimeout(()=>{var j;(j=L.current)==null||j.focus()},150);return()=>clearTimeout(B)},[O==null?void 0:O.tabKey]),w.useEffect(()=>{const B=j=>{var le,fe,ae,xe,we,Ze;const K=parseInt(j.key);if(isNaN(K)||K<1||K>9)return;if(j.ctrlKey){j.preventDefault();const nt=ue[K-1];nt&&(Ke(),g(nt.tabKey));return}const Y=(le=document.activeElement)==null?void 0:le.tagName,ee=Y==="INPUT"||Y==="TEXTAREA"||((fe=document.activeElement)==null?void 0:fe.isContentEditable),se=((xe=(ae=document.activeElement)==null?void 0:ae.closest)==null?void 0:xe.call(ae,".xterm-helper-textarea"))!=null||((Ze=(we=document.activeElement)==null?void 0:we.classList)==null?void 0:Ze.contains("xterm-helper-textarea"));if(!ee&&!se){j.preventDefault();const nt=ue[K-1];nt&&(Ke(),g(nt.tabKey))}};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[ue,Ke,g]),w.useEffect(()=>{const B=R3.on("status_event",j=>{var se;const K=Ur(j.ideType||"");let Y="",ee="info";if(j.event==="agent:generating_completed"){const le=j.duration?` (${j.duration}s)`:"";Y=`✅ ${K} agent task completed${le}`,ee="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${le}`,_localId:`sys_complete_${Date.now()}`};U(ae=>{for(const xe of Object.keys(ae))if(xe.includes(j.ideId))return{...ae,[xe]:[...ae[xe]||[],fe]};return ae})}}else if(j.event==="agent:generating_started")j.ideId&&U(le=>{const fe={...le};for(const ae of Object.keys(fe))ae.includes(j.ideId)&&(fe[ae]=(fe[ae]||[]).filter(xe=>{var we;return!(xe.role==="system"&&((we=xe._localId)!=null&&we.startsWith("sys_complete_")))}));return fe});else if((j.event==="agent:waiting_approval"||j.event==="agent:approval_needed")&&(Y=`⚡ ${K} approval needed`,ee="warning",j.ideId)){const le=j.modalMessage||"Approval requested",fe=(se=j.modalButtons)!=null&&se.length?j.modalButtons.map(xe=>`[${xe}]`).join(" "):"[Approve] [Reject]",ae={role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${le}
168
- ${fe}`,_localId:`sys_approval_${Date.now()}`};U(xe=>{for(const we of Object.keys(xe))if(we.includes(j.ideId))return{...xe,[we]:[...xe[we]||[],ae]};return xe})}if(Y){const le=Date.now();l(fe=>[...fe.slice(-4),{id:le,message:Y,type:ee,timestamp:le,ideId:j.ideId}]),setTimeout(()=>l(fe=>fe.filter(ae=>ae.id!==le)),5e3)}});return()=>B()},[]),w.useEffect(()=>{var j;const B=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(ee=>console.error("[SW Action] approve failed:",ee))};return(j=navigator.serviceWorker)==null||j.addEventListener("message",B),()=>{var K;return(K=navigator.serviceWorker)==null?void 0:K.removeEventListener("message",B)}},[]);const ke=async()=>{if(!O)return;const B=_.trim();if(!B)return;const j=O.ideId,K=O.tabKey;v(""),Ot(K,[100,500,1500,3e3]);const Y=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,ee={role:"user",content:B,timestamp:Date.now(),_localId:Y};U(se=>({...se,[K]:[...se[K]||[],ee]}));try{if(ar(O)&&!Dr(O)){const se=j||O.daemonId||"";if(!se)return;const le=O.ideType||O.agentType||"";await e(se,"agent_command",{agentType:le,cliType:le,action:"send_chat",message:B,text:B})}else if(Dr(O)){const se=j||O.daemonId||"";if(!se)return;await e(se,"send_chat",{message:B,text:B,agentType:O.agentType})}else{const se=j||O.daemonId||"";if(!se)return;await e(se,"send_chat",{message:B,text:B,...O.streamSource==="agent-stream"&&{agentType:O.agentType}})}setTimeout(()=>{const se=Date.now()-6e4;U(le=>{const fe=le[K];if(!fe)return le;const ae=fe.filter(xe=>xe.timestamp>se);return ae.length===fe.length?le:{...le,[K]:ae}})},6e4)}catch(se){console.error("Send failed",se),v(B),U(le=>({...le,[K]:(le[K]||[]).filter(fe=>fe._localId!==Y)}))}},Or=async()=>{if(O)try{me?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(B){console.error("Relaunch failed",B)}},Zr=async B=>{try{await e("standalone","launch_ide",{ideType:B,enableCdp:!0})}catch(j){console.error("Launch failed",j)}},Pt=async B=>{if(O){console.log("[ModalButton] ideId:",O.ideId,"button:",B,"agentType:",O.agentType,"source:",O.streamSource),A(j=>[...j,{ideId:O.tabKey,text:`🖱️ **${B}** clicked`,timestamp:Date.now()}]);try{let j;if(ar(O)&&!Dr(O)){const Y=(O.modalButtons||[]).indexOf(B),ee=B.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase();let se;Y>=0?se=`${Y+1}\r`:/^(deny|no|reject|cancel)/.test(ee)?se="3\r":/always/.test(ee)?se="2\r":se="1\r";const le=O.daemonId||O.ideId,fe=O.ideType||O.agentType||"";jg.sendPtyInput(le,fe,se)||await e(le,"pty_input",{cliType:fe,data:se}),j={success:!0}}else{const K=B.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),Y=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(K),ee=O.ideId||O.daemonId||"";j=await e(ee,"resolve_action",{button:B,action:Y?"approve":"reject",...O.streamSource==="agent-stream"&&{agentType:O.agentType}})}console.log("[ModalButton] result:",j),j.success||A(K=>[...K,{ideId:O.tabKey,text:`⚠️ **${B}** failed — button not found`,timestamp:Date.now()}])}catch(j){console.error("[ModalButton] Error:",j),A(K=>[...K,{ideId:O.tabKey,text:`❌ **${B}** error`,timestamp:Date.now()}])}}},Yt=async(B,j)=>{try{const K=B||(O==null?void 0:O.daemonId)||"",Y=await e(K,"switch_chat",{id:j,sessionId:j,...(O==null?void 0:O.streamSource)==="agent-stream"&&{agentType:O==null?void 0:O.agentType}}),ee=Y==null?void 0:Y.result;(Y==null?void 0:Y.success)===!0||ee==="switched"||ee==="switched-by-title"||(ee===!1||ee==="not_found"?l(le=>[...le,{id:Date.now(),message:"⚠️ Session tab not found — try refreshing history",type:"warning",timestamp:Date.now()}]):typeof ee=="string"&&ee.startsWith("error:")?l(le=>[...le,{id:Date.now(),message:`⚠️ Switch error: ${ee}`,type:"warning",timestamp:Date.now()}]):l(le=>[...le,{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()}])}},Qe=async()=>{if(!(!O||Z)){T(!0);try{const B=O.ideId||O.daemonId||"";await e(B,"new_chat",{...O.streamSource==="agent-stream"&&{agentType:O.agentType}}),F(j=>({...j,[O.tabKey]:Date.now()})),U(j=>({...j,[O.tabKey]:[]}))}catch(B){console.error("New chat failed",B)}finally{T(!1)}}},[J,pe]=w.useState(!1),P=async()=>{if(!O||J)return;pe(!0);const B=O.tabKey;try{await e(O.ideId,"agent_stream_focus",{agentType:O.agentType}),Ot(B,[200,1500,3e3])}catch(j){console.error("Focus agent failed",j)}finally{pe(!1)}},X=async()=>{var B;if(!(!O||I)){z(!0);try{const j=O.ideId||O.daemonId||"",K=await e(j,"list_chats",{forceExpand:!0,...O.streamSource==="agent-stream"&&{agentType:O.agentType}}),Y=(K==null?void 0:K.chats)||((B=K==null?void 0:K.result)==null?void 0:B.chats);K!=null&&K.success&&Array.isArray(Y)&&r(O.ideId,Y)}catch(j){console.error("Refresh history failed",j)}finally{z(!1)}}};return p.jsxs("div",{className:"page-dashboard flex-1 min-h-0 bg-bg-primary text-text-primary flex flex-col overflow-hidden",children:[p.jsx(y3,{wsStatus:a,showReconnected:d}),p.jsx(x3,{activeConv:O,agentCount:V.length,wsStatus:a,isP2PActive:c,onOpenHistory:()=>k(!0)}),p.jsx(k3,{sortedConversations:ue,activeTabId:f,tabsOverflow:S,tabsContainerRef:$,terminalRef:W,onSelectTab:B=>{ve.current=!0,g(B)},onReorder:ge,pinTab:Ot,clearTabPinTimers:Ke,retryP2P:u}),p.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden relative",children:O?p.jsxs(p.Fragment,{children:[p.jsx(y1,{activeConv:O,onModalButton:Pt}),p.jsx("div",{className:"desktop-only px-3 pt-1 pb-2",children:!ar(O)&&!Dr(O)&&n[O.ideId]?p.jsx(g3,{screenshotUrl:n[O.ideId],mode:"preview",onDismiss:()=>{const B={...n};delete B[O.ideId],i(B)}}):!ar(O)&&!Dr(O)&&O.cdpconnected===!1?p.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 py-2 bg-yellow-500/[0.08] border border-yellow-500/20 rounded-lg text-xs text-text-secondary",children:[p.jsx("span",{className:"text-sm",children:"⚠️"}),p.jsx("span",{className:"flex-1",children:"CDP not connected — chat history & screenshots unavailable for this IDE."}),p.jsx("button",{className:"btn btn-sm bg-yellow-500/15 text-yellow-500 border border-yellow-500/30 text-[10px] whitespace-nowrap shrink-0",onClick:Or,children:"Relaunch with CDP"})]}):null}),ar(O)&&!Dr(O)?p.jsx(v3,{activeConv:O,ptyBuffers:De,terminalRef:W,agentInput:_,setAgentInput:v,handleSendChat:ke,handleModalButton:Pt}):p.jsx(x1,{activeConv:O,ides:s,agentInput:_,setAgentInput:v,handleSendChat:ke,handleFocusAgent:P,isFocusingAgent:J,messageReceivedAt:y,actionLogs:R})]}):p.jsxs("div",{className:"empty-dashboard",children:[p.jsx("div",{className:"glow-orb",children:p.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-12 h-12"})}),p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"font-bold text-lg mb-1.5",children:"No IDE connected"}),p.jsx("div",{className:"text-[13px] text-text-muted",style:{marginBottom:me&&b.length>0?16:0},children:me?"Launch an IDE with CDP to start monitoring":"Launch your IDE with the ADHDev extension to start"}),me&&b.length>0&&p.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:b.filter(B=>B.running||!0).map(B=>p.jsxs("button",{className:"btn btn-sm bg-violet-500/10 border border-violet-500/25 text-violet-400 text-xs font-semibold px-4 py-2 rounded-lg cursor-pointer flex items-center gap-1.5 transition-all",onClick:()=>Zr(B.type),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 ",B.name]},B.type))})]})]})}),N&&O&&p.jsx(b3,{activeConv:O,ides:s,isCreatingChat:Z,isRefreshingHistory:I,onClose:()=>k(!1),onNewChat:Qe,onSwitchSession:Yt,onRefreshHistory:X}),p.jsx("style",{children:`
166
+ `})]})}function N3({screenshotUrl:e,mode:t="preview",zoom:r=100,interactive:n=!1,connectionState:i,onDismiss:s,onClickAt:o,onKeyDown:l,badge:a,emptyMessage:c,aspectRatio:h,className:u,style:d}){const f=b.useRef(null),m=b.useCallback(g=>{if(!n||!o||!f.current)return;const x=f.current,_=x.getBoundingClientRect(),v=(g.clientX-_.left)/_.width*x.naturalWidth,y=(g.clientY-_.top)/_.height*x.naturalHeight;o(v,y,x.naturalWidth,x.naturalHeight)},[n,o]);return t==="preview"?e?p.jsxs("div",{className:`relative rounded-xl overflow-hidden border border-border-subtle bg-bg-secondary ${u||""}`,style:{aspectRatio:h||"16/9",...d},children:[p.jsx("img",{ref:f,src:e,alt:"IDE Screenshot",className:"w-full h-full object-cover"}),s&&p.jsx("button",{onClick:s,className:"absolute top-2.5 right-2.5 bg-black/50 border-none text-white w-5 h-5 rounded-full text-[10px] z-10 cursor-pointer flex items-center justify-center",children:"✕"})]}):null:e?p.jsxs("div",{className:`${n?"screenshot-interactive":""} ${u||""} relative h-full flex items-center justify-center overflow-auto`,tabIndex:n?0:void 0,onKeyDown:n?l:void 0,style:d,children:[p.jsx("img",{ref:f,src:e,alt:"IDE Screenshot",onClick:n?m:void 0,className:"max-w-full max-h-full object-contain",style:{...n?{cursor:"crosshair"}:{},...r!==100?{transform:`scale(${r/100})`,transformOrigin:"center center"}:{}}}),a&&p.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 bg-black/70 text-white px-3.5 py-1.5 rounded-[20px] text-xs font-semibold backdrop-blur-sm",children:a})]}):p.jsxs("div",{className:`flex items-center justify-center flex-col gap-2 h-full text-text-muted ${u||""}`,style:d,children:[p.jsx("p",{className:"text-base",children:c||"🖥 Waiting for screenshot stream..."}),i&&p.jsxs("p",{className:"text-[13px] mt-2 opacity-50",children:["P2P: ",i]})]})}function P1({activeConv:e,onModalButton:t}){const[r,n]=b.useState(null);if(b.useEffect(()=>{n(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=s=>{r||(n(s),t(s))};return p.jsxs("div",{className:"bg-gradient-to-br from-amber-600 to-amber-700 text-white py-2.5 px-4 shrink-0 z-[5]",children:[e.modalMessage&&p.jsx("div",{className:"text-[11px] opacity-85 mb-1.5 whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:e.modalMessage.replace(/[\n\r]+/g," ").slice(0,120)}),p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsxs("div",{className:"font-black text-xs flex items-center gap-2",children:[p.jsx("span",{children:"⚠️"})," ",r?"PROCESSING...":"ACTION REQUIRED"]}),p.jsx("div",{className:"flex gap-2 flex-wrap",children:e.modalButtons.map((s,o)=>{const l=s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),a=/^(run|approve|accept|yes|allow|always)/.test(l),c=/^(reject|deny|delete|remove|abort)/.test(l),h=r===s,u=r!==null;return p.jsx("button",{onClick:()=>i(s),disabled:u,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${a?"bg-white text-amber-700 font-extrabold":c?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${u&&!h?"opacity-40":"opacity-100"} ${u?"cursor-not-allowed":"cursor-pointer"}`,children:h?"⏳ ...":s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim()},o)})})]})]})}const fr=new Map;function T3({ideId:e,ideType:t,agentType:r,agentName:n,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var ge;const{sendCommand:a}=xi(),c=!!(o||l),h=`${e}:${r}`,u=fr.get(h),[d,f]=b.useState(!1),[m,g]=b.useState(!1),[x,_]=b.useState((u==null?void 0:u.models)||[]),[v,y]=b.useState((u==null?void 0:u.modes)||[]),E=X=>X?typeof X=="string"?X:typeof X=="object"?X.name||X.id||JSON.stringify(X):String(X):"",[P,C]=b.useState(E(i)),[M,z]=b.useState(E(s)),[J,N]=b.useState(!1),[D,I]=b.useState(!1),R=b.useRef(0),W=X=>X.map(Q=>typeof Q=="string"?Q:(Q==null?void 0:Q.name)||(Q==null?void 0:Q.id)||String(Q));b.useEffect(()=>{if(o){const X=o.find(Q=>Q.category==="model");if(X){const Q=W(X.options.map(ue=>ue.value));_(Q),X.currentValue&&C(E(X.currentValue));const K=fr.get(h)||{models:[],modes:[]};fr.set(h,{...K,models:Q})}}if(l&&l.length>0){const X=W(l.map(K=>K.id));y(X);const Q=fr.get(h)||{models:[],modes:[]};fr.set(h,{...Q,modes:X})}else if(o){const X=o.find(Q=>Q.category!=="model");if(X){const Q=W(X.options.map(ue=>ue.value));y(Q),X.currentValue&&z(E(X.currentValue));const K=fr.get(h)||{models:[],modes:[]};fr.set(h,{...K,modes:Q})}}},[o,l,h]),b.useEffect(()=>{f(!1),g(!1),C(E(i)),z(E(s));const X=fr.get(h);X?(_(X.models),y(X.modes)):(_([]),y([]))},[e,r]),b.useEffect(()=>{i&&Date.now()>R.current&&C(E(i))},[i]),b.useEffect(()=>{s&&Date.now()>R.current&&z(E(s))},[s]);const A=b.useCallback(async(X,Q={})=>{const K={...Q},ue=e.split(":");return ue.length>=3&&(ue[1]==="ide"||ue[1]==="cli"||ue[1]==="acp")&&(K._targetInstance=ue.slice(2).join(":"),K._targetType=ue[1]),await a(e,X,K)},[e]),F=async()=>{var X,Q;if(x.length>0){f(!d);return}if(c){f(!0);return}N(!0);try{const K=await A("list_extension_models",{agentType:r,ideType:t}),ue=(K==null?void 0:K.models)||((X=K==null?void 0:K.result)==null?void 0:X.models)||[],de=W(ue);_(de),K!=null&&K.current&&C(E(K.current)),(Q=K==null?void 0:K.result)!=null&&Q.current&&C(E(K.result.current));const pe=fr.get(h)||{models:[],modes:[]};fr.set(h,{...pe,models:de}),f(!0)}catch{}finally{N(!1)}},H=async()=>{var X,Q;if(v.length>0){g(!m);return}if(c){g(!0);return}I(!0);try{const K=await A("list_extension_modes",{agentType:r,ideType:t}),ue=(K==null?void 0:K.modes)||((X=K==null?void 0:K.result)==null?void 0:X.modes)||[],de=W(ue);y(de),K!=null&&K.current&&z(E(K.current)),(Q=K==null?void 0:K.result)!=null&&Q.current&&z(E(K.result.current));const pe=fr.get(h)||{models:[],modes:[]};fr.set(h,{...pe,modes:de}),g(!0)}catch{}finally{I(!1)}},L=async X=>{f(!1),C(X),R.current=Date.now()+5e3;try{c?await A("change_model",{agentType:r,ideType:t,model:X}):await A("set_extension_model",{agentType:r,ideType:t,model:X})}catch{}},$=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(X=>X.category!=="model")),S=$?(ge=o==null?void 0:o.find(X=>X.category!=="model"))==null?void 0:ge.configId:void 0,ne=async X=>{g(!1),z(X),R.current=Date.now()+5e3;try{c&&$&&S?await A("set_thought_level",{agentType:r,ideType:t,configId:S,value:X}):c?await A("set_mode",{agentType:r,ideType:t,mode:X}):await A("set_extension_mode",{agentType:r,ideType:t,mode:X})}catch{}},k={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[r]||"#94a3b8";return p.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 flex-wrap text-[10px] border-t border-border-subtle bg-[var(--surface-primary)]",children:[p.jsx("span",{className:"text-[9px] font-bold tracking-wide uppercase opacity-70",style:{color:k},children:n}),p.jsx("span",{className:"text-border-subtle text-[10px]",children:"│"}),p.jsxs("div",{className:"relative",children:[p.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:d?`${k}55`:"transparent",border:"1px solid",color:P?"var(--text-primary)":"var(--text-muted)"},onClick:F,children:[p.jsx("span",{className:"text-[9px] opacity-60",children:"🤖"}),J?"...":P||"Model",p.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),d&&x.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>f(!1)}),p.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[p.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:"SELECT MODEL"}),x.map(X=>p.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:X===P?`${k}18`:"transparent",color:X===P?k:"var(--text-secondary)",fontWeight:X===P?600:400,borderLeft:X===P?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Q=>{Q.currentTarget.style.background=`${k}12`},onMouseLeave:Q=>{Q.currentTarget.style.background=X===P?`${k}18`:"transparent"},onClick:()=>L(X),children:X},X))]})]})]}),p.jsxs("div",{className:"relative",children:[p.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:m?`${k}55`:"transparent",border:"1px solid",color:M?"var(--text-primary)":"var(--text-muted)"},onClick:H,children:[p.jsx("span",{className:"text-[9px] opacity-60",children:$?"🧠":"⚡"}),D?"...":M||($?"Thinking":"Mode"),p.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),m&&v.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>g(!1)}),p.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[p.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:$?"SELECT THINKING LEVEL":"SELECT MODE"}),v.map(X=>p.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:X===M?`${k}18`:"transparent",color:X===M?k:"var(--text-secondary)",fontWeight:X===M?600:400,borderLeft:X===M?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Q=>{Q.currentTarget.style.background=`${k}12`},onMouseLeave:Q=>{Q.currentTarget.style.background=X===M?`${k}18`:"transparent"},onClick:()=>ne(X),children:X},X))]})]})]})]})}const nr=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),Dr=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function L1({activeConv:e,ides:t,agentInput:r,setAgentInput:n,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a}){const c=b.useRef(null),{sendCommand:h}=xi(),[u,d]=b.useState([]),[f,m]=b.useState(0),[g,x]=b.useState(!0),[_,v]=b.useState(!1),y=b.useRef("");e.tabKey!==y.current&&(y.current=e.tabKey,d([]),m(0),x(!0));const E=b.useCallback(async()=>{var M,z,J,N,D;if(!(_||!g)){v(!0);try{const I=t.find(L=>L.id===e.ideId),R=(I==null?void 0:I.daemonId)||((M=e.ideId)==null?void 0:M.split(":")[0])||"";if(!R){x(!1);return}const W=e.ideType||e.agentType||"",A=(e.ideId||"").split(":"),F=A.length>=3?A.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:R,agentType:W,instanceId:F,offset:f});const H=await h(R,"chat_history",{agentType:W,offset:f,limit:30,instanceId:F});console.log("[ChatPane] got result:",{count:((z=H.messages)==null?void 0:z.length)||0,hasMore:H.hasMore}),((J=H.messages)==null?void 0:J.length)>0&&(d(L=>[...H.messages,...L]),m(L=>L+H.messages.length)),x(H.hasMore)}catch(I){console.warn("[ChatPane] Failed to load history:",I),!((N=I==null?void 0:I.message)!=null&&N.includes("P2P not available"))&&!((D=I==null?void 0:I.message)!=null&&D.includes("channel not open"))&&x(!1)}finally{v(!1)}}},[_,g,f,t,e]),P=b.useRef(0);b.useEffect(()=>{if(e.messages.length<10&&g&&!_&&u.length===0){const M=P.current;if(M>5)return;const J=setTimeout(()=>{P.current=M+1,E()},M===0?0:2e3);return()=>clearTimeout(J)}else u.length>0&&(P.current=0)},[e.tabKey,e.messages.length,g,_,u.length,E]);const C=(()=>{const M=e.messages.map((N,D)=>{const I=`${e.ideId}-${N.id??`i-${D}`}`;return{...N,receivedAt:N.receivedAt||l[I]||0}});if(u.length===0)return M;const z=new Set(M.map(N=>`${N.role}:${(N.content||"").slice(0,100)}`));return[...u.filter(N=>!z.has(`${N.role}:${(N.content||"").slice(0,100)}`)),...M]})();return p.jsxs(p.Fragment,{children:[p.jsx(Oy,{messages:C,actionLogs:a.filter(M=>M.ideId===e.tabKey).sort((M,z)=>M.timestamp-z.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",isCliMode:nr(e)||Dr(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:E,isLoadingMore:_,hasMoreHistory:g,emptyState:e.messages.length===0?e.status==="not_monitored"?p.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[p.jsx("div",{className:"text-3xl opacity-60",children:"🔌"}),p.jsx("div",{className:"text-[13px] opacity-50",children:"Agent not monitored"}),p.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Switching...":`📂 Open ${e.displayPrimary} Panel`}),p.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Click to switch monitoring to this agent"})]}):e.status==="panel_hidden"?p.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[p.jsx("div",{className:"text-3xl opacity-60",children:"👁️‍🗨️"}),p.jsx("div",{className:"text-[13px] opacity-50",children:"Panel is not visible in IDE"}),p.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Opening...":`📂 Open ${e.displayPrimary} Panel`}),p.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Open the agent sidebar in your IDE to start viewing messages"})]}):void 0:void 0}),!nr(e)&&(()=>{const M=t.find(z=>z.id===e.ideId);return p.jsx(T3,{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:Dr(e)?M==null?void 0:M.acpConfigOptions:void 0,acpModes:Dr(e)?M==null?void 0:M.acpModes:void 0})})(),p.jsx("div",{className:"dashboard-input-area px-3 py-2.5 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:p.jsxs("div",{className:"flex gap-2.5 items-center",children:[p.jsx("div",{className:"flex-1 relative",children:p.jsx("input",{ref:c,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:M=>n(M.target.value),onPaste:M=>{const z=M.clipboardData.getData("text");z&&n(J=>J+z),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)},className:"w-full h-10 rounded-[20px] px-4 bg-bg-secondary border border-border-subtle text-sm text-text-primary"})}),p.jsx("button",{onClick:i,disabled:!r.trim(),className:`w-10 h-10 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${r.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:p.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:r.trim()?"text-white":"text-text-muted",children:p.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function P3({activeConv:e,ptyBuffers:t,terminalRef:r,agentInput:n,setAgentInput:i,handleSendChat:s,handleModalButton:o}){const l=b.useRef(null),{sendCommand:a,sendData:c}=xi();return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--surface-primary)] border-b border-border-subtle shrink-0",children:[p.jsx("div",{className:"flex gap-1",children:p.jsx("div",{className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-accent text-white",children:"⬛ Terminal"})}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"text-[10px] text-text-muted",children:[e.agentName," — Terminal"]}),p.jsx("button",{onClick:()=>{if(!r.current||!e)return;const h=t.current.get(e.tabKey);if(h&&h.length>0)for(const u of h)r.current.write(u);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var u;(u=r.current)==null||u.bumpResize()})})},title:"Refresh terminal (replay buffer + TUI redraw)",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-bg-secondary text-text-secondary border border-border-subtle cursor-pointer leading-none",children:"↺"}),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",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-red-500/[0.08] text-red-400 border border-red-500/30 cursor-pointer leading-none font-semibold",children:"■ Stop"})]})]}),p.jsx(P1,{activeConv:e,onModalButton:o}),p.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:p.jsx(T1,{ref:r,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 m;const d=e.ideId||e.daemonId||"",f=(m=e.ideId)!=null&&m.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",{className:"px-3 py-2 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:p.jsxs("div",{className:"flex gap-2.5 items-center",children:[p.jsx("div",{className:"flex-1 relative",children:p.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:n,onChange:h=>i(h.target.value),onPaste:h=>{const u=h.clipboardData.getData("text");u&&i(d=>d+u),h.preventDefault()},onKeyDown:h=>{if(h.key==="Enter"){if(h.nativeEvent.isComposing){h.preventDefault();return}h.preventDefault(),s()}},className:"w-full h-9 rounded-[18px] px-4 bg-bg-secondary border border-border-subtle text-[13px] text-text-primary"})}),p.jsx("button",{onClick:s,disabled:!n.trim(),className:`w-9 h-9 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${n.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:n.trim()?"text-white":"text-text-muted",children:p.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function L3({wsStatus:e,showReconnected:t,loginUrl:r}){const n=e==="disconnected"||e==="reconnecting"||e==="offline"||e==="auth_failed",i=e==="auth_failed"?"red":e==="offline"?"orange":"violet",s={red:"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))",orange:"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))",violet:"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))"},o={red:"1px solid rgba(239,68,68,0.2)",orange:"1px solid rgba(255,107,53,0.2)",violet:"1px solid rgba(139,92,246,0.2)"},l={red:"#ef4444",orange:"#ff6b35",violet:"#a78bfa"};return p.jsxs(p.Fragment,{children:[n&&p.jsxs("div",{className:"py-2.5 px-5 text-[13px] font-semibold flex items-center gap-2.5 justify-center",style:{background:s[i],borderBottom:o[i],color:l[i]},children:[p.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-5 h-5",style:{opacity:e==="auth_failed"?.6:1,animation:e==="auth_failed"?void 0:"pulse 2s ease-in-out infinite",filter:e==="auth_failed"?"grayscale(1)":void 0}}),e==="offline"&&"Network offline — waiting for connection...",e==="disconnected"&&"Reconnecting to server...",e==="reconnecting"&&"Reconnecting to server...",e==="auth_failed"&&(r?p.jsxs(p.Fragment,{children:["Session expired."," ",p.jsx("a",{href:r,className:"text-inherit underline",children:"Log in again"})]}):"Connection failed — please restart the server.")]}),t&&e==="connected"&&p.jsxs("div",{className:"py-2 px-4 text-xs font-semibold flex items-center gap-2 justify-center bg-gradient-to-r from-green-500/[0.12] to-green-500/[0.04] text-green-400 border-b border-green-500/15 animate-[fadeIn_0.3s_ease]",children:[p.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-4 h-4"}),"Connected"]})]})}const ru=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),nu=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function D3({activeConv:e,agentCount:t,wsStatus:r,isConnected:n,onOpenHistory:i}){const s=cs(),o=n?"#22c55e":r==="connected"?"#eab308":"#ef4444",l=n?"0 0 4px #22c55e80":r==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480";return p.jsxs("div",{className:"dashboard-header",children:[p.jsx("div",{className:"flex items-center gap-3",children:p.jsxs("div",{className:"leading-tight",children:[p.jsxs("h1",{className:"header-title m-0",children:["💬 Dashboard",p.jsxs("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:[t," Active",p.jsx("span",{className:"inline-block w-[5px] h-[5px] rounded-full ml-1 align-middle",style:{background:o}})]})]}),p.jsxs("div",{className:"header-subtitle text-[11px] items-center gap-1",children:[t," agent",t!==1?"s":""," active",p.jsx("span",{title:n?"Connected":r==="connected"?"Partial":"Disconnected",className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{background:o,boxShadow:l}})]})]})}),p.jsxs("div",{className:"flex gap-2 items-center",children:[e&&!ru(e)&&!nu(e)&&p.jsx("button",{onClick:()=>s(`/ide/${e.ideId}`),className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs",children:"IDE"}),e&&!ru(e)&&!nu(e)&&p.jsx("button",{onClick:i,className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5 flex items-center gap-1",title:"Chat History",children:"📜"}),e&&!ru(e)&&!nu(e)&&p.jsx("button",{onClick:()=>s(`/ide/${e.ideId}?view=remote`),className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5",title:"Remote Control",children:"🖥️"})]})]})}function Ur(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function R3(e){if(e<60)return`${Math.round(e)}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const r=Math.floor(t/60),n=t%60;if(r<24)return n>0?`${r}h ${n}m`:`${r}h`;const i=Math.floor(r/24),s=r%24;return`${i}d ${s}h`}function Ug(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Kg(e){return(e.id||"").includes(":cli:")}function Vg(e){return(e.id||"").includes(":acp:")}function Yh(e,t){return Ur(e)}function M3(e){if(!Array.isArray(e)||e.length<=1)return e;const t=new Map,r=["generating","streaming","active","connected","idle","panel_hidden"];for(const n of e){const i=(n.name||n.id||"").toLowerCase().replace(/\s+/g,"-"),s=t.get(i);if(!s){t.set(i,n);continue}const o=r.indexOf(s.status||"idle"),l=r.indexOf(n.status||"idle");l>=0&&(o<0||l<o)&&t.set(i,n)}return Array.from(t.values())}function I3({activeConv:e,ides:t,isCreatingChat:r,isRefreshingHistory:n,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",{className:"fixed inset-0 z-[1000] flex items-center justify-center",children:[p.jsx("div",{onClick:i,className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),p.jsxs("div",{className:"card fade-in relative w-[90%] max-w-[500px] max-h-[80vh] flex flex-col p-0 overflow-hidden shadow-[0_20px_40px_rgba(0,0,0,0.4)] rounded-[20px]",children:[p.jsxs("div",{className:"px-6 py-5 border-b border-border-subtle flex justify-between items-center bg-[var(--surface-primary)]",children:[p.jsxs("div",{children:[p.jsx("h3",{className:"m-0 text-lg font-extrabold",children:"Chat History"}),p.jsxs("div",{className:"text-xs text-text-muted mt-0.5",children:[e.displayPrimary," — ",Ur(e.ideType)]})]}),p.jsx("button",{onClick:i,className:"bg-transparent border-none text-xl text-text-muted cursor-pointer",children:"✕"})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-3 bg-bg-primary",children:[p.jsx("button",{onClick:s,disabled:r,className:"w-full p-3.5 rounded-xl mb-3 bg-indigo-500/10 border border-dashed border-accent text-accent font-bold text-sm cursor-pointer",children:r?"⌛ Creating...":"+ Start New Chat Session"}),c.map(d=>p.jsxs("div",{onClick:()=>{o(e.ideId,d.id),i()},className:`p-4 rounded-xl mb-2 cursor-pointer border transition-all ${h===d.id?"bg-[var(--bg-glass-hover)] border-accent":"bg-[var(--surface-secondary)] border-border-subtle"}`,children:[p.jsx("div",{className:`font-bold text-sm mb-1 ${h===d.id?"text-[var(--accent-primary-light)]":"text-text-primary"}`,children:d.title||"Untitled Session"}),p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsxs("div",{className:"text-[11px] text-text-muted font-mono",children:[d.id.substring(0,12),"..."]}),h===d.id&&p.jsx("span",{className:"text-[10px] bg-accent text-white px-2 py-0.5 rounded-[10px] font-extrabold",children:"ACTIVE"})]})]},d.id)),c.length===0&&p.jsxs("div",{className:"py-10 px-5 text-center text-text-muted",children:[p.jsx("div",{className:"text-3xl mb-3",children:"🕯️"}),p.jsx("div",{className:"text-[13px]",children:"No recent chat sessions found."})]})]}),p.jsx("div",{className:"px-5 py-4 bg-[var(--surface-tertiary)] border-t border-border-subtle text-right",children:p.jsx("button",{onClick:l,disabled:n,className:"btn btn-secondary btn-sm rounded-[10px]",children:n?"⌛ Refreshing...":"🔄 Refresh History"})})]})]})}function A3({sortedConversations:e,activeTabId:t,tabsOverflow:r,tabsContainerRef:n,terminalRef:i,onSelectTab:s,onReorder:o,pinTab:l,clearTabPinTimers:a,retryConnection:c}){const{sendCommand:h}=xi(),u=b.useRef(null),d=b.useRef(null),f=b.useRef(null),m=b.useRef(null),[g,x]=b.useState(!1),_=b.useCallback((D,I)=>{const R=I.touches[0];f.current={x:R.clientX,y:R.clientY},d.current=D,m.current=setTimeout(()=>{x(!0)},400)},[]),v=b.useCallback(D=>{if(!g||!d.current){m.current&&(clearTimeout(m.current),m.current=null);return}D.preventDefault();const I=D.touches[0],R=n.current;if(!R)return;const W=Array.from(R.querySelectorAll("[data-tabkey]"));for(const A of W){const F=A.getBoundingClientRect();if(I.clientX>=F.left&&I.clientX<=F.right){const H=A.getAttribute("data-tabkey");if(H&&H!==d.current){const L=e.map(ne=>ne.tabKey),$=L.indexOf(d.current),S=L.indexOf(H);if($!==-1&&S!==-1){const ne=[...L];ne.splice($,1),ne.splice(S,0,d.current),o(ne)}}break}}},[g,e,n,o]),y=b.useCallback(()=>{m.current&&(clearTimeout(m.current),m.current=null),x(!1),d.current=null,f.current=null},[]),E=()=>{const D=n.current;D&&D.scrollBy({left:-150,behavior:"smooth"})},P=()=>{const D=n.current;D&&D.scrollBy({left:150,behavior:"smooth"})},[C,M]=b.useState(!1),[z,J]=b.useState(!1),N=b.useCallback(()=>{const D=n.current;D&&(M(D.scrollLeft>4),J(D.scrollLeft+D.clientWidth<D.scrollWidth-4))},[n]);return b.useEffect(()=>{const D=n.current;if(!D)return;N(),D.addEventListener("scroll",N,{passive:!0});const I=new ResizeObserver(N);return I.observe(D),()=>{D.removeEventListener("scroll",N),I.disconnect()}},[n,N,e.length]),p.jsxs("div",{className:"relative shrink-0",children:[r&&p.jsx("button",{onClick:E,className:"absolute left-0 top-0 bottom-0 z-[5] w-8 border-none text-text-muted text-xs flex items-center justify-center transition-opacity duration-150",style:{background:"linear-gradient(to right, var(--bg-secondary) 60%, transparent)",cursor:C?"pointer":"default",opacity:C?.7:0,pointerEvents:C?"auto":"none"},onMouseEnter:D=>{C&&(D.currentTarget.style.opacity="1")},onMouseLeave:D=>{D.currentTarget.style.opacity=C?"0.7":"0"},children:"◀"}),r&&p.jsx("button",{onClick:P,className:"absolute right-0 top-0 bottom-0 z-[5] w-8 border-none text-text-muted text-xs flex items-center justify-center transition-opacity duration-150",style:{background:"linear-gradient(to left, var(--bg-secondary) 60%, transparent)",cursor:z?"pointer":"default",opacity:z?.7:0,pointerEvents:z?"auto":"none"},onMouseEnter:D=>{z&&(D.currentTarget.style.opacity="1")},onMouseLeave:D=>{D.currentTarget.style.opacity=z?"0.7":"0"},children:"▶"}),p.jsxs("div",{ref:n,className:"dashboard-agent-tabs flex overflow-x-auto overflow-y-visible shrink-0 bg-bg-secondary border-b border-border-subtle pt-1.5 pb-0 gap-1 select-none",onWheel:D=>{const I=n.current;I&&Math.abs(D.deltaY)>Math.abs(D.deltaX)&&(D.preventDefault(),I.scrollLeft+=D.deltaY)},style:{paddingLeft:r?36:8,paddingRight:r?36:8,scrollbarWidth:"none",WebkitOverflowScrolling:"touch"},children:[e.map((D,I)=>{const R=t===D.tabKey,W=D.status==="working"?"agent-tab-working":D.status==="waiting_approval"?"agent-tab-waiting":"",A=I<9?String(I+1):null,F=D.connectionState==="gave_up";return p.jsxs("div",{"data-tabkey":D.tabKey,className:`${W} shrink-0 px-2.5 py-1.5 rounded-t-lg border-b-0 cursor-grab flex items-center gap-2 transition-all duration-200`,draggable:!0,onDragStart:()=>{u.current=D.tabKey},onDragOver:H=>{H.preventDefault(),H.currentTarget.style.borderLeft="2px solid var(--accent-primary)"},onDragLeave:H=>{H.currentTarget.style.borderLeft=R?"1px solid var(--border-subtle)":"1px solid transparent"},onDrop:H=>{if(H.preventDefault(),H.currentTarget.style.borderLeft=R?"1px solid var(--border-subtle)":"1px solid transparent",!u.current||u.current===D.tabKey)return;const L=e.map(ce=>ce.tabKey),$=L.indexOf(u.current),S=L.indexOf(D.tabKey);if($===-1||S===-1)return;const ne=[...L];ne.splice($,1),ne.splice(S,0,u.current),o(ne),u.current=null},onDragEnd:()=>{u.current=null},onTouchStart:H=>_(D.tabKey,H),onTouchMove:v,onTouchEnd:y,onClick:()=>{a(),s(D.tabKey),D.streamSource==="agent-stream"&&D.agentType&&(h(D.ideId,"agent_stream_focus",{agentType:D.agentType}).catch(()=>{}),l(D.tabKey,[200,1500])),nr(D)&&setTimeout(()=>{var H,L;(L=(H=i.current)==null?void 0:H.bumpResize)==null||L.call(H)},100)},style:{background:R?"var(--bg-primary)":"rgba(255,255,255,0.03)",borderTop:R?"1px solid var(--border-subtle)":"1px solid transparent",borderLeft:R?"1px solid var(--border-subtle)":"1px solid transparent",borderRight:R?"1px solid var(--border-subtle)":"1px solid transparent",opacity:g&&d.current===D.tabKey?F?.15:.3:F?R?.6:.3:R?1:.5},children:[D.status==="working"?p.jsx("div",{className:"tab-spinner"}):D.status==="waiting_approval"?p.jsx("span",{className:"text-[8px] px-[5px] py-px text-yellow-400",children:"▲"}):D.connectionState==="gave_up"?p.jsx("span",{onClick:H=>{var $;H.stopPropagation();const L=D.daemonId||(($=D.ideId)==null?void 0:$.split(":")[0])||"";c==null||c(L)},title:"Disconnected — click to reconnect",className:"text-[8px] px-[5px] py-px text-yellow-400 cursor-pointer",children:"●"}):D.connectionState==="connecting"?p.jsx("span",{className:"text-[8px] px-[5px] py-px text-blue-400",children:"○"}):D.connectionState==="connected"?p.jsx("span",{className:"text-[8px] px-[5px] py-px text-green-400",children:"●"}):p.jsx("span",{className:"text-[8px] px-[5px] py-px text-text-muted",children:"●"}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-xs font-bold whitespace-nowrap overflow-hidden text-ellipsis",children:D.displayPrimary}),p.jsxs("div",{className:"text-[8px] opacity-50 flex gap-1 items-center",children:[D.displaySecondary,D.machineName&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"opacity-40",children:"·"}),p.jsxs("span",{className:"opacity-70",children:["🖥 ",D.machineName]})]})]})]}),A&&p.jsx("span",{className:"text-[9px] opacity-35 font-mono ml-0.5 shrink-0",children:A})]},D.tabKey)}),e.length===0&&p.jsx("div",{className:"p-2 text-xs opacity-40",children:"No active agents online."})]})]})}const qg={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function B3({toasts:e,onDismiss:t,onClickToast:r}){return p.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:e.map(n=>p.jsx("div",{className:"fade-in text-white px-5 py-3 rounded-xl text-[13px] font-semibold shadow-[0_8px_32px_rgba(0,0,0,0.3)] backdrop-blur-lg pointer-events-auto cursor-pointer animate-[toast-in_0.3s_ease-out] max-w-[360px]",style:{background:qg[n.type]||qg.info},onClick:()=>{r&&r(n),t(n.id)},children:n.message},n.id))})}const O3=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function j3(e){var n;const t=(n=e.workspaceFolders)==null?void 0:n[0];return t!=null&&t.name?t.name:((t==null?void 0:t.path)??"").split("/").filter(Boolean).pop()||"Workspace"}function z3(e,t,r,n){var s;const i={};if(r)for(const o of r){const l=o;if(l.type==="adhdev-daemon"||l.daemonMode){const a=l.machine||{},c=l.machineNickname,h=a.hostname||((s=l.system)==null?void 0:s.hostname)||"",u=c||(h&&h!=="Unknown"?h.replace(/\.local$/,""):null)||`Machine ${(l.id||"").substring(0,6)}`;i[l.id]=u}}return e.flatMap(o=>{var x,_,v,y,E;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((x=o.id)==null?void 0:x.split(":")[0])||o.id,h=n?n[c]||"new":void 0,u=j3(o),d=Ur(o.type),f=o.agentStreams,m=Array.isArray(f)?f:[],g=O3(o);if(g){const P=Yh(o.type),C=(_=o.agents)==null?void 0:_[0],M=(v=o.activeChat)==null?void 0:v.activeModal,z=M&&Array.isArray(M.buttons)&&M.buttons.length>0,J=(y=o.activeChat)==null?void 0:y.status,N=J==="generating"||J==="loading"||J&&J.toLowerCase()==="thinking",I=z||J==="waiting_approval"?"waiting_approval":N?"working":(C==null?void 0:C.status)||"idle",R=o.activeChat||{title:"",messages:[]};let W=R.title&&String(R.title).trim()?String(R.title).trim():"";const A=(E=o.activeChat)==null?void 0:E.id,F=o.chats;if(A&&Array.isArray(F)&&F.length>0){const ne=F.find(ce=>ce.id===A||ce.id&&String(ce.id)===String(A));ne!=null&&ne.title&&String(ne.title).trim()&&(W=String(ne.title).trim())}const H=R.messages||[],L=t[o.id]||[],$=new Map;H.filter(ne=>ne.role==="user").forEach(ne=>{$.set(ne.content,($.get(ne.content)||0)+1)});const S=L.filter(ne=>{const ce=$.get(ne.content)||0;return ce>0?($.set(ne.content,ce-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:P,agentType:nr(o)||Dr(o)?o.type:(C==null?void 0:C.type)||"ide-native",status:I,title:W,messages:[...H,...S],ideType:o.type,workspaceName:u,displayPrimary:W||P||u,displaySecondary:d,cdpconnected:o.cdpconnected,modalButtons:z?M.buttons:void 0,modalMessage:z?M.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,connectionState:h})}if(g&&(nr(o)||Dr(o)))return l;for(const P of m){const C=P.activeModal&&Array.isArray(P.activeModal.buttons)&&P.activeModal.buttons.length>0,M=C?"waiting_approval":P.status==="streaming"?"working":P.status,z=`${o.id}:${P.agentType}`,J=P.messages||[],N=t[z]||[],D=new Map;J.filter(R=>R.role==="user").forEach(R=>{D.set(R.content,(D.get(R.content)||0)+1)});const I=N.filter(R=>{const W=D.get(R.content)||0;return W>0?(D.set(R.content,W-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:P.agentName,agentType:P.agentType,status:M,title:"",messages:[...J,...I],ideType:o.type,workspaceName:u,displayPrimary:P.agentName,displaySecondary:d,cdpconnected:o.cdpconnected,modalButtons:C?P.activeModal.buttons:void 0,modalMessage:C?P.activeModal.message:void 0,streamSource:"agent-stream",tabKey:z,machineName:a,connectionState: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,connectionState:h}),l})}let F3=P0;function wf(){return F3()}class $3{constructor(){ps(this,"listeners",new Map)}send(t){}isConnected(){return!1}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>{var n;(n=this.listeners.get(t))==null||n.delete(r)}}emit(t,...r){var n;(n=this.listeners.get(t))==null||n.forEach(i=>i(...r))}}let H3=new $3;class W3{constructor(){ps(this,"ptyCallbacks",new Set)}sendPtyInput(t,r,n){return!1}sendPtyResize(t,r,n,i){return!1}async requestChatHistory(t,r,n,i,s){return{messages:[],hasMore:!1}}retryConnection(t){}getState(t){return"disconnected"}sendData(t,r){return!1}get(t){}onScreenshot(t,r){return()=>{}}onStatusEvent(t){return()=>{}}onPtyOutput(t){return this.ptyCallbacks.add(t),()=>{this.ptyCallbacks.delete(t)}}emitPtyOutput(t,r){this.ptyCallbacks.forEach(n=>n(t,r))}}let ei=new W3,Yg=ei;function U3(){const{sendCommand:e}=xi(),t=wf(),{updateIdeChats:r,screenshotMap:n,setScreenshotMap:i}=t,s=t.ides||[],o=t.toasts||[],l=t.setToasts||(()=>{}),a=t.wsStatus||"connected",c=t.isConnected??!0,h=t.connectionStates||{},u=t.retryConnection,d=t.showReconnected||!1,[f,m]=b.useState(()=>{try{const j=new URLSearchParams(window.location.search).get("activeTab");return j||sessionStorage.getItem("adhdev_dashboard_activeTab")}catch{return null}}),g=b.useCallback(O=>{m(O);try{O?sessionStorage.setItem("adhdev_dashboard_activeTab",O):sessionStorage.removeItem("adhdev_dashboard_activeTab")}catch{}},[]),x=b.useRef([]),[_,v]=b.useState(""),[y,E]=b.useState({}),[P,C]=b.useState(!1),[M,z]=b.useState(!1),[J,N]=b.useState(!1),[D,I]=b.useState([]),[R,W]=b.useState({}),[A,F]=b.useState({}),H=b.useRef(null),L=b.useRef(null),$=b.useRef(null),[S,ne]=b.useState(!1),ce=s.find(O=>O.type==="adhdev-daemon"),k=(ce==null?void 0:ce.detectedIdes)||[],ge=!!ce,X=b.useMemo(()=>{var U,V;const O=s.filter(Z=>Z.type!=="adhdev-daemon"),j=new Map;for(const Z of O){const se=j.get(Z.id);if(!se)j.set(Z.id,Z);else{const le=(((U=se.workspaceFolders)==null?void 0:U.length)||0)+(se.activeChat?1:0);((((V=Z.workspaceFolders)==null?void 0:V.length)||0)+(Z.activeChat?1:0)>le||(Z.timestamp||0)>(se.timestamp||0))&&j.set(Z.id,Z)}}return Array.from(j.values())},[s]),Q=b.useMemo(()=>{const O=z3(X,R,s,h),j=Date.now();return O.map(U=>{const V=A[U.tabKey];return V&&j-V<5e3?{...U,messages:[],title:""}:U})},[X,R,A,s]),[K,ue]=b.useState(()=>{try{return JSON.parse(sessionStorage.getItem("adhdev_tabOrder")||"[]")}catch{return[]}}),de=b.useMemo(()=>{if(K.length===0)return Q;const O=new Map(K.map((j,U)=>[j,U]));return[...Q].sort((j,U)=>{const V=O.get(j.tabKey)??9999,Z=O.get(U.tabKey)??9999;return V-Z})},[Q,K]);b.useEffect(()=>{const O=$.current;if(!O)return;const j=()=>ne(O.scrollWidth>O.clientWidth+2);j();const U=new ResizeObserver(j);return U.observe(O),O.addEventListener("scroll",j),()=>{U.disconnect(),O.removeEventListener("scroll",j)}},[de.length]);const pe=b.useCallback(O=>{ue(O);try{sessionStorage.setItem("adhdev_tabOrder",JSON.stringify(O))}catch{}},[]);b.useEffect(()=>{if(Object.keys(A).length===0)return;const j=setTimeout(()=>{F(U=>{const V=Date.now(),Z={};for(const[se,le]of Object.entries(U))V-le<5e3&&(Z[se]=le);return Object.keys(Z).length===Object.keys(U).length?U:Z})},5500);return()=>clearTimeout(j)},[A]);const B=de.find(O=>O.tabKey===f),Re=de.map(O=>O.tabKey).join(","),be=b.useRef(!1);b.useEffect(()=>{if(de.length===0||be.current&&f&&de.some(j=>j.tabKey===f))return;const O=de.find(j=>j.cdpconnected===!0);O?g(O.tabKey):(!f||!de.some(j=>j.tabKey===f))&&g(de[0].tabKey)},[Re]);const Ie=b.useCallback(()=>{x.current.forEach(O=>clearTimeout(O)),x.current=[]},[]),Nt=b.useCallback((O,j)=>{Ie();for(const U of j)x.current.push(setTimeout(()=>g(O),U))},[Ie]);b.useEffect(()=>{var U;if(!((U=B==null?void 0:B.messages)!=null&&U.length))return;const O=B.ideId,j=Date.now();E(V=>{let Z=!1;const se={...V};return B.messages.forEach((le,me)=>{const re=`${O}-${le.id??`i-${me}`}`;se[re]==null&&(se[re]=j,Z=!0)}),Z?se:V})},[B==null?void 0:B.ideId,B==null?void 0:B.messages]);const ur=b.useRef(!1);b.useEffect(()=>{if(!P){ur.current=!1;return}if(!B||ur.current||M)return;const O=s.find(j=>j.id===B.ideId);O&&(!O.chats||O.chats.length===0)&&(ur.current=!0,q())},[P,B==null?void 0:B.ideId]),b.useEffect(()=>{const O=setInterval(()=>{const j=Date.now()-3e5;I(U=>{const V=U.filter(Z=>Z.timestamp>j).slice(-100);return V.length===U.length?U:V})},6e4);return()=>clearInterval(O)},[]);const kr=b.useRef(new Map);b.useEffect(()=>{const O=(U,V)=>{var me,re,xe;if(!V)return;for(const ye of Q){if(!nr(ye))continue;const rt=(me=ye.ideId)!=null&&me.includes(":cli:")?ye.ideId.split(":cli:")[1]:"";if(U===rt||U===ye.agentType||U===ye.ideType){const At=kr.current.get(ye.tabKey)||[];At.push(V),At.length>1e4&&At.splice(0,At.length-5e3),kr.current.set(ye.tabKey,At)}}const Z=B&&nr(B),se=(re=B==null?void 0:B.ideId)!=null&&re.includes(":cli:")?B.ideId.split(":cli:")[1]:"",le=U===se||U===(B==null?void 0:B.agentType)||U===(B==null?void 0:B.ideType);Z&&le&&((xe=H.current)==null||xe.write(V))},j=Yg.onPtyOutput(O);return()=>{j()}},[B==null?void 0:B.agentType,B==null?void 0:B.ideType,B==null?void 0:B.tabKey,Q]),b.useEffect(()=>{if(!B||!nr(B))return;const j=setTimeout(()=>{if(H.current){const U=kr.current.get(B.tabKey);if(U&&U.length>0)for(const V of U)H.current.write(V);H.current.bumpResize()}},200);return()=>clearTimeout(j)},[B==null?void 0:B.tabKey]),b.useEffect(()=>{if(!B)return;const O=setTimeout(()=>{var j;(j=L.current)==null||j.focus()},150);return()=>clearTimeout(O)},[B==null?void 0:B.tabKey]),b.useEffect(()=>{const O=j=>{var le,me,re,xe,ye,Xe;const U=parseInt(j.key);if(isNaN(U)||U<1||U>9)return;if(j.ctrlKey){j.preventDefault();const rt=de[U-1];rt&&(Ie(),g(rt.tabKey));return}const V=(le=document.activeElement)==null?void 0:le.tagName,Z=V==="INPUT"||V==="TEXTAREA"||((me=document.activeElement)==null?void 0:me.isContentEditable),se=((xe=(re=document.activeElement)==null?void 0:re.closest)==null?void 0:xe.call(re,".xterm-helper-textarea"))!=null||((Xe=(ye=document.activeElement)==null?void 0:ye.classList)==null?void 0:Xe.contains("xterm-helper-textarea"));if(!Z&&!se){j.preventDefault();const rt=de[U-1];rt&&(Ie(),g(rt.tabKey))}};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[de,Ie,g]),b.useEffect(()=>{const O=H3.on("status_event",j=>{var se;const U=Ur(j.ideType||"");let V="",Z="info";if(j.event==="agent:generating_completed"){const le=j.duration?` (${j.duration}s)`:"";V=`✅ ${U} agent task completed${le}`,Z="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}if(j.ideId){const me={role:"system",timestamp:Date.now(),content:`✅ Task completed${le}`,_localId:`sys_complete_${Date.now()}`};W(re=>{for(const xe of Object.keys(re))if(xe.includes(j.ideId))return{...re,[xe]:[...re[xe]||[],me]};return re})}}else if(j.event==="agent:generating_started")j.ideId&&W(le=>{const me={...le};for(const re of Object.keys(me))re.includes(j.ideId)&&(me[re]=(me[re]||[]).filter(xe=>{var ye;return!(xe.role==="system"&&((ye=xe._localId)!=null&&ye.startsWith("sys_complete_")))}));return me});else if((j.event==="agent:waiting_approval"||j.event==="agent:approval_needed")&&(V=`⚡ ${U} approval needed`,Z="warning",j.ideId)){const le=j.modalMessage||"Approval requested",me=(se=j.modalButtons)!=null&&se.length?j.modalButtons.map(xe=>`[${xe}]`).join(" "):"[Approve] [Reject]",re={role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${le}
168
+ ${me}`,_localId:`sys_approval_${Date.now()}`};W(xe=>{for(const ye of Object.keys(xe))if(ye.includes(j.ideId))return{...xe,[ye]:[...xe[ye]||[],re]};return xe})}if(V){const le=Date.now();l(me=>[...me.slice(-4),{id:le,message:V,type:Z,timestamp:le,ideId:j.ideId}]),setTimeout(()=>l(me=>me.filter(re=>re.id!==le)),5e3)}});return()=>O()},[]),b.useEffect(()=>{var j;const O=U=>{const V=U.data;(V==null?void 0:V.type)==="notification_action"&&V.action==="approve"&&V.ideId&&e(V.ideId,"resolve_action",{action:"approve",button:"Approve"}).catch(Z=>console.error("[SW Action] approve failed:",Z))};return(j=navigator.serviceWorker)==null||j.addEventListener("message",O),()=>{var U;return(U=navigator.serviceWorker)==null?void 0:U.removeEventListener("message",O)}},[]);const Br=async()=>{if(!B)return;const O=_.trim();if(!O)return;const j=B.ideId,U=B.tabKey;v(""),Nt(U,[100,500,1500,3e3]);const V=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,Z={role:"user",content:O,timestamp:Date.now(),_localId:V};W(se=>({...se,[U]:[...se[U]||[],Z]}));try{if(nr(B)&&!Dr(B)){const se=j||B.daemonId||"";if(!se)return;const le=B.ideType||B.agentType||"";await e(se,"agent_command",{agentType:le,cliType:le,action:"send_chat",message:O,text:O})}else if(Dr(B)){const se=j||B.daemonId||"";if(!se)return;await e(se,"send_chat",{message:O,text:O,agentType:B.agentType})}else{const se=j||B.daemonId||"";if(!se)return;await e(se,"send_chat",{message:O,text:O,...B.streamSource==="agent-stream"&&{agentType:B.agentType}})}setTimeout(()=>{const se=Date.now()-6e4;W(le=>{const me=le[U];if(!me)return le;const re=me.filter(xe=>xe.timestamp>se);return re.length===me.length?le:{...le,[U]:re}})},6e4)}catch(se){console.error("Send failed",se),v(O),W(le=>({...le,[U]:(le[U]||[]).filter(me=>me._localId!==V)}))}},Or=async()=>{if(B)try{ge?await e(B.ideId,"launch_ide",{ideType:B.ideType,enableCdp:!0}):await e(B.ideId,"vscode_command_exec",{commandId:"adhdev.relaunchWithCdp",args:[{force:!0}]})}catch(O){console.error("Relaunch failed",O)}},mn=async O=>{try{await e("standalone","launch_ide",{ideType:O,enableCdp:!0})}catch(j){console.error("Launch failed",j)}},hr=async O=>{if(B){console.log("[ModalButton] ideId:",B.ideId,"button:",O,"agentType:",B.agentType,"source:",B.streamSource),I(j=>[...j,{ideId:B.tabKey,text:`🖱️ **${O}** clicked`,timestamp:Date.now()}]);try{let j;if(nr(B)&&!Dr(B)){const V=(B.modalButtons||[]).indexOf(O),Z=O.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase();let se;V>=0?se=`${V+1}\r`:/^(deny|no|reject|cancel)/.test(Z)?se="3\r":/always/.test(Z)?se="2\r":se="1\r";const le=B.daemonId||B.ideId,me=B.ideType||B.agentType||"";Yg.sendPtyInput(le,me,se)||await e(le,"pty_input",{cliType:me,data:se}),j={success:!0}}else{const U=O.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),V=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(U),Z=B.ideId||B.daemonId||"";j=await e(Z,"resolve_action",{button:O,action:V?"approve":"reject",...B.streamSource==="agent-stream"&&{agentType:B.agentType}})}console.log("[ModalButton] result:",j),j.success||I(U=>[...U,{ideId:B.tabKey,text:`⚠️ **${O}** failed — button not found`,timestamp:Date.now()}])}catch(j){console.error("[ModalButton] Error:",j),I(U=>[...U,{ideId:B.tabKey,text:`❌ **${O}** error`,timestamp:Date.now()}])}}},Cr=async(O,j)=>{try{const U=O||(B==null?void 0:B.daemonId)||"",V=await e(U,"switch_chat",{id:j,sessionId:j,...(B==null?void 0:B.streamSource)==="agent-stream"&&{agentType:B==null?void 0:B.agentType}}),Z=V==null?void 0:V.result;(V==null?void 0:V.success)===!0||Z==="switched"||Z==="switched-by-title"||(Z===!1||Z==="not_found"?l(le=>[...le,{id:Date.now(),message:"⚠️ Session tab not found — try refreshing history",type:"warning",timestamp:Date.now()}]):typeof Z=="string"&&Z.startsWith("error:")?l(le=>[...le,{id:Date.now(),message:`⚠️ Switch error: ${Z}`,type:"warning",timestamp:Date.now()}]):l(le=>[...le,{id:Date.now(),message:"⚠️ Session switch failed",type:"warning",timestamp:Date.now()}]))}catch(U){console.error("Switch failed",U),l(V=>[...V,{id:Date.now(),message:`❌ Switch failed: ${U.message||"connection error"}`,type:"warning",timestamp:Date.now()}])}},ft=async()=>{if(!(!B||J)){N(!0);try{const O=B.ideId||B.daemonId||"";await e(O,"new_chat",{...B.streamSource==="agent-stream"&&{agentType:B.agentType}}),F(j=>({...j,[B.tabKey]:Date.now()})),W(j=>({...j,[B.tabKey]:[]}))}catch(O){console.error("New chat failed",O)}finally{N(!1)}}},[ee,ae]=b.useState(!1),T=async()=>{if(!B||ee)return;ae(!0);const O=B.tabKey;try{await e(B.ideId,"agent_stream_focus",{agentType:B.agentType}),Nt(O,[200,1500,3e3])}catch(j){console.error("Focus agent failed",j)}finally{ae(!1)}},q=async()=>{var O;if(!(!B||M)){z(!0);try{const j=B.ideId||B.daemonId||"",U=await e(j,"list_chats",{forceExpand:!0,...B.streamSource==="agent-stream"&&{agentType:B.agentType}}),V=(U==null?void 0:U.chats)||((O=U==null?void 0:U.result)==null?void 0:O.chats);U!=null&&U.success&&Array.isArray(V)&&r(B.ideId,V)}catch(j){console.error("Refresh history failed",j)}finally{z(!1)}}};return p.jsxs("div",{className:"page-dashboard flex-1 min-h-0 bg-bg-primary text-text-primary flex flex-col overflow-hidden",children:[p.jsx(L3,{wsStatus:a,showReconnected:d}),p.jsx(D3,{activeConv:B,agentCount:X.length,wsStatus:a,isConnected:c,onOpenHistory:()=>C(!0)}),p.jsx(A3,{sortedConversations:de,activeTabId:f,tabsOverflow:S,tabsContainerRef:$,terminalRef:H,onSelectTab:O=>{be.current=!0,g(O)},onReorder:pe,pinTab:Nt,clearTabPinTimers:Ie,retryConnection:u}),p.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden relative",children:B?p.jsxs(p.Fragment,{children:[p.jsx(P1,{activeConv:B,onModalButton:hr}),p.jsx("div",{className:"desktop-only px-3 pt-1 pb-2",children:!nr(B)&&!Dr(B)&&n[B.ideId]?p.jsx(N3,{screenshotUrl:n[B.ideId],mode:"preview",onDismiss:()=>{const O={...n};delete O[B.ideId],i(O)}}):!nr(B)&&!Dr(B)&&B.cdpconnected===!1?p.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 py-2 bg-yellow-500/[0.08] border border-yellow-500/20 rounded-lg text-xs text-text-secondary",children:[p.jsx("span",{className:"text-sm",children:"⚠️"}),p.jsx("span",{className:"flex-1",children:"CDP not connected — chat history & screenshots unavailable for this IDE."}),p.jsx("button",{className:"btn btn-sm bg-yellow-500/15 text-yellow-500 border border-yellow-500/30 text-[10px] whitespace-nowrap shrink-0",onClick:Or,children:"Relaunch with CDP"})]}):null}),nr(B)&&!Dr(B)?p.jsx(P3,{activeConv:B,ptyBuffers:kr,terminalRef:H,agentInput:_,setAgentInput:v,handleSendChat:Br,handleModalButton:hr}):p.jsx(L1,{activeConv:B,ides:s,agentInput:_,setAgentInput:v,handleSendChat:Br,handleFocusAgent:T,isFocusingAgent:ee,messageReceivedAt:y,actionLogs:D})]}):p.jsxs("div",{className:"empty-dashboard",children:[p.jsx("div",{className:"glow-orb",children:p.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-12 h-12"})}),p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"font-bold text-lg mb-1.5",children:"No IDE connected"}),p.jsx("div",{className:"text-[13px] text-text-muted",style:{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",{className:"flex flex-wrap gap-2 justify-center",children:k.filter(O=>O.running||!0).map(O=>p.jsxs("button",{className:"btn btn-sm bg-violet-500/10 border border-violet-500/25 text-violet-400 text-xs font-semibold px-4 py-2 rounded-lg cursor-pointer flex items-center gap-1.5 transition-all",onClick:()=>mn(O.type),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 ",O.name]},O.type))})]})]})}),P&&B&&p.jsx(I3,{activeConv:B,ides:s,isCreatingChat:J,isRefreshingHistory:M,onClose:()=>C(!1),onNewChat:ft,onSwitchSession:Cr,onRefreshHistory:q}),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(xe=>{for(const we of Object.keys
177
177
  }
178
178
  100 % { transform: scale(1); box- shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
179
179
  }
180
- `}),p.jsx(C3,{toasts:o,onDismiss:B=>l(j=>j.filter(K=>K.id!==B)),onClickToast:B=>{if(B.ideId){const j=ue.find(K=>K.ideId===B.ideId||K.tabKey===B.ideId);j&&(Ke(),g(j.tabKey))}}}),p.jsx("style",{children:`
180
+ `}),p.jsx(B3,{toasts:o,onDismiss:O=>l(j=>j.filter(U=>U.id!==O)),onClickToast:O=>{if(O.ideId){const j=de.find(U=>U.ideId===O.ideId||U.tabKey===O.ideId);j&&(Ie(),g(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 I3(e){return e.split(":")[0]||""}function A3({renderHeaderActions:e}={}){var b,me,V;const{id:t}=f0(),r=cs(),n=wf(),i=n.ides||[],s=n.connectionStates||n.p2pStates||{},{sendCommand:o}=Si(),l=w.useMemo(()=>I3(t||""),[t]),a=w.useMemo(()=>i.find(H=>H.id===t),[i,t]),c=(a==null?void 0:a.type)||void 0,h=c?c.charAt(0).toUpperCase()+c.slice(1):"IDE",u=(a==null?void 0:a.activeChat)||null,d=(a==null?void 0:a.agentStreams)||[],f=s[l]||"new",m=w.useMemo(()=>i.find(H=>H.id===l||H.daemonId===l),[i,l]),g=(m==null?void 0:m.machineNickname)||((b=m==null?void 0:m.machine)==null?void 0:b.hostname)||"",x=((V=(me=a==null?void 0:a.workspaceFolders)==null?void 0:me[0])==null?void 0:V.name)||"",[_]=qw(),v=typeof window<"u"&&window.innerWidth<=768,y=_.get("view")||(v?"chat":"split"),[E,N]=w.useState(y),[k,I]=w.useState("ide"),[z,Z]=w.useState(""),[T,R]=w.useState(!1),[A,D]=w.useState(null),[U,M]=w.useState(null),[F,W]=w.useState([]),L=w.useMemo(()=>{var H,G;return{ideId:t||"",daemonId:l,agentName:Yh(c||""),agentType:c||"",status:(u==null?void 0:u.status)||"idle",title:(u==null?void 0:u.title)||"",messages:(u==null?void 0:u.messages)||[],ideType:c||"",workspaceName:(a==null?void 0:a.workspaceName)||"",displayPrimary:h,displaySecondary:(a==null?void 0:a.workspaceName)||"",cdpConnected:!0,modalButtons:(H=u==null?void 0:u.activeModal)==null?void 0:H.buttons,modalMessage:(G=u==null?void 0:u.activeModal)==null?void 0:G.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,u,a,h]);w.useEffect(()=>l?ti.onScreenshot("ide-page",(G,he)=>{if(G!==l)return;const ue=new FileReader;ue.onload=()=>D(ue.result),ue.readAsDataURL(he)}):void 0,[l]),w.useEffect(()=>l?ti.onStatusEvent((G,he)=>{if(G!==l)return;let ue="",ge="info";if(he.event==="agent:generating_completed"?(ue=`✅ Task completed${he.duration?` (${he.duration}s)`:""}`,ge="success"):(he.event==="agent:waiting_approval"||he.event==="agent:approval_requested")&&(ue="⚡ Approval needed",ge="warning"),ue){const O=Date.now();W(ve=>[...ve.slice(-4),{id:O,message:ue,type:ge}]),setTimeout(()=>W(ve=>ve.filter(Ke=>Ke.id!==O)),ge==="warning"?1e4:5e3)}}):void 0,[l]),w.useEffect(()=>{const H=l?ti.get(l):null;!H||!(f==="connected")||(E!=="chat"?H.startScreenshots(c):H.stopScreenshots(c))},[E,f,c,l]);const $=w.useCallback(async(H,G={})=>{if(!t)throw new Error("No IDE ID");const he={...G};if(!he._targetInstance&&t){const ge=t.split(":");ge.length>=3&&(ge[1]==="ide"||ge[1]==="cli")&&(he._targetInstance=ge.slice(2).join(":"),he._targetType=ge[1])}const ue=l?ti.get(l):null;return ue!=null&&ue.hasCommandChannel?await ue.sendCommand(H,he):ue&&ue.connectionState!=="failed"&&ue.connectionState!=="closed"&&await new Promise(O=>{const Ue=Date.now(),ve=()=>{if(ue.hasCommandChannel)return O(!0);if(Date.now()-Ue>3e3)return O(!1);setTimeout(ve,200)};ve()})&&ue.hasCommandChannel?await ue.sendCommand(H,he):await o(t,H,he)},[t,l]),S=async()=>{const H=z.trim();if(!(!H||!t||T)){Z(""),R(!0);try{await $("send_chat",{message:H,waitForResponse:!0})}catch(G){console.error("[IDE] Send failed:",G)}finally{R(!1)}}},ne=async H=>{if(t)try{const G=await o(t,"screenshot",{width:H?Math.min(H,1280):1280});G!=null&&G.success&&(G!=null&&G.base64)&&M(`data:image/jpeg;base64,${G.base64}`)}catch(G){console.error("[IDE] Screenshot failed:",G)}},oe=d.length>0;return t?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:h}),x&&p.jsx("span",{className:"ide-workspace",children:x}),p.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),p.jsxs("div",{className:"ide-status-pill",children:[p.jsx("span",{className:`ide-dot ${f==="connected"?"online":"connecting"}`}),p.jsx("span",{className:"ide-status-text",children:f==="connected"?"Connected":f==="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(H=>p.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:E===H?"1px solid var(--accent-primary)":"none",background:E===H?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:E===H?"var(--accent-primary)":void 0},onClick:()=>N(H),children:H==="chat"?"💬":H==="split"?"⊞":"🖥"},H)),e&&e({daemonId:l,ideInstanceId:t||""}),p.jsx("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs",onClick:()=>r("/dashboard"),children:"← Back"})]})]}),p.jsxs("div",{className:"ide-content",children:[p.jsxs("div",{className:`ide-chat-panel ${E==="chat"?"full":""} ${E==="remote"?"hidden":""}`,children:[oe&&p.jsxs("div",{className:"ide-chat-tabs",children:[p.jsx("button",{className:`ide-chat-tab ${k==="ide"?"active":""}`,onClick:()=>I("ide"),children:h}),p.jsxs("button",{className:`ide-chat-tab ext ${k==="extensions"?"active":""}`,onClick:()=>I("extensions"),children:["Extensions ",p.jsx("span",{className:"ide-ext-badge",children:d.length})]})]}),k==="extensions"&&oe?p.jsx(GT,{ideId:t,agentStreams:d,sendCommand:async(H,G)=>{try{const he=l?ti.get(l):null;if(he&&f==="connected"){await Promise.race([he.sendCommand(H,G),new Promise((ue,ge)=>setTimeout(()=>ge(new Error("connection timeout")),3e3))]);return}}catch{}await o(t,H,G)}}):p.jsx(x1,{activeConv:L,ides:i,agentInput:z,setAgentInput:Z,handleSendChat:S,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[]})]}),p.jsx("div",{className:`ide-remote-panel ${E==="remote"?"full":""} ${E==="chat"?"hidden":""}`,children:p.jsx(m3,{screenshot:U,isCapturing:!1,onRefresh:ne,addLog:()=>{},connState:f,connScreenshot:A,onAction:async(H,G)=>{const he=l?ti.get(l):null;if(he&&f==="connected")try{return await he.sendInput(H,G)}catch(ue){console.error("[Connection Input] Failed:",ue)}return await o(t,"cdp_remote_action",{action:H,params:G})}})})]}),F.length>0&&p.jsx("div",{className:"ide-toasts",children:F.map(H=>p.jsx("div",{className:`ide-toast ${H.type}`,onClick:()=>W(G=>G.filter(he=>he.id!==H.id)),children:H.message},H.id))})]}):p.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function B3(){var Ze,nt,Xt,jt,$o,Ho,Wo,Uo,Vn;const{id:e}=f0(),t=cs(),{sendCommand:r}=Si(),n=r,i=wf(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=w.useState([]),[c,h]=w.useState([]),[u,d]=w.useState(0),[f,m]=w.useState(!0),[g,x]=w.useState("debug"),[_,v]=w.useState(null),[y,E]=w.useState([]),[N,k]=w.useState(!1),[I,z]=w.useState(""),[Z,T]=w.useState(""),[R,A]=w.useState(""),[D,U]=w.useState(""),[M,F]=w.useState("overview"),[W,L]=w.useState([]),[$,S]=w.useState(!1),[ne,oe]=w.useState(!1),[b,me]=w.useState(""),[V,H]=w.useState([]),[G,he]=w.useState(!1),[ue,ge]=w.useState(null),[O,Ue]=w.useState("all"),ve=w.useRef(null),Ke=w.useRef(!1);w.useEffect(()=>{if(!e||M!=="logs"||!f)return;const C=async()=>{try{const ye=await r(e,"get_logs",{count:200,minLevel:g,since:u}),Te=(ye==null?void 0:ye.result)||ye;if(ye!=null&&ye.success&&Array.isArray(Te==null?void 0:Te.logs)&&Te.logs.length>0){h(Je=>[...Je,...Te.logs.map(ki=>({timestamp:ki.ts,level:ki.level,message:`[${ki.category}] ${ki.message}`}))].slice(-300));const je=Math.max(...Te.logs.map(Je=>Je.ts));d(je)}}catch{}};C();const Q=setInterval(C,3e3);return()=>clearInterval(Q)},[e,M,f,u,g]),w.useEffect(()=>{if(f&&c.length>0){const C=Ke.current?"smooth":"instant";setTimeout(()=>{var Q;(Q=ve.current)==null||Q.scrollIntoView({behavior:C}),Ke.current=!0},50)}},[c.length,l.length,f]),w.useEffect(()=>{M!=="logs"&&(Ke.current=!1)},[M]);const Ot=async()=>{var C;if(e){he(!0);try{const Q=await r(e,"get_provider_settings",{}),ye=(Q==null?void 0:Q.result)||Q;if(Q!=null&&Q.success&&(ye!=null&&ye.settings)){const Te=[];for(const[je,Je]of Object.entries(ye.settings)){const gt=Or.find(ki=>ki.type===je);Te.push({type:je,displayName:(gt==null?void 0:gt.displayName)||je,icon:(gt==null?void 0:gt.icon)||"🔧",category:(gt==null?void 0:gt.category)||"unknown",schema:Je,values:((C=ye.values)==null?void 0:C[je])||{}})}Te.sort((je,Je)=>je.category.localeCompare(Je.category)||je.displayName.localeCompare(Je.displayName)),H(Te)}}catch{}he(!1)}};w.useEffect(()=>{M==="providers"&&V.length===0&&Ot()},[M]);const qt=async(C,Q,ye)=>{ge(`${C}.${Q}`),H(Te=>Te.map(je=>je.type===C?{...je,values:{...je.values,[Q]:ye}}:je));try{const Te=await r(e,"set_provider_setting",{providerType:C,key:Q,value:ye});Te!=null&&Te.success||Ot()}catch{Ot()}ge(null)},De=s.find(C=>C.id===e&&C.daemonMode),ke=De?{id:De.id,hostname:((Ze=De.machine)==null?void 0:Ze.hostname)||De.id,platform:((nt=De.machine)==null?void 0:nt.platform)||"unknown",arch:((Xt=De.machine)==null?void 0:Xt.arch)||"",cpus:((jt=De.machine)==null?void 0:jt.cpus)||0,totalMem:(($o=De.machine)==null?void 0:$o.totalMem)||0,freeMem:((Ho=De.machine)==null?void 0:Ho.freeMem)||0,loadavg:((Wo=De.machine)==null?void 0:Wo.loadavg)||[],uptime:((Uo=De.machine)==null?void 0:Uo.uptime)||0,release:((Vn=De.machine)==null?void 0:Vn.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,Or=(De==null?void 0:De.availableProviders)||[],Zr={};for(const C of Or)Zr[C.type]=C.icon;const Pt=C=>Zr[C]||"💻",Yt=Or.filter(C=>C.category==="cli"||C.category==="acp");w.useEffect(()=>{!R&&Yt.length>0&&A(Yt[0].type)},[R,Yt.length]);const Qe=s.filter(C=>C.daemonId===e&&!C.daemonMode).filter(C=>!Bg(C)).map(C=>({id:C.id,type:C.type,version:C.version||"",instanceId:C.instanceId||"",status:C.status,workspaceFolders:C.workspaceFolders||[],activeFile:C.activeFile||null,terminals:C.terminals||0,aiAgents:w3(C.aiAgents||C.agents||[]),activeChat:C.activeChat||null,chats:C.chats||[],agentStreams:C.agentStreams||[],cdpconnected:C.cdpconnected||!1,daemonId:e})),J=s.filter(C=>C.daemonId===e&&Bg(C)).map(C=>{var Q,ye;return{id:C.id,type:C.type,cliName:C.cliName||C.type,status:C.status,workingDir:C.workingDir||((ye=(Q=C.workspaceFolders)==null?void 0:Q[0])==null?void 0:ye.path)||"",activeChat:C.activeChat||null,daemonId:e}}),pe=((ke==null?void 0:ke.detectedIdes)||[]).filter(C=>!C.running&&!Qe.some(Q=>(Q.type||"").toLowerCase()===(C.type||"").toLowerCase())),P=(C,Q)=>{a(ye=>[...ye.slice(-100),{timestamp:Date.now(),level:C,message:Q}]),setTimeout(()=>{var ye;return(ye=ve.current)==null?void 0:ye.scrollIntoView({behavior:"smooth"})},100)},X=async C=>{if(!(!e||_)){v(C),P("info",`Launching ${Ur(C)}...`);try{const Q=await r(e,"launch_ide",{ideType:C,enableCdp:!0});P(Q!=null&&Q.success?"info":"error",Q!=null&&Q.success?`${Ur(C)} launched`:`Failed: ${Q==null?void 0:Q.error}`)}catch(Q){P("error",`Launch error: ${Q.message}`)}finally{v(null)}}},B=async(C,Q,ye,Te)=>{if(e){P("info",`Launching ${C}${Q?` in ${Q}`:""}${Te?` (model: ${Te})`:""}...`);try{const je=ye?ye.split(/\s+/).filter(Boolean):void 0,Je=await r(e,"launch_cli",{cliType:C,dir:Q||void 0,cliArgs:je,initialModel:Te||void 0}),gt=(Je==null?void 0:Je.result)||Je;Je!=null&&Je.success?(P("info",`${C} launched`),gt!=null&&gt.defaultedToHome&&P("info",`📂 No directory specified — running in home directory (${gt.dir||"~"})`)):P("error",`Failed: ${(Je==null?void 0:Je.error)||(gt==null?void 0:gt.error)}`)}catch(je){P("error",`Launch error: ${je.message}`)}}},j=async(C,Q)=>{if(e&&window.confirm(`Stop ${C}?
186
- This will terminate the CLI process.`))try{await r(e,"stop_cli",{cliType:C,dir:Q}),P("info",`${C} stopped`)}catch(ye){P("error",`Stop failed: ${ye.message}`)}},K=async C=>{try{await r(C.id,"restart_session",{ideType:C.type}),P("info",`${Ur(C.type)} restart initiated`)}catch(Q){P("error",`Restart failed: ${Q.message}`)}},Y=async()=>{if(e)try{const C=await r(e,"detect_ides",{});P("info",`Found ${((C==null?void 0:C.result)||[]).length} IDE(s)`)}catch(C){P("error",`Detection failed: ${C.message}`)}},ee=async()=>{if(e){k(!0);try{const C=await r(e,"get_recent_workspaces",{});C!=null&&C.success&&Array.isArray(C==null?void 0:C.result)&&E(C.result)}catch(C){P("error",`Failed: ${C.message}`)}finally{k(!1)}}},se=async()=>{var C;if(e){S(!0);try{const Q=await n(e,"get_cli_history");Q.success&&((C=Q.result)!=null&&C.history)&&L(Q.result.history)}catch{}S(!1)}},le=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:b}),P("info",`Nickname set to "${b||"(cleared)"}"`),oe(!1)}catch(C){P("error",`Failed: ${C.message}`)}};if(!ke)return o?p.jsxs("div",{className:"p-10 text-center text-slate-500",children:[p.jsx("h2",{className:"text-slate-100",children:"Machine not found"}),p.jsx("p",{className:"mt-3",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",{className:"p-10 text-center text-slate-500",children:p.jsx("p",{children:"⏳ Loading machine..."})});const fe=ke.totalMem>0?Math.round((ke.totalMem-ke.freeMem)/ke.totalMem*100):0,ae=ke.loadavg[0]||0,xe=ke.machineNickname||ke.hostname,we=[{id:"overview",label:"📊 Overview"},{id:"ides",label:"💻 IDEs",count:Qe.length},{id:"clis",label:"🔌 CLIs",count:J.length},{id:"providers",label:"⚙️ Providers",count:V.length>0?V.length:void 0},{id:"logs",label:"📋 Logs",count:l.length>0?l.length:void 0}];return p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsxs("div",{className:"px-6 py-4 border-b border-white/[0.06] bg-surface-primary",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3.5",children:[p.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"←"}),p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2",children:[ne?p.jsxs("div",{className:"flex gap-1.5 items-center",children:[p.jsx("input",{autoFocus:!0,value:b,onChange:C=>me(C.target.value),onKeyDown:C=>{C.key==="Enter"&&le(),C.key==="Escape"&&oe(!1)},placeholder:"Machine nickname...",className:"px-2.5 py-1 rounded-md border border-violet-500/30 bg-slate-950/80 text-slate-100 text-sm font-semibold w-[200px]"}),p.jsx("button",{onClick:le,className:"machine-btn text-green-500 border-green-500/30",children:"✓"}),p.jsx("button",{onClick:()=>oe(!1),className:"machine-btn",children:"✕"})]}):p.jsx("h1",{className:"text-lg font-bold text-slate-100 m-0 cursor-pointer",onClick:()=>{oe(!0),me(ke.machineNickname||"")},title:"Click to set nickname",children:xe}),p.jsx("span",{className:"status-dot-md online"})]}),p.jsxs("div",{className:"text-[11px] text-slate-500 mt-0.5 flex gap-2 items-center",children:[p.jsxs("span",{children:[ke.platform," · ",ke.arch," · ",ke.cpus," cores"]}),ke.p2p.available&&p.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:ke.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:ke.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",ke.p2p.state==="connected"?`● ${ke.p2p.peers}`:"○"]}),ke.cdpconnected&&p.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500",children:"CDP ●"}),ke.machineNickname&&p.jsxs("span",{className:"text-slate-600",children:["(",ke.hostname,")"]})]})]})]}),p.jsx("button",{onClick:Y,className:"machine-btn-primary",title:"Re-detect installed IDEs",children:"🔍 Scan IDEs"})]}),p.jsx("div",{className:"machine-tabs",children:we.map(C=>p.jsxs("button",{onClick:()=>F(C.id),className:`machine-tab${M===C.id?" active":""}`,children:[C.label,C.count!==void 0&&p.jsx("span",{className:"tab-count",children:C.count})]},C.id))})]}),p.jsxs("div",{className:"page-content",children:[M==="overview"&&p.jsxs("div",{children:[p.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[p.jsx(Mg,{icon:"⏱",label:"Uptime",value:S3(ke.uptime)}),p.jsx(Mg,{icon:"💻",label:"IDEs",value:`${Qe.length}`,sub:`${J.length} CLIs`})]}),p.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-slate-950/50 border border-white/[0.06]",children:[p.jsx("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),p.jsxs("div",{className:"flex gap-6",children:[p.jsx(Ig,{value:Math.min(Math.round(ae/ke.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${ae.toFixed(2)} avg / ${ke.cpus} cores`}),p.jsx(Ig,{value:fe,max:100,label:"Memory",color:"#3b82f6",detail:`${Ag(ke.totalMem-ke.freeMem)} / ${Ag(ke.totalMem)}`})]})]}),p.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[p.jsxs("div",{className:"px-5 py-4 rounded-xl bg-slate-950/50 border border-white/[0.06]",children:[p.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider",children:"IDEs"}),p.jsx("button",{onClick:()=>F("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),Qe.length===0?p.jsx("div",{className:"text-xs text-slate-600 italic",children:"No IDEs running"}):p.jsx("div",{className:"flex flex-col gap-1.5",children:Qe.map(C=>{var ye,Te,je;const Q=(C.agentStreams||[]).some(Je=>Je.status==="generating"||Je.status==="streaming")||((ye=C.activeChat)==null?void 0:ye.status)==="generating";return p.jsxs("div",{onClick:()=>t(`/ide/${C.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${Q?"bg-orange-500/[0.04] border border-orange-500/10":"bg-white/[0.02] border border-transparent"}`,children:[p.jsx("span",{children:Pt(C.type)}),p.jsx("span",{className:"text-xs text-slate-200 font-medium",children:Ur(C.type)}),p.jsx("span",{className:"text-[10px] text-slate-600 overflow-hidden text-ellipsis whitespace-nowrap",children:((je=(Te=C.workspaceFolders)==null?void 0:Te[0])==null?void 0:je.name)||""}),Q&&p.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),p.jsx("span",{className:`${Q?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:Q?"#fb923c":"#22c55e",boxShadow:Q?"0 0 8px rgba(249,115,22,0.4)":"none",animation:Q?"pulse-dot 1.5s infinite":"none"}})]},C.id)})})]}),p.jsxs("div",{className:"px-5 py-4 rounded-xl bg-slate-950/50 border border-white/[0.06]",children:[p.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider",children:"CLIs"}),p.jsx("button",{onClick:()=>F("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),J.length===0?p.jsx("div",{className:"text-xs text-slate-600 italic",children:"No CLIs running"}):p.jsx("div",{className:"flex flex-col gap-1.5",children:J.map(C=>p.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-white/[0.02]",children:[p.jsx("span",{children:Pt(C.type)}),p.jsx("span",{className:"text-xs text-slate-200 font-medium",children:C.cliName}),p.jsx("span",{className:"text-[10px] text-slate-600 overflow-hidden text-ellipsis whitespace-nowrap",children:C.workingDir.split("/").pop()}),p.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:C.status==="stopped"?"#ef4444":"#22c55e"}})]},C.id))})]})]}),ke.detectedIdes.length>0&&p.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-slate-950/50 border border-white/[0.06]",children:[p.jsx("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:ke.detectedIdes.map(C=>p.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${C.running?"bg-green-500/[0.06] border border-green-500/[0.12] text-green-300":"bg-white/[0.02] border border-white/[0.04] text-slate-500"}`,children:[p.jsx("span",{children:Pt(C.type)}),C.name||C.type,p.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:C.running?"#22c55e":"#475569"}})]},C.type))})]})]}),M==="ides"&&p.jsxs("div",{children:[p.jsxs("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2.5",children:["Running (",Qe.length,")"]}),Qe.length===0?p.jsx("div",{className:"py-10 px-5 text-center rounded-xl bg-slate-950/40 border border-dashed border-white/[0.06] text-slate-600 text-[13px] mb-5",children:"No IDEs currently running. Launch one below."}):p.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:Qe.map(C=>{var Q,ye;return p.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-slate-950/50 border border-white/[0.06]",children:[p.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-lg",children:Pt(C.type)}),p.jsx("span",{className:"font-semibold text-sm text-slate-100",children:Ur(C.type)}),C.version&&p.jsxs("span",{className:"text-[10px] text-slate-600",children:["v",C.version]}),p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),p.jsxs("div",{className:"flex gap-1.5",children:[p.jsx("button",{onClick:()=>t(`/ide/${C.id}`),className:"machine-btn",children:"🖥 Control"}),p.jsx("button",{onClick:()=>K(C),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"})]})]}),p.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(130px,1fr))] gap-1.5 text-xs text-slate-400",children:[p.jsxs("div",{children:[p.jsx("span",{className:"text-slate-500",children:"Workspace:"})," ",((Q=C.workspaceFolders)==null?void 0:Q.map(Te=>Te.name).join(", "))||"—"]}),p.jsxs("div",{children:[p.jsx("span",{className:"text-slate-500",children:"File:"})," ",((ye=C.activeFile)==null?void 0:ye.split("/").pop())||"—"]}),p.jsxs("div",{children:[p.jsx("span",{className:"text-slate-500",children:"Terminals:"})," ",C.terminals]}),p.jsxs("div",{children:[p.jsx("span",{className:"text-slate-500",children:"CDP:"})," ",C.cdpconnected?"● connected":"○ Off"]})]}),C.aiAgents.length>0&&p.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:C.aiAgents.map(Te=>p.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${Te.status==="generating"||Te.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[Te.name," · ",Te.status]},Te.id))})]},C.id)})}),p.jsxs("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2.5",children:["Available to Launch (",pe.length,")"]}),p.jsxs("div",{className:"flex flex-wrap gap-2",children:[pe.map(C=>p.jsxs("button",{onClick:()=>X(C.type||C.id||""),disabled:!!_,className:"machine-btn-primary flex items-center gap-1.5",style:{opacity:_&&_!==C.type?.4:1},children:[p.jsx("span",{children:Pt(C.type)}),_===C.type?"⏳ Launching...":`▶ ${C.name||Ur(C.type)}`]},C.type)),pe.length===0&&p.jsxs("div",{className:"text-xs text-slate-600 italic",children:["All detected IDEs are running, or none detected.",p.jsx("button",{onClick:Y,className:"machine-btn ml-2",children:"🔍 Scan"})]})]})]}),M==="clis"&&p.jsxs("div",{children:[p.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-slate-950/50 border border-violet-500/[0.12]",children:[p.jsx("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2.5",children:"Launch New CLI"}),p.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[p.jsx("select",{value:R,onChange:C=>A(C.target.value),className:"machine-input",children:Yt.length>0?Yt.map(C=>p.jsxs("option",{value:C.type,children:[C.icon," ",C.displayName]},C.type)):p.jsx("option",{value:"",disabled:!0,children:"No providers available"})}),p.jsx("input",{type:"text",placeholder:"Working directory...",value:I,onChange:C=>z(C.target.value),className:"machine-input flex-1 min-w-[200px]"}),p.jsx("input",{type:"text",placeholder:"Args (optional)",value:Z,onChange:C=>T(C.target.value),className:"machine-input min-w-[150px]"}),(()=>{const C=Yt.find(Q=>Q.type===R);return(C==null?void 0:C.category)==="acp"?p.jsx("input",{type:"text",placeholder:"Model (default)",value:D,onChange:Q=>U(Q.target.value),className:"machine-input min-w-[120px]"}):null})(),p.jsx("button",{onClick:()=>B(R,I,Z||void 0,D||void 0),className:"machine-btn-primary",children:"▶ Launch"})]})]}),p.jsxs("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2.5",children:["Running (",J.length,")"]}),J.length===0?p.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-slate-950/40 border border-dashed border-white/[0.06] text-slate-600 text-[13px] mb-5",children:"No CLIs running"}):p.jsx("div",{className:"flex flex-col gap-2 mb-5",children:J.map(C=>p.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-slate-950/50 border border-white/[0.06] flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2.5",children:[p.jsx("span",{className:"text-lg",children:Pt(C.type)}),p.jsxs("div",{children:[p.jsx("div",{className:"font-semibold text-[13px] text-slate-100",children:C.cliName}),p.jsx("div",{className:"text-[11px] text-slate-500",children:C.workingDir})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${C.status==="stopped"?"bg-red-500/[0.08] text-red-500":"bg-green-500/[0.08] text-green-500"}`,children:C.status}),C.status==="stopped"?p.jsx("button",{onClick:()=>B(C.type,C.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):p.jsx("button",{onClick:()=>j(C.type,C.workingDir),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},C.id))}),p.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider",children:"History"}),p.jsx("button",{onClick:se,disabled:$,className:"machine-btn",children:$?"⏳":"↻ Load"})]}),W.length>0&&p.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:W.map((C,Q)=>{var ye,Te;return p.jsxs("div",{onClick:()=>{A(C.cliType),z(C.dir),T((C.cliArgs||[]).join(" "))},className:"flex justify-between items-center px-2.5 py-1.5 rounded-md cursor-pointer bg-white/[0.02] border border-white/[0.04] text-xs transition-[background] duration-150",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",{className:"flex gap-1.5 items-center text-slate-400",children:[p.jsx("span",{children:Pt(C.cliType)}),p.jsx("span",{children:((ye=C.dir)==null?void 0:ye.split("/").filter(Boolean).pop())||"root"}),((Te=C.cliArgs)==null?void 0:Te.length)>0&&p.jsx("span",{className:"text-slate-600 text-[10px]",children:C.cliArgs.join(" ")})]}),p.jsx("span",{className:"text-slate-600 text-[10px]",children:C.timestamp?new Date(C.timestamp).toLocaleDateString():""})]},Q)})}),p.jsxs("div",{className:"mt-5",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),p.jsx("button",{onClick:ee,disabled:N,className:"machine-btn",children:N?"⏳":"↻ Load"})]}),y.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.map((C,Q)=>p.jsxs("button",{onClick:()=>z(C),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:C,children:["📂 ",C.split("/").filter(Boolean).pop()||C]},Q))})]})]}),M==="providers"&&p.jsxs("div",{children:[p.jsxs("div",{className:"flex justify-between items-center mb-4",children:[p.jsxs("div",{className:"flex gap-1 items-center",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(C=>p.jsx("button",{onClick:()=>Ue(C),className:`machine-btn text-[10px] px-2 py-0.5 ${O===C?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:C.toUpperCase()},C))]}),p.jsx("button",{onClick:Ot,disabled:G,className:"machine-btn",children:G?"⏳ Loading...":"↻ Refresh"})]}),G&&V.length===0?p.jsx("div",{className:"p-10 text-center text-slate-600",children:"Loading provider settings..."}):p.jsx("div",{className:"flex flex-col gap-2",children:V.filter(C=>O==="all"||C.category===O).map(C=>p.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-slate-950/50 border border-white/[0.06]",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[p.jsx("span",{className:"text-lg",children:C.icon}),p.jsx("span",{className:"font-semibold text-[13px] text-slate-100",children:C.displayName}),p.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:C.category==="acp"?"rgba(139,92,246,0.08)":C.category==="cli"?"rgba(59,130,246,0.08)":C.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:C.category==="acp"?"#a78bfa":C.category==="cli"?"#60a5fa":C.category==="ide"?"#86efac":"#fbbf24"},children:C.category})]}),p.jsx("div",{className:"flex flex-col gap-2",children:C.schema.map(Q=>p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"text-xs font-medium text-slate-200",children:[Q.label||Q.key,ue===`${C.type}.${Q.key}`&&p.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),Q.description&&p.jsx("div",{className:"text-[10px] text-slate-500 mt-px",children:Q.description})]}),p.jsx("div",{className:"shrink-0",children:Q.type==="boolean"?p.jsx("button",{onClick:()=>qt(C.type,Q.key,!(C.values[Q.key]??Q.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:C.values[Q.key]??Q.default?"#8b5cf6":"rgba(255,255,255,0.08)"},children:p.jsx("div",{className:"w-4 h-4 rounded-full bg-white absolute top-[3px] transition-[left] duration-200 shadow-[0_1px_3px_rgba(0,0,0,0.3)]",style:{left:C.values[Q.key]??Q.default?21:3}})}):Q.type==="number"?p.jsx("input",{type:"number",value:C.values[Q.key]??Q.default??0,min:Q.min,max:Q.max,onChange:ye=>{const Te=parseInt(ye.target.value)||0;Q.min!==void 0&&Te<Q.min||Q.max!==void 0&&Te>Q.max||qt(C.type,Q.key,Te)},className:"machine-input w-20 text-center text-[11px]"}):Q.type==="select"&&Q.options?p.jsx("select",{value:C.values[Q.key]??Q.default??"",onChange:ye=>qt(C.type,Q.key,ye.target.value),className:"machine-input text-[11px]",children:Q.options.map(ye=>p.jsx("option",{value:ye,children:ye},ye))}):p.jsx("input",{type:"text",value:C.values[Q.key]??Q.default??"",onBlur:ye=>qt(C.type,Q.key,ye.target.value),className:"machine-input w-[120px] text-[11px]"})})]},Q.key))})]},C.type))})]}),M==="logs"&&p.jsxs("div",{children:[p.jsxs("div",{className:"flex justify-between items-center mb-3",children:[p.jsxs("div",{className:"flex gap-1 items-center",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(C=>p.jsx("button",{onClick:()=>{x(C),h([]),d(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${g===C?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:C.toUpperCase()},C))]}),p.jsxs("div",{className:"flex gap-1.5 items-center",children:[p.jsxs("span",{className:"text-[10px] text-slate-600",children:[c.length," entries"]}),p.jsx("button",{onClick:()=>m(!f),className:`machine-btn ${f?"text-green-500 border-green-500/30":""}`,children:f?"⏸ Pause":"▶ Resume"}),p.jsx("button",{onClick:()=>{h([]),d(0)},className:"machine-btn",children:"Clear"})]})]}),p.jsxs("div",{className:"bg-slate-950/60 border border-white/[0.06] rounded-xl p-3 min-h-[200px] max-h-[500px] overflow-y-auto font-mono text-[11px] leading-relaxed",children:[c.length===0&&p.jsx("div",{className:"p-10 text-center text-slate-600",children:"Loading daemon logs..."}),c.map((C,Q)=>p.jsxs("div",{className:"flex gap-2 py-px",style:{color:C.level==="error"?"#ef4444":C.level==="warn"?"#f59e0b":C.level==="debug"?"#64748b":"#94a3b8"},children:[p.jsx("span",{className:"text-slate-600 min-w-[75px] shrink-0",children:new Date(C.timestamp).toLocaleTimeString()}),p.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:C.level==="error"?"#ef4444":C.level==="warn"?"#f59e0b":C.level==="debug"?"#475569":"#8b5cf6"},children:C.level==="error"?"ERR":C.level==="warn"?"WRN":C.level==="debug"?"DBG":"INF"}),p.jsx("span",{children:C.message})]},Q)),p.jsx("div",{ref:ve})]})]})]})]})}function O3(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new URLSearchParams(window.location.search).get("token");return n?`${t}?token=${encodeURIComponent(n)}`:t}const zg=O3(),Fg=3e3,j3=3e4;let rn=null,z3=0;const wa=new Map,Xh=new Set;let Ds=null;async function Fl(e,t,r){const n=rn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++z3}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{wa.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);wa.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),n.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:r||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:r||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class F3{constructor(t){ps(this,"daemonId");ps(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(rn==null?void 0:rn.readyState)===WebSocket.OPEN}get connectionState(){return(rn==null?void 0:rn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return Fl(this.daemonId,t,r)}async sendInput(t,r){return Fl(this.daemonId,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){if(this.screenshotIdeType=t||null,Ds)return;const r=async()=>{if(this.hasCommandChannel)try{const n=await Fl(this.daemonId,"screenshot",{width:1280});if(n!=null&&n.success&&(n!=null&&n.base64)){const i=await fetch(`data:image/jpeg;base64,${n.base64}`).then(s=>s.blob());Xh.forEach(s=>s(this.daemonId,i))}}catch{}};r(),Ds=setInterval(r,2e3)}stopScreenshots(t){Ds&&(clearInterval(Ds),Ds=null)}}let Xn=null;function $3(e){(!Xn||Xn.daemonId!==e)&&(Xn=new F3(e));try{const{connectionManager:t}=require("@adhdev/web-core"),r=t.get.bind(t);t.get=n=>n===e?Xn:r(n),t.getState=n=>n===e&&(Xn==null?void 0:Xn.connectionState)||"disconnected",t.onScreenshot=n=>(Xh.add(n),()=>{Xh.delete(n)})}catch{}}function H3({children:e}){const t=w.useRef($p()),r=$p();t.current=r;const[,n]=w.useState("disconnected"),i=w.useRef(null),s=w.useRef(),o=w.useRef(Fg),l=w.useRef(!0);return w.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;n("connecting"),console.log(`[Standalone WS] Connecting to ${zg}...`);let h;try{h=new WebSocket(zg)}catch(f){console.error("[Standalone WS] Failed to create WebSocket:",f),c();return}i.current=h,h.onopen=()=>{if(!l.current){h.close();return}n("connected"),o.current=Fg,console.log("[Standalone WS] Connected")},rn=h,h.onmessage=f=>{var m;try{const g=JSON.parse(f.data);if((g.type==="command_result"||g.type==="error")&&g.requestId){const x=wa.get(g.requestId);x&&(wa.delete(g.requestId),g.type==="error"?x.reject(new Error(((m=g.data)==null?void 0:m.message)||"Command failed")):x.resolve(g.data));return}if(g.type==="status"||g.type==="initial_state"){const x=g.data;if(!x)return;const{injectEntries:_,markLoaded:v}=t.current,y=[],E=x.id||"standalone";$3(E),y.push({id:E,type:"adhdev-daemon",status:"online",daemonMode:!0,machine:{hostname:x.hostname,platform:x.platform,...x.system||{}},system:x.system||null,timestamp:x.timestamp,cdpConnected:x.cdpConnected,detectedIdes:x.detectedIdes||[],availableProviders:x.availableProviders||[],managedIdeIds:(x.ides||[]).map(N=>N.id),managedCliIds:(x.clis||[]).map(N=>N.id)});for(const N of x.ides||[])y.push({...N,daemonId:x.id||"standalone",status:N.cdpConnected?"online":"detected"});for(const N of x.clis||[])y.push({...N,daemonId:x.id||"standalone",status:N.isRunning?"running":"stopped"});y.length>0&&_(y),v()}}catch(g){console.error("[Standalone WS] Parse error:",g)}},h.onclose=()=>{l.current&&(n("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,j3),a()},h)}return a(),()=>{l.current=!1,clearTimeout(s.current),i.current&&(i.current.onclose=null,i.current.close(),i.current=null,rn=null)}},[]),p.jsx(p.Fragment,{children:e})}function W3({children:e}){return p.jsx(Xw,{children:p.jsx(H3,{children:e})})}const U3=[{id:"dashboard",path:"/dashboard",icon:"🌊",label:"Dashboard"},{id:"machine",path:"/machine",icon:"🐇",label:"Burrow"}];function K3({children:e}){const t=cs(),r=Mo(),[n,i]=w.useState(!1),[s,o]=w.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${n?" 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"})]}),n&&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 ${n?"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:U3.map(c=>p.jsxs("div",{className:`nav-item${r.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.5.3"]}),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 $g(){const{ides:e}=y0(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?p.jsx(Ll,{to:`/machines/${t.id}`,replace:!0}):e.length>0?p.jsx(Ll,{to:`/machines/${e[0].id}`,replace:!0}):p.jsx(Ll,{to:"/dashboard",replace:!0})}function V3(){return p.jsx(Vw,{children:p.jsx(W3,{children:p.jsx(Jw,{value:{sendCommand:Fl,sendData:()=>!1},children:p.jsx(K3,{children:p.jsxs(Hw,{children:[p.jsx(Zn,{path:"/dashboard",element:p.jsx(M3,{})}),p.jsx(Zn,{path:"/ide/:id",element:p.jsx(A3,{})}),p.jsx(Zn,{path:"/machine",element:p.jsx($g,{})}),p.jsx(Zn,{path:"/machines/:id",element:p.jsx(B3,{})}),p.jsx(Zn,{path:"/machines",element:p.jsx($g,{})}),p.jsx(Zn,{path:"*",element:p.jsx(Ll,{to:"/dashboard",replace:!0})})]})})})})})}n0(document.getElementById("root")).render(p.jsx(w.StrictMode,{children:p.jsx(V3,{})}));
185
+ `})]})}function K3(e){return e.split(":")[0]||""}function V3({renderHeaderActions:e}={}){var ge,X,Q;const{id:t}=b0(),r=cs(),n=wf(),i=n.ides||[],s=n.connectionStates||{},{sendCommand:o}=xi(),l=b.useMemo(()=>K3(t||""),[t]),a=b.useMemo(()=>i.find(K=>K.id===t),[i,t]),c=(a==null?void 0:a.type)||void 0,h=c?c.charAt(0).toUpperCase()+c.slice(1):"IDE",u=(a==null?void 0:a.activeChat)||null,d=(a==null?void 0:a.agentStreams)||[],f=n.isConnected??!0,m=s[l]||(f?"connected":"new"),g=b.useMemo(()=>i.find(K=>K.id===l||K.daemonId===l),[i,l]),x=(g==null?void 0:g.machineNickname)||((ge=g==null?void 0:g.machine)==null?void 0:ge.hostname)||"",_=((Q=(X=a==null?void 0:a.workspaceFolders)==null?void 0:X[0])==null?void 0:Q.name)||"",[v]=ib(),y=typeof window<"u"&&window.innerWidth<=768,E=v.get("view")||(y?"chat":"split"),[P,C]=b.useState(E),[M,z]=b.useState("ide"),[J,N]=b.useState(""),[D,I]=b.useState(!1),[R,W]=b.useState(null),[A,F]=b.useState(null),[H,L]=b.useState([]),$=b.useMemo(()=>{var K,ue;return{ideId:t||"",daemonId:l,agentName:Yh(c||""),agentType:c||"",status:(u==null?void 0:u.status)||"idle",title:(u==null?void 0:u.title)||"",messages:(u==null?void 0:u.messages)||[],ideType:c||"",workspaceName:(a==null?void 0:a.workspaceName)||"",displayPrimary:h,displaySecondary:(a==null?void 0:a.workspaceName)||"",cdpConnected:!0,modalButtons:(K=u==null?void 0:u.activeModal)==null?void 0:K.buttons,modalMessage:(ue=u==null?void 0:u.activeModal)==null?void 0:ue.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,u,a,h]);b.useEffect(()=>l?ei.onScreenshot("ide-page",(ue,de)=>{if(ue!==l)return;const pe=new FileReader;pe.onload=()=>W(pe.result),pe.readAsDataURL(de)}):void 0,[l]),b.useEffect(()=>l?ei.onStatusEvent((ue,de)=>{if(ue!==l)return;let pe="",B="info";if(de.event==="agent:generating_completed"?(pe=`✅ Task completed${de.duration?` (${de.duration}s)`:""}`,B="success"):(de.event==="agent:waiting_approval"||de.event==="agent:approval_requested")&&(pe="⚡ Approval needed",B="warning"),pe){const Re=Date.now();L(Ie=>[...Ie.slice(-4),{id:Re,message:pe,type:B}]),setTimeout(()=>L(Ie=>Ie.filter(Nt=>Nt.id!==Re)),B==="warning"?1e4:5e3)}}):void 0,[l]),b.useEffect(()=>{const K=l?ei.get(l):null;!K||!(m==="connected")||(P!=="chat"?K.startScreenshots(c):K.stopScreenshots(c))},[P,m,c,l]);const S=b.useCallback(async(K,ue={})=>{if(!t)throw new Error("No IDE ID");const de={...ue};if(!de._targetInstance&&t){const B=t.split(":");B.length>=3&&(B[1]==="ide"||B[1]==="cli")&&(de._targetInstance=B.slice(2).join(":"),de._targetType=B[1])}const pe=l?ei.get(l):null;return pe!=null&&pe.hasCommandChannel?await pe.sendCommand(K,de):pe&&pe.connectionState!=="failed"&&pe.connectionState!=="closed"&&await new Promise(Re=>{const be=Date.now(),Ie=()=>{if(pe.hasCommandChannel)return Re(!0);if(Date.now()-be>3e3)return Re(!1);setTimeout(Ie,200)};Ie()})&&pe.hasCommandChannel?await pe.sendCommand(K,de):await o(t,K,de)},[t,l]),ne=async()=>{const K=J.trim();if(!(!K||!t||D)){N(""),I(!0);try{await S("send_chat",{message:K,waitForResponse:!0})}catch(ue){console.error("[IDE] Send failed:",ue)}finally{I(!1)}}},ce=async K=>{if(t)try{const ue=await o(t,"screenshot",{width:K?Math.min(K,1280):1280});ue!=null&&ue.success&&(ue!=null&&ue.base64)&&F(`data:image/jpeg;base64,${ue.base64}`)}catch(ue){console.error("[IDE] Screenshot failed:",ue)}},k=d.length>0;return t?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:h}),_&&p.jsx("span",{className:"ide-workspace",children:_}),p.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),p.jsxs("div",{className:"ide-status-pill",children:[p.jsx("span",{className:`ide-dot ${m==="connected"?"online":"connecting"}`}),p.jsx("span",{className:"ide-status-text",children:m==="connected"?"Connected":m==="connecting"?"Connecting":"WS"})]}),x&&p.jsx("span",{className:"ide-machine-label",children:x})]}),p.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(K=>p.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:P===K?"1px solid var(--accent-primary)":"none",background:P===K?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:P===K?"var(--accent-primary)":void 0},onClick:()=>C(K),children:K==="chat"?"💬":K==="split"?"⊞":"🖥"},K)),e&&e({daemonId:l,ideInstanceId:t||""}),p.jsx("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs",onClick:()=>r("/dashboard"),children:"← Back"})]})]}),p.jsxs("div",{className:"ide-content",children:[p.jsxs("div",{className:`ide-chat-panel ${P==="chat"?"full":""} ${P==="remote"?"hidden":""}`,children:[k&&p.jsxs("div",{className:"ide-chat-tabs",children:[p.jsx("button",{className:`ide-chat-tab ${M==="ide"?"active":""}`,onClick:()=>z("ide"),children:h}),p.jsxs("button",{className:`ide-chat-tab ext ${M==="extensions"?"active":""}`,onClick:()=>z("extensions"),children:["Extensions ",p.jsx("span",{className:"ide-ext-badge",children:d.length})]})]}),M==="extensions"&&k?p.jsx(lT,{ideId:t,agentStreams:d,sendCommand:async(K,ue)=>{try{const de=l?ei.get(l):null;if(de&&m==="connected"){await Promise.race([de.sendCommand(K,ue),new Promise((pe,B)=>setTimeout(()=>B(new Error("connection timeout")),3e3))]);return}}catch{}await o(t,K,ue)}}):p.jsx(L1,{activeConv:$,ides:i,agentInput:J,setAgentInput:N,handleSendChat:ne,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[]})]}),p.jsx("div",{className:`ide-remote-panel ${P==="remote"?"full":""} ${P==="chat"?"hidden":""}`,children:p.jsx(E3,{screenshot:A,isCapturing:!1,onRefresh:ce,addLog:()=>{},connState:m,connScreenshot:R,onAction:async(K,ue)=>{const de=l?ei.get(l):null;if(de&&m==="connected")try{return await de.sendInput(K,ue)}catch(pe){console.error("[Connection Input] Failed:",pe)}return await o(t,"cdp_remote_action",{action:K,params:ue})}})})]}),H.length>0&&p.jsx("div",{className:"ide-toasts",children:H.map(K=>p.jsx("div",{className:`ide-toast ${K.type}`,onClick:()=>L(ue=>ue.filter(de=>de.id!==K.id)),children:K.message},K.id))})]}):p.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function q3(){var bf,kf,Cf,Ef,Nf,Tf,Pf,Lf,Df;const{id:e}=b0(),t=cs(),{sendCommand:r}=xi(),n=r,i=wf(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=b.useState([]),[c,h]=b.useState([]),[u,d]=b.useState(0),[f,m]=b.useState(!0),[g,x]=b.useState("debug"),[_,v]=b.useState(null),[y,E]=b.useState([]),[P,C]=b.useState(!1),[M,z]=b.useState(""),[J,N]=b.useState(""),[D,I]=b.useState(""),[R,W]=b.useState(""),[A,F]=b.useState(""),[H,L]=b.useState(""),[$,S]=b.useState(""),[ne,ce]=b.useState(""),[k,ge]=b.useState("overview"),[X,Q]=b.useState([]),[K,ue]=b.useState(!1),[de,pe]=b.useState(!1),[B,Re]=b.useState(""),[be,Ie]=b.useState([]),[Nt,ur]=b.useState(!1),[kr,Br]=b.useState(null),[Or,mn]=b.useState("all"),hr=b.useRef(null),Cr=b.useRef(!1);b.useEffect(()=>{if(!e||k!=="logs"||!f)return;const w=async()=>{try{const ve=await r(e,"get_logs",{count:200,minLevel:g,since:u}),Se=(ve==null?void 0:ve.result)||ve;if(ve!=null&&ve.success&&Array.isArray(Se==null?void 0:Se.logs)&&Se.logs.length>0){h(Ge=>[...Ge,...Se.logs.map(ki=>({timestamp:ki.ts,level:ki.level,message:`[${ki.category}] ${ki.message}`}))].slice(-300));const je=Math.max(...Se.logs.map(Ge=>Ge.ts));d(je)}}catch{}};w();const G=setInterval(w,3e3);return()=>clearInterval(G)},[e,k,f,u,g]),b.useEffect(()=>{if(f&&c.length>0){const w=Cr.current?"smooth":"instant";setTimeout(()=>{var G;(G=hr.current)==null||G.scrollIntoView({behavior:w}),Cr.current=!0},50)}},[c.length,l.length,f]),b.useEffect(()=>{k!=="logs"&&(Cr.current=!1)},[k]);const ft=async()=>{var w;if(e){ur(!0);try{const G=await r(e,"get_provider_settings",{}),ve=(G==null?void 0:G.result)||G;if(G!=null&&G.success&&(ve!=null&&ve.settings)){const Se=[];for(const[je,Ge]of Object.entries(ve.settings)){const pt=q.find(ki=>ki.type===je);Se.push({type:je,displayName:(pt==null?void 0:pt.displayName)||je,icon:(pt==null?void 0:pt.icon)||"🔧",category:(pt==null?void 0:pt.category)||"unknown",schema:Ge,values:((w=ve.values)==null?void 0:w[je])||{}})}Se.sort((je,Ge)=>je.category.localeCompare(Ge.category)||je.displayName.localeCompare(Ge.displayName)),Ie(Se)}}catch{}ur(!1)}};b.useEffect(()=>{k==="providers"&&be.length===0&&ft()},[k]);const ee=async(w,G,ve)=>{Br(`${w}.${G}`),Ie(Se=>Se.map(je=>je.type===w?{...je,values:{...je.values,[G]:ve}}:je));try{const Se=await r(e,"set_provider_setting",{providerType:w,key:G,value:ve});Se!=null&&Se.success||ft()}catch{ft()}Br(null)},ae=s.find(w=>w.id===e&&w.daemonMode),T=ae?{id:ae.id,hostname:((bf=ae.machine)==null?void 0:bf.hostname)||ae.id,platform:((kf=ae.machine)==null?void 0:kf.platform)||"unknown",arch:((Cf=ae.machine)==null?void 0:Cf.arch)||"",cpus:((Ef=ae.machine)==null?void 0:Ef.cpus)||0,totalMem:((Nf=ae.machine)==null?void 0:Nf.totalMem)||0,freeMem:((Tf=ae.machine)==null?void 0:Tf.freeMem)||0,loadavg:((Pf=ae.machine)==null?void 0:Pf.loadavg)||[],uptime:((Lf=ae.machine)==null?void 0:Lf.uptime)||0,release:((Df=ae.machine)==null?void 0:Df.release)||"",cdpconnected:ae.cdpconnected||!1,machineNickname:ae.machineNickname||null,p2p:ae.p2p||{available:!1,state:"unavailable",peers:0},detectedIdes:ae.detectedIdes||[],managedIdeIds:ae.managedIdeIds||[],managedCliIds:ae.managedCliIds||[]}:null,q=(ae==null?void 0:ae.availableProviders)||[],O={};for(const w of q)O[w.type]=w.icon;const j=w=>O[w]||"💻",U=q.filter(w=>w.category==="cli"),V=q.filter(w=>w.category==="acp");b.useEffect(()=>{!D&&U.length>0&&I(U[0].type)},[D,U.length]),b.useEffect(()=>{!A&&V.length>0&&F(V[0].type)},[A,V.length]);const Z=s.filter(w=>w.daemonId===e&&!w.daemonMode).filter(w=>!Kg(w)&&!Vg(w)).map(w=>({id:w.id,type:w.type,version:w.version||"",instanceId:w.instanceId||"",status:w.status,workspaceFolders:w.workspaceFolders||[],activeFile:w.activeFile||null,terminals:w.terminals||0,aiAgents:M3(w.aiAgents||w.agents||[]),activeChat:w.activeChat||null,chats:w.chats||[],agentStreams:w.agentStreams||[],cdpconnected:w.cdpconnected||!1,daemonId:e})),se=s.filter(w=>w.daemonId===e&&Kg(w)).map(w=>{var G,ve;return{id:w.id,type:w.type,cliName:w.cliName||w.type,status:w.status,workingDir:w.workingDir||((ve=(G=w.workspaceFolders)==null?void 0:G[0])==null?void 0:ve.path)||"",activeChat:w.activeChat||null,daemonId:e}}),le=s.filter(w=>w.daemonId===e&&Vg(w)).map(w=>{var G,ve;return{id:w.id,type:w.type,acpName:w.cliName||w.type,status:w.status,workingDir:w.workingDir||((ve=(G=w.workspaceFolders)==null?void 0:G[0])==null?void 0:ve.path)||"",activeChat:w.activeChat||null,currentModel:w.currentModel,currentPlan:w.currentPlan,daemonId:e}}),me=((T==null?void 0:T.detectedIdes)||[]).filter(w=>!w.running&&!Z.some(G=>(G.type||"").toLowerCase()===(w.type||"").toLowerCase())),re=(w,G)=>{a(ve=>[...ve.slice(-100),{timestamp:Date.now(),level:w,message:G}]),setTimeout(()=>{var ve;return(ve=hr.current)==null?void 0:ve.scrollIntoView({behavior:"smooth"})},100)},xe=async w=>{if(!(!e||_)){v(w),re("info",`Launching ${Ur(w)}...`);try{const G=await r(e,"launch_ide",{ideType:w,enableCdp:!0});re(G!=null&&G.success?"info":"error",G!=null&&G.success?`${Ur(w)} launched`:`Failed: ${G==null?void 0:G.error}`)}catch(G){re("error",`Launch error: ${G.message}`)}finally{v(null)}}},ye=async(w,G,ve,Se)=>{if(e){re("info",`Launching ${w}${G?` in ${G}`:""}${Se?` (model: ${Se})`:""}...`);try{const je=ve?ve.split(/\s+/).filter(Boolean):void 0,Ge=await r(e,"launch_cli",{cliType:w,dir:G||void 0,cliArgs:je,initialModel:Se||void 0}),pt=(Ge==null?void 0:Ge.result)||Ge;Ge!=null&&Ge.success?(re("info",`${w} launched`),pt!=null&&pt.defaultedToHome&&re("info",`📂 No directory specified — running in home directory (${pt.dir||"~"})`)):re("error",`Failed: ${(Ge==null?void 0:Ge.error)||(pt==null?void 0:pt.error)}`)}catch(je){re("error",`Launch error: ${je.message}`)}}},Xe=async(w,G,ve)=>{if(e&&window.confirm(`Stop ${w}?
186
+ This will terminate the process.`))try{const Se=await r(e,"stop_cli",{cliType:w,dir:G,_targetInstance:ve});Se!=null&&Se.success?re("info",`${w} stopped`):re("error",`Stop failed: ${(Se==null?void 0:Se.error)||"Unknown error"}`)}catch(Se){re("error",`Stop failed: ${Se.message}`)}},rt=async w=>{try{await r(w.id,"restart_session",{ideType:w.type}),re("info",`${Ur(w.type)} restart initiated`)}catch(G){re("error",`Restart failed: ${G.message}`)}},Ut=async()=>{if(e)try{const w=await r(e,"detect_ides",{});re("info",`Found ${((w==null?void 0:w.result)||[]).length} IDE(s)`)}catch(w){re("error",`Detection failed: ${w.message}`)}},At=async()=>{if(e){C(!0);try{const w=await r(e,"get_recent_workspaces",{});w!=null&&w.success&&Array.isArray(w==null?void 0:w.result)&&E(w.result)}catch(w){re("error",`Failed: ${w.message}`)}finally{C(!1)}}},Xa=async()=>{var w;if(e){ue(!0);try{const G=await n(e,"get_cli_history");G.success&&((w=G.result)!=null&&w.history)&&Q(G.result.history)}catch{}ue(!1)}},$o=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:B}),re("info",`Nickname set to "${B||"(cleared)"}"`),pe(!1)}catch(w){re("error",`Failed: ${w.message}`)}};if(!T)return o?p.jsxs("div",{className:"p-10 text-center text-slate-500",children:[p.jsx("h2",{className:"text-slate-100",children:"Machine not found"}),p.jsx("p",{className:"mt-3",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",{className:"p-10 text-center text-slate-500",children:p.jsx("p",{children:"⏳ Loading machine..."})});const Ga=T.totalMem>0?Math.round((T.totalMem-T.freeMem)/T.totalMem*100):0,Ho=T.loadavg[0]||0,bi=T.machineNickname||T.hostname,D1=[{id:"overview",label:"📊 Overview"},{id:"ides",label:"💻 IDEs",count:Z.length},{id:"clis",label:"🔌 CLIs",count:se.length},{id:"acps",label:"🤖 ACP Agents",count:le.length},{id:"providers",label:"⚙️ Providers",count:be.length>0?be.length:void 0},{id:"logs",label:"📋 Logs",count:l.length>0?l.length:void 0}];return p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsxs("div",{className:"px-6 py-4 border-b border-white/[0.06] bg-surface-primary",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3.5",children:[p.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"←"}),p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2",children:[de?p.jsxs("div",{className:"flex gap-1.5 items-center",children:[p.jsx("input",{autoFocus:!0,value:B,onChange:w=>Re(w.target.value),onKeyDown:w=>{w.key==="Enter"&&$o(),w.key==="Escape"&&pe(!1)},placeholder:"Machine nickname...",className:"px-2.5 py-1 rounded-md border border-violet-500/30 bg-slate-950/80 text-slate-100 text-sm font-semibold w-[200px]"}),p.jsx("button",{onClick:$o,className:"machine-btn text-green-500 border-green-500/30",children:"✓"}),p.jsx("button",{onClick:()=>pe(!1),className:"machine-btn",children:"✕"})]}):p.jsx("h1",{className:"text-lg font-bold text-slate-100 m-0 cursor-pointer",onClick:()=>{pe(!0),Re(T.machineNickname||"")},title:"Click to set nickname",children:bi}),p.jsx("span",{className:"status-dot-md online"})]}),p.jsxs("div",{className:"text-[11px] text-slate-500 mt-0.5 flex gap-2 items-center",children:[p.jsxs("span",{children:[T.platform," · ",T.arch," · ",T.cpus," cores"]}),T.p2p.available&&p.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:T.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:T.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",T.p2p.state==="connected"?`● ${T.p2p.peers}`:"○"]}),T.cdpconnected&&p.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500",children:"CDP ●"}),T.machineNickname&&p.jsxs("span",{className:"text-slate-600",children:["(",T.hostname,")"]})]})]})]}),p.jsx("button",{onClick:Ut,className:"machine-btn-primary",title:"Re-detect installed IDEs",children:"🔍 Scan IDEs"})]}),p.jsx("div",{className:"machine-tabs",children:D1.map(w=>p.jsxs("button",{onClick:()=>ge(w.id),className:`machine-tab${k===w.id?" active":""}`,children:[w.label,w.count!==void 0&&p.jsx("span",{className:"tab-count",children:w.count})]},w.id))})]}),p.jsxs("div",{className:"page-content",children:[k==="overview"&&p.jsxs("div",{children:[p.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[p.jsx(Hg,{icon:"⏱",label:"Uptime",value:R3(T.uptime)}),p.jsx(Hg,{icon:"💻",label:"IDEs",value:`${Z.length}`,sub:`${se.length} CLIs`})]}),p.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-slate-950/50 border border-white/[0.06]",children:[p.jsx("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),p.jsxs("div",{className:"flex gap-6",children:[p.jsx(Wg,{value:Math.min(Math.round(Ho/T.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${Ho.toFixed(2)} avg / ${T.cpus} cores`}),p.jsx(Wg,{value:Ga,max:100,label:"Memory",color:"#3b82f6",detail:`${Ug(T.totalMem-T.freeMem)} / ${Ug(T.totalMem)}`})]})]}),p.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[p.jsxs("div",{className:"px-5 py-4 rounded-xl bg-slate-950/50 border border-white/[0.06]",children:[p.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider",children:"IDEs"}),p.jsx("button",{onClick:()=>ge("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),Z.length===0?p.jsx("div",{className:"text-xs text-slate-600 italic",children:"No IDEs running"}):p.jsx("div",{className:"flex flex-col gap-1.5",children:Z.map(w=>{var ve,Se,je;const G=(w.agentStreams||[]).some(Ge=>Ge.status==="generating"||Ge.status==="streaming")||((ve=w.activeChat)==null?void 0:ve.status)==="generating";return p.jsxs("div",{onClick:()=>t(`/ide/${w.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${G?"bg-orange-500/[0.04] border border-orange-500/10":"bg-white/[0.02] border border-transparent"}`,children:[p.jsx("span",{children:j(w.type)}),p.jsx("span",{className:"text-xs text-slate-200 font-medium",children:Ur(w.type)}),p.jsx("span",{className:"text-[10px] text-slate-600 overflow-hidden text-ellipsis whitespace-nowrap",children:((je=(Se=w.workspaceFolders)==null?void 0:Se[0])==null?void 0:je.name)||""}),G&&p.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),p.jsx("span",{className:`${G?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:G?"#fb923c":"#22c55e",boxShadow:G?"0 0 8px rgba(249,115,22,0.4)":"none",animation:G?"pulse-dot 1.5s infinite":"none"}})]},w.id)})})]}),p.jsxs("div",{className:"px-5 py-4 rounded-xl bg-slate-950/50 border border-white/[0.06]",children:[p.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider",children:"CLIs"}),p.jsx("button",{onClick:()=>ge("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),se.length===0?p.jsx("div",{className:"text-xs text-slate-600 italic",children:"No CLIs running"}):p.jsx("div",{className:"flex flex-col gap-1.5",children:se.map(w=>p.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-white/[0.02]",children:[p.jsx("span",{children:j(w.type)}),p.jsx("span",{className:"text-xs text-slate-200 font-medium",children:w.cliName}),p.jsx("span",{className:"text-[10px] text-slate-600 overflow-hidden text-ellipsis whitespace-nowrap",children:w.workingDir.split("/").pop()}),p.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:w.status==="stopped"?"#ef4444":"#22c55e"}})]},w.id))})]})]}),T.detectedIdes.length>0&&p.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-slate-950/50 border border-white/[0.06]",children:[p.jsx("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:T.detectedIdes.map(w=>p.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${w.running?"bg-green-500/[0.06] border border-green-500/[0.12] text-green-300":"bg-white/[0.02] border border-white/[0.04] text-slate-500"}`,children:[p.jsx("span",{children:j(w.type)}),w.name||w.type,p.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:w.running?"#22c55e":"#475569"}})]},w.type))})]})]}),k==="ides"&&p.jsxs("div",{children:[p.jsxs("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2.5",children:["Running (",Z.length,")"]}),Z.length===0?p.jsx("div",{className:"py-10 px-5 text-center rounded-xl bg-slate-950/40 border border-dashed border-white/[0.06] text-slate-600 text-[13px] mb-5",children:"No IDEs currently running. Launch one below."}):p.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:Z.map(w=>{var G,ve;return p.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-slate-950/50 border border-white/[0.06]",children:[p.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-lg",children:j(w.type)}),p.jsx("span",{className:"font-semibold text-sm text-slate-100",children:Ur(w.type)}),w.version&&p.jsxs("span",{className:"text-[10px] text-slate-600",children:["v",w.version]}),p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),p.jsxs("div",{className:"flex gap-1.5",children:[p.jsx("button",{onClick:()=>t(`/ide/${w.id}`),className:"machine-btn",children:"🖥 Control"}),p.jsx("button",{onClick:()=>rt(w),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"})]})]}),p.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(130px,1fr))] gap-1.5 text-xs text-slate-400",children:[p.jsxs("div",{children:[p.jsx("span",{className:"text-slate-500",children:"Workspace:"})," ",((G=w.workspaceFolders)==null?void 0:G.map(Se=>Se.name).join(", "))||"—"]}),p.jsxs("div",{children:[p.jsx("span",{className:"text-slate-500",children:"File:"})," ",((ve=w.activeFile)==null?void 0:ve.split("/").pop())||"—"]}),p.jsxs("div",{children:[p.jsx("span",{className:"text-slate-500",children:"Terminals:"})," ",w.terminals]}),p.jsxs("div",{children:[p.jsx("span",{className:"text-slate-500",children:"CDP:"})," ",w.cdpconnected?"● connected":"○ Off"]})]}),w.aiAgents.length>0&&p.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:w.aiAgents.map(Se=>p.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${Se.status==="generating"||Se.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[Se.name," · ",Se.status]},Se.id))})]},w.id)})}),p.jsxs("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2.5",children:["Available to Launch (",me.length,")"]}),p.jsxs("div",{className:"flex flex-wrap gap-2",children:[me.map(w=>p.jsxs("button",{onClick:()=>xe(w.type||w.id||""),disabled:!!_,className:"machine-btn-primary flex items-center gap-1.5",style:{opacity:_&&_!==w.type?.4:1},children:[p.jsx("span",{children:j(w.type)}),_===w.type?"⏳ Launching...":`▶ ${w.name||Ur(w.type)}`]},w.type)),me.length===0&&p.jsxs("div",{className:"text-xs text-slate-600 italic",children:["All detected IDEs are running, or none detected.",p.jsx("button",{onClick:Ut,className:"machine-btn ml-2",children:"🔍 Scan"})]})]})]}),k==="clis"&&p.jsxs("div",{children:[p.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-slate-950/50 border border-violet-500/[0.12]",children:[p.jsx("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2.5",children:"Launch New CLI"}),p.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[p.jsx("select",{value:D,onChange:w=>I(w.target.value),className:"machine-input",children:U.length>0?U.map(w=>p.jsxs("option",{value:w.type,children:[w.icon," ",w.displayName]},w.type)):p.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),p.jsx("input",{type:"text",placeholder:"Working directory...",value:M,onChange:w=>z(w.target.value),className:"machine-input flex-1 min-w-[200px]"}),p.jsx("input",{type:"text",placeholder:"Args (optional)",value:J,onChange:w=>N(w.target.value),className:"machine-input min-w-[150px]"}),p.jsx("button",{onClick:()=>ye(D,M,J||void 0),className:"machine-btn-primary",children:"▶ Launch"})]})]}),p.jsxs("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2.5",children:["Running (",se.length,")"]}),se.length===0?p.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-slate-950/40 border border-dashed border-white/[0.06] text-slate-600 text-[13px] mb-5",children:"No CLIs running"}):p.jsx("div",{className:"flex flex-col gap-2 mb-5",children:se.map(w=>p.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-slate-950/50 border border-white/[0.06] flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2.5",children:[p.jsx("span",{className:"text-lg",children:j(w.type)}),p.jsxs("div",{children:[p.jsx("div",{className:"font-semibold text-[13px] text-slate-100",children:w.cliName}),p.jsx("div",{className:"text-[11px] text-slate-500",children:w.workingDir})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${w.status==="stopped"?"bg-red-500/[0.08] text-red-500":"bg-green-500/[0.08] text-green-500"}`,children:w.status}),w.status==="stopped"?p.jsx("button",{onClick:()=>ye(w.type,w.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):p.jsx("button",{onClick:()=>Xe(w.type,w.workingDir,w.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},w.id))}),p.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider",children:"History"}),p.jsx("button",{onClick:Xa,disabled:K,className:"machine-btn",children:K?"⏳":"↻ Load"})]}),X.length>0&&p.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:X.map((w,G)=>{var ve,Se;return p.jsxs("div",{onClick:()=>{I(w.cliType),z(w.dir),N((w.cliArgs||[]).join(" "))},className:"flex justify-between items-center px-2.5 py-1.5 rounded-md cursor-pointer bg-white/[0.02] border border-white/[0.04] text-xs transition-[background] duration-150",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",{className:"flex gap-1.5 items-center text-slate-400",children:[p.jsx("span",{children:j(w.cliType)}),p.jsx("span",{children:((ve=w.dir)==null?void 0:ve.split("/").filter(Boolean).pop())||"root"}),((Se=w.cliArgs)==null?void 0:Se.length)>0&&p.jsx("span",{className:"text-slate-600 text-[10px]",children:w.cliArgs.join(" ")})]}),p.jsx("span",{className:"text-slate-600 text-[10px]",children:w.timestamp?new Date(w.timestamp).toLocaleDateString():""})]},G)})}),p.jsxs("div",{className:"mt-5",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),p.jsx("button",{onClick:At,disabled:P,className:"machine-btn",children:P?"⏳":"↻ Load"})]}),y.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.map((w,G)=>p.jsxs("button",{onClick:()=>z(w),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:w,children:["📂 ",w.split("/").filter(Boolean).pop()||w]},G))})]})]}),k==="acps"&&p.jsxs("div",{children:[p.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-slate-950/50 border border-emerald-500/[0.12]",children:[p.jsx("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2.5",children:"Launch ACP Agent"}),p.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[p.jsx("select",{value:A,onChange:w=>F(w.target.value),className:"machine-input",children:V.length>0?V.map(w=>p.jsxs("option",{value:w.type,children:[w.icon," ",w.displayName]},w.type)):p.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),p.jsx("input",{type:"text",placeholder:"Working directory...",value:H,onChange:w=>L(w.target.value),className:"machine-input flex-1 min-w-[200px]"}),p.jsx("input",{type:"text",placeholder:"Model (default)",value:$,onChange:w=>S(w.target.value),className:"machine-input min-w-[120px]"}),p.jsx("input",{type:"text",placeholder:"Args (optional)",value:ne,onChange:w=>ce(w.target.value),className:"machine-input min-w-[120px]"}),p.jsx("button",{onClick:()=>ye(A,H,ne||void 0,$||void 0),className:"machine-btn-primary",children:"▶ Launch"})]})]}),p.jsxs("div",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mb-2.5",children:["Running (",le.length,")"]}),le.length===0?p.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-slate-950/40 border border-dashed border-white/[0.06] text-slate-600 text-[13px] mb-5",children:"No ACP agents running"}):p.jsx("div",{className:"flex flex-col gap-2 mb-5",children:le.map(w=>p.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-slate-950/50 border border-white/[0.06] flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2.5",children:[p.jsx("span",{className:"text-lg",children:j(w.type)}),p.jsxs("div",{children:[p.jsx("div",{className:"font-semibold text-[13px] text-slate-100",children:w.acpName}),p.jsxs("div",{className:"text-[11px] text-slate-500 flex gap-2",children:[p.jsx("span",{children:w.workingDir}),w.currentModel&&p.jsxs("span",{className:"text-cyan-500",children:["🤖 ",w.currentModel]}),w.currentPlan&&p.jsxs("span",{className:"text-amber-500",children:["📋 ",w.currentPlan]})]})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${w.status==="stopped"?"bg-red-500/[0.08] text-red-500":w.status==="generating"?"bg-orange-500/[0.08] text-orange-400":"bg-green-500/[0.08] text-green-500"}`,children:w.status}),p.jsx("button",{onClick:()=>t(`/ide/${w.id}`),className:"machine-btn",title:"View chat",children:"💬"}),w.status==="stopped"?p.jsx("button",{onClick:()=>ye(w.type,w.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):p.jsx("button",{onClick:()=>Xe(w.type,w.workingDir,w.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},w.id))}),p.jsxs("div",{className:"mt-5",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),p.jsx("button",{onClick:At,disabled:P,className:"machine-btn",children:P?"⏳":"↻ Load"})]}),y.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.map((w,G)=>p.jsxs("button",{onClick:()=>L(w),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:w,children:["📂 ",w.split("/").filter(Boolean).pop()||w]},G))})]})]}),k==="providers"&&p.jsxs("div",{children:[p.jsxs("div",{className:"flex justify-between items-center mb-4",children:[p.jsxs("div",{className:"flex gap-1 items-center",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(w=>p.jsx("button",{onClick:()=>mn(w),className:`machine-btn text-[10px] px-2 py-0.5 ${Or===w?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:w.toUpperCase()},w))]}),p.jsx("button",{onClick:ft,disabled:Nt,className:"machine-btn",children:Nt?"⏳ Loading...":"↻ Refresh"})]}),Nt&&be.length===0?p.jsx("div",{className:"p-10 text-center text-slate-600",children:"Loading provider settings..."}):p.jsx("div",{className:"flex flex-col gap-2",children:be.filter(w=>Or==="all"||w.category===Or).map(w=>p.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-slate-950/50 border border-white/[0.06]",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[p.jsx("span",{className:"text-lg",children:w.icon}),p.jsx("span",{className:"font-semibold text-[13px] text-slate-100",children:w.displayName}),p.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:w.category==="acp"?"rgba(139,92,246,0.08)":w.category==="cli"?"rgba(59,130,246,0.08)":w.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:w.category==="acp"?"#a78bfa":w.category==="cli"?"#60a5fa":w.category==="ide"?"#86efac":"#fbbf24"},children:w.category})]}),p.jsx("div",{className:"flex flex-col gap-2",children:w.schema.map(G=>p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"text-xs font-medium text-slate-200",children:[G.label||G.key,kr===`${w.type}.${G.key}`&&p.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),G.description&&p.jsx("div",{className:"text-[10px] text-slate-500 mt-px",children:G.description})]}),p.jsx("div",{className:"shrink-0",children:G.type==="boolean"?p.jsx("button",{onClick:()=>ee(w.type,G.key,!(w.values[G.key]??G.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:w.values[G.key]??G.default?"#8b5cf6":"rgba(255,255,255,0.08)"},children:p.jsx("div",{className:"w-4 h-4 rounded-full bg-white absolute top-[3px] transition-[left] duration-200 shadow-[0_1px_3px_rgba(0,0,0,0.3)]",style:{left:w.values[G.key]??G.default?21:3}})}):G.type==="number"?p.jsx("input",{type:"number",value:w.values[G.key]??G.default??0,min:G.min,max:G.max,onChange:ve=>{const Se=parseInt(ve.target.value)||0;G.min!==void 0&&Se<G.min||G.max!==void 0&&Se>G.max||ee(w.type,G.key,Se)},className:"machine-input w-20 text-center text-[11px]"}):G.type==="select"&&G.options?p.jsx("select",{value:w.values[G.key]??G.default??"",onChange:ve=>ee(w.type,G.key,ve.target.value),className:"machine-input text-[11px]",children:G.options.map(ve=>p.jsx("option",{value:ve,children:ve},ve))}):p.jsx("input",{type:"text",value:w.values[G.key]??G.default??"",onBlur:ve=>ee(w.type,G.key,ve.target.value),className:"machine-input w-[120px] text-[11px]"})})]},G.key))})]},w.type))})]}),k==="logs"&&p.jsxs("div",{children:[p.jsxs("div",{className:"flex justify-between items-center mb-3",children:[p.jsxs("div",{className:"flex gap-1 items-center",children:[p.jsx("span",{className:"text-[11px] text-slate-500 font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(w=>p.jsx("button",{onClick:()=>{x(w),h([]),d(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${g===w?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:w.toUpperCase()},w))]}),p.jsxs("div",{className:"flex gap-1.5 items-center",children:[p.jsxs("span",{className:"text-[10px] text-slate-600",children:[c.length," entries"]}),p.jsx("button",{onClick:()=>m(!f),className:`machine-btn ${f?"text-green-500 border-green-500/30":""}`,children:f?"⏸ Pause":"▶ Resume"}),p.jsx("button",{onClick:()=>{h([]),d(0)},className:"machine-btn",children:"Clear"})]})]}),p.jsxs("div",{className:"bg-slate-950/60 border border-white/[0.06] rounded-xl p-3 min-h-[200px] max-h-[500px] overflow-y-auto font-mono text-[11px] leading-relaxed",children:[c.length===0&&p.jsx("div",{className:"p-10 text-center text-slate-600",children:"Loading daemon logs..."}),c.map((w,G)=>p.jsxs("div",{className:"flex gap-2 py-px",style:{color:w.level==="error"?"#ef4444":w.level==="warn"?"#f59e0b":w.level==="debug"?"#64748b":"#94a3b8"},children:[p.jsx("span",{className:"text-slate-600 min-w-[75px] shrink-0",children:new Date(w.timestamp).toLocaleTimeString()}),p.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:w.level==="error"?"#ef4444":w.level==="warn"?"#f59e0b":w.level==="debug"?"#475569":"#8b5cf6"},children:w.level==="error"?"ERR":w.level==="warn"?"WRN":w.level==="debug"?"DBG":"INF"}),p.jsx("span",{children:w.message})]},G)),p.jsx("div",{ref:hr})]})]})]})]})}function Y3(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new URLSearchParams(window.location.search).get("token");return n?`${t}?token=${encodeURIComponent(n)}`:t}const Xg=Y3(),Gg=3e3,X3=3e4;let tn=null,G3=0;const xa=new Map,Xh=new Set;let Rs=null;async function jl(e,t,r){const n=tn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++G3}_${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)}}),n.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:r||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:r||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class Q3{constructor(t){ps(this,"daemonId");ps(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(tn==null?void 0:tn.readyState)===WebSocket.OPEN}get connectionState(){return(tn==null?void 0:tn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return jl(this.daemonId,t,r)}async sendInput(t,r){return jl(this.daemonId,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){if(this.screenshotIdeType=t||null,Rs)return;const r=async()=>{if(this.hasCommandChannel)try{const n=await jl(this.daemonId,"screenshot",{width:1280});if(n!=null&&n.success&&(n!=null&&n.base64)){const i=await fetch(`data:image/jpeg;base64,${n.base64}`).then(s=>s.blob());Xh.forEach(s=>s(this.daemonId,i))}}catch{}};r(),Rs=setInterval(r,2e3)}stopScreenshots(t){Rs&&(clearInterval(Rs),Rs=null)}}let Yn=null;function Z3(e){(!Yn||Yn.daemonId!==e)&&(Yn=new Q3(e));try{const{connectionManager:t}=require("@adhdev/web-core"),r=t.get.bind(t);t.get=n=>n===e?Yn:r(n),t.getState=n=>n===e&&(Yn==null?void 0:Yn.connectionState)||"disconnected",t.onScreenshot=n=>(Xh.add(n),()=>{Xh.delete(n)})}catch{}}function J3({children:e}){const t=b.useRef(Gp()),r=Gp();t.current=r;const[,n]=b.useState("disconnected"),i=b.useRef(null),s=b.useRef(),o=b.useRef(Gg),l=b.useRef(!0);return b.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;n("connecting"),console.log(`[Standalone WS] Connecting to ${Xg}...`);let h;try{h=new WebSocket(Xg)}catch(f){console.error("[Standalone WS] Failed to create WebSocket:",f),c();return}i.current=h,h.onopen=()=>{if(!l.current){h.close();return}n("connected"),o.current=Gg,console.log("[Standalone WS] Connected")},tn=h,h.onmessage=f=>{var m;try{const g=JSON.parse(f.data);if((g.type==="command_result"||g.type==="error")&&g.requestId){const x=xa.get(g.requestId);x&&(xa.delete(g.requestId),g.type==="error"?x.reject(new Error(((m=g.data)==null?void 0:m.message)||"Command failed")):x.resolve(g.data));return}if(g.type==="status"||g.type==="initial_state"){const x=g.data;if(!x)return;const{injectEntries:_,markLoaded:v}=t.current,y=[],E=x.id||"standalone";Z3(E),y.push({id:E,type:"adhdev-daemon",status:"online",daemonMode:!0,machine:{hostname:x.hostname,platform:x.platform,...x.system||{}},system:x.system||null,timestamp:x.timestamp,cdpConnected:x.cdpConnected,detectedIdes:x.detectedIdes||[],availableProviders:x.availableProviders||[],managedIdeIds:(x.ides||[]).map(P=>P.id),managedCliIds:(x.clis||[]).map(P=>P.id)});for(const P of x.ides||[])y.push({...P,daemonId:x.id||"standalone",status:P.cdpConnected?"online":"detected"});for(const P of x.clis||[])y.push({...P,daemonId:x.id||"standalone",status:P.isRunning?"running":"stopped"});y.length>0&&_(y),v()}}catch(g){console.error("[Standalone WS] Parse error:",g)}},h.onclose=()=>{l.current&&(n("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,X3),a()},h)}return a(),()=>{l.current=!1,clearTimeout(s.current),i.current&&(i.current.onclose=null,i.current.close(),i.current=null,tn=null)}},[]),p.jsx(p.Fragment,{children:e})}function eD({children:e}){return p.jsx(ob,{children:p.jsx(J3,{children:e})})}const tD=[{id:"dashboard",path:"/dashboard",icon:"🌊",label:"Dashboard"},{id:"machine",path:"/machine",icon:"🐇",label:"Burrow"}];function rD({children:e}){const t=cs(),r=Mo(),[n,i]=b.useState(!1),[s,o]=b.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${n?" 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"})]}),n&&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 ${n?"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:tD.map(c=>p.jsxs("div",{className:`nav-item${r.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.5.3"]}),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 Qg(){const{ides:e}=P0(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?p.jsx(Tl,{to:`/machines/${t.id}`,replace:!0}):e.length>0?p.jsx(Tl,{to:`/machines/${e[0].id}`,replace:!0}):p.jsx(Tl,{to:"/dashboard",replace:!0})}function nD(){return p.jsx(nb,{children:p.jsx(eD,{children:p.jsx(ub,{value:{sendCommand:jl,sendData:()=>!1},children:p.jsx(rD,{children:p.jsxs(Jw,{children:[p.jsx(Qn,{path:"/dashboard",element:p.jsx(U3,{})}),p.jsx(Qn,{path:"/ide/:id",element:p.jsx(V3,{})}),p.jsx(Qn,{path:"/machine",element:p.jsx(Qg,{})}),p.jsx(Qn,{path:"/machines/:id",element:p.jsx(q3,{})}),p.jsx(Qn,{path:"/machines",element:p.jsx(Qg,{})}),p.jsx(Qn,{path:"*",element:p.jsx(Tl,{to:"/dashboard",replace:!0})})]})})})})})}f0(document.getElementById("root")).render(p.jsx(b.StrictMode,{children:p.jsx(nD,{})}));