@adhdev/daemon-standalone 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,186 +0,0 @@
1
- var d1=Object.defineProperty;var f1=(e,t,r)=>t in e?d1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var os=(e,t,r)=>f1(e,typeof t!="symbol"?t+"":t,r);function p1(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 Ll=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mm={exports:{}},da={},Am={exports:{}},Ee={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var vo=Symbol.for("react.element"),g1=Symbol.for("react.portal"),m1=Symbol.for("react.fragment"),_1=Symbol.for("react.strict_mode"),v1=Symbol.for("react.profiler"),y1=Symbol.for("react.provider"),S1=Symbol.for("react.context"),x1=Symbol.for("react.forward_ref"),w1=Symbol.for("react.suspense"),b1=Symbol.for("react.memo"),k1=Symbol.for("react.lazy"),df=Symbol.iterator;function C1(e){return e===null||typeof e!="object"?null:(e=df&&e[df]||e["@@iterator"],typeof e=="function"?e:null)}var Bm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nm=Object.assign,zm={};function Qi(e,t,r){this.props=e,this.context=t,this.refs=zm,this.updater=r||Bm}Qi.prototype.isReactComponent={};Qi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Qi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Om(){}Om.prototype=Qi.prototype;function Fh(e,t,r){this.props=e,this.context=t,this.refs=zm,this.updater=r||Bm}var $h=Fh.prototype=new Om;$h.constructor=Fh;Nm($h,Qi.prototype);$h.isPureReactComponent=!0;var ff=Array.isArray,jm=Object.prototype.hasOwnProperty,Wh={current:null},Fm={key:!0,ref:!0,__self:!0,__source:!0};function $m(e,t,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)jm.call(t,n)&&!Fm.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:vo,type:e,key:s,ref:o,props:i,_owner:Wh.current}}function E1(e,t){return{$$typeof:vo,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Hh(e){return typeof e=="object"&&e!==null&&e.$$typeof===vo}function T1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var pf=/\/+/g;function Fa(e,t){return typeof e=="object"&&e!==null&&e.key!=null?T1(""+e.key):t.toString(36)}function ll(e,t,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 vo:case g1:o=!0}}if(o)return o=e,i=i(o),e=n===""?"."+Fa(o,0):n,ff(i)?(r="",e!=null&&(r=e.replace(pf,"$&/")+"/"),ll(i,t,r,"",function(c){return c})):i!=null&&(Hh(i)&&(i=E1(i,r+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(pf,"$&/")+"/")+e)),t.push(i)),1;if(o=0,n=n===""?".":n+":",ff(e))for(var l=0;l<e.length;l++){s=e[l];var a=n+Fa(s,l);o+=ll(s,t,r,a,i)}else if(a=C1(e),typeof a=="function")for(e=a.call(e),l=0;!(s=e.next()).done;)s=s.value,a=n+Fa(s,l++),o+=ll(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 Ao(e,t,r){if(e==null)return e;var n=[],i=0;return ll(e,n,"","",function(s){return t.call(r,s,i++)}),n}function R1(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 At={current:null},al={transition:null},I1={ReactCurrentDispatcher:At,ReactCurrentBatchConfig:al,ReactCurrentOwner:Wh};function Wm(){throw Error("act(...) is not supported in production builds of React.")}Ee.Children={map:Ao,forEach:function(e,t,r){Ao(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Ao(e,function(){t++}),t},toArray:function(e){return Ao(e,function(t){return t})||[]},only:function(e){if(!Hh(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ee.Component=Qi;Ee.Fragment=m1;Ee.Profiler=v1;Ee.PureComponent=Fh;Ee.StrictMode=_1;Ee.Suspense=w1;Ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I1;Ee.act=Wm;Ee.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=Nm({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Wh.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)jm.call(t,a)&&!Fm.hasOwnProperty(a)&&(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:vo,type:e.type,key:i,ref:s,props:n,_owner:o}};Ee.createContext=function(e){return e={$$typeof:S1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:y1,_context:e},e.Consumer=e};Ee.createElement=$m;Ee.createFactory=function(e){var t=$m.bind(null,e);return t.type=e,t};Ee.createRef=function(){return{current:null}};Ee.forwardRef=function(e){return{$$typeof:x1,render:e}};Ee.isValidElement=Hh;Ee.lazy=function(e){return{$$typeof:k1,_payload:{_status:-1,_result:e},_init:R1}};Ee.memo=function(e,t){return{$$typeof:b1,type:e,compare:t===void 0?null:t}};Ee.startTransition=function(e){var t=al.transition;al.transition={};try{e()}finally{al.transition=t}};Ee.unstable_act=Wm;Ee.useCallback=function(e,t){return At.current.useCallback(e,t)};Ee.useContext=function(e){return At.current.useContext(e)};Ee.useDebugValue=function(){};Ee.useDeferredValue=function(e){return At.current.useDeferredValue(e)};Ee.useEffect=function(e,t){return At.current.useEffect(e,t)};Ee.useId=function(){return At.current.useId()};Ee.useImperativeHandle=function(e,t,r){return At.current.useImperativeHandle(e,t,r)};Ee.useInsertionEffect=function(e,t){return At.current.useInsertionEffect(e,t)};Ee.useLayoutEffect=function(e,t){return At.current.useLayoutEffect(e,t)};Ee.useMemo=function(e,t){return At.current.useMemo(e,t)};Ee.useReducer=function(e,t,r){return At.current.useReducer(e,t,r)};Ee.useRef=function(e){return At.current.useRef(e)};Ee.useState=function(e){return At.current.useState(e)};Ee.useSyncExternalStore=function(e,t,r){return At.current.useSyncExternalStore(e,t,r)};Ee.useTransition=function(){return At.current.useTransition()};Ee.version="18.3.1";Am.exports=Ee;var b=Am.exports;const L1=jh(b),P1=p1({__proto__:null,default:L1},[b]);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var D1=b,M1=Symbol.for("react.element"),A1=Symbol.for("react.fragment"),B1=Object.prototype.hasOwnProperty,N1=D1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,z1={key:!0,ref:!0,__self:!0,__source:!0};function Hm(e,t,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)B1.call(t,n)&&!z1.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:M1,type:e,key:s,ref:o,props:i,_owner:N1.current}}da.Fragment=A1;da.jsx=Hm;da.jsxs=Hm;Mm.exports=da;var p=Mm.exports,Um={exports:{}},tr={},Km={exports:{}},Vm={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(P,$){var S=P.length;P.push($);e:for(;0<S;){var Q=S-1>>>1,le=P[Q];if(0<i(le,$))P[Q]=$,P[S]=le,S=Q;else break e}}function r(P){return P.length===0?null:P[0]}function n(P){if(P.length===0)return null;var $=P[0],S=P.pop();if(S!==$){P[0]=S;e:for(var Q=0,le=P.length,C=le>>>1;Q<C;){var ge=2*(Q+1)-1,ie=P[ge],N=ge+1,Y=P[N];if(0>i(ie,S))N<le&&0>i(Y,ie)?(P[Q]=Y,P[N]=S,Q=N):(P[Q]=ie,P[ge]=S,Q=ge);else if(N<le&&0>i(Y,S))P[Q]=Y,P[N]=S,Q=N;else break e}}return $}function i(P,$){var S=P.sortIndex-$.sortIndex;return S!==0?S:P.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],c=[],h=1,u=null,d=3,f=!1,g=!1,m=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(P){for(var $=r(c);$!==null;){if($.callback===null)n(c);else if($.startTime<=P)n(c),$.sortIndex=$.expirationTime,t(a,$);else break;$=r(c)}}function T(P){if(m=!1,y(P),!g)if(r(a)!==null)g=!0,O(R);else{var $=r(c);$!==null&&K(T,$.startTime-P)}}function R(P,$){g=!1,m&&(m=!1,_(H),H=-1),f=!0;var S=d;try{for(y($),u=r(a);u!==null&&(!(u.expirationTime>$)||P&&!I());){var Q=u.callback;if(typeof Q=="function"){u.callback=null,d=u.priorityLevel;var le=Q(u.expirationTime<=$);$=e.unstable_now(),typeof le=="function"?u.callback=le:u===r(a)&&n(a),y($)}else n(a);u=r(a)}if(u!==null)var C=!0;else{var ge=r(c);ge!==null&&K(T,ge.startTime-$),C=!1}return C}finally{u=null,d=S,f=!1}}var x=!1,j=null,H=-1,U=5,E=-1;function I(){return!(e.unstable_now()-E<U)}function M(){if(j!==null){var P=e.unstable_now();E=P;var $=!0;try{$=j(!0,P)}finally{$?L():(x=!1,j=null)}}else x=!1}var L;if(typeof v=="function")L=function(){v(M)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,A=W.port2;W.port1.onmessage=M,L=function(){A.postMessage(null)}}else L=function(){w(M,0)};function O(P){j=P,x||(x=!0,L())}function K(P,$){H=w(function(){P(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_continueExecution=function(){g||f||(g=!0,O(R))},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return r(a)},e.unstable_next=function(P){switch(d){case 1:case 2:case 3:var $=3;break;default:$=d}var S=d;d=$;try{return P()}finally{d=S}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,$){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var S=d;d=P;try{return $()}finally{d=S}},e.unstable_scheduleCallback=function(P,$,S){var Q=e.unstable_now();switch(typeof S=="object"&&S!==null?(S=S.delay,S=typeof S=="number"&&0<S?Q+S:Q):S=Q,P){case 1:var le=-1;break;case 2:le=250;break;case 5:le=1073741823;break;case 4:le=1e4;break;default:le=5e3}return le=S+le,P={id:h++,callback:$,priorityLevel:P,startTime:S,expirationTime:le,sortIndex:-1},S>Q?(P.sortIndex=S,t(c,P),r(a)===null&&P===r(c)&&(m?(_(H),H=-1):m=!0,K(T,S-Q))):(P.sortIndex=le,t(a,P),g||f||(g=!0,O(R))),P},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(P){var $=d;return function(){var S=d;d=$;try{return P.apply(this,arguments)}finally{d=S}}}})(Vm);Km.exports=Vm;var O1=Km.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var j1=b,er=O1;function ee(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var qm=new Set,qs={};function di(e,t){Wi(e,t),Wi(e+"Capture",t)}function Wi(e,t){for(qs[e]=t,e=0;e<t.length;e++)qm.add(t[e])}var Jr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qc=Object.prototype.hasOwnProperty,F1=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,gf={},mf={};function $1(e){return qc.call(mf,e)?!0:qc.call(gf,e)?!1:F1.test(e)?mf[e]=!0:(gf[e]=!0,!1)}function W1(e,t,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 H1(e,t,r,n){if(t===null||typeof t>"u"||W1(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 Bt(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 xt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){xt[e]=new Bt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];xt[t]=new Bt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){xt[e]=new Bt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){xt[e]=new Bt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){xt[e]=new Bt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){xt[e]=new Bt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){xt[e]=new Bt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){xt[e]=new Bt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){xt[e]=new Bt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Uh=/[\-:]([a-z])/g;function Kh(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Uh,Kh);xt[t]=new Bt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Uh,Kh);xt[t]=new Bt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Uh,Kh);xt[t]=new Bt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){xt[e]=new Bt(e,1,!1,e.toLowerCase(),null,!1,!1)});xt.xlinkHref=new Bt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){xt[e]=new Bt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Vh(e,t,r,n){var i=xt.hasOwnProperty(t)?xt[t]:null;(i!==null?i.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(H1(t,r,i,n)&&(r=null),n||i===null?$1(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 nn=j1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Bo=Symbol.for("react.element"),wi=Symbol.for("react.portal"),bi=Symbol.for("react.fragment"),qh=Symbol.for("react.strict_mode"),Yc=Symbol.for("react.profiler"),Ym=Symbol.for("react.provider"),Xm=Symbol.for("react.context"),Yh=Symbol.for("react.forward_ref"),Xc=Symbol.for("react.suspense"),Gc=Symbol.for("react.suspense_list"),Xh=Symbol.for("react.memo"),pn=Symbol.for("react.lazy"),Gm=Symbol.for("react.offscreen"),_f=Symbol.iterator;function ls(e){return e===null||typeof e!="object"?null:(e=_f&&e[_f]||e["@@iterator"],typeof e=="function"?e:null)}var qe=Object.assign,$a;function Cs(e){if($a===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);$a=t&&t[1]||""}return`
34
- `+$a+e}var Wa=!1;function Ha(e,t){if(!e||Wa)return"";Wa=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var n=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){n=c}e.call(t.prototype)}else{try{throw Error()}catch(c){n=c}e()}}catch(c){if(c&&n&&typeof c.stack=="string"){for(var i=c.stack.split(`
35
- `),s=n.stack.split(`
36
- `),o=i.length-1,l=s.length-1;1<=o&&0<=l&&i[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==s[l]){var a=`
37
- `+i[o].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Wa=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Cs(e):""}function U1(e){switch(e.tag){case 5:return Cs(e.type);case 16:return Cs("Lazy");case 13:return Cs("Suspense");case 19:return Cs("SuspenseList");case 0:case 2:case 15:return e=Ha(e.type,!1),e;case 11:return e=Ha(e.type.render,!1),e;case 1:return e=Ha(e.type,!0),e;default:return""}}function Qc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case bi:return"Fragment";case wi:return"Portal";case Yc:return"Profiler";case qh:return"StrictMode";case Xc:return"Suspense";case Gc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Xm:return(e.displayName||"Context")+".Consumer";case Ym:return(e._context.displayName||"Context")+".Provider";case Yh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Xh:return t=e.displayName||null,t!==null?t:Qc(e.type)||"Memo";case pn:t=e._payload,e=e._init;try{return Qc(e(t))}catch{}}return null}function K1(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qc(t);case 8:return t===qh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Dn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Qm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function V1(e){var t=Qm(e)?"checked":"value",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 No(e){e._valueTracker||(e._valueTracker=V1(e))}function Zm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Qm(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Pl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Zc(e,t){var r=t.checked;return qe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function vf(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Dn(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 Jm(e,t){t=t.checked,t!=null&&Vh(e,"checked",t,!1)}function Jc(e,t){Jm(e,t);var r=Dn(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")?eu(e,t.type,r):t.hasOwnProperty("defaultValue")&&eu(e,t.type,Dn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function yf(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function eu(e,t,r){(t!=="number"||Pl(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Es=Array.isArray;function Bi(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=""+Dn(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 tu(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ee(91));return qe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Sf(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(ee(92));if(Es(r)){if(1<r.length)throw Error(ee(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Dn(r)}}function e_(e,t){var r=Dn(t.value),n=Dn(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 xf(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function t_(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ru(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?t_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var zo,r_=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,i){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(zo=zo||document.createElement("div"),zo.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=zo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ys(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var As={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},q1=["Webkit","ms","Moz","O"];Object.keys(As).forEach(function(e){q1.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),As[t]=As[e]})});function n_(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||As.hasOwnProperty(e)&&As[e]?(""+t).trim():t+"px"}function i_(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=n_(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var Y1=qe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nu(e,t){if(t){if(Y1[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function iu(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var su=null;function Gh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ou=null,Ni=null,zi=null;function wf(e){if(e=xo(e)){if(typeof ou!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=_a(t),ou(e.stateNode,e.type,t))}}function s_(e){Ni?zi?zi.push(e):zi=[e]:Ni=e}function o_(){if(Ni){var e=Ni,t=zi;if(zi=Ni=null,wf(e),t)for(e=0;e<t.length;e++)wf(t[e])}}function l_(e,t){return e(t)}function a_(){}var Ua=!1;function c_(e,t,r){if(Ua)return e(t,r);Ua=!0;try{return l_(e,t,r)}finally{Ua=!1,(Ni!==null||zi!==null)&&(a_(),o_())}}function Xs(e,t){var r=e.stateNode;if(r===null)return null;var n=_a(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(ee(231,t,typeof r));return r}var lu=!1;if(Jr)try{var as={};Object.defineProperty(as,"passive",{get:function(){lu=!0}}),window.addEventListener("test",as,as),window.removeEventListener("test",as,as)}catch{lu=!1}function X1(e,t,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 Bs=!1,Dl=null,Ml=!1,au=null,G1={onError:function(e){Bs=!0,Dl=e}};function Q1(e,t,r,n,i,s,o,l,a){Bs=!1,Dl=null,X1.apply(G1,arguments)}function Z1(e,t,r,n,i,s,o,l,a){if(Q1.apply(this,arguments),Bs){if(Bs){var c=Dl;Bs=!1,Dl=null}else throw Error(ee(198));Ml||(Ml=!0,au=c)}}function fi(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 u_(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function bf(e){if(fi(e)!==e)throw Error(ee(188))}function J1(e){var t=e.alternate;if(!t){if(t=fi(e),t===null)throw Error(ee(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(i===null)break;var s=i.alternate;if(s===null){if(n=i.return,n!==null){r=n;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===r)return bf(i),e;if(s===n)return bf(i),t;s=s.sibling}throw Error(ee(188))}if(r.return!==n.return)r=i,n=s;else{for(var o=!1,l=i.child;l;){if(l===r){o=!0,r=i,n=s;break}if(l===n){o=!0,n=i,r=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===r){o=!0,r=s,n=i;break}if(l===n){o=!0,n=s,r=i;break}l=l.sibling}if(!o)throw Error(ee(189))}}if(r.alternate!==n)throw Error(ee(190))}if(r.tag!==3)throw Error(ee(188));return r.stateNode.current===r?e:t}function h_(e){return e=J1(e),e!==null?d_(e):null}function d_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=d_(e);if(t!==null)return t;e=e.sibling}return null}var f_=er.unstable_scheduleCallback,kf=er.unstable_cancelCallback,eS=er.unstable_shouldYield,tS=er.unstable_requestPaint,Je=er.unstable_now,rS=er.unstable_getCurrentPriorityLevel,Qh=er.unstable_ImmediatePriority,p_=er.unstable_UserBlockingPriority,Al=er.unstable_NormalPriority,nS=er.unstable_LowPriority,g_=er.unstable_IdlePriority,fa=null,zr=null;function iS(e){if(zr&&typeof zr.onCommitFiberRoot=="function")try{zr.onCommitFiberRoot(fa,e,void 0,(e.current.flags&128)===128)}catch{}}var br=Math.clz32?Math.clz32:lS,sS=Math.log,oS=Math.LN2;function lS(e){return e>>>=0,e===0?32:31-(sS(e)/oS|0)|0}var Oo=64,jo=4194304;function Ts(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Bl(e,t){var 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=Ts(l):(s&=o,s!==0&&(n=Ts(s)))}else o=r&~i,o!==0?n=Ts(o):s!==0&&(n=Ts(s));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-br(t),i=1<<r,n|=e[r],t&=~i;return n}function aS(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function cS(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-br(s),l=1<<o,a=i[o];a===-1?(!(l&r)||l&n)&&(i[o]=aS(l,t)):a<=t&&(e.expiredLanes|=l),s&=~l}}function cu(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function m_(){var e=Oo;return Oo<<=1,!(Oo&4194240)&&(Oo=64),e}function Ka(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function yo(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-br(t),e[t]=r}function uS(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var i=31-br(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}function Zh(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-br(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var Le=0;function __(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var v_,Jh,y_,S_,x_,uu=!1,Fo=[],bn=null,kn=null,Cn=null,Gs=new Map,Qs=new Map,_n=[],hS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Cf(e,t){switch(e){case"focusin":case"focusout":bn=null;break;case"dragenter":case"dragleave":kn=null;break;case"mouseover":case"mouseout":Cn=null;break;case"pointerover":case"pointerout":Gs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qs.delete(t.pointerId)}}function cs(e,t,r,n,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:s,targetContainers:[i]},t!==null&&(t=xo(t),t!==null&&Jh(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function dS(e,t,r,n,i){switch(t){case"focusin":return bn=cs(bn,e,t,r,n,i),!0;case"dragenter":return kn=cs(kn,e,t,r,n,i),!0;case"mouseover":return Cn=cs(Cn,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return Gs.set(s,cs(Gs.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,Qs.set(s,cs(Qs.get(s)||null,e,t,r,n,i)),!0}return!1}function w_(e){var t=Gn(e.target);if(t!==null){var r=fi(t);if(r!==null){if(t=r.tag,t===13){if(t=u_(r),t!==null){e.blockedOn=t,x_(e.priority,function(){y_(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 cl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=hu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);su=n,r.target.dispatchEvent(n),su=null}else return t=xo(r),t!==null&&Jh(t),e.blockedOn=r,!1;t.shift()}return!0}function Ef(e,t,r){cl(e)&&r.delete(t)}function fS(){uu=!1,bn!==null&&cl(bn)&&(bn=null),kn!==null&&cl(kn)&&(kn=null),Cn!==null&&cl(Cn)&&(Cn=null),Gs.forEach(Ef),Qs.forEach(Ef)}function us(e,t){e.blockedOn===t&&(e.blockedOn=null,uu||(uu=!0,er.unstable_scheduleCallback(er.unstable_NormalPriority,fS)))}function Zs(e){function t(i){return us(i,e)}if(0<Fo.length){us(Fo[0],e);for(var r=1;r<Fo.length;r++){var n=Fo[r];n.blockedOn===e&&(n.blockedOn=null)}}for(bn!==null&&us(bn,e),kn!==null&&us(kn,e),Cn!==null&&us(Cn,e),Gs.forEach(t),Qs.forEach(t),r=0;r<_n.length;r++)n=_n[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<_n.length&&(r=_n[0],r.blockedOn===null);)w_(r),r.blockedOn===null&&_n.shift()}var Oi=nn.ReactCurrentBatchConfig,Nl=!0;function pS(e,t,r,n){var i=Le,s=Oi.transition;Oi.transition=null;try{Le=1,ed(e,t,r,n)}finally{Le=i,Oi.transition=s}}function gS(e,t,r,n){var i=Le,s=Oi.transition;Oi.transition=null;try{Le=4,ed(e,t,r,n)}finally{Le=i,Oi.transition=s}}function ed(e,t,r,n){if(Nl){var i=hu(e,t,r,n);if(i===null)tc(e,t,n,zl,r),Cf(e,n);else if(dS(i,e,t,r,n))n.stopPropagation();else if(Cf(e,n),t&4&&-1<hS.indexOf(e)){for(;i!==null;){var s=xo(i);if(s!==null&&v_(s),s=hu(e,t,r,n),s===null&&tc(e,t,n,zl,r),s===i)break;i=s}i!==null&&n.stopPropagation()}else tc(e,t,n,null,r)}}var zl=null;function hu(e,t,r,n){if(zl=null,e=Gh(n),e=Gn(e),e!==null)if(t=fi(e),t===null)e=null;else if(r=t.tag,r===13){if(e=u_(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return zl=e,null}function b_(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(rS()){case Qh:return 1;case p_:return 4;case Al:case nS:return 16;case g_:return 536870912;default:return 16}default:return 16}}var yn=null,td=null,ul=null;function k_(){if(ul)return ul;var e,t=td,r=t.length,n,i="value"in yn?yn.value:yn.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 ul=i.slice(e,1<n?1-n:void 0)}function hl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function $o(){return!0}function Tf(){return!1}function rr(e){function t(r,n,i,s,o){this._reactName=r,this._targetInst=i,this.type=n,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?$o:Tf,this.isPropagationStopped=Tf,this}return qe(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=$o)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=$o)},persist:function(){},isPersistent:$o}),t}var Zi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rd=rr(Zi),So=qe({},Zi,{view:0,detail:0}),mS=rr(So),Va,qa,hs,pa=qe({},So,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nd,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==hs&&(hs&&e.type==="mousemove"?(Va=e.screenX-hs.screenX,qa=e.screenY-hs.screenY):qa=Va=0,hs=e),Va)},movementY:function(e){return"movementY"in e?e.movementY:qa}}),Rf=rr(pa),_S=qe({},pa,{dataTransfer:0}),vS=rr(_S),yS=qe({},So,{relatedTarget:0}),Ya=rr(yS),SS=qe({},Zi,{animationName:0,elapsedTime:0,pseudoElement:0}),xS=rr(SS),wS=qe({},Zi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bS=rr(wS),kS=qe({},Zi,{data:0}),If=rr(kS),CS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ES={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},TS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=TS[e])?!!t[e]:!1}function nd(){return RS}var IS=qe({},So,{key:function(e){if(e.key){var t=CS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ES[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nd,charCode:function(e){return e.type==="keypress"?hl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),LS=rr(IS),PS=qe({},pa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lf=rr(PS),DS=qe({},So,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nd}),MS=rr(DS),AS=qe({},Zi,{propertyName:0,elapsedTime:0,pseudoElement:0}),BS=rr(AS),NS=qe({},pa,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),zS=rr(NS),OS=[9,13,27,32],id=Jr&&"CompositionEvent"in window,Ns=null;Jr&&"documentMode"in document&&(Ns=document.documentMode);var jS=Jr&&"TextEvent"in window&&!Ns,C_=Jr&&(!id||Ns&&8<Ns&&11>=Ns),Pf=" ",Df=!1;function E_(e,t){switch(e){case"keyup":return OS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function T_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ki=!1;function FS(e,t){switch(e){case"compositionend":return T_(t);case"keypress":return t.which!==32?null:(Df=!0,Pf);case"textInput":return e=t.data,e===Pf&&Df?null:e;default:return null}}function $S(e,t){if(ki)return e==="compositionend"||!id&&E_(e,t)?(e=k_(),ul=td=yn=null,ki=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return C_&&t.locale!=="ko"?null:t.data;default:return null}}var WS={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Mf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!WS[e.type]:t==="textarea"}function R_(e,t,r,n){s_(n),t=Ol(t,"onChange"),0<t.length&&(r=new rd("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var zs=null,Js=null;function HS(e){j_(e,0)}function ga(e){var t=Ti(e);if(Zm(t))return e}function US(e,t){if(e==="change")return t}var I_=!1;if(Jr){var Xa;if(Jr){var Ga="oninput"in document;if(!Ga){var Af=document.createElement("div");Af.setAttribute("oninput","return;"),Ga=typeof Af.oninput=="function"}Xa=Ga}else Xa=!1;I_=Xa&&(!document.documentMode||9<document.documentMode)}function Bf(){zs&&(zs.detachEvent("onpropertychange",L_),Js=zs=null)}function L_(e){if(e.propertyName==="value"&&ga(Js)){var t=[];R_(t,Js,e,Gh(e)),c_(HS,t)}}function KS(e,t,r){e==="focusin"?(Bf(),zs=t,Js=r,zs.attachEvent("onpropertychange",L_)):e==="focusout"&&Bf()}function VS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ga(Js)}function qS(e,t){if(e==="click")return ga(t)}function YS(e,t){if(e==="input"||e==="change")return ga(t)}function XS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Er=typeof Object.is=="function"?Object.is:XS;function eo(e,t){if(Er(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(!qc.call(t,i)||!Er(e[i],t[i]))return!1}return!0}function Nf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function zf(e,t){var r=Nf(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=Nf(r)}}function P_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?P_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function D_(){for(var e=window,t=Pl();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Pl(e.document)}return t}function sd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function GS(e){var t=D_(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&P_(r.ownerDocument.documentElement,r)){if(n!==null&&sd(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=zf(r,s);var o=zf(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 QS=Jr&&"documentMode"in document&&11>=document.documentMode,Ci=null,du=null,Os=null,fu=!1;function Of(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;fu||Ci==null||Ci!==Pl(n)||(n=Ci,"selectionStart"in n&&sd(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}),Os&&eo(Os,n)||(Os=n,n=Ol(du,"onSelect"),0<n.length&&(t=new rd("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Ci)))}function Wo(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Ei={animationend:Wo("Animation","AnimationEnd"),animationiteration:Wo("Animation","AnimationIteration"),animationstart:Wo("Animation","AnimationStart"),transitionend:Wo("Transition","TransitionEnd")},Qa={},M_={};Jr&&(M_=document.createElement("div").style,"AnimationEvent"in window||(delete Ei.animationend.animation,delete Ei.animationiteration.animation,delete Ei.animationstart.animation),"TransitionEvent"in window||delete Ei.transitionend.transition);function ma(e){if(Qa[e])return Qa[e];if(!Ei[e])return e;var t=Ei[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in M_)return Qa[e]=t[r];return e}var A_=ma("animationend"),B_=ma("animationiteration"),N_=ma("animationstart"),z_=ma("transitionend"),O_=new Map,jf="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function An(e,t){O_.set(e,t),di(t,[e])}for(var Za=0;Za<jf.length;Za++){var Ja=jf[Za],ZS=Ja.toLowerCase(),JS=Ja[0].toUpperCase()+Ja.slice(1);An(ZS,"on"+JS)}An(A_,"onAnimationEnd");An(B_,"onAnimationIteration");An(N_,"onAnimationStart");An("dblclick","onDoubleClick");An("focusin","onFocus");An("focusout","onBlur");An(z_,"onTransitionEnd");Wi("onMouseEnter",["mouseout","mouseover"]);Wi("onMouseLeave",["mouseout","mouseover"]);Wi("onPointerEnter",["pointerout","pointerover"]);Wi("onPointerLeave",["pointerout","pointerover"]);di("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));di("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));di("onBeforeInput",["compositionend","keypress","textInput","paste"]);di("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));di("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));di("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Rs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),ex=new Set("cancel close invalid load scroll toggle".split(" ").concat(Rs));function Ff(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,Z1(n,t,void 0,e),e.currentTarget=null}function j_(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;Ff(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;Ff(i,l,c),s=a}}}if(Ml)throw e=au,Ml=!1,au=null,e}function Oe(e,t){var r=t[vu];r===void 0&&(r=t[vu]=new Set);var n=e+"__bubble";r.has(n)||(F_(t,e,2,!1),r.add(n))}function ec(e,t,r){var n=0;t&&(n|=4),F_(r,e,n,t)}var Ho="_reactListening"+Math.random().toString(36).slice(2);function to(e){if(!e[Ho]){e[Ho]=!0,qm.forEach(function(r){r!=="selectionchange"&&(ex.has(r)||ec(r,!1,e),ec(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ho]||(t[Ho]=!0,ec("selectionchange",!1,t))}}function F_(e,t,r,n){switch(b_(t)){case 1:var i=pS;break;case 4:i=gS;break;default:i=ed}r=i.bind(null,t,r,e),i=void 0,!lu||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 tc(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=Gn(l),o===null)return;if(a=o.tag,a===5||a===6){n=s=o;continue e}l=l.parentNode}}n=n.return}c_(function(){var c=s,h=Gh(r),u=[];e:{var d=O_.get(e);if(d!==void 0){var f=rd,g=e;switch(e){case"keypress":if(hl(r)===0)break e;case"keydown":case"keyup":f=LS;break;case"focusin":g="focus",f=Ya;break;case"focusout":g="blur",f=Ya;break;case"beforeblur":case"afterblur":f=Ya;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=Rf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=vS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=MS;break;case A_:case B_:case N_:f=xS;break;case z_:f=BS;break;case"scroll":f=mS;break;case"wheel":f=zS;break;case"copy":case"cut":case"paste":f=bS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=Lf}var m=(t&4)!==0,w=!m&&e==="scroll",_=m?d!==null?d+"Capture":null:d;m=[];for(var v=c,y;v!==null;){y=v;var T=y.stateNode;if(y.tag===5&&T!==null&&(y=T,_!==null&&(T=Xs(v,_),T!=null&&m.push(ro(v,T,y)))),w)break;v=v.return}0<m.length&&(d=new f(d,g,null,r,h),u.push({event:d,listeners:m}))}}if(!(t&7)){e:{if(d=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",d&&r!==su&&(g=r.relatedTarget||r.fromElement)&&(Gn(g)||g[en]))break e;if((f||d)&&(d=h.window===h?h:(d=h.ownerDocument)?d.defaultView||d.parentWindow:window,f?(g=r.relatedTarget||r.toElement,f=c,g=g?Gn(g):null,g!==null&&(w=fi(g),g!==w||g.tag!==5&&g.tag!==6)&&(g=null)):(f=null,g=c),f!==g)){if(m=Rf,T="onMouseLeave",_="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(m=Lf,T="onPointerLeave",_="onPointerEnter",v="pointer"),w=f==null?d:Ti(f),y=g==null?d:Ti(g),d=new m(T,v+"leave",f,r,h),d.target=w,d.relatedTarget=y,T=null,Gn(h)===c&&(m=new m(_,v+"enter",g,r,h),m.target=y,m.relatedTarget=w,T=m),w=T,f&&g)t:{for(m=f,_=g,v=0,y=m;y;y=_i(y))v++;for(y=0,T=_;T;T=_i(T))y++;for(;0<v-y;)m=_i(m),v--;for(;0<y-v;)_=_i(_),y--;for(;v--;){if(m===_||_!==null&&m===_.alternate)break t;m=_i(m),_=_i(_)}m=null}else m=null;f!==null&&$f(u,d,f,m,!1),g!==null&&w!==null&&$f(u,w,g,m,!0)}}e:{if(d=c?Ti(c):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var R=US;else if(Mf(d))if(I_)R=YS;else{R=VS;var x=KS}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(R=qS);if(R&&(R=R(e,c))){R_(u,R,r,h);break e}x&&x(e,d,c),e==="focusout"&&(x=d._wrapperState)&&x.controlled&&d.type==="number"&&eu(d,"number",d.value)}switch(x=c?Ti(c):window,e){case"focusin":(Mf(x)||x.contentEditable==="true")&&(Ci=x,du=c,Os=null);break;case"focusout":Os=du=Ci=null;break;case"mousedown":fu=!0;break;case"contextmenu":case"mouseup":case"dragend":fu=!1,Of(u,r,h);break;case"selectionchange":if(QS)break;case"keydown":case"keyup":Of(u,r,h)}var j;if(id)e:{switch(e){case"compositionstart":var H="onCompositionStart";break e;case"compositionend":H="onCompositionEnd";break e;case"compositionupdate":H="onCompositionUpdate";break e}H=void 0}else ki?E_(e,r)&&(H="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(H="onCompositionStart");H&&(C_&&r.locale!=="ko"&&(ki||H!=="onCompositionStart"?H==="onCompositionEnd"&&ki&&(j=k_()):(yn=h,td="value"in yn?yn.value:yn.textContent,ki=!0)),x=Ol(c,H),0<x.length&&(H=new If(H,e,null,r,h),u.push({event:H,listeners:x}),j?H.data=j:(j=T_(r),j!==null&&(H.data=j)))),(j=jS?FS(e,r):$S(e,r))&&(c=Ol(c,"onBeforeInput"),0<c.length&&(h=new If("onBeforeInput","beforeinput",null,r,h),u.push({event:h,listeners:c}),h.data=j))}j_(u,t)})}function ro(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Ol(e,t){for(var r=t+"Capture",n=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Xs(e,r),s!=null&&n.unshift(ro(e,s,i)),s=Xs(e,t),s!=null&&n.push(ro(e,s,i))),e=e.return}return n}function _i(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function $f(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=Xs(r,s),a!=null&&o.unshift(ro(r,a,l))):i||(a=Xs(r,s),a!=null&&o.push(ro(r,a,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var tx=/\r\n?/g,rx=/\u0000|\uFFFD/g;function Wf(e){return(typeof e=="string"?e:""+e).replace(tx,`
38
- `).replace(rx,"")}function Uo(e,t,r){if(t=Wf(t),Wf(e)!==t&&r)throw Error(ee(425))}function jl(){}var pu=null,gu=null;function mu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var _u=typeof setTimeout=="function"?setTimeout:void 0,nx=typeof clearTimeout=="function"?clearTimeout:void 0,Hf=typeof Promise=="function"?Promise:void 0,ix=typeof queueMicrotask=="function"?queueMicrotask:typeof Hf<"u"?function(e){return Hf.resolve(null).then(e).catch(sx)}:_u;function sx(e){setTimeout(function(){throw e})}function rc(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),Zs(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=i}while(r);Zs(t)}function En(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Uf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var Ji=Math.random().toString(36).slice(2),Br="__reactFiber$"+Ji,no="__reactProps$"+Ji,en="__reactContainer$"+Ji,vu="__reactEvents$"+Ji,ox="__reactListeners$"+Ji,lx="__reactHandles$"+Ji;function Gn(e){var t=e[Br];if(t)return t;for(var r=e.parentNode;r;){if(t=r[en]||r[Br]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Uf(e);e!==null;){if(r=e[Br])return r;e=Uf(e)}return t}e=r,r=e.parentNode}return null}function xo(e){return e=e[Br]||e[en],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ti(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ee(33))}function _a(e){return e[no]||null}var yu=[],Ri=-1;function Bn(e){return{current:e}}function Fe(e){0>Ri||(e.current=yu[Ri],yu[Ri]=null,Ri--)}function Ne(e,t){Ri++,yu[Ri]=e.current,e.current=t}var Mn={},Rt=Bn(Mn),Wt=Bn(!1),ii=Mn;function Hi(e,t){var r=e.type.contextTypes;if(!r)return Mn;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 Ht(e){return e=e.childContextTypes,e!=null}function Fl(){Fe(Wt),Fe(Rt)}function Kf(e,t,r){if(Rt.current!==Mn)throw Error(ee(168));Ne(Rt,t),Ne(Wt,r)}function $_(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(ee(108,K1(e)||"Unknown",i));return qe({},r,n)}function $l(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Mn,ii=Rt.current,Ne(Rt,e),Ne(Wt,Wt.current),!0}function Vf(e,t,r){var n=e.stateNode;if(!n)throw Error(ee(169));r?(e=$_(e,t,ii),n.__reactInternalMemoizedMergedChildContext=e,Fe(Wt),Fe(Rt),Ne(Rt,e)):Fe(Wt),Ne(Wt,r)}var qr=null,va=!1,nc=!1;function W_(e){qr===null?qr=[e]:qr.push(e)}function ax(e){va=!0,W_(e)}function Nn(){if(!nc&&qr!==null){nc=!0;var e=0,t=Le;try{var r=qr;for(Le=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}qr=null,va=!1}catch(i){throw qr!==null&&(qr=qr.slice(e+1)),f_(Qh,Nn),i}finally{Le=t,nc=!1}}return null}var Ii=[],Li=0,Wl=null,Hl=0,ar=[],cr=0,si=null,Xr=1,Gr="";function Hn(e,t){Ii[Li++]=Hl,Ii[Li++]=Wl,Wl=e,Hl=t}function H_(e,t,r){ar[cr++]=Xr,ar[cr++]=Gr,ar[cr++]=si,si=e;var n=Xr;e=Gr;var i=32-br(n)-1;n&=~(1<<i),r+=1;var s=32-br(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,Xr=1<<32-br(t)+i|r<<i|n,Gr=s+e}else Xr=1<<s|r<<i|n,Gr=e}function od(e){e.return!==null&&(Hn(e,1),H_(e,1,0))}function ld(e){for(;e===Wl;)Wl=Ii[--Li],Ii[Li]=null,Hl=Ii[--Li],Ii[Li]=null;for(;e===si;)si=ar[--cr],ar[cr]=null,Gr=ar[--cr],ar[cr]=null,Xr=ar[--cr],ar[cr]=null}var Zt=null,Qt=null,$e=!1,xr=null;function U_(e,t){var r=hr(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 qf(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,Zt=e,Qt=En(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Zt=e,Qt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=si!==null?{id:Xr,overflow:Gr}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=hr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Zt=e,Qt=null,!0):!1;default:return!1}}function Su(e){return(e.mode&1)!==0&&(e.flags&128)===0}function xu(e){if($e){var t=Qt;if(t){var r=t;if(!qf(e,t)){if(Su(e))throw Error(ee(418));t=En(r.nextSibling);var n=Zt;t&&qf(e,t)?U_(n,r):(e.flags=e.flags&-4097|2,$e=!1,Zt=e)}}else{if(Su(e))throw Error(ee(418));e.flags=e.flags&-4097|2,$e=!1,Zt=e}}}function Yf(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Zt=e}function Ko(e){if(e!==Zt)return!1;if(!$e)return Yf(e),$e=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!mu(e.type,e.memoizedProps)),t&&(t=Qt)){if(Su(e))throw K_(),Error(ee(418));for(;t;)U_(e,t),t=En(t.nextSibling)}if(Yf(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Qt=En(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Qt=null}}else Qt=Zt?En(e.stateNode.nextSibling):null;return!0}function K_(){for(var e=Qt;e;)e=En(e.nextSibling)}function Ui(){Qt=Zt=null,$e=!1}function ad(e){xr===null?xr=[e]:xr.push(e)}var cx=nn.ReactCurrentBatchConfig;function ds(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(ee(309));var n=r.stateNode}if(!n)throw Error(ee(147,e));var i=n,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(ee(284));if(!r._owner)throw Error(ee(290,e))}return e}function Vo(e,t){throw e=Object.prototype.toString.call(t),Error(ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Xf(e){var t=e._init;return t(e._payload)}function V_(e){function t(_,v){if(e){var y=_.deletions;y===null?(_.deletions=[v],_.flags|=16):y.push(v)}}function 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 _=Ln(_,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,T){return v===null||v.tag!==6?(v=uc(y,_.mode,T),v.return=_,v):(v=i(v,y),v.return=_,v)}function a(_,v,y,T){var R=y.type;return R===bi?h(_,v,y.props.children,T,y.key):v!==null&&(v.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===pn&&Xf(R)===v.type)?(T=i(v,y.props),T.ref=ds(_,v,y),T.return=_,T):(T=vl(y.type,y.key,y.props,null,_.mode,T),T.ref=ds(_,v,y),T.return=_,T)}function c(_,v,y,T){return v===null||v.tag!==4||v.stateNode.containerInfo!==y.containerInfo||v.stateNode.implementation!==y.implementation?(v=hc(y,_.mode,T),v.return=_,v):(v=i(v,y.children||[]),v.return=_,v)}function h(_,v,y,T,R){return v===null||v.tag!==7?(v=ti(y,_.mode,T,R),v.return=_,v):(v=i(v,y),v.return=_,v)}function u(_,v,y){if(typeof v=="string"&&v!==""||typeof v=="number")return v=uc(""+v,_.mode,y),v.return=_,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Bo:return y=vl(v.type,v.key,v.props,null,_.mode,y),y.ref=ds(_,null,v),y.return=_,y;case wi:return v=hc(v,_.mode,y),v.return=_,v;case pn:var T=v._init;return u(_,T(v._payload),y)}if(Es(v)||ls(v))return v=ti(v,_.mode,y,null),v.return=_,v;Vo(_,v)}return null}function d(_,v,y,T){var R=v!==null?v.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return R!==null?null:l(_,v,""+y,T);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Bo:return y.key===R?a(_,v,y,T):null;case wi:return y.key===R?c(_,v,y,T):null;case pn:return R=y._init,d(_,v,R(y._payload),T)}if(Es(y)||ls(y))return R!==null?null:h(_,v,y,T,null);Vo(_,y)}return null}function f(_,v,y,T,R){if(typeof T=="string"&&T!==""||typeof T=="number")return _=_.get(y)||null,l(v,_,""+T,R);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case Bo:return _=_.get(T.key===null?y:T.key)||null,a(v,_,T,R);case wi:return _=_.get(T.key===null?y:T.key)||null,c(v,_,T,R);case pn:var x=T._init;return f(_,v,y,x(T._payload),R)}if(Es(T)||ls(T))return _=_.get(y)||null,h(v,_,T,R,null);Vo(v,T)}return null}function g(_,v,y,T){for(var R=null,x=null,j=v,H=v=0,U=null;j!==null&&H<y.length;H++){j.index>H?(U=j,j=null):U=j.sibling;var E=d(_,j,y[H],T);if(E===null){j===null&&(j=U);break}e&&j&&E.alternate===null&&t(_,j),v=s(E,v,H),x===null?R=E:x.sibling=E,x=E,j=U}if(H===y.length)return r(_,j),$e&&Hn(_,H),R;if(j===null){for(;H<y.length;H++)j=u(_,y[H],T),j!==null&&(v=s(j,v,H),x===null?R=j:x.sibling=j,x=j);return $e&&Hn(_,H),R}for(j=n(_,j);H<y.length;H++)U=f(j,_,H,y[H],T),U!==null&&(e&&U.alternate!==null&&j.delete(U.key===null?H:U.key),v=s(U,v,H),x===null?R=U:x.sibling=U,x=U);return e&&j.forEach(function(I){return t(_,I)}),$e&&Hn(_,H),R}function m(_,v,y,T){var R=ls(y);if(typeof R!="function")throw Error(ee(150));if(y=R.call(y),y==null)throw Error(ee(151));for(var x=R=null,j=v,H=v=0,U=null,E=y.next();j!==null&&!E.done;H++,E=y.next()){j.index>H?(U=j,j=null):U=j.sibling;var I=d(_,j,E.value,T);if(I===null){j===null&&(j=U);break}e&&j&&I.alternate===null&&t(_,j),v=s(I,v,H),x===null?R=I:x.sibling=I,x=I,j=U}if(E.done)return r(_,j),$e&&Hn(_,H),R;if(j===null){for(;!E.done;H++,E=y.next())E=u(_,E.value,T),E!==null&&(v=s(E,v,H),x===null?R=E:x.sibling=E,x=E);return $e&&Hn(_,H),R}for(j=n(_,j);!E.done;H++,E=y.next())E=f(j,_,H,E.value,T),E!==null&&(e&&E.alternate!==null&&j.delete(E.key===null?H:E.key),v=s(E,v,H),x===null?R=E:x.sibling=E,x=E);return e&&j.forEach(function(M){return t(_,M)}),$e&&Hn(_,H),R}function w(_,v,y,T){if(typeof y=="object"&&y!==null&&y.type===bi&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Bo:e:{for(var R=y.key,x=v;x!==null;){if(x.key===R){if(R=y.type,R===bi){if(x.tag===7){r(_,x.sibling),v=i(x,y.props.children),v.return=_,_=v;break e}}else if(x.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===pn&&Xf(R)===x.type){r(_,x.sibling),v=i(x,y.props),v.ref=ds(_,x,y),v.return=_,_=v;break e}r(_,x);break}else t(_,x);x=x.sibling}y.type===bi?(v=ti(y.props.children,_.mode,T,y.key),v.return=_,_=v):(T=vl(y.type,y.key,y.props,null,_.mode,T),T.ref=ds(_,v,y),T.return=_,_=T)}return o(_);case wi:e:{for(x=y.key;v!==null;){if(v.key===x)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=hc(y,_.mode,T),v.return=_,_=v}return o(_);case pn:return x=y._init,w(_,v,x(y._payload),T)}if(Es(y))return g(_,v,y,T);if(ls(y))return m(_,v,y,T);Vo(_,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=uc(y,_.mode,T),v.return=_,_=v),o(_)):r(_,v)}return w}var Ki=V_(!0),q_=V_(!1),Ul=Bn(null),Kl=null,Pi=null,cd=null;function ud(){cd=Pi=Kl=null}function hd(e){var t=Ul.current;Fe(Ul),e._currentValue=t}function wu(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function ji(e,t){Kl=e,cd=Pi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&($t=!0),e.firstContext=null)}function pr(e){var t=e._currentValue;if(cd!==e)if(e={context:e,memoizedValue:t,next:null},Pi===null){if(Kl===null)throw Error(ee(308));Pi=e,Kl.dependencies={lanes:0,firstContext:e}}else Pi=Pi.next=e;return t}var Qn=null;function dd(e){Qn===null?Qn=[e]:Qn.push(e)}function Y_(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,dd(t)):(r.next=i.next,i.next=r),t.interleaved=r,tn(e,n)}function tn(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 gn=!1;function fd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function X_(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Zr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Tn(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Ie&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,tn(e,r)}return i=n.interleaved,i===null?(t.next=t,dd(n)):(t.next=i.next,i.next=t),n.interleaved=t,tn(e,r)}function dl(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,Zh(e,r)}}function Gf(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 Vl(e,t,r,n){var i=e.updateQueue;gn=!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 g=e,m=l;switch(d=t,f=r,m.tag){case 1:if(g=m.payload,typeof g=="function"){u=g.call(f,u,d);break e}u=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,d=typeof g=="function"?g.call(f,u,d):g,d==null)break e;u=qe({},u,d);break e;case 2:gn=!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);li|=o,e.lanes=o,e.memoizedState=u}}function Qf(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(i!==null){if(n.callback=null,n=r,typeof i!="function")throw Error(ee(191,i));i.call(n)}}}var wo={},Or=Bn(wo),io=Bn(wo),so=Bn(wo);function Zn(e){if(e===wo)throw Error(ee(174));return e}function pd(e,t){switch(Ne(so,t),Ne(io,e),Ne(Or,wo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ru(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ru(t,e)}Fe(Or),Ne(Or,t)}function Vi(){Fe(Or),Fe(io),Fe(so)}function G_(e){Zn(so.current);var t=Zn(Or.current),r=ru(t,e.type);t!==r&&(Ne(io,e),Ne(Or,r))}function gd(e){io.current===e&&(Fe(Or),Fe(io))}var Ke=Bn(0);function ql(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 ic=[];function md(){for(var e=0;e<ic.length;e++)ic[e]._workInProgressVersionPrimary=null;ic.length=0}var fl=nn.ReactCurrentDispatcher,sc=nn.ReactCurrentBatchConfig,oi=0,Ve=null,lt=null,ht=null,Yl=!1,js=!1,oo=0,ux=0;function bt(){throw Error(ee(321))}function _d(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Er(e[r],t[r]))return!1;return!0}function vd(e,t,r,n,i,s){if(oi=s,Ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,fl.current=e===null||e.memoizedState===null?px:gx,e=r(n,i),js){s=0;do{if(js=!1,oo=0,25<=s)throw Error(ee(301));s+=1,ht=lt=null,t.updateQueue=null,fl.current=mx,e=r(n,i)}while(js)}if(fl.current=Xl,t=lt!==null&&lt.next!==null,oi=0,ht=lt=Ve=null,Yl=!1,t)throw Error(ee(300));return e}function yd(){var e=oo!==0;return oo=0,e}function Dr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ht===null?Ve.memoizedState=ht=e:ht=ht.next=e,ht}function gr(){if(lt===null){var e=Ve.alternate;e=e!==null?e.memoizedState:null}else e=lt.next;var t=ht===null?Ve.memoizedState:ht.next;if(t!==null)ht=t,lt=e;else{if(e===null)throw Error(ee(310));lt=e,e={memoizedState:lt.memoizedState,baseState:lt.baseState,baseQueue:lt.baseQueue,queue:lt.queue,next:null},ht===null?Ve.memoizedState=ht=e:ht=ht.next=e}return ht}function lo(e,t){return typeof t=="function"?t(e):t}function oc(e){var t=gr(),r=t.queue;if(r===null)throw Error(ee(311));r.lastRenderedReducer=e;var n=lt,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((oi&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,Ve.lanes|=h,li|=h}c=c.next}while(c!==null&&c!==s);a===null?o=n:a.next=l,Er(n,t.memoizedState)||($t=!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,Ve.lanes|=s,li|=s,i=i.next;while(i!==e)}else i===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function lc(e){var t=gr(),r=t.queue;if(r===null)throw Error(ee(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,s=t.memoizedState;if(i!==null){r.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);Er(s,t.memoizedState)||($t=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function Q_(){}function Z_(e,t){var r=Ve,n=gr(),i=t(),s=!Er(n.memoizedState,i);if(s&&(n.memoizedState=i,$t=!0),n=n.queue,Sd(tv.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||ht!==null&&ht.memoizedState.tag&1){if(r.flags|=2048,ao(9,ev.bind(null,r,n,i,t),void 0,null),gt===null)throw Error(ee(349));oi&30||J_(r,t,i)}return i}function J_(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Ve.updateQueue,t===null?(t={lastEffect:null,stores:null},Ve.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function ev(e,t,r,n){t.value=r,t.getSnapshot=n,rv(t)&&nv(e)}function tv(e,t,r){return r(function(){rv(t)&&nv(e)})}function rv(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Er(e,r)}catch{return!0}}function nv(e){var t=tn(e,1);t!==null&&kr(t,e,1,-1)}function Zf(e){var t=Dr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:lo,lastRenderedState:e},t.queue=e,e=e.dispatch=fx.bind(null,Ve,e),[t.memoizedState,e]}function ao(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=Ve.updateQueue,t===null?(t={lastEffect:null,stores:null},Ve.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 iv(){return gr().memoizedState}function pl(e,t,r,n){var i=Dr();Ve.flags|=e,i.memoizedState=ao(1|t,r,void 0,n===void 0?null:n)}function ya(e,t,r,n){var i=gr();n=n===void 0?null:n;var s=void 0;if(lt!==null){var o=lt.memoizedState;if(s=o.destroy,n!==null&&_d(n,o.deps)){i.memoizedState=ao(t,r,s,n);return}}Ve.flags|=e,i.memoizedState=ao(1|t,r,s,n)}function Jf(e,t){return pl(8390656,8,e,t)}function Sd(e,t){return ya(2048,8,e,t)}function sv(e,t){return ya(4,2,e,t)}function ov(e,t){return ya(4,4,e,t)}function lv(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function av(e,t,r){return r=r!=null?r.concat([e]):null,ya(4,4,lv.bind(null,t,e),r)}function xd(){}function cv(e,t){var r=gr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&_d(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function uv(e,t){var r=gr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&_d(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function hv(e,t,r){return oi&21?(Er(r,t)||(r=m_(),Ve.lanes|=r,li|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,$t=!0),e.memoizedState=r)}function hx(e,t){var r=Le;Le=r!==0&&4>r?r:4,e(!0);var n=sc.transition;sc.transition={};try{e(!1),t()}finally{Le=r,sc.transition=n}}function dv(){return gr().memoizedState}function dx(e,t,r){var n=In(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},fv(e))pv(t,r);else if(r=Y_(e,t,r,n),r!==null){var i=Mt();kr(r,e,n,i),gv(r,t,n)}}function fx(e,t,r){var n=In(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(fv(e))pv(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,r);if(i.hasEagerState=!0,i.eagerState=l,Er(l,o)){var a=t.interleaved;a===null?(i.next=i,dd(t)):(i.next=a.next,a.next=i),t.interleaved=i;return}}catch{}finally{}r=Y_(e,t,i,n),r!==null&&(i=Mt(),kr(r,e,n,i),gv(r,t,n))}}function fv(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function pv(e,t){js=Yl=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function gv(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Zh(e,r)}}var Xl={readContext:pr,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useInsertionEffect:bt,useLayoutEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useMutableSource:bt,useSyncExternalStore:bt,useId:bt,unstable_isNewReconciler:!1},px={readContext:pr,useCallback:function(e,t){return Dr().memoizedState=[e,t===void 0?null:t],e},useContext:pr,useEffect:Jf,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,pl(4194308,4,lv.bind(null,t,e),r)},useLayoutEffect:function(e,t){return pl(4194308,4,e,t)},useInsertionEffect:function(e,t){return pl(4,2,e,t)},useMemo:function(e,t){var r=Dr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Dr();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=dx.bind(null,Ve,e),[n.memoizedState,e]},useRef:function(e){var t=Dr();return e={current:e},t.memoizedState=e},useState:Zf,useDebugValue:xd,useDeferredValue:function(e){return Dr().memoizedState=e},useTransition:function(){var e=Zf(!1),t=e[0];return e=hx.bind(null,e[1]),Dr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ve,i=Dr();if($e){if(r===void 0)throw Error(ee(407));r=r()}else{if(r=t(),gt===null)throw Error(ee(349));oi&30||J_(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,Jf(tv.bind(null,n,s,e),[e]),n.flags|=2048,ao(9,ev.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=Dr(),t=gt.identifierPrefix;if($e){var r=Gr,n=Xr;r=(n&~(1<<32-br(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=oo++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=ux++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},gx={readContext:pr,useCallback:cv,useContext:pr,useEffect:Sd,useImperativeHandle:av,useInsertionEffect:sv,useLayoutEffect:ov,useMemo:uv,useReducer:oc,useRef:iv,useState:function(){return oc(lo)},useDebugValue:xd,useDeferredValue:function(e){var t=gr();return hv(t,lt.memoizedState,e)},useTransition:function(){var e=oc(lo)[0],t=gr().memoizedState;return[e,t]},useMutableSource:Q_,useSyncExternalStore:Z_,useId:dv,unstable_isNewReconciler:!1},mx={readContext:pr,useCallback:cv,useContext:pr,useEffect:Sd,useImperativeHandle:av,useInsertionEffect:sv,useLayoutEffect:ov,useMemo:uv,useReducer:lc,useRef:iv,useState:function(){return lc(lo)},useDebugValue:xd,useDeferredValue:function(e){var t=gr();return lt===null?t.memoizedState=e:hv(t,lt.memoizedState,e)},useTransition:function(){var e=lc(lo)[0],t=gr().memoizedState;return[e,t]},useMutableSource:Q_,useSyncExternalStore:Z_,useId:dv,unstable_isNewReconciler:!1};function yr(e,t){if(e&&e.defaultProps){t=qe({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function bu(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:qe({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Sa={isMounted:function(e){return(e=e._reactInternals)?fi(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Mt(),i=In(e),s=Zr(n,i);s.payload=t,r!=null&&(s.callback=r),t=Tn(e,s,i),t!==null&&(kr(t,e,i,n),dl(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Mt(),i=In(e),s=Zr(n,i);s.tag=1,s.payload=t,r!=null&&(s.callback=r),t=Tn(e,s,i),t!==null&&(kr(t,e,i,n),dl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Mt(),n=In(e),i=Zr(r,n);i.tag=2,t!=null&&(i.callback=t),t=Tn(e,i,n),t!==null&&(kr(t,e,n,r),dl(t,e,n))}};function ep(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?!eo(r,n)||!eo(i,s):!0}function mv(e,t,r){var n=!1,i=Mn,s=t.contextType;return typeof s=="object"&&s!==null?s=pr(s):(i=Ht(t)?ii:Rt.current,n=t.contextTypes,s=(n=n!=null)?Hi(e,i):Mn),t=new t(r,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Sa,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function tp(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&&Sa.enqueueReplaceState(t,t.state,null)}function ku(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs={},fd(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=pr(s):(s=Ht(t)?ii:Rt.current,i.context=Hi(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(bu(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&&Sa.enqueueReplaceState(i,i.state,null),Vl(e,r,i,n),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function qi(e,t){try{var r="",n=t;do r+=U1(n),n=n.return;while(n);var i=r}catch(s){i=`
39
- Error generating stack: `+s.message+`
40
- `+s.stack}return{value:e,source:t,stack:i,digest:null}}function ac(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Cu(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var _x=typeof WeakMap=="function"?WeakMap:Map;function _v(e,t,r){r=Zr(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Ql||(Ql=!0,Bu=n),Cu(e,t)},r}function vv(e,t,r){r=Zr(-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(){Cu(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){Cu(e,t),typeof n!="function"&&(Rn===null?Rn=new Set([this]):Rn.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function rp(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new _x;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=Px.bind(null,e,t,r),t.then(e,e))}function np(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ip(e,t,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=Zr(-1,1),t.tag=2,Tn(r,t,1))),r.lanes|=1),e)}var vx=nn.ReactCurrentOwner,$t=!1;function Pt(e,t,r,n){t.child=e===null?q_(t,null,r,n):Ki(t,e.child,r,n)}function sp(e,t,r,n,i){r=r.render;var s=t.ref;return ji(t,i),n=vd(e,t,r,n,s,i),r=yd(),e!==null&&!$t?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,rn(e,t,i)):($e&&r&&od(t),t.flags|=1,Pt(e,t,n,i),t.child)}function op(e,t,r,n,i){if(e===null){var s=r.type;return typeof s=="function"&&!Id(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=s,yv(e,t,s,n,i)):(e=vl(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:eo,r(o,n)&&e.ref===t.ref)return rn(e,t,i)}return t.flags|=1,e=Ln(s,n),e.ref=t.ref,e.return=t,t.child=e}function yv(e,t,r,n,i){if(e!==null){var s=e.memoizedProps;if(eo(s,n)&&e.ref===t.ref)if($t=!1,t.pendingProps=n=s,(e.lanes&i)!==0)e.flags&131072&&($t=!0);else return t.lanes=e.lanes,rn(e,t,i)}return Eu(e,t,r,n,i)}function Sv(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},Ne(Mi,Xt),Xt|=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,Ne(Mi,Xt),Xt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,Ne(Mi,Xt),Xt|=n}else s!==null?(n=s.baseLanes|r,t.memoizedState=null):n=r,Ne(Mi,Xt),Xt|=n;return Pt(e,t,i,r),t.child}function xv(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Eu(e,t,r,n,i){var s=Ht(r)?ii:Rt.current;return s=Hi(t,s),ji(t,i),r=vd(e,t,r,n,s,i),n=yd(),e!==null&&!$t?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,rn(e,t,i)):($e&&n&&od(t),t.flags|=1,Pt(e,t,r,i),t.child)}function lp(e,t,r,n,i){if(Ht(r)){var s=!0;$l(t)}else s=!1;if(ji(t,i),t.stateNode===null)gl(e,t),mv(t,r,n),ku(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=pr(c):(c=Ht(r)?ii:Rt.current,c=Hi(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)&&tp(t,o,n,c),gn=!1;var d=t.memoizedState;o.state=d,Vl(t,n,o,i),a=t.memoizedState,l!==n||d!==a||Wt.current||gn?(typeof h=="function"&&(bu(t,r,h,n),a=t.memoizedState),(l=gn||ep(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,X_(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:yr(t.type,l),o.props=c,u=t.pendingProps,d=o.context,a=r.contextType,typeof a=="object"&&a!==null?a=pr(a):(a=Ht(r)?ii:Rt.current,a=Hi(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)&&tp(t,o,n,a),gn=!1,d=t.memoizedState,o.state=d,Vl(t,n,o,i);var g=t.memoizedState;l!==u||d!==g||Wt.current||gn?(typeof f=="function"&&(bu(t,r,f,n),g=t.memoizedState),(c=gn||ep(t,r,c,n,d,g,a)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,g,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,g,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=g),o.props=n,o.state=g,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 Tu(e,t,r,n,s,i)}function Tu(e,t,r,n,i,s){xv(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return i&&Vf(t,r,!1),rn(e,t,s);n=t.stateNode,vx.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=Ki(t,e.child,null,s),t.child=Ki(t,null,l,s)):Pt(e,t,l,s),t.memoizedState=n.state,i&&Vf(t,r,!0),t.child}function wv(e){var t=e.stateNode;t.pendingContext?Kf(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Kf(e,t.context,!1),pd(e,t.containerInfo)}function ap(e,t,r,n,i){return Ui(),ad(i),t.flags|=256,Pt(e,t,r,n),t.child}var Ru={dehydrated:null,treeContext:null,retryLane:0};function Iu(e){return{baseLanes:e,cachePool:null,transitions:null}}function bv(e,t,r){var n=t.pendingProps,i=Ke.current,s=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Ne(Ke,i&1),e===null)return xu(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=ba(o,n,0,null),e=ti(e,n,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Iu(r),t.memoizedState=Ru,e):wd(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return yx(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=Ln(i,a),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=Ln(l,s):(s=ti(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?Iu(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~r,t.memoizedState=Ru,n}return s=e.child,e=s.sibling,n=Ln(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 wd(e,t){return t=ba({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function qo(e,t,r,n){return n!==null&&ad(n),Ki(t,e.child,null,r),e=wd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yx(e,t,r,n,i,s,o){if(r)return t.flags&256?(t.flags&=-257,n=ac(Error(ee(422))),qo(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=ba({mode:"visible",children:n.children},i,0,null),s=ti(s,i,o,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,t.mode&1&&Ki(t,e.child,null,o),t.child.memoizedState=Iu(o),t.memoizedState=Ru,s);if(!(t.mode&1))return qo(e,t,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,s=Error(ee(419)),n=ac(s,n,void 0),qo(e,t,o,n)}if(l=(o&e.childLanes)!==0,$t||l){if(n=gt,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,tn(e,i),kr(n,e,i,-1))}return Rd(),n=ac(Error(ee(421))),qo(e,t,o,n)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Dx.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,Qt=En(i.nextSibling),Zt=t,$e=!0,xr=null,e!==null&&(ar[cr++]=Xr,ar[cr++]=Gr,ar[cr++]=si,Xr=e.id,Gr=e.overflow,si=t),t=wd(t,n.children),t.flags|=4096,t)}function cp(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),wu(e.return,t,r)}function cc(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 kv(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(Pt(e,t,n.children,r),n=Ke.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&&cp(e,r,t);else if(e.tag===19)cp(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(Ne(Ke,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&&ql(e)===null&&(i=r),r=r.sibling;r=i,r===null?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),cc(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&&ql(e)===null){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}cc(t,!0,r,null,s);break;case"together":cc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function gl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function rn(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),li|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ee(153));if(t.child!==null){for(e=t.child,r=Ln(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Ln(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Sx(e,t,r){switch(t.tag){case 3:wv(t),Ui();break;case 5:G_(t);break;case 1:Ht(t.type)&&$l(t);break;case 4:pd(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;Ne(Ul,n._currentValue),n._currentValue=i;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(Ne(Ke,Ke.current&1),t.flags|=128,null):r&t.child.childLanes?bv(e,t,r):(Ne(Ke,Ke.current&1),e=rn(e,t,r),e!==null?e.sibling:null);Ne(Ke,Ke.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return kv(e,t,r);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ne(Ke,Ke.current),n)break;return null;case 22:case 23:return t.lanes=0,Sv(e,t,r)}return rn(e,t,r)}var Cv,Lu,Ev,Tv;Cv=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}};Lu=function(){};Ev=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,Zn(Or.current);var s=null;switch(r){case"input":i=Zc(e,i),n=Zc(e,n),s=[];break;case"select":i=qe({},i,{value:void 0}),n=qe({},n,{value:void 0}),s=[];break;case"textarea":i=tu(e,i),n=tu(e,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=jl)}nu(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"&&(qs.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"&&(qs.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&Oe("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)}};Tv=function(e,t,r,n){r!==n&&(t.flags|=4)};function fs(e,t){if(!$e)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 kt(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 xx(e,t,r){var n=t.pendingProps;switch(ld(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(t),null;case 1:return Ht(t.type)&&Fl(),kt(t),null;case 3:return n=t.stateNode,Vi(),Fe(Wt),Fe(Rt),md(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ko(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,xr!==null&&(Ou(xr),xr=null))),Lu(e,t),kt(t),null;case 5:gd(t);var i=Zn(so.current);if(r=t.type,e!==null&&t.stateNode!=null)Ev(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(ee(166));return kt(t),null}if(e=Zn(Or.current),Ko(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[Br]=t,n[no]=s,e=(t.mode&1)!==0,r){case"dialog":Oe("cancel",n),Oe("close",n);break;case"iframe":case"object":case"embed":Oe("load",n);break;case"video":case"audio":for(i=0;i<Rs.length;i++)Oe(Rs[i],n);break;case"source":Oe("error",n);break;case"img":case"image":case"link":Oe("error",n),Oe("load",n);break;case"details":Oe("toggle",n);break;case"input":vf(n,s),Oe("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},Oe("invalid",n);break;case"textarea":Sf(n,s),Oe("invalid",n)}nu(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&&Uo(n.textContent,l,e),i=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Uo(n.textContent,l,e),i=["children",""+l]):qs.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Oe("scroll",n)}switch(r){case"input":No(n),yf(n,s,!0);break;case"textarea":No(n),xf(n);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(n.onclick=jl)}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=t_(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[Br]=t,e[no]=n,Cv(e,t,!1,!1),t.stateNode=e;e:{switch(o=iu(r,n),r){case"dialog":Oe("cancel",e),Oe("close",e),i=n;break;case"iframe":case"object":case"embed":Oe("load",e),i=n;break;case"video":case"audio":for(i=0;i<Rs.length;i++)Oe(Rs[i],e);i=n;break;case"source":Oe("error",e),i=n;break;case"img":case"image":case"link":Oe("error",e),Oe("load",e),i=n;break;case"details":Oe("toggle",e),i=n;break;case"input":vf(e,n),i=Zc(e,n),Oe("invalid",e);break;case"option":i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=qe({},n,{value:void 0}),Oe("invalid",e);break;case"textarea":Sf(e,n),i=tu(e,n),Oe("invalid",e);break;default:i=n}nu(r,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?i_(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&r_(e,a)):s==="children"?typeof a=="string"?(r!=="textarea"||a!=="")&&Ys(e,a):typeof a=="number"&&Ys(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(qs.hasOwnProperty(s)?a!=null&&s==="onScroll"&&Oe("scroll",e):a!=null&&Vh(e,s,a,o))}switch(r){case"input":No(e),yf(e,n,!1);break;case"textarea":No(e),xf(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Dn(n.value));break;case"select":e.multiple=!!n.multiple,s=n.value,s!=null?Bi(e,!!n.multiple,s,!1):n.defaultValue!=null&&Bi(e,!!n.multiple,n.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=jl)}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 kt(t),null;case 6:if(e&&t.stateNode!=null)Tv(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(ee(166));if(r=Zn(so.current),Zn(Or.current),Ko(t)){if(n=t.stateNode,r=t.memoizedProps,n[Br]=t,(s=n.nodeValue!==r)&&(e=Zt,e!==null))switch(e.tag){case 3:Uo(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Uo(n.nodeValue,r,(e.mode&1)!==0)}s&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Br]=t,t.stateNode=n}return kt(t),null;case 13:if(Fe(Ke),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if($e&&Qt!==null&&t.mode&1&&!(t.flags&128))K_(),Ui(),t.flags|=98560,s=!1;else if(s=Ko(t),n!==null&&n.dehydrated!==null){if(e===null){if(!s)throw Error(ee(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ee(317));s[Br]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kt(t),s=!1}else xr!==null&&(Ou(xr),xr=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||Ke.current&1?at===0&&(at=3):Rd())),t.updateQueue!==null&&(t.flags|=4),kt(t),null);case 4:return Vi(),Lu(e,t),e===null&&to(t.stateNode.containerInfo),kt(t),null;case 10:return hd(t.type._context),kt(t),null;case 17:return Ht(t.type)&&Fl(),kt(t),null;case 19:if(Fe(Ke),s=t.memoizedState,s===null)return kt(t),null;if(n=(t.flags&128)!==0,o=s.rendering,o===null)if(n)fs(s,!1);else{if(at!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ql(e),o!==null){for(t.flags|=128,fs(s,!1),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 Ne(Ke,Ke.current&1|2),t.child}e=e.sibling}s.tail!==null&&Je()>Yi&&(t.flags|=128,n=!0,fs(s,!1),t.lanes=4194304)}else{if(!n)if(e=ql(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),fs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!$e)return kt(t),null}else 2*Je()-s.renderingStartTime>Yi&&r!==1073741824&&(t.flags|=128,n=!0,fs(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=Je(),t.sibling=null,r=Ke.current,Ne(Ke,n?r&1|2:r&1),t):(kt(t),null);case 22:case 23:return Td(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Xt&1073741824&&(kt(t),t.subtreeFlags&6&&(t.flags|=8192)):kt(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function wx(e,t){switch(ld(t),t.tag){case 1:return Ht(t.type)&&Fl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi(),Fe(Wt),Fe(Rt),md(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return gd(t),null;case 13:if(Fe(Ke),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Fe(Ke),null;case 4:return Vi(),null;case 10:return hd(t.type._context),null;case 22:case 23:return Td(),null;case 24:return null;default:return null}}var Yo=!1,Et=!1,bx=typeof WeakSet=="function"?WeakSet:Set,de=null;function Di(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Xe(e,t,n)}else r.current=null}function Pu(e,t,r){try{r()}catch(n){Xe(e,t,n)}}var up=!1;function kx(e,t){if(pu=Nl,e=D_(),sd(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(gu={focusedElem:e,selectionRange:r},Nl=!1,de=t;de!==null;)if(t=de,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,de=e;else for(;de!==null;){t=de;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,w=g.memoizedState,_=t.stateNode,v=_.getSnapshotBeforeUpdate(t.elementType===t.type?m:yr(t.type,m),w);_.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(T){Xe(t,t.return,T)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return g=up,up=!1,g}function Fs(e,t,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&&Pu(t,r,s)}i=i.next}while(i!==n)}}function xa(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 Du(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 Rv(e){var t=e.alternate;t!==null&&(e.alternate=null,Rv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Br],delete t[no],delete t[vu],delete t[ox],delete t[lx])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Iv(e){return e.tag===5||e.tag===3||e.tag===4}function hp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Iv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Mu(e,t,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=jl));else if(n!==4&&(e=e.child,e!==null))for(Mu(e,t,r),e=e.sibling;e!==null;)Mu(e,t,r),e=e.sibling}function Au(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(Au(e,t,r),e=e.sibling;e!==null;)Au(e,t,r),e=e.sibling}var _t=null,Sr=!1;function cn(e,t,r){for(r=r.child;r!==null;)Lv(e,t,r),r=r.sibling}function Lv(e,t,r){if(zr&&typeof zr.onCommitFiberUnmount=="function")try{zr.onCommitFiberUnmount(fa,r)}catch{}switch(r.tag){case 5:Et||Di(r,t);case 6:var n=_t,i=Sr;_t=null,cn(e,t,r),_t=n,Sr=i,_t!==null&&(Sr?(e=_t,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):_t.removeChild(r.stateNode));break;case 18:_t!==null&&(Sr?(e=_t,r=r.stateNode,e.nodeType===8?rc(e.parentNode,r):e.nodeType===1&&rc(e,r),Zs(e)):rc(_t,r.stateNode));break;case 4:n=_t,i=Sr,_t=r.stateNode.containerInfo,Sr=!0,cn(e,t,r),_t=n,Sr=i;break;case 0:case 11:case 14:case 15:if(!Et&&(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)&&Pu(r,t,o),i=i.next}while(i!==n)}cn(e,t,r);break;case 1:if(!Et&&(Di(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){Xe(r,t,l)}cn(e,t,r);break;case 21:cn(e,t,r);break;case 22:r.mode&1?(Et=(n=Et)||r.memoizedState!==null,cn(e,t,r),Et=n):cn(e,t,r);break;default:cn(e,t,r)}}function dp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new bx),t.forEach(function(n){var i=Mx.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function _r(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:_t=l.stateNode,Sr=!1;break e;case 3:_t=l.stateNode.containerInfo,Sr=!0;break e;case 4:_t=l.stateNode.containerInfo,Sr=!0;break e}l=l.return}if(_t===null)throw Error(ee(160));Lv(s,o,i),_t=null,Sr=!1;var a=i.alternate;a!==null&&(a.return=null),i.return=null}catch(c){Xe(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Pv(t,e),t=t.sibling}function Pv(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(_r(t,e),Rr(e),n&4){try{Fs(3,e,e.return),xa(3,e)}catch(m){Xe(e,e.return,m)}try{Fs(5,e,e.return)}catch(m){Xe(e,e.return,m)}}break;case 1:_r(t,e),Rr(e),n&512&&r!==null&&Di(r,r.return);break;case 5:if(_r(t,e),Rr(e),n&512&&r!==null&&Di(r,r.return),e.flags&32){var i=e.stateNode;try{Ys(i,"")}catch(m){Xe(e,e.return,m)}}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&&Jm(i,s),iu(l,o);var c=iu(l,s);for(o=0;o<a.length;o+=2){var h=a[o],u=a[o+1];h==="style"?i_(i,u):h==="dangerouslySetInnerHTML"?r_(i,u):h==="children"?Ys(i,u):Vh(i,h,u,c)}switch(l){case"input":Jc(i,s);break;case"textarea":e_(i,s);break;case"select":var d=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var f=s.value;f!=null?Bi(i,!!s.multiple,f,!1):d!==!!s.multiple&&(s.defaultValue!=null?Bi(i,!!s.multiple,s.defaultValue,!0):Bi(i,!!s.multiple,s.multiple?[]:"",!1))}i[no]=s}catch(m){Xe(e,e.return,m)}}break;case 6:if(_r(t,e),Rr(e),n&4){if(e.stateNode===null)throw Error(ee(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(m){Xe(e,e.return,m)}}break;case 3:if(_r(t,e),Rr(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Zs(t.containerInfo)}catch(m){Xe(e,e.return,m)}break;case 4:_r(t,e),Rr(e);break;case 13:_r(t,e),Rr(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Cd=Je())),n&4&&dp(e);break;case 22:if(h=r!==null&&r.memoizedState!==null,e.mode&1?(Et=(c=Et)||h,_r(t,e),Et=c):_r(t,e),Rr(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:Fs(4,d,d.return);break;case 1:Di(d,d.return);var g=d.stateNode;if(typeof g.componentWillUnmount=="function"){n=d,r=d.return;try{t=n,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(m){Xe(n,r,m)}}break;case 5:Di(d,d.return);break;case 22:if(d.memoizedState!==null){pp(u);continue}}f!==null?(f.return=d,de=f):pp(u)}h=h.sibling}e:for(h=null,u=e;;){if(u.tag===5){if(h===null){h=u;try{i=u.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=u.stateNode,a=u.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=n_("display",o))}catch(m){Xe(e,e.return,m)}}}else if(u.tag===6){if(h===null)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(m){Xe(e,e.return,m)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;h===u&&(h=null),u=u.return}h===u&&(h=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:_r(t,e),Rr(e),n&4&&dp(e);break;case 21:break;default:_r(t,e),Rr(e)}}function Rr(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(Iv(r)){var n=r;break e}r=r.return}throw Error(ee(160))}switch(n.tag){case 5:var i=n.stateNode;n.flags&32&&(Ys(i,""),n.flags&=-33);var s=hp(e);Au(e,s,i);break;case 3:case 4:var o=n.stateNode.containerInfo,l=hp(e);Mu(e,l,o);break;default:throw Error(ee(161))}}catch(a){Xe(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Cx(e,t,r){de=e,Dv(e)}function Dv(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||Yo;if(!o){var l=i.alternate,a=l!==null&&l.memoizedState!==null||Et;l=Yo;var c=Et;if(Yo=o,(Et=a)&&!c)for(de=i;de!==null;)o=de,a=o.child,o.tag===22&&o.memoizedState!==null?gp(i):a!==null?(a.return=o,de=a):gp(i);for(;s!==null;)de=s,Dv(s),s=s.sibling;de=i,Yo=l,Et=c}fp(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,de=s):fp(e)}}function fp(e){for(;de!==null;){var t=de;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Et||xa(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Et)if(r===null)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:yr(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Qf(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}Qf(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&&Zs(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ee(163))}Et||t.flags&512&&Du(t)}catch(d){Xe(t,t.return,d)}}if(t===e){de=null;break}if(r=t.sibling,r!==null){r.return=t.return,de=r;break}de=t.return}}function pp(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 gp(e){for(;de!==null;){var t=de;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{xa(4,t)}catch(a){Xe(t,r,a)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var i=t.return;try{n.componentDidMount()}catch(a){Xe(t,i,a)}}var s=t.return;try{Du(t)}catch(a){Xe(t,s,a)}break;case 5:var o=t.return;try{Du(t)}catch(a){Xe(t,o,a)}}}catch(a){Xe(t,t.return,a)}if(t===e){de=null;break}var l=t.sibling;if(l!==null){l.return=t.return,de=l;break}de=t.return}}var Ex=Math.ceil,Gl=nn.ReactCurrentDispatcher,bd=nn.ReactCurrentOwner,dr=nn.ReactCurrentBatchConfig,Ie=0,gt=null,nt=null,St=0,Xt=0,Mi=Bn(0),at=0,co=null,li=0,wa=0,kd=0,$s=null,Ft=null,Cd=0,Yi=1/0,Vr=null,Ql=!1,Bu=null,Rn=null,Xo=!1,Sn=null,Zl=0,Ws=0,Nu=null,ml=-1,_l=0;function Mt(){return Ie&6?Je():ml!==-1?ml:ml=Je()}function In(e){return e.mode&1?Ie&2&&St!==0?St&-St:cx.transition!==null?(_l===0&&(_l=m_()),_l):(e=Le,e!==0||(e=window.event,e=e===void 0?16:b_(e.type)),e):1}function kr(e,t,r,n){if(50<Ws)throw Ws=0,Nu=null,Error(ee(185));yo(e,r,n),(!(Ie&2)||e!==gt)&&(e===gt&&(!(Ie&2)&&(wa|=r),at===4&&vn(e,St)),Ut(e,n),r===1&&Ie===0&&!(t.mode&1)&&(Yi=Je()+500,va&&Nn()))}function Ut(e,t){var r=e.callbackNode;cS(e,t);var n=Bl(e,e===gt?St:0);if(n===0)r!==null&&kf(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&kf(r),t===1)e.tag===0?ax(mp.bind(null,e)):W_(mp.bind(null,e)),ix(function(){!(Ie&6)&&Nn()}),r=null;else{switch(__(n)){case 1:r=Qh;break;case 4:r=p_;break;case 16:r=Al;break;case 536870912:r=g_;break;default:r=Al}r=Fv(r,Mv.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function Mv(e,t){if(ml=-1,_l=0,Ie&6)throw Error(ee(327));var r=e.callbackNode;if(Fi()&&e.callbackNode!==r)return null;var n=Bl(e,e===gt?St:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Jl(e,n);else{t=n;var i=Ie;Ie|=2;var s=Bv();(gt!==e||St!==t)&&(Vr=null,Yi=Je()+500,ei(e,t));do try{Ix();break}catch(l){Av(e,l)}while(!0);ud(),Gl.current=s,Ie=i,nt!==null?t=0:(gt=null,St=0,t=at)}if(t!==0){if(t===2&&(i=cu(e),i!==0&&(n=i,t=zu(e,i))),t===1)throw r=co,ei(e,0),vn(e,n),Ut(e,Je()),r;if(t===6)vn(e,n);else{if(i=e.current.alternate,!(n&30)&&!Tx(i)&&(t=Jl(e,n),t===2&&(s=cu(e),s!==0&&(n=s,t=zu(e,s))),t===1))throw r=co,ei(e,0),vn(e,n),Ut(e,Je()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(ee(345));case 2:Un(e,Ft,Vr);break;case 3:if(vn(e,n),(n&130023424)===n&&(t=Cd+500-Je(),10<t)){if(Bl(e,0)!==0)break;if(i=e.suspendedLanes,(i&n)!==n){Mt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=_u(Un.bind(null,e,Ft,Vr),t);break}Un(e,Ft,Vr);break;case 4:if(vn(e,n),(n&4194240)===n)break;for(t=e.eventTimes,i=-1;0<n;){var o=31-br(n);s=1<<o,o=t[o],o>i&&(i=o),n&=~s}if(n=i,n=Je()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Ex(n/1960))-n,10<n){e.timeoutHandle=_u(Un.bind(null,e,Ft,Vr),n);break}Un(e,Ft,Vr);break;case 5:Un(e,Ft,Vr);break;default:throw Error(ee(329))}}}return Ut(e,Je()),e.callbackNode===r?Mv.bind(null,e):null}function zu(e,t){var r=$s;return e.current.memoizedState.isDehydrated&&(ei(e,t).flags|=256),e=Jl(e,t),e!==2&&(t=Ft,Ft=r,t!==null&&Ou(t)),e}function Ou(e){Ft===null?Ft=e:Ft.push.apply(Ft,e)}function Tx(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(!Er(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 vn(e,t){for(t&=~kd,t&=~wa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-br(t),n=1<<r;e[r]=-1,t&=~n}}function mp(e){if(Ie&6)throw Error(ee(327));Fi();var t=Bl(e,0);if(!(t&1))return Ut(e,Je()),null;var r=Jl(e,t);if(e.tag!==0&&r===2){var n=cu(e);n!==0&&(t=n,r=zu(e,n))}if(r===1)throw r=co,ei(e,0),vn(e,t),Ut(e,Je()),r;if(r===6)throw Error(ee(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Un(e,Ft,Vr),Ut(e,Je()),null}function Ed(e,t){var r=Ie;Ie|=1;try{return e(t)}finally{Ie=r,Ie===0&&(Yi=Je()+500,va&&Nn())}}function ai(e){Sn!==null&&Sn.tag===0&&!(Ie&6)&&Fi();var t=Ie;Ie|=1;var r=dr.transition,n=Le;try{if(dr.transition=null,Le=1,e)return e()}finally{Le=n,dr.transition=r,Ie=t,!(Ie&6)&&Nn()}}function Td(){Xt=Mi.current,Fe(Mi)}function ei(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,nx(r)),nt!==null)for(r=nt.return;r!==null;){var n=r;switch(ld(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Fl();break;case 3:Vi(),Fe(Wt),Fe(Rt),md();break;case 5:gd(n);break;case 4:Vi();break;case 13:Fe(Ke);break;case 19:Fe(Ke);break;case 10:hd(n.type._context);break;case 22:case 23:Td()}r=r.return}if(gt=e,nt=e=Ln(e.current,null),St=Xt=t,at=0,co=null,kd=wa=li=0,Ft=$s=null,Qn!==null){for(t=0;t<Qn.length;t++)if(r=Qn[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}Qn=null}return e}function Av(e,t){do{var r=nt;try{if(ud(),fl.current=Xl,Yl){for(var n=Ve.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}Yl=!1}if(oi=0,ht=lt=Ve=null,js=!1,oo=0,bd.current=null,r===null||r.return===null){at=1,co=t,nt=null;break}e:{var s=e,o=r.return,l=r,a=t;if(t=St,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var c=a,h=l,u=h.tag;if(!(h.mode&1)&&(u===0||u===11||u===15)){var d=h.alternate;d?(h.updateQueue=d.updateQueue,h.memoizedState=d.memoizedState,h.lanes=d.lanes):(h.updateQueue=null,h.memoizedState=null)}var f=np(o);if(f!==null){f.flags&=-257,ip(f,o,l,s,t),f.mode&1&&rp(s,c,t),t=f,a=c;var g=t.updateQueue;if(g===null){var m=new Set;m.add(a),t.updateQueue=m}else g.add(a);break e}else{if(!(t&1)){rp(s,c,t),Rd();break e}a=Error(ee(426))}}else if($e&&l.mode&1){var w=np(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),ip(w,o,l,s,t),ad(qi(a,l));break e}}s=a=qi(a,l),at!==4&&(at=2),$s===null?$s=[s]:$s.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var _=_v(s,a,t);Gf(s,_);break e;case 1:l=a;var v=s.type,y=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Rn===null||!Rn.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t;var T=vv(s,l,t);Gf(s,T);break e}}s=s.return}while(s!==null)}zv(r)}catch(R){t=R,nt===r&&r!==null&&(nt=r=r.return);continue}break}while(!0)}function Bv(){var e=Gl.current;return Gl.current=Xl,e===null?Xl:e}function Rd(){(at===0||at===3||at===2)&&(at=4),gt===null||!(li&268435455)&&!(wa&268435455)||vn(gt,St)}function Jl(e,t){var r=Ie;Ie|=2;var n=Bv();(gt!==e||St!==t)&&(Vr=null,ei(e,t));do try{Rx();break}catch(i){Av(e,i)}while(!0);if(ud(),Ie=r,Gl.current=n,nt!==null)throw Error(ee(261));return gt=null,St=0,at}function Rx(){for(;nt!==null;)Nv(nt)}function Ix(){for(;nt!==null&&!eS();)Nv(nt)}function Nv(e){var t=jv(e.alternate,e,Xt);e.memoizedProps=e.pendingProps,t===null?zv(e):nt=t,bd.current=null}function zv(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=wx(r,t),r!==null){r.flags&=32767,nt=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{at=6,nt=null;return}}else if(r=xx(r,t,Xt),r!==null){nt=r;return}if(t=t.sibling,t!==null){nt=t;return}nt=t=e}while(t!==null);at===0&&(at=5)}function Un(e,t,r){var n=Le,i=dr.transition;try{dr.transition=null,Le=1,Lx(e,t,r,n)}finally{dr.transition=i,Le=n}return null}function Lx(e,t,r,n){do Fi();while(Sn!==null);if(Ie&6)throw Error(ee(327));r=e.finishedWork;var i=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(ee(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(uS(e,s),e===gt&&(nt=gt=null,St=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Xo||(Xo=!0,Fv(Al,function(){return Fi(),null})),s=(r.flags&15990)!==0,r.subtreeFlags&15990||s){s=dr.transition,dr.transition=null;var o=Le;Le=1;var l=Ie;Ie|=4,bd.current=null,kx(e,r),Pv(r,e),GS(gu),Nl=!!pu,gu=pu=null,e.current=r,Cx(r),tS(),Ie=l,Le=o,dr.transition=s}else e.current=r;if(Xo&&(Xo=!1,Sn=e,Zl=i),s=e.pendingLanes,s===0&&(Rn=null),iS(r.stateNode),Ut(e,Je()),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(Ql)throw Ql=!1,e=Bu,Bu=null,e;return Zl&1&&e.tag!==0&&Fi(),s=e.pendingLanes,s&1?e===Nu?Ws++:(Ws=0,Nu=e):Ws=0,Nn(),null}function Fi(){if(Sn!==null){var e=__(Zl),t=dr.transition,r=Le;try{if(dr.transition=null,Le=16>e?16:e,Sn===null)var n=!1;else{if(e=Sn,Sn=null,Zl=0,Ie&6)throw Error(ee(331));var i=Ie;for(Ie|=4,de=e.current;de!==null;){var s=de,o=s.child;if(de.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(de=c;de!==null;){var h=de;switch(h.tag){case 0:case 11:case 15:Fs(8,h,s)}var u=h.child;if(u!==null)u.return=h,de=u;else for(;de!==null;){h=de;var d=h.sibling,f=h.return;if(Rv(h),h===c){de=null;break}if(d!==null){d.return=f,de=d;break}de=f}}}var g=s.alternate;if(g!==null){var m=g.child;if(m!==null){g.child=null;do{var w=m.sibling;m.sibling=null,m=w}while(m!==null)}}de=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,de=o;else e:for(;de!==null;){if(s=de,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Fs(9,s,s.return)}var _=s.sibling;if(_!==null){_.return=s.return,de=_;break e}de=s.return}}var v=e.current;for(de=v;de!==null;){o=de;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,de=y;else e:for(o=v;de!==null;){if(l=de,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:xa(9,l)}}catch(R){Xe(l,l.return,R)}if(l===o){de=null;break e}var T=l.sibling;if(T!==null){T.return=l.return,de=T;break e}de=l.return}}if(Ie=i,Nn(),zr&&typeof zr.onPostCommitFiberRoot=="function")try{zr.onPostCommitFiberRoot(fa,e)}catch{}n=!0}return n}finally{Le=r,dr.transition=t}}return!1}function _p(e,t,r){t=qi(r,t),t=_v(e,t,1),e=Tn(e,t,1),t=Mt(),e!==null&&(yo(e,1,t),Ut(e,t))}function Xe(e,t,r){if(e.tag===3)_p(e,e,r);else for(;t!==null;){if(t.tag===3){_p(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Rn===null||!Rn.has(n))){e=qi(r,e),e=vv(t,e,1),t=Tn(t,e,1),e=Mt(),t!==null&&(yo(t,1,e),Ut(t,e));break}}t=t.return}}function Px(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=Mt(),e.pingedLanes|=e.suspendedLanes&r,gt===e&&(St&r)===r&&(at===4||at===3&&(St&130023424)===St&&500>Je()-Cd?ei(e,0):kd|=r),Ut(e,t)}function Ov(e,t){t===0&&(e.mode&1?(t=jo,jo<<=1,!(jo&130023424)&&(jo=4194304)):t=1);var r=Mt();e=tn(e,t),e!==null&&(yo(e,t,r),Ut(e,r))}function Dx(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Ov(e,r)}function Mx(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(ee(314))}n!==null&&n.delete(t),Ov(e,r)}var jv;jv=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Wt.current)$t=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return $t=!1,Sx(e,t,r);$t=!!(e.flags&131072)}else $t=!1,$e&&t.flags&1048576&&H_(t,Hl,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;gl(e,t),e=t.pendingProps;var i=Hi(t,Rt.current);ji(t,r),i=vd(null,t,n,e,i,r);var s=yd();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ht(n)?(s=!0,$l(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,fd(t),i.updater=Sa,t.stateNode=i,i._reactInternals=t,ku(t,n,e,r),t=Tu(null,t,n,!0,s,r)):(t.tag=0,$e&&s&&od(t),Pt(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(gl(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=Bx(n),e=yr(n,e),i){case 0:t=Eu(null,t,n,e,r);break e;case 1:t=lp(null,t,n,e,r);break e;case 11:t=sp(null,t,n,e,r);break e;case 14:t=op(null,t,n,yr(n.type,e),r);break e}throw Error(ee(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:yr(n,i),Eu(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:yr(n,i),lp(e,t,n,i,r);case 3:e:{if(wv(t),e===null)throw Error(ee(387));n=t.pendingProps,s=t.memoizedState,i=s.element,X_(e,t),Vl(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=qi(Error(ee(423)),t),t=ap(e,t,n,r,i);break e}else if(n!==i){i=qi(Error(ee(424)),t),t=ap(e,t,n,r,i);break e}else for(Qt=En(t.stateNode.containerInfo.firstChild),Zt=t,$e=!0,xr=null,r=q_(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Ui(),n===i){t=rn(e,t,r);break e}Pt(e,t,n,r)}t=t.child}return t;case 5:return G_(t),e===null&&xu(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,mu(n,i)?o=null:s!==null&&mu(n,s)&&(t.flags|=32),xv(e,t),Pt(e,t,o,r),t.child;case 6:return e===null&&xu(t),null;case 13:return bv(e,t,r);case 4:return pd(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ki(t,null,n,r):Pt(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:yr(n,i),sp(e,t,n,i,r);case 7:return Pt(e,t,t.pendingProps,r),t.child;case 8:return Pt(e,t,t.pendingProps.children,r),t.child;case 12:return Pt(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,Ne(Ul,n._currentValue),n._currentValue=o,s!==null)if(Er(s.value,o)){if(s.children===i.children&&!Wt.current){t=rn(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=Zr(-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),wu(s.return,r,t),l.lanes|=r;break}a=a.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),wu(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}Pt(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,ji(t,r),i=pr(i),n=n(i),t.flags|=1,Pt(e,t,n,r),t.child;case 14:return n=t.type,i=yr(n,t.pendingProps),i=yr(n.type,i),op(e,t,n,i,r);case 15:return yv(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:yr(n,i),gl(e,t),t.tag=1,Ht(n)?(e=!0,$l(t)):e=!1,ji(t,r),mv(t,n,i),ku(t,n,i,r),Tu(null,t,n,!0,e,r);case 19:return kv(e,t,r);case 22:return Sv(e,t,r)}throw Error(ee(156,t.tag))};function Fv(e,t){return f_(e,t)}function Ax(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 hr(e,t,r,n){return new Ax(e,t,r,n)}function Id(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Bx(e){if(typeof e=="function")return Id(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Yh)return 11;if(e===Xh)return 14}return 2}function Ln(e,t){var r=e.alternate;return r===null?(r=hr(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 vl(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")Id(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case bi:return ti(r.children,i,s,t);case qh:o=8,i|=8;break;case Yc:return e=hr(12,r,t,i|2),e.elementType=Yc,e.lanes=s,e;case Xc:return e=hr(13,r,t,i),e.elementType=Xc,e.lanes=s,e;case Gc:return e=hr(19,r,t,i),e.elementType=Gc,e.lanes=s,e;case Gm:return ba(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ym:o=10;break e;case Xm:o=9;break e;case Yh:o=11;break e;case Xh:o=14;break e;case pn:o=16,n=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=hr(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function ti(e,t,r,n){return e=hr(7,e,n,t),e.lanes=r,e}function ba(e,t,r,n){return e=hr(22,e,n,t),e.elementType=Gm,e.lanes=r,e.stateNode={isHidden:!1},e}function uc(e,t,r){return e=hr(6,e,null,t),e.lanes=r,e}function hc(e,t,r){return t=hr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Nx(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=Ka(0),this.expirationTimes=Ka(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ka(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Ld(e,t,r,n,i,s,o,l,a){return e=new Nx(e,t,r,l,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=hr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},fd(s),e}function zx(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:wi,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function $v(e){if(!e)return Mn;e=e._reactInternals;e:{if(fi(e)!==e||e.tag!==1)throw Error(ee(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ht(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ee(171))}if(e.tag===1){var r=e.type;if(Ht(r))return $_(e,r,t)}return t}function Wv(e,t,r,n,i,s,o,l,a){return e=Ld(r,n,!0,e,i,s,o,l,a),e.context=$v(null),r=e.current,n=Mt(),i=In(r),s=Zr(n,i),s.callback=t??null,Tn(r,s,i),e.current.lanes=i,yo(e,i,n),Ut(e,n),e}function ka(e,t,r,n){var i=t.current,s=Mt(),o=In(i);return r=$v(r),t.context===null?t.context=r:t.pendingContext=r,t=Zr(s,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=Tn(i,t,o),e!==null&&(kr(e,i,o,s),dl(e,i,o)),o}function ea(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function vp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Pd(e,t){vp(e,t),(e=e.alternate)&&vp(e,t)}function Ox(){return null}var Hv=typeof reportError=="function"?reportError:function(e){console.error(e)};function Dd(e){this._internalRoot=e}Ca.prototype.render=Dd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ee(409));ka(e,t,null,null)};Ca.prototype.unmount=Dd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ai(function(){ka(null,e,null,null)}),t[en]=null}};function Ca(e){this._internalRoot=e}Ca.prototype.unstable_scheduleHydration=function(e){if(e){var t=S_();e={blockedOn:null,target:e,priority:t};for(var r=0;r<_n.length&&t!==0&&t<_n[r].priority;r++);_n.splice(r,0,e),r===0&&w_(e)}};function Md(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ea(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function yp(){}function jx(e,t,r,n,i){if(i){if(typeof n=="function"){var s=n;n=function(){var c=ea(o);s.call(c)}}var o=Wv(t,n,e,0,null,!1,!1,"",yp);return e._reactRootContainer=o,e[en]=o.current,to(e.nodeType===8?e.parentNode:e),ai(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof n=="function"){var l=n;n=function(){var c=ea(a);l.call(c)}}var a=Ld(e,0,!1,null,null,!1,!1,"",yp);return e._reactRootContainer=a,e[en]=a.current,to(e.nodeType===8?e.parentNode:e),ai(function(){ka(t,a,r,n)}),a}function Ta(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=ea(o);l.call(a)}}ka(t,o,e,i)}else o=jx(r,t,e,i,n);return ea(o)}v_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Ts(t.pendingLanes);r!==0&&(Zh(t,r|1),Ut(t,Je()),!(Ie&6)&&(Yi=Je()+500,Nn()))}break;case 13:ai(function(){var n=tn(e,1);if(n!==null){var i=Mt();kr(n,e,1,i)}}),Pd(e,1)}};Jh=function(e){if(e.tag===13){var t=tn(e,134217728);if(t!==null){var r=Mt();kr(t,e,134217728,r)}Pd(e,134217728)}};y_=function(e){if(e.tag===13){var t=In(e),r=tn(e,t);if(r!==null){var n=Mt();kr(r,e,t,n)}Pd(e,t)}};S_=function(){return Le};x_=function(e,t){var r=Le;try{return Le=e,t()}finally{Le=r}};ou=function(e,t,r){switch(t){case"input":if(Jc(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=_a(n);if(!i)throw Error(ee(90));Zm(n),Jc(n,i)}}}break;case"textarea":e_(e,r);break;case"select":t=r.value,t!=null&&Bi(e,!!r.multiple,t,!1)}};l_=Ed;a_=ai;var Fx={usingClientEntryPoint:!1,Events:[xo,Ti,_a,s_,o_,Ed]},ps={findFiberByHostInstance:Gn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$x={bundleType:ps.bundleType,version:ps.version,rendererPackageName:ps.rendererPackageName,rendererConfig:ps.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:nn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=h_(e),e===null?null:e.stateNode},findFiberByHostInstance:ps.findFiberByHostInstance||Ox,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Go=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Go.isDisabled&&Go.supportsFiber)try{fa=Go.inject($x),zr=Go}catch{}}tr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Fx;tr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Md(t))throw Error(ee(200));return zx(e,t,null,r)};tr.createRoot=function(e,t){if(!Md(e))throw Error(ee(299));var r=!1,n="",i=Hv;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Ld(e,1,!1,null,null,r,!1,n,i),e[en]=t.current,to(e.nodeType===8?e.parentNode:e),new Dd(t)};tr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ee(188)):(e=Object.keys(e).join(","),Error(ee(268,e)));return e=h_(t),e=e===null?null:e.stateNode,e};tr.flushSync=function(e){return ai(e)};tr.hydrate=function(e,t,r){if(!Ea(t))throw Error(ee(200));return Ta(null,e,t,!0,r)};tr.hydrateRoot=function(e,t,r){if(!Md(e))throw Error(ee(405));var n=r!=null&&r.hydratedSources||null,i=!1,s="",o=Hv;if(r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=Wv(t,null,e,1,r??null,i,!1,s,o),e[en]=t.current,to(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 Ca(t)};tr.render=function(e,t,r){if(!Ea(t))throw Error(ee(200));return Ta(null,e,t,!1,r)};tr.unmountComponentAtNode=function(e){if(!Ea(e))throw Error(ee(40));return e._reactRootContainer?(ai(function(){Ta(null,null,e,!1,function(){e._reactRootContainer=null,e[en]=null})}),!0):!1};tr.unstable_batchedUpdates=Ed;tr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Ea(r))throw Error(ee(200));if(e==null||e._reactInternals===void 0)throw Error(ee(38));return Ta(e,t,r,!1,n)};tr.version="18.3.1-next-f1338f8080-20240426";function Uv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Uv)}catch(e){console.error(e)}}Uv(),Um.exports=tr;var Wx=Um.exports,Kv,Sp=Wx;Kv=Sp.createRoot,Sp.hydrateRoot;/**
41
- * @remix-run/router v1.23.2
42
- *
43
- * Copyright (c) Remix Software Inc.
44
- *
45
- * This source code is licensed under the MIT license found in the
46
- * LICENSE.md file in the root directory of this source tree.
47
- *
48
- * @license MIT
49
- */function uo(){return uo=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},uo.apply(this,arguments)}var xn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(xn||(xn={}));const xp="popstate";function Hx(e){e===void 0&&(e={});function t(n,i){let{pathname:s,search:o,hash:l}=n.location;return ju("",{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:Vv(i)}return Kx(t,r,null,e)}function it(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ad(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Ux(){return Math.random().toString(36).substr(2,8)}function wp(e,t){return{usr:e.state,key:e.key,idx:t}}function ju(e,t,r,n){return r===void 0&&(r=null),uo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?es(t):t,{state:r,key:t&&t.key||n||Ux()})}function Vv(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 es(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 Kx(e,t,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,l=xn.Pop,a=null,c=h();c==null&&(c=0,o.replaceState(uo({},o.state,{idx:c}),""));function h(){return(o.state||{idx:null}).idx}function u(){l=xn.Pop;let w=h(),_=w==null?null:w-c;c=w,a&&a({action:l,location:m.location,delta:_})}function d(w,_){l=xn.Push;let v=ju(m.location,w,_);c=h()+1;let y=wp(v,c),T=m.createHref(v);try{o.pushState(y,"",T)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;i.location.assign(T)}s&&a&&a({action:l,location:m.location,delta:1})}function f(w,_){l=xn.Replace;let v=ju(m.location,w,_);c=h();let y=wp(v,c),T=m.createHref(v);o.replaceState(y,"",T),s&&a&&a({action:l,location:m.location,delta:0})}function g(w){let _=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof w=="string"?w:Vv(w);return v=v.replace(/ $/,"%20"),it(_,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,_)}let m={get action(){return l},get location(){return e(i,o)},listen(w){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(xp,u),a=w,()=>{i.removeEventListener(xp,u),a=null}},createHref(w){return t(i,w)},createURL:g,encodeLocation(w){let _=g(w);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:d,replace:f,go(w){return o.go(w)}};return m}var bp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(bp||(bp={}));function Vx(e,t,r){return r===void 0&&(r="/"),qx(e,t,r)}function qx(e,t,r,n){let i=typeof t=="string"?es(t):t,s=Xv(i.pathname||"/",r);if(s==null)return null;let o=qv(e);Yx(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let c=ow(s);l=nw(o[a],c)}return l}function qv(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("/")&&(it(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=ri([n,a.relativePath]),h=r.concat(a);s.children&&s.children.length>0&&(it(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),qv(s.children,t,h,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:tw(c,s.index),routesMeta:h})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let a of Yv(s.path))i(s,o,a)}),t}function Yv(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=Yv(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 Yx(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:rw(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Xx=/^:[\w-]+$/,Gx=3,Qx=2,Zx=1,Jx=10,ew=-2,kp=e=>e==="*";function tw(e,t){let r=e.split("/"),n=r.length;return r.some(kp)&&(n+=ew),t&&(n+=Qx),r.filter(i=>!kp(i)).reduce((i,s)=>i+(Xx.test(s)?Gx:s===""?Zx:Jx),n)}function rw(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 nw(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=iw({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:ri([s,u.pathname]),pathnameBase:hw(ri([s,u.pathnameBase])),route:d}),u.pathnameBase!=="/"&&(s=ri([s,u.pathnameBase]))}return o}function iw(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=sw(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 m=l[u]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[u];return f&&!g?c[d]=void 0:c[d]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:e}}function sw(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),Ad(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let 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 ow(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ad(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Xv(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const lw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,aw=e=>lw.test(e);function cw(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?es(e):e,s;if(r)if(aw(r))s=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),Ad(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?s=Cp(r.substring(1),"/"):s=Cp(r,t)}else s=t;return{pathname:s,search:dw(n),hash:fw(i)}}function Cp(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 dc(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 uw(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Gv(e,t){let r=uw(e);return t?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function Qv(e,t,r,n){n===void 0&&(n=!1);let i;typeof e=="string"?i=es(e):(i=uo({},e),it(!i.pathname||!i.pathname.includes("?"),dc("?","pathname","search",i)),it(!i.pathname||!i.pathname.includes("#"),dc("#","pathname","hash",i)),it(!i.search||!i.search.includes("#"),dc("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=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=cw(i,l),c=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(c||h)&&(a.pathname+="/"),a}const ri=e=>e.join("/").replace(/\/\/+/g,"/"),hw=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),dw=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,fw=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function pw(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Zv=["post","put","patch","delete"];new Set(Zv);const gw=["get",...Zv];new Set(gw);/**
50
- * React Router v6.30.3
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */function ho(){return ho=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},ho.apply(this,arguments)}const Bd=b.createContext(null),mw=b.createContext(null),bo=b.createContext(null),Ra=b.createContext(null),zn=b.createContext({outlet:null,matches:[],isDataRoute:!1}),Jv=b.createContext(null);function ko(){return b.useContext(Ra)!=null}function Co(){return ko()||it(!1),b.useContext(Ra).location}function ey(e){b.useContext(bo).static||b.useLayoutEffect(e)}function ts(){let{isDataRoute:e}=b.useContext(zn);return e?Iw():_w()}function _w(){ko()||it(!1);let e=b.useContext(Bd),{basename:t,future:r,navigator:n}=b.useContext(bo),{matches:i}=b.useContext(zn),{pathname:s}=Co(),o=JSON.stringify(Gv(i,r.v7_relativeSplatPath)),l=b.useRef(!1);return ey(()=>{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=Qv(c,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:ri([t,u.pathname])),(h.replace?n.replace:n.push)(u,h.state,h)},[t,n,o,s,e])}function ty(){let{matches:e}=b.useContext(zn),t=e[e.length-1];return t?t.params:{}}function vw(e,t){return yw(e,t)}function yw(e,t,r,n){ko()||it(!1);let{navigator:i}=b.useContext(bo),{matches:s}=b.useContext(zn),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let c=Co(),h;if(t){var u;let w=typeof t=="string"?es(t):t;a==="/"||(u=w.pathname)!=null&&u.startsWith(a)||it(!1),h=w}else h=c;let d=h.pathname||"/",f=d;if(a!=="/"){let w=a.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(w.length).join("/")}let g=Vx(e,{pathname:f}),m=kw(g&&g.map(w=>Object.assign({},w,{params:Object.assign({},l,w.params),pathname:ri([a,i.encodeLocation?i.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?a:ri([a,i.encodeLocation?i.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),s,r,n);return t&&m?b.createElement(Ra.Provider,{value:{location:ho({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:xn.Pop}},m):m}function Sw(){let e=Rw(),t=pw(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 xw=b.createElement(Sw,null);class ww 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(zn.Provider,{value:this.props.routeContext},b.createElement(Jv.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function bw(e){let{routeContext:t,match:r,children:n}=e,i=b.useContext(Bd);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),b.createElement(zn.Provider,{value:t},n)}function kw(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||it(!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,g=u.route.loader&&d[u.route.id]===void 0&&(!f||f[u.route.id]===void 0);if(u.route.lazy||g){a=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((h,u,d)=>{let f,g=!1,m=null,w=null;r&&(f=l&&u.route.id?l[u.route.id]:void 0,m=u.route.errorElement||xw,a&&(c<0&&d===0?(Lw("route-fallback"),g=!0,w=null):c===d&&(g=!0,w=u.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,d+1)),v=()=>{let y;return f?y=m:g?y=w:u.route.Component?y=b.createElement(u.route.Component,null):u.route.element?y=u.route.element:y=h,b.createElement(bw,{match:u,routeContext:{outlet:h,matches:_,isDataRoute:r!=null},children:y})};return r&&(u.route.ErrorBoundary||u.route.errorElement||d===0)?b.createElement(ww,{location:r.location,revalidation:r.revalidation,component:m,error:f,children:v(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):v()},null)}var ry=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ry||{}),ny=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}(ny||{});function Cw(e){let t=b.useContext(Bd);return t||it(!1),t}function Ew(e){let t=b.useContext(mw);return t||it(!1),t}function Tw(e){let t=b.useContext(zn);return t||it(!1),t}function iy(e){let t=Tw(),r=t.matches[t.matches.length-1];return r.route.id||it(!1),r.route.id}function Rw(){var e;let t=b.useContext(Jv),r=Ew(),n=iy();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function Iw(){let{router:e}=Cw(ry.UseNavigateStable),t=iy(ny.UseNavigateStable),r=b.useRef(!1);return ey(()=>{r.current=!0}),b.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,ho({fromRouteId:t},s)))},[e,t])}const Ep={};function Lw(e,t,r){Ep[e]||(Ep[e]=!0)}function Pw(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function yl(e){let{to:t,replace:r,state:n,relative:i}=e;ko()||it(!1);let{future:s,static:o}=b.useContext(bo),{matches:l}=b.useContext(zn),{pathname:a}=Co(),c=ts(),h=Qv(t,Gv(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 Kn(e){it(!1)}function Dw(e){let{basename:t="/",children:r=null,location:n,navigationType:i=xn.Pop,navigator:s,static:o=!1,future:l}=e;ko()&&it(!1);let a=t.replace(/^\/*/,"/"),c=b.useMemo(()=>({basename:a,navigator:s,static:o,future:ho({v7_relativeSplatPath:!1},l)}),[a,l,s,o]);typeof n=="string"&&(n=es(n));let{pathname:h="/",search:u="",hash:d="",state:f=null,key:g="default"}=n,m=b.useMemo(()=>{let w=Xv(h,a);return w==null?null:{location:{pathname:w,search:u,hash:d,state:f,key:g},navigationType:i}},[a,h,u,d,f,g,i]);return m==null?null:b.createElement(bo.Provider,{value:c},b.createElement(Ra.Provider,{children:r,value:m}))}function Mw(e){let{children:t,location:r}=e;return vw(Fu(t),r)}new Promise(()=>{});function Fu(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,Fu(n.props.children,s));return}n.type!==Kn&&it(!1),!n.props.index||!n.props.children||it(!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=Fu(n.props.children,s)),r.push(o)}),r}/**
59
- * React Router DOM v6.30.3
60
- *
61
- * Copyright (c) Remix Software Inc.
62
- *
63
- * This source code is licensed under the MIT license found in the
64
- * LICENSE.md file in the root directory of this source tree.
65
- *
66
- * @license MIT
67
- */function $u(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 Aw(e,t){let r=$u(e);return t&&t.forEach((n,i)=>{r.has(i)||t.getAll(i).forEach(s=>{r.append(i,s)})}),r}const Bw="6";try{window.__reactRouterVersion=Bw}catch{}const Nw="startTransition",Tp=P1[Nw];function zw(e){let{basename:t,children:r,future:n,window:i}=e,s=b.useRef();s.current==null&&(s.current=Hx({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&&Tp?Tp(()=>a(u)):a(u)},[a,c]);return b.useLayoutEffect(()=>o.listen(h),[o,h]),b.useEffect(()=>Pw(n),[n]),b.createElement(Dw,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}var Rp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Rp||(Rp={}));var Ip;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Ip||(Ip={}));function Ow(e){let t=b.useRef($u(e)),r=b.useRef(!1),n=Co(),i=b.useMemo(()=>Aw(n.search,r.current?null:t.current),[n.search]),s=ts(),o=b.useCallback((l,a)=>{const c=$u(typeof l=="function"?l(i):l);r.current=!0,s("?"+c,a)},[s,i]);return[i,o]}const sy=b.createContext({ides:[],updateIdeChats:()=>{},screenshotMap:{},setScreenshotMap:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{}}),oy=b.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function jw(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 g=(o=h.chats)!=null&&o.length?h.chats:u.chats;n.set(h.id,{...u,...h,chats:g,_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 Fw({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(g=>g.id===u?{...g,chats:d}:g))},[]),h={injectEntries:u=>{r(d=>d.length===0?u:jw(u,d))},markLoaded:()=>o(!0),getIdes:()=>t};return p.jsx(oy.Provider,{value:h,children:p.jsx(sy.Provider,{value:{ides:t,updateIdeChats:c,screenshotMap:n,setScreenshotMap:i,initialLoaded:s,toasts:l,setToasts:a},children:e})})}function ly(){return b.useContext(sy)}function Lp(){return b.useContext(oy)}function $w(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 Ww=$w({baseUrl:"http://localhost:3847"});b.createContext(Ww);const Hw={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},ay=b.createContext(Hw);function Uw({value:e,children:t}){return p.jsx(ay.Provider,{value:e,children:t})}function On(){return b.useContext(ay)}function Kw(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Vw=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qw=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Yw={};function Pp(e,t){return(Yw.jsx?qw:Vw).test(e)}const Xw=/[ \t\n\f\r]/g;function Gw(e){return typeof e=="object"?e.type==="text"?Dp(e.value):!1:Dp(e)}function Dp(e){return e.replace(Xw,"")===""}class Eo{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}Eo.prototype.normal={};Eo.prototype.property={};Eo.prototype.space=void 0;function cy(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new Eo(r,n,t)}function Wu(e){return e.toLowerCase()}class Kt{constructor(t,r){this.attribute=r,this.property=t}}Kt.prototype.attribute="";Kt.prototype.booleanish=!1;Kt.prototype.boolean=!1;Kt.prototype.commaOrSpaceSeparated=!1;Kt.prototype.commaSeparated=!1;Kt.prototype.defined=!1;Kt.prototype.mustUseProperty=!1;Kt.prototype.number=!1;Kt.prototype.overloadedBoolean=!1;Kt.prototype.property="";Kt.prototype.spaceSeparated=!1;Kt.prototype.space=void 0;let Qw=0;const xe=pi(),et=pi(),Hu=pi(),ne=pi(),Be=pi(),$i=pi(),Yt=pi();function pi(){return 2**++Qw}const Uu=Object.freeze(Object.defineProperty({__proto__:null,boolean:xe,booleanish:et,commaOrSpaceSeparated:Yt,commaSeparated:$i,number:ne,overloadedBoolean:Hu,spaceSeparated:Be},Symbol.toStringTag,{value:"Module"})),fc=Object.keys(Uu);class Nd extends Kt{constructor(t,r,n,i){let s=-1;if(super(t,r),Mp(this,"space",i),typeof n=="number")for(;++s<fc.length;){const o=fc[s];Mp(this,fc[s],(n&Uu[o])===Uu[o])}}}Nd.prototype.defined=!0;function Mp(e,t,r){r&&(e[t]=r)}function rs(e){const t={},r={};for(const[n,i]of Object.entries(e.properties)){const s=new Nd(n,e.transform(e.attributes||{},n),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),t[n]=s,r[Wu(n)]=n,r[Wu(s.attribute)]=n}return new Eo(t,r,e.space)}const uy=rs({properties:{ariaActiveDescendant:null,ariaAtomic:et,ariaAutoComplete:null,ariaBusy:et,ariaChecked:et,ariaColCount:ne,ariaColIndex:ne,ariaColSpan:ne,ariaControls:Be,ariaCurrent:null,ariaDescribedBy:Be,ariaDetails:null,ariaDisabled:et,ariaDropEffect:Be,ariaErrorMessage:null,ariaExpanded:et,ariaFlowTo:Be,ariaGrabbed:et,ariaHasPopup:null,ariaHidden:et,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Be,ariaLevel:ne,ariaLive:null,ariaModal:et,ariaMultiLine:et,ariaMultiSelectable:et,ariaOrientation:null,ariaOwns:Be,ariaPlaceholder:null,ariaPosInSet:ne,ariaPressed:et,ariaReadOnly:et,ariaRelevant:null,ariaRequired:et,ariaRoleDescription:Be,ariaRowCount:ne,ariaRowIndex:ne,ariaRowSpan:ne,ariaSelected:et,ariaSetSize:ne,ariaSort:null,ariaValueMax:ne,ariaValueMin:ne,ariaValueNow:ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function hy(e,t){return t in e?e[t]:t}function dy(e,t){return hy(e,t.toLowerCase())}const Zw=rs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$i,acceptCharset:Be,accessKey:Be,action:null,allow:null,allowFullScreen:xe,allowPaymentRequest:xe,allowUserMedia:xe,alt:null,as:null,async:xe,autoCapitalize:null,autoComplete:Be,autoFocus:xe,autoPlay:xe,blocking:Be,capture:null,charSet:null,checked:xe,cite:null,className:Be,cols:ne,colSpan:null,content:null,contentEditable:et,controls:xe,controlsList:Be,coords:ne|$i,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xe,defer:xe,dir:null,dirName:null,disabled:xe,download:Hu,draggable:et,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xe,formTarget:null,headers:Be,height:ne,hidden:Hu,high:ne,href:null,hrefLang:null,htmlFor:Be,httpEquiv:Be,id:null,imageSizes:null,imageSrcSet:null,inert:xe,inputMode:null,integrity:null,is:null,isMap:xe,itemId:null,itemProp:Be,itemRef:Be,itemScope:xe,itemType:Be,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xe,low:ne,manifest:null,max:null,maxLength:ne,media:null,method:null,min:null,minLength:ne,multiple:xe,muted:xe,name:null,nonce:null,noModule:xe,noValidate:xe,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:xe,optimum:ne,pattern:null,ping:Be,placeholder:null,playsInline:xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xe,referrerPolicy:null,rel:Be,required:xe,reversed:xe,rows:ne,rowSpan:ne,sandbox:Be,scope:null,scoped:xe,seamless:xe,selected:xe,shadowRootClonable:xe,shadowRootDelegatesFocus:xe,shadowRootMode:null,shape:null,size:ne,sizes:null,slot:null,span:ne,spellCheck:et,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ne,step:null,style:null,tabIndex:ne,target:null,title:null,translate:null,type:null,typeMustMatch:xe,useMap:null,value:et,width:ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Be,axis:null,background:null,bgColor:null,border:ne,borderColor:null,bottomMargin:ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xe,declare:xe,event:null,face:null,frame:null,frameBorder:null,hSpace:ne,leftMargin:ne,link:null,longDesc:null,lowSrc:null,marginHeight:ne,marginWidth:ne,noResize:xe,noHref:xe,noShade:xe,noWrap:xe,object:null,profile:null,prompt:null,rev:null,rightMargin:ne,rules:null,scheme:null,scrolling:et,standby:null,summary:null,text:null,topMargin:ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xe,disableRemotePlayback:xe,prefix:null,property:null,results:ne,security:null,unselectable:null},space:"html",transform:dy}),Jw=rs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Yt,accentHeight:ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ne,amplitude:ne,arabicForm:null,ascent:ne,attributeName:null,attributeType:null,azimuth:ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ne,by:null,calcMode:null,capHeight:ne,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:ne,diffuseConstant:ne,direction:null,display:null,dur:null,divisor:ne,dominantBaseline:null,download:xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ne,enableBackground:null,end:null,event:null,exponent:ne,externalResourcesRequired:null,fill:null,fillOpacity:ne,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:$i,g2:$i,glyphName:$i,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ne,horizOriginX:ne,horizOriginY:ne,id:null,ideographic:ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ne,k:ne,k1:ne,k2:ne,k3:ne,k4:ne,kernelMatrix:Yt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ne,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:ne,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:ne,overlineThickness:ne,paintOrder:null,panose1:null,path:null,pathLength:ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Be,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ne,pointsAtY:ne,pointsAtZ:ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yt,rev:Yt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yt,requiredFeatures:Yt,requiredFonts:Yt,requiredFormats:Yt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ne,specularExponent:ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ne,strikethroughThickness:ne,string:null,stroke:null,strokeDashArray:Yt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ne,strokeOpacity:ne,strokeWidth:null,style:null,surfaceScale:ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yt,tabIndex:ne,tableValues:null,target:null,targetX:ne,targetY:ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ne,underlineThickness:ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ne,values:null,vAlphabetic:ne,vMathematical:ne,vectorEffect:null,vHanging:ne,vIdeographic:ne,version:null,vertAdvY:ne,vertOriginX:ne,vertOriginY:ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:hy}),fy=rs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),py=rs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:dy}),gy=rs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),eb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},tb=/[A-Z]/g,Ap=/-[a-z]/g,rb=/^data[-\w.:]+$/i;function nb(e,t){const r=Wu(t);let n=t,i=Kt;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&rb.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ap,sb);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ap.test(s)){let o=s.replace(tb,ib);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Nd}return new i(n,t)}function ib(e){return"-"+e.toLowerCase()}function sb(e){return e.charAt(1).toUpperCase()}const ob=cy([uy,Zw,fy,py,gy],"html"),zd=cy([uy,Jw,fy,py,gy],"svg");function lb(e){return e.join(" ").trim()}var Od={},Bp=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ab=/\n/g,cb=/^\s*/,ub=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,hb=/^:\s*/,db=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,fb=/^[;\s]*/,pb=/^\s+|\s+$/g,gb=`
68
- `,Np="/",zp="*",Xn="",mb="comment",_b="declaration";function vb(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function i(g){var m=g.match(ab);m&&(r+=m.length);var w=g.lastIndexOf(gb);n=~w?g.length-w:n+g.length}function s(){var g={line:r,column:n};return function(m){return m.position=new o(g),c(),m}}function o(g){this.start=g,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(g){var m=new Error(t.source+":"+r+":"+n+": "+g);if(m.reason=g,m.filename=t.source,m.line=r,m.column=n,m.source=e,!t.silent)throw m}function a(g){var m=g.exec(e);if(m){var w=m[0];return i(w),e=e.slice(w.length),m}}function c(){a(cb)}function h(g){var m;for(g=g||[];m=u();)m!==!1&&g.push(m);return g}function u(){var g=s();if(!(Np!=e.charAt(0)||zp!=e.charAt(1))){for(var m=2;Xn!=e.charAt(m)&&(zp!=e.charAt(m)||Np!=e.charAt(m+1));)++m;if(m+=2,Xn===e.charAt(m-1))return l("End of comment missing");var w=e.slice(2,m-2);return n+=2,i(w),e=e.slice(m),n+=2,g({type:mb,comment:w})}}function d(){var g=s(),m=a(ub);if(m){if(u(),!a(hb))return l("property missing ':'");var w=a(db),_=g({type:_b,property:Op(m[0].replace(Bp,Xn)),value:w?Op(w[0].replace(Bp,Xn)):Xn});return a(fb),_}}function f(){var g=[];h(g);for(var m;m=d();)m!==!1&&(g.push(m),h(g));return g}return c(),f()}function Op(e){return e?e.replace(pb,Xn):Xn}var yb=vb,Sb=Ll&&Ll.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Od,"__esModule",{value:!0});Od.default=wb;const xb=Sb(yb);function wb(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,xb.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 Ia={};Object.defineProperty(Ia,"__esModule",{value:!0});Ia.camelCase=void 0;var bb=/^--[a-zA-Z0-9_-]+$/,kb=/-([a-z])/g,Cb=/^[^-]+$/,Eb=/^-(webkit|moz|ms|o|khtml)-/,Tb=/^-(ms)-/,Rb=function(e){return!e||Cb.test(e)||bb.test(e)},Ib=function(e,t){return t.toUpperCase()},jp=function(e,t){return"".concat(t,"-")},Lb=function(e,t){return t===void 0&&(t={}),Rb(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Tb,jp):e=e.replace(Eb,jp),e.replace(kb,Ib))};Ia.camelCase=Lb;var Pb=Ll&&Ll.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Db=Pb(Od),Mb=Ia;function Ku(e,t){var r={};return!e||typeof e!="string"||(0,Db.default)(e,function(n,i){n&&i&&(r[(0,Mb.camelCase)(n,t)]=i)}),r}Ku.default=Ku;var Ab=Ku;const Bb=jh(Ab),my=_y("end"),jd=_y("start");function _y(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 Nb(e){const t=jd(e),r=my(e);if(t&&r)return{start:t,end:r}}function Hs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Fp(e.position):"start"in e||"end"in e?Fp(e):"line"in e||"column"in e?Vu(e):""}function Vu(e){return $p(e&&e.line)+":"+$p(e&&e.column)}function Fp(e){return Vu(e&&e.start)+"-"+Vu(e&&e.end)}function $p(e){return e&&typeof e=="number"?e:1}class It extends Error{constructor(t,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=Hs(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}It.prototype.file="";It.prototype.name="";It.prototype.reason="";It.prototype.message="";It.prototype.stack="";It.prototype.column=void 0;It.prototype.line=void 0;It.prototype.ancestors=void 0;It.prototype.cause=void 0;It.prototype.fatal=void 0;It.prototype.place=void 0;It.prototype.ruleId=void 0;It.prototype.source=void 0;const Fd={}.hasOwnProperty,zb=new Map,Ob=/[A-Z]/g,jb=new Set(["table","tbody","thead","tfoot","tr"]),Fb=new Set(["td","th"]),vy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function $b(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const 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=Xb(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=Yb(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?zd:ob,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=yy(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function yy(e,t,r){if(t.type==="element")return Wb(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Hb(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Kb(e,t,r);if(t.type==="mdxjsEsm")return Ub(e,t);if(t.type==="root")return Vb(e,t,r);if(t.type==="text")return qb(e,t)}function Wb(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=zd,e.schema=i),e.ancestors.push(t);const s=xy(e,t.tagName,!1),o=Gb(e,t);let l=Wd(e,t);return jb.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!Gw(a):!0})),Sy(e,o,s,t),$d(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function Hb(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)}fo(e,t.position)}function Ub(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);fo(e,t.position)}function Kb(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=zd,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:xy(e,t.name,!0),o=Qb(e,t),l=Wd(e,t);return Sy(e,o,s,t),$d(o,l),e.ancestors.pop(),e.schema=n,e.create(t,s,o,r)}function Vb(e,t,r){const n={};return $d(n,Wd(e,t)),e.create(t,e.Fragment,n,r)}function qb(e,t){return t.value}function Sy(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function $d(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function Yb(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 Xb(e,t){return r;function r(n,i,s,o){const l=Array.isArray(s.children),a=jd(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 Gb(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&Fd.call(t.properties,i)){const s=Zb(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Fb.has(t.tagName)?n=l:r[o]=l}}if(n){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function Qb(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 fo(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 fo(e,t.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function Wd(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:zb;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=yy(e,s,o);l!==void 0&&r.push(l)}return r}function Zb(e,t,r){const n=nb(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?Kw(r):lb(r)),n.property==="style"){let i=typeof r=="object"?r:Jb(e,String(r));return e.stylePropertyNameCase==="css"&&(i=ek(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&n.space?eb[n.property]||n.property:n.attribute,r]}}function Jb(e,t){try{return Bb(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=vy+"#cannot-parse-style-attribute",i}}function xy(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=Pp(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}n=o}else n=Pp(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const i=n.value;return Fd.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(n);fo(e)}function fo(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=vy+"#cannot-handle-mdx-estrees-without-createevaluater",r}function ek(e){const t={};let r;for(r in e)Fd.call(e,r)&&(t[tk(r)]=e[r]);return t}function tk(e){let t=e.replace(Ob,rk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function rk(e){return"-"+e.toLowerCase()}const pc={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},nk={};function Hd(e,t){const r=nk,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return wy(e,n,i)}function wy(e,t,r){if(ik(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 Wp(e.children,t,r)}return Array.isArray(e)?Wp(e,t,r):""}function Wp(e,t,r){const n=[];let i=-1;for(;++i<e.length;)n[i]=wy(e[i],t,r);return n.join("")}function ik(e){return!!(e&&typeof e=="object")}const Hp=document.createElement("i");function Ud(e){const t="&"+e+";";Hp.innerHTML=t;const r=Hp.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Jt(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 ur(e,t){return e.length>0?(Jt(e,e.length,0,t),e):t}const Up={}.hasOwnProperty;function by(e){const t={};let r=-1;for(;++r<e.length;)sk(t,e[r]);return t}function sk(e,t){let r;for(r in t){const i=(Up.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];let o;if(s)for(o in s){Up.call(i,o)||(i[o]=[]);const l=s[o];ok(i[o],Array.isArray(l)?l:l?[l]:[])}}}function ok(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);Jt(e,0,0,n)}function ky(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 Cr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dt=jn(/[A-Za-z]/),Tt=jn(/[\dA-Za-z]/),lk=jn(/[#-'*+\--9=?A-Z^-~]/);function ta(e){return e!==null&&(e<32||e===127)}const qu=jn(/\d/),ak=jn(/[\dA-Fa-f]/),ck=jn(/[!-/:-@[-`{-~]/);function me(e){return e!==null&&e<-2}function Me(e){return e!==null&&(e<0||e===32)}function Ce(e){return e===-2||e===-1||e===32}const La=jn(new RegExp("\\p{P}|\\p{S}","u")),ci=jn(/\s/);function jn(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ns(e){const t=[];let r=-1,n=0,i=0;for(;++r<e.length;){const s=e.charCodeAt(r);let o="";if(s===37&&Tt(e.charCodeAt(r+1))&&Tt(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 Re(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(a){return Ce(a)?(e.enter(r),l(a)):t(a)}function l(a){return Ce(a)&&s++<i?(e.consume(a),l):(e.exit(r),t(a))}}const uk={tokenize:hk};function hk(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"),Re(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 me(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const dk={tokenize:fk},Kp={tokenize:pk};function fk(e){const t=this,r=[];let n=0,i,s,o;return l;function l(y){if(n<r.length){const T=r[n];return t.containerState=T[1],e.attempt(T[0].continuation,a,c)(y)}return c(y)}function a(y){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const T=t.events.length;let R=T,x;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){x=t.events[R][1].end;break}_(n);let j=T;for(;j<t.events.length;)t.events[j][1].end={...x},j++;return Jt(t.events,R+1,0,t.events.slice(T)),t.events.length=j,c(y)}return l(y)}function c(y){if(n===r.length){if(!i)return d(y);if(i.currentConstruct&&i.currentConstruct.concrete)return g(y);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Kp,h,u)(y)}function h(y){return i&&v(),_(n),d(y)}function u(y){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,g(y)}function d(y){return t.containerState={},e.attempt(Kp,f,g)(y)}function f(y){return n++,r.push([t.currentConstruct,t.containerState]),d(y)}function g(y){if(y===null){i&&v(),_(0),e.consume(y);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),m(y)}function m(y){if(y===null){w(e.exit("chunkFlow"),!0),_(0),e.consume(y);return}return me(y)?(e.consume(y),w(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(y),m)}function w(y,T){const R=t.sliceStream(y);if(T&&R.push(null),y.previous=s,s&&(s.next=y),s=y,i.defineSkip(y.start),i.write(R),t.parser.lazy[y.start.line]){let x=i.events.length;for(;x--;)if(i.events[x][1].start.offset<o&&(!i.events[x][1].end||i.events[x][1].end.offset>o))return;const j=t.events.length;let H=j,U,E;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(U){E=t.events[H][1].end;break}U=!0}for(_(n),x=j;x<t.events.length;)t.events[x][1].end={...E},x++;Jt(t.events,H+1,0,t.events.slice(j)),t.events.length=x}}function _(y){let T=r.length;for(;T-- >y;){const R=r[T];t.containerState=R[1],R[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 pk(e,t,r){return Re(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xi(e){if(e===null||Me(e)||ci(e))return 1;if(La(e))return 2}function Pa(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 Yu={name:"attention",resolveAll:gk,tokenize:mk};function gk(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};Vp(u,-a),Vp(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=ur(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=ur(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=ur(c,Pa(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),c=ur(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=ur(c,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,Jt(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 mk(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Xi(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=Xi(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 Vp(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const _k={name:"autolink",tokenize:vk};function vk(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 Dt(f)?(e.consume(f),o):f===64?r(f):c(f)}function o(f){return f===43||f===45||f===46||Tt(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||Tt(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||ta(f)?r(f):(e.consume(f),a)}function c(f){return f===64?(e.consume(f),h):lk(f)?(e.consume(f),c):r(f)}function h(f){return Tt(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||Tt(f))&&n++<63){const g=f===45?d:u;return e.consume(f),g}return r(f)}}const To={partial:!0,tokenize:yk};function yk(e,t,r){return n;function n(s){return Ce(s)?Re(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||me(s)?t(s):r(s)}}const Cy={continuation:{tokenize:xk},exit:wk,name:"blockQuote",tokenize:Sk};function Sk(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 Ce(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function xk(e,t,r){const n=this;return i;function i(o){return Ce(o)?Re(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(Cy,t,r)(o)}}function wk(e){e.exit("blockQuote")}const Ey={name:"characterEscape",tokenize:bk};function bk(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 ck(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(s)}}const Ty={name:"characterReference",tokenize:kk};function kk(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=Tt,h(u))}function c(u){return u===88||u===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(u),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=ak,h):(e.enter("characterReferenceValue"),s=7,o=qu,h(u))}function h(u){if(u===59&&i){const d=e.exit("characterReferenceValue");return o===Tt&&!Ud(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 qp={partial:!0,tokenize:Ek},Yp={concrete:!0,name:"codeFenced",tokenize:Ck};function Ck(e,t,r){const n=this,i={partial:!0,tokenize:R};let s=0,o=0,l;return a;function a(x){return c(x)}function c(x){const j=n.events[n.events.length-1];return s=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,l=x,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(x)}function h(x){return x===l?(o++,e.consume(x),h):o<3?r(x):(e.exit("codeFencedFenceSequence"),Ce(x)?Re(e,u,"whitespace")(x):u(x))}function u(x){return x===null||me(x)?(e.exit("codeFencedFence"),n.interrupt?t(x):e.check(qp,m,T)(x)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(x))}function d(x){return x===null||me(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(x)):Ce(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Re(e,f,"whitespace")(x)):x===96&&x===l?r(x):(e.consume(x),d)}function f(x){return x===null||me(x)?u(x):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||me(x)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(x)):x===96&&x===l?r(x):(e.consume(x),g)}function m(x){return e.attempt(i,T,w)(x)}function w(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),_}function _(x){return s>0&&Ce(x)?Re(e,v,"linePrefix",s+1)(x):v(x)}function v(x){return x===null||me(x)?e.check(qp,m,T)(x):(e.enter("codeFlowValue"),y(x))}function y(x){return x===null||me(x)?(e.exit("codeFlowValue"),v(x)):(e.consume(x),y)}function T(x){return e.exit("codeFenced"),t(x)}function R(x,j,H){let U=0;return E;function E(A){return x.enter("lineEnding"),x.consume(A),x.exit("lineEnding"),I}function I(A){return x.enter("codeFencedFence"),Ce(A)?Re(x,M,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):M(A)}function M(A){return A===l?(x.enter("codeFencedFenceSequence"),L(A)):H(A)}function L(A){return A===l?(U++,x.consume(A),L):U>=o?(x.exit("codeFencedFenceSequence"),Ce(A)?Re(x,W,"whitespace")(A):W(A)):H(A)}function W(A){return A===null||me(A)?(x.exit("codeFencedFence"),j(A)):H(A)}}}function Ek(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 gc={name:"codeIndented",tokenize:Rk},Tk={partial:!0,tokenize:Ik};function Rk(e,t,r){const n=this;return i;function i(c){return e.enter("codeIndented"),Re(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):me(c)?e.attempt(Tk,o,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||me(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function Ik(e,t,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):me(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Re(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):me(o)?i(o):r(o)}}const Lk={name:"codeText",previous:Dk,resolve:Pk,tokenize:Mk};function Pk(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 Dk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Mk(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)):me(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):(e.enter("codeTextData"),c(u))}function c(u){return u===null||u===32||u===96||me(u)?(e.exit("codeTextData"),a(u)):(e.consume(u),c)}function h(u){return u===96?(e.consume(u),i++,h):i===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(s.type="codeTextData",c(u))}}class Ak{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,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&&gs(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),gs(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),gs(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);gs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);gs(this.left,r.reverse())}}}function gs(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 Ry(e){const t={};let r=-1,n,i,s,o,l,a,c;const h=new Ak(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,Bk(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 Jt(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function Bk(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,g=0,m=0;const w=[m];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&&(m=d+1,w.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):w.pop(),d=w.length;d--;){const _=l.slice(w[d],w[d+1]),v=s.pop();a.push([v,v+_.length-1]),e.splice(v,2,_)}for(a.reverse(),d=-1;++d<a.length;)c[g+a[d][0]]=g+a[d][1],g+=a[d][1]-a[d][0]-1;return c}const Nk={resolve:Ok,tokenize:jk},zk={partial:!0,tokenize:Fk};function Ok(e){return Ry(e),e}function jk(e,t){let 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):me(l)?e.check(zk,o,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function Fk(e,t,r){const n=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Re(e,s,"linePrefix")}function s(o){if(o===null||me(o))return 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 Iy(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||ta(_)?r(_):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),m(_))}function d(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(_))}function f(_){return _===62?(e.exit("chunkString"),e.exit(l),d(_)):_===null||_===60||me(_)?r(_):(e.consume(_),_===92?g:f)}function g(_){return _===60||_===62||_===92?(e.consume(_),f):f(_)}function m(_){return!h&&(_===null||_===41||Me(_))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(_)):h<c&&_===40?(e.consume(_),h++,m):_===41?(e.consume(_),h--,m):_===null||_===32||_===40||ta(_)?r(_):(e.consume(_),_===92?w:m)}function w(_){return _===40||_===41||_===92?(e.consume(_),m):m(_)}}function Ly(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):me(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===null||f===91||f===93||me(f)||l++>999?(e.exit("chunkString"),h(f)):(e.consume(f),a||(a=!Ce(f)),f===92?d:u)}function d(f){return f===91||f===92||f===93?(e.consume(f),l++,u):u(f)}}function Py(e,t,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):me(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Re(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===o||d===null||me(d)?(e.exit("chunkString"),c(d)):(e.consume(d),d===92?u:h)}function u(d){return d===o||d===92?(e.consume(d),h):h(d)}}function Us(e,t){let r;return n;function n(i){return me(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Ce(i)?Re(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const $k={name:"definition",tokenize:Hk},Wk={partial:!0,tokenize:Uk};function Hk(e,t,r){const n=this;let i;return s;function s(f){return e.enter("definition"),o(f)}function o(f){return Ly.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return i=Cr(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 Me(f)?Us(e,c)(f):c(f)}function c(f){return Iy(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function h(f){return e.attempt(Wk,u,u)(f)}function u(f){return Ce(f)?Re(e,d,"whitespace")(f):d(f)}function d(f){return f===null||me(f)?(e.exit("definition"),n.parser.defined.push(i),t(f)):r(f)}}function Uk(e,t,r){return n;function n(l){return Me(l)?Us(e,i)(l):r(l)}function i(l){return Py(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Ce(l)?Re(e,o,"whitespace")(l):o(l)}function o(l){return l===null||me(l)?t(l):r(l)}}const Kk={name:"hardBreakEscape",tokenize:Vk};function Vk(e,t,r){return n;function n(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return me(s)?(e.exit("hardBreakEscape"),t(s)):r(s)}}const qk={name:"headingAtx",resolve:Yk,tokenize:Xk};function Yk(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"},Jt(e,n,r-n+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Xk(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||Me(h)?(e.exit("atxHeadingSequence"),l(h)):r(h)}function l(h){return h===35?(e.enter("atxHeadingSequence"),a(h)):h===null||me(h)?(e.exit("atxHeading"),t(h)):Ce(h)?Re(e,l,"whitespace")(h):(e.enter("atxHeadingText"),c(h))}function a(h){return h===35?(e.consume(h),a):(e.exit("atxHeadingSequence"),l(h))}function c(h){return h===null||h===35||Me(h)?(e.exit("atxHeadingText"),l(h)):(e.consume(h),c)}}const Gk=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Xp=["pre","script","style","textarea"],Qk={concrete:!0,name:"htmlFlow",resolveTo:eC,tokenize:tC},Zk={partial:!0,tokenize:nC},Jk={partial:!0,tokenize:rC};function eC(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function tC(e,t,r){const n=this;let i,s,o,l,a;return c;function c(C){return h(C)}function h(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),u}function u(C){return C===33?(e.consume(C),d):C===47?(e.consume(C),s=!0,m):C===63?(e.consume(C),i=3,n.interrupt?t:S):Dt(C)?(e.consume(C),o=String.fromCharCode(C),w):r(C)}function d(C){return C===45?(e.consume(C),i=2,f):C===91?(e.consume(C),i=5,l=0,g):Dt(C)?(e.consume(C),i=4,n.interrupt?t:S):r(C)}function f(C){return C===45?(e.consume(C),n.interrupt?t:S):r(C)}function g(C){const ge="CDATA[";return C===ge.charCodeAt(l++)?(e.consume(C),l===ge.length?n.interrupt?t:M:g):r(C)}function m(C){return Dt(C)?(e.consume(C),o=String.fromCharCode(C),w):r(C)}function w(C){if(C===null||C===47||C===62||Me(C)){const ge=C===47,ie=o.toLowerCase();return!ge&&!s&&Xp.includes(ie)?(i=1,n.interrupt?t(C):M(C)):Gk.includes(o.toLowerCase())?(i=6,ge?(e.consume(C),_):n.interrupt?t(C):M(C)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(C):s?v(C):y(C))}return C===45||Tt(C)?(e.consume(C),o+=String.fromCharCode(C),w):r(C)}function _(C){return C===62?(e.consume(C),n.interrupt?t:M):r(C)}function v(C){return Ce(C)?(e.consume(C),v):E(C)}function y(C){return C===47?(e.consume(C),E):C===58||C===95||Dt(C)?(e.consume(C),T):Ce(C)?(e.consume(C),y):E(C)}function T(C){return C===45||C===46||C===58||C===95||Tt(C)?(e.consume(C),T):R(C)}function R(C){return C===61?(e.consume(C),x):Ce(C)?(e.consume(C),R):y(C)}function x(C){return C===null||C===60||C===61||C===62||C===96?r(C):C===34||C===39?(e.consume(C),a=C,j):Ce(C)?(e.consume(C),x):H(C)}function j(C){return C===a?(e.consume(C),a=null,U):C===null||me(C)?r(C):(e.consume(C),j)}function H(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Me(C)?R(C):(e.consume(C),H)}function U(C){return C===47||C===62||Ce(C)?y(C):r(C)}function E(C){return C===62?(e.consume(C),I):r(C)}function I(C){return C===null||me(C)?M(C):Ce(C)?(e.consume(C),I):r(C)}function M(C){return C===45&&i===2?(e.consume(C),O):C===60&&i===1?(e.consume(C),K):C===62&&i===4?(e.consume(C),Q):C===63&&i===3?(e.consume(C),S):C===93&&i===5?(e.consume(C),$):me(C)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Zk,le,L)(C)):C===null||me(C)?(e.exit("htmlFlowData"),L(C)):(e.consume(C),M)}function L(C){return e.check(Jk,W,le)(C)}function W(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),A}function A(C){return C===null||me(C)?L(C):(e.enter("htmlFlowData"),M(C))}function O(C){return C===45?(e.consume(C),S):M(C)}function K(C){return C===47?(e.consume(C),o="",P):M(C)}function P(C){if(C===62){const ge=o.toLowerCase();return Xp.includes(ge)?(e.consume(C),Q):M(C)}return Dt(C)&&o.length<8?(e.consume(C),o+=String.fromCharCode(C),P):M(C)}function $(C){return C===93?(e.consume(C),S):M(C)}function S(C){return C===62?(e.consume(C),Q):C===45&&i===2?(e.consume(C),S):M(C)}function Q(C){return C===null||me(C)?(e.exit("htmlFlowData"),le(C)):(e.consume(C),Q)}function le(C){return e.exit("htmlFlow"),t(C)}}function rC(e,t,r){const n=this;return i;function i(o){return me(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 nC(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(To,t,r)}}const iC={name:"htmlText",tokenize:sC};function sC(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),R):S===63?(e.consume(S),y):Dt(S)?(e.consume(S),H):r(S)}function c(S){return S===45?(e.consume(S),h):S===91?(e.consume(S),s=0,g):Dt(S)?(e.consume(S),v):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):me(S)?(o=u,K(S)):(e.consume(S),u)}function d(S){return S===45?(e.consume(S),f):u(S)}function f(S){return S===62?O(S):S===45?d(S):u(S)}function g(S){const Q="CDATA[";return S===Q.charCodeAt(s++)?(e.consume(S),s===Q.length?m:g):r(S)}function m(S){return S===null?r(S):S===93?(e.consume(S),w):me(S)?(o=m,K(S)):(e.consume(S),m)}function w(S){return S===93?(e.consume(S),_):m(S)}function _(S){return S===62?O(S):S===93?(e.consume(S),_):m(S)}function v(S){return S===null||S===62?O(S):me(S)?(o=v,K(S)):(e.consume(S),v)}function y(S){return S===null?r(S):S===63?(e.consume(S),T):me(S)?(o=y,K(S)):(e.consume(S),y)}function T(S){return S===62?O(S):y(S)}function R(S){return Dt(S)?(e.consume(S),x):r(S)}function x(S){return S===45||Tt(S)?(e.consume(S),x):j(S)}function j(S){return me(S)?(o=j,K(S)):Ce(S)?(e.consume(S),j):O(S)}function H(S){return S===45||Tt(S)?(e.consume(S),H):S===47||S===62||Me(S)?U(S):r(S)}function U(S){return S===47?(e.consume(S),O):S===58||S===95||Dt(S)?(e.consume(S),E):me(S)?(o=U,K(S)):Ce(S)?(e.consume(S),U):O(S)}function E(S){return S===45||S===46||S===58||S===95||Tt(S)?(e.consume(S),E):I(S)}function I(S){return S===61?(e.consume(S),M):me(S)?(o=I,K(S)):Ce(S)?(e.consume(S),I):U(S)}function M(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(e.consume(S),i=S,L):me(S)?(o=M,K(S)):Ce(S)?(e.consume(S),M):(e.consume(S),W)}function L(S){return S===i?(e.consume(S),i=void 0,A):S===null?r(S):me(S)?(o=L,K(S)):(e.consume(S),L)}function W(S){return S===null||S===34||S===39||S===60||S===61||S===96?r(S):S===47||S===62||Me(S)?U(S):(e.consume(S),W)}function A(S){return S===47||S===62||Me(S)?U(S):r(S)}function O(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):r(S)}function K(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),P}function P(S){return Ce(S)?Re(e,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):$(S)}function $(S){return e.enter("htmlTextData"),o(S)}}const Kd={name:"labelEnd",resolveAll:cC,resolveTo:uC,tokenize:hC},oC={tokenize:dC},lC={tokenize:fC},aC={tokenize:pC};function cC(e){let t=-1;const 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&&Jt(e,0,e.length,r),e}function uC(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=ur(l,e.slice(s+1,s+n+3)),l=ur(l,[["enter",h,t]]),l=ur(l,Pa(t.parser.constructs.insideSpan.null,e.slice(s+n+4,o-3),t)),l=ur(l,[["exit",h,t],e[o-2],e[o-1],["exit",c,t]]),l=ur(l,e.slice(o+1)),l=ur(l,[["exit",a,t]]),Jt(e,s,e.length,l),e}function hC(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(Cr(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(oC,h,o?h:u)(d):d===91?e.attempt(lC,h,o?c:u)(d):o?h(d):u(d)}function c(d){return e.attempt(aC,h,u)(d)}function h(d){return t(d)}function u(d){return s._balanced=!0,r(d)}}function dC(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 Me(u)?Us(e,s)(u):s(u)}function s(u){return u===41?h(u):Iy(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function o(u){return Me(u)?Us(e,a)(u):h(u)}function l(u){return r(u)}function a(u){return u===34||u===39||u===40?Py(e,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):h(u)}function c(u){return Me(u)?Us(e,h)(u):h(u)}function h(u){return u===41?(e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),e.exit("resource"),t):r(u)}}function fC(e,t,r){const n=this;return i;function i(l){return Ly.call(n,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return n.parser.defined.includes(Cr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function pC(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 gC={name:"labelStartImage",resolveAll:Kd.resolveAll,tokenize:mC};function mC(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 _C={name:"labelStartLink",resolveAll:Kd.resolveAll,tokenize:vC};function vC(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 mc={name:"lineEnding",tokenize:yC};function yC(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Re(e,t,"linePrefix")}}const Sl={name:"thematicBreak",tokenize:SC};function SC(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||me(c))?(e.exit("thematicBreak"),t(c)):r(c)}function a(c){return c===i?(e.consume(c),n++,a):(e.exit("thematicBreakSequence"),Ce(c)?Re(e,l,"whitespace")(c):l(c))}}const jt={continuation:{tokenize:kC},exit:EC,name:"list",tokenize:bC},xC={partial:!0,tokenize:TC},wC={partial:!0,tokenize:CC};function bC(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 g=n.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!n.containerState.marker||f===n.containerState.marker:qu(f)){if(n.containerState.type||(n.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Sl,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 qu(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(To,n.interrupt?r:h,e.attempt(xC,d,u))}function h(f){return n.containerState.initialBlankLine=!0,s++,d(f)}function u(f){return Ce(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 kC(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(To,i,s);function i(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Re(e,t,"listItemIndent",n.containerState.size+1)(l)}function s(l){return n.containerState.furtherBlankLines||!Ce(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(wC,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,Re(e,e.attempt(jt,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function CC(e,t,r){const n=this;return Re(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 EC(e){e.exit(this.containerState.type)}function TC(e,t,r){const n=this;return Re(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!Ce(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):r(s)}}const Gp={name:"setextUnderline",resolveTo:RC,tokenize:IC};function RC(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 IC(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"),Ce(c)?Re(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||me(c)?(e.exit("setextHeadingLine"),t(c)):r(c)}}const LC={tokenize:PC};function PC(e){const t=this,r=e.attempt(To,n,e.attempt(this.parser.constructs.flowInitial,i,Re(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Nk,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 DC={resolveAll:My()},MC=Dy("string"),AC=Dy("text");function Dy(e){return{resolveAll:My(e==="text"?BC: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 My(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 BC(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 NC={42:jt,43:jt,45:jt,48:jt,49:jt,50:jt,51:jt,52:jt,53:jt,54:jt,55:jt,56:jt,57:jt,62:Cy},zC={91:$k},OC={[-2]:gc,[-1]:gc,32:gc},jC={35:qk,42:Sl,45:[Gp,Sl],60:Qk,61:Gp,95:Sl,96:Yp,126:Yp},FC={38:Ty,92:Ey},$C={[-5]:mc,[-4]:mc,[-3]:mc,33:gC,38:Ty,42:Yu,60:[_k,iC],91:_C,92:[Kk,Ey],93:Kd,95:Yu,96:Lk},WC={null:[Yu,DC]},HC={null:[42,95]},UC={null:[]},KC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:HC,contentInitial:zC,disable:UC,document:NC,flow:jC,flowInitial:OC,insideSpan:WC,string:FC,text:$C},Symbol.toStringTag,{value:"Module"}));function VC(e,t,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:j(R),check:j(x),consume:v,enter:y,exit:T,interrupt:j(x,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:e,previous:null,sliceSerialize:d,sliceStream:f,write:u};let h=t.tokenize.call(c,a);return t.resolveAll&&s.push(t),c;function u(I){return o=ur(o,I),w(),o[o.length-1]!==null?[]:(H(t,0),c.events=Pa(s,c.events,c),c.events)}function d(I,M){return YC(f(I),M)}function f(I){return qC(o,I)}function g(){const{_bufferIndex:I,_index:M,line:L,column:W,offset:A}=n;return{_bufferIndex:I,_index:M,line:L,column:W,offset:A}}function m(I){i[I.line]=I.column,E()}function w(){let I;for(;n._index<o.length;){const M=o[n._index];if(typeof M=="string")for(I=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===I&&n._bufferIndex<M.length;)_(M.charCodeAt(n._bufferIndex));else _(M)}}function _(I){h=h(I)}function v(I){me(I)?(n.line++,n.column=1,n.offset+=I===-3?2:1,E()):I!==-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=I}function y(I,M){const L=M||{};return L.type=I,L.start=g(),c.events.push(["enter",L,c]),l.push(L),L}function T(I){const M=l.pop();return M.end=g(),c.events.push(["exit",M,c]),M}function R(I,M){H(I,M.from)}function x(I,M){M.restore()}function j(I,M){return L;function L(W,A,O){let K,P,$,S;return Array.isArray(W)?le(W):"tokenize"in W?le([W]):Q(W);function Q(N){return Y;function Y(te){const ue=te!==null&&N[te],_e=te!==null&&N.null,z=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(_e)?_e:_e?[_e]:[]];return le(z)(te)}}function le(N){return K=N,P=0,N.length===0?O:C(N[P])}function C(N){return Y;function Y(te){return S=U(),$=N,N.partial||(c.currentConstruct=N),N.name&&c.parser.constructs.disable.null.includes(N.name)?ie():N.tokenize.call(M?Object.assign(Object.create(c),M):c,a,ge,ie)(te)}}function ge(N){return I($,S),A}function ie(N){return S.restore(),++P<K.length?C(K[P]):O}}}function H(I,M){I.resolveAll&&!s.includes(I)&&s.push(I),I.resolve&&Jt(c.events,M,c.events.length-M,I.resolve(c.events.slice(M),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function U(){const I=g(),M=c.previous,L=c.currentConstruct,W=c.events.length,A=Array.from(l);return{from:W,restore:O};function O(){n=I,c.previous=M,c.currentConstruct=L,c.events.length=W,l=A,E()}}function E(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function qC(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 YC(e,t){let r=-1;const n=[];let i;for(;++r<e.length;){const s=e[r];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
69
- `;break}case-3:{o=`\r
70
- `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,n.push(o)}return n.join("")}function XC(e){const n={constructs:by([KC,...(e||{}).extensions||[]]),content:i(uk),defined:[],document:i(dk),flow:i(LC),lazy:{},string:i(MC),text:i(AC)};return n;function i(s){return o;function o(l){return VC(n,s,l)}}}function GC(e){for(;!Ry(e););return e}const Qp=/[\0\t\n\r]/g;function QC(){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(Qp.lastIndex=u,c=Qp.exec(s),d=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(d),!c){t=s.slice(u);break}if(f===10&&u===d&&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 ZC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JC(e){return e.replace(ZC,e2)}function e2(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return ky(r.slice(s?2:1),s?16:10)}return Ud(r)||e}const Ay={}.hasOwnProperty;function t2(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),r2(r)(GC(XC(r).document().write(QC()(e,t,!0))))}function r2(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(an),autolinkProtocol:U,autolinkEmail:U,atxHeading:s(Pe),blockQuote:s(_e),characterEscape:U,characterReference:U,codeFenced:s(z),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(z,o),codeText:s(Te,o),codeTextData:U,data:U,codeFlowValue:U,definition:s(ye),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Qe),hardBreakEscape:s(mr),hardBreakTrailing:s(mr),htmlFlow:s(nr,o),htmlFlowData:U,htmlText:s(nr,o),htmlTextData:U,image:s(Wr),label:o,link:s(an),listItem:s(Tr),listItemValue:d,listOrdered:s(Hr,u),listUnordered:s(Hr),paragraph:s(Ur),reference:C,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Pe),strong:s(wt),thematicBreak:s(pe)},exit:{atxHeading:a(),atxHeadingSequence:R,autolink:a(),autolinkEmail:ue,autolinkProtocol:te,blockQuote:a(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:N,characterReference:Y,codeFenced:a(w),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:E,codeIndented:a(_),codeText:a(A),codeTextData:E,data:E,definition:a(),definitionDestinationString:T,definitionLabelString:v,definitionTitleString:y,emphasis:a(),hardBreakEscape:a(M),hardBreakTrailing:a(M),htmlFlow:a(L),htmlFlowData:E,htmlText:a(W),htmlTextData:E,image:a(K),label:$,labelText:P,lineEnding:I,link:a(O),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:ge,resourceDestinationString:S,resourceTitleString:Q,resource:le,setextHeading:a(H),setextHeadingLineSequence:j,setextHeadingText:x,strong:a(),thematicBreak:a()}};By(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(D){let G={type:"root",children:[]};const B={stack:[G],tokenStack:[],config:t,enter:l,exit:c,buffer:o,resume:h,data:r},F=[];let V=-1;for(;++V<D.length;)if(D[V][1].type==="listOrdered"||D[V][1].type==="listUnordered")if(D[V][0]==="enter")F.push(V);else{const X=F.pop();V=i(D,X,V)}for(V=-1;++V<D.length;){const X=t[D[V][0]];Ay.call(X,D[V][1].type)&&X[D[V][1].type].call(Object.assign({sliceSerialize:D[V][2].sliceSerialize},B),D[V][1])}if(B.tokenStack.length>0){const X=B.tokenStack[B.tokenStack.length-1];(X[1]||Zp).call(B,void 0,X[0])}for(G.position={start:un(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:un(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},V=-1;++V<t.transforms.length;)G=t.transforms[V](G)||G;return G}function i(D,G,B){let F=G-1,V=-1,X=!1,J,oe,ae,fe;for(;++F<=B;){const ce=D[F];switch(ce[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ce[0]==="enter"?V++:V--,fe=void 0;break}case"lineEndingBlank":{ce[0]==="enter"&&(J&&!fe&&!V&&!ae&&(ae=F),fe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:fe=void 0}if(!V&&ce[0]==="enter"&&ce[1].type==="listItemPrefix"||V===-1&&ce[0]==="exit"&&(ce[1].type==="listUnordered"||ce[1].type==="listOrdered")){if(J){let k=F;for(oe=void 0;k--;){const Z=D[k];if(Z[1].type==="lineEnding"||Z[1].type==="lineEndingBlank"){if(Z[0]==="exit")continue;oe&&(D[oe][1].type="lineEndingBlank",X=!0),Z[1].type="lineEnding",oe=k}else if(!(Z[1].type==="linePrefix"||Z[1].type==="blockQuotePrefix"||Z[1].type==="blockQuotePrefixWhitespace"||Z[1].type==="blockQuoteMarker"||Z[1].type==="listItemIndent"))break}ae&&(!oe||ae<oe)&&(J._spread=!0),J.end=Object.assign({},oe?D[oe][1].start:ce[1].end),D.splice(oe||F,0,["exit",J,ce[2]]),F++,B++}if(ce[1].type==="listItemPrefix"){const k={type:"listItem",_spread:!1,start:Object.assign({},ce[1].start),end:void 0};J=k,D.splice(F,0,["enter",k,ce[2]]),F++,B++,ae=void 0,fe=!0}}}return D[G][1]._spread=X,B}function s(D,G){return B;function B(F){l.call(this,D(F),F),G&&G.call(this,F)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(D,G,B){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([G,B||void 0]),D.position={start:un(G.start),end:void 0}}function a(D){return G;function G(B){D&&D.call(this,B),c.call(this,B)}}function c(D,G){const B=this.stack.pop(),F=this.tokenStack.pop();if(F)F[0].type!==D.type&&(G?G.call(this,D,F[0]):(F[1]||Zp).call(this,D,F[0]));else throw new Error("Cannot close `"+D.type+"` ("+Hs({start:D.start,end:D.end})+"): it’s not open");B.position.end=un(D.end)}function h(){return Hd(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function d(D){if(this.data.expectingFirstListItemValue){const G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function f(){const D=this.resume(),G=this.stack[this.stack.length-1];G.lang=D}function g(){const D=this.resume(),G=this.stack[this.stack.length-1];G.meta=D}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const D=this.resume(),G=this.stack[this.stack.length-1];G.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const D=this.resume(),G=this.stack[this.stack.length-1];G.value=D.replace(/(\r?\n|\r)$/g,"")}function v(D){const G=this.resume(),B=this.stack[this.stack.length-1];B.label=G,B.identifier=Cr(this.sliceSerialize(D)).toLowerCase()}function y(){const D=this.resume(),G=this.stack[this.stack.length-1];G.title=D}function T(){const D=this.resume(),G=this.stack[this.stack.length-1];G.url=D}function R(D){const G=this.stack[this.stack.length-1];if(!G.depth){const B=this.sliceSerialize(D).length;G.depth=B}}function x(){this.data.setextHeadingSlurpLineEnding=!0}function j(D){const G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function H(){this.data.setextHeadingSlurpLineEnding=void 0}function U(D){const B=this.stack[this.stack.length-1].children;let F=B[B.length-1];(!F||F.type!=="text")&&(F=re(),F.position={start:un(D.start),end:void 0},B.push(F)),this.stack.push(F)}function E(D){const G=this.stack.pop();G.value+=this.sliceSerialize(D),G.position.end=un(D.end)}function I(D){const G=this.stack[this.stack.length-1];if(this.data.atHardBreak){const B=G.children[G.children.length-1];B.position.end=un(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(G.type)&&(U.call(this,D),E.call(this,D))}function M(){this.data.atHardBreak=!0}function L(){const D=this.resume(),G=this.stack[this.stack.length-1];G.value=D}function W(){const D=this.resume(),G=this.stack[this.stack.length-1];G.value=D}function A(){const D=this.resume(),G=this.stack[this.stack.length-1];G.value=D}function O(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=G,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function K(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=G,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function P(D){const G=this.sliceSerialize(D),B=this.stack[this.stack.length-2];B.label=JC(G),B.identifier=Cr(G).toLowerCase()}function $(){const D=this.stack[this.stack.length-1],G=this.resume(),B=this.stack[this.stack.length-1];if(this.data.inReference=!0,B.type==="link"){const F=D.children;B.children=F}else B.alt=G}function S(){const D=this.resume(),G=this.stack[this.stack.length-1];G.url=D}function Q(){const D=this.resume(),G=this.stack[this.stack.length-1];G.title=D}function le(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function ge(D){const G=this.resume(),B=this.stack[this.stack.length-1];B.label=G,B.identifier=Cr(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function ie(D){this.data.characterReferenceType=D.type}function N(D){const G=this.sliceSerialize(D),B=this.data.characterReferenceType;let F;B?(F=ky(G,B==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):F=Ud(G);const V=this.stack[this.stack.length-1];V.value+=F}function Y(D){const G=this.stack.pop();G.position.end=un(D.end)}function te(D){E.call(this,D);const G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(D)}function ue(D){E.call(this,D);const G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(D)}function _e(){return{type:"blockquote",children:[]}}function z(){return{type:"code",lang:null,meta:null,value:""}}function Te(){return{type:"inlineCode",value:""}}function ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Qe(){return{type:"emphasis",children:[]}}function Pe(){return{type:"heading",depth:0,children:[]}}function mr(){return{type:"break"}}function nr(){return{type:"html",value:""}}function Wr(){return{type:"image",title:null,url:"",alt:null}}function an(){return{type:"link",title:null,url:"",children:[]}}function Hr(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function Tr(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function Ur(){return{type:"paragraph",children:[]}}function wt(){return{type:"strong",children:[]}}function re(){return{type:"text",value:""}}function pe(){return{type:"thematicBreak"}}}function un(e){return{line:e.line,column:e.column,offset:e.offset}}function By(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?By(e,n):n2(e,n)}}function n2(e,t){let r;for(r in t)if(Ay.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 Zp(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Hs({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Hs({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Hs({start:t.start,end:t.end})+") is still open")}function i2(e){const t=this;t.parser=r;function r(n){return t2(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function s2(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 o2(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
71
- `}]}function l2(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 a2(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function c2(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function u2(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),i=ns(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 h2(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 d2(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function Ny(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 f2(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Ny(e,t);const i={src:ns(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 p2(e,t){const r={src:ns(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 g2(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 m2(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Ny(e,t);const i={href:ns(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 _2(e,t){const r={href:ns(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 v2(e,t,r){const n=e.all(t),i=r?y2(r):zy(t),s={},o=[];if(typeof t.checked=="boolean"){const h=n[0];let u;h&&h.type==="element"&&h.tagName==="p"?u=h:(u={type:"element",tagName:"p",properties:{},children:[]},n.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const h=n[l];(i||l!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
73
- `}),h.type==="element"&&h.tagName==="p"&&!i?o.push(...h.children):o.push(h)}const a=n[n.length-1];a&&(i||a.type!=="element"||a.tagName!=="p")&&o.push({type:"text",value:`
74
- `});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function y2(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=zy(r[n])}return t}function zy(e){const t=e.spread;return t??e.children.length>1}function S2(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 x2(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function w2(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function b2(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function k2(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=jd(t.children[1]),a=my(t.children[t.children.length-1]);l&&a&&(o.position={start:l,end:a}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function C2(e,t,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 g={type:"element",tagName:s,properties:d,children:[]};u&&(g.children=e.all(u),e.patch(u,g),g=e.applyData(u,g)),c.push(g)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,h),e.applyData(t,h)}function E2(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const Jp=9,eg=32;function T2(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),i=0;const s=[];for(;n;)s.push(tg(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return s.push(tg(t.slice(i),i>0,!1)),s.join("")}function tg(e,t,r){let n=0,i=e.length;if(t){let s=e.codePointAt(n);for(;s===Jp||s===eg;)n++,s=e.codePointAt(n)}if(r){let s=e.codePointAt(i-1);for(;s===Jp||s===eg;)i--,s=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}function R2(e,t){const r={type:"text",value:T2(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function I2(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const L2={blockquote:s2,break:o2,code:l2,delete:a2,emphasis:c2,footnoteReference:u2,heading:h2,html:d2,imageReference:f2,image:p2,inlineCode:g2,linkReference:m2,link:_2,listItem:v2,list:S2,paragraph:x2,root:w2,strong:b2,table:k2,tableCell:E2,tableRow:C2,text:R2,thematicBreak:I2,toml:Qo,yaml:Qo,definition:Qo,footnoteDefinition:Qo};function Qo(){}const Oy=-1,Da=0,Ks=1,ra=2,Vd=3,qd=4,Yd=5,Xd=6,jy=7,Fy=8,rg=typeof self=="object"?self:globalThis,P2=(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 Da:case Oy:return r(o,i);case Ks:{const l=r([],i);for(const a of o)l.push(n(a));return l}case ra:{const l=r({},i);for(const[a,c]of o)l[n(a)]=n(c);return l}case Vd:return r(new Date(o),i);case qd:{const{source:l,flags:a}=o;return r(new RegExp(l,a),i)}case Yd:{const l=r(new Map,i);for(const[a,c]of o)l.set(n(a),n(c));return l}case Xd:{const l=r(new Set,i);for(const a of o)l.add(n(a));return l}case jy:{const{name:l,message:a}=o;return r(new rg[l](a),i)}case Fy: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 rg[s](o),i)};return n},ng=e=>P2(new Map,e)(0),vi="",{toString:D2}={},{keys:M2}=Object,ms=e=>{const t=typeof e;if(t!=="object"||!e)return[Da,t];const r=D2.call(e).slice(8,-1);switch(r){case"Array":return[Ks,vi];case"Object":return[ra,vi];case"Date":return[Vd,vi];case"RegExp":return[qd,vi];case"Map":return[Yd,vi];case"Set":return[Xd,vi];case"DataView":return[Ks,r]}return r.includes("Array")?[Ks,r]:r.includes("Error")?[jy,r]:[ra,r]},Zo=([e,t])=>e===Da&&(t==="function"||t==="symbol"),A2=(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]=ms(o);switch(l){case Da:{let h=o;switch(a){case"bigint":l=Fy,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);h=null;break;case"undefined":return i([Oy],o)}return i([l,h],o)}case Ks:{if(a){let d=o;return a==="DataView"?d=new Uint8Array(o.buffer):a==="ArrayBuffer"&&(d=new Uint8Array(o)),i([a,[...d]],o)}const h=[],u=i([l,h],o);for(const d of o)h.push(s(d));return u}case ra:{if(a)switch(a){case"BigInt":return i([a,o.toString()],o);case"Boolean":case"Number":case"String":return i([a,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const h=[],u=i([l,h],o);for(const d of M2(o))(e||!Zo(ms(o[d])))&&h.push([s(d),s(o[d])]);return u}case Vd:return i([l,o.toISOString()],o);case qd:{const{source:h,flags:u}=o;return i([l,{source:h,flags:u}],o)}case Yd:{const h=[],u=i([l,h],o);for(const[d,f]of o)(e||!(Zo(ms(d))||Zo(ms(f))))&&h.push([s(d),s(f)]);return u}case Xd:{const h=[],u=i([l,h],o);for(const d of o)(e||!Zo(ms(d)))&&h.push(s(d));return u}}const{message:c}=o;return i([l,{name:a,message:c}],o)};return s},ig=(e,{json:t,lossy:r}={})=>{const n=[];return A2(!(t||r),!!t,new Map,n)(e),n},na=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ng(ig(e,t)):structuredClone(e):(e,t)=>ng(ig(e,t));function B2(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 N2(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function z2(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||B2,n=e.options.footnoteBackLabel||N2,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let a=-1;for(;++a<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[a]);if(!c)continue;const h=e.all(c),u=String(c.identifier).toUpperCase(),d=ns(u.toLowerCase());let f=0;const g=[],m=e.footnoteCounts.get(u);for(;m!==void 0&&++f<=m;){g.length>0&&g.push({type:"text",value:" "});let v=typeof r=="string"?r:r(a,f);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(a,f),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const v=w.children[w.children.length-1];v&&v.type==="text"?v.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...g)}else h.push(...g);const _={type:"element",tagName:"li",properties:{id:t+"fn-"+d},children:e.wrap(h,!0)};e.patch(c,_),l.push(_)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...na(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
75
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
76
- `}]}}const Ma=function(e){if(e==null)return $2;if(typeof e=="function")return Aa(e);if(typeof e=="object")return Array.isArray(e)?O2(e):j2(e);if(typeof e=="string")return F2(e);throw new Error("Expected function, string, or object as test")};function O2(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Ma(e[r]);return Aa(n);function n(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function j2(e){const t=e;return Aa(r);function r(n){const i=n;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function F2(e){return Aa(t);function t(r){return r&&r.type===e}}function Aa(e){return t;function t(r,n,i){return!!(W2(r)&&e.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function $2(){return!0}function W2(e){return e!==null&&typeof e=="object"&&"type"in e}const $y=[],H2=!0,Xu=!1,U2="skip";function Wy(e,t,r,n){let i;typeof t=="function"&&typeof r!="function"?(n=r,r=t):i=t;const s=Ma(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=$y,g,m,w;if((!t||s(a,c,h[h.length-1]||void 0))&&(f=K2(r(a,h)),f[0]===Xu))return f;if("children"in a&&a.children){const _=a;if(_.children&&f[0]!==U2)for(m=(n?_.children.length:-1)+o,w=h.concat(_);m>-1&&m<_.children.length;){const v=_.children[m];if(g=l(v,m,w)(),g[0]===Xu)return g;m=typeof g[1]=="number"?g[1]:m+o}}return f}}}function K2(e){return Array.isArray(e)?e:typeof e=="number"?[H2,e]:e==null?$y:[e]}function Ba(e,t,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),Wy(e,s,l,i);function l(a,c){const h=c[c.length-1],u=h?h.children.indexOf(a):void 0;return o(a,u,h)}}const Gu={}.hasOwnProperty,V2={};function q2(e,t){const r=t||V2,n=new Map,i=new Map,s=new Map,o={...L2,...r.handlers},l={all:c,applyData:X2,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:a,options:r,patch:Y2,wrap:Q2};return Ba(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(Gu.call(l.handlers,d)&&f)return f(l,h,u);if(l.options.passThrough&&l.options.passThrough.includes(d)){if("children"in h){const{children:m,...w}=h,_=na(w);return _.children=l.all(h),_}return na(h)}return(l.options.unknownHandler||G2)(l,h,u)}function c(h){const u=[];if("children"in h){const d=h.children;let f=-1;for(;++f<d.length;){const g=l.one(d[f],h);if(g){if(f&&d[f-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=sg(g.value)),!Array.isArray(g)&&g.type==="element")){const m=g.children[0];m&&m.type==="text"&&(m.value=sg(m.value))}Array.isArray(g)?u.push(...g):u.push(g)}}}return u}}function Y2(e,t){e.position&&(t.position=Nb(e))}function X2(e,t){let 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,na(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function G2(e,t){const r=t.data||{},n="value"in t&&!(Gu.call(r,"hProperties")||Gu.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 Q2(e,t){const r=[];let n=-1;for(t&&r.push({type:"text",value:`
77
- `});++n<e.length;)n&&r.push({type:"text",value:`
78
- `}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:`
79
- `}),r}function sg(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function og(e,t){const r=q2(e,t),n=r.one(e,void 0),i=z2(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 Z2(e,t){return e&&"run"in e?async function(r,n){const i=og(r,{file:n,...t});await e.run(i,n)}:function(r,n){return og(r,{file:n,...e||t})}}function lg(e){if(e)throw e}var xl=Object.prototype.hasOwnProperty,Hy=Object.prototype.toString,ag=Object.defineProperty,cg=Object.getOwnPropertyDescriptor,ug=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Hy.call(t)==="[object Array]"},hg=function(t){if(!t||Hy.call(t)!=="[object Object]")return!1;var r=xl.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&xl.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var i;for(i in t);return typeof i>"u"||xl.call(t,i)},dg=function(t,r){ag&&r.name==="__proto__"?ag(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},fg=function(t,r){if(r==="__proto__")if(xl.call(t,r)){if(cg)return cg(t,r).value}else return;return t[r]},J2=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=fg(l,r),i=fg(t,r),l!==i&&(h&&i&&(hg(i)||(s=ug(i)))?(s?(s=!1,o=n&&ug(n)?n:[]):o=n&&hg(n)?n:{},dg(l,{name:r,newValue:e(h,o,i)})):typeof i<"u"&&dg(l,{name:r,newValue:i}));return l};const _c=jh(J2);function Qu(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function eE(){const e=[],t={run: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?tE(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 tE(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 Mr={basename:rE,dirname:nE,extname:iE,join:sE,sep:"/"};function rE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ro(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 nE(e){if(Ro(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 iE(e){Ro(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 sE(...e){let t=-1,r;for(;++t<e.length;)Ro(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":oE(r)}function oE(e){Ro(e);const t=e.codePointAt(0)===47;let r=lE(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function lE(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 Ro(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const aE={cwd:cE};function cE(){return"/"}function Zu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function uE(e){if(typeof e=="string")e=new URL(e);else if(!Zu(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return hE(e)}function hE(e){if(e.hostname!==""){const 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 vc=["history","path","basename","stem","extname","dirname"];class Uy{constructor(t){let r;t?Zu(t)?r={path:t}:typeof t=="string"||dE(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":aE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<vc.length;){const s=vc[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)vc.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Mr.basename(this.path):void 0}set basename(t){Sc(t,"basename"),yc(t,"basename"),this.path=Mr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Mr.dirname(this.path):void 0}set dirname(t){pg(this.basename,"dirname"),this.path=Mr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Mr.extname(this.path):void 0}set extname(t){if(yc(t,"extname"),pg(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Mr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Zu(t)&&(t=uE(t)),Sc(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Mr.basename(this.path,this.extname):void 0}set stem(t){Sc(t,"stem"),yc(t,"stem"),this.path=Mr.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 yc(e,t){if(e&&e.includes(Mr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Mr.sep+"`")}function Sc(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function pg(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function dE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const fE=function(e){const n=this.constructor.prototype,i=n[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s},pE={}.hasOwnProperty;class Gd extends fE{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=eE()}copy(){const t=new Gd;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(_c(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(bc("data",this.frozen),this.namespace[t]=r,this):pE.call(this.namespace,t)&&this.namespace[t]||void 0:t?(bc("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[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=Jo(t),n=this.parser||this.Parser;return xc("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),xc("process",this.parser||this.Parser),wc("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const l=Jo(t),a=n.parse(l);n.run(a,l,function(h,u,d){if(h||!u||!d)return c(h);const f=u,g=n.stringify(f,d);_E(g)?d.value=g:d.result=g,c(h,d)});function c(h,u){h||!u?o(h):s?s(u):r(void 0,u)}}}processSync(t){let r=!1,n;return this.freeze(),xc("processSync",this.parser||this.Parser),wc("processSync",this.compiler||this.Compiler),this.process(t,i),mg("processSync","process",r),n;function i(s,o){r=!0,lg(s),n=o}}run(t,r,n){gg(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=Jo(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),mg("runSync","run",n),i;function s(o,l){lg(o),i=l,n=!0}}stringify(t,r){this.freeze();const n=Jo(r),i=this.compiler||this.Compiler;return wc("stringify",i),gg(t),i(t,n)}use(t,...r){const n=this.attachers,i=this.namespace;if(bc("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=_c(!0,i.settings,c.settings))}function l(c){let h=-1;if(c!=null)if(Array.isArray(c))for(;++h<c.length;){const u=c[h];s(u)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function a(c,h){let u=-1,d=-1;for(;++u<n.length;)if(n[u][0]===c){d=u;break}if(d===-1)n.push([c,...h]);else if(h.length>0){let[f,...g]=h;const m=n[d][1];Qu(m)&&Qu(f)&&(f=_c(!0,m,f)),n[d]=[c,f,...g]}}}}const gE=new Gd().freeze();function xc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function wc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function bc(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function gg(e){if(!Qu(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function mg(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Jo(e){return mE(e)?e:new Uy(e)}function mE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _E(e){return typeof e=="string"||vE(e)}function vE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_g=[],vg={allowDangerousHtml:!0},SE=/^(https?|ircs?|mailto|xmpp)$/i,xE=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function kc(e){const t=wE(e),r=bE(e);return kE(t.runSync(t.parse(r),r),e)}function wE(e){const t=e.rehypePlugins||_g,r=e.remarkPlugins||_g,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vg}:vg;return gE().use(i2).use(r).use(Z2,n).use(t)}function bE(e){const t=e.children||"",r=new Uy;return typeof t=="string"&&(r.value=t),r}function kE(e,t){const r=t.allowedElements,n=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||CE;for(const h of xE)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+yE+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Ba(e,c),$b(e,{Fragment:p.Fragment,components:i,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function c(h,u,d){if(h.type==="raw"&&d&&typeof u=="number")return o?d.children.splice(u,1):d.children[u]={type:"text",value:h.value},u;if(h.type==="element"){let f;for(f in pc)if(Object.hasOwn(pc,f)&&Object.hasOwn(h.properties,f)){const g=h.properties[f],m=pc[f];(m===null||m.includes(h.tagName))&&(h.properties[f]=a(String(g||""),f,h))}}if(h.type==="element"){let f=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 CE(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||SE.test(e.slice(0,t))?e:""}function yg(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 EE(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ky(e,t,r){const i=Ma((r||{}).ignore||[]),s=TE(t);let o=-1;for(;++o<s.length;)Wy(e,"text",l);function l(c,h){let u=-1,d;for(;++u<h.length;){const f=h[u],g=d?d.children:void 0;if(i(f,g?g.indexOf(f):void 0,d))return;d=f}if(d)return a(c,h)}function a(c,h){const u=h[h.length-1],d=s[o][0],f=s[o][1];let g=0;const w=u.children.indexOf(c);let _=!1,v=[];d.lastIndex=0;let y=d.exec(c.value);for(;y;){const T=y.index,R={index:y.index,input:y.input,stack:[...h,c]};let x=f(...y,R);if(typeof x=="string"&&(x=x.length>0?{type:"text",value:x}:void 0),x===!1?d.lastIndex=T+1:(g!==T&&v.push({type:"text",value:c.value.slice(g,T)}),Array.isArray(x)?v.push(...x):x&&v.push(x),g=T+y[0].length,_=!0),!d.global)break;y=d.exec(c.value)}return _?(g<c.value.length&&v.push({type:"text",value:c.value.slice(g)}),u.children.splice(w,1,...v)):v=[c],w+v.length}}function TE(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let n=-1;for(;++n<r.length;){const i=r[n];t.push([RE(i[0]),IE(i[1])])}return t}function RE(e){return typeof e=="string"?new RegExp(EE(e),"g"):e}function IE(e){return typeof e=="function"?e:function(){return e}}const Cc="phrasing",Ec=["autolink","link","image","label"];function LE(){return{transforms:[zE],enter:{literalAutolink:DE,literalAutolinkEmail:Tc,literalAutolinkHttp:Tc,literalAutolinkWww:Tc},exit:{literalAutolink:NE,literalAutolinkEmail:BE,literalAutolinkHttp:ME,literalAutolinkWww:AE}}}function PE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Cc,notInConstruct:Ec},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Cc,notInConstruct:Ec},{character:":",before:"[ps]",after:"\\/",inConstruct:Cc,notInConstruct:Ec}]}}function DE(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Tc(e){this.config.enter.autolinkProtocol.call(this,e)}function ME(e){this.config.exit.autolinkProtocol.call(this,e)}function AE(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function BE(e){this.config.exit.autolinkEmail.call(this,e)}function NE(e){this.exit(e)}function zE(e){Ky(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,OE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),jE]],{ignore:["link","linkReference"]})}function OE(e,t,r,n,i){let s="";if(!Vy(i)||(/^w/i.test(t)&&(r=t+r,t="",s="http://"),!FE(r)))return!1;const o=$E(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 jE(e,t,r,n){return!Vy(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function FE(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function $E(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")");const i=yg(e,"(");let s=yg(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 Vy(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ci(r)||La(r))&&(!t||r!==47)}qy.peek=GE;function WE(){this.buffer()}function HE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function UE(){this.buffer()}function KE(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function VE(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Cr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function qE(e){this.exit(e)}function YE(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Cr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function XE(e){this.exit(e)}function GE(){return"["}function qy(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 QE(){return{enter:{gfmFootnoteCallString:WE,gfmFootnoteCall:HE,gfmFootnoteDefinitionLabelString:UE,gfmFootnoteDefinition:KE},exit:{gfmFootnoteCallString:VE,gfmFootnoteCall:qE,gfmFootnoteDefinitionLabelString:YE,gfmFootnoteDefinition:XE}}}function ZE(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:qy},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?Yy:JE))),c(),a}}function JE(e,t,r){return t===0?e:Yy(e,t,r)}function Yy(e,t,r){return(r?"":" ")+e}const e5=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Xy.peek=s5;function t5(){return{canContainEols:["delete"],enter:{strikethrough:n5},exit:{strikethrough:i5}}}function r5(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:e5}],handlers:{delete:Xy}}}function n5(e){this.enter({type:"delete",children:[]},e)}function i5(e){this.exit(e)}function Xy(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 s5(){return"~"}function o5(e){return e.length}function l5(e,t){const r=t||{},n=(r.align||[]).concat(),i=r.stringLength||o5,s=[],o=[],l=[],a=[];let c=0,h=-1;for(;++h<e.length;){const m=[],w=[];let _=-1;for(e[h].length>c&&(c=e[h].length);++_<e[h].length;){const v=a5(e[h][_]);if(r.alignDelimiters!==!1){const y=i(v);w[_]=y,(a[_]===void 0||y>a[_])&&(a[_]=y)}m.push(v)}o[h]=m,l[h]=w}let u=-1;if(typeof n=="object"&&"length"in n)for(;++u<c;)s[u]=Sg(n[u]);else{const m=Sg(n);for(;++u<c;)s[u]=m}u=-1;const d=[],f=[];for(;++u<c;){const m=s[u];let w="",_="";m===99?(w=":",_=":"):m===108?w=":":m===114&&(_=":");let v=r.alignDelimiters===!1?1:Math.max(1,a[u]-w.length-_.length);const y=w+"-".repeat(v)+_;r.alignDelimiters!==!1&&(v=w.length+v+_.length,v>a[u]&&(a[u]=v),f[u]=v),d[u]=y}o.splice(1,0,d),l.splice(1,0,f),h=-1;const g=[];for(;++h<o.length;){const m=o[h],w=l[h];u=-1;const _=[];for(;++u<c;){const v=m[u]||"";let y="",T="";if(r.alignDelimiters!==!1){const R=a[u]-(w[u]||0),x=s[u];x===114?y=" ".repeat(R):x===99?R%2?(y=" ".repeat(R/2+.5),T=" ".repeat(R/2-.5)):(y=" ".repeat(R/2),T=y):T=" ".repeat(R)}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(T),r.padding!==!1&&_.push(" "),(r.delimiterEnd!==!1||u!==c-1)&&_.push("|")}g.push(r.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return g.join(`
82
- `)}function a5(e){return e==null?"":String(e)}function Sg(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function c5(e,t,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()),u5);return i(),o}function u5(e,t,r){return">"+(r?"":" ")+e}function h5(e,t){return xg(e,t.inConstruct,!0)&&!xg(e,t.notInConstruct,!1)}function xg(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 wg(e,t,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
83
- `&&h5(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
84
- `}function d5(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 f5(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function p5(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function g5(e,t,r,n){const i=p5(r),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(f5(e,r)){const u=r.enter("codeIndented"),d=r.indentLines(s,m5);return u(),d}const l=r.createTracker(n),a=i.repeat(Math.max(d5(s,i)+1,3)),c=r.enter("codeFenced");let h=l.move(a);if(e.lang){const u=r.enter(`codeFencedLang${o}`);h+=l.move(r.safe(e.lang,{before:h,after:" ",encode:["`"],...l.current()})),u()}if(e.lang&&e.meta){const u=r.enter(`codeFencedMeta${o}`);h+=l.move(" "),h+=l.move(r.safe(e.meta,{before:h,after:`
85
- `,encode:["`"],...l.current()})),u()}return h+=l.move(`
86
- `),s&&(h+=l.move(s+`
87
- `)),h+=l.move(a),c(),h}function m5(e,t,r){return(r?"":" ")+e}function Qd(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function _5(e,t,r,n){const i=Qd(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 v5(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function po(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ia(e,t,r){const n=Xi(e),i=Xi(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}}Gy.peek=y5;function Gy(e,t,r,n){const i=v5(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=ia(n.before.charCodeAt(n.before.length-1),c,i);h.inside&&(a=po(c)+a.slice(1));const u=a.charCodeAt(a.length-1),d=ia(n.after.charCodeAt(0),u,i);d.inside&&(a=a.slice(0,-1)+po(u));const f=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},l+a+f}function y5(e,t,r){return r.options.emphasis||"*"}function S5(e,t){let r=!1;return Ba(e,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,Xu}),!!((!e.depth||e.depth<3)&&Hd(e)&&(t.options.setext||r))}function x5(e,t,r,n){const i=Math.max(Math.min(6,e.depth||1),1),s=r.createTracker(n);if(S5(e,r)){const h=r.enter("headingSetext"),u=r.enter("phrasing"),d=r.containerPhrasing(e,{...s.current(),before:`
89
- `,after:`
90
- `});return u(),h(),d+`
91
- `+(i===1?"=":"-").repeat(d.length-(Math.max(d.lastIndexOf("\r"),d.lastIndexOf(`
92
- `))+1))}const o="#".repeat(i),l=r.enter("headingAtx"),a=r.enter("phrasing");s.move(o+" ");let c=r.containerPhrasing(e,{before:"# ",after:`
93
- `,...s.current()});return/^[\t ]/.test(c)&&(c=po(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),a(),l(),c}Qy.peek=w5;function Qy(e){return e.value||""}function w5(){return"<"}Zy.peek=b5;function Zy(e,t,r,n){const i=Qd(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 b5(){return"!"}Jy.peek=k5;function Jy(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 k5(){return"!"}e0.peek=C5;function e0(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 C5(){return"`"}function t0(e,t){const r=Hd(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))}r0.peek=E5;function r0(e,t,r,n){const i=Qd(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let l,a;if(t0(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 E5(e,t,r){return t0(e,r)?"<":"["}n0.peek=T5;function n0(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 T5(){return"["}function Zd(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function R5(e){const t=Zd(e),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 I5(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function i0(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function L5(e,t,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=e.ordered?I5(r):Zd(r);const l=e.ordered?o==="."?")":".":R5(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),i0(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 P5(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function D5(e,t,r,n){const i=P5(r);let s=r.bulletCurrent||Zd(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 M5(e,t,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(e,n);return s(),i(),o}const A5=Ma(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function B5(e,t,r,n){return(e.children.some(function(o){return A5(o)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function N5(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}s0.peek=z5;function s0(e,t,r,n){const i=N5(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=ia(n.before.charCodeAt(n.before.length-1),c,i);h.inside&&(a=po(c)+a.slice(1));const u=a.charCodeAt(a.length-1),d=ia(n.after.charCodeAt(0),u,i);d.inside&&(a=a.slice(0,-1)+po(u));const f=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},l+a+f}function z5(e,t,r){return r.options.strong||"*"}function O5(e,t,r,n){return r.safe(e.value,n)}function j5(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function F5(e,t,r){const n=(i0(r)+(r.options.ruleSpaces?" ":"")).repeat(j5(r));return r.options.ruleSpaces?n.slice(0,-1):n}const o0={blockquote:c5,break:wg,code:g5,definition:_5,emphasis:Gy,hardBreak:wg,heading:x5,html:Qy,image:Zy,imageReference:Jy,inlineCode:e0,link:r0,linkReference:n0,list:L5,listItem:D5,paragraph:M5,root:B5,strong:s0,text:O5,thematicBreak:F5};function $5(){return{enter:{table:W5,tableData:bg,tableHeader:bg,tableRow:U5},exit:{codeText:K5,table:H5,tableData:Rc,tableHeader:Rc,tableRow:Rc}}}function W5(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function H5(e){this.exit(e),this.data.inTable=void 0}function U5(e){this.enter({type:"tableRow",children:[]},e)}function Rc(e){this.exit(e)}function bg(e){this.enter({type:"tableCell",children:[]},e)}function K5(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,V5));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function V5(e,t){return t==="|"?t:e}function q5(e){const t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
94
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:d,table:o,tableCell:a,tableRow:l}};function o(f,g,m,w){return c(h(f,m,w),f.align)}function l(f,g,m,w){const _=u(f,m,w),v=c([_]);return v.slice(0,v.indexOf(`
95
- `))}function a(f,g,m,w){const _=m.enter("tableCell"),v=m.enter("phrasing"),y=m.containerPhrasing(f,{...w,before:s,after:s});return v(),_(),y}function c(f,g){return l5(f,{align:g,alignDelimiters:n,padding:r,stringLength:i})}function h(f,g,m){const w=f.children;let _=-1;const v=[],y=g.enter("table");for(;++_<w.length;)v[_]=u(w[_],g,m);return y(),v}function u(f,g,m){const w=f.children;let _=-1;const v=[],y=g.enter("tableRow");for(;++_<w.length;)v[_]=a(w[_],f,g,m);return y(),v}function d(f,g,m){let w=o0.inlineCode(f,g,m);return m.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function Y5(){return{exit:{taskListCheckValueChecked:kg,taskListCheckValueUnchecked:kg,paragraph:G5}}}function X5(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Q5}}}function kg(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function G5(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const 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 Q5(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=o0.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 Z5(){return[LE(),QE(),t5(),$5(),Y5()]}function J5(e){return{extensions:[PE(),ZE(e),r5(),q5(e),X5()]}}const e4={tokenize:o4,partial:!0},l0={tokenize:l4,partial:!0},a0={tokenize:a4,partial:!0},c0={tokenize:c4,partial:!0},t4={tokenize:u4,partial:!0},u0={name:"wwwAutolink",tokenize:i4,previous:d0},h0={name:"protocolAutolink",tokenize:s4,previous:f0},sn={name:"emailAutolink",tokenize:n4,previous:p0},$r={};function r4(){return{text:$r}}let Fn=48;for(;Fn<123;)$r[Fn]=sn,Fn++,Fn===58?Fn=65:Fn===91&&(Fn=97);$r[43]=sn;$r[45]=sn;$r[46]=sn;$r[95]=sn;$r[72]=[sn,h0];$r[104]=[sn,h0];$r[87]=[sn,u0];$r[119]=[sn,u0];function n4(e,t,r){const n=this;let i,s;return o;function o(u){return!Ju(u)||!p0.call(n,n.previous)||Jd(n.events)?r(u):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(u))}function l(u){return Ju(u)?(e.consume(u),l):u===64?(e.consume(u),a):r(u)}function a(u){return u===46?e.check(t4,h,c)(u):u===45||u===95||Tt(u)?(s=!0,e.consume(u),a):h(u)}function c(u){return e.consume(u),i=!0,a}function h(u){return s&&i&&Dt(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(u)):r(u)}}function i4(e,t,r){const n=this;return i;function i(o){return o!==87&&o!==119||!d0.call(n,n.previous)||Jd(n.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(e4,e.attempt(l0,e.attempt(a0,s),r),r)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function s4(e,t,r){const n=this;let i="",s=!1;return o;function o(u){return(u===72||u===104)&&f0.call(n,n.previous)&&!Jd(n.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(u),e.consume(u),l):r(u)}function l(u){if(Dt(u)&&i.length<5)return i+=String.fromCodePoint(u),e.consume(u),l;if(u===58){const d=i.toLowerCase();if(d==="http"||d==="https")return e.consume(u),a}return r(u)}function a(u){return u===47?(e.consume(u),s?c:(s=!0,a)):r(u)}function c(u){return u===null||ta(u)||Me(u)||ci(u)||La(u)?r(u):e.attempt(l0,e.attempt(a0,h),r)(u)}function h(u){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(u)}}function o4(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 l4(e,t,r){let n,i,s;return o;function o(c){return c===46||c===95?e.check(c0,a,l)(c):c===null||Me(c)||ci(c)||c!==45&&La(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 a4(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(c0,t,s)(o):o===null||Me(o)||ci(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&n++,e.consume(o),i}}function c4(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||Me(l)||ci(l)?t(l):r(l)}function i(l){return l===null||l===40||l===91||Me(l)||ci(l)?t(l):n(l)}function s(l){return Dt(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),n):Dt(l)?(e.consume(l),o):r(l)}}function u4(e,t,r){return n;function n(s){return e.consume(s),i}function i(s){return Tt(s)?r(s):t(s)}}function d0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Me(e)}function f0(e){return!Dt(e)}function p0(e){return!(e===47||Ju(e))}function Ju(e){return e===43||e===45||e===46||e===95||Tt(e)}function Jd(e){let t=e.length,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 h4={tokenize:y4,partial:!0};function d4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:m4,continuation:{tokenize:_4},exit:v4}},text:{91:{name:"gfmFootnoteCall",tokenize:g4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:f4,resolveTo:p4}}}}function f4(e,t,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=Cr(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 p4(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 g4(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||Me(u))return r(u);if(u===93){e.exit("chunkString");const d=e.exit("gfmFootnoteCallString");return i.includes(Cr(n.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(u)}return Me(u)||(o=!0),s++,e.consume(u),u===92?h:c}function h(u){return u===91||u===92||u===93?(e.consume(u),s++,c):c(u)}}function m4(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,l;return a;function a(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):r(g)}function h(g){if(o>999||g===93&&!l||g===null||g===91||Me(g))return r(g);if(g===93){e.exit("chunkString");const m=e.exit("gfmFootnoteDefinitionLabelString");return s=Cr(n.sliceSerialize(m)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return Me(g)||(l=!0),o++,e.consume(g),g===92?u:h}function u(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}function d(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(s)||i.push(s),Re(e,f,"gfmFootnoteDefinitionWhitespace")):r(g)}function f(g){return t(g)}}function _4(e,t,r){return e.check(To,t,e.attempt(h4,t,r))}function v4(e){e.exit("gfmFootnoteDefinition")}function y4(e,t,r){const n=this;return Re(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 S4(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&&Jt(d,d.length,0,Pa(f,o.slice(c+1,a),l)),Jt(d,d.length,0,[["exit",u,l],["enter",o[a][1],l],["exit",o[a][1],l],["exit",h,l]]),Jt(o,c-1,a-c+3,d),a=c+d.length-2;break}}for(a=-1;++a<o.length;)o[a][1].type==="strikethroughSequenceTemporary"&&(o[a][1].type="data");return o}function s(o,l,a){const c=this.previous,h=this.events;let u=0;return d;function d(g){return c===126&&h[h.length-1][1].type!=="characterEscape"?a(g):(o.enter("strikethroughSequenceTemporary"),f(g))}function f(g){const m=Xi(c);if(g===126)return u>1?a(g):(o.consume(g),u++,f);if(u<2&&!r)return a(g);const w=o.exit("strikethroughSequenceTemporary"),_=Xi(g);return w._open=!_||_===2&&!!m,w._close=!m||m===2&&!!_,l(g)}}}class x4{constructor(){this.map=[]}add(t,r,n){w4(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 w4(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 b4(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 k4(){return{flow:{null:{name:"table",tokenize:C4,resolveAll:E4}}}}function C4(e,t,r){const n=this;let i=0,s=0,o;return l;function l(E){let I=n.events.length-1;for(;I>-1;){const W=n.events[I][1].type;if(W==="lineEnding"||W==="linePrefix")I--;else break}const M=I>-1?n.events[I][1].type:null,L=M==="tableHead"||M==="tableRow"?x:a;return L===x&&n.parser.lazy[n.now().line]?r(E):L(E)}function a(E){return e.enter("tableHead"),e.enter("tableRow"),c(E)}function c(E){return E===124||(o=!0,s+=1),h(E)}function h(E){return E===null?r(E):me(E)?s>1?(s=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),f):r(E):Ce(E)?Re(e,h,"whitespace")(E):(s+=1,o&&(o=!1,i+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),u(E)))}function u(E){return E===null||E===124||Me(E)?(e.exit("data"),h(E)):(e.consume(E),E===92?d:u)}function d(E){return E===92||E===124?(e.consume(E),u):u(E)}function f(E){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(E):(e.enter("tableDelimiterRow"),o=!1,Ce(E)?Re(e,g,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):g(E))}function g(E){return E===45||E===58?w(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),m):R(E)}function m(E){return Ce(E)?Re(e,w,"whitespace")(E):w(E)}function w(E){return E===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),_):E===45?(s+=1,_(E)):E===null||me(E)?T(E):R(E)}function _(E){return E===45?(e.enter("tableDelimiterFiller"),v(E)):R(E)}function v(E){return E===45?(e.consume(E),v):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(E))}function y(E){return Ce(E)?Re(e,T,"whitespace")(E):T(E)}function T(E){return E===124?g(E):E===null||me(E)?!o||i!==s?R(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):R(E)}function R(E){return r(E)}function x(E){return e.enter("tableRow"),j(E)}function j(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),j):E===null||me(E)?(e.exit("tableRow"),t(E)):Ce(E)?Re(e,j,"whitespace")(E):(e.enter("data"),H(E))}function H(E){return E===null||E===124||Me(E)?(e.exit("data"),j(E)):(e.consume(E),E===92?U:H)}function U(E){return E===92||E===124?(e.consume(E),H):H(E)}}function E4(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 x4;for(;++r<e.length;){const f=e[r],g=f[1];f[0]==="enter"?g.type==="tableHead"?(l=!1,a!==0&&(Cg(d,t,a,c,h),h=void 0,a=0),c={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},d.add(r,0,[["enter",c,t]])):g.type==="tableRow"||g.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({},g.start),end:Object.assign({},g.end)},d.add(r,0,[["enter",h,t]])),i=g.type==="tableDelimiterRow"?2:h?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(n=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],u=el(d,t,s,i,void 0,u),s=[0,0,0,0]),o[2]=r)):g.type==="tableCellDivider"&&(n?n=!1:(s[1]!==0&&(o[0]=o[1],u=el(d,t,s,i,void 0,u)),s=o,o=[s[1],r,0,0])):g.type==="tableHead"?(l=!0,a=r):g.type==="tableRow"||g.type==="tableDelimiterRow"?(a=r,s[1]!==0?(o[0]=o[1],u=el(d,t,s,i,r,u)):o[1]!==0&&(u=el(d,t,o,i,r,u)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=r)}for(a!==0&&Cg(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=b4(t.events,r))}return e}function el(e,t,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(s.end=Object.assign({},xi(t.events,r[0])),e.add(r[0],0,[["exit",s,t]]));const a=xi(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=xi(t.events,r[2]),h=xi(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 g=r[2]+1,m=r[3]-r[2]-1;e.add(g,m,[])}}e.add(r[3]+1,0,[["exit",u,t]])}return i!==void 0&&(s.end=Object.assign({},xi(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function Cg(e,t,r,n,i){const s=[],o=xi(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 xi(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const T4={name:"tasklistCheck",tokenize:I4};function R4(){return{text:{91:T4}}}function I4(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 Me(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),o):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),o):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 me(a)?t(a):Ce(a)?e.check({tokenize:L4},t,r)(a):r(a)}}function L4(e,t,r){return Re(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function P4(e){return by([r4(),d4(),S4(e),k4(),R4()])}const D4={};function Ic(e){const t=this,r=e||D4,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(P4(r)),s.push(Z5()),o.push(J5(r))}const M4=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,A4=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,Eg=({legacyTitle:e=!1,tagName:t="div"}={})=>r=>{Ba(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?A4:M4,g=d.match(f);if(g&&(a=!1,o=g[1].toLocaleLowerCase(),l=e&&g[2]||o.toLocaleUpperCase(),d.includes(`
96
- `)&&(h.children[0]={type:"text",value:d.replace(f,"").replace(/^\n+/,"")}),!d.includes(`
97
- `))){const m=[];h.children.forEach((w,_)=>{_!=0&&(_==1&&w.type==="break"||m.push(w))}),h.children=[...m]}}return h});o&&(n.data={hName:t,hProperties:{className:["markdown-alert",`markdown-alert-${o}`],dir:"auto"}},c.unshift({type:"paragraph",children:[B4(o),{type:"text",value:l.replace(/^\//,"")}],data:{hProperties:{className:"markdown-alert-title",dir:"auto"}}})),n.children=[...c]})};function B4(e){let t=N4[e]??"";return{type:"emphasis",data:{hName:"svg",hProperties:{className:["octicon"],viewBox:"0 0 16 16",width:"16",height:"16",ariaHidden:"true"}},children:[{type:"emphasis",data:{hName:"path",hProperties:{d:t}},children:[]}]}}const N4={note:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z",tip:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z",important:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",warning:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",caution:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"};function z4(e){Ky(e,[/\r?\n|\r/g,O4])}function O4(){return{type:"break"}}function j4(){return function(e){z4(e)}}function F4(e){const r=e.split(`
98
- `).map(l=>{if(!l.includes("\r"))return l;const a=l.split("\r").map(u=>u.trim()).filter(Boolean);if(a.length===0)return"";const c=a.filter(u=>u.startsWith("⏺"));if(c.length>0)return c[c.length-1];const h=a.filter(u=>!(/^[❯›>]\s*$/.test(u)||/^[^a-zA-Z0-9\s]\s*\S+[…\.]{1,3}\s*$/.test(u)&&u.length<40||/^[╭╰│├╮╯─═]+$/.test(u)));return h.length>0?h[h.length-1]:a[a.length-1]}).join(`
99
- `).split(`
100
- `),n={},i=[];let s=!1;for(const l of r){const a=l.trim();if(a===""){s=!1,i.push("");continue}if(/^❯\s*$/.test(a)||/^>\s*$/.test(a)||/^[✡-✩✪-✿⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◆◇◐◑◒◓]\s*\S+[…\.]{1,3}\s*$/.test(a)||/^◐\s/.test(a)||/\/effort/.test(a)||/^⎿\s+(Tip|Note|Hint):/.test(a)||/^\?\s*(for\s*shortcuts|shortcuts)/.test(a)||/esc\s+to\s+interrupt|shift\+tab\s+to\s+cycle|accept\s+edits\s+on/i.test(a)||/Brewing[…\.]{0,3}\s*\d*$/i.test(a)||/^[✢✳✶✻⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◆◇✦\s]+$/.test(a)||/^Auto-updating/i.test(a))continue;if(/^[⏺●·⏵]/.test(l)){const h=l.match(/^[⏺●·]\s*([A-Za-z][A-Za-z0-9_]*)\s*[\(\[]/);if(h)n[h[1]]=(n[h[1]]||0)+1;else{const u=l.replace(/^[⏺●·⏵]\s*/,"").trim().slice(0,40);u&&(n[u]=(n[u]||0)+1)}s=!0;continue}if(/^[\s]*[╭╰│├╮╯]/.test(l)||/^[╭╰│├╮╯─]+/.test(a)||/^\s+[⊙✓✗○◎▸►✦]/.test(l)||s&&/^\s{2,}/.test(l))continue;s=!1;const c=l.replace(/^❯\s+/,"");i.push(c)}const o=i.join(`
101
- `).replace(/\n{3,}/g,`
102
-
103
- `).trim();return{toolCounts:n,textContent:o,hasTools:Object.keys(n).length>0}}function Lc(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}const g0=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),g=b.useRef(null),m=b.useRef(0),w=b.useRef(""),_=b.useRef(!1),[v,y]=b.useState(new Set),[T,R]=b.useState(new Set),x=b.useRef(!1),j=()=>{const A=f.current;return A?A.scrollHeight-A.scrollTop-A.clientHeight<200:!0},H=t.length>0?`${t.length}:${(((W=t[t.length-1])==null?void 0:W.content)||"").length}`:"0:0";b.useEffect(()=>{var P,$;const A=!_.current,O=w.current!==o;if(w.current=o,A||O){_.current=!0,x.current=!1;const S=()=>{var Q;(Q=g.current)==null||Q.scrollIntoView({behavior:"instant"})};requestAnimationFrame(()=>requestAnimationFrame(S)),setTimeout(S,100),setTimeout(S,300),m.current=t.length;return}t.length>m.current?x.current||(P=g.current)==null||P.scrollIntoView({behavior:"instant"}):j()&&!x.current&&(($=g.current)==null||$.scrollIntoView({behavior:"instant"})),m.current=t.length},[H,o,s]),b.useImperativeHandle(d,()=>({scrollToBottom:(A="smooth")=>{var O;(O=g.current)==null||O.scrollIntoView({behavior:A})}})),b.useEffect(()=>{const A=f.current;if(!A)return;let O;const K=()=>{clearTimeout(O),O=setTimeout(()=>{x.current=!j()},50)};return A.addEventListener("scroll",K,{passive:!0}),()=>{A.removeEventListener("scroll",K),clearTimeout(O)}},[]);const U=b.useRef(!1),E=b.useRef(0),I=b.useRef(!1);b.useEffect(()=>{const A=f.current;if(!A||!I.current||E.current===0)return;const K=A.scrollHeight-E.current;K>0&&(A.scrollTop=K),E.current=0,I.current=!1},[t.length]),b.useEffect(()=>{const A=f.current;if(!A||!c)return;const O=()=>{A.scrollTop<60&&u&&!h&&!U.current&&(U.current=!0,E.current=A.scrollHeight,c(),setTimeout(()=>{U.current=!1},1500))};return A.addEventListener("scroll",O,{passive:!0}),()=>A.removeEventListener("scroll",O)},[c,u,h]);const M=(()=>{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 O=[...r].sort(($,S)=>$.timestamp-S.timestamp).map(($,S)=>({type:"action",data:$,index:S,ts:$.timestamp})),K=[];let P=0;for(const $ of A){for(;P<O.length&&$.ts>0&&O[P].ts<$.ts;)K.push(O[P++]);K.push($)}for(;P<O.length;)K.push(O[P++]);return K})(),L=700;return p.jsxs("div",{ref:f,"data-chat-scroll":!0,style:{flex:1,minHeight:0,overflowY:"auto",padding:"24px 20px",display:"flex",flexDirection:"column",gap:16,background:"var(--bg-primary)"},children:[h&&p.jsx("div",{style:{textAlign:"center",padding:"12px 0",color:"var(--text-muted)",fontSize:12,opacity:.6},children:"⏳ Loading older messages..."}),u&&!h&&p.jsx("div",{style:{textAlign:"center",padding:"8px 0"},children:p.jsx("button",{onClick:c,style:{background:"none",border:"1px solid var(--border-subtle)",color:"var(--text-muted)",fontSize:11,borderRadius:12,padding:"4px 16px",cursor:"pointer",opacity:.7},children:"↑ Load older messages"})}),M.length===0&&!u&&(a||p.jsx("div",{style:{textAlign:"center",marginTop:60,opacity:.2,fontSize:13},children:"Waiting for messages..."})),M.map(A=>{if(A.type==="action"){const _e=A.data;return p.jsxs("div",{style:{alignSelf:"center",maxWidth:"80%",background:"rgba(99, 102, 241, 0.08)",color:"var(--accent-primary)",padding:"6px 14px",borderRadius:20,fontSize:12,textAlign:"center",border:"1px solid rgba(99, 102, 241, 0.15)",opacity:.85},children:[p.jsx(kc,{remarkPlugins:[Ic],children:_e.text}),p.jsx("span",{style:{fontSize:10,opacity:.5,marginLeft:8},children:Lc(_e.timestamp)})]},`action-${A.index}`)}const O=A.data,K=A.index,P=(O.role||"").toLowerCase(),$=P==="user"||P==="human",S=O.kind||"standard",Q=O.receivedAt||l[O.id??`i-${K}`],le=`${o}-${K}`,C=v.has(le),ge=T.has(le);if(S==="thought")return p.jsx("div",{style:{alignSelf:"flex-start",maxWidth:"88%",borderLeft:"2px solid rgba(99,102,241,0.35)",paddingLeft:12,color:"var(--text-muted)",fontSize:12,fontStyle:"italic",lineHeight:1.6,opacity:.75},children:p.jsx("div",{className:"chat-markdown",children:p.jsx(kc,{remarkPlugins:[Ic,Eg],children:O.content||""})})},`msg-${K}`);if(S==="tool")return p.jsxs("div",{style:{alignSelf:"flex-start",display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-muted)",padding:"3px 10px 3px 8px",background:"rgba(16,185,129,0.05)",border:"1px solid rgba(16,185,129,0.12)",borderRadius:6,fontFamily:"ui-monospace, monospace"},children:[p.jsx("span",{style:{color:"#10b981",fontSize:10},children:"⏺"}),p.jsx("span",{style:{color:"#10b981",opacity:.8},children:(O.content||"").split(`
104
- `)[0].slice(0,80)})]},`msg-${K}`);if(S==="system")return p.jsx("div",{style:{alignSelf:"center",fontSize:11,color:"var(--text-muted)",opacity:.6,padding:"2px 12px",borderRadius:20,border:"1px solid var(--border-subtle)"},children:(O.content||"").slice(0,100)},`msg-${K}`);const ie=!$&&i?F4(O.content||""):null,N=ie?ie.textContent:O.content||"",Y=ie?Object.entries(ie.toolCounts):[],te=i&&!$&&!C&&N.length>L,ue=C?O.content||"":te&&!ge?N.slice(0,L):N;return p.jsxs("div",{style:{alignSelf:$?"flex-end":"flex-start",maxWidth:"88%",display:"flex",flexDirection:"column",gap:4},children:[Y.length>0&&p.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center",marginBottom:2},children:[Y.map(([_e,z])=>p.jsxs("span",{style:{fontSize:10,fontFamily:"ui-monospace, monospace",color:"#10b981",background:"rgba(16,185,129,0.07)",border:"1px solid rgba(16,185,129,0.18)",borderRadius:4,padding:"2px 7px"},children:["⏺ ",_e,z>1?` ×${z}`:""]},_e)),(ie==null?void 0:ie.hasTools)&&p.jsx("button",{onClick:()=>y(_e=>{const z=new Set(_e);return C?z.delete(le):z.add(le),z}),style:{fontSize:10,color:"var(--text-muted)",background:"none",border:"none",cursor:"pointer",padding:"1px 4px",opacity:.5},children:C?"Collapse":"Original"}),!N&&Q!=null&&p.jsx("span",{style:{fontSize:10,opacity:.35,marginLeft:2},children:Lc(Q)})]}),(N||$)&&p.jsxs("div",{style:{background:$?"var(--accent-primary)":"var(--bg-secondary)",color:$?"#fff":"var(--text-primary)",padding:"10px 14px",borderRadius:$?"14px 14px 4px 14px":"14px 14px 14px 4px",fontSize:13,lineHeight:1.6,border:$?"none":"1px solid var(--border-subtle)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8,marginBottom:N?5:0},children:[p.jsx("span",{style:{fontSize:10,fontWeight:700,opacity:.6,letterSpacing:"0.05em",textTransform:"uppercase"},children:$?"You":n}),Q!=null&&p.jsx("span",{style:{fontSize:10,opacity:.45},children:Lc(Q)})]}),N&&p.jsx("div",{className:"chat-markdown",children:p.jsx(kc,{remarkPlugins:[Ic,Eg,j4],children:ue})}),te&&p.jsx("button",{onClick:()=>R(_e=>{const z=new Set(_e);return ge?z.delete(le):z.add(le),z}),style:{marginTop:6,fontSize:11,fontWeight:600,color:"var(--accent-primary)",background:"none",border:"none",cursor:"pointer",padding:0,opacity:.8},children:ge?"Collapse ↑":`Show more (${Math.round(N.length/100)*100} chars) ↓`})]})]},`msg-${K}`)}),s&&p.jsx("div",{style:{alignSelf:"flex-start",maxWidth:"90%",background:"var(--bg-secondary)",borderRadius:"16px 16px 16px 4px",border:"1px solid var(--border-subtle)"},children:p.jsxs("div",{className:"typing-indicator",children:[p.jsx("div",{className:"dot"}),p.jsx("div",{className:"dot"}),p.jsx("div",{className:"dot"}),p.jsx("span",{style:{fontSize:11,color:"var(--text-muted)",marginLeft:4},children:"Agent working..."})]})}),p.jsx("div",{style:{minHeight:40},ref:g})]})}),_s={idle:{bg:"rgba(100,116,139,0.15)",text:"#94a3b8",dot:"#64748b",label:"Idle"},streaming:{bg:"rgba(59,130,246,0.15)",text:"#60a5fa",dot:"#3b82f6",label:"Streaming"},waiting_approval:{bg:"rgba(245,158,11,0.15)",text:"#fbbf24",dot:"#f59e0b",label:"Waiting Approval"},error:{bg:"rgba(239,68,68,0.15)",text:"#f87171",dot:"#ef4444",label:"Error"},disconnected:{bg:"rgba(75,85,99,0.15)",text:"#6b7280",dot:"#4b5563",label:"Disconnected"}},Pc={cline:"#22d3ee","roo-code":"#a78bfa",continue:"#34d399",copilot:"#60a5fa"};function $4({agentStreams:e,sendCommand:t}){var d,f,g;const[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(m=>m.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(m){console.error("Failed to send agent message",m)}finally{l(!1)}}},[i,r,o,t]),h=b.useCallback(async m=>{if(r)try{await t("agent_stream_resolve",{agentType:r,action:m})}catch(w){console.error("Failed to resolve agent action",w)}},[r,t]),u=b.useCallback(async()=>{if(r)try{await t("agent_stream_new_session",{agentType:r})}catch(m){console.error("Failed to start new session",m)}},[r,t]);return e.length===0?null:p.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"#0c0e14",borderRadius:12,overflow:"hidden",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2,padding:"8px 12px 0",borderBottom:"1px solid rgba(255,255,255,0.06)",background:"rgba(255,255,255,0.02)",overflowX:"auto"},children:[e.map(m=>{const w=m.agentType===r,_=Pc[m.agentType]||"#94a3b8",v=_s[m.status]||_s.idle;return p.jsxs("button",{onClick:()=>n(m.agentType),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",border:"none",borderBottom:w?`2px solid ${_}`:"2px solid transparent",background:w?"rgba(255,255,255,0.05)":"transparent",color:w?"#f1f5f9":"#64748b",cursor:"pointer",fontSize:13,fontWeight:w?600:400,borderRadius:"8px 8px 0 0",transition:"all 0.15s ease",whiteSpace:"nowrap"},children:[p.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:v.dot,boxShadow:m.status==="streaming"?`0 0 6px ${v.dot}`:"none",animation:m.status==="streaming"?"pulse 1.5s infinite":"none"}}),m.agentName,m.status==="waiting_approval"&&p.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:4,background:"rgba(245,158,11,0.2)",color:"#fbbf24",fontWeight:600},children:"APPROVE"})]},m.agentType)}),p.jsx("div",{style:{flex:1}}),p.jsx("button",{onClick:u,title:"New Chat Session",style:{padding:"4px 8px",marginBottom:4,border:"none",background:"rgba(255,255,255,0.06)",color:"#94a3b8",borderRadius:6,cursor:"pointer",fontSize:13},children:"+ New"})]}),a?p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 14px",fontSize:11,color:"#64748b",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[p.jsx("span",{style:{padding:"2px 8px",borderRadius:4,background:(d=_s[a.status])==null?void 0:d.bg,color:(f=_s[a.status])==null?void 0:f.text,fontWeight:600,fontSize:10,letterSpacing:.5,textTransform:"uppercase"},children:((g=_s[a.status])==null?void 0:g.label)||a.status}),a.model&&p.jsxs("span",{style:{color:"#475569"},children:["Model: ",p.jsx("span",{style:{color:"#94a3b8"},children:a.model})]}),p.jsx("span",{style:{color:"#334155"},children:"|"}),p.jsxs("span",{children:[a.messages.length," messages"]})]}),a.activeModal&&p.jsxs("div",{style:{padding:"10px 14px",background:"linear-gradient(135deg, rgba(245,158,11,0.1), rgba(234,88,12,0.08))",borderBottom:"1px solid rgba(245,158,11,0.2)",display:"flex",alignItems:"center",gap:10},children:[p.jsx("span",{style:{fontSize:16},children:"⚠️"}),p.jsx("span",{style:{flex:1,fontSize:13,color:"#fbbf24",lineHeight:"1.4"},children:a.activeModal.message||"Action requires approval"}),p.jsx("button",{onClick:()=>h("approve"),style:{padding:"5px 14px",border:"none",borderRadius:6,background:"#22c55e",color:"#fff",fontSize:12,fontWeight:600,cursor:"pointer"},children:"Approve"}),p.jsx("button",{onClick:()=>h("reject"),style:{padding:"5px 14px",border:"none",borderRadius:6,background:"rgba(239,68,68,0.2)",color:"#f87171",fontSize:12,fontWeight:600,cursor:"pointer"},children:"Reject"})]}),p.jsx(g0,{messages:a.messages.map((m,w)=>({role:m.role,content:m.content,kind:m.kind,id:`${a.agentType}-${w}`,receivedAt:m.timestamp})),agentName:a.agentName,isWorking:a.status==="streaming",contextKey:`agent-${a.agentType}`,emptyState:p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--text-muted)",fontSize:13},children:["No messages yet. Start a conversation with ",a.agentName,"."]})}),p.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid rgba(255,255,255,0.06)",display:"flex",gap:8},children:[p.jsx("input",{type:"text",value:i,onChange:m=>s(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),c())},placeholder:`Message ${a.agentName}...`,disabled:o,style:{flex:1,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,padding:"8px 14px",color:"#e2e8f0",fontSize:13,outline:"none"}}),p.jsx("button",{onClick:c,disabled:o||!i.trim(),style:{padding:"8px 18px",border:"none",borderRadius:8,background:i.trim()?`linear-gradient(135deg, ${Pc[a.agentType]||"#3b82f6"}, ${Pc[a.agentType]||"#3b82f6"}cc)`:"rgba(255,255,255,0.04)",color:i.trim()?"#fff":"#475569",fontSize:13,fontWeight:600,cursor:i.trim()?"pointer":"default",transition:"all 0.15s"},children:o?"…":"Send"})]})]}):p.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#334155",fontSize:13},children:"Select an agent tab to view its chat stream."}),p.jsx("style",{children:`
105
- @keyframes pulse {
106
- 0%, 100% { opacity: 1; }
107
- 50% { opacity: 0.4; }
108
- }
109
- `})]})}/**
110
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
111
- * @license MIT
112
- *
113
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
114
- * @license MIT
115
- *
116
- * Originally forked from (with the author's permission):
117
- * Fabrice Bellard's javascript vt100 for jslinux:
118
- * http://bellard.org/jslinux/
119
- * Copyright (c) 2011 Fabrice Bellard
120
- */var m0=Object.defineProperty,W4=Object.getOwnPropertyDescriptor,H4=(e,t)=>{for(var r in t)m0(e,r,{get:t[r],enumerable:!0})},Ge=(e,t,r,n)=>{for(var i=n>1?void 0:n?W4(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&&m0(t,r,i),i},he=(e,t)=>(r,n)=>t(r,n,e),Tg="Terminal input",eh={get:()=>Tg,set:e=>Tg=e},Rg="Too much output to announce, navigate to rows manually to read",th={get:()=>Rg,set:e=>Rg=e};function U4(e){return e.replace(/\r?\n/g,"\r")}function K4(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function V4(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function q4(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");_0(i,t,r,n)}}function _0(e,t,r,n){e=U4(e),e=K4(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function v0(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 Ig(e,t,r,n,i){v0(e,t,r),i&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function mn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Na(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 Y4=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}},X4=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 g=0,m;for(;(m=this.interim[++g]&63)&&g<4;)f<<=6,f|=m;let w=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,_=w-g;for(;c<_;){if(c>=r)return 0;if(m=e[c++],(m&192)!==128){c--,d=!0;break}else this.interim[g++]=m,f<<=6,f|=m&63}d||(w===2?f<128?c--:t[n++]=f:w===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}},y0="",wn=" ",Io=class S0{constructor(){this.fg=0,this.bg=0,this.extended=new sa}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new S0;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},sa=class x0{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 x0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},fr=class w0 extends Io{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new sa,this.combinedData=""}static fromCharData(t){let r=new w0;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?mn(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Lg="di$target",rh="di$dependencies",Dc=new Map;function G4(e){return e[rh]||[]}function mt(e){if(Dc.has(e))return Dc.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");Q4(t,r,i)};return t._id=e,Dc.set(e,t),t}function Q4(e,t,r){t[Lg]===t?t[rh].push({id:e,index:r}):(t[rh]=[{id:e,index:r}],t[Lg]=t)}var Nt=mt("BufferService"),b0=mt("CoreMouseService"),gi=mt("CoreService"),Z4=mt("CharsetService"),ef=mt("InstantiationService"),k0=mt("LogService"),zt=mt("OptionsService"),C0=mt("OscLinkService"),J4=mt("UnicodeService"),Lo=mt("DecorationService"),nh=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 fr,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}},g=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let m=new URL(d);["http:","https:"].includes(m.protocol)||(g=!0)}catch{g=!0}g||n.push({text:d,range:f,activate:(m,w)=>i?i.activate(m,w,f):eT(m,w),hover:(m,w)=>{var _;return(_=i==null?void 0:i.hover)==null?void 0:_.call(i,m,w,f)},leave:(m,w)=>{var _;return(_=i==null?void 0:i.leave)==null?void 0:_.call(i,m,w,f)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(a=u,l=s.extended.urlId):(a=-1,l=-1)}}t(n)}};nh=Ge([he(0,Nt),he(1,zt),he(2,C0)],nh);function eT(e,t){if(confirm(`Do you want to navigate to ${t}?
121
-
122
- WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var za=mt("CharSizeService"),on=mt("CoreBrowserService"),tf=mt("MouseService"),ln=mt("RenderService"),tT=mt("SelectionService"),E0=mt("CharacterJoinerService"),is=mt("ThemeService"),T0=mt("LinkProviderService"),rT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Pg.isErrorNoTelemetry(e)?new Pg(e.message+`
123
-
124
- `+e.stack):new Error(e.message+`
125
-
126
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},nT=new rT;function wl(e){iT(e)||nT.onUnexpectedError(e)}var ih="Canceled";function iT(e){return e instanceof sT?!0:e instanceof Error&&e.name===ih&&e.message===ih}var sT=class extends Error{constructor(){super(ih),this.name=this.message}};function oT(e){return new Error(`Illegal argument: ${e}`)}var Pg=class sh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof sh)return t;let r=new sh;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},oh=class R0 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,R0.prototype)}};function Vt(e,t=0){return e[e.length-(1+t)]}var lT;(e=>{function t(s){return s<0}e.isLessThan=t;function 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})(lT||(lT={}));function aT(e,t){let r=this,n=!1,i;return function(){return n||(n=!0,t||(i=e.apply(r,arguments))),i}}var I0;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*i(T){yield T}e.single=i;function s(T){return t(T)?T:i(T)}e.wrap=s;function o(T){return T||r}e.from=o;function*l(T){for(let R=T.length-1;R>=0;R--)yield T[R]}e.reverse=l;function a(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=a;function c(T){return T[Symbol.iterator]().next().value}e.first=c;function h(T,R){let x=0;for(let j of T)if(R(j,x++))return!0;return!1}e.some=h;function u(T,R){for(let x of T)if(R(x))return x}e.find=u;function*d(T,R){for(let x of T)R(x)&&(yield x)}e.filter=d;function*f(T,R){let x=0;for(let j of T)yield R(j,x++)}e.map=f;function*g(T,R){let x=0;for(let j of T)yield*R(j,x++)}e.flatMap=g;function*m(...T){for(let R of T)yield*R}e.concat=m;function w(T,R,x){let j=x;for(let H of T)j=R(j,H);return j}e.reduce=w;function*_(T,R,x=T.length){for(R<0&&(R+=T.length),x<0?x+=T.length:x>T.length&&(x=T.length);R<x;R++)yield T[R]}e.slice=_;function v(T,R=Number.POSITIVE_INFINITY){let x=[];if(R===0)return[x,T];let j=T[Symbol.iterator]();for(let H=0;H<R;H++){let U=j.next();if(U.done)return[x,e.empty()];x.push(U.value)}return[x,{[Symbol.iterator](){return j}}]}e.consume=v;async function y(T){let R=[];for await(let x of T)R.push(x);return Promise.resolve(R)}e.asyncToArray=y})(I0||(I0={}));function ui(e){if(I0.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 cT(...e){return We(()=>ui(e))}function We(e){return{dispose:aT(()=>{e()})}}var L0=class P0{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ui(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?P0.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};L0.DISABLE_DISPOSED_WARNING=!1;var Pn=L0,ke=class{constructor(){this._store=new Pn,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ke.None=Object.freeze({dispose(){}});var Gi=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Qr=typeof window=="object"?window:globalThis,lh=class ah{constructor(t){this.element=t,this.next=ah.Undefined,this.prev=ah.Undefined}};lh.Undefined=new lh(void 0);var He=lh,Dg=class{constructor(){this._first=He.Undefined,this._last=He.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===He.Undefined}clear(){let e=this._first;for(;e!==He.Undefined;){let t=e.next;e.prev=He.Undefined,e.next=He.Undefined,e=t}this._first=He.Undefined,this._last=He.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new He(e);if(this._first===He.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!==He.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==He.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==He.Undefined&&e.next!==He.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===He.Undefined&&e.next===He.Undefined?(this._first=He.Undefined,this._last=He.Undefined):e.next===He.Undefined?(this._last=this._last.prev,this._last.next=He.Undefined):e.prev===He.Undefined&&(this._first=this._first.next,this._first.prev=He.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==He.Undefined;)yield e.element,e=e.next}},uT=globalThis.performance&&typeof globalThis.performance.now=="function",hT=class D0{static create(t){return new D0(t)}constructor(t){this._now=uT&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},yt;(e=>{e.None=()=>ke.None;function t(M,L){return u(M,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function r(M){return(L,W=null,A)=>{let O=!1,K;return K=M(P=>{if(!O)return K?K.dispose():O=!0,L.call(W,P)},null,A),O&&K.dispose(),K}}e.once=r;function n(M,L,W){return c((A,O=null,K)=>M(P=>A.call(O,L(P)),null,K),W)}e.map=n;function i(M,L,W){return c((A,O=null,K)=>M(P=>{L(P),A.call(O,P)},null,K),W)}e.forEach=i;function s(M,L,W){return c((A,O=null,K)=>M(P=>L(P)&&A.call(O,P),null,K),W)}e.filter=s;function o(M){return M}e.signal=o;function l(...M){return(L,W=null,A)=>{let O=cT(...M.map(K=>K(P=>L.call(W,P))));return h(O,A)}}e.any=l;function a(M,L,W,A){let O=W;return n(M,K=>(O=L(O,K),O),A)}e.reduce=a;function c(M,L){let W,A={onWillAddFirstListener(){W=M(O.fire,O)},onDidRemoveLastListener(){W==null||W.dispose()}},O=new se(A);return L==null||L.add(O),O.event}function h(M,L){return L instanceof Array?L.push(M):L&&L.add(M),M}function u(M,L,W=100,A=!1,O=!1,K,P){let $,S,Q,le=0,C,ge={leakWarningThreshold:K,onWillAddFirstListener(){$=M(N=>{le++,S=L(S,N),A&&!Q&&(ie.fire(S),S=void 0),C=()=>{let Y=S;S=void 0,Q=void 0,(!A||le>1)&&ie.fire(Y),le=0},typeof W=="number"?(clearTimeout(Q),Q=setTimeout(C,W)):Q===void 0&&(Q=0,queueMicrotask(C))})},onWillRemoveListener(){O&&le>0&&(C==null||C())},onDidRemoveLastListener(){C=void 0,$.dispose()}},ie=new se(ge);return P==null||P.add(ie),ie.event}e.debounce=u;function d(M,L=0,W){return e.debounce(M,(A,O)=>A?(A.push(O),A):[O],L,void 0,!0,void 0,W)}e.accumulate=d;function f(M,L=(A,O)=>A===O,W){let A=!0,O;return s(M,K=>{let P=A||!L(K,O);return A=!1,O=K,P},W)}e.latch=f;function g(M,L,W){return[e.filter(M,L,W),e.filter(M,A=>!L(A),W)]}e.split=g;function m(M,L=!1,W=[],A){let O=W.slice(),K=M(S=>{O?O.push(S):$.fire(S)});A&&A.add(K);let P=()=>{O==null||O.forEach(S=>$.fire(S)),O=null},$=new se({onWillAddFirstListener(){K||(K=M(S=>$.fire(S)),A&&A.add(K))},onDidAddFirstListener(){O&&(L?setTimeout(P):P())},onDidRemoveLastListener(){K&&K.dispose(),K=null}});return A&&A.add($),$.event}e.buffer=m;function w(M,L){return(W,A,O)=>{let K=L(new v);return M(function(P){let $=K.evaluate(P);$!==_&&W.call(A,$)},void 0,O)}}e.chain=w;let _=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(W=>(L(W),W)),this}filter(L){return this.steps.push(W=>L(W)?W:_),this}reduce(L,W){let A=W;return this.steps.push(O=>(A=L(A,O),A)),this}latch(L=(W,A)=>W===A){let W=!0,A;return this.steps.push(O=>{let K=W||!L(O,A);return W=!1,A=O,K?O:_}),this}evaluate(L){for(let W of this.steps)if(L=W(L),L===_)break;return L}}function y(M,L,W=A=>A){let A=(...$)=>P.fire(W(...$)),O=()=>M.on(L,A),K=()=>M.removeListener(L,A),P=new se({onWillAddFirstListener:O,onDidRemoveLastListener:K});return P.event}e.fromNodeEventEmitter=y;function T(M,L,W=A=>A){let A=(...$)=>P.fire(W(...$)),O=()=>M.addEventListener(L,A),K=()=>M.removeEventListener(L,A),P=new se({onWillAddFirstListener:O,onDidRemoveLastListener:K});return P.event}e.fromDOMEventEmitter=T;function R(M){return new Promise(L=>r(M)(L))}e.toPromise=R;function x(M){let L=new se;return M.then(W=>{L.fire(W)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=x;function j(M,L){return M(W=>L.fire(W))}e.forward=j;function H(M,L,W){return L(W),M(A=>L(A))}e.runAndSubscribe=H;class U{constructor(L,W){this._observable=L,this._counter=0,this._hasChanged=!1;let A={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new se(A),W&&W.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,W){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(M,L){return new U(M,L).emitter.event}e.fromObservable=E;function I(M){return(L,W,A)=>{let O=0,K=!1,P={beginUpdate(){O++},endUpdate(){O--,O===0&&(M.reportChanges(),K&&(K=!1,L.call(W)))},handlePossibleChange(){},handleChange(){K=!0}};M.addObserver(P),M.reportChanges();let $={dispose(){M.removeObserver(P)}};return A instanceof Pn?A.add($):Array.isArray(A)&&A.push($),$}}e.fromObservableLight=I})(yt||(yt={}));var ch=class uh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${uh._idPool++}`,uh.all.add(this)}start(t){this._stopWatch=new hT,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};ch.all=new Set,ch._idPool=0;var dT=ch,fT=-1,M0=class A0{constructor(t,r,n=(A0._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 mT(l,s);this._errorHandler(a)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,i]of this._stacks)(!t||r<i)&&(t=[n,i],r=i);return t}};M0._idPool=1;var pT=M0,gT=class B0{constructor(t){this.value=t}static create(){let t=new Error;return new B0(t.stack??"")}print(){console.warn(this.value.split(`
127
- `).slice(2).join(`
128
- `))}},mT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},_T=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},vT=0,Mc=class{constructor(e){this.value=e,this.id=vT++}},yT=2,ST,se=class{constructor(t){var r,n,i,s;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new pT((t==null?void 0:t.onListenerError)??wl,((n=this._options)==null?void 0:n.leakWarningThreshold)??fT):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new dT(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,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],g=new _T(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((l=this._options)==null?void 0:l.onListenerError)||wl)(g),ke.None}if(this._disposed)return ke.None;r&&(t=t.bind(r));let i=new Mc(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=gT.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Mc?(this._deliveryQueue??(this._deliveryQueue=new xT),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 Pn?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*yT<=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)||wl;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 Mc)this._deliver(this._listeners,t);else{let o=this._deliveryQueue;o.enqueue(this,t,this._listeners.length),this._deliverQueue(o)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},xT=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}},hh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new se,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new se,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,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}};hh.INSTANCE=new hh;var rf=hh;function wT(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}rf.INSTANCE.onDidChangeZoomLevel;function bT(e){return rf.INSTANCE.getZoomFactor(e)}rf.INSTANCE.onDidChangeFullscreen;var ss=typeof navigator=="object"?navigator.userAgent:"",dh=ss.indexOf("Firefox")>=0,kT=ss.indexOf("AppleWebKit")>=0,nf=ss.indexOf("Chrome")>=0,CT=!nf&&ss.indexOf("Safari")>=0;ss.indexOf("Electron/")>=0;ss.indexOf("Android")>=0;var Ac=!1;if(typeof Qr.matchMedia=="function"){let e=Qr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Qr.matchMedia("(display-mode: fullscreen)");Ac=e.matches,wT(Qr,e,({matches:r})=>{Ac&&t.matches||(Ac=r)})}var Ai="en",fh=!1,ph=!1,bl=!1,N0=!1,tl,kl=Ai,Mg=Ai,ET,vr,ni=globalThis,vt,Lm;typeof ni.vscode<"u"&&typeof ni.vscode.process<"u"?vt=ni.vscode.process:typeof process<"u"&&typeof((Lm=process==null?void 0:process.versions)==null?void 0:Lm.node)=="string"&&(vt=process);var Pm,TT=typeof((Pm=vt==null?void 0:vt.versions)==null?void 0:Pm.electron)=="string",RT=TT&&(vt==null?void 0:vt.type)==="renderer",Dm;if(typeof vt=="object"){fh=vt.platform==="win32",ph=vt.platform==="darwin",bl=vt.platform==="linux",bl&&vt.env.SNAP&&vt.env.SNAP_REVISION,vt.env.CI||vt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,tl=Ai,kl=Ai;let e=vt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);tl=t.userLocale,Mg=t.osLocale,kl=t.resolvedLanguage||Ai,ET=(Dm=t.languagePack)==null?void 0:Dm.translationsConfigFile}catch{}N0=!0}else typeof navigator=="object"&&!RT?(vr=navigator.userAgent,fh=vr.indexOf("Windows")>=0,ph=vr.indexOf("Macintosh")>=0,(vr.indexOf("Macintosh")>=0||vr.indexOf("iPad")>=0||vr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,bl=vr.indexOf("Linux")>=0,(vr==null?void 0:vr.indexOf("Mobi"))>=0,kl=globalThis._VSCODE_NLS_LANGUAGE||Ai,tl=navigator.language.toLowerCase(),Mg=tl):console.error("Unable to resolve platform.");var z0=fh,jr=ph,IT=bl,Ag=N0,Fr=vr,hn=kl,LT;(e=>{function t(){return hn}e.value=t;function r(){return hn.length===2?hn==="en":hn.length>=3?hn[0]==="e"&&hn[1]==="n"&&hn[2]==="-":!1}e.isDefaultVariant=r;function n(){return hn==="en"}e.isDefault=n})(LT||(LT={}));var PT=typeof ni.postMessage=="function"&&!ni.importScripts;(()=>{if(PT){let e=[];ni.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}),ni.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var DT=!!(Fr&&Fr.indexOf("Chrome")>=0);Fr&&Fr.indexOf("Firefox")>=0;!DT&&Fr&&Fr.indexOf("Safari")>=0;Fr&&Fr.indexOf("Edg/")>=0;Fr&&Fr.indexOf("Android")>=0;var yi=typeof navigator=="object"?navigator:{};Ag||document.queryCommandSupported&&document.queryCommandSupported("copy")||yi&&yi.clipboard&&yi.clipboard.writeText,Ag||yi&&yi.clipboard&&yi.clipboard.readText;var sf=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Bc=new sf,Bg=new sf,Ng=new sf,MT=new Array(230),O0;(e=>{function t(l){return Bc.keyCodeToStr(l)}e.toString=t;function r(l){return Bc.strToKeyCode(l)}e.fromString=r;function n(l){return Bg.keyCodeToStr(l)}e.toUserSettingsUS=n;function i(l){return Ng.keyCodeToStr(l)}e.toUserSettingsGeneral=i;function s(l){return Bg.strToKeyCode(l)||Ng.strToKeyCode(l)}e.fromUserSettings=s;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Bc.keyCodeToStr(l)}e.toElectronAccelerator=o})(O0||(O0={}));var AT=class j0{constructor(t,r,n,i,s){this.ctrlKey=t,this.shiftKey=r,this.altKey=n,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof j0&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",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 BT([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},BT=class{constructor(e){if(e.length===0)throw oT("chords");this.chords=e}getHashCode(){let e="";for(let t=0,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 NT(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return O0.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(dh)switch(t){case 59:return 85;case 60:if(IT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(jr)return 57;break}else if(kT&&(jr&&t===93||!jr&&t===92))return 57;return MT[t]||0}var zT=jr?256:2048,OT=512,jT=1024,FT=jr?2048:256,zg=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=NT(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=zT),this.altKey&&(t|=OT),this.shiftKey&&(t|=jT),this.metaKey&&(t|=FT),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new AT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Og=new WeakMap;function $T(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var WT=class{static getSameOriginWindowChain(e){let t=Og.get(e);if(!t){t=[],Og.set(e,t);let r=e,n;do n=$T(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}}},rl=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=WT.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},jg=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(nf){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?dh&&!jr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")CT&&z0?this.deltaX=-(s.wheelDeltaX/120):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?dh&&!jr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},F0=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),HT;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof UT?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:yt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:F0})})(HT||(HT={}));var UT=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?F0:(this._emitter||(this._emitter=new se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},of=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new oh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new oh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},KT=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new oh("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}},VT;(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})(VT||(VT={}));var Fg=class or{static fromArray(t){return new or(r=>{r.emitMany(t)})}static fromPromise(t){return new or(async r=>{r.emitMany(await t)})}static fromPromises(t){return new or(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new or(async r=>{await Promise.all(t.map(async n=>{for await(let i of n)r.emitOne(i)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new se,queueMicrotask(async()=>{let n={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(n)),this.resolve()}catch(i){this.reject(i)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await yt.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 or(async n=>{for await(let i of t)n.emitOne(r(i))})}map(t){return or.map(this,t)}static filter(t,r){return new or(async n=>{for await(let i of t)r(i)&&n.emitOne(i)})}filter(t){return or.filter(this,t)}static coalesce(t){return or.filter(t,r=>!!r)}coalesce(){return or.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return or.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Fg.EMPTY=Fg.fromArray([]);var{getWindow:Nr,getWindowId:qT,onDidRegisterWindow:YT}=function(){let e=new Map,t={window:Qr,disposables:new Pn};e.set(Qr.vscodeWindowId,t);let r=new se,n=new se,i=new se;function s(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:n.event,registerWindow(o){if(e.has(o.vscodeWindowId))return ke.None;let l=new Pn,a={window:o,disposables:l.add(new Pn)};return e.set(o.vscodeWindowId,a),l.add(We(()=>{e.delete(o.vscodeWindowId),n.fire(o)})),l.add(Se(o,ut.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:Qr},getDocument(o){return Nr(o).document}}}(),XT=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 XT(e,t,r,n)}var $g=function(e,t,r,n){return Se(e,t,r,n)},lf,GT=class extends KT{constructor(e){super(),this.defaultTarget=e&&Nr(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},Wg=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){wl(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(Wg.sort),o.shift().execute();n.set(s,!1)};lf=(s,o,l=0)=>{let a=qT(s),c=new Wg(o,l),h=e.get(a);return h||(h=[],e.set(a,h)),h.push(c),r.get(a)||(r.set(a,!0),s.requestAnimationFrame(()=>i(a))),c}})();function QT(e){let t=e.getBoundingClientRect(),r=Nr(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var ut={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},ZT=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Ot(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ot(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ot(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ot(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ot(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ot(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ot(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ot(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ot(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ot(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ot(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Ot(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Ot(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ot(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ot(e){return typeof e=="number"?`${e}px`:e}function Vs(e){return new ZT(e)}var $0=class{constructor(){this._hooks=new Pn,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=Nr(e)}this._hooks.add(Se(s,ut.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Se(s,ut.POINTER_UP,o=>this.stopMonitoring(!0)))}};function JT(e,t,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 Pr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Pr||(Pr={}));var Is=class Ct extends ke{constructor(){super(),this.dispatched=!1,this.targets=new Dg,this.ignoreTargets=new Dg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(yt.runAndSubscribe(YT,({window:t,disposables: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:Qr,disposables:this._store}))}static addTarget(t){if(!Ct.isTouchDevice())return ke.None;Ct.INSTANCE||(Ct.INSTANCE=new Ct);let r=Ct.INSTANCE.targets.push(t);return We(r)}static ignoreTarget(t){if(!Ct.isTouchDevice())return ke.None;Ct.INSTANCE||(Ct.INSTANCE=new Ct);let r=Ct.INSTANCE.ignoreTargets.push(t);return We(r)}static isTouchDevice(){return"ontouchstart"in Qr||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(Pr.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<Ct.HOLD_DELAY&&Math.abs(a.initialPageX-Vt(a.rollingPageX))<30&&Math.abs(a.initialPageY-Vt(a.rollingPageY))<30){let h=this.newGestureEvent(Pr.Tap,a.initialTarget);h.pageX=Vt(a.rollingPageX),h.pageY=Vt(a.rollingPageY),this.dispatchEvent(h)}else if(c>=Ct.HOLD_DELAY&&Math.abs(a.initialPageX-Vt(a.rollingPageX))<30&&Math.abs(a.initialPageY-Vt(a.rollingPageY))<30){let h=this.newGestureEvent(Pr.Contextmenu,a.initialTarget);h.pageX=Vt(a.rollingPageX),h.pageY=Vt(a.rollingPageY),this.dispatchEvent(h)}else if(i===1){let h=Vt(a.rollingPageX),u=Vt(a.rollingPageY),d=Vt(a.rollingTimestamps)-a.rollingTimestamps[0],f=h-a.rollingPageX[0],g=u-a.rollingPageY[0],m=[...this.targets].filter(w=>a.initialTarget instanceof Node&&w.contains(a.initialTarget));this.inertia(t,m,n,Math.abs(f)/d,f>0?1:-1,h,Math.abs(g)/d,g>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(Pr.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===Pr.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>Ct.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===Pr.Change||t.type===Pr.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=lf(t,()=>{let h=Date.now(),u=h-n,d=0,f=0,g=!0;i+=Ct.SCROLL_FRICTION*u,l+=Ct.SCROLL_FRICTION*u,i>0&&(g=!1,d=s*i*u),l>0&&(g=!1,f=a*l*u);let m=this.newGestureEvent(Pr.Change);m.translationX=d,m.translationY=f,r.forEach(w=>w.dispatchEvent(m)),g||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(Pr.Change,o.initialTarget);l.translationX=s.pageX-Vt(o.rollingPageX),l.translationY=s.pageY-Vt(o.rollingPageY),l.pageX=s.pageX,l.pageY=s.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Is.SCROLL_FRICTION=-.005,Is.HOLD_DELAY=700,Is.CLEAR_TAP_COUNT_TIME=400,Ge([JT],Is,"isTouchDevice",1);var eR=Is,af=class extends ke{onclick(e,t){this._register(Se(e,ut.CLICK,r=>t(new rl(Nr(e),r))))}onmousedown(e,t){this._register(Se(e,ut.MOUSE_DOWN,r=>t(new rl(Nr(e),r))))}onmouseover(e,t){this._register(Se(e,ut.MOUSE_OVER,r=>t(new rl(Nr(e),r))))}onmouseleave(e,t){this._register(Se(e,ut.MOUSE_LEAVE,r=>t(new rl(Nr(e),r))))}onkeydown(e,t){this._register(Se(e,ut.KEY_DOWN,r=>t(new zg(r))))}onkeyup(e,t){this._register(Se(e,ut.KEY_UP,r=>t(new zg(r))))}oninput(e,t){this._register(Se(e,ut.INPUT,t))}onblur(e,t){this._register(Se(e,ut.BLUR,t))}onfocus(e,t){this._register(Se(e,ut.FOCUS,t))}onchange(e,t){this._register(Se(e,ut.CHANGE,t))}ignoreGesture(e){return eR.ignoreTarget(e)}},Hg=11,tR=class extends af{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Hg+"px",this.domNode.style.height=Hg+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new $0),this._register($g(this.bgDomNode,ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register($g(this.domNode,ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new GT),this._pointerdownScheduleRepeatTimer=this._register(new of)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Nr(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()}},rR=class gh{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 gh(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 gh(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,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}}},nR=class extends ke{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new rR(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 Kg(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=Kg.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 Nc(e,t){let r=t-e;return function(n){return e+r*oR(n)}}function iR(e,t,r){return function(n){return n<r?e(n/r):t((n-r)/(1-r))}}var Kg=class mh{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),iR(Nc(t,i),Nc(s,r),.33)}return Nc(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 mh.start(t,r,n)}static start(t,r,n){n=n+10;let i=Date.now()-10;return new mh(t,r,i,n)}};function sR(e){return Math.pow(e,3)}function oR(e){return 1-sR(1-e)}var lR=class extends ke{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 of)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},aR=140,W0=class extends af{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new lR(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new $0),this._shouldRender=!0,this.domNode=Vs(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Se(this.domNode.domNode,ut.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new tR(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=Vs(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,ut.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,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=QT(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(z0&&o>aR){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()}},H0=class _h{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 _h(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=_h._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let 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)}},cR=class extends W0{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new H0(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}},uR=class extends W0{constructor(e,t,r){let n=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new H0(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}},hR=500,Vg=50,dR=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},vh=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,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(nf){let r=Nr(t.browserEvent),n=bT(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 dR(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}};vh.INSTANCE=new vh;var fR=vh,pR=class extends af{constructor(e,t,r){super(),this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new se),this.onWillScroll=this._onWillScroll.event,this._options=mR(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 uR(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new cR(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=Vs(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Vs(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Vs(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new of),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ui(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,jr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new jg(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ui(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new jg(r))};this._mouseWheelToDispose.push(Se(this._listenOnDomNode,ut.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=fR.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let l=!jr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),c={};if(s){let h=Vg*s,u=a.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(c,u)}if(o){let h=Vg*o,u=a.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(c,u)}c=this._scrollable.validateScrollPosition(c),(a.scrollLeft!==c.scrollLeft||a.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),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(),hR)}},gR=class extends pR{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 mR(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,jr&&(t.className+=" mac"),t}var yh=class extends ke{constructor(e,t,r,n,i,s,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new nR({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>lf(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new gR(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},a)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(yt.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(We(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(We(()=>this._styleElement.remove())),this._register(yt.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
129
- `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};yh=Ge([he(2,Nt),he(3,on),he(4,b0),he(5,is),he(6,zt),he(7,ln)],yh);var Sh=class extends ke{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()}};Sh=Ge([he(1,Nt),he(2,on),he(3,Lo),he(4,ln)],Sh);var _R=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,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)}},Ir={full:0,left:0,center:0,right:0},dn={full:0,left:0,center:0,right:0},vs={full:0,left:0,center:0,right:0},oa=class extends ke{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 _R,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(We(()=>{var h;return(h=this._canvas)==null?void 0:h.remove()}));let a=this._canvas.getContext("2d");if(a)this._ctx=a;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);dn.full=this._canvas.width,dn.left=e,dn.center=t,dn.right=e,this._refreshDrawHeightConstants(),vs.full=1,vs.left=1,vs.center=1+dn.left,vs.right=1+dn.left+dn.center}_refreshDrawHeightConstants(){Ir.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);Ir.left=t,Ir.center=t,Ir.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ir.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ir.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ir.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ir.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(vs[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ir[e.position||"full"]/2),dn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ir[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};oa=Ge([he(2,Nt),he(3,Lo),he(4,ln),he(5,zt),he(6,is),he(7,on)],oa);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 Cl;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(Cl||(Cl={}));var U0;(e=>e.ST=`${q.ESC}\\`)(U0||(U0={}));var xh=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)}}};xh=Ge([he(2,Nt),he(3,zt),he(4,gi),he(5,ln)],xh);var dt=0,ft=0,pt=0,Ye=0,qg={css:"#00000000",rgba:0},rt;(e=>{function t(i,s,o,l){return l!==void 0?`#${$n(i)}${$n(s)}${$n(o)}${$n(l)}`:`#${$n(i)}${$n(s)}${$n(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})(rt||(rt={}));var je;(e=>{function t(a,c){if(Ye=(c.rgba&255)/255,Ye===1)return{css:c.css,rgba:c.rgba};let h=c.rgba>>24&255,u=c.rgba>>16&255,d=c.rgba>>8&255,f=a.rgba>>24&255,g=a.rgba>>16&255,m=a.rgba>>8&255;dt=f+Math.round((h-f)*Ye),ft=g+Math.round((u-g)*Ye),pt=m+Math.round((d-m)*Ye);let w=rt.toCss(dt,ft,pt),_=rt.toRgba(dt,ft,pt);return{css:w,rgba:_}}e.blend=t;function r(a){return(a.rgba&255)===255}e.isOpaque=r;function n(a,c,h){let u=El.ensureContrastRatio(a.rgba,c.rgba,h);if(u)return rt.toColor(u>>24&255,u>>16&255,u>>8&255)}e.ensureContrastRatio=n;function i(a){let c=(a.rgba|255)>>>0;return[dt,ft,pt]=El.toChannels(c),{css:rt.toCss(dt,ft,pt),rgba:c}}e.opaque=i;function s(a,c){return Ye=Math.round(c*255),[dt,ft,pt]=El.toChannels(a.rgba),{css:rt.toCss(dt,ft,pt,Ye),rgba:rt.toRgba(dt,ft,pt,Ye)}}e.opacity=s;function o(a,c){return Ye=a.rgba&255,s(a,Ye*c/255)}e.multiplyOpacity=o;function l(a){return[a.rgba>>24&255,a.rgba>>16&255,a.rgba>>8&255]}e.toColorRGB=l})(je||(je={}));var Ue;(e=>{let t,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 dt=parseInt(i.slice(1,2).repeat(2),16),ft=parseInt(i.slice(2,3).repeat(2),16),pt=parseInt(i.slice(3,4).repeat(2),16),rt.toColor(dt,ft,pt);case 5:return dt=parseInt(i.slice(1,2).repeat(2),16),ft=parseInt(i.slice(2,3).repeat(2),16),pt=parseInt(i.slice(3,4).repeat(2),16),Ye=parseInt(i.slice(4,5).repeat(2),16),rt.toColor(dt,ft,pt,Ye);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return dt=parseInt(s[1]),ft=parseInt(s[2]),pt=parseInt(s[3]),Ye=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),rt.toColor(dt,ft,pt,Ye);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),[dt,ft,pt,Ye]=t.getImageData(0,0,1,1).data,Ye!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:rt.toRgba(dt,ft,pt,Ye),css:i}}e.toColor=n})(Ue||(Ue={}));var Lt;(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})(Lt||(Lt={}));var El;(e=>{function t(o,l){if(Ye=(l&255)/255,Ye===1)return l;let a=l>>24&255,c=l>>16&255,h=l>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return dt=u+Math.round((a-u)*Ye),ft=d+Math.round((c-d)*Ye),pt=f+Math.round((h-f)*Ye),rt.toRgba(dt,ft,pt)}e.blend=t;function r(o,l,a){let c=Lt.relativeLuminance(o>>8),h=Lt.relativeLuminance(l>>8);if(Kr(c,h)<a){if(h<c){let f=n(o,l,a),g=Kr(c,Lt.relativeLuminance(f>>8));if(g<a){let m=i(o,l,a),w=Kr(c,Lt.relativeLuminance(m>>8));return g>w?f:m}return f}let u=i(o,l,a),d=Kr(c,Lt.relativeLuminance(u>>8));if(d<a){let f=n(o,l,a),g=Kr(c,Lt.relativeLuminance(f>>8));return d>g?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,g=l>>8&255,m=Kr(Lt.relativeLuminance2(d,f,g),Lt.relativeLuminance2(c,h,u));for(;m<a&&(d>0||f>0||g>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),g-=Math.max(0,Math.ceil(g*.1)),m=Kr(Lt.relativeLuminance2(d,f,g),Lt.relativeLuminance2(c,h,u));return(d<<24|f<<16|g<<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,g=l>>8&255,m=Kr(Lt.relativeLuminance2(d,f,g),Lt.relativeLuminance2(c,h,u));for(;m<a&&(d<255||f<255||g<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),m=Kr(Lt.relativeLuminance2(d,f,g),Lt.relativeLuminance2(c,h,u));return(d<<24|f<<16|g<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(El||(El={}));function $n(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Kr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var vR=class extends Io{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()]}},la=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new fr}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||wn.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++)la._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||wn.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}};la=Ge([he(0,Nt)],la);function yR(e){return 57508<=e&&e<=57558}function SR(e){return 9472<=e&&e<=9631}function xR(e){return yR(e)||SR(e)}function wR(){return{css:{canvas:nl(),cell:nl()},device:{canvas:nl(),cell:nl(),char:{width:0,height:0,left:0,top:0}}}}function nl(){return{width:0,height:0}}var wh=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 fr,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,g=e.getNoBgTrimmedLength();r&&g<s+1&&(g=s+1);let m,w=0,_="",v=0,y=0,T=0,R=0,x=!1,j=0,H=!1,U=0,E=0,I=[],M=c!==-1&&h!==-1;for(let L=0;L<g;L++){e.loadCell(L,this._workCell);let W=this._workCell.getWidth();if(W===0)continue;let A=!1,O=L>=E,K=L,P=this._workCell;if(d.length>0&&L===d[0][0]&&O){let ye=d.shift(),Qe=this._isCellInSelection(ye[0],t);for(v=ye[0]+1;v<ye[1];v++)O&&(O=Qe===this._isCellInSelection(v,t));O&&(O=!r||s<ye[0]||s>=ye[1]),O?(A=!0,P=new vR(this._workCell,e.translateToString(!0,ye[0],ye[1]),ye[1]-ye[0]),K=ye[1]-1,W=P.getWidth()):E=ye[1]}let $=this._isCellInSelection(L,t),S=r&&L===s,Q=M&&L>=c&&L<=h,le=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,ye=>{le=!0});let C=P.getChars()||wn;if(C===" "&&(P.isUnderline()||P.isOverline())&&(C=" "),U=W*l-a.get(C,P.isBold(),P.isItalic()),!m)m=this._document.createElement("span");else if(w&&($&&H||!$&&!H&&P.bg===y)&&($&&H&&f.selectionForeground||P.fg===T)&&P.extended.ext===R&&Q===x&&U===j&&!S&&!A&&!le&&O){P.isInvisible()?_+=wn:_+=C,w++;continue}else w&&(m.textContent=_),m=this._document.createElement("span"),w=0,_="";if(y=P.bg,T=P.fg,R=P.extended.ext,x=Q,j=U,H=$,A&&s>=L&&s<=K&&(s=L),!this._coreService.isCursorHidden&&S&&this._coreService.isCursorInitialized){if(I.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&I.push("xterm-cursor-blink"),I.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":I.push("xterm-cursor-outline");break;case"block":I.push("xterm-cursor-block");break;case"bar":I.push("xterm-cursor-bar");break;case"underline":I.push("xterm-cursor-underline");break}}if(P.isBold()&&I.push("xterm-bold"),P.isItalic()&&I.push("xterm-italic"),P.isDim()&&I.push("xterm-dim"),P.isInvisible()?_=wn:_=P.getChars()||wn,P.isUnderline()&&(I.push(`xterm-underline-${P.extended.underlineStyle}`),_===" "&&(_=" "),!P.isUnderlineColorDefault()))if(P.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${Io.toColorRGB(P.getUnderlineColor()).join(",")})`;else{let ye=P.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&P.isBold()&&ye<8&&(ye+=8),m.style.textDecorationColor=f.ansi[ye].css}P.isOverline()&&(I.push("xterm-overline"),_===" "&&(_=" ")),P.isStrikethrough()&&I.push("xterm-strikethrough"),Q&&(m.style.textDecoration="underline");let ge=P.getFgColor(),ie=P.getFgColorMode(),N=P.getBgColor(),Y=P.getBgColorMode(),te=!!P.isInverse();if(te){let ye=ge;ge=N,N=ye;let Qe=ie;ie=Y,Y=Qe}let ue,_e,z=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,ye=>{ye.options.layer!=="top"&&z||(ye.backgroundColorRGB&&(Y=50331648,N=ye.backgroundColorRGB.rgba>>8&16777215,ue=ye.backgroundColorRGB),ye.foregroundColorRGB&&(ie=50331648,ge=ye.foregroundColorRGB.rgba>>8&16777215,_e=ye.foregroundColorRGB),z=ye.options.layer==="top")}),!z&&$&&(ue=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,N=ue.rgba>>8&16777215,Y=50331648,z=!0,f.selectionForeground&&(ie=50331648,ge=f.selectionForeground.rgba>>8&16777215,_e=f.selectionForeground)),z&&I.push("xterm-decoration-top");let Te;switch(Y){case 16777216:case 33554432:Te=f.ansi[N],I.push(`xterm-bg-${N}`);break;case 50331648:Te=rt.toColor(N>>16,N>>8&255,N&255),this._addStyle(m,`background-color:#${Yg((N>>>0).toString(16),"0",6)}`);break;case 0:default:te?(Te=f.foreground,I.push("xterm-bg-257")):Te=f.background}switch(ue||P.isDim()&&(ue=je.multiplyOpacity(Te,.5)),ie){case 16777216:case 33554432:P.isBold()&&ge<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ge+=8),this._applyMinimumContrast(m,Te,f.ansi[ge],P,ue,void 0)||I.push(`xterm-fg-${ge}`);break;case 50331648:let ye=rt.toColor(ge>>16&255,ge>>8&255,ge&255);this._applyMinimumContrast(m,Te,ye,P,ue,_e)||this._addStyle(m,`color:#${Yg(ge.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(m,Te,f.foreground,P,ue,_e)||te&&I.push("xterm-fg-257")}I.length&&(m.className=I.join(" "),I.length=0),!S&&!A&&!le&&O?w++:m.textContent=_,U!==this.defaultSpacing&&(m.style.letterSpacing=`${U}px`),u.push(m),L=K}return m&&w&&(m.textContent=_),u}_applyMinimumContrast(e,t,r,n,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||xR(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=je.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]}};wh=Ge([he(1,E0),he(2,zt),he(3,on),he(4,gi),he(5,Lo),he(6,is)],wh);function Yg(e,t,r){for(;e.length<r;)e=t+e;return e}var bR=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let 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}},kR=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,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 CR(){return new kR}var zc="xterm-dom-renderer-owner-",ir="xterm-rows",il="xterm-fg-",Xg="xterm-bg-",ys="xterm-focus",sl="xterm-selection",ER=1,bh=class extends ke{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=ER++,this._rowElements=[],this._selectionRenderModel=CR(),this.onRequestRedraw=this._register(new se).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ir),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(sl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=wR(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(g=>this._injectCss(g))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(wh,document),this._element.classList.add(zc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(g=>this._handleLinkHover(g))),this._register(this._linkifier2.onHideLinkUnderline(g=>this._handleLinkLeave(g))),this._register(We(()=>{this._element.classList.remove(zc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new bR(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ir} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${ir} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${ir} .xterm-dim { color: ${je.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ir}.${ys} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ir}.${ys} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ir}.${ys} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${ir} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ir} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ir} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ir} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ir} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${sl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${sl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${sl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${il}${s} { color: ${o.css}; }${this._terminalSelector} .${il}${s}.xterm-dim { color: ${je.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Xg}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${il}257 { color: ${je.opaque(e.background).css}; }${this._terminalSelector} .${il}257.xterm-dim { color: ${je.multiplyOpacity(je.opaque(e.background),.5).css}; }${this._terminalSelector} .${Xg}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let 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(ys),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ys),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,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`.${zc}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,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 g=f+l.ydisp,m=this._rowElements[f],w=l.lines.get(g);if(!m||!w)break;m.replaceChildren(...this._rowFactory.createRow(w,g,g===a,u,d,c,h,this.dimensions.css.cell.width,this._widthCache,s?f===r?e:0:-1,s?(f===n?t:i)-1:-1))}}};bh=Ge([he(7,ef),he(8,za),he(9,zt),he(10,Nt),he(11,gi),he(12,on),he(13,is)],bh);var kh=class extends ke{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new se),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new RR(this._optionsService))}catch{this._measureStrategy=this._register(new TR(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};kh=Ge([he(2,zt)],kh);var K0=class extends ke{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},TR=class extends K0{constructor(e,t,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}},RR=class extends K0{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},IR=class extends ke{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new LR(this._window)),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new se),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(yt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Se(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Se(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},LR=class extends ke{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Gi),this._onDprChange=this._register(new se),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(We(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Se(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},PR=class extends ke{constructor(){super(),this.linkProviders=[],this._register(We(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function cf(e,t,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 DR(e,t,r,n,i,s,o,l,a){if(!s)return;let c=cf(e,t,r);if(c)return c[0]=Math.ceil((c[0]+(a?o/2:0))/o),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),n+(a?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var Ch=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return DR(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let r=cf(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};Ch=Ge([he(0,ln),he(1,za)],Ch);var MR=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,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=[]}},V0={};H4(V0,{getSafariVersion:()=>BR,isChromeOS:()=>G0,isFirefox:()=>q0,isIpad:()=>NR,isIphone:()=>zR,isLegacyEdge:()=>AR,isLinux:()=>uf,isMac:()=>aa,isNode:()=>Oa,isSafari:()=>Y0,isWindows:()=>X0});var Oa=typeof process<"u"&&"title"in process,Po=Oa?"node":navigator.userAgent,Do=Oa?"node":navigator.platform,q0=Po.includes("Firefox"),AR=Po.includes("Edge"),Y0=/^((?!chrome|android).)*safari/i.test(Po);function BR(){if(!Y0)return 0;let e=Po.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var aa=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Do),NR=Do==="iPad",zR=Do==="iPhone",X0=["Windows","Win16","Win32","WinCE"].includes(Do),uf=Do.indexOf("Linux")>=0,G0=/\bCrOS\b/.test(Po),Q0=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,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()}},OR=class extends Q0{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},jR=class extends Q0{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ca=!Oa&&"requestIdleCallback"in window?jR:OR,FR=class{constructor(){this._queue=new ca}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Eh=class extends ke{constructor(e,t,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 Gi),this._pausedResizeTask=new FR,this._observerDisposable=this._register(new Gi),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new se),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new se),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new se),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new MR((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new $R(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(We(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let 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()}};Eh=Ge([he(2,zt),he(3,za),he(4,gi),he(5,Lo),he(6,Nt),he(7,on),he(8,is)],Eh);var $R=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 WR(e,t,r,n){let i=r.buffer.x,s=r.buffer.y;if(!r.buffer.hasScrollback)return KR(i,s,e,t,r,n)+ja(s,t,r,n)+VR(i,s,e,t,r,n);let o;if(s===t)return o=i>e?"D":"C",mo(Math.abs(i-e),go(o,n));o=s>t?"D":"C";let l=Math.abs(s-t),a=UR(s>t?e:i,r)+(l-1)*r.cols+1+HR(s>t?i:e);return mo(a,go(o,n))}function HR(e,t){return e-1}function UR(e,t){return t.cols-e}function KR(e,t,r,n,i,s){return ja(t,n,i,s).length===0?"":mo(J0(e,t,e,t-hi(t,i),!1,i).length,go("D",s))}function ja(e,t,r,n){let i=e-hi(e,r),s=t-hi(t,r),o=Math.abs(i-s)-qR(e,t,r);return mo(o,go(Z0(e,t),n))}function VR(e,t,r,n,i,s){let o;ja(t,n,i,s).length>0?o=n-hi(n,i):o=t;let l=n,a=YR(e,t,r,n,i,s);return mo(J0(e,o,r,l,a==="C",i).length,go(a,s))}function qR(e,t,r){var o;let n=0,i=e-hi(e,r),s=t-hi(t,r);for(let l=0;l<Math.abs(i-s);l++){let a=Z0(e,t)==="A"?-1:1;(o=r.buffer.lines.get(i+a*l))!=null&&o.isWrapped&&n++}return n}function hi(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 YR(e,t,r,n,i,s){let o;return ja(r,n,i,s).length>0?o=n-hi(n,i):o=t,e<r&&o<=n||e>=r&&o<n?"C":"D"}function Z0(e,t){return e>t?"A":"B"}function J0(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 go(e,t){let r=t?"O":"[";return q.ESC+r+e}function mo(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}var XR=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Gg(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Oc=50,GR=15,QR=50,ZR=500,JR=" ",eI=new RegExp(JR,"g"),Th=class extends ke{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 fr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new se),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new se),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new XR(this._bufferService),this._activeSelectionMode=0,this._register(We(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let 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(eI," ")).join(X0?`\r
131
- `:`
132
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),uf&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),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=cf(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-Oc),Oc),t/=Oc,t/Math.abs(t)+Math.round(t*(GR-1)))}shouldForceSelection(e){return aa?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),QR)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(aa&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let 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<ZR&&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=WR(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 w=e[0],_=e[0];s.getWidth(w)===0&&(h++,w--),s.getWidth(_)===2&&(u++,_++);let v=s.getString(_).length;for(v>1&&(f+=v-1,a+=v-1);w>0&&l>0&&!this._isCharWordSeparator(s.loadCell(w-1,this._workCell));){s.loadCell(w-1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,w--):y>1&&(d+=y-1,l-=y-1),l--,w--}for(;_<s.length&&a+1<o.length&&!this._isCharWordSeparator(s.loadCell(_+1,this._workCell));){s.loadCell(_+1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===2?(u++,_++):y>1&&(f+=y-1,a+=y-1),a++,_++}}a++;let g=l+c-h+d,m=Math.min(this._bufferService.cols,a-l+h+u-d-f);if(!(!t&&o.slice(l,a).trim()==="")){if(r&&g===0&&s.getCodePoint(0)!==32){let w=i.lines.get(e[1]-1);if(w&&s.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let _=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(_){let v=this._bufferService.cols-_.start;g-=v,m+=v}}}if(n&&g+m===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let w=i.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let _=this._getWordAt([0,e[1]+1],!1,!1,!0);_&&(m+=_.length)}}return{start:g,length:m}}}_selectWordAt(e,t){let 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)}};Th=Ge([he(3,Nt),he(4,gi),he(5,tf),he(6,zt),he(7,ln),he(8,on)],Th);var Qg=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={}}},Zg=class{constructor(){this._color=new Qg,this._css=new Qg}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()}},st=Object.freeze((()=>{let e=[Ue.toColor("#2e3436"),Ue.toColor("#cc0000"),Ue.toColor("#4e9a06"),Ue.toColor("#c4a000"),Ue.toColor("#3465a4"),Ue.toColor("#75507b"),Ue.toColor("#06989a"),Ue.toColor("#d3d7cf"),Ue.toColor("#555753"),Ue.toColor("#ef2929"),Ue.toColor("#8ae234"),Ue.toColor("#fce94f"),Ue.toColor("#729fcf"),Ue.toColor("#ad7fa8"),Ue.toColor("#34e2e2"),Ue.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let 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:rt.toCss(n,i,s),rgba:rt.toRgba(n,i,s)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:rt.toCss(n,n,n),rgba:rt.toRgba(n,n,n)})}return e})()),Vn=Ue.toColor("#ffffff"),Ls=Ue.toColor("#000000"),Jg=Ue.toColor("#ffffff"),em=Ls,Ss={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},tI=Vn,Rh=class extends ke{constructor(e){super(),this._optionsService=e,this._contrastCache=new Zg,this._halfContrastCache=new Zg,this._onChangeColors=this._register(new se),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Vn,background:Ls,cursor:Jg,cursorAccent:em,selectionForeground:void 0,selectionBackgroundTransparent:Ss,selectionBackgroundOpaque:je.blend(Ls,Ss),selectionInactiveBackgroundTransparent:Ss,selectionInactiveBackgroundOpaque:je.blend(Ls,Ss),scrollbarSliderBackground:je.opacity(Vn,.2),scrollbarSliderHoverBackground:je.opacity(Vn,.4),scrollbarSliderActiveBackground:je.opacity(Vn,.5),overviewRulerBorder:Vn,ansi:st.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=De(e.foreground,Vn),t.background=De(e.background,Ls),t.cursor=je.blend(t.background,De(e.cursor,Jg)),t.cursorAccent=je.blend(t.background,De(e.cursorAccent,em)),t.selectionBackgroundTransparent=De(e.selectionBackground,Ss),t.selectionBackgroundOpaque=je.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=De(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=je.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?De(e.selectionForeground,qg):void 0,t.selectionForeground===qg&&(t.selectionForeground=void 0),je.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=je.opacity(t.selectionBackgroundTransparent,.3)),je.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=je.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=De(e.scrollbarSliderBackground,je.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=De(e.scrollbarSliderHoverBackground,je.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=De(e.scrollbarSliderActiveBackground,je.opacity(t.foreground,.5)),t.overviewRulerBorder=De(e.overviewRulerBorder,tI),t.ansi=st.slice(),t.ansi[0]=De(e.black,st[0]),t.ansi[1]=De(e.red,st[1]),t.ansi[2]=De(e.green,st[2]),t.ansi[3]=De(e.yellow,st[3]),t.ansi[4]=De(e.blue,st[4]),t.ansi[5]=De(e.magenta,st[5]),t.ansi[6]=De(e.cyan,st[6]),t.ansi[7]=De(e.white,st[7]),t.ansi[8]=De(e.brightBlack,st[8]),t.ansi[9]=De(e.brightRed,st[9]),t.ansi[10]=De(e.brightGreen,st[10]),t.ansi[11]=De(e.brightYellow,st[11]),t.ansi[12]=De(e.brightBlue,st[12]),t.ansi[13]=De(e.brightMagenta,st[13]),t.ansi[14]=De(e.brightCyan,st[14]),t.ansi[15]=De(e.brightWhite,st[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<r;n++)t.ansi[n+16]=De(e.extendedAnsi[n],st[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()}}};Rh=Ge([he(0,zt)],Rh);function De(e,t){if(e!==void 0)try{return Ue.toColor(e)}catch{}return t}var rI=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)}},nI=class{constructor(){this._services=new rI,this._services.set(ef,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=G4(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)}},iI={trace:0,debug:1,info:2,warn:3,error:4,off:5},sI="xterm.js: ",Ih=class extends ke{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=iI[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?"":sI)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Ih=Ge([he(0,zt)],Ih);var tm=class extends ke{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new se),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new se),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new se),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let 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}},be=3,tt=Object.freeze(new Io),ol=0,jc=2,Ps=class e1{constructor(t,r,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*be);let i=r||fr.fromCharData([0,y0,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let r=this._data[t*be+0],n=r&2097151;return[this._data[t*be+1],r&2097152?this._combined[t]:n?mn(n):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*be+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*be+0]=t|2097152|r[2]<<22):this._data[t*be+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*be+0]>>22}hasWidth(t){return this._data[t*be+0]&12582912}getFg(t){return this._data[t*be+1]}getBg(t){return this._data[t*be+2]}hasContent(t){return this._data[t*be+0]&4194303}getCodePoint(t){let r=this._data[t*be+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*be+0]&2097152}getString(t){let r=this._data[t*be+0];return r&2097152?this._combined[t]:r&2097151?mn(r&2097151):""}isProtected(t){return this._data[t*be+2]&536870912}loadCell(t,r){return ol=t*be,r.content=this._data[ol+0],r.fg=this._data[ol+1],r.bg=this._data[ol+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*be+0]=r.content,this._data[t*be+1]=r.fg,this._data[t*be+2]=r.bg}setCellFromCodepoint(t,r,n,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*be+0]=r|n<<22,this._data[t*be+1]=i.fg,this._data[t*be+2]=i.bg}addCodepointToCell(t,r,n){let i=this._data[t*be+0];i&2097152?this._combined[t]+=mn(r):i&2097151?(this._combined[t]=mn(i&2097151)+mn(r),i&=-2097152,i|=2097152):i=r|1<<22,n&&(i&=-12582913,i|=n<<22),this._data[t*be+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 fr;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 fr;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*jc<this._data.buffer.byteLength;let n=t*be;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*jc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*jc<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,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 e1(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*be+0]&4194303)return t+(this._data[t*be+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*be+0]&4194303||this._data[t*be+2]&50331648)return t+(this._data[t*be+0]>>22);return 0}copyCellsFrom(t,r,n,i,s){let o=t._data;if(s)for(let a=i-1;a>=0;a--){for(let c=0;c<be;c++)this._data[(n+a)*be+c]=o[(r+a)*be+c];o[(r+a)*be+2]&268435456&&(this._extendedAttrs[n+a]=t._extendedAttrs[r+a])}else for(let a=0;a<i;a++){for(let c=0;c<be;c++)this._data[(n+a)*be+c]=o[(r+a)*be+c];o[(r+a)*be+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*be+0],l=o&2097151,a=o&2097152?this._combined[r]:l?mn(l):wn;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 oI(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=_o(h,u,t),f=1,g=0;for(;f<h.length;){let w=_o(h,f,t),_=w-g,v=r-d,y=Math.min(_,v);h[u].copyCellsFrom(h[f],g,d,y,!1),d+=y,d===r&&(u++,d=0),g+=y,g===w&&(f++,g=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 m=0;for(let w=h.length-1;w>0&&(w>u||h[w].getTrimmedLength()===0);w--)m++;m>0&&(o.push(l+h.length-m),o.push(m)),l+=h.length-1}return o}function lI(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 aI(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 cI(e,t,r){let n=[],i=e.map((a,c)=>_o(e,c,t)).reduce((a,c)=>a+c),s=0,o=0,l=0;for(;l<i;){if(i-l<r){n.push(i-l);break}s+=r;let a=_o(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 _o(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 t1=class r1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=r1._nextId++,this._onDispose=this.register(new se),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ui(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};t1._nextId=1;var uI=t1,ct={},qn=ct.B;ct[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};ct.A={"#":"£"};ct.B=void 0;ct[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ct.C=ct[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ct.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ct.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ct.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ct.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ct.E=ct[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ct.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ct.H=ct[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ct["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var rm=4294967295,nm=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=tt.clone(),this.savedCharset=qn,this.markers=[],this._nullCell=fr.fromCharData([0,y0,1,0]),this._whitespaceCell=fr.fromCharData([0,wn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ca,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new tm(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new sa),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new sa),this._whitespaceCell}getBlankLine(e,t){return new Ps(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>rm?rm:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=tt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new tm(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(tt),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 Ps(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 Ps(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=oI(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(tt),r);if(n.length>0){let i=lI(this.lines,n);aI(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(tt),i=r;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ps(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(tt),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let a=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),a.unshift(l);if(!r){let y=this.ybase+this.y;if(y>=o&&y<o+a.length)continue}let c=a[a.length-1].getTrimmedLength(),h=cI(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 T=this.getBlankLine(tt,!0);f.push(T)}f.length>0&&(i.push({start:o+a.length+s,newLines:f}),s+=f.length),a.push(...f);let g=h.length-1,m=h[g];m===0&&(g--,m=h[g]);let w=a.length-u-1,_=c;for(;w>=0;){let y=Math.min(_,m);if(a[g]===void 0)break;if(a[g].copyCellsFrom(a[w],_-y,m-y,y,!0),m-=y,m===0&&(g--,m=h[g]),_-=y,_===0){w--;let T=Math.max(w,0);_=_o(a,T,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 m=0;m<this.lines.length;m++)l.push(this.lines.get(m));let a=this.lines.length,c=a-1,h=0,u=i[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let d=0;for(let m=Math.min(this.lines.maxLength-1,a+s-1);m>=0;m--)if(u&&u.start>c+d){for(let w=u.newLines.length-1;w>=0;w--)this.lines.set(m--,u.newLines[w]);m++,o.push({index:c+1,amount:u.newLines.length}),d+=u.newLines.length,u=i[++h]}else this.lines.set(m,l[c--]);let f=0;for(let m=o.length-1;m>=0;m--)o[m].index+=f,this.lines.onInsertEmitter.fire(o[m]),f+=o[m].amount;let g=Math.max(0,a+s-this.lines.maxLength);g>0&&this.lines.onTrimEmitter.fire(g)}}translateBufferLineToString(e,t,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 uI(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)}},hI=class extends ke{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new se),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new nm(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new nm(!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)}},n1=2,i1=1,Lh=class extends ke{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,n1),this.rows=Math.max(e.rawOptions.rows||0,i1),this.buffers=this._register(new hI(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))}};Lh=Ge([he(0,zt)],Lh);var Si={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:aa,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},dI=["normal","bold","100","200","300","400","500","600","700","800","900"],fI=class extends ke{constructor(e){super(),this._onOptionChange=this._register(new se),this.onOptionChange=this._onOptionChange.event;let t={...Si};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 Si))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in Si))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=Si[e]),!pI(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Si[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=dI.includes(t)?t:Si[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function pI(e){return e==="block"||e==="underline"||e==="bar"}function Ds(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]&&Ds(e[n],t-1);return r}var im=Object.freeze({insertMode:!1}),sm=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Ph=class extends ke{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new se),this.onData=this._onData.event,this._onUserInput=this._register(new se),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new se),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ds(im),this.decPrivateModes=Ds(sm)}reset(){this.modes=Ds(im),this.decPrivateModes=Ds(sm)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let 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))}};Ph=Ge([he(0,Nt),he(1,k0),he(2,zt)],Ph);var om={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Fc(e,t){let 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 $c=String.fromCharCode,lm={DEFAULT:e=>{let t=[Fc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${$c(t[0])}${$c(t[1])}${$c(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Fc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Fc(e,!0)};${e.x};${e.y}${t}`}},Dh=class extends ke{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new se),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(om))this.addProtocol(n,om[n]);for(let n of Object.keys(lm))this.addEncoding(n,lm[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)}};Dh=Ge([he(0,Nt),he(1,gi),he(2,zt)],Dh);var Wc=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],gI=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],ot;function mI(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 _I=class{constructor(){if(this.version="6",!ot){ot=new Uint8Array(65536),ot.fill(1),ot[0]=0,ot.fill(0,1,32),ot.fill(0,127,160),ot.fill(2,4352,4448),ot[9001]=2,ot[9002]=2,ot.fill(2,11904,42192),ot[12351]=1,ot.fill(2,44032,55204),ot.fill(2,63744,64256),ot.fill(2,65040,65050),ot.fill(2,65072,65136),ot.fill(2,65280,65377),ot.fill(2,65504,65511);for(let e=0;e<Wc.length;++e)ot.fill(0,Wc[e][0],Wc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ot[e]:mI(e,gI)?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=Jn.extractWidth(t);i===0?n=!1:i>r&&(r=i)}return Jn.createPropertyValue(0,r,n)}},Jn=class Tl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new se,this.onChange=this._onChange.event;let t=new _I;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=Tl.extractWidth(l);Tl.extractShouldJoin(l)&&(a-=Tl.extractWidth(n)),r+=a,n=l}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},vI=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function am(e){var 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 xs=2147483647,yI=256,s1=class Mh{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>yI)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 Mh;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 Mh(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let 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>xs?xs: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>xs?xs: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,xs):t}},ws=[],SI=class{constructor(){this._state=0,this._active=ws,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=ws}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=ws,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ws,!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",Na(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=ws,this._id=-1,this._state=0}}},qt=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Na(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}},bs=[],xI=class{constructor(){this._handlers=Object.create(null),this._active=bs,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=bs}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let 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=bs,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||bs,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let 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",Na(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=bs,this._ident=0}},Ms=new s1;Ms.addParam(0);var cm=class{constructor(e){this._handler=e,this._data="",this._params=Ms,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ms,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Na(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=Ms,this._data="",this._hitLimit=!1,r));return this._params=Ms,this._data="",this._hitLimit=!1,t}},wI=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}},lr=160,bI=function(){let e=new wI(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(lr,0,2,0),e.add(lr,8,5,8),e.add(lr,6,0,6),e.add(lr,11,0,11),e.add(lr,13,13,13),e}(),kI=class extends ke{constructor(e=bI){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new s1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,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 SI),this._dcsParser=this._register(new xI),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:lr)],i>>4){case 2:for(let d=l+1;;++d){if(d>=t||(n=e[d])<32||n>126&&n<lr){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(n=e[d])<32||n>126&&n<lr){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(n=e[d])<32||n>126&&n<lr){this._printHandler(e,l,d),l=d-1;break}if(++d>=t||(n=e[d])<32||n>126&&n<lr){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<lr){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<lr){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}}},CI=/^([\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})$/,EI=/^[\da-f]+$/;function um(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=CI.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),EI.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 Hc(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 TI(e,t=16){let[r,n,i]=e;return`rgb:${Hc(r,t)}/${Hc(n,t)}/${Hc(i,t)}`}var RI={"(":0,")":1,"*":2,"+":3,"-":1,".":2},fn=131072,hm=10;function dm(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var fm=5e3,pm=0,II=class extends ke{constructor(e,t,r,n,i,s,o,l,a=new kI){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 Y4,this._utf8Decoder=new X4,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=tt.clone(),this._eraseAttrDataInternal=tt.clone(),this._onRequestBell=this._register(new se),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new se),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new se),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new se),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new se),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new se),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new se),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new se),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new se),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new se),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Ah(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:h.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,h,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:h,data:u})}),this._parser.setDcsHandlerFallback((c,h,u)=>{h==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:h,payload:u})}),this._parser.setPrintHandler((c,h,u)=>this.print(c,h,u)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(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(Cl.IND,()=>this.index()),this._parser.setExecuteHandler(Cl.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Cl.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new qt(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new qt(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new qt(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new qt(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new qt(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new qt(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new qt(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new qt(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new qt(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new qt(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new qt(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new qt(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in ct)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new cm((c,h)=>this.requestStatusString(c,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,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"),fm))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${fm} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let 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>fn&&(s=this._parseStack.position+fn)}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<fn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,fn))),o||this._dirtyRowTracker.clearRange(),e.length>fn)for(let c=s;c<e.length;c+=fn){let h=c+fn<e.length?c+fn: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 g=this._unicodeService.charProperties(n,d);i=Jn.extractWidth(g);let m=Jn.extractShouldJoin(g),w=m?Jn.extractWidth(d):0;if(d=g,o&&this._onA11yChar.fire(mn(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-w>l){if(a){let _=u,v=this._activeBuffer.x-w;for(this._activeBuffer.x=w,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),w>0&&u instanceof Ps&&u.copyCellsFrom(_,v,0,w,!1);v<l;)_.setCellFromCodepoint(v++,0,1,h)}else if(this._activeBuffer.x=l-1,i===2)continue}if(m&&this._activeBuffer.x){let _=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-_,n,i);for(let v=i-w;--v>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,i-w,this._activeBuffer.getNullCell(h)),u.getWidth(l-1)===2&&u.setCellFromCodepoint(l-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,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=>dm(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new cm(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new qt(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,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(tt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let 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=Jn.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,qn),this._charsetService.setgCharset(1,qn),this._charsetService.setgCharset(2,qn),this._charsetService.setgCharset(3,qn);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(m=>(m[m.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",m[m.SET=1]="SET",m[m.RESET=2]="RESET",m[m.PERMANENTLY_SET=3]="PERMANENTLY_SET",m[m.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(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=(m,w)=>(o.triggerDataEvent(`${q.ESC}[${t?"":"?"}${m};${w}$y`),!0),f=m=>m?1:2,g=e.params[0];return t?g===2?d(g,4):g===4?d(g,f(o.modes.insertMode)):g===12?d(g,3):g===20?d(g,f(u.convertEol)):d(g,0):g===1?d(g,f(n.applicationCursorKeys)):g===3?d(g,u.windowOptions.setWinLines?a===80?2:a===132?1:0:0):g===6?d(g,f(n.origin)):g===7?d(g,f(n.wraparound)):g===8?d(g,3):g===9?d(g,f(i==="X10")):g===12?d(g,f(u.cursorBlink)):g===25?d(g,f(!o.isCursorHidden)):g===45?d(g,f(n.reverseWraparound)):g===66?d(g,f(n.applicationKeypad)):g===67?d(g,4):g===1e3?d(g,f(i==="VT200")):g===1002?d(g,f(i==="DRAG")):g===1003?d(g,f(i==="ANY")):g===1004?d(g,f(n.sendFocus)):g===1005?d(g,4):g===1006?d(g,f(s==="SGR")):g===1015?d(g,4):g===1016?d(g,f(s==="SGR_PIXELS")):g===1048?d(g,1):g===47||g===1047||g===1049?d(g,f(c===h)):g===2004?d(g,f(n.bracketedPasteMode)):g===2026?d(g,f(n.synchronizedOutput)):d(g,0)}_updateAttrColor(e,t,r,n,i){return t===2?(e|=50331648,e&=-16777216,e|=Io.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=tt.fg,e.bg=tt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,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|=tt.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=tt.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|=tt.fg&16777215,n.bg&=-67108864,n.bg|=tt.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=tt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let 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(!dm(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${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>hm&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>hm&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let n=r.shift(),i=r.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(gm(s))if(i==="?")t.push({type:0,index:s});else{let o=um(i);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let 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=um(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]);gm(i)&&t.push({type:2,index:i})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,qn),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(RI[e[0]],ct[e[1]]||qn),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=tt.clone(),this._eraseAttrDataInternal=tt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new fr;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)}},Ah=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(pm=e,e=t,t=pm),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Ah=Ge([he(0,Nt)],Ah);function gm(e){return 0<=e&&e<256}var LI=5e7,mm=12,PI=50,DI=class extends ke{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new se),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let 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>LI)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>=mm?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>=mm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>PI&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},Bh=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let l=t.addMarker(t.ybase+t.y),a={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(a,l)),this._dataByLinkId.set(a.id,a),a.id}let 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)))}};Bh=Ge([he(0,Nt)],Bh);var _m=!1,MI=class extends ke{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Gi),this._onBinary=this._register(new se),this.onBinary=this._onBinary.event,this._onData=this._register(new se),this.onData=this._onData.event,this._onLineFeed=this._register(new se),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new se),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new se),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new se),this._instantiationService=new nI,this.optionsService=this._register(new fI(e)),this._instantiationService.setService(zt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Lh)),this._instantiationService.setService(Nt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Ih)),this._instantiationService.setService(k0,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Ph)),this._instantiationService.setService(gi,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Dh)),this._instantiationService.setService(b0,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Jn)),this._instantiationService.setService(J4,this.unicodeService),this._charsetService=this._instantiationService.createInstance(vI),this._instantiationService.setService(Z4,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Bh),this._instantiationService.setService(C0,this._oscLinkService),this._inputHandler=this._register(new II(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(yt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(yt.forward(this._bufferService.onResize,this._onResize)),this._register(yt.forward(this.coreService.onData,this._onData)),this._register(yt.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new DI((t,r)=>this._inputHandler.parse(t,r))),this._register(yt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new se),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!_m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),_m=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,n1),t=Math.max(t,i1),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(am.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(am(this._bufferService),!1))),this._windowsWrappingHeuristics.value=We(()=>{for(let t of e)t.dispose()})}}},AI={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 BI(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=AI[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 Ze=0,NI=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ca,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ca,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,s)=>this._getKey(i)-this._getKey(s)),t=0,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||(Ze=this._search(t),Ze===-1)||this._getKey(this._array[Ze])!==t)return!1;do if(this._array[Ze]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ze),!0;while(++Ze<this._array.length&&this._getKey(this._array[Ze])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,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&&(Ze=this._search(e),!(Ze<0||Ze>=this._array.length)&&this._getKey(this._array[Ze])===e))do yield this._array[Ze];while(++Ze<this._array.length&&this._getKey(this._array[Ze])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ze=this._search(e),!(Ze<0||Ze>=this._array.length)&&this._getKey(this._array[Ze])===e))do t(this._array[Ze]);while(++Ze<this._array.length&&this._getKey(this._array[Ze])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,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}},Uc=0,vm=0,zI=class extends ke{constructor(){super(),this._decorations=new NI(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new se),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new se),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(We(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new OI(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=>{Uc=i.options.x??0,vm=Uc+(i.options.width??1),e>=Uc&&e<vm&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},OI=class extends Pn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new se),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new se),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ue.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ue.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},jI=1e3,FI=class{constructor(e,t=jI){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)}},ym=20,ua=class extends ke{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 FI(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
133
- `))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Se(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(We(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<ym+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
134
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===ym+1&&(this._liveRegion.textContent+=th.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let 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})`}};ua=Ge([he(1,ef),he(2,on),he(3,ln)],ua);var Nh=class extends ke{constructor(e,t,r,n,i){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=n,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new se),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new se),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(We(()=>{var s;ui(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&&$I(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,ui(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}}};Nh=Ge([he(1,tf),he(2,ln),he(3,Nt),he(4,T0)],Nh);function $I(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 WI=class extends MI{constructor(e={}){super(e),this._linkifier=this._register(new Gi),this.browser=V0,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Gi),this._onCursorMove=this._register(new se),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new se),this.onKey=this._onKey.event,this._onRender=this._register(new se),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new se),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new se),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new se),this.onBell=this._onBell.event,this._onFocus=this._register(new se),this._onBlur=this._register(new se),this._onA11yCharEmitter=this._register(new se),this._onA11yTabEmitter=this._register(new se),this._onWillOpen=this._register(new se),this._setup(),this._decorationService=this._instantiationService.createInstance(zI),this._instantiationService.setService(Lo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(PR),this._instantiationService.setService(T0,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(nh)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(yt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(yt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(yt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(yt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(We(()=>{var t,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=je.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${q.ESC}]${n};${TI(i)}${U0.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=rt.toColor(...t.color));else{let s=r;this._themeService.modifyColors(o=>o[s]=rt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ua,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(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()&&V4(t,this._selectionService)}));let e=t=>q4(t,this.textarea,this.coreService,this.optionsService);this._register(Se(this.textarea,"paste",e)),this._register(Se(this.element,"paste",e)),q0?this._register(Se(this.element,"mousedown",t=>{t.button===2&&Ig(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Se(this.element,"contextmenu",t=>{Ig(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),uf&&this._register(Se(this.element,"auxclick",t=>{t.button===1&&v0(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Se(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Se(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Se(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Se(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Se(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Se(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Se(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((i=this.element)==null?void 0:i.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Se(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",eh.get()),G0||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(IR,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(on,this._coreBrowserService),this._register(Se(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(Se(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(kh,this._document,this._helperContainer),this._instantiationService.setService(za,this._charSizeService),this._themeService=this._instantiationService.createInstance(Rh),this._instantiationService.setService(is,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(la),this._instantiationService.setService(E0,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Eh,this.rows,this.screenElement)),this._instantiationService.setService(ln,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(xh,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ch),this._instantiationService.setService(tf,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(Nh,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(yh,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Th,this.element,this.screenElement,n)),this._instantiationService.setService(tT,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(yt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(Sh,this.screenElement)),this._register(Se(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(ua,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(oa,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(oa,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(bh,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function 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 g=s.deltaY;if(g===0||e.coreMouseService.consumeWheelEvent(s,(d=(u=(h=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:h.device)==null?void 0:u.cell)==null?void 0:d.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;a=g<0?0:1,l=4;break;default:return!1}return a===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:a,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let 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){_0(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,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=BI(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)&&(HI(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(tt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(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 HI(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var UI=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)}},KI=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 fr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},Sm=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new KI(t)}getNullCell(){return new fr}},VI=class extends ke{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new se),this.onBufferChange=this._onBufferChange.event,this._normal=new Sm(this._core.buffers.normal,"normal"),this._alternate=new Sm(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},qI=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)}},YI=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}},XI=["cols","rows"],Lr=0,GI=class extends ke{constructor(e){super(),this._core=this._register(new WI(e)),this._addonManager=this._register(new UI),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(XI.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 qI(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new YI(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 VI(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
135
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return eh.get()},set promptLabel(e){eh.set(e)},get tooMuchOutput(){return th.get()},set tooMuchOutput(e){th.set(e)}}}_verifyIntegers(...e){for(Lr of e)if(Lr===1/0||isNaN(Lr)||Lr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Lr of e)if(Lr&&(Lr===1/0||isNaN(Lr)||Lr%1!==0||Lr<0))throw new Error("This API only accepts positive integers")}};/**
136
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
137
- * @license MIT
138
- *
139
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
140
- * @license MIT
141
- *
142
- * Originally forked from (with the author's permission):
143
- * Fabrice Bellard's javascript vt100 for jslinux:
144
- * http://bellard.org/jslinux/
145
- * Copyright (c) 2011 Fabrice Bellard
146
- */var QI=2,ZI=1,JI=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(QI,Math.floor(h/e.css.cell.width)),rows:Math.max(ZI,Math.floor(c/e.css.cell.height))}}};/**
147
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
148
- * @license MIT
149
- *
150
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
151
- * @license MIT
152
- *
153
- * Originally forked from (with the author's permission):
154
- * Fabrice Bellard's javascript vt100 for jslinux:
155
- * http://bellard.org/jslinux/
156
- * Copyright (c) 2011 Fabrice Bellard
157
- */var e3=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){let r=r3.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 t3(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 r3=class Rl{static computeLink(t,r,n,i){let s=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=Rl._getWindowedLineStrings(t-1,n),a=o.join(""),c,h=[];for(;c=s.exec(a);){let u=c[0];if(!t3(u))continue;let[d,f]=Rl._mapStrIdx(n,l,0,c.index),[g,m]=Rl._mapStrIdx(n,d,f,u.length);if(d===-1||f===-1||g===-1||m===-1)continue;let w={start:{x:f+1,y:d+1},end:{x:m,y:g+1}};h.push({range:w,text:u,activate:i})}return h}static _getWindowedLineStrings(t,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]}},n3=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function i3(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 s3=class{constructor(e=i3,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||n3;this._linkProvider=this._terminal.registerLinkProvider(new e3(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const xm={background:"#0f1117",foreground:"#cdd6f4",cursor:"#f38ba8",cursorAccent:"#0f1117",selectionBackground:"rgba(166, 227, 161, 0.3)",selectionForeground:"#cdd6f4",black:"#45475a",red:"#f38ba8",green:"#a6e3a1",yellow:"#f9e2af",blue:"#89b4fa",magenta:"#cba6f7",cyan:"#94e2d5",white:"#bac2de",brightBlack:"#585b70",brightRed:"#f38ba8",brightGreen:"#a6e3a1",brightYellow:"#f9e2af",brightBlue:"#89b4fa",brightMagenta:"#cba6f7",brightCyan:"#94e2d5",brightWhite:"#a6adc8"},o1=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 GI({cursorBlink:!0,cursorStyle:"bar",fontSize:r,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:xm,allowTransparency:!0,scrollback:5e3,convertEol:!1}),h=new JI,u=new s3;c.loadAddon(h),c.loadAddon(u),c.open(i.current),requestAnimationFrame(()=>{h.fit(),t==null||t(c.cols,c.rows),a(!0)});const d=c.onData(g=>{e(g)}),f=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{h.fit(),t==null||t(c.cols,c.rows)}catch{}})});return f.observe(i.current),s.current=c,o.current=h,()=>{d.dispose(),f.disconnect(),c.dispose(),s.current=null,o.current=null}},[r]),p.jsx("div",{ref:i,style:{width:"100%",height:"100%",background:xm.background,borderRadius:8,overflow:"hidden",opacity:l?1:0,transition:"opacity 0.2s ease"}})});o1.displayName="CliTerminal";function wm({label:e,value:t,sub:r,icon:n}){return p.jsxs("div",{style:{padding:"14px 16px",borderRadius:12,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[p.jsx("span",{style:{fontSize:16},children:n}),p.jsx("span",{style:{fontSize:10,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.5px",fontWeight:600},children:e})]}),p.jsx("div",{style:{fontSize:22,fontWeight:700,color:"#f1f5f9",letterSpacing:"-0.02em"},children:t}),r&&p.jsx("div",{style:{fontSize:11,color:"#64748b",marginTop:2},children:r})]})}function bm({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",{style:{flex:1},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:3},children:[p.jsx("span",{style:{fontSize:9,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.5px",fontWeight:600},children:r}),p.jsxs("span",{style:{fontSize:10,color:"#94a3b8",fontWeight:600},children:[o,"%"]})]}),p.jsx("div",{style:{height:4,background:"rgba(255,255,255,0.04)",borderRadius:2,overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",width:`${o}%`,borderRadius:2,background:l,transition:"width 0.5s ease"}})})]}):p.jsxs("div",{style:{flex:1},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:6},children:[p.jsx("span",{style:{fontSize:11,color:"#94a3b8",fontWeight:500},children:r}),p.jsxs("span",{style:{fontSize:13,color:"#e2e8f0",fontWeight:700},children:[o,"%"]})]}),p.jsx("div",{style:{height:6,background:"rgba(255,255,255,0.04)",borderRadius:3,overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",width:`${o}%`,borderRadius:3,background:`linear-gradient(90deg, ${l}, ${l}cc)`,transition:"width 0.6s ease"}})}),i&&p.jsx("div",{style:{fontSize:10,color:"#64748b",marginTop:3},children:i})]})}function o3({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),[g,m]=b.useState(null),[w,_]=b.useState(""),[,v]=b.useState(!1),[y,T]=b.useState(!1),[R,x]=b.useState(!1),j=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[H,U]=b.useState(j?"mouse":"touch"),[E,I]=b.useState(1),[M,L]=b.useState(0),[W,A]=b.useState(0),O=b.useRef(0),K=b.useRef(t),P=b.useRef(r),$=b.useRef(n),S=b.useRef(null),Q=b.useRef(null),le=b.useRef(!1),C=b.useRef(null),ge=b.useRef(0),ie=b.useRef(null),N=b.useRef(1),Y=b.useRef({x:0,y:0}),te=b.useRef(E),ue=b.useRef(M),_e=b.useRef(W),z=b.useRef(H);b.useEffect(()=>{K.current=t},[t]),b.useEffect(()=>{P.current=r},[r]),b.useEffect(()=>{te.current=E},[E]),b.useEffect(()=>{ue.current=M},[M]),b.useEffect(()=>{_e.current=W},[W]),b.useEffect(()=>{$.current=n},[n]),b.useEffect(()=>{z.current=H},[H]),b.useEffect(()=>{var re;(re=l.current)==null||re.focus()},[]);const Te=s==="connected",ye=s!=="connected"&&s!=="connecting",Qe=Te&&o?o:e;b.useEffect(()=>{E<=1&&(L(0),A(0))},[E]);const Pe=(re,pe,D)=>{if(D<=1)return{x:0,y:0};const G=(D-1)/(2*D)*100,B=(D-1)/(2*D)*100;return{x:Math.max(-G,Math.min(G,re)),y:Math.max(-B,Math.min(B,pe))}};b.useEffect(()=>{if(!h||!ye)return;let re=null;const pe=()=>{re&&clearInterval(re),!document.hidden&&(re=setInterval(()=>{var G;if(!K.current){const B=((G=l.current)==null?void 0:G.clientWidth)||0,F=Math.max(400,Math.ceil(B/100)*100);P.current(F)}},d))},D=()=>{document.hidden?(re&&clearInterval(re),re=null):pe()};return pe(),document.addEventListener("visibilitychange",D),()=>{re&&clearInterval(re),document.removeEventListener("visibilitychange",D)}},[h,ye,d]);const mr=(re,pe)=>{if(!c.current)return null;const D=c.current.getBoundingClientRect();return!D.width||!D.height?null:{nx:Math.max(0,Math.min(1,(re-D.left)/D.width)),ny:Math.max(0,Math.min(1,(pe-D.top)/D.height))}},nr=async re=>{var D;const pe=mr(re.clientX,re.clientY);if(pe){m(`Click: ${Math.round(pe.nx*100)}%, ${Math.round(pe.ny*100)}%`),(D=l.current)==null||D.focus();try{const G=await n("input_click",{nx:pe.nx,ny:pe.ny});G!=null&&G.success||i(`❌ Click failed: ${G==null?void 0:G.error}`)}catch(G){i(`❌ Click error: ${G.message||G}`)}}},Wr=async(re,pe,D,G=0)=>{try{await n("input_key",{type:D?"char":"keyDown",key:re,code:pe,text:D?re:void 0,unmodifiedText:D?re:void 0,modifiers:G})}catch(B){i(`❌ Key error: ${B.message||B}`)}},an=async re=>{if(re.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(re.key)&&re.preventDefault();let D=0;re.altKey&&(D|=1),re.ctrlKey&&(D|=2),re.metaKey&&(D|=4),re.shiftKey&&(D|=8),m(`Key: ${re.key}`),await Wr(re.key,re.code,re.key.length===1,D)},Hr=async re=>{if(re.key==="Enter"){if(re.nativeEvent.isComposing)return;if(w){const pe=w;_(""),m(`IME Sent: ${pe}`);try{const D=await n("input_type",{text:pe});D!=null&&D.success||i(`❌ IME error: ${D==null?void 0:D.error}`)}catch(D){i(`❌ IME error: ${D.message}`)}}else m("Key: Enter"),await Wr("Enter","Enter",!1)}};b.useEffect(()=>{const re=l.current;if(!re)return;const pe=D=>{var G;if((G=c.current)!=null&&G.contains(D.target)){D.preventDefault();const B=Date.now();if(B-O.current<40)return;O.current=B;const F=mr(D.clientX,D.clientY);if(!F)return;m(`Scroll: ${Math.round(D.deltaY)}`),n("input_wheel",{nx:F.nx,ny:F.ny,deltaX:Math.round(D.deltaX),deltaY:Math.round(D.deltaY)}).catch(()=>{})}};return re.addEventListener("wheel",pe,{passive:!1}),()=>re.removeEventListener("wheel",pe)},[n]);const[Tr,Ur]=b.useState(null),wt=b.useRef(null);return b.useEffect(()=>{if(H==="mouse"&&!wt.current){const re={nx:.5,ny:.5};wt.current=re,Ur(re)}},[H]),b.useEffect(()=>{const re=l.current;if(!re)return;const pe=X=>{if(!c.current)return null;const J=c.current.getBoundingClientRect();return!J.width||!J.height?null:{nx:Math.max(0,Math.min(1,(X.clientX-J.left)/J.width)),ny:Math.max(0,Math.min(1,(X.clientY-J.top)/J.height))}},D=(X,J)=>{if(!c.current)return{dnx:0,dny:0};const oe=c.current,ae=oe.getBoundingClientRect(),fe=oe.naturalWidth||ae.width,ce=oe.naturalHeight||ae.height,k=fe/ce,Z=ae.width/ae.height;let ve,we;return k>Z?(ve=ae.width,we=ae.width/k):(we=ae.height,ve=ae.height*k),{dnx:X/ve,dny:J/we}},G=(X,J,oe)=>{if(oe<=1.05)return;const ae=-(X-.5)*100,fe=-(J-.5)*100,ce=Pe(ae,fe,oe);(Math.abs(ce.x-ue.current)>.1||Math.abs(ce.y-_e.current)>.1)&&(L(ce.x),A(ce.y),ue.current=ce.x,_e.current=ce.y)},B=X=>{if(X.preventDefault(),X.touches.length===1){const J=X.touches[0];S.current={x:J.clientX,y:J.clientY,time:Date.now()},Q.current={x:J.clientX,y:J.clientY},le.current=!1,C.current=setTimeout(()=>{if(!le.current)if(le.current=!0,z.current==="mouse"){const oe=wt.current||{nx:.5,ny:.5};m("Right Click"),$.current("input_click",{...oe,button:"right"}).catch(()=>{})}else{const oe=pe(J);oe&&(m("Right Click"),$.current("input_click",{...oe,button:"right"}).catch(()=>{}))}},500)}else if(X.touches.length===2){clearTimeout(C.current),le.current=!0;const J=X.touches[1].clientX-X.touches[0].clientX,oe=X.touches[1].clientY-X.touches[0].clientY;ie.current=Math.sqrt(J*J+oe*oe),N.current=te.current,Y.current={x:(X.touches[0].clientX+X.touches[1].clientX)/2,y:(X.touches[0].clientY+X.touches[1].clientY)/2}}},F=X=>{if(X.preventDefault(),X.touches.length===1&&Q.current){const J=X.touches[0],oe=J.clientX-Q.current.x,ae=J.clientY-Q.current.y;if(!le.current&&(Math.abs(oe)>10||Math.abs(ae)>10)&&(le.current=!0,clearTimeout(C.current)),le.current)if(z.current==="mouse"){const fe=D(oe,ae),ce=wt.current||{nx:.5,ny:.5},k=Math.max(0,Math.min(1,ce.nx+fe.dnx)),Z=Math.max(0,Math.min(1,ce.ny+fe.dny));wt.current={nx:k,ny:Z},Ur({nx:k,ny:Z}),m(`Cursor: ${Math.round(k*100)}%, ${Math.round(Z*100)}%`),G(k,Z,te.current);const ve=Date.now();ve-O.current>=30&&(O.current=ve,$.current("input_mouseMoved",{nx:k,ny:Z}).catch(()=>{}))}else if(te.current>1){const fe=a.current;if(fe){const ce=fe.clientWidth,k=fe.clientHeight,Z=ue.current+oe/ce*100,ve=_e.current+ae/k*100,we=Pe(Z,ve,te.current);L(we.x),A(we.y),ue.current=we.x,_e.current=we.y}}else{const fe=pe(J);if(fe){const ce=Date.now();ce-O.current>=40&&(O.current=ce,m("Scroll"),$.current("input_wheel",{nx:fe.nx,ny:fe.ny,deltaX:Math.round(-oe*2.5),deltaY:Math.round(-ae*2.5)}).catch(()=>{}))}}Q.current={x:J.clientX,y:J.clientY}}else if(X.touches.length===2&&ie.current!==null){const J=X.touches[1].clientX-X.touches[0].clientX,oe=X.touches[1].clientY-X.touches[0].clientY,fe=Math.sqrt(J*J+oe*oe)/ie.current,ce=(X.touches[0].clientX+X.touches[1].clientX)/2,k=(X.touches[0].clientY+X.touches[1].clientY)/2,Z=ce-Y.current.x,ve=k-Y.current.y,we=Math.abs(fe-1)>.03;if(z.current==="mouse"){if(we){const Ae=Math.max(.5,Math.min(5,N.current*fe));I(Ae),te.current=Ae}else if(Math.abs(Z)>2||Math.abs(ve)>2){const Ae=wt.current||{nx:.5,ny:.5},ze=Date.now();ze-O.current>=30&&(O.current=ze,m("Scroll"),$.current("input_wheel",{nx:Ae.nx,ny:Ae.ny,deltaX:Math.round(-Z*3),deltaY:Math.round(-ve*3)}).catch(()=>{}))}}else{const Ae=Math.max(.5,Math.min(5,N.current*fe));I(Ae),te.current=Ae;const ze=a.current;if(ze&&Ae>1){const mi=ze.clientWidth,c1=ze.clientHeight,u1=ue.current+Z/mi*100,h1=_e.current+ve/c1*100,Mo=Pe(u1,h1,Ae);L(Mo.x),A(Mo.y),ue.current=Mo.x,_e.current=Mo.y}}Y.current={x:ce,y:k}}},V=X=>{var J;if(clearTimeout(C.current),ie.current=null,X.touches.length===0&&X.changedTouches.length===1&&!le.current){const oe=X.changedTouches[0],ae=Date.now();if(ae-(((J=S.current)==null?void 0:J.time)||0)<40)return;if(z.current==="mouse"){const ce=wt.current||pe(oe);ce&&(m(`Click: ${Math.round(ce.nx*100)}%, ${Math.round(ce.ny*100)}%`),$.current("input_click",{...ce}).catch(()=>{}))}else{const ce=pe(oe);if(!ce)return;ae-ge.current<300?(m("Double tap"),$.current("input_click",{...ce,clickCount:2}).catch(()=>{}),ge.current=0):(m(`Tap: ${Math.round(ce.nx*100)}%, ${Math.round(ce.ny*100)}%`),$.current("input_click",{...ce}).catch(()=>{}),ge.current=ae)}}le.current=!1};return re.addEventListener("touchstart",B,{passive:!1}),re.addEventListener("touchmove",F,{passive:!1}),re.addEventListener("touchend",V,{passive:!1}),()=>{re.removeEventListener("touchstart",B),re.removeEventListener("touchmove",F),re.removeEventListener("touchend",V),clearTimeout(C.current)}},[]),p.jsxs("div",{ref:l,style:{flex:1,display:"flex",flexDirection:"column",background:"#000",position:"relative",overflow:"hidden",outline:"none",touchAction:"none"},onKeyDown:an,onContextMenu:re=>re.preventDefault(),onFocus:()=>v(!0),onBlur:()=>v(!1),tabIndex:0,children:[p.jsxs("div",{ref:a,style:{flex:1,position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",background:"#000"},children:[Qe?p.jsx("img",{ref:c,src:Qe,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${E}) translate(${M}%, ${W}%)`,transformOrigin:"center center",cursor:H==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:nr,onContextMenu:re=>re.preventDefault(),onDragStart:re=>re.preventDefault()}):p.jsxs("div",{style:{color:"#333",textAlign:"center"},children:[p.jsx("div",{style:{fontSize:48,marginBottom:12},children:"🌑"}),p.jsx("div",{style:{fontSize:13,fontWeight:600},children:"Connecting to Host..."})]}),H==="mouse"&&Tr&&Qe&&c.current&&(()=>{var ve;const re=c.current,pe=re.getBoundingClientRect(),D=(ve=a.current)==null?void 0:ve.getBoundingClientRect();if(!D)return null;const G=re.naturalWidth||pe.width,B=re.naturalHeight||pe.height,F=G/B,V=pe.width/pe.height;let X,J,oe,ae;F>V?(X=pe.width,J=pe.width/F,oe=0,ae=(pe.height-J)/2):(J=pe.height,X=pe.height*F,oe=(pe.width-X)/2,ae=0);const fe=pe.left-D.left+oe+X*Tr.nx,ce=pe.top-D.top+ae+J*Tr.ny,k=Math.max(8,Math.min(D.width-8,fe)),Z=Math.max(8,Math.min(D.height-8,ce));return p.jsxs("div",{style:{position:"absolute",left:k-8,top:Z-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[p.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),p.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),p.jsx("div",{style:{position:"absolute",left:5,top:5,width:6,height:6,borderRadius:"50%",background:"#3b82f6",boxShadow:"0 0 8px rgba(59,130,246,0.6)"}})]})})()]}),p.jsxs("div",{onTouchStart:re=>re.stopPropagation(),style:{position:"absolute",bottom:0,left:0,right:0,zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 12px",background:"rgba(0,0,0,0.75)",backdropFilter:"blur(16px)",borderTop:"1px solid rgba(255,255,255,0.08)",touchAction:"none"},children:[p.jsxs("div",{onClick:()=>{U(re=>{const pe=re==="touch"?"mouse":"touch";if(pe==="mouse"&&!wt.current){const D={nx:.5,ny:.5};wt.current=D,Ur(D)}return pe})},style:{height:32,padding:"0 10px",background:H==="mouse"?"rgba(59,130,246,0.25)":"rgba(255,255,255,0.08)",borderRadius:8,display:"flex",alignItems:"center",gap:5,cursor:"pointer",border:H==="mouse"?"1px solid rgba(59,130,246,0.4)":"1px solid rgba(255,255,255,0.1)"},children:[p.jsx("span",{style:{fontSize:14},children:H==="mouse"?"🖱️":"👆"}),p.jsx("span",{style:{fontSize:10,fontWeight:700,color:H==="mouse"?"#60a5fa":"#94a3b8"},children:H==="mouse"?"Mouse":"Touch"})]}),p.jsxs("div",{style:{position:"relative"},children:[p.jsx("div",{onClick:()=>{x(!R),T(!1)},style:{width:32,height:32,background:R?"rgba(16,185,129,0.25)":"rgba(255,255,255,0.08)",borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:R?"1px solid rgba(16,185,129,0.4)":"1px solid rgba(255,255,255,0.1)"},children:p.jsx("span",{style:{fontSize:14},children:"⌨️"})}),R&&p.jsx("div",{style:{position:"absolute",bottom:40,left:"50%",transform:"translateX(-50%)",width:220,background:"rgba(23,23,23,0.98)",backdropFilter:"blur(30px)",borderRadius:12,border:"1px solid rgba(255,255,255,0.2)",padding:"10px 12px",boxShadow:"0 10px 30px rgba(0,0,0,0.8)",display:"flex",flexDirection:"column",gap:8,animation:"slideUp 0.15s ease-out",zIndex:2e3},children:p.jsx("input",{type:"text",placeholder:"Type & Enter...",value:w,autoFocus:!0,onTouchStart:re=>re.stopPropagation(),onChange:re=>_(re.target.value),onKeyDown:Hr,style:{width:"100%",background:"rgba(0,0,0,0.6)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:8,padding:"8px 10px",color:"#fff",fontSize:13,outline:"none"}})})]}),p.jsx("div",{style:{position:"relative"},children:p.jsx("div",{onClick:()=>{T(!y),x(!1)},style:{width:32,height:32,background:y?"rgba(59,130,246,0.25)":"rgba(255,255,255,0.08)",borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:y?"1px solid rgba(59,130,246,0.4)":"1px solid rgba(255,255,255,0.1)"},children:p.jsx("span",{style:{fontSize:14},children:"⚙️"})})}),p.jsx("div",{style:{width:1,height:18,background:"rgba(255,255,255,0.1)"}}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:3,padding:"2px 6px",borderRadius:6,background:Te?"rgba(16,185,129,0.12)":"rgba(251,191,36,0.12)"},children:[p.jsx("div",{style:{width:4,height:4,borderRadius:"50%",background:Te?"#10b981":"#fbbf24"}}),p.jsx("span",{style:{fontSize:8,fontWeight:800,color:Te?"#10b981":"#fbbf24"},children:Te?"Connected":"WS"})]}),E>1&&p.jsxs("span",{style:{fontSize:8,fontWeight:700,color:"#6366f1"},children:[Math.round(E*100),"%"]}),g&&p.jsx("span",{style:{fontSize:8,color:"#888",fontWeight:600,maxWidth:100,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g})]})]}),y&&p.jsxs("div",{onTouchStart:re=>re.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: ",E===1?"FIT":`${Math.round(E*100)}%`]}),p.jsxs("div",{style:{display:"flex",gap:4},children:[p.jsx("button",{onClick:re=>{re.stopPropagation(),I(pe=>Math.max(.5,pe-.25))},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"−"}),p.jsx("button",{onClick:re=>{re.stopPropagation(),I(1),L(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:re=>{re.stopPropagation(),I(pe=>Math.min(5,pe+.25))},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"+"})]})]}),p.jsx("button",{onClick:re=>{var G;re.stopPropagation();const pe=((G=l.current)==null?void 0:G.clientWidth)||0,D=pe>0?Math.max(400,Math.ceil(pe/100)*100):void 0;r(D)},style:{width:"100%",background:"#3b82f6",color:"#fff",border:"none",padding:"8px",borderRadius:6,fontSize:11,fontWeight:800,cursor:"pointer"},children:"FORCE SYNC"}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(255,255,255,0.05)",padding:"6px 10px",borderRadius:6},children:[p.jsx("span",{style:{fontSize:10,color:"#888",fontWeight:700},children:"AUTO REF."}),p.jsx("input",{type:"checkbox",checked:h,onChange:re=>u(re.target.checked)})]}),p.jsxs("select",{value:d,onChange:re=>f(Number(re.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
- @keyframes slideUp {
159
- from { opacity: 0; transform: translateY(6px); }
160
- to { opacity: 1; transform: translateY(0); }
161
- }
162
- @keyframes slideUpSidebar {
163
- from { opacity: 0; transform: translateY(6px); }
164
- to { opacity: 1; transform: translateY(0); }
165
- }
166
- `})]})}function l1({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",{style:{background:"linear-gradient(135deg, #d97706, #b45309)",color:"white",padding:"10px 16px",flexShrink:0,zIndex:5},children:[e.modalMessage&&p.jsx("div",{style:{fontSize:11,opacity:.85,marginBottom:6,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:e.modalMessage.replace(/[\n\r]+/g," ").slice(0,120)}),p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[p.jsxs("div",{style:{fontWeight:900,fontSize:12,display:"flex",alignItems:"center",gap:8},children:[p.jsx("span",{children:"⚠️"})," ",r?"PROCESSING...":"ACTION REQUIRED"]}),p.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.modalButtons.map((s,o)=>{const l=s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),a=/^(run|approve|accept|yes|allow|always)/.test(l),c=/^(reject|deny|delete|remove|abort)/.test(l),h=r===s,u=r!==null;return p.jsx("button",{onClick:()=>i(s),disabled:u,className:"btn btn-sm",style:{background:a?"white":c?"rgba(239,68,68,0.3)":"rgba(255,255,255,0.15)",color:a?"#b45309":"white",border:"none",fontWeight:a?800:600,borderRadius:6,fontSize:12,padding:"4px 12px",opacity:u&&!h?.4:1,cursor:u?"not-allowed":"pointer"},children:h?"⏳ ...":s.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim()},o)})})]})]})}const sr=new Map;function l3({ideId:e,ideType:t,agentType:r,agentName:n,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var ie;const{sendCommand:a}=On(),c=!!(o||l),h=`${e}:${r}`,u=sr.get(h),[d,f]=b.useState(!1),[g,m]=b.useState(!1),[w,_]=b.useState((u==null?void 0:u.models)||[]),[v,y]=b.useState((u==null?void 0:u.modes)||[]),[T,R]=b.useState(i||""),[x,j]=b.useState(s||""),[H,U]=b.useState(!1),[E,I]=b.useState(!1),M=b.useRef(0);b.useEffect(()=>{if(o){const N=o.find(Y=>Y.category==="model");if(N){const Y=N.options.map(ue=>ue.value);_(Y),N.currentValue&&R(N.currentValue);const te=sr.get(h)||{models:[],modes:[]};sr.set(h,{...te,models:Y})}}if(l&&l.length>0){const N=l.map(te=>te.id);y(N);const Y=sr.get(h)||{models:[],modes:[]};sr.set(h,{...Y,modes:N})}else if(o){const N=o.find(Y=>Y.category!=="model");if(N){const Y=N.options.map(ue=>ue.value);y(Y),N.currentValue&&j(N.currentValue);const te=sr.get(h)||{models:[],modes:[]};sr.set(h,{...te,modes:Y})}}},[o,l,h]),b.useEffect(()=>{f(!1),m(!1),R(i||""),j(s||"");const N=sr.get(h);N?(_(N.models),y(N.modes)):(_([]),y([]))},[e,r]),b.useEffect(()=>{i&&Date.now()>M.current&&R(i)},[i]),b.useEffect(()=>{s&&Date.now()>M.current&&j(s)},[s]);const L=b.useCallback(async(N,Y={})=>{const te={...Y},ue=e.split(":");return ue.length>=3&&(ue[1]==="ide"||ue[1]==="cli"||ue[1]==="acp")&&(te._targetInstance=ue.slice(2).join(":"),te._targetType=ue[1]),await a(e,N,te)},[e]),W=async()=>{var N,Y;if(w.length>0){f(!d);return}if(c){f(!0);return}U(!0);try{const te=await L("list_extension_models",{agentType:r,ideType:t}),ue=(te==null?void 0:te.models)||((N=te==null?void 0:te.result)==null?void 0:N.models)||[];_(ue),te!=null&&te.current&&R(te.current),(Y=te==null?void 0:te.result)!=null&&Y.current&&R(te.result.current);const _e=sr.get(h)||{models:[],modes:[]};sr.set(h,{..._e,models:ue}),f(!0)}catch{}finally{U(!1)}},A=async()=>{var N,Y;if(v.length>0){m(!g);return}if(c){m(!0);return}I(!0);try{const te=await L("list_extension_modes",{agentType:r,ideType:t}),ue=(te==null?void 0:te.modes)||((N=te==null?void 0:te.result)==null?void 0:N.modes)||[];y(ue),te!=null&&te.current&&j(te.current),(Y=te==null?void 0:te.result)!=null&&Y.current&&j(te.result.current);const _e=sr.get(h)||{models:[],modes:[]};sr.set(h,{..._e,modes:ue}),m(!0)}catch{}finally{I(!1)}},O=async N=>{f(!1),R(N),M.current=Date.now()+5e3;try{c?await L("change_model",{agentType:r,ideType:t,model:N}):await L("set_extension_model",{agentType:r,ideType:t,model:N})}catch{}},K=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(N=>N.category!=="model")),P=K?(ie=o==null?void 0:o.find(N=>N.category!=="model"))==null?void 0:ie.configId:void 0,$=async N=>{m(!1),j(N),M.current=Date.now()+5e3;try{c&&K&&P?await L("set_thought_level",{agentType:r,ideType:t,configId:P,value:N}):c?await L("set_mode",{agentType:r,ideType:t,mode:N}):await L("set_extension_mode",{agentType:r,ideType:t,mode:N})}catch{}},Q={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[r]||"#94a3b8",le={display:"inline-flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:12,fontSize:10,fontWeight:500,cursor:"pointer",border:"1px solid transparent",transition:"all 0.15s",background:"var(--surface-tertiary)",color:"var(--text-secondary)",whiteSpace:"nowrap",maxWidth:160,overflow:"hidden",textOverflow:"ellipsis"},C={position:"absolute",bottom:"100%",left:0,zIndex:60,background:"var(--surface-primary)",border:"1px solid var(--border-subtle)",borderRadius:8,marginBottom:4,maxHeight:220,overflowY:"auto",minWidth:160,boxShadow:"0 -4px 16px rgba(0,0,0,0.3)"},ge=N=>({padding:"7px 12px",fontSize:11,cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",background:N?`${Q}18`:"transparent",color:N?Q:"var(--text-secondary)",fontWeight:N?600:400,borderLeft:N?`2px solid ${Q}`:"2px solid transparent"});return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",flexWrap:"wrap",fontSize:10,borderTop:"1px solid var(--border-subtle)",background:"var(--surface-primary)"},children:[p.jsx("span",{style:{fontSize:9,fontWeight:700,color:Q,letterSpacing:"0.03em",textTransform:"uppercase",opacity:.7},children:n}),p.jsx("span",{style:{color:"var(--border-subtle)",fontSize:10},children:"│"}),p.jsxs("div",{style:{position:"relative"},children:[p.jsxs("span",{style:{...le,borderColor:d?`${Q}55`:"transparent",color:T?"var(--text-primary)":"var(--text-muted)"},onClick:W,children:[p.jsx("span",{style:{fontSize:9,opacity:.6},children:"🤖"}),H?"...":T||"Model",p.jsx("span",{style:{fontSize:7,opacity:.5},children:"▼"})]}),d&&w.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{style:{position:"fixed",inset:0,zIndex:59},onClick:()=>f(!1)}),p.jsxs("div",{style:C,children:[p.jsx("div",{style:{padding:"6px 12px",fontSize:9,fontWeight:700,color:"var(--text-muted)",letterSpacing:"0.05em",borderBottom:"1px solid var(--border-subtle)"},children:"SELECT MODEL"}),w.map(N=>p.jsx("div",{style:ge(N===T),onMouseEnter:Y=>{Y.currentTarget.style.background=`${Q}12`},onMouseLeave:Y=>{Y.currentTarget.style.background=N===T?`${Q}18`:"transparent"},onClick:()=>O(N),children:N},N))]})]})]}),p.jsxs("div",{style:{position:"relative"},children:[p.jsxs("span",{style:{...le,borderColor:g?`${Q}55`:"transparent",color:x?"var(--text-primary)":"var(--text-muted)"},onClick:A,children:[p.jsx("span",{style:{fontSize:9,opacity:.6},children:K?"🧠":"⚡"}),E?"...":x||(K?"Thinking":"Mode"),p.jsx("span",{style:{fontSize:7,opacity:.5},children:"▼"})]}),g&&v.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{style:{position:"fixed",inset:0,zIndex:59},onClick:()=>m(!1)}),p.jsxs("div",{style:C,children:[p.jsx("div",{style:{padding:"6px 12px",fontSize:9,fontWeight:700,color:"var(--text-muted)",letterSpacing:"0.05em",borderBottom:"1px solid var(--border-subtle)"},children:K?"SELECT THINKING LEVEL":"SELECT MODE"}),v.map(N=>p.jsx("div",{style:ge(N===x),onMouseEnter:Y=>{Y.currentTarget.style.background=`${Q}12`},onMouseLeave:Y=>{Y.currentTarget.style.background=N===x?`${Q}18`:"transparent"},onClick:()=>$(N),children:N},N))]})]})]})]})}function a3({ideId:e,providerType:t,providerName:r,onClose:n}){const{sendCommand:i}=On(),[s,o]=b.useState([]),[l,a]=b.useState({}),[c,h]=b.useState(!0),[u,d]=b.useState(null),f=b.useRef(!0);b.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),b.useEffect(()=>{(async()=>{h(!0);try{const x=await i(e,"get_provider_settings",{providerType:t});if(!f.current)return;x!=null&&x.success&&(o(x.schema||[]),a(x.values||{}))}catch(x){console.warn("[ProviderSettings] fetch failed:",x)}finally{f.current&&h(!1)}})()},[e,t]);const g=b.useCallback(async(x,j)=>{a(H=>({...H,[x]:j})),d(x);try{await i(e,"set_provider_setting",{providerType:t,key:x,value:j})}catch(H){console.warn("[ProviderSettings] set failed:",H),a(U=>{const E=s.find(I=>I.configId===x||I.key===x);return{...U,[x]:(E==null?void 0:E.default)??U[x]}})}finally{f.current&&d(null)}},[e,t,s]),m={position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:100,background:"var(--bg-primary)",display:"flex",flexDirection:"column",overflow:"hidden"},w={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-primary)",flexShrink:0},_={flex:1,overflowY:"auto",padding:"12px 16px"},v={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 0",borderBottom:"1px solid var(--border-subtle)",gap:12},y={fontSize:13,fontWeight:500,color:"var(--text-primary)"},T={fontSize:11,color:"var(--text-muted)",marginTop:2},R=s.filter(x=>x.public!==!1).map(x=>({key:x.key||x.configId||x.name||"",...x}));return p.jsxs("div",{style:m,children:[p.jsxs("div",{style:w,children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx("span",{style:{fontSize:16},children:"⚙️"}),p.jsxs("div",{children:[p.jsxs("div",{style:{fontSize:14,fontWeight:700,color:"var(--text-primary)"},children:[r," Settings"]}),p.jsx("div",{style:{fontSize:10,color:"var(--text-muted)"},children:t})]})]}),p.jsx("button",{onClick:n,style:{background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontSize:18,padding:"4px 8px",borderRadius:6,transition:"all 0.15s"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-tertiary)"},onMouseLeave:x=>{x.currentTarget.style.background="none"},children:"✕"})]}),p.jsx("div",{style:_,children:c?p.jsx("div",{style:{textAlign:"center",padding:40,color:"var(--text-muted)"},children:"Loading settings..."}):R.length===0?p.jsxs("div",{style:{textAlign:"center",padding:40,color:"var(--text-muted)"},children:[p.jsx("div",{style:{fontSize:24,marginBottom:8},children:"📋"}),"No configurable settings for this provider"]}):R.map(x=>p.jsxs("div",{style:v,children:[p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsxs("div",{style:y,children:[x.label||x.key,u===x.key&&p.jsx("span",{style:{marginLeft:6,fontSize:10,color:"var(--accent-primary)"},children:"saving..."})]}),x.description&&p.jsx("div",{style:T,children:x.description})]}),p.jsx("div",{style:{flexShrink:0},children:x.type==="boolean"?p.jsx(c3,{checked:l[x.key]??x.default??!1,onChange:j=>g(x.key,j)}):x.type==="number"?p.jsx(u3,{value:l[x.key]??x.default??0,min:x.min,max:x.max,onChange:j=>g(x.key,j)}):x.type==="select"&&x.options?p.jsx("select",{value:l[x.key]??x.default??"",onChange:j=>g(x.key,j.target.value),style:{background:"var(--surface-tertiary)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"4px 8px",fontSize:12},children:x.options.map(j=>p.jsx("option",{value:j,children:j},j))}):p.jsx("input",{type:"text",value:l[x.key]??x.default??"",onChange:j=>g(x.key,j.target.value),style:{background:"var(--surface-tertiary)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"4px 8px",fontSize:12,width:120}})})]},x.key))})]})}function c3({checked:e,onChange:t}){return p.jsx("button",{onClick:()=>t(!e),style:{width:40,height:22,borderRadius:11,border:"none",background:e?"var(--accent-primary)":"var(--surface-tertiary)",position:"relative",cursor:"pointer",transition:"background 0.2s",outline:"none"},children:p.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:"white",position:"absolute",top:3,left:e?21:3,transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"}})})}function u3({value:e,min:t,max:r,onChange:n}){const[i,s]=b.useState(String(e));b.useEffect(()=>{s(String(e))},[e]);const o=()=>{let l=parseInt(i)||0;t!==void 0&&(l=Math.max(t,l)),r!==void 0&&(l=Math.min(r,l)),s(String(l)),l!==e&&n(l)};return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[p.jsx("input",{type:"number",value:i,min:t,max:r,onChange:l=>s(l.target.value),onBlur:o,onKeyDown:l=>{l.key==="Enter"&&o()},style:{width:70,background:"var(--surface-tertiary)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"4px 8px",fontSize:12,textAlign:"center"}}),t!==void 0&&r!==void 0&&p.jsxs("span",{style:{fontSize:9,color:"var(--text-muted)"},children:[t,"–",r]})]})}const Gt=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),wr=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function a1({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}=On(),[u,d]=b.useState([]),[f,g]=b.useState(0),[m,w]=b.useState(!0),[_,v]=b.useState(!1),[y,T]=b.useState(!1),R=b.useRef("");e.tabKey!==R.current&&(R.current=e.tabKey,d([]),g(0),w(!0));const x=b.useCallback(async()=>{var U,E,I,M,L;if(!(_||!m)){v(!0);try{const W=t.find(S=>S.id===e.ideId),A=(W==null?void 0:W.daemonId)||((U=e.ideId)==null?void 0:U.split(":")[0])||"";if(!A){w(!1);return}const O=e.ideType||e.agentType||"",K=(e.ideId||"").split(":"),P=K.length>=3?K.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:A,agentType:O,instanceId:P,offset:f});const $=await h(A,"chat_history",{agentType:O,offset:f,limit:30,instanceId:P});console.log("[ChatPane] got result:",{count:((E=$.messages)==null?void 0:E.length)||0,hasMore:$.hasMore}),((I=$.messages)==null?void 0:I.length)>0&&(d(S=>[...$.messages,...S]),g(S=>S+$.messages.length)),w($.hasMore)}catch(W){console.warn("[ChatPane] Failed to load history:",W),!((M=W==null?void 0:W.message)!=null&&M.includes("P2P not available"))&&!((L=W==null?void 0:W.message)!=null&&L.includes("channel not open"))&&w(!1)}finally{v(!1)}}},[_,m,f,t,e]),j=b.useRef(0);b.useEffect(()=>{if(e.messages.length<10&&m&&!_&&u.length===0){const U=j.current;if(U>5)return;const I=setTimeout(()=>{j.current=U+1,x()},U===0?0:2e3);return()=>clearTimeout(I)}else u.length>0&&(j.current=0)},[e.tabKey,e.messages.length,m,_,u.length,x]);const H=(()=>{const U=e.messages.map((M,L)=>{const W=`${e.ideId}-${M.id??`i-${L}`}`;return{...M,receivedAt:M.receivedAt||l[W]||0}});if(u.length===0)return U;const E=new Set(U.map(M=>`${M.role}:${(M.content||"").slice(0,100)}`));return[...u.filter(M=>!E.has(`${M.role}:${(M.content||"").slice(0,100)}`)),...U]})();return p.jsxs(p.Fragment,{children:[p.jsx(g0,{messages:H,actionLogs:a.filter(U=>U.ideId===e.tabKey).sort((U,E)=>U.timestamp-E.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",isCliMode:Gt(e)||wr(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:x,isLoadingMore:_,hasMoreHistory:m,emptyState:e.messages.length===0?e.status==="not_monitored"?p.jsxs("div",{style:{textAlign:"center",marginTop:60,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[p.jsx("div",{style:{fontSize:28,opacity:.6},children:"🔌"}),p.jsx("div",{style:{fontSize:13,opacity:.5},children:"Agent not monitored"}),p.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm",style:{background:"var(--accent-primary)",color:"white",border:"none",borderRadius:10,padding:"8px 20px",fontWeight:700,fontSize:13,cursor:"pointer",transition:"all 0.2s"},children:o?"⌛ Switching...":`📂 Open ${e.displayPrimary} Panel`}),p.jsx("div",{style:{fontSize:11,opacity:.35,maxWidth:280},children:"Click to switch monitoring to this agent"})]}):e.status==="panel_hidden"?p.jsxs("div",{style:{textAlign:"center",marginTop:60,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[p.jsx("div",{style:{fontSize:28,opacity:.6},children:"👁️‍🗨️"}),p.jsx("div",{style:{fontSize:13,opacity:.5},children:"Panel is not visible in IDE"}),p.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm",style:{background:"var(--accent-primary)",color:"white",border:"none",borderRadius:10,padding:"8px 20px",fontWeight:700,fontSize:13,cursor:"pointer",transition:"all 0.2s"},children:o?"⌛ Opening...":`📂 Open ${e.displayPrimary} Panel`}),p.jsx("div",{style:{fontSize:11,opacity:.35,maxWidth:280},children:"Open the agent sidebar in your IDE to start viewing messages"})]}):void 0:void 0}),!Gt(e)&&(()=>{const U=t.find(E=>E.id===e.ideId);return p.jsx(l3,{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:(U==null?void 0:U.currentModel)||void 0,serverMode:(U==null?void 0:U.currentPlan)||void 0,acpConfigOptions:wr(e)?U==null?void 0:U.acpConfigOptions:void 0,acpModes:wr(e)?U==null?void 0:U.acpModes:void 0})})(),p.jsx("div",{className:"dashboard-input-area",style:{padding:"10px 12px",background:"var(--surface-primary)",borderTop:"1px solid var(--border-subtle)",flexShrink:0},children:p.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[p.jsx("div",{style:{flex:1,position:"relative"},children:p.jsx("input",{ref:c,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:U=>n(U.target.value),onPaste:U=>{const E=U.clipboardData.getData("text");E&&n(I=>I+E),U.preventDefault()},onKeyDown:U=>{if(U.key==="Enter"){if(U.nativeEvent.isComposing){U.preventDefault();return}U.preventDefault(),i()}},onBlur:()=>{window.innerWidth<768&&setTimeout(()=>{document.documentElement.scrollTop=0},100)},style:{width:"100%",height:40,borderRadius:20,padding:"0 16px",background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",fontSize:14,color:"var(--text-primary)"}})}),p.jsx("button",{onClick:()=>T(U=>!U),title:"Provider Settings",style:{width:36,height:36,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:y?"var(--accent-primary)":"var(--surface-tertiary)",cursor:"pointer",flexShrink:0,transition:"all 0.2s",color:y?"white":"var(--text-muted)",fontSize:15},children:"⚙️"}),p.jsx("button",{onClick:i,disabled:!r.trim(),style:{width:40,height:40,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:r.trim()?"var(--accent-primary)":"var(--bg-secondary)",cursor:r.trim()?"pointer":"default",flexShrink:0,transition:"all 0.3s ease"},children:p.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:r.trim()?"white":"var(--text-muted)"},children:p.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})}),y&&p.jsx(a3,{ideId:e.ideId,providerType:e.streamSource==="agent-stream"?e.agentType:e.ideType,providerName:e.streamSource==="agent-stream"?e.agentName:e.displayPrimary,onClose:()=>T(!1)})]})}function h3({activeConv:e,ptyBuffers:t,terminalRef:r,agentInput:n,setAgentInput:i,handleSendChat:s,handleModalButton:o}){const l=b.useRef(null),{sendCommand:a,sendData:c}=On();return p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",background:"var(--surface-primary)",borderBottom:"1px solid var(--border-subtle)",flexShrink:0},children:[p.jsx("div",{style:{display:"flex",gap:4},children:p.jsx("div",{style:{padding:"4px 12px",borderRadius:6,fontSize:11,fontWeight:600,background:"var(--accent)",color:"#fff"},children:"⬛ Terminal"})}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)"},children:[e.agentName," — Terminal"]}),p.jsx("button",{onClick:()=>{if(!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)",style:{padding:"3px 8px",borderRadius:5,fontSize:11,background:"var(--bg-secondary)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",cursor:"pointer",lineHeight:1},children:"↺"}),p.jsx("button",{onClick:async()=>{var d;const h=(d=e.ideId)!=null&&d.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";if(!window.confirm(`Stop ${h}?
167
- This will terminate the CLI process.`))return;const u=e.ideId||e.daemonId||"";try{await a(u,"stop_cli",{cliType:h})}catch(f){console.error("Stop CLI failed:",f)}},title:"Stop CLI process",style:{padding:"3px 8px",borderRadius:5,fontSize:11,background:"rgba(239,68,68,0.08)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.3)",cursor:"pointer",lineHeight:1,fontWeight:600},children:"■ Stop"})]})]}),p.jsx(l1,{activeConv:e,onModalButton:o}),p.jsx("div",{style:{flex:1,minHeight:0,padding:8,background:"#0f1117"},children:p.jsx(o1,{ref: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 g;const d=e.ideId||e.daemonId||"",f=(g=e.ideId)!=null&&g.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(d,{type:"pty_resize",cliType:f,cols:h,rows:u})||a(d,"pty_resize",{cliType:f,cols:h,rows:u,force:!0}).catch(()=>{})}},e.tabKey)}),p.jsx("div",{style:{padding:"8px 12px",background:"var(--surface-primary)",borderTop:"1px solid var(--border-subtle)",flexShrink:0},children:p.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[p.jsx("div",{style:{flex:1,position:"relative"},children:p.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value: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()}},style:{width:"100%",height:36,borderRadius:18,padding:"0 16px",background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",fontSize:13,color:"var(--text-primary)"}})}),p.jsx("button",{onClick:s,disabled:!n.trim(),style:{width:36,height:36,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:n.trim()?"var(--accent-primary)":"var(--bg-secondary)",cursor:n.trim()?"pointer":"default",flexShrink:0,transition:"all 0.3s ease"},children:p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:n.trim()?"white":"var(--text-muted)"},children:p.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function d3({wsStatus:e,showReconnected:t,loginUrl:r}){const n=e==="disconnected"||e==="reconnecting"||e==="offline"||e==="auth_failed";return p.jsxs(p.Fragment,{children:[n&&p.jsxs("div",{style:{padding:"10px 20px",fontSize:13,fontWeight:600,display:"flex",alignItems:"center",gap:10,justifyContent:"center",background:e==="auth_failed"?"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))":e==="offline"?"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))":"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))",borderBottom:e==="auth_failed"?"1px solid rgba(239,68,68,0.2)":e==="offline"?"1px solid rgba(255,107,53,0.2)":"1px solid rgba(139,92,246,0.2)",color:e==="auth_failed"?"#ef4444":e==="offline"?"#ff6b35":"#a78bfa"},children:[p.jsx("img",{src:"/otter-logo.png",alt:"",style:{width:20,height:20,opacity:e==="auth_failed"?.6:1,animation:e==="auth_failed"?void 0:"pulse 2s ease-in-out infinite",filter:e==="auth_failed"?"grayscale(1)":void 0}}),e==="offline"&&"Network offline — waiting for connection...",e==="disconnected"&&"Reconnecting to server...",e==="reconnecting"&&"Reconnecting to server...",e==="auth_failed"&&(r?p.jsxs(p.Fragment,{children:["Session expired."," ",p.jsx("a",{href:r,style:{color:"inherit",textDecoration:"underline"},children:"Log in again"})]}):"Connection failed — please restart the server.")]}),t&&e==="connected"&&p.jsxs("div",{style:{padding:"8px 16px",fontSize:12,fontWeight:600,display:"flex",alignItems:"center",gap:8,justifyContent:"center",background:"linear-gradient(90deg, rgba(34,197,94,0.12), rgba(34,197,94,0.04))",color:"#22c55e",borderBottom:"1px solid rgba(34,197,94,0.15)",animation:"fadeIn 0.3s ease"},children:[p.jsx("img",{src:"/otter-logo.png",alt:"",style:{width:16,height:16}}),"Connected"]})]})}const Kc=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),Vc=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function f3({activeConv:e,agentCount:t,wsStatus:r,isP2PActive:n,onOpenHistory:i}){const s=ts();return p.jsxs("div",{className:"dashboard-header",children:[p.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:p.jsxs("div",{style:{lineHeight:1.25},children:[p.jsxs("h1",{className:"header-title",style:{margin:0},children:["DASHBOARD",p.jsxs("span",{className:"header-count-mobile",style:{fontSize:10,fontWeight:600,opacity:.6,marginLeft:8,letterSpacing:"0.02em"},children:[t," Active",p.jsx("span",{style:{display:"inline-block",width:5,height:5,borderRadius:"50%",marginLeft:4,verticalAlign:"middle",background:n?"#22c55e":r==="connected"?"#eab308":"#ef4444"}})]})]}),p.jsxs("div",{className:"header-subtitle",style:{fontSize:11,alignItems:"center",gap:4},children:[t," AGENTS ACTIVE",p.jsx("span",{title:n?"P2P Direct":r==="connected"?"WebSocket":"Disconnected",style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:n?"#22c55e":r==="connected"?"#eab308":"#ef4444",boxShadow:n?"0 0 4px #22c55e80":r==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480",flexShrink:0}})]})]})}),p.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e&&!Kc(e)&&!Vc(e)&&p.jsx("button",{onClick:()=>s(`/ide/${e.ideId}`),className:"btn btn-primary btn-sm",style:{border:"none",padding:"6px 12px",fontSize:12},children:"IDE"}),e&&!Kc(e)&&!Vc(e)&&p.jsx("button",{onClick:i,className:"btn btn-secondary btn-sm",style:{border:"none",background:"var(--bg-secondary)",padding:"6px 10px",display:"flex",alignItems:"center",gap:4},title:"Chat History",children:"📜"}),e&&!Kc(e)&&!Vc(e)&&p.jsx("button",{onClick:()=>s(`/ide/${e.ideId}?view=remote`),className:"btn btn-secondary btn-sm",style:{border:"none",background:"var(--bg-secondary)",padding:"6px 10px"},title:"Remote Control",children:"🖥️"})]})]})}function Ar(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function p3(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 km(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Cm(e){return(e.id||"").includes(":cli:")}function zh(e,t){return Ar(e)}function g3(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 m3({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",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"},children:[p.jsx("div",{onClick:i,style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}),p.jsxs("div",{className:"card fade-in",style:{position:"relative",width:"90%",maxWidth:500,maxHeight:"80vh",display:"flex",flexDirection:"column",padding:0,overflow:"hidden",boxShadow:"0 20px 40px rgba(0,0,0,0.4)",borderRadius:20},children:[p.jsxs("div",{style:{padding:"20px 24px",borderBottom:"1px solid var(--border-subtle)",display:"flex",justifyContent:"space-between",alignItems:"center",background:"var(--surface-primary)"},children:[p.jsxs("div",{children:[p.jsx("h3",{style:{margin:0,fontSize:18,fontWeight:800},children:"Chat History"}),p.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:2},children:[e.displayPrimary," — ",Ar(e.ideType)]})]}),p.jsx("button",{onClick:i,style:{background:"none",border:"none",fontSize:20,color:"var(--text-muted)",cursor:"pointer"},children:"✕"})]}),p.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,background:"var(--bg-primary)"},children:[p.jsx("button",{onClick:s,disabled:r,style:{width:"100%",padding:"14px",borderRadius:12,marginBottom:12,background:"rgba(99,102,241,0.1)",border:"1px dashed var(--accent-primary)",color:"var(--accent-primary)",fontWeight:700,fontSize:14,cursor:"pointer"},children:r?"⌛ Creating...":"+ Start New Chat Session"}),c.map(d=>p.jsxs("div",{onClick:()=>{o(e.ideId,d.id),i()},style:{padding:"16px",borderRadius:12,marginBottom:8,cursor:"pointer",background:h===d.id?"var(--bg-glass-hover)":"var(--surface-secondary)",border:"1px solid",borderColor:h===d.id?"var(--accent-primary)":"var(--border-subtle)",transition:"all 0.2s"},children:[p.jsx("div",{style:{fontWeight:700,fontSize:14,marginBottom:4,color:h===d.id?"var(--accent-primary-light)":"var(--text-primary)"},children:d.title||"Untitled Session"}),p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[p.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",fontFamily:"monospace"},children:[d.id.substring(0,12),"..."]}),h===d.id&&p.jsx("span",{style:{fontSize:10,background:"var(--accent-primary)",color:"white",padding:"2px 8px",borderRadius:10,fontWeight:800},children:"ACTIVE"})]})]},d.id)),c.length===0&&p.jsxs("div",{style:{padding:"40px 20px",textAlign:"center",color:"var(--text-muted)"},children:[p.jsx("div",{style:{fontSize:32,marginBottom:12},children:"🕯️"}),p.jsx("div",{style:{fontSize:13},children:"No recent chat sessions found."})]})]}),p.jsx("div",{style:{padding:"16px 20px",background:"var(--surface-tertiary)",borderTop:"1px solid var(--border-subtle)",textAlign:"right"},children:p.jsx("button",{onClick:l,disabled:n,className:"btn btn-secondary btn-sm",style:{borderRadius:10},children:n?"⌛ Refreshing...":"🔄 Refresh History"})})]})]})}function _3({sortedConversations:e,activeTabId:t,tabsOverflow:r,tabsContainerRef:n,terminalRef:i,onSelectTab:s,onReorder:o,pinTab:l,clearTabPinTimers:a,retryP2P:c}){const{sendCommand:h}=On(),u=b.useRef(null),d=b.useRef(null),f=b.useRef(null),g=b.useRef(null),[m,w]=b.useState(!1),_=b.useCallback((I,M)=>{const L=M.touches[0];f.current={x:L.clientX,y:L.clientY},d.current=I,g.current=setTimeout(()=>{w(!0)},400)},[]),v=b.useCallback(I=>{if(!m||!d.current){g.current&&(clearTimeout(g.current),g.current=null);return}I.preventDefault();const M=I.touches[0],L=n.current;if(!L)return;const W=Array.from(L.querySelectorAll("[data-tabkey]"));for(const A of W){const O=A.getBoundingClientRect();if(M.clientX>=O.left&&M.clientX<=O.right){const K=A.getAttribute("data-tabkey");if(K&&K!==d.current){const P=e.map(Q=>Q.tabKey),$=P.indexOf(d.current),S=P.indexOf(K);if($!==-1&&S!==-1){const Q=[...P];Q.splice($,1),Q.splice(S,0,d.current),o(Q)}}break}}},[m,e,n,o]),y=b.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null),w(!1),d.current=null,f.current=null},[]),T=()=>{const I=n.current;I&&I.scrollBy({left:-150,behavior:"smooth"})},R=()=>{const I=n.current;I&&I.scrollBy({left:150,behavior:"smooth"})},[x,j]=b.useState(!1),[H,U]=b.useState(!1),E=b.useCallback(()=>{const I=n.current;I&&(j(I.scrollLeft>4),U(I.scrollLeft+I.clientWidth<I.scrollWidth-4))},[n]);return b.useEffect(()=>{const I=n.current;if(!I)return;E(),I.addEventListener("scroll",E,{passive:!0});const M=new ResizeObserver(E);return M.observe(I),()=>{I.removeEventListener("scroll",E),M.disconnect()}},[n,E,e.length]),p.jsxs("div",{style:{position:"relative",flexShrink:0},children:[r&&p.jsx("button",{onClick:T,style:{position:"absolute",left:0,top:0,bottom:0,zIndex:5,width:32,background:"linear-gradient(to right, var(--bg-secondary) 60%, transparent)",border:"none",color:"var(--text-muted)",cursor:x?"pointer":"default",fontSize:12,display:"flex",alignItems:"center",justifyContent:"center",opacity:x?.7:0,pointerEvents:x?"auto":"none",transition:"opacity 0.15s"},onMouseEnter:I=>{x&&(I.currentTarget.style.opacity="1")},onMouseLeave:I=>{I.currentTarget.style.opacity=x?"0.7":"0"},children:"◀"}),r&&p.jsx("button",{onClick:R,style:{position:"absolute",right:0,top:0,bottom:0,zIndex:5,width:32,background:"linear-gradient(to left, var(--bg-secondary) 60%, transparent)",border:"none",color:"var(--text-muted)",cursor:H?"pointer":"default",fontSize:12,display:"flex",alignItems:"center",justifyContent:"center",opacity:H?.7:0,pointerEvents:H?"auto":"none",transition:"opacity 0.15s"},onMouseEnter:I=>{H&&(I.currentTarget.style.opacity="1")},onMouseLeave:I=>{I.currentTarget.style.opacity=H?"0.7":"0"},children:"▶"}),p.jsxs("div",{ref:n,className:"dashboard-agent-tabs",onWheel:I=>{const M=n.current;M&&Math.abs(I.deltaY)>Math.abs(I.deltaX)&&(I.preventDefault(),M.scrollLeft+=I.deltaY)},style:{display:"flex",overflowX:"auto",overflowY:"visible",flexShrink:0,background:"var(--bg-secondary)",borderBottom:"1px solid var(--border-subtle)",paddingTop:6,paddingBottom:0,paddingLeft:r?36:8,paddingRight:r?36:8,gap:4,scrollbarWidth:"none",WebkitOverflowScrolling:"touch",userSelect:"none",WebkitUserSelect:"none"},children:[e.map((I,M)=>{const L=t===I.tabKey,W=I.status==="working"?"agent-tab-working":I.status==="waiting_approval"?"agent-tab-waiting":"",A=M<9?String(M+1):null;return p.jsxs("div",{"data-tabkey":I.tabKey,className:W,draggable:!0,onDragStart:()=>{u.current=I.tabKey},onDragOver:O=>{O.preventDefault(),O.currentTarget.style.borderLeft="2px solid var(--accent-primary)"},onDragLeave:O=>{O.currentTarget.style.borderLeft=L?"1px solid var(--border-subtle)":"1px solid transparent"},onDrop:O=>{if(O.preventDefault(),O.currentTarget.style.borderLeft=L?"1px solid var(--border-subtle)":"1px solid transparent",!u.current||u.current===I.tabKey)return;const K=e.map(Q=>Q.tabKey),P=K.indexOf(u.current),$=K.indexOf(I.tabKey);if(P===-1||$===-1)return;const S=[...K];S.splice(P,1),S.splice($,0,u.current),o(S),u.current=null},onDragEnd:()=>{u.current=null},onTouchStart:O=>_(I.tabKey,O),onTouchMove:v,onTouchEnd:y,onClick:()=>{a(),s(I.tabKey),I.streamSource==="agent-stream"&&I.agentType&&(h(I.ideId,"agent_stream_focus",{agentType:I.agentType}).catch(()=>{}),l(I.tabKey,[200,1500])),Gt(I)&&setTimeout(()=>{var O,K;(K=(O=i.current)==null?void 0:O.bumpResize)==null||K.call(O)},100)},style:{flexShrink:0,padding:"6px 10px",background:L?"var(--bg-primary)":"rgba(255,255,255,0.03)",borderRadius:"8px 8px 0 0",borderTop:L?"1px solid var(--border-subtle)":"1px solid transparent",borderLeft:L?"1px solid var(--border-subtle)":"1px solid transparent",borderRight:L?"1px solid var(--border-subtle)":"1px solid transparent",borderBottom:"none",cursor:"grab",display:"flex",alignItems:"center",gap:8,transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",opacity:m&&d.current===I.tabKey?.3:L?1:.5,...I.p2pState==="gave_up"&&{opacity:m&&d.current===I.tabKey?.15:L?.6:.3}},children:[I.status==="working"?p.jsx("div",{className:"tab-spinner"}):I.status==="waiting_approval"?p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"#f59e0b"},children:"▲"}):I.p2pState==="gave_up"?p.jsx("span",{onClick:O=>{var P;O.stopPropagation();const K=I.daemonId||((P=I.ideId)==null?void 0:P.split(":")[0])||"";c==null||c(K)},title:"P2P disconnected — click to reconnect",style:{fontSize:8,padding:"1px 5px",color:"#f59e0b",cursor:"pointer"},children:"●"}):I.p2pState==="connecting"?p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"#60a5fa"},children:"○"}):I.p2pState==="connected"?p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"#22c55e"},children:"●"}):p.jsx("span",{style:{fontSize:8,padding:"1px 5px",color:"var(--text-muted)"},children:"●"}),p.jsxs("div",{style:{minWidth:0},children:[p.jsx("div",{style:{fontSize:12,fontWeight:700,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:I.displayPrimary}),p.jsxs("div",{style:{fontSize:8,opacity:.5,display:"flex",gap:4,alignItems:"center"},children:[I.displaySecondary,I.machineName&&p.jsxs(p.Fragment,{children:[p.jsx("span",{style:{opacity:.4},children:"·"}),p.jsxs("span",{style:{opacity:.7},children:["🖥 ",I.machineName]})]})]})]}),A&&p.jsx("span",{style:{fontSize:9,opacity:.35,fontFamily:"monospace",marginLeft:2,flexShrink:0},children:A})]},I.tabKey)}),e.length===0&&p.jsx("div",{style:{padding:"8px",fontSize:12,opacity:.4},children:"No active agents online."})]})]})}function v3({toasts:e,onDismiss:t,onClickToast:r}){return p.jsx("div",{style:{position:"fixed",top:16,right:16,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:e.map(n=>p.jsx("div",{className:"fade-in",style:{background:n.type==="success"?"rgba(16, 185, 129, 0.95)":n.type==="warning"?"rgba(245, 158, 11, 0.95)":"rgba(99, 102, 241, 0.95)",color:"white",padding:"12px 20px",borderRadius:12,fontSize:13,fontWeight:600,boxShadow:"0 8px 32px rgba(0,0,0,0.3)",backdropFilter:"blur(8px)",pointerEvents:"auto",cursor:"pointer",animation:"toast-in 0.3s ease-out",maxWidth:360},onClick:()=>{r&&r(n),t(n.id)},children:n.message},n.id))})}const y3=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function S3(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 x3(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 w,_,v,y,T;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((w=o.id)==null?void 0:w.split(":")[0])||o.id,h=n?n[c]||"new":void 0,u=S3(o),d=Ar(o.type),f=o.agentStreams,g=Array.isArray(f)?f:[],m=y3(o);if(m){const R=zh(o.type),x=(_=o.agents)==null?void 0:_[0],j=(v=o.activeChat)==null?void 0:v.activeModal,H=j&&Array.isArray(j.buttons)&&j.buttons.length>0,U=(y=o.activeChat)==null?void 0:y.status,E=U==="generating"||U==="loading"||U&&U.toLowerCase()==="thinking",M=H||U==="waiting_approval"?"waiting_approval":E?"working":(x==null?void 0:x.status)||"idle",L=o.activeChat||{title:"",messages:[]};let W=L.title&&String(L.title).trim()?String(L.title).trim():"";const A=(T=o.activeChat)==null?void 0:T.id,O=o.chats;if(A&&Array.isArray(O)&&O.length>0){const Q=O.find(le=>le.id===A||le.id&&String(le.id)===String(A));Q!=null&&Q.title&&String(Q.title).trim()&&(W=String(Q.title).trim())}const K=L.messages||[],P=t[o.id]||[],$=new Map;K.filter(Q=>Q.role==="user").forEach(Q=>{$.set(Q.content,($.get(Q.content)||0)+1)});const S=P.filter(Q=>{const le=$.get(Q.content)||0;return le>0?($.set(Q.content,le-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:R,agentType:Gt(o)||wr(o)?o.type:(x==null?void 0:x.type)||"ide-native",status:M,title:W,messages:[...K,...S],ideType:o.type,workspaceName:u,displayPrimary:W||R||u,displaySecondary:d,cdpconnected:o.cdpconnected,modalButtons:H?j.buttons:void 0,modalMessage:H?j.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,p2pState:h})}if(m&&(Gt(o)||wr(o)))return l;for(const R of g){const x=R.activeModal&&Array.isArray(R.activeModal.buttons)&&R.activeModal.buttons.length>0,j=x?"waiting_approval":R.status==="streaming"?"working":R.status,H=`${o.id}:${R.agentType}`,U=R.messages||[],E=t[H]||[],I=new Map;U.filter(L=>L.role==="user").forEach(L=>{I.set(L.content,(I.get(L.content)||0)+1)});const M=E.filter(L=>{const W=I.get(L.content)||0;return W>0?(I.set(L.content,W-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:R.agentName,agentType:R.agentType,status:j,title:"",messages:[...U,...M],ideType:o.type,workspaceName:u,displayPrimary:R.agentName,displaySecondary:d,cdpconnected:o.cdpconnected,modalButtons:x?R.activeModal.buttons:void 0,modalMessage:x?R.activeModal.message:void 0,streamSource:"agent-stream",tabKey:H,machineName:a,p2pState:h})}return l.length===0&&l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:zh(o.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:o.type,workspaceName:u,displayPrimary:u||d,displaySecondary:d,cdpconnected:o.cdpconnected,streamSource:"native",tabKey:o.id,p2pState:h}),l})}function hf(){return ly()}class w3{constructor(){os(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))}}const b3=new w3;class k3{constructor(){os(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))}}const Yn=new k3,Em=Yn;function C3(){const{sendCommand:e}=On(),t=hf(),{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,g]=b.useState(()=>{try{const F=new URLSearchParams(window.location.search).get("activeTab");return F||sessionStorage.getItem("adhdev_dashboard_activeTab")}catch{return null}}),m=b.useCallback(B=>{g(B);try{B?sessionStorage.setItem("adhdev_dashboard_activeTab",B):sessionStorage.removeItem("adhdev_dashboard_activeTab")}catch{}},[]),w=b.useRef([]),[_,v]=b.useState(""),[y,T]=b.useState({}),[R,x]=b.useState(!1),[j,H]=b.useState(!1),[U,E]=b.useState(!1),[I,M]=b.useState([]),[L,W]=b.useState({}),[A,O]=b.useState({}),K=b.useRef(null),P=b.useRef(null),$=b.useRef(null),[S,Q]=b.useState(!1),le=s.find(B=>B.type==="adhdev-daemon"),C=(le==null?void 0:le.detectedIdes)||[],ge=!!le,ie=b.useMemo(()=>{var V,X;const B=s.filter(J=>J.type!=="adhdev-daemon"),F=new Map;for(const J of B){const oe=F.get(J.id);if(!oe)F.set(J.id,J);else{const ae=(((V=oe.workspaceFolders)==null?void 0:V.length)||0)+(oe.activeChat?1:0);((((X=J.workspaceFolders)==null?void 0:X.length)||0)+(J.activeChat?1:0)>ae||(J.timestamp||0)>(oe.timestamp||0))&&F.set(J.id,J)}}return Array.from(F.values())},[s]),N=b.useMemo(()=>{const B=x3(ie,L,s,h),F=Date.now();return B.map(V=>{const X=A[V.tabKey];return X&&F-X<5e3?{...V,messages:[],title:""}:V})},[ie,L,A,s]),[Y,te]=b.useState(()=>{try{return JSON.parse(sessionStorage.getItem("adhdev_tabOrder")||"[]")}catch{return[]}}),ue=b.useMemo(()=>{if(Y.length===0)return N;const B=new Map(Y.map((F,V)=>[F,V]));return[...N].sort((F,V)=>{const X=B.get(F.tabKey)??9999,J=B.get(V.tabKey)??9999;return X-J})},[N,Y]);b.useEffect(()=>{const B=$.current;if(!B)return;const F=()=>Q(B.scrollWidth>B.clientWidth+2);F();const V=new ResizeObserver(F);return V.observe(B),B.addEventListener("scroll",F),()=>{V.disconnect(),B.removeEventListener("scroll",F)}},[ue.length]);const _e=b.useCallback(B=>{te(B);try{sessionStorage.setItem("adhdev_tabOrder",JSON.stringify(B))}catch{}},[]);b.useEffect(()=>{if(Object.keys(A).length===0)return;const F=setTimeout(()=>{O(V=>{const X=Date.now(),J={};for(const[oe,ae]of Object.entries(V))X-ae<5e3&&(J[oe]=ae);return Object.keys(J).length===Object.keys(V).length?V:J})},5500);return()=>clearTimeout(F)},[A]);const z=ue.find(B=>B.tabKey===f),Te=ue.map(B=>B.tabKey).join(","),ye=b.useRef(!1);b.useEffect(()=>{if(ue.length===0||ye.current&&f&&ue.some(F=>F.tabKey===f))return;const B=ue.find(F=>F.cdpconnected===!0);B?m(B.tabKey):(!f||!ue.some(F=>F.tabKey===f))&&m(ue[0].tabKey)},[Te]);const Qe=b.useCallback(()=>{w.current.forEach(B=>clearTimeout(B)),w.current=[]},[]),Pe=b.useCallback((B,F)=>{Qe();for(const V of F)w.current.push(setTimeout(()=>m(B),V))},[Qe]);b.useEffect(()=>{var V;if(!((V=z==null?void 0:z.messages)!=null&&V.length))return;const B=z.ideId,F=Date.now();T(X=>{let J=!1;const oe={...X};return z.messages.forEach((ae,fe)=>{const ce=`${B}-${ae.id??`i-${fe}`}`;oe[ce]==null&&(oe[ce]=F,J=!0)}),J?oe:X})},[z==null?void 0:z.ideId,z==null?void 0:z.messages]);const mr=b.useRef(!1);b.useEffect(()=>{if(!R){mr.current=!1;return}if(!z||mr.current||j)return;const B=s.find(F=>F.id===z.ideId);B&&(!B.chats||B.chats.length===0)&&(mr.current=!0,G())},[R,z==null?void 0:z.ideId]),b.useEffect(()=>{const B=setInterval(()=>{const F=Date.now()-3e5;M(V=>{const X=V.filter(J=>J.timestamp>F).slice(-100);return X.length===V.length?V:X})},6e4);return()=>clearInterval(B)},[]);const nr=b.useRef(new Map);b.useEffect(()=>{const B=(V,X)=>{var fe,ce,k;if(!X)return;for(const Z of N){if(!Gt(Z))continue;const we=(fe=Z.ideId)!=null&&fe.includes(":cli:")?Z.ideId.split(":cli:")[1]:"";if(V===we||V===Z.agentType||V===Z.ideType){const ze=nr.current.get(Z.tabKey)||[];ze.push(X),ze.length>1e4&&ze.splice(0,ze.length-5e3),nr.current.set(Z.tabKey,ze)}}const J=z&&Gt(z),oe=(ce=z==null?void 0:z.ideId)!=null&&ce.includes(":cli:")?z.ideId.split(":cli:")[1]:"",ae=V===oe||V===(z==null?void 0:z.agentType)||V===(z==null?void 0:z.ideType);J&&ae&&((k=K.current)==null||k.write(X))},F=Em.onPtyOutput(B);return()=>{F()}},[z==null?void 0:z.agentType,z==null?void 0:z.ideType,z==null?void 0:z.tabKey,N]),b.useEffect(()=>{if(!z||!Gt(z))return;const F=setTimeout(()=>{if(K.current){const V=nr.current.get(z.tabKey);if(V&&V.length>0)for(const X of V)K.current.write(X);K.current.bumpResize()}},200);return()=>clearTimeout(F)},[z==null?void 0:z.tabKey]),b.useEffect(()=>{if(!z)return;const B=setTimeout(()=>{var F;(F=P.current)==null||F.focus()},150);return()=>clearTimeout(B)},[z==null?void 0:z.tabKey]),b.useEffect(()=>{const B=F=>{var ae,fe,ce,k,Z,ve;const V=parseInt(F.key);if(isNaN(V)||V<1||V>9)return;if(F.ctrlKey){F.preventDefault();const we=ue[V-1];we&&(Qe(),m(we.tabKey));return}const X=(ae=document.activeElement)==null?void 0:ae.tagName,J=X==="INPUT"||X==="TEXTAREA"||((fe=document.activeElement)==null?void 0:fe.isContentEditable),oe=((k=(ce=document.activeElement)==null?void 0:ce.closest)==null?void 0:k.call(ce,".xterm-helper-textarea"))!=null||((ve=(Z=document.activeElement)==null?void 0:Z.classList)==null?void 0:ve.contains("xterm-helper-textarea"));if(!J&&!oe){F.preventDefault();const we=ue[V-1];we&&(Qe(),m(we.tabKey))}};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[ue,Qe,m]),b.useEffect(()=>{const B=b3.on("status_event",F=>{var oe;const V=Ar(F.ideType||"");let X="",J="info";if(F.event==="agent:generating_completed"){const ae=F.duration?` (${F.duration}s)`:"";X=`✅ ${V} agent task completed${ae}`,J="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}if(F.ideId){const fe={role:"system",timestamp:Date.now(),content:`✅ Task completed${ae}`,_localId:`sys_complete_${Date.now()}`};W(ce=>{for(const k of Object.keys(ce))if(k.includes(F.ideId))return{...ce,[k]:[...ce[k]||[],fe]};return ce})}}else if(F.event==="agent:generating_started")F.ideId&&W(ae=>{const fe={...ae};for(const ce of Object.keys(fe))ce.includes(F.ideId)&&(fe[ce]=(fe[ce]||[]).filter(k=>{var Z;return!(k.role==="system"&&((Z=k._localId)!=null&&Z.startsWith("sys_complete_")))}));return fe});else if((F.event==="agent:waiting_approval"||F.event==="agent:approval_needed")&&(X=`⚡ ${V} approval needed`,J="warning",F.ideId)){const ae=F.modalMessage||"Approval requested",fe=(oe=F.modalButtons)!=null&&oe.length?F.modalButtons.map(k=>`[${k}]`).join(" "):"[Approve] [Reject]",ce={role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${ae}
168
- ${fe}`,_localId:`sys_approval_${Date.now()}`};W(k=>{for(const Z of Object.keys(k))if(Z.includes(F.ideId))return{...k,[Z]:[...k[Z]||[],ce]};return k})}if(X){const ae=Date.now();l(fe=>[...fe.slice(-4),{id:ae,message:X,type:J,timestamp:ae,ideId:F.ideId}]),setTimeout(()=>l(fe=>fe.filter(ce=>ce.id!==ae)),5e3)}});return()=>B()},[]),b.useEffect(()=>{var F;const B=V=>{const X=V.data;(X==null?void 0:X.type)==="notification_action"&&X.action==="approve"&&X.ideId&&e(X.ideId,"resolve_action",{action:"approve",button:"Approve"}).catch(J=>console.error("[SW Action] approve failed:",J))};return(F=navigator.serviceWorker)==null||F.addEventListener("message",B),()=>{var V;return(V=navigator.serviceWorker)==null?void 0:V.removeEventListener("message",B)}},[]);const Wr=async()=>{if(!z)return;const B=_.trim();if(!B)return;const F=z.ideId,V=z.tabKey;v(""),Pe(V,[100,500,1500,3e3]);const X=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,J={role:"user",content:B,timestamp:Date.now(),_localId:X};W(oe=>({...oe,[V]:[...oe[V]||[],J]}));try{if(Gt(z)&&!wr(z)){const oe=F||z.daemonId||"";if(!oe)return;const ae=z.ideType||z.agentType||"";await e(oe,"agent_command",{agentType:ae,cliType:ae,action:"send_chat",message:B,text:B})}else if(wr(z)){const oe=F||z.daemonId||"";if(!oe)return;await e(oe,"send_chat",{message:B,text:B,agentType:z.agentType})}else{const oe=F||z.daemonId||"";if(!oe)return;await e(oe,"send_chat",{message:B,text:B,...z.streamSource==="agent-stream"&&{agentType:z.agentType}})}setTimeout(()=>{const oe=Date.now()-6e4;W(ae=>{const fe=ae[V];if(!fe)return ae;const ce=fe.filter(k=>k.timestamp>oe);return ce.length===fe.length?ae:{...ae,[V]:ce}})},6e4)}catch(oe){console.error("Send failed",oe),v(B),W(ae=>({...ae,[V]:(ae[V]||[]).filter(fe=>fe._localId!==X)}))}},an=async()=>{if(z)try{ge?await e(z.ideId,"launch_ide",{ideType:z.ideType,enableCdp:!0}):await e(z.ideId,"vscode_command_exec",{commandId:"adhdev.relaunchWithCdp",args:[{force:!0}]})}catch(B){console.error("Relaunch failed",B)}},Hr=async B=>{try{await e("standalone","launch_ide",{ideType:B,enableCdp:!0})}catch(F){console.error("Launch failed",F)}},Tr=async B=>{if(z){console.log("[ModalButton] ideId:",z.ideId,"button:",B,"agentType:",z.agentType,"source:",z.streamSource),M(F=>[...F,{ideId:z.tabKey,text:`🖱️ **${B}** clicked`,timestamp:Date.now()}]);try{let F;if(Gt(z)&&!wr(z)){const X=(z.modalButtons||[]).indexOf(B),J=B.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase();let oe;X>=0?oe=`${X+1}\r`:/^(deny|no|reject|cancel)/.test(J)?oe="3\r":/always/.test(J)?oe="2\r":oe="1\r";const ae=z.daemonId||z.ideId,fe=z.ideType||z.agentType||"";Em.sendPtyInput(ae,fe,oe)||await e(ae,"pty_input",{cliType:fe,data:oe}),F={success:!0}}else{const V=B.replace(/[⌥⏎⇧⌫⌘⌃]/g,"").trim().toLowerCase(),X=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(V),J=z.ideId||z.daemonId||"";F=await e(J,"resolve_action",{button:B,action:X?"approve":"reject",...z.streamSource==="agent-stream"&&{agentType:z.agentType}})}console.log("[ModalButton] result:",F),F.success||M(V=>[...V,{ideId:z.tabKey,text:`⚠️ **${B}** failed — button not found`,timestamp:Date.now()}])}catch(F){console.error("[ModalButton] Error:",F),M(V=>[...V,{ideId:z.tabKey,text:`❌ **${B}** error`,timestamp:Date.now()}])}}},Ur=async(B,F)=>{try{const V=B||(z==null?void 0:z.daemonId)||"",X=await e(V,"switch_chat",{id:F,sessionId:F,...(z==null?void 0:z.streamSource)==="agent-stream"&&{agentType:z==null?void 0:z.agentType}}),J=X==null?void 0:X.result;(X==null?void 0:X.success)===!0||J==="switched"||J==="switched-by-title"||(J===!1||J==="not_found"?l(ae=>[...ae,{id:Date.now(),message:"⚠️ Session tab not found — try refreshing history",type:"warning",timestamp:Date.now()}]):typeof J=="string"&&J.startsWith("error:")?l(ae=>[...ae,{id:Date.now(),message:`⚠️ Switch error: ${J}`,type:"warning",timestamp:Date.now()}]):l(ae=>[...ae,{id:Date.now(),message:"⚠️ Session switch failed",type:"warning",timestamp:Date.now()}]))}catch(V){console.error("Switch failed",V),l(X=>[...X,{id:Date.now(),message:`❌ Switch failed: ${V.message||"connection error"}`,type:"warning",timestamp:Date.now()}])}},wt=async()=>{if(!(!z||U)){E(!0);try{const B=z.ideId||z.daemonId||"";await e(B,"new_chat",{...z.streamSource==="agent-stream"&&{agentType:z.agentType}}),O(F=>({...F,[z.tabKey]:Date.now()})),W(F=>({...F,[z.tabKey]:[]}))}catch(B){console.error("New chat failed",B)}finally{E(!1)}}},[re,pe]=b.useState(!1),D=async()=>{if(!z||re)return;pe(!0);const B=z.tabKey;try{await e(z.ideId,"agent_stream_focus",{agentType:z.agentType}),Pe(B,[200,1500,3e3])}catch(F){console.error("Focus agent failed",F)}finally{pe(!1)}},G=async()=>{var B;if(!(!z||j)){H(!0);try{const F=z.ideId||z.daemonId||"",V=await e(F,"list_chats",{forceExpand:!0,...z.streamSource==="agent-stream"&&{agentType:z.agentType}}),X=(V==null?void 0:V.chats)||((B=V==null?void 0:V.result)==null?void 0:B.chats);V!=null&&V.success&&Array.isArray(X)&&r(z.ideId,X)}catch(F){console.error("Refresh history failed",F)}finally{H(!1)}}};return p.jsxs("div",{className:"page-dashboard",style:{flex:1,minHeight:0,background:"var(--bg-primary)",color:"var(--text-primary)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[p.jsx(d3,{wsStatus:a,showReconnected:d}),p.jsx(f3,{activeConv:z,agentCount:ie.length,wsStatus:a,isP2PActive:c,onOpenHistory:()=>x(!0)}),p.jsx(_3,{sortedConversations:ue,activeTabId:f,tabsOverflow:S,tabsContainerRef:$,terminalRef:K,onSelectTab:B=>{ye.current=!0,m(B)},onReorder:_e,pinTab:Pe,clearTabPinTimers:Qe,retryP2P:u}),p.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},children:z?p.jsxs(p.Fragment,{children:[p.jsx(l1,{activeConv:z,onModalButton:Tr}),p.jsx("div",{className:"desktop-only",style:{padding:"4px 12px 8px"},children:!Gt(z)&&!wr(z)&&n[z.ideId]?p.jsxs("div",{style:{position:"relative",borderRadius:12,overflow:"hidden",border:"1px solid var(--border-subtle)",background:"var(--bg-secondary)",aspectRatio:"16/9"},children:[p.jsx("img",{src:n[z.ideId],style:{width:"100%",height:"100%",objectFit:"cover"}}),p.jsx("button",{onClick:()=>{const B={...n};delete B[z.ideId],i(B)},style:{position:"absolute",top:10,right:10,background:"rgba(0,0,0,0.5)",border:"none",color:"white",width:20,height:20,borderRadius:"50%",fontSize:10,zIndex:10},children:"✕"})]}):!Gt(z)&&!wr(z)&&z.cdpconnected===!1?p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 14px",background:"rgba(234,179,8,0.08)",border:"1px solid rgba(234,179,8,0.2)",borderRadius:8,fontSize:12,color:"var(--text-secondary)"},children:[p.jsx("span",{style:{fontSize:14},children:"⚠️"}),p.jsx("span",{style:{flex:1},children:"CDP not connected — chat history & screenshots unavailable for this IDE."}),p.jsx("button",{className:"btn btn-sm",onClick:an,style:{background:"rgba(234,179,8,0.15)",color:"#eab308",border:"1px solid rgba(234,179,8,0.3)",fontSize:10,whiteSpace:"nowrap",flexShrink:0},children:"Relaunch with CDP"})]}):null}),Gt(z)&&!wr(z)?p.jsx(h3,{activeConv:z,ptyBuffers:nr,terminalRef:K,agentInput:_,setAgentInput:v,handleSendChat:Wr,handleModalButton:Tr}):p.jsx(a1,{activeConv:z,ides:s,agentInput:_,setAgentInput:v,handleSendChat:Wr,handleFocusAgent:D,isFocusingAgent:re,messageReceivedAt:y,actionLogs:I})]}):p.jsxs("div",{className:"empty-dashboard",children:[p.jsx("div",{className:"glow-orb",children:p.jsx("img",{src:"/otter-logo.png",alt:"",style:{width:48,height:48}})}),p.jsxs("div",{style:{textAlign:"center"},children:[p.jsx("div",{style:{fontWeight:700,fontSize:18,marginBottom:6},children:"No IDE connected"}),p.jsx("div",{style:{fontSize:13,color:"var(--text-muted)",marginBottom:ge&&C.length>0?16:0},children:ge?"Launch an IDE with CDP to start monitoring":"Launch your IDE with the ADHDev extension to start"}),ge&&C.length>0&&p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"center"},children:C.filter(B=>B.running||!0).map(B=>p.jsxs("button",{className:"btn btn-sm",onClick:()=>Hr(B.type),style:{background:"rgba(139,92,246,0.1)",border:"1px solid rgba(139,92,246,0.25)",color:"#a78bfa",fontSize:12,fontWeight:600,padding:"8px 16px",borderRadius:8,cursor:"pointer",display:"flex",alignItems:"center",gap:6,transition:"all 0.2s"},onMouseEnter:F=>F.currentTarget.style.background="rgba(139,92,246,0.2)",onMouseLeave:F=>F.currentTarget.style.background="rgba(139,92,246,0.1)",children:["🚀 Launch ",B.name]},B.type))})]})]})}),R&&z&&p.jsx(m3,{activeConv:z,ides:s,isCreatingChat:U,isRefreshingHistory:j,onClose:()=>x(!1),onNewChat:wt,onSwitchSession:Ur,onRefreshHistory:G}),p.jsx("style",{children:`
169
- body { overflow: hidden; overscroll - behavior: none; }
170
- .btn { cursor: pointer; border - radius: 8px; font - weight: 600; font - size: 14px; transition: all 0.2s; }
171
- .btn - sm { padding: 6px 12px; font - size: 12px; }
172
- .pulse - amber { animation: pulse - amber 2s infinite ease -in -out; }
173
- @keyframes pulse - amber {
174
- 0 % { transform: scale(1); box- shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
175
- }
176
- 70 % { transform: scale(1.1); box- shadow: 0 0 0 10px rgba(245, 158, 11, 0);
177
- }
178
- 100 % { transform: scale(1); box- shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
179
- }
180
- `}),p.jsx(v3,{toasts:o,onDismiss:B=>l(F=>F.filter(V=>V.id!==B)),onClickToast:B=>{if(B.ideId){const F=ue.find(V=>V.ideId===B.ideId||V.tabKey===B.ideId);F&&(Qe(),m(F.tabKey))}}}),p.jsx("style",{children:`
181
- @keyframes toast -in {
182
- from { opacity: 0; transform: translateX(40px); }
183
- to { opacity: 1; transform: translateX(0); }
184
- }
185
- `})]})}function E3(e){return e.split(":")[0]||""}function T3(){var le,C,ge;const{id:e}=ty(),t=ts(),r=hf(),n=r.ides||[],i=r.connectionStates||r.p2pStates||{},{sendCommand:s}=On(),o=b.useMemo(()=>E3(e||""),[e]),l=b.useMemo(()=>n.find(ie=>ie.id===e),[n,e]),a=(l==null?void 0:l.type)||void 0,c=a?a.charAt(0).toUpperCase()+a.slice(1):"IDE",h=(l==null?void 0:l.activeChat)||null,u=(l==null?void 0:l.agentStreams)||[],d=i[o]||"new",f=b.useMemo(()=>n.find(ie=>ie.id===o||ie.daemonId===o),[n,o]),g=(f==null?void 0:f.machineNickname)||((le=f==null?void 0:f.machine)==null?void 0:le.hostname)||"",m=((ge=(C=l==null?void 0:l.workspaceFolders)==null?void 0:C[0])==null?void 0:ge.name)||"",[w]=Ow(),_=typeof window<"u"&&window.innerWidth<=768,v=w.get("view")||(_?"chat":"split"),[y,T]=b.useState(v),[R,x]=b.useState("ide"),[j,H]=b.useState(""),[U,E]=b.useState(!1),[I,M]=b.useState(null),[L,W]=b.useState(null),[A,O]=b.useState([]),K=b.useMemo(()=>{var ie,N;return{ideId:e||"",daemonId:o,agentName:zh(a||""),agentType:a||"",status:(h==null?void 0:h.status)||"idle",title:(h==null?void 0:h.title)||"",messages:(h==null?void 0:h.messages)||[],ideType:a||"",workspaceName:(l==null?void 0:l.workspaceName)||"",displayPrimary:c,displaySecondary:(l==null?void 0:l.workspaceName)||"",cdpConnected:!0,modalButtons:(ie=h==null?void 0:h.activeModal)==null?void 0:ie.buttons,modalMessage:(N=h==null?void 0:h.activeModal)==null?void 0:N.message,streamSource:"native",tabKey:`ide-${e}`}},[e,o,a,h,l,c]);b.useEffect(()=>o?Yn.onScreenshot("ide-page",(N,Y)=>{if(N!==o)return;const te=new FileReader;te.onload=()=>M(te.result),te.readAsDataURL(Y)}):void 0,[o]),b.useEffect(()=>o?Yn.onStatusEvent((N,Y)=>{if(N!==o)return;let te="",ue="info";if(Y.event==="agent:generating_completed"?(te=`✅ Task completed${Y.duration?` (${Y.duration}s)`:""}`,ue="success"):(Y.event==="agent:waiting_approval"||Y.event==="agent:approval_requested")&&(te="⚡ Approval needed",ue="warning"),te){const _e=Date.now();O(Te=>[...Te.slice(-4),{id:_e,message:te,type:ue}]),setTimeout(()=>O(Te=>Te.filter(ye=>ye.id!==_e)),ue==="warning"?1e4:5e3)}}):void 0,[o]),b.useEffect(()=>{const ie=o?Yn.get(o):null;!ie||!(d==="connected")||(y!=="chat"?ie.startScreenshots(a):ie.stopScreenshots(a))},[y,d,a,o]);const P=b.useCallback(async(ie,N={})=>{if(!e)throw new Error("No IDE ID");const Y={...N};if(!Y._targetInstance&&e){const ue=e.split(":");ue.length>=3&&(ue[1]==="ide"||ue[1]==="cli")&&(Y._targetInstance=ue.slice(2).join(":"),Y._targetType=ue[1])}const te=o?Yn.get(o):null;return te!=null&&te.hasCommandChannel?await te.sendCommand(ie,Y):te&&te.connectionState!=="failed"&&te.connectionState!=="closed"&&await new Promise(_e=>{const z=Date.now(),Te=()=>{if(te.hasCommandChannel)return _e(!0);if(Date.now()-z>3e3)return _e(!1);setTimeout(Te,200)};Te()})&&te.hasCommandChannel?await te.sendCommand(ie,Y):await s(e,ie,Y)},[e,o]),$=async()=>{const ie=j.trim();if(!(!ie||!e||U)){H(""),E(!0);try{await P("send_chat",{message:ie,waitForResponse:!0})}catch(N){console.error("[IDE] Send failed:",N)}finally{E(!1)}}},S=async ie=>{if(e)try{const N=await s(e,"screenshot",{width:ie?Math.min(ie,1280):1280});N!=null&&N.success&&(N!=null&&N.base64)&&W(`data:image/jpeg;base64,${N.base64}`)}catch(N){console.error("[IDE] Screenshot failed:",N)}},Q=u.length>0;return e?p.jsxs("div",{className:"ide-page",children:[p.jsxs("header",{className:"ide-header",children:[p.jsxs("div",{className:"ide-header-left",children:[p.jsxs("div",{className:"ide-title",children:[p.jsx("span",{className:"ide-name",children:c}),m&&p.jsx("span",{className:"ide-workspace",children:m}),p.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),p.jsxs("div",{className:"ide-status-pill",children:[p.jsx("span",{className:`ide-dot ${d==="connected"?"online":"connecting"}`}),p.jsx("span",{className:"ide-status-text",children:d==="connected"?"Connected":d==="connecting"?"Connecting":"WS"})]}),g&&p.jsx("span",{className:"ide-machine-label",children:g})]}),p.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(ie=>p.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:y===ie?"1px solid var(--accent-primary)":"none",background:y===ie?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:y===ie?"var(--accent-primary)":void 0},onClick:()=>T(ie),children:ie==="chat"?"💬":ie==="split"?"⊞":"🖥"},ie)),p.jsx("button",{className:"btn btn-primary btn-sm",style:{border:"none",padding:"6px 12px",fontSize:12},onClick:()=>t("/dashboard"),children:"← Back"})]})]}),p.jsxs("div",{className:"ide-content",children:[p.jsxs("div",{className:`ide-chat-panel ${y==="chat"?"full":""} ${y==="remote"?"hidden":""}`,children:[Q&&p.jsxs("div",{className:"ide-chat-tabs",children:[p.jsx("button",{className:`ide-chat-tab ${R==="ide"?"active":""}`,onClick:()=>x("ide"),children:c}),p.jsxs("button",{className:`ide-chat-tab ext ${R==="extensions"?"active":""}`,onClick:()=>x("extensions"),children:["Extensions ",p.jsx("span",{className:"ide-ext-badge",children:u.length})]})]}),R==="extensions"&&Q?p.jsx($4,{ideId:e,agentStreams:u,sendCommand:async(ie,N)=>{try{const Y=o?Yn.get(o):null;if(Y&&d==="connected"){await Promise.race([Y.sendCommand(ie,N),new Promise((te,ue)=>setTimeout(()=>ue(new Error("connection timeout")),3e3))]);return}}catch{}await s(e,ie,N)}}):p.jsx(a1,{activeConv:K,ides:n,agentInput:j,setAgentInput:H,handleSendChat:$,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[]})]}),p.jsx("div",{className:`ide-remote-panel ${y==="remote"?"full":""} ${y==="chat"?"hidden":""}`,children:p.jsx(o3,{screenshot:L,isCapturing:!1,onRefresh:S,addLog:()=>{},connState:d,connScreenshot:I,onAction:async(ie,N)=>{const Y=o?Yn.get(o):null;if(Y&&d==="connected")try{return await Y.sendInput(ie,N)}catch(te){console.error("[Connection Input] Failed:",te)}return await s(e,"cdp_remote_action",{action:ie,params:N})}})})]}),A.length>0&&p.jsx("div",{className:"ide-toasts",children:A.map(ie=>p.jsx("div",{className:`ide-toast ${ie.type}`,onClick:()=>O(N=>N.filter(Y=>Y.id!==ie.id)),children:ie.message},ie.id))})]}):p.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function R3(){var B,F,V,X,J,oe,ae,fe,ce;const{id:e}=ty(),t=ts(),{sendCommand:r}=On(),n=r,i=hf(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=b.useState([]),[c,h]=b.useState([]),[u,d]=b.useState(0),[f,g]=b.useState(!0),[m,w]=b.useState("debug"),[_,v]=b.useState(null),[y,T]=b.useState([]),[R,x]=b.useState(!1),[j,H]=b.useState(""),[U,E]=b.useState(""),[I,M]=b.useState(""),[L,W]=b.useState(""),[A,O]=b.useState("overview"),[K,P]=b.useState([]),[$,S]=b.useState(!1),[Q,le]=b.useState(!1),[C,ge]=b.useState(""),ie=b.useRef(null);b.useEffect(()=>{if(!e||A!=="logs"||!f)return;const k=async()=>{try{const ve=await r(e,"get_logs",{count:200,minLevel:m,since:u});if(ve!=null&&ve.success&&Array.isArray(ve.logs)&&ve.logs.length>0){h(Ae=>[...Ae,...ve.logs.map(mi=>({timestamp:mi.ts,level:mi.level,message:`[${mi.category}] ${mi.message}`}))].slice(-300));const we=Math.max(...ve.logs.map(Ae=>Ae.ts));d(we)}}catch{}};k();const Z=setInterval(k,3e3);return()=>clearInterval(Z)},[e,A,f,u,m]),b.useEffect(()=>{f&&setTimeout(()=>{var k;return(k=ie.current)==null?void 0:k.scrollIntoView({behavior:"smooth"})},100)},[c.length,l.length,f]);const N=s.find(k=>k.id===e&&k.daemonMode),Y=N?{id:N.id,hostname:((B=N.machine)==null?void 0:B.hostname)||N.id,platform:((F=N.machine)==null?void 0:F.platform)||"unknown",arch:((V=N.machine)==null?void 0:V.arch)||"",cpus:((X=N.machine)==null?void 0:X.cpus)||0,totalMem:((J=N.machine)==null?void 0:J.totalMem)||0,freeMem:((oe=N.machine)==null?void 0:oe.freeMem)||0,loadavg:((ae=N.machine)==null?void 0:ae.loadavg)||[],uptime:((fe=N.machine)==null?void 0:fe.uptime)||0,release:((ce=N.machine)==null?void 0:ce.release)||"",cdpconnected:N.cdpconnected||!1,machineNickname:N.machineNickname||null,p2p:N.p2p||{available:!1,state:"unavailable",peers:0},detectedIdes:N.detectedIdes||[],managedIdeIds:N.managedIdeIds||[],managedCliIds:N.managedCliIds||[]}:null,te=(N==null?void 0:N.availableProviders)||[],ue={};for(const k of te)ue[k.type]=k.icon;const _e=k=>ue[k]||"💻",z=te.filter(k=>k.category==="cli"||k.category==="acp");b.useEffect(()=>{!I&&z.length>0&&M(z[0].type)},[I,z.length]);const Te=s.filter(k=>k.daemonId===e&&!k.daemonMode).filter(k=>!Cm(k)).map(k=>({id:k.id,type:k.type,version:k.version||"",instanceId:k.instanceId||"",status:k.status,workspaceFolders:k.workspaceFolders||[],activeFile:k.activeFile||null,terminals:k.terminals||0,aiAgents:g3(k.aiAgents||k.agents||[]),activeChat:k.activeChat||null,chats:k.chats||[],agentStreams:k.agentStreams||[],cdpconnected:k.cdpconnected||!1,daemonId:e})),ye=s.filter(k=>k.daemonId===e&&Cm(k)).map(k=>{var Z,ve;return{id:k.id,type:k.type,cliName:k.cliName||k.type,status:k.status,workingDir:k.workingDir||((ve=(Z=k.workspaceFolders)==null?void 0:Z[0])==null?void 0:ve.path)||"",activeChat:k.activeChat||null,daemonId:e}}),Qe=((Y==null?void 0:Y.detectedIdes)||[]).filter(k=>!k.running&&!Te.some(Z=>(Z.type||"").toLowerCase()===(k.type||"").toLowerCase())),Pe=(k,Z)=>{a(ve=>[...ve.slice(-100),{timestamp:Date.now(),level:k,message:Z}]),setTimeout(()=>{var ve;return(ve=ie.current)==null?void 0:ve.scrollIntoView({behavior:"smooth"})},100)},mr=async k=>{if(!(!e||_)){v(k),Pe("info",`Launching ${Ar(k)}...`);try{const Z=await r(e,"launch_ide",{ideType:k,enableCdp:!0});Pe(Z!=null&&Z.success?"info":"error",Z!=null&&Z.success?`${Ar(k)} launched`:`Failed: ${Z==null?void 0:Z.error}`)}catch(Z){Pe("error",`Launch error: ${Z.message}`)}finally{v(null)}}},nr=async(k,Z,ve,we)=>{if(e){Pe("info",`Launching ${k}${Z?` in ${Z}`:""}${we?` (model: ${we})`:""}...`);try{const Ae=ve?ve.split(/\s+/).filter(Boolean):void 0,ze=await r(e,"launch_cli",{cliType:k,dir:Z||void 0,cliArgs:Ae,initialModel:we||void 0});ze!=null&&ze.success?(Pe("info",`${k} launched`),ze.defaultedToHome&&Pe("info",`📂 No directory specified — running in home directory (${ze.dir||"~"})`)):Pe("error",`Failed: ${ze==null?void 0:ze.error}`)}catch(Ae){Pe("error",`Launch error: ${Ae.message}`)}}},Wr=async(k,Z)=>{if(e&&window.confirm(`Stop ${k}?
186
- This will terminate the CLI process.`))try{await r(e,"stop_cli",{cliType:k,dir:Z}),Pe("info",`${k} stopped`)}catch(ve){Pe("error",`Stop failed: ${ve.message}`)}},an=async k=>{try{await r(k.id,"restart_session",{ideType:k.type}),Pe("info",`${Ar(k.type)} restart initiated`)}catch(Z){Pe("error",`Restart failed: ${Z.message}`)}},Hr=async()=>{if(e)try{const k=await r(e,"detect_ides",{});Pe("info",`Found ${((k==null?void 0:k.result)||[]).length} IDE(s)`)}catch(k){Pe("error",`Detection failed: ${k.message}`)}},Tr=async()=>{if(e){x(!0);try{const k=await r(e,"get_recent_workspaces",{});k!=null&&k.success&&Array.isArray(k==null?void 0:k.result)&&T(k.result)}catch(k){Pe("error",`Failed: ${k.message}`)}finally{x(!1)}}},Ur=async()=>{var k;if(e){S(!0);try{const Z=await n(e,"get_cli_history");Z.success&&((k=Z.result)!=null&&k.history)&&P(Z.result.history)}catch{}S(!1)}},wt=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:C}),Pe("info",`Nickname set to "${C||"(cleared)"}"`),le(!1)}catch(k){Pe("error",`Failed: ${k.message}`)}};if(!Y)return o?p.jsxs("div",{style:{padding:40,textAlign:"center",color:"#64748b"},children:[p.jsx("h2",{style:{color:"#f1f5f9"},children:"Machine not found"}),p.jsx("p",{style:{marginTop:12},children:"The machine may be offline or not yet connected."}),p.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):p.jsx("div",{style:{padding:40,textAlign:"center",color:"#64748b"},children:p.jsx("p",{children:"⏳ Loading machine..."})});const re=Y.totalMem>0?Math.round((Y.totalMem-Y.freeMem)/Y.totalMem*100):0,pe=Y.loadavg[0]||0,D=Y.machineNickname||Y.hostname,G=[{id:"overview",label:"📊 Overview"},{id:"ides",label:"💻 IDEs",count:Te.length},{id:"clis",label:"🔌 CLIs",count:ye.length},{id:"logs",label:"📋 Logs",count:l.length>0?l.length:void 0}];return p.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[p.jsxs("div",{style:{padding:"16px 24px",borderBottom:"1px solid rgba(255,255,255,0.06)",background:"var(--surface-primary)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[p.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"←"}),p.jsxs("div",{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[Q?p.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[p.jsx("input",{autoFocus:!0,value:C,onChange:k=>ge(k.target.value),onKeyDown:k=>{k.key==="Enter"&&wt(),k.key==="Escape"&&le(!1)},placeholder:"Machine nickname...",style:{padding:"4px 10px",borderRadius:6,border:"1px solid rgba(139,92,246,0.3)",background:"rgba(15,23,42,0.8)",color:"#f1f5f9",fontSize:14,fontWeight:600,width:200}}),p.jsx("button",{onClick:wt,className:"machine-btn",style:{color:"#22c55e",borderColor:"rgba(34,197,94,0.3)"},children:"✓"}),p.jsx("button",{onClick:()=>le(!1),className:"machine-btn",children:"✕"})]}):p.jsx("h1",{style:{fontSize:18,fontWeight:700,color:"#f1f5f9",margin:0,cursor:"pointer"},onClick:()=>{le(!0),ge(Y.machineNickname||"")},title:"Click to set nickname",children:D}),p.jsx("span",{className:"status-dot-md online"})]}),p.jsxs("div",{style:{fontSize:11,color:"#64748b",marginTop:2,display:"flex",gap:8,alignItems:"center"},children:[p.jsxs("span",{children:[Y.platform," · ",Y.arch," · ",Y.cpus," cores"]}),Y.p2p.available&&p.jsxs("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:9,fontWeight:600,background:Y.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:Y.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",Y.p2p.state==="connected"?`● ${Y.p2p.peers}`:"○"]}),Y.cdpconnected&&p.jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:9,fontWeight:600,background:"rgba(34,197,94,0.08)",color:"#22c55e"},children:"CDP ●"}),Y.machineNickname&&p.jsxs("span",{style:{color:"#475569"},children:["(",Y.hostname,")"]})]})]})]}),p.jsx("button",{onClick:Hr,className:"machine-btn-primary",title:"Re-detect installed IDEs",children:"🔍 Scan IDEs"})]}),p.jsx("div",{className:"machine-tabs",children:G.map(k=>p.jsxs("button",{onClick:()=>O(k.id),className:`machine-tab${A===k.id?" active":""}`,children:[k.label,k.count!==void 0&&p.jsx("span",{className:"tab-count",children:k.count})]},k.id))})]}),p.jsxs("div",{className:"page-content",children:[A==="overview"&&p.jsxs("div",{children:[p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:10,marginBottom:20},children:[p.jsx(wm,{icon:"⏱",label:"Uptime",value:p3(Y.uptime)}),p.jsx(wm,{icon:"💻",label:"IDEs",value:`${Te.length}`,sub:`${ye.length} CLIs`})]}),p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,marginBottom:20,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsx("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:12},children:"Resource Usage"}),p.jsxs("div",{style:{display:"flex",gap:24},children:[p.jsx(bm,{value:Math.min(Math.round(pe/Y.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${pe.toFixed(2)} avg / ${Y.cpus} cores`}),p.jsx(bm,{value:re,max:100,label:"Memory",color:"#3b82f6",detail:`${km(Y.totalMem-Y.freeMem)} / ${km(Y.totalMem)}`})]})]}),p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:12},children:[p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"IDEs"}),p.jsx("button",{onClick:()=>O("ides"),className:"machine-btn",style:{fontSize:10},children:"View All →"})]}),Te.length===0?p.jsx("div",{style:{fontSize:12,color:"#475569",fontStyle:"italic"},children:"No IDEs running"}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:Te.map(k=>{var ve,we,Ae;const Z=(k.agentStreams||[]).some(ze=>ze.status==="generating"||ze.status==="streaming")||((ve=k.activeChat)==null?void 0:ve.status)==="generating";return p.jsxs("div",{onClick:()=>t(`/ide/${k.id}`),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 10px",borderRadius:8,cursor:"pointer",transition:"background 0.15s",background:Z?"rgba(249,115,22,0.04)":"rgba(255,255,255,0.02)",border:Z?"1px solid rgba(249,115,22,0.1)":"1px solid transparent"},children:[p.jsx("span",{children:_e(k.type)}),p.jsx("span",{style:{fontSize:12,color:"#e2e8f0",fontWeight:500},children:Ar(k.type)}),p.jsx("span",{style:{fontSize:10,color:"#475569",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((Ae=(we=k.workspaceFolders)==null?void 0:we[0])==null?void 0:Ae.name)||""}),Z&&p.jsx("span",{style:{fontSize:10,color:"#fb923c",fontWeight:600,marginLeft:"auto"},children:"⚡ Working"}),p.jsx("span",{style:{marginLeft:Z?6:"auto",width:6,height:6,borderRadius:"50%",background:Z?"#fb923c":"#22c55e",boxShadow:Z?"0 0 8px rgba(249,115,22,0.4)":"none",animation:Z?"pulse-dot 1.5s infinite":"none"}})]},k.id)})})]}),p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,background:"rgba(15, 23, 42, 0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"CLIs"}),p.jsx("button",{onClick:()=>O("clis"),className:"machine-btn",style:{fontSize:10},children:"View All →"})]}),ye.length===0?p.jsx("div",{style:{fontSize:12,color:"#475569",fontStyle:"italic"},children:"No CLIs running"}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:ye.map(k=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 10px",borderRadius:8,background:"rgba(255,255,255,0.02)"},children:[p.jsx("span",{children:_e(k.type)}),p.jsx("span",{style:{fontSize:12,color:"#e2e8f0",fontWeight:500},children:k.cliName}),p.jsx("span",{style:{fontSize:10,color:"#475569",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.workingDir.split("/").pop()}),p.jsx("span",{style:{marginLeft:"auto",width:6,height:6,borderRadius:"50%",background:k.status==="stopped"?"#ef4444":"#22c55e"}})]},k.id))})]})]}),Y.detectedIdes.length>0&&p.jsxs("div",{style:{marginTop:16,padding:"14px 18px",borderRadius:12,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsx("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:8},children:"Detected on this machine"}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:Y.detectedIdes.map(k=>p.jsxs("div",{style:{padding:"4px 10px",borderRadius:6,fontSize:11,background:k.running?"rgba(34,197,94,0.06)":"rgba(255,255,255,0.02)",border:`1px solid ${k.running?"rgba(34,197,94,0.12)":"rgba(255,255,255,0.04)"}`,color:k.running?"#86efac":"#64748b",display:"flex",alignItems:"center",gap:4},children:[p.jsx("span",{children:_e(k.type)}),k.name||k.type,p.jsx("span",{style:{width:4,height:4,borderRadius:"50%",background:k.running?"#22c55e":"#475569"}})]},k.type))})]})]}),A==="ides"&&p.jsxs("div",{children:[p.jsxs("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:["Running (",Te.length,")"]}),Te.length===0?p.jsx("div",{style:{padding:"40px 20px",textAlign:"center",borderRadius:12,background:"rgba(15,23,42,0.4)",border:"1px dashed rgba(255,255,255,0.06)",color:"#475569",fontSize:13,marginBottom:20},children:"No IDEs currently running. Launch one below."}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10,marginBottom:20},children:Te.map(k=>{var Z,ve;return p.jsxs("div",{style:{padding:"14px 18px",borderRadius:12,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(255,255,255,0.06)"},children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx("span",{style:{fontSize:18},children:_e(k.type)}),p.jsx("span",{style:{fontWeight:600,fontSize:14,color:"#f1f5f9"},children:Ar(k.type)}),k.version&&p.jsxs("span",{style:{fontSize:10,color:"#475569"},children:["v",k.version]}),p.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#22c55e",boxShadow:"0 0 6px rgba(34,197,94,0.3)"}})]}),p.jsxs("div",{style:{display:"flex",gap:6},children:[p.jsx("button",{onClick:()=>t(`/ide/${k.id}`),className:"machine-btn",children:"🖥 Control"}),p.jsx("button",{onClick:()=>an(k),className:"machine-btn",style:{color:"#f59e0b",borderColor:"rgba(245,158,11,0.3)"},children:"↻ Restart"})]})]}),p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:6,fontSize:12,color:"#94a3b8"},children:[p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"Workspace:"})," ",((Z=k.workspaceFolders)==null?void 0:Z.map(we=>we.name).join(", "))||"—"]}),p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"File:"})," ",((ve=k.activeFile)==null?void 0:ve.split("/").pop())||"—"]}),p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"Terminals:"})," ",k.terminals]}),p.jsxs("div",{children:[p.jsx("span",{style:{color:"#64748b"},children:"CDP:"})," ",k.cdpconnected?"● connected":"○ Off"]})]}),k.aiAgents.length>0&&p.jsx("div",{style:{display:"flex",gap:4,marginTop:8,flexWrap:"wrap"},children:k.aiAgents.map(we=>p.jsxs("span",{style:{padding:"2px 8px",borderRadius:6,fontSize:10,background:we.status==="generating"||we.status==="streaming"?"rgba(249,115,22,0.08)":"rgba(99,102,241,0.06)",color:we.status==="generating"||we.status==="streaming"?"#fb923c":"#818cf8"},children:[we.name," · ",we.status]},we.id))})]},k.id)})}),p.jsxs("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:["Available to Launch (",Qe.length,")"]}),p.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[Qe.map(k=>p.jsxs("button",{onClick:()=>mr(k.type||k.id||""),disabled:!!_,className:"machine-btn-primary",style:{opacity:_&&_!==k.type?.4:1,display:"flex",alignItems:"center",gap:6},children:[p.jsx("span",{children:_e(k.type)}),_===k.type?"⏳ Launching...":`▶ ${k.name||Ar(k.type)}`]},k.type)),Qe.length===0&&p.jsxs("div",{style:{fontSize:12,color:"#475569",fontStyle:"italic"},children:["All detected IDEs are running, or none detected.",p.jsx("button",{onClick:Hr,className:"machine-btn",style:{marginLeft:8},children:"🔍 Scan"})]})]})]}),A==="clis"&&p.jsxs("div",{children:[p.jsxs("div",{style:{padding:"16px 20px",borderRadius:12,marginBottom:20,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(139,92,246,0.12)"},children:[p.jsx("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:"Launch New CLI"}),p.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[p.jsx("select",{value:I,onChange:k=>M(k.target.value),className:"machine-input",children:z.length>0?z.map(k=>p.jsxs("option",{value:k.type,children:[k.icon," ",k.displayName]},k.type)):p.jsx("option",{value:"",disabled:!0,children:"No providers available"})}),p.jsx("input",{type:"text",placeholder:"Working directory...",value:j,onChange:k=>H(k.target.value),className:"machine-input",style:{flex:1,minWidth:200}}),p.jsx("input",{type:"text",placeholder:"Args (optional)",value:U,onChange:k=>E(k.target.value),className:"machine-input",style:{minWidth:150}}),(()=>{const k=z.find(Z=>Z.type===I);return(k==null?void 0:k.category)==="acp"?p.jsx("input",{type:"text",placeholder:"Model (default)",value:L,onChange:Z=>W(Z.target.value),className:"machine-input",style:{minWidth:120}}):null})(),p.jsx("button",{onClick:()=>nr(I,j,U||void 0,L||void 0),className:"machine-btn-primary",children:"▶ Launch"})]})]}),p.jsxs("div",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:10},children:["Running (",ye.length,")"]}),ye.length===0?p.jsx("div",{style:{padding:"30px 20px",textAlign:"center",borderRadius:12,background:"rgba(15,23,42,0.4)",border:"1px dashed rgba(255,255,255,0.06)",color:"#475569",fontSize:13,marginBottom:20},children:"No CLIs running"}):p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:20},children:ye.map(k=>p.jsxs("div",{style:{padding:"12px 16px",borderRadius:10,background:"rgba(15,23,42,0.5)",border:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[p.jsx("span",{style:{fontSize:18},children:_e(k.type)}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:600,fontSize:13,color:"#f1f5f9"},children:k.cliName}),p.jsx("div",{style:{fontSize:11,color:"#64748b"},children:k.workingDir})]})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[p.jsx("span",{style:{padding:"2px 8px",borderRadius:6,fontSize:10,fontWeight:600,background:k.status==="stopped"?"rgba(239,68,68,0.08)":"rgba(34,197,94,0.08)",color:k.status==="stopped"?"#ef4444":"#22c55e"},children:k.status}),k.status==="stopped"?p.jsx("button",{onClick:()=>nr(k.type,k.workingDir),className:"machine-btn",style:{color:"#22c55e",borderColor:"rgba(34,197,94,0.3)"},children:"▶"}):p.jsx("button",{onClick:()=>Wr(k.type,k.workingDir),className:"machine-btn",style:{color:"#ef4444",borderColor:"rgba(239,68,68,0.3)"},children:"■"})]})]},k.id))}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"History"}),p.jsx("button",{onClick:Ur,disabled:$,className:"machine-btn",children:$?"⏳":"↻ Load"})]}),K.length>0&&p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,maxHeight:200,overflowY:"auto"},children:K.map((k,Z)=>{var ve,we;return p.jsxs("div",{onClick:()=>{M(k.cliType),H(k.dir),E((k.cliArgs||[]).join(" "))},style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",borderRadius:6,cursor:"pointer",background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.04)",fontSize:12,transition:"background 0.15s"},onMouseEnter:Ae=>Ae.currentTarget.style.background="rgba(255,255,255,0.06)",onMouseLeave:Ae=>Ae.currentTarget.style.background="rgba(255,255,255,0.02)",children:[p.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",color:"#94a3b8"},children:[p.jsx("span",{children:_e(k.cliType)}),p.jsx("span",{children:((ve=k.dir)==null?void 0:ve.split("/").filter(Boolean).pop())||"root"}),((we=k.cliArgs)==null?void 0:we.length)>0&&p.jsx("span",{style:{color:"#475569",fontSize:10},children:k.cliArgs.join(" ")})]}),p.jsx("span",{style:{color:"#475569",fontSize:10},children:k.timestamp?new Date(k.timestamp).toLocaleDateString():""})]},Z)})}),p.jsxs("div",{style:{marginTop:20},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:"Recent Workspaces"}),p.jsx("button",{onClick:Tr,disabled:R,className:"machine-btn",children:R?"⏳":"↻ Load"})]}),y.length>0&&p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:y.map((k,Z)=>p.jsxs("button",{onClick:()=>H(k),className:"machine-btn",style:{maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:k,children:["📂 ",k.split("/").filter(Boolean).pop()||k]},Z))})]})]}),A==="logs"&&p.jsxs("div",{children:[p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[p.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[p.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginRight:8},children:"Level"}),["debug","info","warn","error"].map(k=>p.jsx("button",{onClick:()=>{w(k),h([]),d(0)},className:"machine-btn",style:{fontSize:10,padding:"2px 8px",background:m===k?"rgba(139,92,246,0.15)":void 0,borderColor:m===k?"rgba(139,92,246,0.4)":void 0,color:m===k?"#a78bfa":void 0},children:k.toUpperCase()},k))]}),p.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[p.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[c.length," entries"]}),p.jsx("button",{onClick:()=>g(!f),className:"machine-btn",style:{color:f?"#22c55e":"#64748b",borderColor:f?"rgba(34,197,94,0.3)":void 0},children:f?"⏸ Pause":"▶ Resume"}),p.jsx("button",{onClick:()=>{h([]),d(0)},className:"machine-btn",children:"Clear"})]})]}),p.jsxs("div",{style:{background:"rgba(15, 23, 42, 0.6)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:12,padding:12,minHeight:200,maxHeight:500,overflowY:"auto",fontFamily:"'JetBrains Mono', monospace",fontSize:11,lineHeight:1.6},children:[c.length===0&&p.jsx("div",{style:{padding:40,textAlign:"center",color:"#475569"},children:"Loading daemon logs..."}),c.map((k,Z)=>p.jsxs("div",{style:{display:"flex",gap:8,padding:"2px 0",color:k.level==="error"?"#ef4444":k.level==="warn"?"#f59e0b":k.level==="debug"?"#64748b":"#94a3b8"},children:[p.jsx("span",{style:{color:"#475569",minWidth:75,flexShrink:0},children:new Date(k.timestamp).toLocaleTimeString()}),p.jsx("span",{style:{fontWeight:600,minWidth:32,flexShrink:0,fontSize:9,color:k.level==="error"?"#ef4444":k.level==="warn"?"#f59e0b":k.level==="debug"?"#475569":"#8b5cf6"},children:k.level==="error"?"ERR":k.level==="warn"?"WRN":k.level==="debug"?"DBG":"INF"}),p.jsx("span",{children:k.message})]},Z)),p.jsx("div",{ref:ie})]})]})]})]})}function I3(){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 Tm=I3(),Rm=3e3,L3=3e4;let Yr=null,P3=0;const ha=new Map,Oh=new Set;let ks=null;async function Il(e,t,r){const n=Yr;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++P3}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{ha.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);ha.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),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 D3{constructor(t){os(this,"daemonId");os(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(Yr==null?void 0:Yr.readyState)===WebSocket.OPEN}get connectionState(){return(Yr==null?void 0:Yr.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return Il(this.daemonId,t,r)}async sendInput(t,r){return Il(this.daemonId,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){if(this.screenshotIdeType=t||null,ks)return;const r=async()=>{if(this.hasCommandChannel)try{const n=await Il(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());Oh.forEach(s=>s(this.daemonId,i))}}catch{}};r(),ks=setInterval(r,2e3)}stopScreenshots(t){ks&&(clearInterval(ks),ks=null)}}let Wn=null;function M3(e){(!Wn||Wn.daemonId!==e)&&(Wn=new D3(e));try{const{connectionManager:t}=require("@adhdev/web-core"),r=t.get.bind(t);t.get=n=>n===e?Wn:r(n),t.getState=n=>n===e&&(Wn==null?void 0:Wn.connectionState)||"disconnected",t.onScreenshot=n=>(Oh.add(n),()=>{Oh.delete(n)})}catch{}}function A3({children:e}){const t=b.useRef(Lp()),r=Lp();t.current=r;const[,n]=b.useState("disconnected"),i=b.useRef(null),s=b.useRef(),o=b.useRef(Rm),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 ${Tm}...`);let h;try{h=new WebSocket(Tm)}catch(f){console.error("[Standalone WS] Failed to create WebSocket:",f),c();return}i.current=h,h.onopen=()=>{if(!l.current){h.close();return}n("connected"),o.current=Rm,console.log("[Standalone WS] Connected")},Yr=h,h.onmessage=f=>{var g;try{const m=JSON.parse(f.data);if((m.type==="command_result"||m.type==="error")&&m.requestId){const w=ha.get(m.requestId);w&&(ha.delete(m.requestId),m.type==="error"?w.reject(new Error(((g=m.data)==null?void 0:g.message)||"Command failed")):w.resolve(m.data));return}if(m.type==="status"||m.type==="initial_state"){const w=m.data;if(!w)return;const{injectEntries:_,markLoaded:v}=t.current,y=[],T=w.id||"standalone";M3(T),y.push({id:T,type:"adhdev-daemon",status:"online",daemonMode:!0,machine:{hostname:w.hostname,platform:w.platform,...w.system||{}},system:w.system||null,timestamp:w.timestamp,cdpConnected:w.cdpConnected,detectedIdes:w.detectedIdes||[],availableProviders:w.availableProviders||[],managedIdeIds:(w.ides||[]).map(R=>R.id),managedCliIds:(w.clis||[]).map(R=>R.id)});for(const R of w.ides||[])y.push({...R,daemonId:w.id||"standalone",status:R.cdpConnected?"online":"detected"});for(const R of w.clis||[])y.push({...R,daemonId:w.id||"standalone",status:R.isRunning?"running":"stopped"});y.length>0&&_(y),v()}}catch(m){console.error("[Standalone WS] Parse error:",m)}},h.onclose=()=>{l.current&&(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,L3),a()},h)}return a(),()=>{l.current=!1,clearTimeout(s.current),i.current&&(i.current.onclose=null,i.current.close(),i.current=null,Yr=null)}},[]),p.jsx(p.Fragment,{children:e})}function B3({children:e}){return p.jsx(Fw,{children:p.jsx(A3,{children:e})})}const N3=[{id:"dashboard",path:"/dashboard",icon:"🌊",label:"Dashboard"},{id:"machine",path:"/machine",icon:"🐇",label:"Burrow"}];function z3({children:e}){const t=ts(),r=Co(),[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:N3.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.jsx("div",{style:{padding:"8px 12px",fontSize:12,color:"var(--text-muted)"},children:"Selfhost Mode"}),p.jsxs("div",{className:"nav-item",onClick:a,title:s?"Expand sidebar":"Collapse sidebar",style:{cursor:"pointer",justifyContent:s?"center":void 0,padding:s?"10px 0":void 0},children:[p.jsx("span",{className:"nav-icon",style:{fontSize:16},children:s?"›":"‹"}),!s&&p.jsx("span",{style:{fontSize:12},children:"Collapse"})]})]})]}),p.jsx("main",{className:"main-content",style:{position:"relative"},children:p.jsx("div",{className:"main-content-inner",children:e})})]})}function Im(){const{ides:e}=ly(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?p.jsx(yl,{to:`/machines/${t.id}`,replace:!0}):e.length>0?p.jsx(yl,{to:`/machines/${e[0].id}`,replace:!0}):p.jsx(yl,{to:"/dashboard",replace:!0})}function O3(){return p.jsx(zw,{children:p.jsx(B3,{children:p.jsx(Uw,{value:{sendCommand:Il,sendData:()=>!1},children:p.jsx(z3,{children:p.jsxs(Mw,{children:[p.jsx(Kn,{path:"/dashboard",element:p.jsx(C3,{})}),p.jsx(Kn,{path:"/ide/:id",element:p.jsx(T3,{})}),p.jsx(Kn,{path:"/machine",element:p.jsx(Im,{})}),p.jsx(Kn,{path:"/machines/:id",element:p.jsx(R3,{})}),p.jsx(Kn,{path:"/machines",element:p.jsx(Im,{})}),p.jsx(Kn,{path:"*",element:p.jsx(yl,{to:"/dashboard",replace:!0})})]})})})})})}Kv(document.getElementById("root")).render(p.jsx(b.StrictMode,{children:p.jsx(O3,{})}));